42#include <com/sun/star/awt/Toolkit.hpp>
43#include <com/sun/star/awt/XDevice.hpp>
44#include <com/sun/star/awt/XTopWindow.hpp>
45#include <com/sun/star/awt/PosSize.hpp>
46#include <com/sun/star/beans/PropertyAttribute.hpp>
47#include <com/sun/star/beans/PropertyExistException.hpp>
48#include <com/sun/star/beans/PropertyValue.hpp>
49#include <com/sun/star/beans/XPropertySet.hpp>
50#include <com/sun/star/container/XIndexAccess.hpp>
51#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
52#include <com/sun/star/frame/XFrame2.hpp>
53#include <com/sun/star/frame/XModel.hpp>
54#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
55#include <com/sun/star/frame/LayoutManager.hpp>
56#include <com/sun/star/frame/XDesktop.hpp>
57#include <com/sun/star/frame/FrameSearchFlag.hpp>
58#include <com/sun/star/lang/DisposedException.hpp>
59#include <com/sun/star/task/StatusIndicatorFactory.hpp>
60#include <com/sun/star/task/theJobExecutor.hpp>
61#include <com/sun/star/task/XJobExecutor.hpp>
62#include <com/sun/star/util/CloseVetoException.hpp>
63#include <com/sun/star/util/URLTransformer.hpp>
64#include <com/sun/star/util/XURLTransformer.hpp>
65#include <com/sun/star/util/XCloseable.hpp>
66#include <com/sun/star/lang/XServiceInfo.hpp>
107 public cppu::PartialWeakComponentImplHelper<
108 css::lang::XServiceInfo, css::frame::XFrame2, css::awt::XWindowListener,
109 css::awt::XTopWindowListener, css::awt::XFocusListener,
110 css::document::XActionLockable, css::util::XCloseable,
111 css::frame::XComponentLoader, css::frame::XTitle,
112 css::frame::XTitleChangeBroadcaster, css::beans::XPropertySet,
113 css::beans::XPropertySetInfo>
117 explicit XFrameImpl(css::uno::Reference< css::uno::XComponentContext > xContext);
120 void initListeners();
124 return "com.sun.star.comp.framework.Frame";
134 return {
"com.sun.star.frame.Frame"};
139 virtual css::uno::Reference< css::lang::XComponent > SAL_CALL loadComponentFromURL(
140 const OUString& sURL,
141 const OUString& sTargetFrameName,
142 sal_Int32 nSearchFlags,
143 const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
override;
147 virtual css::uno::Reference < css::frame::XFrames > SAL_CALL getFrames()
override;
148 virtual css::uno::Reference < css::frame::XFrame > SAL_CALL getActiveFrame()
override;
149 virtual void SAL_CALL setActiveFrame(
const css::uno::Reference < css::frame::XFrame > & xFrame)
override;
153 virtual void SAL_CALL initialize(
const css::uno::Reference < css::awt::XWindow > & xWindow)
override;
154 virtual css::uno::Reference < css::awt::XWindow > SAL_CALL getContainerWindow()
override;
155 virtual void SAL_CALL setCreator(
const css::uno::Reference < css::frame::XFramesSupplier > & xCreator)
override;
156 virtual css::uno::Reference < css::frame::XFramesSupplier > SAL_CALL getCreator()
override;
157 virtual OUString SAL_CALL getName()
override;
158 virtual void SAL_CALL setName(
const OUString & sName)
override;
159 virtual css::uno::Reference < css::frame::XFrame > SAL_CALL findFrame(
160 const OUString & sTargetFrameName,
161 sal_Int32 nSearchFlags)
override;
162 virtual sal_Bool SAL_CALL isTop()
override;
163 virtual void SAL_CALL activate()
override;
164 virtual void SAL_CALL deactivate()
override;
166 virtual void SAL_CALL contextChanged()
override;
167 virtual sal_Bool SAL_CALL setComponent(
168 const css::uno::Reference < css::awt::XWindow > & xComponentWindow,
169 const css::uno::Reference < css::frame::XController > & xController)
override;
170 virtual css::uno::Reference < css::awt::XWindow > SAL_CALL getComponentWindow()
override;
171 virtual css::uno::Reference < css::frame::XController > SAL_CALL getController()
override;
172 virtual void SAL_CALL addFrameActionListener(
const css::uno::Reference < css::frame::XFrameActionListener > & xListener)
override;
173 virtual void SAL_CALL removeFrameActionListener(
const css::uno::Reference < css::frame::XFrameActionListener > & xListener)
override;
177 virtual void SAL_CALL disposing()
override;
178 virtual void SAL_CALL addEventListener(
const css::uno::Reference < css::lang::XEventListener > & xListener)
override;
179 virtual void SAL_CALL removeEventListener(
const css::uno::Reference < css::lang::XEventListener > & xListener)
override;
183 virtual css::uno::Reference < css::task::XStatusIndicator > SAL_CALL createStatusIndicator()
override;
187 virtual css::uno::Reference < css::frame::XDispatch > SAL_CALL queryDispatch(
const css::util::URL & aURL,
188 const OUString & sTargetFrameName,
189 sal_Int32 nSearchFlags)
override;
190 virtual css::uno::Sequence < css::uno::Reference < css::frame::XDispatch > > SAL_CALL queryDispatches(
191 const css::uno::Sequence < css::frame::DispatchDescriptor > & lDescriptor)
override;
195 virtual void SAL_CALL registerDispatchProviderInterceptor(
196 const css::uno::Reference < css::frame::XDispatchProviderInterceptor > & xInterceptor)
override;
197 virtual void SAL_CALL releaseDispatchProviderInterceptor(
198 const css::uno::Reference < css::frame::XDispatchProviderInterceptor > & xInterceptor)
override;
202 virtual css::uno::Sequence < sal_Int16 > SAL_CALL getSupportedCommandGroups()
override;
203 virtual css::uno::Sequence < css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation(sal_Int16 nCommandGroup)
override;
208 virtual void SAL_CALL
windowResized(
const css::awt::WindowEvent & aEvent)
override;
209 virtual void SAL_CALL
windowMoved(
const css::awt::WindowEvent & )
override {};
210 virtual void SAL_CALL
windowShown(
const css::lang::EventObject & aEvent)
override;
211 virtual void SAL_CALL
windowHidden(
const css::lang::EventObject & aEvent)
override;
216 virtual void SAL_CALL
focusGained(
const css::awt::FocusEvent & aEvent)
override;
217 virtual void SAL_CALL
focusLost(
const css::awt::FocusEvent & )
override {};
222 virtual void SAL_CALL
windowActivated(
const css::lang::EventObject & aEvent)
override;
223 virtual void SAL_CALL
windowDeactivated(
const css::lang::EventObject & aEvent)
override;
224 virtual void SAL_CALL
windowOpened(
const css::lang::EventObject & )
override {};
225 virtual void SAL_CALL
windowClosing(
const css::lang::EventObject & aEvent)
override;
226 virtual void SAL_CALL
windowClosed(
const css::lang::EventObject & )
override {};
227 virtual void SAL_CALL
windowMinimized(
const css::lang::EventObject & )
override {};
228 virtual void SAL_CALL
windowNormalized(
const css::lang::EventObject & )
override {};
232 virtual void SAL_CALL disposing(
const css::lang::EventObject & aEvent)
override;
236 virtual sal_Bool SAL_CALL isActionLocked()
override;
237 virtual void SAL_CALL addActionLock()
override;
238 virtual void SAL_CALL removeActionLock()
override;
239 virtual void SAL_CALL setActionLocks(sal_Int16 nLock)
override;
240 virtual sal_Int16 SAL_CALL resetActionLocks()
override;
244 virtual void SAL_CALL
close(
sal_Bool bDeliverOwnership)
override;
248 virtual void SAL_CALL addCloseListener(
const css::uno::Reference < css::util::XCloseListener > & xListener)
override;
249 virtual void SAL_CALL removeCloseListener(
const css::uno::Reference < css::util::XCloseListener > & xListener)
override;
253 virtual OUString SAL_CALL
getTitle()
override;
254 virtual void SAL_CALL setTitle(
const OUString & sTitle)
override;
258 virtual void SAL_CALL addTitleChangeListener(
const css::uno::Reference < css::frame::XTitleChangeListener > & xListener)
override;
259 virtual void SAL_CALL removeTitleChangeListener(
const css::uno::Reference < css::frame::XTitleChangeListener > & xListenr)
override;
263 virtual css::uno::Reference < css::container::XNameContainer > SAL_CALL getUserDefinedAttributes()
override;
265 virtual css::uno::Reference < css::frame::XDispatchRecorderSupplier > SAL_CALL getDispatchRecorderSupplier()
override;
266 virtual void SAL_CALL setDispatchRecorderSupplier(
const css::uno::Reference < css::frame::XDispatchRecorderSupplier > & )
override;
268 virtual css::uno::Reference < css::uno::XInterface > SAL_CALL getLayoutManager()
override;
269 virtual void SAL_CALL setLayoutManager(
const css::uno::Reference < css::uno::XInterface > & )
override;
272 virtual css::uno::Reference < css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
override;
274 virtual void SAL_CALL
setPropertyValue(
const OUString & sProperty,
const css::uno::Any & aValue)
override;
276 virtual css::uno::Any SAL_CALL
getPropertyValue(
const OUString & sProperty)
override;
278 virtual void SAL_CALL addPropertyChangeListener(
279 const OUString & sProperty,
280 const css::uno::Reference < css::beans::XPropertyChangeListener > & xListener)
override;
282 virtual void SAL_CALL removePropertyChangeListener(
283 const OUString & sProperty,
284 const css::uno::Reference < css::beans::XPropertyChangeListener > & xListener)
override;
286 virtual void SAL_CALL addVetoableChangeListener(
287 const OUString & sProperty,
288 const css::uno::Reference < css::beans::XVetoableChangeListener > & xListener)
override;
290 virtual void SAL_CALL removeVetoableChangeListener(
291 const OUString & sProperty,
292 const css::uno::Reference < css::beans::XVetoableChangeListener > & xListener)
override;
295 virtual css::uno::Sequence < css::beans::Property > SAL_CALL getProperties()
override;
297 virtual css::beans::Property SAL_CALL getPropertyByName(
const OUString & sName)
override;
299 virtual sal_Bool SAL_CALL hasPropertyByName(
const OUString & sName)
override;
304 void impl_setPropertyValue(sal_Int32 nHandle,
305 const css::uno::Any& aValue);
307 css::uno::Any impl_getPropertyValue(sal_Int32 nHandle);
314 void impl_setPropertyChangeBroadcaster(
const css::uno::Reference< css::uno::XInterface >& xBroadcaster);
329 void impl_addPropertyInfo(
const css::beans::Property& aProperty);
333 void impl_disablePropertySet();
335 bool impl_existsVeto(
const css::beans::PropertyChangeEvent& aEvent);
337 void impl_notifyChangeListener(
const css::beans::PropertyChangeEvent& aEvent);
347 void implts_sendFrameActionEvent (
const css::frame::FrameAction& aAction );
348 void implts_resizeComponentWindow ( );
349 void implts_setIconOnWindow ( );
350 void implts_startWindowListening ( );
351 void implts_stopWindowListening ( );
352 void implts_checkSuicide ( );
353 void implts_forgetSubFrames ( );
356 void impl_checkMenuCloser ( );
357 void impl_setCloser (
const css::uno::Reference< css::frame::XFrame2 >& xFrame ,
bool bState );
359 void disableLayoutManager(
const css::uno::Reference< css::frame::XLayoutManager2 >& xLayoutManager);
362 osl::MutexGuard g(rBHelper.rMutex);
363 if (rBHelper.bInDispose || rBHelper.bDisposed) {
364 throw css::lang::DisposedException(
"Frame disposed");
372 css::uno::Reference< css::uno::XComponentContext >
m_xContext;
374 css::uno::Reference< css::task::XStatusIndicatorFactory > m_xIndicatorFactoryHelper;
376 css::uno::WeakReference< css::task::XStatusIndicator > m_xIndicatorInterception;
380 css::uno::Reference< css::frame::XFrames > m_xFramesHelper;
384 css::uno::Reference< css::frame::XFramesSupplier > m_xParent;
386 css::uno::Reference< css::awt::XWindow > m_xContainerWindow;
388 css::uno::Reference< css::awt::XWindow > m_xComponentWindow;
390 css::uno::Reference< css::frame::XController > m_xController;
392 css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > m_xDropTargetListener;
394 EActiveState m_eActiveState;
401 sal_Int16 m_nExternalLockCount;
403 css::uno::Reference< css::frame::XDispatchRecorderSupplier > m_xDispatchRecorderSupplier;
411 bool m_bDocHidden =
false;
414 css::uno::Reference< css::frame::XDispatchInformationProvider > m_xDispatchInfoHelper;
415 css::uno::Reference< css::frame::XTitle > m_xTitleHelper;
417 std::unique_ptr<WindowCommandDispatch> m_pWindowCommandDispatch;
419 typedef std::unordered_map<OUString, css::beans::Property> TPropInfoHash;
420 TPropInfoHash m_lProps;
426 css::uno::WeakReference< css::uno::XInterface > m_xBroadcaster;
456XFrameImpl::XFrameImpl( css::uno::Reference< css::uno::XComponentContext > xContext )
457 : PartialWeakComponentImplHelper(
m_aMutex)
461 , m_eActiveState ( E_INACTIVE )
462 , m_bIsFrameTop ( true )
463 , m_bConnected ( false )
464 , m_nExternalLockCount ( 0 )
465 , m_bSelfClose ( false )
466 , m_bIsHidden ( true )
467 , m_lSimpleChangeListener (
m_aMutex )
468 , m_lVetoChangeListener (
m_aMutex )
472void XFrameImpl::initListeners()
474 css::uno::Reference< css::uno::XInterface > xThis(
static_cast< ::
cppu::OWeakObject*
>(
this), css::uno::UNO_QUERY_THROW);
493 m_xFramesHelper =
new OFrames(
this, &m_aChildFrameContainer );
497 m_xDropTargetListener =
new OpenFileDropTargetListener(
m_xContext,
this );
501 SAL_WARN_IF( !xDispatchProvider.is(),
"fwk.frame",
"XFrameImpl::XFrameImpl(): Slowest slave for dispatch- and interception helper "
502 "is not valid. XDispatchProvider, XDispatch, XDispatchProviderInterception are not full supported!" );
503 SAL_WARN_IF( !m_xDispatchHelper.is(),
"fwk.frame",
"XFrameImpl::XFrameImpl(): Interception helper is not valid. XDispatchProvider, "
504 "XDispatch, XDispatchProviderInterception are not full supported!" );
505 SAL_WARN_IF( !m_xFramesHelper.is(),
"fwk.frame",
"XFrameImpl::XFrameImpl(): Frames helper is not valid. XFrames, "
506 "XIndexAccess and XElementAccess are not supported!" );
507 SAL_WARN_IF( !m_xDropTargetListener.is(),
"fwk.frame",
"XFrameImpl::XFrameImpl(): DropTarget helper is not valid. "
508 "Drag and drop without functionality!" );
511 m_aCommandOptions.EstablishFrameCallback(
this);
518 impl_setPropertyChangeBroadcaster(
static_cast< css::frame::XFrame*
>(
this));
519 impl_addPropertyInfo(
520 css::beans::Property(
524 css::beans::PropertyAttribute::TRANSIENT));
525 impl_addPropertyInfo(
526 css::beans::Property(
530 css::beans::PropertyAttribute::TRANSIENT));
531 impl_addPropertyInfo(
532 css::beans::Property(
536 css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY));
537 impl_addPropertyInfo(
538 css::beans::Property(
542 css::beans::PropertyAttribute::TRANSIENT));
543 impl_addPropertyInfo(
544 css::beans::Property(
548 css::beans::PropertyAttribute::TRANSIENT));
551 css::beans::PropertyAttribute::TRANSIENT));
570css::uno::Reference< css::lang::XComponent > SAL_CALL XFrameImpl::loadComponentFromURL(
571 const OUString& sURL,
572 const OUString& sTargetFrameName,
573 sal_Int32 nSearchFlags,
574 const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
578 css::uno::Reference< css::frame::XComponentLoader > xThis(
this);
581 bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault(
"OnMainThread",
false);
592 nSearchFlags, lArguments));
595 return LoadEnv::loadComponentFromURL(xThis,
m_xContext, sURL, sTargetFrameName,
596 nSearchFlags, lArguments);
610css::uno::Reference< css::frame::XFrames > SAL_CALL XFrameImpl::getFrames()
617 return m_xFramesHelper;
633css::uno::Reference< css::frame::XFrame > SAL_CALL XFrameImpl::getActiveFrame()
640 return m_aChildFrameContainer.getActive();
655void SAL_CALL XFrameImpl::setActiveFrame(
const css::uno::Reference< css::frame::XFrame >& xFrame )
664 css::uno::Reference< css::frame::XFrame > xActiveChild = m_aChildFrameContainer.getActive();
665 EActiveState eActiveState = m_eActiveState;
672 if( xActiveChild != xFrame )
675 m_aChildFrameContainer.setActive( xFrame );
677 ( eActiveState != E_INACTIVE ) &&
681 xActiveChild->deactivate();
689 if( eActiveState == E_FOCUS )
692 eActiveState = E_ACTIVE;
693 m_eActiveState = eActiveState;
695 implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_DEACTIVATING );
701 if ( eActiveState == E_ACTIVE && !
xFrame->isActive() )
708 if( eActiveState == E_ACTIVE )
711 eActiveState = E_FOCUS;
712 m_eActiveState = eActiveState;
714 implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_ACTIVATED );
721void lcl_enableLayoutManager(
const css::uno::Reference< css::frame::XLayoutManager2 >& xLayoutManager,
722 const css::uno::Reference< css::frame::XFrame >& xFrame )
725 xLayoutManager->attachFrame(xFrame);
727 xFrame->addFrameActionListener(xLayoutManager);
730 xLayoutManager->setDockingAreaAcceptor(xDockingAreaAcceptor);
736void XFrameImpl::disableLayoutManager(
const css::uno::Reference< css::frame::XLayoutManager2 >& xLayoutManager)
738 removeFrameActionListener(xLayoutManager);
739 xLayoutManager->setDockingAreaAcceptor(css::uno::Reference< css::ui::XDockingAreaAcceptor >());
740 xLayoutManager->attachFrame(css::uno::Reference< css::frame::XFrame >());
756void SAL_CALL XFrameImpl::initialize(
const css::uno::Reference< css::awt::XWindow >& xWindow )
760 throw css::uno::RuntimeException(
761 "XFrameImpl::initialize() called without a valid container window reference.",
762 static_cast< css::frame::XFrame*
>(
this));
771 if ( m_xContainerWindow.is() )
772 throw css::uno::RuntimeException(
773 "XFrameImpl::initialized() is called more than once, which is not useful nor allowed.",
774 static_cast< css::frame::XFrame*
>(
this));
777 m_xContainerWindow = xWindow;
783 if (pWindow->IsVisible())
786 =
static_cast<bool>(pWindow->GetExtendedStyle() & WindowExtendedStyle::DocHidden);
789 css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager =
m_xLayoutManager;
798 if (xLayoutManager.is() && !m_bDocHidden)
799 lcl_enableLayoutManager(xLayoutManager,
this);
802 css::uno::Reference< css::frame::XFrame > xThis (
this);
803 css::uno::Reference< css::task::XStatusIndicatorFactory > xIndicatorFactory =
804 css::task::StatusIndicatorFactory::createWithFrame(
m_xContext, xThis,
809 m_xIndicatorFactoryHelper = xIndicatorFactory;
815 implts_startWindowListening();
835css::uno::Reference< css::awt::XWindow > SAL_CALL XFrameImpl::getContainerWindow()
838 return m_xContainerWindow;
858void SAL_CALL XFrameImpl::setCreator(
const css::uno::Reference< css::frame::XFramesSupplier >& xCreator )
865 m_xParent = xCreator;
869 css::uno::Reference< css::frame::XDesktop > xIsDesktop( xCreator, css::uno::UNO_QUERY );
870 m_bIsFrameTop = ( xIsDesktop.is() || ! xCreator.is() );
882css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL XFrameImpl::getCreator()
898OUString SAL_CALL XFrameImpl::getName()
916void SAL_CALL XFrameImpl::setName(
const OUString& sName )
921 if (TargetHelper::isValidNameForFrame(sName))
950css::uno::Reference< css::frame::XFrame > SAL_CALL XFrameImpl::findFrame(
const OUString& sTargetFrameName,
951 sal_Int32 nSearchFlags )
953 css::uno::Reference< css::frame::XFrame >
xTarget;
972 css::uno::Reference< css::frame::XFrame > xParent = m_xParent;
973 bool bIsTopFrame = m_bIsFrameTop;
974 bool bIsTopWindow = WindowHelper::isTopWindow(m_xContainerWindow);
1005 else if (xParent.is())
1014 ( sTargetFrameName.isEmpty() )
1041 else if (xParent.is())
1066 (nSearchFlags & css::frame::FrameSearchFlag::SELF) &&
1067 (sOwnName == sTargetFrameName )
1081 (nSearchFlags & css::frame::FrameSearchFlag::CHILDREN)
1084 xTarget = m_aChildFrameContainer.searchOnAllChildrens(sTargetFrameName);
1094 ( bIsTopFrame && (nSearchFlags & css::frame::FrameSearchFlag::TASKS) ) ||
1113 (nSearchFlags & css::frame::FrameSearchFlag::SIBLINGS) &&
1117 css::uno::Reference< css::frame::XFramesSupplier > xSupplier( xParent, css::uno::UNO_QUERY );
1120 css::uno::Reference< css::container::XIndexAccess > xContainer = xSupplier->getFrames();
1121 if (xContainer.is())
1123 sal_Int32
nCount = xContainer->getCount();
1124 for( sal_Int32 i=0;
i<
nCount; ++
i )
1126 css::uno::Reference< css::frame::XFrame > xSibling;
1129 ( !(xContainer->getByIndex(i)>>=xSibling) ) ||
1131 ( ! xSibling.is() ) ||
1141 sal_Int32 nRightFlags = css::frame::FrameSearchFlag::SELF;
1142 if (nSearchFlags & css::frame::FrameSearchFlag::CHILDREN)
1143 nRightFlags |= css::frame::FrameSearchFlag::CHILDREN;
1144 xTarget = xSibling->findFrame(sTargetFrameName, nRightFlags );
1160 (nSearchFlags & css::frame::FrameSearchFlag::PARENT) &&
1164 if (xParent->getName() == sTargetFrameName)
1168 sal_Int32 nRightFlags = nSearchFlags & ~css::frame::FrameSearchFlag::CHILDREN;
1169 xTarget = xParent->findFrame(sTargetFrameName, nRightFlags);
1180 (nSearchFlags & css::frame::FrameSearchFlag::CREATE)
1205sal_Bool SAL_CALL XFrameImpl::isTop()
1211 return m_bIsFrameTop;
1224void SAL_CALL XFrameImpl::activate()
1234 css::uno::Reference< css::frame::XFrame > xActiveChild = m_aChildFrameContainer.getActive();
1235 css::uno::Reference< css::frame::XFramesSupplier > xParent = m_xParent;
1236 css::uno::Reference< css::frame::XFrame > xThis(
this);
1237 EActiveState eState = m_eActiveState;
1243 if( eState == E_INACTIVE )
1248 m_eActiveState = eState;
1261 xParent->setActiveFrame( xThis );
1266 xParent->activate();
1271 implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_ACTIVATED );
1278 if ( eState == E_ACTIVE && xActiveChild.is() && !xActiveChild->isActive() )
1280 xActiveChild->activate();
1284 if ( eState == E_ACTIVE && !xActiveChild.is() )
1288 m_eActiveState = eState;
1290 implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_ACTIVATED );
1304void SAL_CALL XFrameImpl::deactivate()
1312 css::uno::Reference< css::frame::XFrame > xActiveChild = m_aChildFrameContainer.getActive();
1313 css::uno::Reference< css::frame::XFramesSupplier > xParent = m_xParent;
1314 css::uno::Reference< css::frame::XFrame > xThis(
this);
1315 EActiveState eState = m_eActiveState;
1321 if( eState == E_INACTIVE )
1326 if ( xActiveChild.is() && xActiveChild->isActive() )
1328 xActiveChild->deactivate();
1332 if( eState == E_FOCUS )
1338 m_eActiveState = eState;
1340 implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_DEACTIVATING );
1344 if( eState == E_ACTIVE )
1348 eState = E_INACTIVE;
1349 m_eActiveState = eState;
1351 implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_DEACTIVATING );
1358 if ( xParent.is() && xParent->getActiveFrame() == xThis )
1363 xParent->deactivate();
1378sal_Bool SAL_CALL XFrameImpl::isActive()
1382 return m_eActiveState == E_ACTIVE || m_eActiveState == E_FOCUS;
1388void SAL_CALL XFrameImpl::contextChanged()
1393 implts_sendFrameActionEvent( css::frame::FrameAction_CONTEXT_CHANGED );
1424sal_Bool SAL_CALL XFrameImpl::setComponent(
const css::uno::Reference< css::awt::XWindow >& xComponentWindow,
1425 const css::uno::Reference< css::frame::XController >& xController )
1430 if (
xController.is() && ! xComponentWindow.is() )
1438 css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow;
1439 css::uno::Reference< css::awt::XWindow > xOldComponentWindow = m_xComponentWindow;
1440 css::uno::Reference< css::frame::XController > xOldController = m_xController;
1442 bool bHadFocus = pOwnWindow !=
nullptr && pOwnWindow->HasChildPathFocus();
1443 bool bWasConnected = m_bConnected;
1451 implts_stopWindowListening();
1455 implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_DETACHING );
1462 (xOldController.is() ) &&
1463 (xOldController != xController)
1476 m_xController =
nullptr;
1478 if (m_xDispatchHelper)
1481 if (pDispatchProvider)
1483 pDispatchProvider->ClearProtocolHandlers();
1489 if (xOldController.is())
1493 xOldController->dispose();
1495 catch(
const css::lang::DisposedException&)
1498 xOldController =
nullptr;
1507 (xOldComponentWindow.is() ) &&
1508 (xOldComponentWindow != xComponentWindow)
1514 m_xComponentWindow =
nullptr;
1518 if (xOldComponentWindow.is())
1522 xOldComponentWindow->dispose();
1524 catch(
const css::lang::DisposedException&)
1528 xOldComponentWindow =
nullptr;
1535 m_xComponentWindow = xComponentWindow;
1541 m_bConnected = (m_xComponentWindow.is() || m_xController.is());
1542 bool bIsConnected = m_bConnected;
1547 if (bIsConnected && bWasConnected)
1548 implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_REATTACHED );
1549 else if (bIsConnected && !bWasConnected)
1550 implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_ATTACHED );
1554 if ( bHadFocus && xComponentWindow.is() )
1556 xComponentWindow->setFocus();
1561 implts_resizeComponentWindow();
1563 implts_setIconOnWindow();
1565 implts_startWindowListening();
1569 impl_checkMenuCloser();
1592css::uno::Reference< css::awt::XWindow > SAL_CALL XFrameImpl::getComponentWindow()
1596 return m_xComponentWindow;
1615css::uno::Reference< css::frame::XController > SAL_CALL XFrameImpl::getController()
1618 return m_xController;
1630void SAL_CALL XFrameImpl::addFrameActionListener(
const css::uno::Reference< css::frame::XFrameActionListener >& xListener )
1636void SAL_CALL XFrameImpl::removeFrameActionListener(
const css::uno::Reference< css::frame::XFrameActionListener >& xListener )
1660void SAL_CALL XFrameImpl::close(
sal_Bool bDeliverOwnership )
1667 css::uno::Reference< css::uno::XInterface > xSelfHold(
static_cast< ::
cppu::OWeakObject*
>(
this) );
1675 if (pContainer!=
nullptr)
1678 while (pIterator.hasMoreElements())
1682 static_cast<css::util::XCloseListener*
>(pIterator.next())->queryClosing( aSource, bDeliverOwnership );
1684 catch(
const css::uno::RuntimeException& )
1693 if (isActionLocked())
1695 if (bDeliverOwnership)
1698 m_bSelfClose =
true;
1701 throw css::util::CloseVetoException(
"Frame in use for loading document...",
static_cast< ::
cppu::OWeakObject*
>(
this));
1704 if ( ! setComponent(
nullptr,
nullptr) )
1705 throw css::util::CloseVetoException(
"Component couldn't be detached...",
static_cast< ::
cppu::OWeakObject*
>(
this));
1709 if (pContainer!=
nullptr)
1712 while (pIterator.hasMoreElements())
1716 static_cast<css::util::XCloseListener*
>(pIterator.next())->notifyClosing( aSource );
1718 catch(
const css::uno::RuntimeException& )
1731 impl_checkMenuCloser();
1751void SAL_CALL XFrameImpl::addCloseListener(
const css::uno::Reference< css::util::XCloseListener >& xListener )
1757void SAL_CALL XFrameImpl::removeCloseListener(
const css::uno::Reference< css::util::XCloseListener >& xListener )
1762OUString SAL_CALL XFrameImpl::getTitle()
1768 css::uno::Reference< css::frame::XTitle > xTitle(m_xTitleHelper, css::uno::UNO_SET_THROW);
1772 return xTitle->getTitle();
1775void SAL_CALL XFrameImpl::setTitle(
const OUString& sTitle )
1781 css::uno::Reference< css::frame::XTitle > xTitle(m_xTitleHelper, css::uno::UNO_SET_THROW);
1785 xTitle->setTitle(sTitle);
1788void SAL_CALL XFrameImpl::addTitleChangeListener(
const css::uno::Reference< css::frame::XTitleChangeListener >& xListener)
1794 css::uno::Reference< css::frame::XTitleChangeBroadcaster > xTitle(m_xTitleHelper, css::uno::UNO_QUERY_THROW);
1798 xTitle->addTitleChangeListener(xListener);
1801void SAL_CALL XFrameImpl::removeTitleChangeListener(
const css::uno::Reference< css::frame::XTitleChangeListener >& xListener )
1807 css::uno::Reference< css::frame::XTitleChangeBroadcaster > xTitle(m_xTitleHelper, css::uno::UNO_QUERY_THROW);
1811 xTitle->removeTitleChangeListener(xListener);
1814css::uno::Reference<css::container::XNameContainer> SAL_CALL XFrameImpl::getUserDefinedAttributes()
1820css::uno::Reference<css::frame::XDispatchRecorderSupplier> SAL_CALL XFrameImpl::getDispatchRecorderSupplier()
1823 return m_xDispatchRecorderSupplier;
1826void SAL_CALL XFrameImpl::setDispatchRecorderSupplier(
const css::uno::Reference<css::frame::XDispatchRecorderSupplier>& p)
1830 m_xDispatchRecorderSupplier.set(p);
1833css::uno::Reference<css::uno::XInterface> SAL_CALL XFrameImpl::getLayoutManager()
1839void SAL_CALL XFrameImpl::setLayoutManager(
const css::uno::Reference<css::uno::XInterface>& p1)
1844 css::uno::Reference<css::frame::XLayoutManager2> xOldLayoutManager =
m_xLayoutManager;
1845 css::uno::Reference<css::frame::XLayoutManager2> xNewLayoutManager(p1, css::uno::UNO_QUERY);
1847 if (xOldLayoutManager != xNewLayoutManager)
1850 if (xOldLayoutManager.is())
1851 disableLayoutManager(xOldLayoutManager);
1852 if (xNewLayoutManager.is() && !m_bDocHidden)
1853 lcl_enableLayoutManager(xNewLayoutManager,
this);
1857css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL XFrameImpl::getPropertySetInfo()
1860 return css::uno::Reference< css::beans::XPropertySetInfo >(
this);
1863void SAL_CALL XFrameImpl::setPropertyValue(
const OUString& sProperty,
1864 const css::uno::Any& aValue )
1873 TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
1874 if (pIt == m_lProps.end())
1875 throw css::beans::UnknownPropertyException(sProperty);
1877 css::beans::Property aPropInfo = pIt->second;
1879 css::uno::Any aCurrentValue = impl_getPropertyValue(aPropInfo.Handle);
1881 bool bWillBeChanged = (aCurrentValue != aValue);
1882 if (! bWillBeChanged)
1885 css::beans::PropertyChangeEvent
aEvent;
1886 aEvent.PropertyName = aPropInfo.Name;
1888 aEvent.PropertyHandle = aPropInfo.Handle;
1889 aEvent.OldValue = aCurrentValue;
1890 aEvent.NewValue = aValue;
1891 aEvent.Source.set(m_xBroadcaster.get(), css::uno::UNO_QUERY);
1893 if (impl_existsVeto(aEvent))
1894 throw css::beans::PropertyVetoException();
1896 impl_setPropertyValue(aPropInfo.Handle, aValue);
1898 impl_notifyChangeListener(aEvent);
1901css::uno::Any SAL_CALL XFrameImpl::getPropertyValue(
const OUString& sProperty)
1908 TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
1909 if (pIt == m_lProps.end())
1910 throw css::beans::UnknownPropertyException(sProperty);
1912 css::beans::Property aPropInfo = pIt->second;
1914 return impl_getPropertyValue(aPropInfo.Handle);
1917void SAL_CALL XFrameImpl::addPropertyChangeListener(
1918 const OUString& sProperty,
1919 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener)
1927 TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
1928 if (pIt == m_lProps.end())
1929 throw css::beans::UnknownPropertyException(sProperty);
1933 m_lSimpleChangeListener.addInterface(sProperty, xListener);
1936void SAL_CALL XFrameImpl::removePropertyChangeListener(
1937 const OUString& sProperty,
1938 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener)
1944 TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
1945 if (pIt == m_lProps.end())
1946 throw css::beans::UnknownPropertyException(sProperty);
1950 m_lSimpleChangeListener.removeInterface(sProperty, xListener);
1953void SAL_CALL XFrameImpl::addVetoableChangeListener(
1954 const OUString& sProperty,
1955 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener)
1963 TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
1964 if (pIt == m_lProps.end())
1965 throw css::beans::UnknownPropertyException(sProperty);
1969 m_lVetoChangeListener.addInterface(sProperty, xListener);
1972void SAL_CALL XFrameImpl::removeVetoableChangeListener(
1973 const OUString& sProperty,
1974 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener)
1980 TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
1981 if (pIt == m_lProps.end())
1982 throw css::beans::UnknownPropertyException(sProperty);
1986 m_lVetoChangeListener.removeInterface(sProperty, xListener);
1989css::uno::Sequence< css::beans::Property > SAL_CALL XFrameImpl::getProperties()
1995 sal_Int32 c =
static_cast<sal_Int32
>(m_lProps.size());
1996 css::uno::Sequence< css::beans::Property > lProps(c);
1997 auto lPropsRange = asNonConstRange(lProps);
1998 for (
auto const& elem : m_lProps)
2000 lPropsRange[--c] = elem.second;
2006css::beans::Property SAL_CALL XFrameImpl::getPropertyByName(
const OUString& sName)
2012 TPropInfoHash::const_iterator pIt = m_lProps.find(sName);
2013 if (pIt == m_lProps.end())
2014 throw css::beans::UnknownPropertyException(sName);
2019sal_Bool SAL_CALL XFrameImpl::hasPropertyByName(
const OUString& sName)
2025 TPropInfoHash::iterator pIt = m_lProps.find(sName);
2026 bool bExist = (pIt != m_lProps.end());
2032void XFrameImpl::implts_forgetSubFrames()
2036 css::uno::Reference< css::container::XIndexAccess > xContainer(m_xFramesHelper, css::uno::UNO_QUERY_THROW);
2040 sal_Int32 c = xContainer->getCount();
2047 css::uno::Reference< css::frame::XFrame >
xFrame;
2048 xContainer->getByIndex(i) >>=
xFrame;
2050 xFrame->setCreator(css::uno::Reference< css::frame::XFramesSupplier >());
2052 catch(
const css::uno::Exception&)
2060 m_xFramesHelper.clear();
2061 m_aChildFrameContainer.clear();
2078void SAL_CALL XFrameImpl::disposing()
2083 css::uno::Reference< css::frame::XFrame > xThis(
this);
2085 SAL_INFO(
"fwk.frame",
"[Frame] " << m_sName <<
" send dispose event to listener");
2090 implts_stopWindowListening();
2092 css::uno::Reference<css::frame::XLayoutManager2> layoutMgr;
2097 if (layoutMgr.is()) {
2098 disableLayoutManager(layoutMgr);
2101 std::unique_ptr<WindowCommandDispatch> disp;
2104 std::swap(disp, m_pWindowCommandDispatch);
2109 css::lang::EventObject
aEvent( xThis );
2110 m_aListenerContainer.disposeAndClear( aEvent );
2113 impl_disablePropertySet();
2117 css::uno::Reference< css::lang::XEventListener > xDispatchHelper;
2120 xDispatchHelper = m_xDispatchHelper;
2122 xDispatchHelper->disposing(aEvent);
2123 xDispatchHelper.clear();
2145 css::uno::Reference<css::frame::XFramesSupplier> parent;
2148 std::swap(parent, m_xParent);
2152 parent->getFrames()->remove( xThis );
2162 css::uno::Reference< css::lang::XComponent > xDisposableCtrl;
2163 css::uno::Reference< css::lang::XComponent > xDisposableComp;
2166 xDisposableCtrl = m_xController;
2167 xDisposableComp = m_xComponentWindow;
2169 if (xDisposableCtrl.is())
2170 xDisposableCtrl->dispose();
2171 if (xDisposableComp.is())
2172 xDisposableComp->dispose();
2174 impl_checkMenuCloser();
2176 css::uno::Reference<css::awt::XWindow> contWin;
2179 std::swap(contWin, m_xContainerWindow);
2183 contWin->setVisible(
false );
2199 implts_forgetSubFrames();
2206 m_xDispatchHelper.clear();
2207 m_xDropTargetListener.clear();
2208 m_xDispatchRecorderSupplier.clear();
2210 m_xIndicatorFactoryHelper.clear();
2215 m_eActiveState = E_INACTIVE;
2217 m_bIsFrameTop =
false;
2218 m_bConnected =
false;
2219 m_nExternalLockCount = 0;
2220 m_bSelfClose =
false;
2236void SAL_CALL XFrameImpl::addEventListener(
const css::uno::Reference< css::lang::XEventListener >& xListener )
2242void SAL_CALL XFrameImpl::removeEventListener(
const css::uno::Reference< css::lang::XEventListener >& xListener )
2258css::uno::Reference< css::task::XStatusIndicator > SAL_CALL XFrameImpl::createStatusIndicator()
2266 css::uno::Reference< css::task::XStatusIndicator > xExternal(m_xIndicatorInterception.get(), css::uno::UNO_QUERY);
2267 css::uno::Reference< css::task::XStatusIndicatorFactory >
xFactory = m_xIndicatorFactoryHelper;
2278 return xFactory->createStatusIndicator();
2280 return css::uno::Reference< css::task::XStatusIndicator >();
2301css::uno::Reference< css::frame::XDispatch > SAL_CALL XFrameImpl::queryDispatch(
const css::util::URL& aURL,
2302 const OUString& sTargetFrameName,
2303 sal_Int32 nSearchFlags)
2312 if (
aURL.Protocol.equalsIgnoreAsciiCase(
".uno:") )
2316 if ( m_aCommandOptions.LookupDisabled(
aCommand ) )
2317 return css::uno::Reference< css::frame::XDispatch >();
2321 css::uno::Reference<css::frame::XDispatchProvider> disp;
2324 disp = m_xDispatchHelper;
2327 throw css::lang::DisposedException(
"Frame disposed");
2329 return disp->queryDispatch( aURL, sTargetFrameName, nSearchFlags );
2345css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL XFrameImpl::queryDispatches(
2346 const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor )
2353 css::uno::Reference<css::frame::XDispatchProvider> disp;
2356 disp = m_xDispatchHelper;
2359 throw css::lang::DisposedException(
"Frame disposed");
2361 return disp->queryDispatches( lDescriptor );
2374void SAL_CALL XFrameImpl::registerDispatchProviderInterceptor(
2375 const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor )
2383 css::uno::Reference< css::frame::XDispatchProviderInterception > xInterceptionHelper;
2386 xInterceptionHelper = m_xDispatchHelper;
2388 if (xInterceptionHelper.is()) {
2389 xInterceptionHelper->registerDispatchProviderInterceptor( xInterceptor );
2393void SAL_CALL XFrameImpl::releaseDispatchProviderInterceptor(
2394 const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor )
2402 css::uno::Reference< css::frame::XDispatchProviderInterception > xInterceptionHelper;
2405 xInterceptionHelper = m_xDispatchHelper;
2407 if (xInterceptionHelper.is()) {
2408 xInterceptionHelper->releaseDispatchProviderInterceptor( xInterceptor );
2416css::uno::Sequence< sal_Int16 > SAL_CALL XFrameImpl::getSupportedCommandGroups()
2418 return m_xDispatchInfoHelper->getSupportedCommandGroups();
2421css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL XFrameImpl::getConfigurableDispatchInformation(
2422 sal_Int16 nCommandGroup)
2424 return m_xDispatchInfoHelper->getConfigurableDispatchInformation(nCommandGroup);
2437void SAL_CALL XFrameImpl::windowResized(
const css::awt::WindowEvent& )
2444 implts_resizeComponentWindow();
2447void SAL_CALL XFrameImpl::focusGained(
const css::awt::FocusEvent& )
2454 css::uno::Reference< css::awt::XWindow > xComponentWindow = m_xComponentWindow;
2458 if( xComponentWindow.is() )
2460 xComponentWindow->setFocus();
2475void SAL_CALL XFrameImpl::windowActivated(
const css::lang::EventObject& )
2482 EActiveState eState = m_eActiveState;
2486 if( eState == E_INACTIVE )
2488 setActiveFrame( css::uno::Reference< css::frame::XFrame >() );
2493void SAL_CALL XFrameImpl::windowDeactivated(
const css::lang::EventObject& )
2500 css::uno::Reference< css::frame::XFrame > xParent = m_xParent;
2501 css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow;
2502 EActiveState eActiveState = m_eActiveState;
2506 if( eActiveState == E_INACTIVE )
2514 if ( !xContainerWindow.is() || !xParent.is() ||
2515 css::uno::Reference< css::frame::XDesktop >( xParent, css::uno::UNO_QUERY ).is()
2519 css::uno::Reference< css::awt::XWindow > xParentWindow = xParent->getContainerWindow();
2526 if( pFocusWindow && pParentWindow->IsChild( pFocusWindow ) )
2528 css::uno::Reference< css::frame::XFramesSupplier > xSupplier( xParent, css::uno::UNO_QUERY );
2529 if( xSupplier.is() )
2531 aSolarGuard.clear();
2532 xSupplier->setActiveFrame( css::uno::Reference< css::frame::XFrame >() );
2537void SAL_CALL XFrameImpl::windowClosing(
const css::lang::EventObject& )
2554 css::util::URL
aURL;
2555 aURL.Complete =
".uno:CloseFrame";
2556 css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(
m_xContext));
2557 xParser->parseStrict(aURL);
2559 css::uno::Reference< css::frame::XDispatch > xCloser = queryDispatch(aURL,
SPECIALTARGET_SELF, 0);
2561 xCloser->dispatch(aURL, css::uno::Sequence< css::beans::PropertyValue >());
2590void SAL_CALL XFrameImpl::windowShown(
const css::lang::EventObject& )
2592 static std::mutex aFirstVisibleLock;
2596 css::uno::Reference< css::frame::XDesktop > xDesktopCheck( m_xParent, css::uno::UNO_QUERY );
2597 m_bIsHidden =
false;
2601 impl_checkMenuCloser();
2603 if (!xDesktopCheck.is())
2606 static bool bFirstVisibleTask =
true;
2607 std::unique_lock aGuard(aFirstVisibleLock);
2608 bool bMustBeTriggered = bFirstVisibleTask;
2609 bFirstVisibleTask =
false;
2612 if (bMustBeTriggered)
2614 css::uno::Reference< css::task::XJobExecutor > xExecutor
2615 = css::task::theJobExecutor::get(
m_xContext );
2616 xExecutor->trigger(
"onFirstVisibleTask" );
2620void SAL_CALL XFrameImpl::windowHidden(
const css::lang::EventObject& )
2629 impl_checkMenuCloser();
2642void SAL_CALL XFrameImpl::disposing(
const css::lang::EventObject& aEvent )
2647 if(
aEvent.Source == m_xContainerWindow )
2651 implts_stopWindowListening();
2653 m_xContainerWindow.clear();
2672sal_Bool SAL_CALL XFrameImpl::isActionLocked()
2675 return( m_nExternalLockCount!=0);
2678void SAL_CALL XFrameImpl::addActionLock()
2681 ++m_nExternalLockCount;
2684void SAL_CALL XFrameImpl::removeActionLock()
2688 SAL_WARN_IF( m_nExternalLockCount<=0,
"fwk.frame",
"XFrameImpl::removeActionLock(): Frame is not locked! "
2689 "Possible multithreading problem detected." );
2690 --m_nExternalLockCount;
2693 implts_checkSuicide();
2696void SAL_CALL XFrameImpl::setActionLocks( sal_Int16 nLock )
2703 m_nExternalLockCount = m_nExternalLockCount + nLock;
2706sal_Int16 SAL_CALL XFrameImpl::resetActionLocks()
2708 sal_Int16 nCurrentLocks = 0;
2711 nCurrentLocks = m_nExternalLockCount;
2712 m_nExternalLockCount = 0;
2719 implts_checkSuicide();
2721 return nCurrentLocks;
2724void XFrameImpl::impl_setPropertyValue(sal_Int32 nHandle,
2725 const css::uno::Any& aValue)
2740 OUString sExternalTitle;
2741 aValue >>= sExternalTitle;
2742 setTitle (sExternalTitle);
2747 aValue >>= m_xDispatchRecorderSupplier;
2752 css::uno::Reference< css::frame::XLayoutManager2 > xOldLayoutManager =
m_xLayoutManager;
2753 css::uno::Reference< css::frame::XLayoutManager2 > xNewLayoutManager;
2754 aValue >>= xNewLayoutManager;
2756 if (xOldLayoutManager != xNewLayoutManager)
2759 if (xOldLayoutManager.is())
2760 disableLayoutManager(xOldLayoutManager);
2761 if (xNewLayoutManager.is() && !m_bDocHidden)
2762 lcl_enableLayoutManager(xNewLayoutManager,
this);
2769 css::uno::Reference< css::task::XStatusIndicator > xProgress;
2770 aValue >>= xProgress;
2771 m_xIndicatorInterception = xProgress;
2781 SAL_INFO(
"fwk.frame",
"XFrameImpl::setFastPropertyValue_NoBroadcast(): Invalid handle detected!" );
2786css::uno::Any XFrameImpl::impl_getPropertyValue(sal_Int32 nHandle)
2796 css::uno::Any aValue;
2804 aValue <<= m_xDispatchRecorderSupplier;
2808 aValue <<= m_bIsHidden;
2817 css::uno::Reference< css::task::XStatusIndicator > xProgress(m_xIndicatorInterception.get(),
2818 css::uno::UNO_QUERY);
2819 aValue <<= xProgress;
2829 SAL_INFO(
"fwk.frame",
"XFrameImpl::getFastPropertyValue(): Invalid handle detected!" );
2836void XFrameImpl::impl_setPropertyChangeBroadcaster(
const css::uno::Reference< css::uno::XInterface >& xBroadcaster)
2839 m_xBroadcaster = xBroadcaster;
2842void XFrameImpl::impl_addPropertyInfo(
const css::beans::Property& aProperty)
2846 TPropInfoHash::const_iterator pIt = m_lProps.find(aProperty.Name);
2847 if (pIt != m_lProps.end())
2848 throw css::beans::PropertyExistException();
2850 m_lProps[aProperty.Name] = aProperty;
2853void XFrameImpl::impl_disablePropertySet()
2857 css::uno::Reference< css::uno::XInterface > xThis(
static_cast< css::beans::XPropertySet*
>(
this), css::uno::UNO_QUERY);
2858 css::lang::EventObject
aEvent(xThis);
2860 m_lSimpleChangeListener.disposeAndClear(aEvent);
2861 m_lVetoChangeListener.disposeAndClear(aEvent);
2865bool XFrameImpl::impl_existsVeto(
const css::beans::PropertyChangeEvent& aEvent)
2872 if (! pVetoListener)
2876 while (pListener.hasMoreElements())
2880 pListener.next()->vetoableChange(aEvent);
2882 catch(
const css::uno::RuntimeException&)
2883 { pListener.remove(); }
2884 catch(
const css::beans::PropertyVetoException&)
2891void XFrameImpl::impl_notifyChangeListener(
const css::beans::PropertyChangeEvent& aEvent)
2898 if (! pSimpleListener)
2902 while (pListener.hasMoreElements())
2906 pListener.next()->propertyChange(aEvent);
2908 catch(
const css::uno::RuntimeException&)
2909 { pListener.remove(); }
2918void XFrameImpl::implts_sendFrameActionEvent(
const css::frame::FrameAction& aAction )
2925 "[Frame] " << m_sName <<
" send event " <<
2926 (aAction == css::frame::FrameAction_COMPONENT_ATTACHED ? OUString(
"COMPONENT ATTACHED") :
2927 (aAction == css::frame::FrameAction_COMPONENT_DETACHING ? OUString(
"COMPONENT DETACHING") :
2928 (aAction == css::frame::FrameAction_COMPONENT_REATTACHED ? OUString(
"COMPONENT REATTACHED") :
2929 (aAction == css::frame::FrameAction_FRAME_ACTIVATED ? OUString(
"FRAME ACTIVATED") :
2930 (aAction == css::frame::FrameAction_FRAME_DEACTIVATING ? OUString(
"FRAME DEACTIVATING") :
2931 (aAction == css::frame::FrameAction_CONTEXT_CHANGED ? OUString(
"CONTEXT CHANGED") :
2932 (aAction == css::frame::FrameAction_FRAME_UI_ACTIVATED ? OUString(
"FRAME UI ACTIVATED") :
2933 (aAction == css::frame::FrameAction_FRAME_UI_DEACTIVATING ? OUString(
"FRAME UI DEACTIVATING") :
2934 (aAction == css::frame::FrameAction::FrameAction_MAKE_FIXED_SIZE ? OUString(
"MAKE_FIXED_SIZE") :
2935 OUString(
"*invalid*")))))))))));
2945 if( pContainer ==
nullptr )
2949 css::frame::FrameActionEvent aFrameActionEvent(
static_cast< ::
cppu::OWeakObject*
>(
this),
this, aAction );
2954 while( aIterator.hasMoreElements() )
2958 static_cast<css::frame::XFrameActionListener*
>(aIterator.next())->frameAction( aFrameActionEvent );
2960 catch(
const css::uno::RuntimeException& )
2973void XFrameImpl::implts_resizeComponentWindow()
2980 css::uno::Reference< css::awt::XWindow > xComponentWindow( getComponentWindow() );
2981 if( !xComponentWindow.is() )
2984 css::uno::Reference< css::awt::XDevice > xDevice( getContainerWindow(), css::uno::UNO_QUERY );
2987 css::awt::Rectangle aRectangle = getContainerWindow()->getPosSize();
2988 css::awt::DeviceInfo aInfo = xDevice->getInfo();
2989 css::awt::Size aSize( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset,
2990 aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
2993 xComponentWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, css::awt::PosSize::POSSIZE );
3005void XFrameImpl::implts_setIconOnWindow()
3012 css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow;
3013 css::uno::Reference< css::frame::XController >
xController = m_xController;
3017 if( !(xContainerWindow.is() &&
xController.is()) )
3024 sal_Int32 nIcon = -1;
3028 css::uno::Reference< css::beans::XPropertySet > xSet( xController, css::uno::UNO_QUERY );
3033 css::uno::Reference< css::beans::XPropertySetInfo >
const xPSI( xSet->getPropertySetInfo(),
3034 css::uno::UNO_SET_THROW );
3035 if ( xPSI->hasPropertyByName(
"IconId" ) )
3036 xSet->getPropertyValue(
"IconId" ) >>= nIcon;
3038 catch( css::uno::Exception& )
3071 ( pWindow !=
nullptr ) &&
3072 ( pWindow->GetType() == WindowType::WORKWINDOW )
3076 pWorkWindow->
SetIcon(
static_cast<sal_uInt16
>(nIcon) );
3094void XFrameImpl::implts_startWindowListening()
3101 css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow;
3102 css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > xDragDropListener = m_xDropTargetListener;
3103 css::uno::Reference< css::awt::XWindowListener > xWindowListener(
this);
3104 css::uno::Reference< css::awt::XFocusListener > xFocusListener(
this);
3105 css::uno::Reference< css::awt::XTopWindowListener > xTopWindowListener(
this);
3109 if( !xContainerWindow.is() )
3112 xContainerWindow->addWindowListener( xWindowListener);
3113 xContainerWindow->addFocusListener ( xFocusListener );
3115 css::uno::Reference< css::awt::XTopWindow > xTopWindow( xContainerWindow, css::uno::UNO_QUERY );
3116 if( xTopWindow.is() )
3118 xTopWindow->addTopWindowListener( xTopWindowListener );
3120 css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create(
m_xContext );
3121 css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget( xContainerWindow );
3122 if( xDropTarget.is() )
3124 xDropTarget->addDropTargetListener( xDragDropListener );
3125 xDropTarget->setActive(
true );
3130void XFrameImpl::implts_stopWindowListening()
3137 css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow;
3138 css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > xDragDropListener = m_xDropTargetListener;
3139 css::uno::Reference< css::awt::XWindowListener > xWindowListener(
this);
3140 css::uno::Reference< css::awt::XFocusListener > xFocusListener(
this);
3141 css::uno::Reference< css::awt::XTopWindowListener > xTopWindowListener(
this);
3145 if( !xContainerWindow.is() )
3148 xContainerWindow->removeWindowListener( xWindowListener);
3149 xContainerWindow->removeFocusListener ( xFocusListener );
3151 css::uno::Reference< css::awt::XTopWindow > xTopWindow( xContainerWindow, css::uno::UNO_QUERY );
3152 if( !xTopWindow.is() )
3155 xTopWindow->removeTopWindowListener( xTopWindowListener );
3157 css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create(
m_xContext );
3158 css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
3159 xToolkit->getDropTarget( xContainerWindow );
3160 if( xDropTarget.is() )
3162 xDropTarget->removeDropTargetListener( xDragDropListener );
3163 xDropTarget->setActive(
false );
3181void XFrameImpl::implts_checkSuicide()
3187 bool bSuicide = (m_nExternalLockCount==0 && m_bSelfClose);
3188 m_bSelfClose =
false;
3199 catch(
const css::util::CloseVetoException&)
3201 catch(
const css::lang::DisposedException&)
3215void XFrameImpl::impl_setCloser(
const css::uno::Reference< css::frame::XFrame2 >& xFrame ,
3224 css::uno::Reference< css::beans::XPropertySet > xFrameProps(xFrame, css::uno::UNO_QUERY_THROW);
3225 css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
3227 css::uno::Reference< css::beans::XPropertySet > xLayoutProps(xLayoutManager, css::uno::UNO_QUERY_THROW);
3230 catch(
const css::uno::RuntimeException&)
3232 catch(
const css::uno::Exception&)
3245void XFrameImpl::impl_checkMenuCloser()
3253 css::uno::Reference< css::frame::XDesktop > xDesktop (m_xParent, css::uno::UNO_QUERY);
3254 css::uno::Reference< css::frame::XFramesSupplier > xTaskSupplier(xDesktop , css::uno::UNO_QUERY);
3255 if ( !xDesktop.is() || !xTaskSupplier.is() )
3264 FrameListAnalyzer aAnalyzer(
3270 css::uno::Reference< css::frame::XFrame2 > xNewCloserFrame;
3280 (aAnalyzer.m_lOtherVisibleFrames.size()==1) &&
3282 (aAnalyzer.m_bReferenceIsHelp ) ||
3283 (aAnalyzer.m_bReferenceIsHidden)
3289 xNewCloserFrame.set( aAnalyzer.m_lOtherVisibleFrames[0], css::uno::UNO_QUERY_THROW );
3296 (aAnalyzer.m_lOtherVisibleFrames.empty()) &&
3297 (!aAnalyzer.m_bReferenceIsHelp) &&
3298 (!aAnalyzer.m_bReferenceIsHidden) &&
3299 (!aAnalyzer.m_bReferenceIsBacking)
3302 xNewCloserFrame =
this;
3310 static css::uno::WeakReference< css::frame::XFrame2 > s_xCloserFrame;
3311 css::uno::Reference< css::frame::XFrame2 > xCloserFrame (s_xCloserFrame.get(), css::uno::UNO_QUERY);
3312 if (xCloserFrame!=xNewCloserFrame)
3314 if (xCloserFrame.is())
3315 impl_setCloser(xCloserFrame,
false);
3316 if (xNewCloserFrame.is())
3317 impl_setCloser(xNewCloserFrame,
true);
3318 s_xCloserFrame = xNewCloserFrame;
3324extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
3326 css::uno::XComponentContext *context,
3327 css::uno::Sequence<css::uno::Any>
const &)
3330 css::uno::XInterface *acquired_inst = cppu::acquire(inst.get());
3332 inst->initListeners();
3334 return acquired_inst;
static void SetDialogCancelMode(DialogCancelMode mode)
static DialogCancelMode GetDialogCancelMode()
static vcl::Window * GetFocusWindow()
sal_Int32 GetFactoryIcon(EFactory eFactory) const
static EFactory ClassifyFactoryByModel(const css::uno::Reference< css::frame::XModel > &xModel)
void SetIcon(sal_uInt16 nIcon)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
reference_type * get() const
implement a helper for XDispatchProvider interface @descr The result of a queryDispatch() call depend...
implements a helper to support interception with additional functionality.
implement XFrames, XIndexAccess and XElementAccess interfaces as helper for services @descr Use this ...
can be used as implementation helper of interface css.frame.XTitle
internal helper to bind e.g.
#define DBG_UNHANDLED_EXCEPTION(...)
Reference< XLayoutManager > m_xLayoutManager
Reference< XInterface > xTarget
Reference< XSingleServiceFactory > xFactory
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_framework_Frame_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
css::uno::Reference< css::uno::XComponentContext > m_xContext
void SAL_CALL windowClosed(const css::lang::EventObject &e) override
void SAL_CALL windowMinimized(const css::lang::EventObject &e) override
void SAL_CALL windowDeactivated(const css::lang::EventObject &e) override
void SAL_CALL windowHidden(const css::lang::EventObject &e) override
void SAL_CALL windowActivated(const css::lang::EventObject &e) override
DECL_LISTENERMULTIPLEXER_END void SAL_CALL windowResized(const css::awt::WindowEvent &e) override
DECL_LISTENERMULTIPLEXER_END void SAL_CALL windowOpened(const css::lang::EventObject &e) override
void SAL_CALL windowClosing(const css::lang::EventObject &e) override
class UNLESS_MERGELIBS(TOOLKIT_DLLPUBLIC) ListenerMultiplexerBase DECL_LISTENERMULTIPLEXER_END void SAL_CALL focusGained(const css::awt::FocusEvent &e) override
void SAL_CALL focusLost(const css::awt::FocusEvent &e) override
void SAL_CALL windowShown(const css::lang::EventObject &e) override
void SAL_CALL windowNormalized(const css::lang::EventObject &e) override
void SAL_CALL windowMoved(const css::awt::WindowEvent &e) override
#define SAL_WARN_IF(condition, area, stream)
#define SAL_INFO(area, stream)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
void checkDisposed(bool _bThrow)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::u16string_view getTitle(std::u16string_view aPath)
constexpr OUStringLiteral FRAME_PROPNAME_ASCII_INDICATORINTERCEPTION
constexpr OUStringLiteral FRAME_PROPNAME_ASCII_TITLE
constexpr OUStringLiteral FRAME_PROPNAME_ASCII_DISPATCHRECORDERSUPPLIER
properties for "Frame" class
constexpr OUStringLiteral SPECIALTARGET_BEAMER
constexpr OUStringLiteral SPECIALTARGET_TOP
constexpr OUStringLiteral SPECIALTARGET_BLANK
constexpr OUStringLiteral SPECIALTARGET_DEFAULT
constexpr OUStringLiteral FRAME_PROPNAME_ASCII_ISHIDDEN
constexpr OUStringLiteral FRAME_PROPNAME_ASCII_URL
constexpr OUStringLiteral SPECIALTARGET_SELF
constexpr OUStringLiteral FRAME_PROPNAME_ASCII_LAYOUTMANAGER
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
auto syncExecute(FuncT const &func) -> decltype(func())
#define FRAME_PROPHANDLE_URL
#define FRAME_PROPHANDLE_LAYOUTMANAGER
#define FRAME_PROPHANDLE_TITLE
#define FRAME_PROPHANDLE_ISHIDDEN
#define LAYOUTMANAGER_PROPNAME_MENUBARCLOSER
#define FRAME_PROPHANDLE_DISPATCHRECORDERSUPPLIER
#define FRAME_PROPHANDLE_INDICATORINTERCEPTION
Reference< XController > xController
Reference< XFrame > xFrame
Reference< XModel > xModel
#define SPECIALTARGET_PARENT