summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-11-02 15:38:46 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-11-02 16:51:29 +0100
commit4b0db40ab4a05a0940096654e8d60ed04f0cd2e6 (patch)
treeab91ce13fccbe99ceb96c75a4987e51d3e7ecd4a /sfx2
parentd562ee86414c8946c3b650d6e917db3f729325d3 (diff)
Revert "weld SwWordCountFloatDlg"
This reverts commit 26c375671aa362b2f59d84645784938677ae1719. Conflicts: vcl/qt5/Qt5Frame.cxx It caused null pointer dereference during UITest_writer_tests, as seen at <https://ci.libreoffice.org//job/lo_ubsan/1090/>: > /sfx2/source/appl/childwin.cxx:654:18: runtime error: member call on null pointer of type 'vcl::Window' > #0 0x2b97d4160fa3 in SfxChildWindow::SetWorkWindow_Impl(SfxWorkWindow*) /sfx2/source/appl/childwin.cxx:654:18 > #1 0x2b97d462ab86 in SfxWorkWindow::CreateChildWin_Impl(SfxChildWin_Impl*, bool) /sfx2/source/appl/workwin.cxx:1350:9 > #2 0x2b97d463e6bb in SfxWorkWindow::ToggleChildWindow_Impl(unsigned short, bool) /sfx2/source/appl/workwin.cxx:1837:21 > #3 0x2b97d6eae94d in SfxViewFrame::ToggleChildWindow(unsigned short) /sfx2/source/view/viewfrm.cxx:3080:9 > #4 0x2b987664316d in SwView::UpdateWordCount(SfxShell*, unsigned short) /sw/source/uibase/uiview/view1.cxx:212:9 > #5 0x2b9876126a5d in SwTextShell::Execute(SfxRequest&) /sw/source/uibase/shells/textsh1.cxx:1369:9 > #6 0x2b98760a2391 in SfxStubSwTextShellExecute(SfxShell*, SfxRequest&) /workdir/SdiTarget/sw/sdi/swslots.hxx:2974:1 > #7 0x2b97d49050f6 in SfxShell::CallExec(void (*)(SfxShell*, SfxRequest&), SfxRequest&) /include/sfx2/shell.hxx:207:35 > #8 0x2b97d48c27d0 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) /sfx2/source/control/dispatch.cxx:353:13 > #9 0x2b97d48de12d in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) /sfx2/source/control/dispatch.cxx:854:9 > #10 0x2b97d482ea34 in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot const*, SfxShell*) /sfx2/source/control/bindings.cxx:1063:9 > #11 0x2b97d4e5cead in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:754:29 > #12 0x2b97d4e60b5e in SfxOfficeDispatch::dispatchWithNotification(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:239:9 > #13 0x2b97c6c10b19 in comphelper::dispatchCommand(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /comphelper/source/misc/dispatchcommand.cxx:60:9 > #14 0x2b980472020c in UITest::executeCommand(rtl::OUString const&) /vcl/source/uitest/uitest.cxx:22:12 [...] Change-Id: I276684a5617bfec3803b195af59c51735bfa470a
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/childwin.cxx73
-rw-r--r--sfx2/source/appl/workwin.cxx85
-rw-r--r--sfx2/source/dialog/basedlgs.cxx126
-rw-r--r--sfx2/source/inc/workwin.hxx11
4 files changed, 30 insertions, 265 deletions
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index e2bbc3ee9e7f..aa8018eb0ed4 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -194,10 +194,7 @@ SfxChildWindow::~SfxChildWindow()
{
pContext.reset();
ClearWorkwin();
- if (xController)
- xController->DeInit();
- else
- pWindow.disposeAndClear();
+ pWindow.disposeAndClear();
}
@@ -273,7 +270,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId,
DBG_ASSERT(pFact && (pChild || !rInfo.bVisible), "ChildWindow-Typ not registered!");
- if (pChild && (!pChild->pWindow && !pChild->xController))
+ if ( pChild && !pChild->pWindow )
{
DELETEZ(pChild);
SAL_INFO("sfx.appl", "ChildWindow has no Window!");
@@ -322,38 +319,26 @@ void SfxChildWindow::SetAlignment(SfxChildAlignment eAlign)
SfxChildWinInfo SfxChildWindow::GetInfo() const
{
+
SfxChildWinInfo aInfo(pImpl->pFact->aInfo);
- if (xController)
+ aInfo.aPos = pWindow->GetPosPixel();
+ aInfo.aSize = pWindow->GetSizePixel();
+ if ( pWindow->IsSystemWindow() )
{
- weld::Dialog* pDialog = xController->getDialog();
- aInfo.aPos = pDialog->get_position();
- aInfo.aSize = pDialog->get_size();
WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
- if (pDialog->get_resizable())
- nMask |= (WindowStateMask::Width | WindowStateMask::Height);
- aInfo.aWinState = pDialog->get_window_state(nMask);
+ if ( pWindow->GetStyle() & WB_SIZEABLE )
+ nMask |= ( WindowStateMask::Width | WindowStateMask::Height );
+ aInfo.aWinState = static_cast<SystemWindow*>(pWindow.get())->GetWindowState( nMask );
}
- else if (pWindow)
+ else if (DockingWindow* pDockingWindow = dynamic_cast<DockingWindow*>(pWindow.get()))
{
- aInfo.aPos = pWindow->GetPosPixel();
- aInfo.aSize = pWindow->GetSizePixel();
- if ( pWindow->IsSystemWindow() )
+ if (pDockingWindow->GetFloatingWindow())
+ aInfo.aWinState = pDockingWindow->GetFloatingWindow()->GetWindowState();
+ else if (SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(pDockingWindow))
{
- WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
- if ( pWindow->GetStyle() & WB_SIZEABLE )
- nMask |= ( WindowStateMask::Width | WindowStateMask::Height );
- aInfo.aWinState = static_cast<SystemWindow*>(pWindow.get())->GetWindowState( nMask );
- }
- else if (DockingWindow* pDockingWindow = dynamic_cast<DockingWindow*>(pWindow.get()))
- {
- if (pDockingWindow->GetFloatingWindow())
- aInfo.aWinState = pDockingWindow->GetFloatingWindow()->GetWindowState();
- else if (SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(pDockingWindow))
- {
- SfxChildWinInfo aTmpInfo;
- pSfxDockingWindow->FillInfo( aTmpInfo );
- aInfo.aExtraString = aTmpInfo.aExtraString;
- }
+ SfxChildWinInfo aTmpInfo;
+ pSfxDockingWindow->FillInfo( aTmpInfo );
+ aInfo.aExtraString = aTmpInfo.aExtraString;
}
}
@@ -623,24 +608,12 @@ void SfxChildWindow::SetVisible_Impl( bool bVis )
void SfxChildWindow::Hide()
{
- if (xController)
- xController->EndDialog();
- else
- pWindow->Hide();
+ pWindow->Hide();
}
void SfxChildWindow::Show( ShowFlags nFlags )
{
- if (xController)
- {
- if (!xController->getDialog()->get_visible())
- {
- weld::DialogController::runAsync(xController,
- [=](sal_Int32 /*nResult*/){ xController->Close(); });
- }
- }
- else
- pWindow->Show(true, nFlags);
+ pWindow->Show(true, nFlags);
}
vcl::Window* SfxChildWindow::GetContextWindow( SfxModule const *pModule ) const
@@ -673,15 +646,7 @@ bool SfxChildWindow::QueryClose()
}
if ( bAllow )
- {
- if (GetController())
- {
- weld::Dialog* pDialog = GetController()->getDialog();
- bAllow = !pDialog->get_visible() || !pDialog->get_modal();
- }
- else if (GetWindow())
- bAllow = !GetWindow()->IsInModalMode();
- }
+ bAllow = !GetWindow()->IsInModalMode();
return bAllow;
}
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 69e29d2e6d83..363b3005d1f9 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -864,6 +864,7 @@ bool SfxWorkWindow::PrepareClose_Impl()
return true;
}
+
SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl( vcl::Window& rWindow,
SfxChildAlignment eAlign )
{
@@ -884,19 +885,6 @@ SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl( vcl::Window& rWindow,
return aChildren.back();
}
-SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl(std::shared_ptr<SfxModelessDialogController>& rController,
- SfxChildAlignment eAlign )
-{
- DBG_ASSERT( aChildren.size() < 255, "too many children" );
- DBG_ASSERT( SfxChildAlignValid(eAlign), "invalid align" );
-
- SfxChild_Impl *pChild = new SfxChild_Impl(rController, eAlign);
-
- aChildren.push_back(pChild);
- bSorted = false;
- nChildren++;
- return aChildren.back();
-}
void SfxWorkWindow::ReleaseChild_Impl( vcl::Window& rWindow )
{
@@ -922,29 +910,6 @@ void SfxWorkWindow::ReleaseChild_Impl( vcl::Window& rWindow )
}
}
-void SfxWorkWindow::ReleaseChild_Impl(SfxModelessDialogController& rController)
-{
-
- SfxChild_Impl *pChild = nullptr;
- decltype(aChildren)::size_type nPos;
- for ( nPos = 0; nPos < aChildren.size(); ++nPos )
- {
- pChild = aChildren[nPos];
- if (pChild && pChild->xController.get() == &rController)
- break;
- }
-
- if ( nPos < aChildren.size() )
- {
- bSorted = false;
- nChildren--;
- aChildren.erase(aChildren.begin() + nPos);
- delete pChild;
- }
- else {
- OSL_FAIL( "releasing unregistered child" );
- }
-}
SfxChild_Impl* SfxWorkWindow::FindChild_Impl( const vcl::Window& rWindow ) const
{
@@ -968,10 +933,8 @@ void SfxWorkWindow::ShowChildren_Impl()
for (SfxChild_Impl* pCli : aChildren)
{
- if (!pCli)
- continue;
SfxChildWin_Impl* pCW = nullptr;
- if (pCli->pWin || pCli->xController)
+ if ( pCli && pCli->pWin )
{
// We have to find the SfxChildWin_Impl to retrieve the
// SFX_CHILDWIN flags that can influence visibility.
@@ -998,27 +961,12 @@ void SfxWorkWindow::ShowChildren_Impl()
if ( SfxChildVisibility::VISIBLE == (pCli->nVisible & SfxChildVisibility::VISIBLE) && bVisible )
{
ShowFlags nFlags = pCli->bSetFocus ? ShowFlags::NONE : ShowFlags::NoFocusChange | ShowFlags::NoActivate;
- if (pCli->xController)
- {
- if (!pCli->xController->getDialog()->get_visible())
- {
- weld::DialogController::runAsync(pCli->xController,
- [=](sal_Int32 /*nResult*/){ pCli->xController->Close(); });
- }
- }
- else
- pCli->pWin->Show(true, nFlags);
+ pCli->pWin->Show(true, nFlags);
pCli->bSetFocus = false;
}
else
{
- if (pCli->xController)
- {
- if (pCli->xController->getDialog()->get_visible())
- pCli->xController->response(RET_CLOSE);
- }
- else
- pCli->pWin->Hide();
+ pCli->pWin->Hide();
}
}
}
@@ -1030,15 +978,12 @@ void SfxWorkWindow::HideChildren_Impl()
for ( sal_uInt16 nPos = aChildren.size(); nPos > 0; --nPos )
{
SfxChild_Impl *pChild = aChildren[nPos-1];
- if (!pChild)
- continue;
- if (pChild->xController)
- pChild->xController->response(RET_CLOSE);
- else if (pChild->pWin)
+ if (pChild && pChild->pWin)
pChild->pWin->Hide();
}
}
+
void SfxWorkWindow::ResetObjectBars_Impl()
{
for ( auto & n: aObjBarList )
@@ -1379,10 +1324,7 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, bool bSetFocus )
{
// The window is not docked or docked outside of one split windows
// and must therefore be registered explicitly as a Child
- if (pChildWin->GetController())
- pCW->pCli = RegisterChild_Impl(pChildWin->GetController(), pChildWin->GetAlignment());
- else
- pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment());
+ pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment());
pCW->pCli->nVisible = SfxChildVisibility::VISIBLE;
if ( pChildWin->GetAlignment() != SfxChildAlignment::NOALIGNMENT && bIsFullScreen )
pCW->pCli->nVisible ^= SfxChildVisibility::ACTIVE;
@@ -1421,10 +1363,7 @@ void SfxWorkWindow::RemoveChildWin_Impl( SfxChildWin_Impl *pCW )
// Child window is a direct child window and must therefore unregister
// itself from the WorkWindow
pCW->pCli = nullptr;
- if (pChildWin->GetController())
- ReleaseChild_Impl(*pChildWin->GetController());
- else
- ReleaseChild_Impl(*pChildWin->GetWindow());
+ ReleaseChild_Impl(*pChildWin->GetWindow());
}
else
{
@@ -2443,12 +2382,8 @@ void SfxWorkWindow::DataChanged_Impl()
for (n=0; n<nCount; n++)
{
SfxChildWin_Impl*pCW = aChildWins[n].get();
- if (pCW && pCW->pWin)
- {
- // TODO does this really have any meaning ?
- if (pCW->pWin->GetWindow())
- pCW->pWin->GetWindow()->UpdateSettings(Application::GetSettings());
- }
+ if ( pCW && pCW->pWin )
+ pCW->pWin->GetWindow()->UpdateSettings( Application::GetSettings() );
}
ArrangeChildren_Impl();
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 8fcb0cb1137f..f4a07696af43 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -56,7 +56,6 @@ public:
OString aWinState;
SfxChildWindow* pMgr;
bool bConstructed;
- bool bClosing;
void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
Idle aMoveIdle;
@@ -285,7 +284,6 @@ void SfxModelessDialog::Init(SfxBindings *pBindinx, SfxChildWindow *pCW)
pImpl.reset(new SfxModelessDialog_Impl);
pImpl->pMgr = pCW;
pImpl->bConstructed = false;
- pImpl->bClosing = false;
if ( pBindinx )
pImpl->StartListening( *pBindinx );
pImpl->aMoveIdle.SetPriority(TaskPriority::RESIZE);
@@ -384,129 +382,6 @@ void SfxModelessDialog::FillInfo(SfxChildWinInfo& rInfo) const
rInfo.nFlags |= SfxChildWindowFlags::ZOOMIN;
}
-void SfxModelessDialogController::Initialize(SfxChildWinInfo const *pInfo)
-
-/* [Description]
-
- Initialization of the class SfxModelessDialog via a SfxChildWinInfo.
- The initialization is done only in a 2nd step after the constructor, this
- constructor should be called from the derived class or from the
- SfxChildWindows.
-*/
-
-{
- if (!pInfo)
- return;
- m_xImpl->aWinState = pInfo->aWinState;
- if (m_xImpl->aWinState.isEmpty())
- return;
- m_xDialog->set_window_state(m_xImpl->aWinState);
-}
-
-SfxModelessDialogController::SfxModelessDialogController(SfxBindings* pBindinx,
- SfxChildWindow *pCW, weld::Window *pParent, const OUString& rUIXMLDescription,
- const OString& rID)
- : SfxDialogController(pParent, rUIXMLDescription, rID)
-{
- Init(pBindinx, pCW);
- m_xDialog->connect_focus_in(LINK(this, SfxModelessDialogController, FocusInHdl));
- m_xDialog->connect_focus_out(LINK(this, SfxModelessDialogController, FocusOutHdl));
-}
-
-void SfxModelessDialogController::Init(SfxBindings *pBindinx, SfxChildWindow *pCW)
-{
- m_pBindings = pBindinx;
- m_xImpl.reset(new SfxModelessDialog_Impl);
- m_xImpl->pMgr = pCW;
- m_xImpl->bConstructed = true;
- m_xImpl->bClosing = false;
- if (pBindinx)
- m_xImpl->StartListening( *pBindinx );
-}
-
-void SfxModelessDialogController::DeInit()
-{
- if (m_xImpl->pMgr)
- {
- WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
- if (m_xDialog->get_resizable())
- nMask |= ( WindowStateMask::Width | WindowStateMask::Height );
- m_xImpl->aWinState = m_xDialog->get_window_state(nMask);
- GetBindings().GetWorkWindow_Impl()->ConfigChild_Impl( SfxChildIdentifier::DOCKINGWINDOW, SfxDockingConfig::ALIGNDOCKINGWINDOW, m_xImpl->pMgr->GetType() );
- }
-
- m_xImpl->pMgr = nullptr;
-}
-
-/* [Description]
-
- If a ModelessDialog is enabled its ViewFrame will be activated.
- This is necessary by PluginInFrames.
-*/
-IMPL_LINK_NOARG(SfxModelessDialogController, FocusInHdl, weld::Widget&, void)
-{
- if (!m_xImpl)
- return;
- m_pBindings->SetActiveFrame(m_xImpl->pMgr->GetFrame());
- m_xImpl->pMgr->Activate_Impl();
-}
-
-IMPL_LINK_NOARG(SfxModelessDialogController, FocusOutHdl, weld::Widget&, void)
-{
- if (!m_xImpl)
- return;
- m_pBindings->SetActiveFrame(css::uno::Reference< css::frame::XFrame>());
-}
-
-SfxModelessDialogController::~SfxModelessDialogController()
-{
- if (!m_xImpl->pMgr)
- return;
- auto xFrame = m_xImpl->pMgr->GetFrame();
- if (!xFrame)
- return;
- if (xFrame == m_pBindings->GetActiveFrame())
- m_pBindings->SetActiveFrame(nullptr);
-}
-
-void SfxModelessDialogController::EndDialog()
-{
- if (!m_xDialog->get_visible())
- return;
- m_xImpl->bClosing = true;
- response(RET_CLOSE);
- m_xImpl->bClosing = false;
-}
-
-/* [Description]
-
- The window is closed when the ChildWindow is destroyed by running the
- ChildWindow-slots.
-*/
-void SfxModelessDialogController::Close()
-{
- if (m_xImpl->bClosing)
- return;
- // Execute with Parameters, since Toggle is ignored by some ChildWindows.
- SfxBoolItem aValue(m_xImpl->pMgr->GetType(), false);
- m_pBindings->GetDispatcher_Impl()->ExecuteList(
- m_xImpl->pMgr->GetType(),
- SfxCallMode::RECORD|SfxCallMode::SYNCHRON, { &aValue } );
-}
-
-/* [Description]
-
- Fills a SfxChildWinInfo with specific data from SfxModelessDialog,
- so that it can be written in the INI file. It is assumed that rinfo
- receives all other possible relevant data in the ChildWindow class.
- ModelessDialogs have no specific information, so that the base
- implementation does nothing and therefore must not be called.
-*/
-void SfxModelessDialogController::FillInfo(SfxChildWinInfo& rInfo) const
-{
- rInfo.aSize = m_xDialog->get_size();
-}
-
bool SfxFloatingWindow::EventNotify( NotifyEvent& rEvt )
/* [Description]
@@ -881,6 +756,7 @@ void SfxSingleTabDialogController::SetTabPage(SfxTabPage* pTabPage)
aUserItem >>= sUserData;
m_xSfxPage->SetUserData(sUserData);
m_xSfxPage->Reset(GetInputItemSet());
+//TODO m_xSfxPage->Show();
m_xHelpBtn->show(Help::IsContextHelpEnabled());
diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx
index 38c41653dfdb..7b37d065afa4 100644
--- a/sfx2/source/inc/workwin.hxx
+++ b/sfx2/source/inc/workwin.hxx
@@ -84,7 +84,6 @@ namespace o3tl
struct SfxChild_Impl
{
VclPtr<vcl::Window> pWin;
- std::shared_ptr<SfxModelessDialogController> xController;
Size aSize;
SfxChildAlignment eAlign;
SfxChildVisibility nVisible;
@@ -98,14 +97,6 @@ struct SfxChild_Impl
{
nVisible = bIsVisible ? SfxChildVisibility::VISIBLE : SfxChildVisibility::NOT_VISIBLE;
}
-
- SfxChild_Impl(std::shared_ptr<SfxModelessDialogController>& rChild,
- SfxChildAlignment eAlignment):
- pWin(nullptr), xController(rChild), eAlign(eAlignment), bResize(false),
- bSetFocus( false )
- {
- nVisible = xController->getDialog()->get_visible() ? SfxChildVisibility::VISIBLE : SfxChildVisibility::NOT_VISIBLE;
- }
};
struct SfxChildWin_Impl
@@ -248,9 +239,7 @@ public:
// Methods for all Child windows
void DataChanged_Impl();
void ReleaseChild_Impl( vcl::Window& rWindow );
- void ReleaseChild_Impl(SfxModelessDialogController&);
SfxChild_Impl* RegisterChild_Impl( vcl::Window& rWindow, SfxChildAlignment eAlign );
- SfxChild_Impl* RegisterChild_Impl(std::shared_ptr<SfxModelessDialogController>& rController, SfxChildAlignment eAlign);
void ShowChildren_Impl();
void HideChildren_Impl();
bool PrepareClose_Impl();