20#include <config_features.h>
21#include <config_feature_desktop.h>
24#include <osl/diagnose.h>
36#include <splitwin.hxx>
37#include <sfx2/sfxsids.hrc>
46#include <com/sun/star/ui/XUIElement.hpp>
47#include <com/sun/star/frame/LayoutManagerEvents.hpp>
48#include <com/sun/star/frame/ModuleManager.hpp>
49#include <com/sun/star/frame/XLayoutManager.hpp>
50#include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp>
51#include <com/sun/star/beans/XPropertySet.hpp>
52#include <com/sun/star/lang/DisposedException.hpp>
54#include <unordered_map>
135 m_bHasFrame( false ),
156 css::uno::Reference< css::beans::XPropertySet > xPropSet(
xFrame, UNO_QUERY );
157 css::uno::Reference< css::frame::XLayoutManagerEventBroadcaster > xLayoutManager;
158 if ( !xPropSet.is() )
164 aValue >>= xLayoutManager;
166 if ( xLayoutManager.is() )
167 xLayoutManager->addLayoutManagerEventListener(
168 css::uno::Reference< css::frame::XLayoutManagerListener >(
this) );
170 xPropSet.set( xLayoutManager, UNO_QUERY );
173 aValue = xPropSet->getPropertyValue(
"LockCount" );
177 catch ( css::lang::DisposedException& )
180 catch (
const css::uno::RuntimeException& )
184 catch ( css::uno::Exception& )
193 const css::uno::Reference< css::lang::XEventListener >& )
199 const css::uno::Reference< css::lang::XEventListener >& )
211 css::uno::Reference< css::frame::XFrame >
xFrame(
m_xFrame.get(), css::uno::UNO_QUERY );
218 css::uno::Reference< css::beans::XPropertySet > xPropSet(
xFrame, css::uno::UNO_QUERY );
219 css::uno::Reference< css::frame::XLayoutManagerEventBroadcaster > xLayoutManager;
220 if ( !xPropSet.is() )
226 aValue >>= xLayoutManager;
229 if ( xLayoutManager.is() )
230 xLayoutManager->removeLayoutManagerEventListener(
231 css::uno::Reference< css::frame::XLayoutManagerListener >(
this) );
233 catch ( css::lang::DisposedException& )
236 catch (
const css::uno::RuntimeException& )
240 catch ( css::uno::Exception& )
249 const css::lang::EventObject& )
261 const css::lang::EventObject&,
262 ::sal_Int16 eLayoutEvent,
263 const css::uno::Any& )
269 if ( eLayoutEvent == css::frame::LayoutManagerEvents::VISIBLE )
275 else if ( eLayoutEvent == css::frame::LayoutManagerEvents::INVISIBLE )
281 else if ( eLayoutEvent == css::frame::LayoutManagerEvents::LOCK )
285 else if ( eLayoutEvent == css::frame::LayoutManagerEvents::UNLOCK )
297 typedef std::underlying_type<ToolbarId>::type underlying_type;
298 return std::hash<underlying_type>()(
static_cast<underlying_type
>(
t));
302 class FilledToolBarResIdToResourceURLMap
305 typedef std::unordered_map<ToolbarId, OUString, ToolbarIdHash> ToolBarResIdToResourceURLMap;
306 ToolBarResIdToResourceURLMap m_aResIdToResourceURLMap;
308 FilledToolBarResIdToResourceURLMap()
313 OUString aResourceURL( OUString::createFromAscii(
pToolBarResToName[nIndex].pName ));
321 ToolBarResIdToResourceURLMap::const_iterator aIter = m_aResIdToResourceURLMap.find(eId);
322 if ( aIter != m_aResIdToResourceURLMap.end() )
323 return aIter->second;
331 static FilledToolBarResIdToResourceURLMap theFilledToolBarResIdToResourceURLMap;
332 return theFilledToolBarResIdToResourceURLMap.findURL(eId);
446 pBindings(&pFrm->GetCurrentViewFrame()->
GetBindings()),
448 pActiveChild( nullptr ),
453 bDockingAllowed(true),
454 bInternalDockingAllowed(true),
455 bAllChildrenVisible(true),
456#
if !defined(ANDROID) || HAVE_FEATURE_ANDROID_LOK
457 bIsFullScreen( false ),
459 bIsFullScreen( true ),
461#
if HAVE_FEATURE_DESKTOP
462 bShowStatusBar( true ),
467 pMasterFrame( pMaster ),
483 pLayoutManagerListener->setFrame(
xFrame );
521 if (
p->GetWindowCount())
541 OSL_FAIL(
"Lock count underflow!");
564 if (
p->GetWindowCount())
571 std::unique_ptr<SfxChildWin_Impl> pCW = std::move(*
aChildWins.begin());
599 pWorkWin->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( pChild->
GetWindow() );
611 Reference< css::beans::XPropertySet > xPropSet(
xFrame, UNO_QUERY );
612 Reference< css::frame::XLayoutManager > xLayoutManager;
618 aValue >>= xLayoutManager;
625 if ( xLayoutManager.is() )
627 xLayoutManager->reset();
698 if (!pCli || !pCli->
pWin)
700 (void)pCli->
pWin->GetSizePixel();
752 aSize = pCli->
pWin->GetSizePixel();
755 bool bAllowHiding =
true;
763 if ( pCli->
pWin->GetType() == WindowType::SPLITWINDOW )
765 bAllowHiding =
false;
778 if ( pCli->
pWin->GetType() == WindowType::SPLITWINDOW )
793 if ( pCli->
pWin->GetType() == WindowType::SPLITWINDOW )
795 bAllowHiding =
false;
808 if ( pCli->
pWin->GetType() == WindowType::SPLITWINDOW )
819 pCli->
aSize = pCli->
pWin->GetSizePixel();
824 pCli->
pWin->SetPosSizePixel( aPos, aSize );
865 for (
const std::unique_ptr<SfxChildWin_Impl> &pCW :
aChildWins)
886 auto pChild = std::make_unique<SfxChild_Impl>(rWindow, rWindow.
GetSizePixel(),
901 auto pChild = std::make_unique<SfxChild_Impl>(rController, eAlign);
917 if ( pChild && pChild->
pWin == &rWindow )
925 OSL_FAIL(
"releasing unregistered child" );
936 if (pChild && pChild->
xController.get() == &rController)
944 OSL_FAIL(
"releasing unregistered child" );
954 if ( pChild && pChild->
pWin == rWindow )
965 for (std::unique_ptr<SfxChild_Impl>& pCli :
aChildren)
970 if (pCli->pWin || pCli->xController)
974 for (
const std::unique_ptr<SfxChildWin_Impl>& pCWin :
aChildWins)
977 if ( pChild == pCli.get() )
996 if (pCli->xController)
998 if (!pCli->xController->getDialog()->get_visible())
1002 [=](sal_Int32 nResult){
1011 ShowFlags nFlags = pCli->bSetFocus ? ShowFlags::NONE : ShowFlags::NoFocusChange | ShowFlags::NoActivate;
1012 pCli->pWin->Show(
true, nFlags);
1014 pCli->bSetFocus =
false;
1018 if (pCli->xController)
1020 if (pCli->xController->getDialog()->get_visible())
1040 else if (pChild->
pWin)
1041 pChild->
pWin->Hide();
1060 aObjBar.
nMode = nFlags;
1064 if ( rBar.eId == aObjBar.
eId )
1109 Reference< css::beans::XPropertySet > xPropSet(
GetFrameInterface(), UNO_QUERY );
1110 Reference< css::frame::XLayoutManager > xLayoutManager;
1111 Reference< css::task::XStatusIndicator > xStatusIndicator;
1113 if ( xPropSet.is() )
1116 aValue >>= xLayoutManager;
1117 if ( xLayoutManager.is() )
1122 Reference< css::ui::XUIElement > xProgressBar =
1124 if ( xProgressBar.is() )
1126 xStatusIndicator.set( xProgressBar->getRealInterface(), UNO_QUERY );
1131 return xStatusIndicator;
1137 if ( pObjShell && pObjShell->
GetMedium() )
1140 if ( pViewOnlyItem && pViewOnlyItem->
GetValue() )
1150 css::uno::Reference< css::frame::XFrame >
xFrame;
1174 if (
p->GetWindowCount())
1178 Reference< css::beans::XPropertySet > xPropSet(
GetFrameInterface(), UNO_QUERY );
1179 Reference< css::frame::XLayoutManager > xLayoutManager;
1181 if ( xPropSet.is() )
1184 aValue >>= xLayoutManager;
1187 if ( !xLayoutManager.is() )
1190 bool bPluginMode(
false );
1201 xLayoutManager->lock();
1206 bool bDestroy =
n.bDestroy;
1216 if ( bDestroy || isNotebookBarActive)
1219 xLayoutManager->destroyElement( aTbxId );
1226 xLayoutManager->destroyElement( aTbxId );
1229 xLayoutManager->requestElement( aTbxId );
1231 xLayoutManager->lockWindow( aTbxId );
1238 xLayoutManager->destroyElement( aTbxId );
1245 xLayoutManager->unlock();
1253 if (
p->GetWindowCount())
1267 bool bCreate =
false;
1272 if ( pChildWin ==
nullptr && pCW->
bCreate )
1294 pCW->
bCreate = bCreate =
false;
1304 else if ( pChildWin )
1328 if ( pChildWin && !bCreate )
1380 pWorkWin->GetSystemWindow()->GetTaskPaneList()->AddWindow( pChildWin->
GetWindow() );
1382 pCW->
pWin = pChildWin;
1425 pCW->
pCli =
nullptr;
1437 pWorkWin->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( pChildWin->
GetWindow() );
1438 pCW->
pWin =
nullptr;
1457 Reference< css::beans::XPropertySet > xPropSet(
GetFrameInterface(), UNO_QUERY );
1458 Reference< css::frame::XLayoutManager > xLayoutManager;
1461 aValue >>= xLayoutManager;
1470 if ( xLayoutManager.is() )
1477 if ( xLayoutManager.is() )
1504 for (
const std::unique_ptr<SfxChildWin_Impl>&
i :
aChildWins)
1513 SAL_WARN(
"sfx.appl",
"missing SfxChild_Impl child!");
1526 pCW->
Show( ShowFlags::NoFocusChange | ShowFlags::NoActivate );
1537 sal_uInt16
nPos = USHRT_MAX;
1542 for (
const std::unique_ptr<SfxChildWin_Impl>&
i :
aChildWins)
1551 pDockWin = pSfxDockingWindow;
1583 pCW->
pCli =
nullptr;
1589 static_cast<SplitWindow*
>(pWin)->
Show(
true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
1603 if ( pChild && pChild->
pWin == pWin )
1615 if (
nPos == USHRT_MAX || !pDockWin)
1709 if (
nPos == USHRT_MAX && !pCW )
1714 if ( pCli && pDockWin )
1727 if( pCli->
eAlign != eAlign )
1737 if ( pCW && pCW->
pWin )
1754 sal_uInt16
nId =
static_cast<sal_uInt16
>( lId & 0xFFFF );
1777 aChildWins.push_back( std::unique_ptr<SfxChildWin_Impl>(pCW) );
1802 bool bCreationAllowed(
true );
1810 if ( bCreationAllowed )
1851 if ( pCW->
bCreate && bCreationAllowed )
1873 OSL_FAIL(
"The ChildWindow is not in context!");
1877 OSL_FAIL(
"The ChildWindow is not registered!");
1895 return ( pChild && pCW->
bCreate );
1926 aChildWins.push_back( std::unique_ptr<SfxChildWin_Impl>(pCW) );
1986 pWork->
aChildWins.push_back( std::unique_ptr<SfxChildWin_Impl>(pCW) );
2017 pChildWin->
Show( bSetFocus && pChildWin->
WantsFocus() ? ShowFlags::NONE : ShowFlags::NoFocusChange | ShowFlags::NoActivate );
2041 pChildWin = pCW->
pWin;
2065 OSL_FAIL(
"The ChildWindow is not in context!");
2069 OSL_FAIL(
"The ChildWindow is not registered");
2091 for (std::unique_ptr<SfxChildWin_Impl>& pChildWin :
aChildWins)
2094 pChildWin->bEnable =
false;
2135 uno::Reference< frame::XModuleManager2 > xModuleManager(
2136 frame::ModuleManager::create(::comphelper::getProcessComponentContext()));
2244 if ( pWin.get() != pSplitWin && pWin->
IsAutoHide(
true ) )
2255 if (
p &&
p->IsAutoHide(
false) )
2257 Point aLocalPos =
p->ScreenToOutputPixel( aPos );
2259 if ( !aRect.
Contains( aLocalPos ) )
2278 bool bDummyWindow = !pSplitWin->IsFadeIn();
2279 vcl::Window *pDummy = pSplitWin->GetSplitWindow();
2280 vcl::Window *pWin = bDummyWindow ? pDummy : pSplitWin;
2281 if ( (pSplitWin->IsPinned() && !bDummyWindow) || (!pWin->
IsVisible() && pActSplitWin != pSplitWin) )
2294 if ( !bDummyWindow )
2295 aSize.
setWidth( pSplitWin->GetSizePixel().Width() );
2300 if ( nLeft > aArea.
Left() )
2311 if ( !bDummyWindow )
2312 aSize.
setWidth( pSplitWin->GetSizePixel().Width() );
2318 if ( aPos.
X() < aArea.
Left() )
2335 if ( !bDummyWindow )
2336 aSize.
setHeight( pSplitWin->GetSizePixel().Height() );
2347 if ( nTop > aArea.
Top() )
2358 if ( !bDummyWindow )
2359 aSize.
setHeight( pSplitWin->GetSizePixel().Height() );
2370 if ( aPos.
Y() < aArea.
Top() )
2380 if ( !bDummyWindow )
2383 pSplitWin->SetPosSizePixel(
pWorkWin->OutputToScreenPixel(aPos), aSize );
SfxApplication * SfxGetpApp()
bool SfxChildAlignValid(SfxChildAlignment eAlign)
const int nCloseResponseToJustHide
static bool IsUICaptured()
Size GetSizePixel() const override
SfxWorkWindow * m_pWrkWin
void setFrame(const css::uno::Reference< css::frame::XFrame > &rFrame)
virtual void SAL_CALL layoutEvent(const css::lang::EventObject &aSource, ::sal_Int16 eLayoutEvent, const css::uno::Any &aInfo) override
virtual void SAL_CALL dispose() override
virtual void SAL_CALL disposing(const css::lang::EventObject &aEvent) override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual ~LayoutManagerListener() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
LayoutManagerListener(SfxWorkWindow *pWrkWin)
css::uno::WeakReference< css::frame::XFrame > m_xFrame
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
SAL_DLLPRIVATE SfxChildWinFactory * GetChildWinFactoryById(sal_uInt16 nId) const
SAL_DLLPRIVATE SfxDispatcher * GetDispatcher_Impl()
SAL_DLLPRIVATE void SetWorkWindow_Impl(std::unique_ptr< SfxWorkWindow >)
void Invalidate(sal_uInt16 nId)
bool IsHideNotDelete() const
static SAL_DLLPRIVATE void InitializeChildWinFactory_Impl(sal_uInt16, SfxChildWinInfo &)
sal_uInt16 GetType() const
SAL_DLLPRIVATE void SetWorkWindow_Impl(SfxWorkWindow *)
void SetVisible_Impl(bool bVis)
virtual bool QueryClose()
vcl::Window * GetWindow() const
SfxChildAlignment GetAlignment() const
std::shared_ptr< SfxDialogController > & GetController()
void SaveStatus(const SfxChildWinInfo &rInfo)
static std::unique_ptr< SfxChildWindow > CreateChildWindow(sal_uInt16, vcl::Window *, SfxBindings *, SfxChildWinInfo const &)
virtual SfxChildWinInfo GetInfo() const
sal_uInt16 GetPosition() const
virtual void Show(ShowFlags nFlags)
SfxViewFrame * GetFrame() const
Returns a pointer to the <SfxViewFrame> instance, which belongs to this SfxDispatcher.
SAL_DLLPRIVATE void AutoShow_Impl()
SAL_DLLPRIVATE bool IsAutoHide_Impl() const
SfxChildAlignment GetAlignment() const
void SetDockingRects(const tools::Rectangle &rOuter, const tools::Rectangle &rInner)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
SAL_DLLPRIVATE tools::Rectangle GetTopOuterRectPixel_Impl() const
bool IsClosing_Impl() const
SAL_DLLPRIVATE void SetToolSpaceBorderPixel_Impl(const SvBorder &)
SAL_WARN_UNUSED_RESULT SfxViewFrame * GetCurrentViewFrame() const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
SfxItemSet & GetItemSet() const
static SfxModule * GetActiveModule(SfxViewFrame *pFrame=nullptr)
SAL_DLLPRIVATE SfxChildWinFactory * GetChildWinFactoryById(sal_uInt16 nId) const
SfxMedium * GetMedium() const
bool IsInPlaceActive() const
The class SfxShell is the base class for all classes, which provide the functionality of the form <Sl...
virtual SfxObjectShell * GetObjectShell()
SfxViewShell * GetViewShell() const
Returns the SfxViewShell in which they are located in the subshells.
SplitWindow * GetSplitWindow()
bool IsAutoHide(bool bSelf) const
sal_uInt16 GetWindowCount(sal_uInt16 nLine) const
SfxFrame & GetFrame() const
virtual SfxObjectShell * GetObjectShell() override
SfxInPlaceClient * GetIPClient() const
std::vector< SfxObjectBar_Impl > aObjBarList
std::vector< std::unique_ptr< SfxChildWin_Impl > > aChildWins
tools::Rectangle aUpperClientArea
SfxWorkWindow(vcl::Window *pWin, SfxFrame *pFrm, SfxFrame *pMaster)
void ArrangeChildren_Impl(bool bForce=true)
void MakeVisible_Impl(bool)
void UpdateObjectBars_Impl()
void ResetObjectBars_Impl()
SfxSplitWindow * GetSplitWindow_Impl(SfxChildAlignment)
void UpdateObjectBars_Impl2()
void SetActiveChild_Impl(vcl::Window *pChild)
void HidePopups_Impl(bool bHide, sal_uInt16 nId=0)
bool IsFloating(sal_uInt16 nId)
void ReleaseChild_Impl(vcl::Window &rWindow)
void ConfigChild_Impl(SfxChildIdentifier, SfxDockingConfig, sal_uInt16)
bool HasChildWindow_Impl(sal_uInt16)
bool IsDockingAllowed() const
void EndAutoShow_Impl(Point aPos)
void SetStatusBar_Impl(StatusBarId eResId)
SfxBindings & GetBindings()
void MakeChildrenVisible_Impl(bool bVis)
SfxChild_Impl * RegisterChild_Impl(vcl::Window &rWindow, SfxChildAlignment eAlign)
bool IsVisible_Impl() const
void CreateChildWin_Impl(SfxChildWin_Impl *, bool)
VclPtr< vcl::Window > pWorkWin
void RemoveChildWin_Impl(SfxChildWin_Impl *)
void ResetChildWindows_Impl()
bool KnowsChildWindow_Impl(sal_uInt16)
std::vector< sal_uInt16 > aSortedList
void SetObjectBar_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId)
void SetChildWindow_Impl(sal_uInt16, bool bOn, bool bSetFocus)
css::uno::Reference< css::task::XStatusIndicator > GetStatusIndicator()
SfxChild_Impl * FindChild_Impl(const vcl::Window *rWindow) const
bool bInternalDockingAllowed
void SetChildWindowVisible_Impl(sal_uInt32, bool, SfxVisibilityFlags)
css::uno::Reference< css::frame::XFrame > GetFrameInterface()
VclPtr< vcl::Window > pActiveChild
void SaveStatus_Impl(SfxChildWindow *, const SfxChildWinInfo &)
tools::Rectangle GetTopRect_Impl() const
friend class LayoutManagerListener
bool IsAutoHideMode(const SfxSplitWindow *pSplit)
tools::Rectangle GetFreeArea(bool bAutoHide) const
SfxVisibilityFlags nUpdateMode
css::uno::Reference< css::lang::XComponent > m_xLayoutManagerListener
void InitializeChild_Impl(SfxChildWin_Impl *)
tools::Rectangle aClientArea
void ShowChildWindow_Impl(sal_uInt16, bool bVisible, bool bSetFocus)
bool RequestTopToolSpacePixel_Impl(SvBorder aBorder)
VclPtr< SfxSplitWindow > pSplit[SFX_SPLITWINDOWS_MAX]
void ResetStatusBar_Impl()
void UpdateStatusBar_Impl()
void UpdateChildWindows_Impl()
std::vector< std::unique_ptr< SfxChild_Impl > > aChildren
void DeleteControllers_Impl()
SfxChildWindow * GetChildWindow_Impl(sal_uInt16)
void ArrangeAutoHideWindows(SfxSplitWindow *pSplit)
static bool IsPluginMode(SfxObjectShell const *pObjShell)
void ToggleChildWindow_Impl(sal_uInt16, bool)
SfxVisibilityFlags nOrigMode
void FlushPendingChildSizes()
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static OUString GetFactoryShortName(EFactory eFactory)
static EFactory ClassifyFactoryByServiceName(std::u16string_view sName)
reference_type * get() const
static VclPtr< reference_type > Create(Arg &&... arg)
static bool IsActive(bool bConsiderSingleToolbar=false)
vcl::Window * GetParent() const
void ReleaseLOKNotifier()
virtual Point GetPosPixel() const
void SetParent(vcl::Window *pNewParent)
virtual Size GetSizePixel() const
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
#define DBG_ASSERT(sCon, aError)
virtual SfxBindings & GetBindings() override
#define SAL_WARN(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
SfxDispatcher * GetDispatcher()
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
#define SFX_OBJECTBAR_APPLICATION
#define SFX_OBJECTBAR_MAX
#define SFX_OBJECTBAR_COMMONTASK
#define SFX_OBJECTBAR_OPTIONS
#define SFX_OBJECTBAR_OBJECT
#define SFX_OBJECTBAR_TOOLS
#define SFX_OBJECTBAR_RECORDING
#define SFX_OBJECTBAR_MACRO
#define SFX_OBJECTBAR_FULLSCREEN
SfxChildWindowFlags nFlags
bool GetExtraData_Impl(SfxChildAlignment *pAlign) const
SfxVisibilityFlags nVisibility
std::shared_ptr< SfxDialogController > xController
VclPtr< vcl::Window > pWin
SfxChildVisibility nVisible
Reference< XController > xController
Reference< XFrame > xFrame
static OUString GetResourceURLFromToolbarId(ToolbarId eId)
constexpr OUStringLiteral g_aLayoutManagerPropName
const ResIdToResName pToolBarResToName[]
static sal_uInt16 TbxMatch(sal_uInt16 nPos)
constexpr OUStringLiteral g_aTbxTypeName(u"private:resource/toolbar/")
constexpr OUStringLiteral g_aProgressBarResName(u"private:resource/progressbar/progressbar")
static sal_uInt16 ChildAlignValue(SfxChildAlignment eAlign)
constexpr OUStringLiteral g_aStatusBarResName(u"private:resource/statusbar/statusbar")
#define SFX_SPLITWINDOWS_LEFT
#define SFX_SPLITWINDOWS_TOP
#define SFX_SPLITWINDOWS_MAX
#define SFX_SPLITWINDOWS_RIGHT