Kaydet (Commit) 072e3ce1 authored tarafından Henry Castro's avatar Henry Castro Kaydeden (comit) pranavk

lok dialog: enable MessageDialog tunneling

Change-Id: I05b270a19e29c5ed3a2482fd8163e61e66bfdf74
Reviewed-on: https://gerrit.libreoffice.org/47772Reviewed-by: 's avatarpranavk <pranavk@collabora.co.uk>
Tested-by: 's avatarpranavk <pranavk@collabora.co.uk>
üst 64619789
......@@ -72,7 +72,6 @@ public:
virtual ~SfxModalDialog() override;
virtual void dispose() override;
virtual short Execute() override;
const SfxItemSet* GetOutputItemSet() const { return pOutputSet; }
const SfxItemSet* GetInputItemSet() const { return pInputSet; }
void StateChanged( StateChangedType nStateChange ) override;
......
......@@ -60,6 +60,7 @@ private:
SAL_DLLPRIVATE void RemoveFromDlgList();
SAL_DLLPRIVATE void ImplInitDialogData();
SAL_DLLPRIVATE void ImplInitSettings();
SAL_DLLPRIVATE inline void ImplLOKNotifier(vcl::Window* pParent);
SAL_DLLPRIVATE VclPtr<vcl::Window> AddBorderWindow(vcl::Window* pParent, WinBits nBits);
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
......
......@@ -1209,7 +1209,7 @@ public:
void SetComponentInterface( css::uno::Reference< css::awt::XWindowPeer > const & xIFace );
/// Interface to register for dialog / window tunneling.
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier);
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier, bool bParent = false);
const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() const;
vcl::LOKWindowId GetLOKWindowId() const;
......
......@@ -161,33 +161,9 @@ void SfxModalDialog::dispose()
SetDialogData_Impl();
delete pOutputSet;
if (comphelper::LibreOfficeKit::isActive() && GetLOKNotifier())
{
SfxViewShell::Current()->notifyWindow(GetLOKWindowId(), "close");
ReleaseLOKNotifier();
}
ModalDialog::dispose();
}
short SfxModalDialog::Execute()
{
SfxViewShell* pViewShell = SfxViewShell::Current();
if (comphelper::LibreOfficeKit::isActive() && pViewShell && !GetLOKNotifier())
{
SetLOKNotifier(pViewShell);
const Size aSize = GetOptimalSize();
std::vector<vcl::LOKPayloadItem> aItems;
aItems.emplace_back("type", "dialog");
aItems.emplace_back("size", aSize.toString());
if (!GetText().isEmpty())
aItems.emplace_back("title", GetText().toUtf8());
pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
}
return ModalDialog::Execute();
}
void SfxModalDialog::CreateOutputItemSet( SfxItemPool& rPool )
{
DBG_ASSERT( !pOutputSet, "Double creation of OutputSet!" );
......
......@@ -403,13 +403,6 @@ void SfxTabDialog::dispose()
m_pBaseFmtBtn.clear();
m_pActionArea.clear();
SfxViewShell* pViewShell = SfxViewShell::Current();
if (comphelper::LibreOfficeKit::isActive() && pViewShell)
{
pViewShell->notifyWindow(GetLOKWindowId(), "close");
ReleaseLOKNotifier();
}
TabDialog::dispose();
}
......@@ -587,20 +580,6 @@ void SfxTabDialog::Start_Impl()
m_pTabCtrl->SetCurPageId( nActPage );
ActivatePageHdl( m_pTabCtrl );
SfxViewShell* pViewShell = SfxViewShell::Current();
if (comphelper::LibreOfficeKit::isActive() && pViewShell && !GetLOKNotifier())
{
SetLOKNotifier(pViewShell);
const Size aSize = GetOptimalSize();
std::vector<vcl::LOKPayloadItem> aItems;
aItems.emplace_back("type", "dialog");
aItems.emplace_back("size", aSize.toString());
if (!GetText().isEmpty())
aItems.emplace_back("title", GetText().toUtf8());
pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
}
}
void SfxTabDialog::AddTabPage( sal_uInt16 nId, const OUString &rRiderText )
......
......@@ -1261,8 +1261,13 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
}
case SfxHintId::Deinitializing:
{
if (GetWindow().GetLOKNotifier())
GetWindow().ReleaseLOKNotifier();
GetFrame().DoClose();
break;
}
case SfxHintId::Dying:
// when the Object is being deleted, destroy the view too
if ( m_xObjSh.is() )
......
......@@ -1072,6 +1072,9 @@ SfxViewShell::SfxViewShell
// Insert into list
SfxViewShellArr_Impl &rViewArr = SfxGetpApp()->GetViewShells_Impl();
rViewArr.push_back(this);
if (comphelper::LibreOfficeKit::isActive())
pViewFrame->GetWindow().SetLOKNotifier(this, true);
}
......@@ -1095,6 +1098,9 @@ SfxViewShell::~SfxViewShell()
pImpl->m_pController->ReleaseShell_Impl();
pImpl->m_pController.clear();
}
if (GetViewFrame()->GetWindow().GetLOKNotifier())
GetViewFrame()->GetWindow().ReleaseLOKNotifier();
}
bool SfxViewShell::PrepareClose
......@@ -1102,6 +1108,9 @@ bool SfxViewShell::PrepareClose
bool bUI // TRUE: Allow Dialog and so on, FALSE: silent-mode
)
{
if (GetViewFrame()->GetWindow().GetLOKNotifier())
GetViewFrame()->GetWindow().ReleaseLOKNotifier();
SfxPrinter *pPrinter = GetPrinter();
if ( pPrinter && pPrinter->IsPrinting() )
{
......
translations @ 4e3651a5
Subproject commit 4c9058997dff2f568d90ead5d9b50fc92b1281cc
Subproject commit 4e3651a5d0e16bd39067227b9279f5cc98fbc127
......@@ -489,6 +489,17 @@ void Dialog::ImplInitSettings()
SetBackground(GetSettings().GetStyleSettings().GetDialogColor());
}
void Dialog::ImplLOKNotifier(vcl::Window* pParent)
{
if (comphelper::LibreOfficeKit::isActive() && pParent)
{
if (VclPtr<vcl::Window> pWin = pParent->GetParentWithLOKNotifier())
{
SetLOKNotifier(pWin->GetLOKNotifier());
}
}
}
Dialog::Dialog( WindowType nType )
: SystemWindow( nType )
, mbForceBorderWindow(false)
......@@ -525,6 +536,7 @@ Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXML
, mbForceBorderWindow(false)
, mnInitFlag(InitFlag::Default)
{
ImplLOKNotifier(pParent);
ImplInitDialogData();
loadUI(pParent, OUStringToOString(rID, RTL_TEXTENCODING_UTF8), rUIXMLDescription);
}
......@@ -534,6 +546,7 @@ Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXML
, mbForceBorderWindow(bBorder)
, mnInitFlag(eFlag)
{
ImplLOKNotifier(pParent);
ImplInitDialogData();
loadUI(pParent, OUStringToOString(rID, RTL_TEXTENCODING_UTF8), rUIXMLDescription);
}
......@@ -543,6 +556,7 @@ Dialog::Dialog(vcl::Window* pParent, WinBits nStyle, InitFlag eFlag)
, mbForceBorderWindow(false)
, mnInitFlag(eFlag)
{
ImplLOKNotifier(pParent);
ImplInitDialogData();
ImplInit( pParent, nStyle, eFlag );
}
......@@ -593,6 +607,15 @@ void Dialog::dispose()
xEventBroadcaster->documentEventOccured(aObject);
UITestLogger::getInstance().log("DialogClosed");
if (comphelper::LibreOfficeKit::isActive())
{
if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
{
pNotifier->notifyWindow(GetLOKWindowId(), "close");
ReleaseLOKNotifier();
}
}
SystemWindow::dispose();
}
......@@ -859,6 +882,20 @@ bool Dialog::ImplStartExecuteModal()
xEventBroadcaster->documentEventOccured(aObject);
UITestLogger::getInstance().log("DialogExecute");
if (comphelper::LibreOfficeKit::isActive())
{
if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
{
const Size aSize = GetOptimalSize();
std::vector<vcl::LOKPayloadItem> aItems;
aItems.emplace_back("type", "dialog");
aItems.emplace_back("size", aSize.toString());
if (!GetText().isEmpty())
aItems.emplace_back("title", GetText().toUtf8());
pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
}
}
return true;
}
......
......@@ -3177,19 +3177,22 @@ LOKWindowsMap& GetLOKWindowsMap()
}
void Window::SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier)
void Window::SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier, bool bParent)
{
// don't allow setting this twice
assert(mpWindowImpl->mpLOKNotifier == nullptr);
assert(pNotifier);
// Counter to be able to have unique id's for each window.
static vcl::LOKWindowId sLastLOKWindowId = 1;
if (!bParent)
{
// Counter to be able to have unique id's for each window.
static vcl::LOKWindowId sLastLOKWindowId = 1;
// assign the LOK window id
assert(mpWindowImpl->mnLOKWindowId == 0);
mpWindowImpl->mnLOKWindowId = sLastLOKWindowId++;
GetLOKWindowsMap().insert(std::map<vcl::LOKWindowId, VclPtr<vcl::Window>>::value_type(mpWindowImpl->mnLOKWindowId, this));
// assign the LOK window id
assert(mpWindowImpl->mnLOKWindowId == 0);
mpWindowImpl->mnLOKWindowId = sLastLOKWindowId++;
GetLOKWindowsMap().insert(std::map<vcl::LOKWindowId, VclPtr<vcl::Window>>::value_type(mpWindowImpl->mnLOKWindowId, this));
}
mpWindowImpl->mpLOKNotifier = pNotifier;
}
......@@ -3220,8 +3223,6 @@ const vcl::ILibreOfficeKitNotifier* Window::GetLOKNotifier() const
vcl::LOKWindowId Window::GetLOKWindowId() const
{
assert(mpWindowImpl->mnLOKWindowId > 0);
return mpWindowImpl->mnLOKWindowId;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment