summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2018-01-11 13:31:36 -0400
committerpranavk <pranavk@collabora.co.uk>2018-01-18 11:17:00 +0100
commit072e3ce1cfea5bb61cc5f3001c288df6deb45613 (patch)
tree60dcc15428c831065ed2c0673c2f73f0123a12ca
parentandroid: fix some layout issues with new-document buttons (diff)
downloadcore-072e3ce1cfea5bb61cc5f3001c288df6deb45613.tar.gz
core-072e3ce1cfea5bb61cc5f3001c288df6deb45613.zip
lok dialog: enable MessageDialog tunneling
Change-Id: I05b270a19e29c5ed3a2482fd8163e61e66bfdf74 Reviewed-on: https://gerrit.libreoffice.org/47772 Reviewed-by: pranavk <pranavk@collabora.co.uk> Tested-by: pranavk <pranavk@collabora.co.uk>
-rw-r--r--include/sfx2/basedlgs.hxx1
-rw-r--r--include/vcl/dialog.hxx1
-rw-r--r--include/vcl/window.hxx2
-rw-r--r--sfx2/source/dialog/basedlgs.cxx24
-rw-r--r--sfx2/source/dialog/tabdlg.cxx21
-rw-r--r--sfx2/source/view/viewfrm.cxx5
-rw-r--r--sfx2/source/view/viewsh.cxx9
m---------translations0
-rw-r--r--vcl/source/window/dialog.cxx37
-rw-r--r--vcl/source/window/window.cxx19
10 files changed, 63 insertions, 56 deletions
diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
index db885c7173a2..670fc10f7238 100644
--- a/include/sfx2/basedlgs.hxx
+++ b/include/sfx2/basedlgs.hxx
@@ -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;
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 7fe00ba1c8c3..eaf9bbe99960 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -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;
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 528ba110bd04..3fe40355bab3 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -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;
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 5379702e7d0a..9ed41424e133 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -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!" );
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index dea1658092fe..4eb7a29d1c49 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -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 )
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 149b24b89826..de705dc9ff61 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -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() )
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 0f05946039f2..c64a50031119 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -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() )
{
diff --git a/translations b/translations
-Subproject 4c9058997dff2f568d90ead5d9b50fc92b1281c
+Subproject 4e3651a5d0e16bd39067227b9279f5cc98fbc12
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 972b6671f0ed..c61a41be32f1 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -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;
}
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index f1ee1d744baa..aedd405f1c04 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -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;
}