22#include <com/sun/star/frame/XController.hpp>
23#include <com/sun/star/frame/XFrame.hpp>
24#include <com/sun/star/util/XCloseable.hpp>
25#include <com/sun/star/beans/NamedValue.hpp>
40#include <sfx2/sfxsids.hrc>
54 css::uno::Reference< css::frame::XFrame >
xFrame;
55 css::uno::Reference< css::lang::XEventListener >
xListener;
65class DisposeListener :
public ::cppu::WeakImplHelper< css::lang::XEventListener >
74 virtual void SAL_CALL disposing(
const css::lang::EventObject& aSource )
override
76 css::uno::Reference< css::lang::XEventListener > xSelfHold(
this );
78 css::uno::Reference< css::lang::XComponent > xComp( aSource.Source, css::uno::UNO_QUERY );
80 xComp->removeEventListener(
this );
126 size_t nIndex = rStr.find(
',' );
127 if (
nIndex != std::u16string_view::npos )
129 std::u16string_view
aStr = rStr.substr(
nIndex+1 );
147 : pParent(pParentWindow)
152 pImpl->bHideNotDelete =
false;
153 pImpl->bWantsFocus =
true;
154 pImpl->bVisible =
true;
155 pImpl->pWorkWin =
nullptr;
165 css::uno::Reference < css::util::XCloseable > xClose(
GetFrame(), css::uno::UNO_QUERY );
167 xClose->close(
true );
171 catch (
const css::uno::Exception&)
184 pImpl->pWorkWin->SetActiveChild_Impl(
nullptr);
185 pImpl->pWorkWin =
nullptr;
203 std::unique_ptr<SfxChildWindow> pChild;
217 pBindings->ENTERREGISTRATIONS();
223 pBindings->LEAVEREGISTRATIONS();
238 pBindings->ENTERREGISTRATIONS();
244 pBindings->LEAVEREGISTRATIONS();
251 assert(pFact &&
"pChild is returned by a call on pFact, so pFact cannot be null");
252 pChild->SetFactory_Impl( pFact );
257 if (pChild && (!pChild->pWindow && !pChild->xController))
260 SAL_INFO(
"sfx.appl",
"ChildWindow has no Window!");
271 OUString aInfoVisible = rInfo.
bVisible ? OUString(
"V") : OUString(
"H");
273 OUString aWinData =
"V"
274 + OUString::number(
static_cast<sal_Int32
>(
nVersion))
278 + OUString::number(
static_cast<sal_Int32
>(rInfo.
nFlags));
283 OUString
sName(OUString::number(nID));
291 css::uno::Sequence < css::beans::NamedValue >
aSeq
292 { {
"Data", css::uno::Any(aWinData) } };
296 pImpl->aFact.aInfo = rInfo;
321 if (
pWindow->IsSystemWindow() )
330 if (pDockingWindow->GetFloatingWindow())
331 aInfo.
aWinState = pDockingWindow->GetFloatingWindow()->GetWindowState();
335 pSfxDockingWindow->FillInfo( aTmpInfo );
348 return pImpl->aFact.nPos;
355 std::optional<SvtViewOptions> xWinOpt;
358 xWinOpt.emplace(EViewType::Window, rInfo.
aModule +
"/" + OUString::number(
nId));
361 if (!xWinOpt || !xWinOpt->Exists())
362 xWinOpt.emplace(EViewType::Window, OUString::number(
nId));
364 if (xWinOpt->Exists() && xWinOpt->HasVisible() )
365 rInfo.
bVisible = xWinOpt->IsVisible();
367 css::uno::Sequence < css::beans::NamedValue >
aSeq = xWinOpt->GetUserData();
370 if (
aSeq.hasElements() )
371 aSeq[0].Value >>= aTmp;
373 OUString aWinData( aTmp );
374 rInfo.
aWinState = xWinOpt->GetWindowState();
376 if ( aWinData.isEmpty() )
380 if ( aWinData[0] != 0x0056 )
385 aWinData = aWinData.copy(1);
389 sal_Int32
nPos = aWinData.indexOf( cToken );
390 sal_uInt16 nActVersion =
static_cast<sal_uInt16
>(
o3tl::toInt32(aWinData.subView( 0,
nPos + 1 )));
394 aWinData = aWinData.copy(
nPos+1);
397 rInfo.
bVisible = (aWinData[0] == 0x0056);
398 aWinData = aWinData.copy(1);
399 nPos = aWinData.indexOf( cToken );
403 sal_Int32 nNextPos = aWinData.indexOf( cToken, 2 );
404 if ( nNextPos != -1 )
408 aWinData = aWinData.replaceAt(
nPos, nNextPos-
nPos+1,
u"" );
419 if (pParent->
GetType() == WindowType::DOCKINGWINDOW || pParent->
GetType() == WindowType::TOOLBOX)
420 return static_cast<const DockingWindow*
>(pParent)->GetFloatingWindow() !=
nullptr;
421 if (pParent->
GetType() == WindowType::FLOATINGWINDOW)
433 pImpl->bHideNotDelete = bOn;
438 return pImpl->bHideNotDelete;
443 pImpl->bWantsFocus = bSet;
448 return pImpl->bWantsFocus;
479 if (
aStr.isEmpty() )
503 return pImpl->bVisible;
508 pImpl->bVisible = bVis;
534 [
this](sal_Int32 nResult) {
548 pImpl->pWorkWin = pWin;
561 if(
pImpl->pWorkWin!=
nullptr)
569 if (
pImpl->xFrame.is() )
571 css::uno::Reference< css::frame::XController > xCtrl =
pImpl->xFrame->getController();
573 bAllow = xCtrl->suspend(
true );
592 return pImpl->xFrame;
598 if(
pImpl->xFrame == rFrame )
602 if(
pImpl->xFrame.is() )
603 pImpl->xFrame->removeEventListener(
pImpl->xListener );
608 if( !
pImpl->xListener.is() )
609 pImpl->xListener.set(
new DisposeListener(
this,
pImpl.get() ) );
613 pImpl->xFrame = rFrame;
614 if(
pImpl->xFrame.is() )
615 pImpl->xFrame->addEventListener(
pImpl->xListener );
SfxApplication * SfxGetpApp()
bool GetSplitSizeFromString(std::u16string_view rStr, Size &rSize)
bool GetPosSizeFromString(std::u16string_view rStr, Point &rPos, Size &rSize)
const sal_uInt16 nVersion
bool ParentIsFloatingWindow(const vcl::Window *pParent)
std::unique_ptr< SfxChildWindow >(* SfxChildWinCtor)(vcl::Window *pParentWindow, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo)
const int nCloseResponseToJustHide
static SystemWindowFlags GetSystemWindowMode()
static void SetSystemWindowMode(SystemWindowFlags nMode)
void setX(tools::Long nX)
void setY(tools::Long nY)
SAL_DLLPRIVATE SfxChildWinFactory * GetChildWinFactoryById(sal_uInt16 nId) const
SAL_DLLPRIVATE void RegisterChildWindow_Impl(SfxModule *, const SfxChildWinFactory &)
SAL_DLLPRIVATE SfxDispatcher * GetDispatcher_Impl()
bool IsHideNotDelete() const
const css::uno::Reference< css::frame::XFrame > & GetFrame() const
static SAL_DLLPRIVATE void InitializeChildWinFactory_Impl(sal_uInt16, SfxChildWinInfo &)
void SetFrame(const css::uno::Reference< css::frame::XFrame > &)
sal_uInt16 GetType() const
SAL_DLLPRIVATE void SetWorkWindow_Impl(SfxWorkWindow *)
void SetAlignment(SfxChildAlignment eAlign)
static void RegisterChildWindow(SfxModule *, const SfxChildWinFactory &)
SfxChildAlignment eChildAlignment
void SetVisible_Impl(bool bVis)
virtual bool QueryClose()
vcl::Window * GetWindow() const
SAL_DLLPRIVATE void SetFactory_Impl(const SfxChildWinFactory *)
VclPtr< vcl::Window > pParent
std::shared_ptr< SfxDialogController > & GetController()
SfxChildWindow(vcl::Window *pParentWindow, sal_uInt16 nId)
virtual ~SfxChildWindow()
void SaveStatus(const SfxChildWinInfo &rInfo)
static std::unique_ptr< SfxChildWindow > CreateChildWindow(sal_uInt16, vcl::Window *, SfxBindings *, SfxChildWinInfo const &)
std::unique_ptr< SfxChildWindow_Impl > pImpl
virtual SfxChildWinInfo GetInfo() const
VclPtr< vcl::Window > pWindow
sal_uInt16 GetPosition() const
void SetHideNotDelete(bool bOn)
SAL_DLLPRIVATE void ClearWorkwin()
SAL_DLLPRIVATE void Activate_Impl()
std::shared_ptr< SfxDialogController > xController
virtual void Show(ShowFlags nFlags)
SfxViewFrame * GetFrame() const
Returns a pointer to the <SfxViewFrame> instance, which belongs to this SfxDispatcher.
static SfxModule * GetActiveModule(SfxViewFrame *pFrame=nullptr)
SAL_DLLPRIVATE SfxChildWinFactory * GetChildWinFactoryById(sal_uInt16 nId) const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
void SetWindowState(const OUString &sState)
void SetUserData(const css::uno::Sequence< css::beans::NamedValue > &lData)
reference_type * get() const
WindowType GetType() const
bool IsInModalMode() const
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
virtual Point get_position() const=0
virtual OUString get_window_state(vcl::WindowDataMask nMask) const=0
virtual bool get_resizable() const=0
virtual Size get_size() const=0
virtual bool get_modal() const=0
#define DBG_ASSERT(sCon, aError)
Sequence< sal_Int8 > aSeq
#define SAL_INFO(area, stream)
std::unique_ptr< sal_Int32[]> pData
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
ContentProvider * m_pOwner
SfxChildWinFactory(SfxChildWinCtor pTheCtor, sal_uInt16 nID, sal_uInt16 n)
SfxChildWindowFlags nFlags
bool GetExtraData_Impl(SfxChildAlignment *pAlign) const
css::uno::Reference< css::lang::XEventListener > xListener
css::uno::Reference< css::frame::XFrame > xFrame
WinBits const WB_SIZEABLE