21#include <svl/solar.hrc>
30#include <osl/diagnose.h>
41#include <splitwin.hxx>
44#include <com/sun/star/beans/UnknownPropertyException.hpp>
45#include <com/sun/star/lang/XSingleComponentFactory.hpp>
46#include <com/sun/star/awt/XWindow.hpp>
47#include <com/sun/star/uno/XComponentContext.hpp>
48#include <com/sun/star/frame/ModuleManager.hpp>
49#include <com/sun/star/container/XNameAccess.hpp>
50#include <com/sun/star/ui/theWindowStateConfiguration.hpp>
51#include <com/sun/star/ui/theWindowContentFactoryManager.hpp>
53#define MAX_TOGGLEAREA_WIDTH 20
54#define MAX_TOGGLEAREA_HEIGHT 20
71 SfxTitleDockingWindow(
76 virtual ~SfxTitleDockingWindow()
override;
77 virtual void dispose()
override;
79 vcl::Window* GetWrappedWindow()
const {
return m_pWrappedWindow; }
83 virtual void Resize()
override;
93static bool lcl_getWindowState(
const uno::Reference< container::XNameAccess >& xWindowStateMgr,
const OUString& rResourceURL, WindowState& rWindowState )
100 uno::Sequence< beans::PropertyValue > aWindowState;
101 a = xWindowStateMgr->getByName( rResourceURL );
102 if (
a >>= aWindowState )
104 for (
const auto& rProp : std::as_const(aWindowState) )
106 if ( rProp.Name ==
"UIName" )
108 rProp.Value >>= rWindowState.sTitle;
115 catch ( container::NoSuchElementException& )
129 uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
137 uno::Reference< lang::XSingleComponentFactory > xFactoryMgr = ui::theWindowContentFactoryManager::get(xContext);
142 OUString aResourceURL =
"private:resource/dockingwindow/" + OUString::number(
nId);
146 {
"ResourceURL",
uno::Any(aResourceURL)},
149 uno::Reference< awt::XWindow > xWindow;
153 xFactoryMgr->createInstanceWithArgumentsAndContext( aArgs, xContext ),
156 static uno::WeakReference< frame::XModuleManager2 > s_xModuleManager;
158 uno::Reference< frame::XModuleManager2 > xModuleManager( s_xModuleManager );
159 if ( !xModuleManager.is() )
161 xModuleManager = frame::ModuleManager::create(xContext);
162 s_xModuleManager = xModuleManager;
165 static uno::WeakReference< container::XNameAccess > s_xWindowStateConfiguration;
167 uno::Reference< container::XNameAccess > xWindowStateConfiguration( s_xWindowStateConfiguration );
168 if ( !xWindowStateConfiguration.is() )
170 xWindowStateConfiguration = ui::theWindowStateConfiguration::get( xContext );
171 s_xWindowStateConfiguration = xWindowStateConfiguration;
174 OUString sModuleIdentifier = xModuleManager->identify(
xFrame );
176 uno::Reference< container::XNameAccess > xModuleWindowState(
177 xWindowStateConfiguration->getByName( sModuleIdentifier ),
179 if ( xModuleWindowState.is() )
183 pTitleDockWindow->SetText( aDockWinState.sTitle );
186 catch ( beans::UnknownPropertyException& )
189 catch ( uno::RuntimeException& )
192 catch ( uno::Exception& )
197 if ( pContentWindow )
199 pTitleDockWindow->SetWrappedWindow(pContentWindow);
207std::unique_ptr<SfxChildWindow> SfxDockingWrapper::CreateImpl(
vcl::Window *pParent, sal_uInt16 nId,
210 return std::make_unique<SfxDockingWrapper>(
pParent, nId, pBindings, pInfo);
218 sal_uInt16 nID = sal_uInt16(SID_DOCKWIN_START+i);
220 aFact.aInfo.nFlags |= nFlags;
221 aFact.aInfo.bVisible = bVis;
236 , m_pWrappedWindow(nullptr)
240SfxTitleDockingWindow::~SfxTitleDockingWindow()
245void SfxTitleDockingWindow::dispose()
247 m_pWrappedWindow.disposeAndClear();
251void SfxTitleDockingWindow::SetWrappedWindow(
vcl::Window*
const pWindow )
253 m_pWrappedWindow = pWindow;
254 if (m_pWrappedWindow)
257 m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() );
258 m_pWrappedWindow->Show();
264 if ( nType == StateChangedType::InitShow )
277void SfxTitleDockingWindow::Resize()
280 if (m_pWrappedWindow)
281 m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() );
284void SfxTitleDockingWindow::Resizing(
Size &rSize )
287 if (m_pWrappedWindow)
288 m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() );
304 if ( xViewShellFrame == rFrame )
327 sal_uInt16 nID = sal_uInt16(
o3tl::toInt32(rDockingWindowName));
353 sal_uInt16 nID = sal_uInt16(
o3tl::toInt32(rDockingWindowName));
410 ,aMoveIdle(
"sfx::SfxDockingWindow_Impl aMoveIdle" )
418 ,bDockingPrevented(false)
440 pImpl->aMoveIdle.Start();
445 switch (
pImpl->GetDockAlignment() )
454 pImpl->aSplitSize = aSize;
463 pImpl->aSplitSize = aSize;
487 if (
pImpl->bDockingPrevented )
496 if (
pImpl->pSplitWin )
499 pImpl->pSplitWin->RemoveWindow(
this);
500 pImpl->pSplitWin =
nullptr;
544 if ( !
pImpl->aWinState.isEmpty() )
551 if (
pImpl->GetDockAlignment() == eLastAlign)
573 DBG_ASSERT( pSplit,
"LastAlignment is not correct!" );
574 if ( pSplit && pSplit !=
pImpl->pSplitWin )
576 if (
pImpl->GetDockAlignment() == eLastAlign )
577 pImpl->pSplitWin->InsertWindow(
this,
pImpl->aSplitSize );
580 if ( !
pImpl->pSplitWin->IsFadeIn() )
581 pImpl->pSplitWin->FadeIn();
586 pImpl->SetLastAlignment(eLastAlign);
610 if (
pImpl->pSplitWin )
616 pImpl->bNewLine =
false;
642 bool bFloatMode =
false;
650 pImpl->SetDockAlignment(eAlign);
686 bool bReArrange = !bFloatMode;
695 Show(
false, ShowFlags::NoFocusChange );
703 Show(
true, ShowFlags::NoFocusChange );
707 pImpl->pSplitWin->RemoveWindow(
this,
false);
710 pImpl->pSplitWin->ReleaseWindow_Impl(
this);
713 if ( !
pImpl->pSplitWin->IsFadeIn() )
714 pImpl->pSplitWin->FadeIn();
763 vcl::Window* pParent,
const OUString& rID,
const OUString& rUIXMLDescription)
784 pImpl->bConstructed =
true;
789 pImpl->bDockingPrevented =
true;
796 if (
pImpl->aSplitSize.Width() < aMinSize.
Width() )
797 pImpl->aSplitSize.setWidth( aMinSize.
Width() );
798 if (
pImpl->aSplitSize.Height() < aMinSize.
Height() )
802 bool bVertHorzRead(
false );
825 if ( !
aStr.isEmpty() )
834 if (
pImpl->bDockingPrevented || bIgnoreFloatConfig)
843 OSL_FAIL(
"Invalid Alignment!");
864 pImpl->nLine =
pImpl->nDockLine =
static_cast<sal_uInt16
>(aPos.
X());
865 pImpl->nPos =
pImpl->nDockPos =
static_cast<sal_uInt16
>(aPos.
Y());
866 pImpl->nVerticalSize =
pImpl->aSplitSize.Height();
867 pImpl->nHorizontalSize =
pImpl->aSplitSize.Width();
869 bVertHorzRead =
true;
874 OSL_FAIL(
"Information is missing!" );
878 if ( !bVertHorzRead )
880 pImpl->nVerticalSize =
pImpl->aSplitSize.Height();
881 pImpl->nHorizontalSize =
pImpl->aSplitSize.Width();
902 bFloatMode = !bFloatMode;
906 if ( !
pImpl->aWinState.isEmpty() )
925 pImpl->SetLastAlignment(eLastAlign);
933 pImpl->pSplitWin->InsertWindow(
this,
pImpl->aSplitSize);
944 pImpl->bConstructed =
true;
957 if ( aPos !=
Point() )
973 if (
pImpl->aWinState.isEmpty() )
987 pImpl->bConstructed =
true;
1008 rInfo.
aExtraString += OUString::number (
static_cast<sal_uInt16
>(
pImpl->GetLastAlignment()));
1047 pImpl->pSplitWin->RemoveWindow(
this);
1072 rRect.
SetSize( aFloatingSize );
1073 return pImpl->GetDockAlignment();
1086 nLRBorder = aBorderTmp.
Width();
1087 nTBBorder = aBorderTmp.
Height();
1097 if ( aInRect.
GetWidth() > nLRBorder )
1099 if ( aInRect.
GetWidth() > nLRBorder )
1107 bool bBecomesFloating =
false;
1126 bBecomesFloating =
true;
1133 Point aNewPos(rPos);
1136 aSmallDockingRect.
SetPos(aNewPos);
1138 if ( aIntersectRect == aSmallDockingRect )
1140 bBecomesFloating =
true;
1143 if ( bBecomesFloating )
1150 Point aInPosTL( aPos.
X()-aInRect.
Left(), aPos.
Y()-aInRect.
Top() );
1153 bool bNoChange =
false;
1161 if (aInPosTL.
X() <= 0)
1170 if ( aInPosTL.
Y() <= 0)
1179 if ( aInPosBR.
X() >= aInSize.
Width())
1188 if ( aInPosBR.
Y() >= aInSize.
Height())
1201 bool bForbidden =
true;
1202 if ( aInPosTL.
X() <= 0)
1210 if ( bForbidden && aInPosTL.
Y() <= 0)
1218 if ( bForbidden && aInPosBR.
X() >= aInSize.
Width())
1226 if ( bForbidden && aInPosBR.
Y() >= aInSize.
Height())
1245 if ( eDockAlign !=
pImpl->GetDockAlignment() )
1246 aDockingRect.
SetSize( aFloatingSize );
1250 sal_uInt16 nLine,
nPos;
1256 pImpl->nDockLine = nLine;
1258 pImpl->bNewLine =
false;
1264 pImpl->nLine ==
pImpl->pSplitWin->GetLineCount()-1 &&
pImpl->pSplitWin->GetWindowCount(
pImpl->nLine) == 1 )
1269 pImpl->bNewLine =
false;
1275 pImpl->nDockPos = 0;
1276 pImpl->bNewLine =
true;
1295 if (
pImpl->bNewLine )
1319 if (
pImpl->bNewLine )
1342 aDockingRect.
SetSize( aSize );
1343 aDockingRect.
SetPos( aPoint );
1346 rRect = aDockingRect;
1430 pImpl->aMinSize = rSize;
1437 return pImpl->aMinSize;
1445 if ( rEvt.
GetType() == NotifyEventType::GETFOCUS )
1447 if (
pMgr !=
nullptr)
1450 if (
pImpl->pSplitWin )
1451 pImpl->pSplitWin->SetActiveWindow_Impl(
this );
1452 else if (
pMgr !=
nullptr)
1464 else if( rEvt.
GetType() == NotifyEventType::KEYINPUT )
1484 pImpl->aSplitSize = rSize;
1493 pImpl->pSplitWin->RemoveWindow(
this);
1500 pImpl->pSplitWin->InsertWindow(
this,
pImpl->aSplitSize );
1506 if (
pImpl->pSplitWin )
1507 return !
pImpl->pSplitWin->IsFadeIn();
1514 if (
pImpl->pSplitWin )
1516 pImpl->pSplitWin->FadeIn();
1522 if ( nStateChange == StateChangedType::InitShow )
1531 pImpl->aMoveIdle.Start();
1536 pImpl->aMoveIdle.Stop();
bool GetSplitSizeFromString(std::u16string_view rStr, Size &rSize)
bool GetPosSizeFromString(std::u16string_view rStr, Point &rPos, Size &rSize)
static bool IsInModalMode()
static std::unique_ptr< weld::Builder > CreateInterimBuilder(vcl::Window *pParent, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId=0)
Point GetFloatingPos() const
void SetMinOutputSizePixel(const Size &rSize)
bool IsFloatingMode() const
void SetFloatingMode(bool bFloatMode)
virtual void StateChanged(StateChangedType nType) override
Size GetSizePixel() const override
virtual bool EventNotify(NotifyEvent &rNEvt) override
Size GetOutputSizePixel() const
virtual void EndDocking(const tools::Rectangle &rRect, bool bFloatMode)
SystemWindow * GetFloatingWindow() const
void SetFloatingPos(const Point &rNewPos)
WinBits GetFloatStyle() const
bool IsDockingCanceled() const
const KeyEvent * GetKeyEvent() const
NotifyEventType GetType() const
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
VclPtr< vcl::Window > m_xBox
virtual void dispose() override
SAL_DLLPRIVATE SfxWorkWindow * GetWorkWindow_Impl() const
SAL_DLLPRIVATE SfxDispatcher * GetDispatcher_Impl()
SfxDispatcher * GetDispatcher() const
css::uno::Reference< css::frame::XFrame > GetActiveFrame() const
void SetActiveFrame(const css::uno::Reference< css::frame::XFrame > &rFrame)
const css::uno::Reference< css::frame::XFrame > & GetFrame() const
sal_uInt16 GetType() const
static void RegisterChildWindow(SfxModule *, const SfxChildWinFactory &)
vcl::Window * GetWindow() const
VclPtr< vcl::Window > pParent
virtual SfxChildWinInfo GetInfo() const
void SetWindow(const VclPtr< vcl::Window > &p)
void SetHideNotDelete(bool bOn)
SAL_DLLPRIVATE void Activate_Impl()
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
Method to execute a <SfxSlot>s over the Slot-Id.
SfxViewFrame * GetFrame() const
Returns a pointer to the <SfxViewFrame> instance, which belongs to this SfxDispatcher.
tools::Long nVerticalSize
SfxChildAlignment eDockAlignment
SfxChildAlignment GetLastAlignment() const
SfxDockingWindow_Impl(SfxDockingWindow *pBase)
void SetLastAlignment(SfxChildAlignment eAlign)
SfxChildAlignment GetDockAlignment() const
void SetDockAlignment(SfxChildAlignment eAlign)
VclPtr< SfxSplitWindow > pSplitWin
tools::Long nHorizontalSize
SfxChildAlignment eLastAlignment
std::unique_ptr< weld::Box > m_xContainer
SAL_DLLPRIVATE void AutoShow_Impl()
SfxDockingWindow(SfxDockingWindow const &)=delete
SAL_DLLPRIVATE bool IsAutoHide_Impl() const
const Size & GetMinOutputSizePixel() const
Set the minimum size which is returned.
void Initialize(SfxChildWinInfo *pInfo)
Initialization of the SfxDockingDialog class via a SfxChildWinInfo.
virtual void Resize() override
SAL_DLLPRIVATE void ReleaseChildWindow_Impl()
tools::Rectangle aInnerRect
SAL_DLLPRIVATE void Reappear_Impl()
virtual void FillInfo(SfxChildWinInfo &) const
Fills a SfxChildWinInfo with specific data from SfxDockingWindow, so that it can be written in the IN...
virtual bool Docking(const Point &rPos, tools::Rectangle &rRect) override
tools::Rectangle aOuterRect
std::unique_ptr< weld::Builder > m_xBuilder
const tools::Rectangle & GetOuterRect() const
SfxChildAlignment GetAlignment() const
virtual void Move() override
virtual bool EventNotify(NotifyEvent &rNEvt) override
void SetAlignment(SfxChildAlignment eAlign)
virtual void StartDocking() override
virtual bool Close() override
The window is closed when the ChildWindow is destroyed by running the ChildWindow-slots.
void SetFloatingSize(const Size &rSize)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
virtual void Resizing(Size &rSize) override
virtual void StateChanged(StateChangedType nStateChange) override
SfxChildAlignment CalcAlignment(const Point &rPos, tools::Rectangle &rRect)
This method calculates a resulting alignment for the given mouse position and tracking rectangle.
const Size & GetFloatingSize() const
virtual Size CalcDockingSize(SfxChildAlignment)
Virtual method of the SfxDockingWindow class.
virtual SfxChildAlignment CheckAlignment(SfxChildAlignment, SfxChildAlignment)
Virtual method of the SfxDockingWindow class.
virtual ~SfxDockingWindow() override
SAL_DLLPRIVATE void Initialize_Impl()
virtual bool PrepareToggleFloatingMode() override
virtual void ToggleFloatingMode() override
SAL_DLLPRIVATE void SetItemSize_Impl(const Size &rSize)
virtual void dispose() override
std::unique_ptr< SfxDockingWindow_Impl > pImpl
sal_uInt16 GetType() const
const tools::Rectangle & GetInnerRect() const
SAL_DLLPRIVATE void Disappear_Impl()
virtual void EndDocking(const tools::Rectangle &rRect, bool bFloatMode) override
Virtual method of the DockingWindow class ensures the correct alignment on the parent window.
void SetMinOutputSizePixel(const Size &rSize)
With this method, a minimal OutputSize be can set, that is queried in the Resizing()-Handler.
SfxDockingWrapper(vcl::Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
SAL_DLLPRIVATE SfxWorkWindow * GetWorkWindow_Impl() const
static SAL_WARN_UNUSED_RESULT SfxFrame * GetNext(SfxFrame &)
static SAL_WARN_UNUSED_RESULT SfxFrame * GetFirst()
SfxViewShell * GetViewShell() const
Returns the SfxViewShell in which they are located in the subshells.
sal_uInt16 GetLineCount() const
bool GetWindowPos(const SfxDockingWindow *pWindow, sal_uInt16 &rLine, sal_uInt16 &rPos) const
void ReleaseWindow_Impl(SfxDockingWindow const *pWin, bool bSaveConfig=true)
tools::Long GetLineSize(sal_uInt16) const
SfxFrame & GetFrame() const
SAL_DLLPRIVATE bool GlobalKeyInput_Impl(const KeyEvent &rKeyEvent)
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
vcl::Window * GetWindow() const
vcl::Window * GetWindow() const
SfxSplitWindow * GetSplitWindow_Impl(SfxChildAlignment)
void ConfigChild_Impl(SfxChildIdentifier, SfxDockingConfig, sal_uInt16)
bool IsDockingAllowed() const
void SetChildWindow_Impl(sal_uInt16, bool bOn, bool bSetFocus)
bool IsInternalDockingAllowed() const
SfxChildWindow * GetChildWindow_Impl(sal_uInt16)
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static bool GetDockingFloatsSupported()
OUString GetWindowState(vcl::WindowDataMask nMask=vcl::WindowDataMask::All) const
void SetWindowState(std::u16string_view rStr)
void SetPriority(TaskPriority ePriority)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
static VclPtr< reference_type > Create(Arg &&... arg)
Point OutputToScreenPixel(const Point &rPos) const
bool IsReallyVisible() const
vcl::Window * GetParent() const
bool HasChildPathFocus(bool bSystemWindow=false) const
virtual void SetSizePixel(const Size &rNewSize)
virtual Point GetPosPixel() const
void SetParent(vcl::Window *pNewParent)
virtual void SetOutputSizePixel(const Size &rNewSize)
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
virtual Size GetSizePixel() const
Point GetPointerPosPixel()
bool IsDefaultPos() const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Point ScreenToOutputPixel(const Point &rPos) const
#define DBG_ASSERT(sCon, aError)
#define MAX_TOGGLEAREA_HEIGHT
bool IsDockingWindowVisible(const uno::Reference< frame::XFrame > &rFrame, std::u16string_view rDockingWindowName)
Function used by the framework layout manager to determine the visibility state of a docking window w...
static bool lcl_getWindowState(const uno::Reference< container::XNameAccess > &xWindowStateMgr, const OUString &rResourceURL, WindowState &rWindowState)
const int NUM_OF_DOCKINGWINDOWS
void SfxDockingWindowFactory(const uno::Reference< frame::XFrame > &rFrame, std::u16string_view rDockingWindowName)
Factory function used by the framework layout manager to "create" a docking window with a special nam...
#define MAX_TOGGLEAREA_WIDTH
IMPL_LINK_NOARG(SfxDockingWindow, TimerHdl, Timer *, void)
static SfxWorkWindow * lcl_getWorkWindowFromXFrame(const uno::Reference< frame::XFrame > &rFrame)
static bool lcl_checkDockingWindowID(sal_uInt16 nID)
#define LINK(Instance, Class, Member)
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
SfxChildWindowFlags nFlags
Reference< XFrame > xFrame
WinBits const WB_DIALOGCONTROL
WinBits const WB_SIZEABLE
WinBits const WB_CHILDDLGCTRL
WinBits const WB_STDDOCKWIN
WinBits const WB_STANDALONE
WinBits const WB_CLIPCHILDREN