[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 16 commits - chart2/source desktop/inc desktop/source editeng/source filter/source include/comphelper include/LibreOfficeKit include/sfx2 include/vcl libreofficekit/qa libreofficekit/source offapi/com offapi/UnoApi_offapi.mk officecfg/registry sc/qa sc/source sd/qa sd/source sfx2/Library_sfx.mk sfx2/source svtools/source sw/source uui/inc uui/source vcl/source

Pranav Kant pranavk at collabora.co.uk
Tue Mar 27 10:24:46 UTC 2018


 chart2/source/controller/main/ChartController_EditData.cxx          |    3 
 chart2/source/controller/main/ChartController_Window.cxx            |    9 
 desktop/inc/app.hxx                                                 |    2 
 desktop/source/lib/init.cxx                                         |    8 
 editeng/source/editeng/editview.cxx                                 |    6 
 filter/source/config/cache/constant.hxx                             |    1 
 filter/source/config/cache/filtercache.cxx                          |    6 
 filter/source/config/fragments/filters/AbiWord.xcu                  |    2 
 filter/source/config/fragments/filters/MWAW_Bitmap.xcu              |    2 
 filter/source/config/fragments/filters/MWAW_Database.xcu            |    2 
 filter/source/config/fragments/filters/MWAW_Drawing.xcu             |    2 
 filter/source/config/fragments/filters/MWAW_Presentation.xcu        |    2 
 filter/source/config/fragments/filters/MWAW_Spreadsheet.xcu         |    2 
 filter/source/config/fragments/filters/MWAW_Text_Document.xcu       |    2 
 filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu    |    2 
 filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu  |    2 
 filter/source/config/fragments/filters/T602Document.xcu             |    2 
 filter/source/config/fragments/filters/XPM.xcu                      |    2 
 filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu       |    2 
 include/LibreOfficeKit/LibreOfficeKitEnums.h                        |   11 
 include/comphelper/documentconstants.hxx                            |    4 
 include/sfx2/docfilt.hxx                                            |    3 
 include/sfx2/objsh.hxx                                              |    3 
 include/vcl/menu.hxx                                                |    9 
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx                 |    6 
 libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx |    9 
 libreofficekit/source/gtk/lokdocview.cxx                            |   22 +
 offapi/UnoApi_offapi.mk                                             |    1 
 offapi/com/sun/star/document/ExoticFileLoadException.idl            |   34 +
 officecfg/registry/schema/org/openoffice/Office/Common.xcs          |   23 +
 sc/qa/unit/tiledrendering/tiledrendering.cxx                        |   43 ++
 sc/source/ui/app/scmod.cxx                                          |   32 -
 sc/source/ui/formdlg/formula.cxx                                    |    6 
 sc/source/ui/inc/anyrefdg.hxx                                       |    4 
 sc/source/ui/miscdlgs/anyrefdg.cxx                                  |   32 -
 sd/qa/unit/tiledrendering/tiledrendering.cxx                        |  210 +++++-----
 sd/source/ui/func/fuarea.cxx                                        |    9 
 sd/source/ui/func/fuline.cxx                                        |    8 
 sd/source/ui/func/futransf.cxx                                      |    8 
 sd/source/ui/inc/ViewShell.hxx                                      |    2 
 sd/source/ui/unoidl/unomodel.cxx                                    |   14 
 sd/source/ui/view/drviews2.cxx                                      |   12 
 sd/source/ui/view/viewshe2.cxx                                      |   12 
 sfx2/Library_sfx.mk                                                 |    1 
 sfx2/source/doc/exoticfileloadexception.cxx                         |   42 ++
 sfx2/source/doc/exoticfileloadexception.hxx                         |   42 ++
 sfx2/source/doc/objstor.cxx                                         |   37 +
 sfx2/source/view/viewsh.cxx                                         |   16 
 svtools/source/contnr/treelistbox.cxx                               |    3 
 sw/source/uibase/inc/olmenu.hxx                                     |    2 
 sw/source/uibase/uiview/viewling.cxx                                |   13 
 uui/inc/ids.hrc                                                     |    2 
 uui/inc/ids.hxx                                                     |    1 
 uui/source/iahndl.cxx                                               |   25 +
 vcl/source/window/builder.cxx                                       |    6 
 vcl/source/window/floatwin.cxx                                      |   14 
 vcl/source/window/menu.cxx                                          |    9 
 vcl/source/window/window2.cxx                                       |    6 
 58 files changed, 587 insertions(+), 208 deletions(-)

New commits:
commit 3b388ea53a73c2c62955338e7d03688c8ed9b26b
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Mar 15 20:09:26 2018 +0530

    sd lok: Set the view size to full page size + fix unit tests
    
    ... such that during insertion of objects when sd calculates the center
    of the view to place the object, it is the center of the whole slide,
    not the center of the default rectangle of 800x600.
    
    It's also important to hide rulers, scrollbars so that correct center is
    calculated; we don't need them anyways in LOK.
    
    Reviewed-on: https://gerrit.libreoffice.org/51416
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    (cherry picked from commit 21f56ccbd22ffa347edf931b7ed93c99988fbb8a)
    
    Change-Id: I2d1577bc963d324959b272ed3174571ab197d014

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 8676a09bb989..1feb91f37efa 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -109,11 +109,11 @@ public:
     void testDocumentRepair();
     void testLanguageStatus();
     void testDefaultView();
+    void testIMESupport();
     void testTdf115783();
+    void testPasteTextOnSlide();
     void testTdf115873();
     void testTdf115873Group();
-    void testIMESupport();
-    void testPasteTextOnSlide();
     void testCutSelectionChange();
 
     CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
@@ -155,11 +155,11 @@ public:
     CPPUNIT_TEST(testDocumentRepair);
     CPPUNIT_TEST(testLanguageStatus);
     CPPUNIT_TEST(testDefaultView);
+    CPPUNIT_TEST(testIMESupport);
     CPPUNIT_TEST(testTdf115783);
+    CPPUNIT_TEST(testPasteTextOnSlide);
     CPPUNIT_TEST(testTdf115873);
     CPPUNIT_TEST(testTdf115873Group);
-    CPPUNIT_TEST(testIMESupport);
-    CPPUNIT_TEST(testPasteTextOnSlide);
     CPPUNIT_TEST(testCutSelectionChange);
 
     CPPUNIT_TEST_SUITE_END();
@@ -339,6 +339,7 @@ xmlDocPtr SdTiledRenderingTest::parseXmlDump()
 
 void SdTiledRenderingTest::testRegisterCallback()
 {
+    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
     pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback, this);
@@ -354,6 +355,7 @@ void SdTiledRenderingTest::testRegisterCallback()
     CPPUNIT_ASSERT(!m_aInvalidation.IsEmpty());
     ::tools::Rectangle aTopLeft(0, 0, 256*15, 256*15); // 1 px = 15 twips, assuming 96 DPI.
     CPPUNIT_ASSERT(m_aInvalidation.IsOver(aTopLeft));
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SdTiledRenderingTest::testPostKeyEvent()
@@ -423,6 +425,7 @@ void SdTiledRenderingTest::testPostMouseEvent()
 
 void SdTiledRenderingTest::testSetTextSelection()
 {
+    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     uno::Reference<container::XIndexAccess> xDrawPage(pXImpressDocument->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
@@ -447,10 +450,12 @@ void SdTiledRenderingTest::testSetTextSelection()
     pXImpressDocument->setTextSelection(LOK_SETTEXTSELECTION_END, aEnd.getX(), aEnd.getY());
     // The new selection must include the ending dot, too -- but not the first word.
     CPPUNIT_ASSERT_EQUAL(OUString("bbb."), rEditView.GetSelected());
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SdTiledRenderingTest::testGetTextSelection()
 {
+    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     uno::Reference<container::XIndexAccess> xDrawPage(pXImpressDocument->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
@@ -471,10 +476,12 @@ void SdTiledRenderingTest::testGetTextSelection()
 
     // Make sure returned RTF is not empty.
     CPPUNIT_ASSERT(!pXImpressDocument->getTextSelection("text/rtf", aUsedFormat).isEmpty());
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SdTiledRenderingTest::testSetGraphicSelection()
 {
+    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("shape.odp");
     sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pPage = pViewShell->GetActualPage();
@@ -504,10 +511,13 @@ void SdTiledRenderingTest::testSetGraphicSelection()
     // Check that a resize happened, but aspect ratio is not kept.
     CPPUNIT_ASSERT_EQUAL(aShapeBefore.getWidth(), aShapeAfter.getWidth());
     CPPUNIT_ASSERT(aShapeBefore.getHeight() < aShapeAfter.getHeight());
+
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SdTiledRenderingTest::testUndoShells()
 {
+    comphelper::LibreOfficeKit::setActive();
     // Load a document and set the page size.
     SdXImpressDocument* pXImpressDocument = createDoc("shape.odp");
     uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
@@ -525,10 +535,12 @@ void SdTiledRenderingTest::testUndoShells()
     sal_Int32 nView1 = SfxLokHelper::getView();
     // This was -1, SdUndoGroup did not track what view shell created it.
     CPPUNIT_ASSERT_EQUAL(ViewShellId(nView1), pUndoManager->GetUndoAction()->GetViewShellId());
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SdTiledRenderingTest::testResetSelection()
 {
+    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     uno::Reference<container::XIndexAccess> xDrawPage(pXImpressDocument->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
@@ -549,6 +561,7 @@ void SdTiledRenderingTest::testResetSelection()
     // Now use resetSelection() to reset the selection.
     pXImpressDocument->resetSelection();
     CPPUNIT_ASSERT(!pView->GetTextEditObject());
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 static void lcl_search(const OUString& rKey, bool bFindAll = false)
@@ -662,6 +675,7 @@ void SdTiledRenderingTest::testSearchAllFollowedBySearch()
     // This used to give wrong result: 'search' after 'search all' still
     // returned 'third'
     CPPUNIT_ASSERT_EQUAL(OString("match"), pXImpressDocument->getTextSelection("text/plain;charset=utf-8", aUsedFormat));
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SdTiledRenderingTest::testDontSearchInMasterPages()
@@ -1555,6 +1569,7 @@ void SdTiledRenderingTest::testTdf104405()
 
 void SdTiledRenderingTest::testTdf81754()
 {
+    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("tdf81754.pptx");
     sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pActualPage = pViewShell->GetActualPage();
@@ -1584,6 +1599,7 @@ void SdTiledRenderingTest::testTdf81754()
     CPPUNIT_ASSERT_EQUAL(OUString("Somethingxx"), aEdit.GetText(0));
 
     xDocShRef->DoClose();
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SdTiledRenderingTest::testTdf105502()
@@ -1955,6 +1971,47 @@ void SdTiledRenderingTest::testDefaultView()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void SdTiledRenderingTest::testIMESupport()
+{
+    // Load the document with notes view.
+    comphelper::LibreOfficeKit::setActive();
+
+    SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
+    VclPtr<vcl::Window> pDocWindow = pXImpressDocument->getDocWindow();
+    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+    SdrObject* pObject = pViewShell->GetActualPage()->GetObj(0);
+    SdrTextObj* pTextObj = static_cast<SdrTextObj*>(pObject);
+    SdrView* pView = pViewShell->GetView();
+    pView->MarkObj(pTextObj, pView->GetSdrPageView());
+    SfxStringItem aInputString(SID_ATTR_CHAR, "x");
+    pViewShell->GetViewFrame()->GetDispatcher()->ExecuteList(SID_ATTR_CHAR,
+                                                             SfxCallMode::SYNCHRON, { &aInputString });
+
+    // sequence of chinese IME compositions when 'nihao' is typed in an IME
+    const std::vector<OString> aUtf8Inputs{ "年", "你", "你好", "你哈", "你好", "你好" };
+    std::vector<OUString> aInputs;
+    std::transform(aUtf8Inputs.begin(), aUtf8Inputs.end(),
+                   std::back_inserter(aInputs), [](OString aInput) {
+                       return OUString::fromUtf8(aInput);
+                   });
+    for (const auto& aInput: aInputs)
+    {
+        pDocWindow->PostExtTextInputEvent(VclEventId::ExtTextInput, aInput);
+    }
+    pDocWindow->PostExtTextInputEvent(VclEventId::EndExtTextInput, "");
+
+    // the cursor should be at position 3rd
+    EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView();
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), rEditView.GetSelection().nStartPos);
+
+    ESelection aWordSelection(0, 0, 0, 3); // start para, start char, end para, end char.
+    rEditView.SetSelection(aWordSelection);
+    // content contains only the last IME composition, not all
+    CPPUNIT_ASSERT_EQUAL(OUString("x").concat(aInputs[aInputs.size() - 1]), rEditView.GetSelected());
+
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 void SdTiledRenderingTest::testTdf115783()
 {
     // Load the document.
@@ -2024,97 +2081,6 @@ void SdTiledRenderingTest::testTdf115783()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
-void SdTiledRenderingTest::testTdf115873()
-{
-    // Initialize the navigator.
-    SdXImpressDocument* pXImpressDocument = createDoc("tdf115873.fodp");
-    SfxViewShell* pViewShell = SfxViewShell::Current();
-    CPPUNIT_ASSERT(pViewShell);
-    SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
-    ScopedVclPtrInstance<SdNavigatorWin> pNavigator(nullptr, &rBindings);
-    pNavigator->InitTreeLB(pXImpressDocument->GetDoc());
-    pNavigator->Show();
-    VclPtr<SdPageObjsTLB> pObjects = pNavigator->GetObjects();
-    pObjects->Select(pObjects->GetEntry(0));
-    sd::ViewShell* pSdViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
-    SdrView* pSdrView = pSdViewShell->GetView();
-    pSdrView->UnmarkAllObj(pSdrView->GetSdrPageView());
-
-    // Make sure that no shapes are selected.
-    const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
-    Scheduler::ProcessEventsToIdle();
-    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), rMarkList.GetMarkCount());
-
-    // Single-click with the mouse.
-    short nHeight = pObjects->GetEntryHeight();
-    // Position of the center of the 2nd entry (first is the slide, second is
-    // the shape).
-    Point aPoint(pObjects->GetOutputWidthPixel() / 2, nHeight * 1.5);
-    MouseEvent aMouseEvent(aPoint, /*nClicks=*/1, MouseEventModifiers::NONE, MOUSE_LEFT);
-    pObjects->MouseButtonDown(aMouseEvent);
-    pObjects->MouseButtonUp(aMouseEvent);
-    Scheduler::ProcessEventsToIdle();
-    // This failed, single-click did not result in a shape selection (only
-    // double-click did).
-    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rMarkList.GetMarkCount());
-}
-
-void SdTiledRenderingTest::testTdf115873Group()
-{
-    // Initialize the navigator.
-    SdXImpressDocument* pXImpressDocument = createDoc("tdf115873-group.fodp");
-    SfxViewShell* pViewShell = SfxViewShell::Current();
-    CPPUNIT_ASSERT(pViewShell);
-    SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
-    ScopedVclPtrInstance<SdNavigatorWin> pNavigator(nullptr, &rBindings);
-    pNavigator->InitTreeLB(pXImpressDocument->GetDoc());
-    VclPtr<SdPageObjsTLB> pObjects = pNavigator->GetObjects();
-    // This failed, Fill() and IsEqualToDoc() were out of sync for group
-    // shapes.
-    CPPUNIT_ASSERT(pObjects->IsEqualToDoc(pXImpressDocument->GetDoc()));
-}
-
-void SdTiledRenderingTest::testIMESupport()
-{
-    // Load the document with notes view.
-    comphelper::LibreOfficeKit::setActive();
-
-    SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
-    VclPtr<vcl::Window> pDocWindow = pXImpressDocument->getDocWindow();
-    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
-    SdrObject* pObject = pViewShell->GetActualPage()->GetObj(0);
-    SdrTextObj* pTextObj = static_cast<SdrTextObj*>(pObject);
-    SdrView* pView = pViewShell->GetView();
-    pView->MarkObj(pTextObj, pView->GetSdrPageView());
-    SfxStringItem aInputString(SID_ATTR_CHAR, "x");
-    pViewShell->GetViewFrame()->GetDispatcher()->ExecuteList(SID_ATTR_CHAR,
-                                                             SfxCallMode::SYNCHRON, { &aInputString });
-
-    // sequence of chineese IME compositions when 'nihao' is typed in an IME
-    const std::vector<OString> aUtf8Inputs{ "年", "你", "你好", "你哈", "你好", "你好" };
-    std::vector<OUString> aInputs;
-    std::transform(aUtf8Inputs.begin(), aUtf8Inputs.end(),
-                   std::back_inserter(aInputs), [](OString aInput) {
-                       return OUString::fromUtf8(aInput);
-                   });
-    for (const auto& aInput: aInputs)
-    {
-        pDocWindow->PostExtTextInputEvent(VclEventId::ExtTextInput, aInput);
-    }
-    pDocWindow->PostExtTextInputEvent(VclEventId::EndExtTextInput, "");
-
-    // the cursor should be at position 3rd
-    EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView();
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), rEditView.GetSelection().nStartPos);
-
-    ESelection aWordSelection(0, 0, 0, 3); // start para, start char, end para, end char.
-    rEditView.SetSelection(aWordSelection);
-    // content contains only the last IME composition, not all
-    CPPUNIT_ASSERT_EQUAL(OUString("x").concat(aInputs[aInputs.size() - 1]), rEditView.GetSelected());
-
-    comphelper::LibreOfficeKit::setActive(false);
-}
-
 void SdTiledRenderingTest::testPasteTextOnSlide()
 {
     // Load the document.
@@ -2180,6 +2146,60 @@ void SdTiledRenderingTest::testPasteTextOnSlide()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void SdTiledRenderingTest::testTdf115873()
+{
+    comphelper::LibreOfficeKit::setActive();
+    // Initialize the navigator.
+    SdXImpressDocument* pXImpressDocument = createDoc("tdf115873.fodp");
+    SfxViewShell* pViewShell = SfxViewShell::Current();
+    CPPUNIT_ASSERT(pViewShell);
+    SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
+    ScopedVclPtrInstance<SdNavigatorWin> pNavigator(nullptr, &rBindings);
+    pNavigator->InitTreeLB(pXImpressDocument->GetDoc());
+    pNavigator->Show();
+    VclPtr<SdPageObjsTLB> pObjects = pNavigator->GetObjects();
+    pObjects->Select(pObjects->GetEntry(0));
+    sd::ViewShell* pSdViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+    SdrView* pSdrView = pSdViewShell->GetView();
+    pSdrView->UnmarkAllObj(pSdrView->GetSdrPageView());
+
+    // Make sure that no shapes are selected.
+    const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), rMarkList.GetMarkCount());
+
+    // Single-click with the mouse.
+    short nHeight = pObjects->GetEntryHeight();
+    // Position of the center of the 2nd entry (first is the slide, second is
+    // the shape).
+    Point aPoint(pObjects->GetOutputWidthPixel() / 2, nHeight * 1.5);
+    MouseEvent aMouseEvent(aPoint, /*nClicks=*/1, MouseEventModifiers::NONE, MOUSE_LEFT);
+    pObjects->MouseButtonDown(aMouseEvent);
+    pObjects->MouseButtonUp(aMouseEvent);
+    Scheduler::ProcessEventsToIdle();
+    // This failed, single-click did not result in a shape selection (only
+    // double-click did).
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rMarkList.GetMarkCount());
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
+void SdTiledRenderingTest::testTdf115873Group()
+{
+    comphelper::LibreOfficeKit::setActive();
+    // Initialize the navigator.
+    SdXImpressDocument* pXImpressDocument = createDoc("tdf115873-group.fodp");
+    SfxViewShell* pViewShell = SfxViewShell::Current();
+    CPPUNIT_ASSERT(pViewShell);
+    SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
+    ScopedVclPtrInstance<SdNavigatorWin> pNavigator(nullptr, &rBindings);
+    pNavigator->InitTreeLB(pXImpressDocument->GetDoc());
+    VclPtr<SdPageObjsTLB> pObjects = pNavigator->GetObjects();
+    // This failed, Fill() and IsEqualToDoc() were out of sync for group
+    // shapes.
+    CPPUNIT_ASSERT(pObjects->IsEqualToDoc(pXImpressDocument->GetDoc()));
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 void SdTiledRenderingTest::testCutSelectionChange()
 {
     // Load the document.
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index ec5ff6514bd9..fbbfb5f4919e 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -190,6 +190,8 @@ public:
 
     bool HasRuler() { return mbHasRulers;}
     void SetRuler(bool bRuler);
+    // Hides horizontal, vertical scrollbar as well as scrollbox
+    void SetScrollBarsVisible(bool bVisible);
 
     /** Set internal values of all scroll bars that determine thumb size and
         position.  The external values like size and position of the scroll
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index ae800a94f0ff..fd22e09ecd03 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2446,11 +2446,21 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs
         SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType());
         pOptions->SetShowComments(comphelper::LibreOfficeKit::isTiledAnnotations());
 
-        // Disable map mode, so that it's possible to send mouse event coordinates
-        // in logic units.
+        pViewShell->SetRuler(false);
+        pViewShell->SetScrollBarsVisible(false);
+
         if (sd::Window* pWindow = pViewShell->GetActiveWindow())
         {
+            // get the full page size in pixels
+            pWindow->EnableMapMode();
+            Size aSize(pWindow->LogicToPixel(pDrawView->GetSdrPageView()->GetPage()->GetSize()));
+            // Disable map mode, so that it's possible to send mouse event
+            // coordinates in logic units
             pWindow->EnableMapMode(false);
+
+            // arrange UI elements again with new view size
+            pViewShell->GetParentWindow()->SetSizePixel(aSize);
+            pViewShell->Resize();
         }
 
         // Forces all images to be swapped in synchronously, this
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index 64a11a91cda0..fe8580ec4218 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -939,6 +939,18 @@ void ViewShell::SetRuler(bool bRuler)
         GetViewShell()->InvalidateBorder();
 }
 
+void ViewShell::SetScrollBarsVisible(bool bVisible)
+{
+    if (mpVerticalScrollBar.get() != nullptr)
+        mpVerticalScrollBar->Show( bVisible );
+
+    if (mpHorizontalScrollBar.get() != nullptr)
+        mpHorizontalScrollBar->Show( bVisible );
+
+    if (mpScrollBarBox.get() != nullptr)
+        mpScrollBarBox->Show(bVisible);
+}
+
 sal_Int8 ViewShell::AcceptDrop (
     const AcceptDropEvent& rEvt,
     DropTargetHelper& rTargetHelper,
commit f1c5471d781f3f1549d23c9de8e09cdc7a2f4b84
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Feb 25 14:14:40 2018 -0500

    lok: notify clients of clipboard changes
    
    Change-Id: I93d8eacc0defb1176ec5d767f49356812cf90ff6
    Reviewed-on: https://gerrit.libreoffice.org/50327
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    (cherry picked from commit de774e261a59625336fe4d744d8c8e2966b570d2)

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index ccbc3b96b065..691018277e25 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -568,6 +568,17 @@ typedef enum
      * - "close" - window is closed
      */
     LOK_CALLBACK_WINDOW = 36,
+
+    /**
+     * Notification that the clipboard contents have changed.
+     * Typically fired in response to copying to clipboard.
+     *
+     * The payload currently is empty and it's up to the
+     * client to get the contents, if necessary. However,
+     * in the future the contents might be included for
+     * convenience.
+     */
+    LOK_CALLBACK_CLIPBOARD_CHANGED = 37,
 }
 LibreOfficeKitCallbackType;
 
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 0174aa2caa40..65213c459ed6 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -155,12 +155,18 @@ SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView, con
 void SfxClipboardChangeListener::ChangedContents()
 {
     const SolarMutexGuard aGuard;
-    if( m_pViewShell )
+    if (m_pViewShell)
     {
         SfxBindings& rBind = m_pViewShell->GetViewFrame()->GetBindings();
-        rBind.Invalidate( SID_PASTE );
-        rBind.Invalidate( SID_PASTE_SPECIAL );
-        rBind.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
+        rBind.Invalidate(SID_PASTE);
+        rBind.Invalidate(SID_PASTE_SPECIAL);
+        rBind.Invalidate(SID_CLIPBOARD_FORMAT_ITEMS);
+
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            // In the future we might send the payload as well.
+            SfxLokHelper::notifyAllViews(LOK_CALLBACK_CLIPBOARD_CHANGED, "");
+        }
     }
 }
 
@@ -815,7 +821,7 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveClient() const
     if ( !pClients )
         return nullptr;
 
-    bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
+    const bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
 
     for (SfxInPlaceClient* pIPClient : *pClients)
     {
commit 9554b95413c82ee4e18e08a69fb7a6477b0c9e22
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Feb 25 15:07:19 2015 +0000

    First cut at annotating 'exotic' filters.
    
    The idea being that we can improve security by warning for these.
    
    Change-Id: I7d993417bfb6a8fe868bc3e07ccbcfe71bf285ff
    Reviewed-on: https://gerrit.libreoffice.org/50387
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    (cherry picked from commit 25e4b59b2e9805ebd3c38c40e5591125a05ed5b0)

diff --git a/filter/source/config/cache/constant.hxx b/filter/source/config/cache/constant.hxx
index c8a45889ee0e..2a5da1529de3 100644
--- a/filter/source/config/cache/constant.hxx
+++ b/filter/source/config/cache/constant.hxx
@@ -121,6 +121,7 @@
 #define  FLAGNAME_TEMPLATEPATH      "TEMPLATEPATH"
 #define  FLAGNAME_COMBINED          "COMBINED"
 #define FLAGNAME_SUPPORTSSIGNING "SUPPORTSSIGNING"
+#define FLAGNAME_EXOTIC "EXOTIC"
 
 /** @short  some uno service names.
  */
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index 92759e063ef9..5b3ff866cdb4 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -1864,6 +1864,7 @@ css::uno::Sequence< OUString > FilterCache::impl_convertFlagField2FlagNames(SfxF
     if (nFlags & SfxFilterFlags::COMBINED         ) lFlagNames.emplace_back(FLAGNAME_COMBINED         );
     if (nFlags & SfxFilterFlags::SUPPORTSSIGNING) lFlagNames.emplace_back(FLAGNAME_SUPPORTSSIGNING);
     if (nFlags & SfxFilterFlags::GPGENCRYPTION) lFlagNames.emplace_back(FLAGNAME_GPGENCRYPTION);
+    if (nFlags & SfxFilterFlags::EXOTIC) lFlagNames.emplace_back(FLAGNAME_EXOTIC);
 
     return comphelper::containerToSequence(lFlagNames);
 }
@@ -1904,6 +1905,11 @@ SfxFilterFlags FilterCache::impl_convertFlagNames2FlagField(const css::uno::Sequ
             nField |= SfxFilterFlags::ENCRYPTION;
             continue;
         }
+        if (pNames[i] == FLAGNAME_EXOTIC)
+        {
+            nField |= SfxFilterFlags::EXOTIC;
+            continue;
+        }
         if (pNames[i] == FLAGNAME_EXPORT)
         {
             nField |= SfxFilterFlags::EXPORT;
diff --git a/filter/source/config/fragments/filters/AbiWord.xcu b/filter/source/config/fragments/filters/AbiWord.xcu
index 115febd8aafe..a309ac87d379 100644
--- a/filter/source/config/fragments/filters/AbiWord.xcu
+++ b/filter/source/config/fragments/filters/AbiWord.xcu
@@ -16,7 +16,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 -->
     <node oor:name="AbiWord" oor:op="replace">
-        <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+        <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER EXOTIC</value></prop>
         <prop oor:name="UIComponent"/>
         <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.AbiWordImportFilter</value></prop>
         <prop oor:name="UserData"><value>ABW</value></prop>
diff --git a/filter/source/config/fragments/filters/MWAW_Bitmap.xcu b/filter/source/config/fragments/filters/MWAW_Bitmap.xcu
index 034b72132219..3e70cc62f972 100644
--- a/filter/source/config/fragments/filters/MWAW_Bitmap.xcu
+++ b/filter/source/config/fragments/filters/MWAW_Bitmap.xcu
@@ -9,7 +9,7 @@
 
 <node oor:name="MWAW_Bitmap" oor:op="replace">
     <prop oor:name="Flags">
-        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value>
+        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC</value>
     </prop>
     <prop oor:name="FilterService">
         <value>com.sun.star.comp.Draw.MWAWDrawImportFilter</value>
diff --git a/filter/source/config/fragments/filters/MWAW_Database.xcu b/filter/source/config/fragments/filters/MWAW_Database.xcu
index 3ff4182ef6c6..075f3ed9e13e 100644
--- a/filter/source/config/fragments/filters/MWAW_Database.xcu
+++ b/filter/source/config/fragments/filters/MWAW_Database.xcu
@@ -9,7 +9,7 @@
 
 <node oor:name="MWAW_Database" oor:op="replace">
     <prop oor:name="Flags">
-        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value>
+        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC</value>
     </prop>
     <prop oor:name="FilterService">
         <value>com.sun.star.comp.Calc.MWAWCalcImportFilter</value>
diff --git a/filter/source/config/fragments/filters/MWAW_Drawing.xcu b/filter/source/config/fragments/filters/MWAW_Drawing.xcu
index b92f378497dd..1b9ec56d27ee 100644
--- a/filter/source/config/fragments/filters/MWAW_Drawing.xcu
+++ b/filter/source/config/fragments/filters/MWAW_Drawing.xcu
@@ -9,7 +9,7 @@
 
 <node oor:name="MWAW_Drawing" oor:op="replace">
     <prop oor:name="Flags">
-        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value>
+        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC</value>
     </prop>
     <prop oor:name="FilterService">
         <value>com.sun.star.comp.Draw.MWAWDrawImportFilter</value>
diff --git a/filter/source/config/fragments/filters/MWAW_Presentation.xcu b/filter/source/config/fragments/filters/MWAW_Presentation.xcu
index 8cfa9445621d..aae6598b27c0 100644
--- a/filter/source/config/fragments/filters/MWAW_Presentation.xcu
+++ b/filter/source/config/fragments/filters/MWAW_Presentation.xcu
@@ -9,7 +9,7 @@
 
 <node oor:name="MWAW_Presentation" oor:op="replace">
     <prop oor:name="Flags">
-        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value>
+        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC</value>
     </prop>
     <prop oor:name="FilterService">
         <value>com.sun.star.comp.Impress.MWAWPresentationImportFilter</value>
diff --git a/filter/source/config/fragments/filters/MWAW_Spreadsheet.xcu b/filter/source/config/fragments/filters/MWAW_Spreadsheet.xcu
index db388c55fe44..5461b7fe20ba 100644
--- a/filter/source/config/fragments/filters/MWAW_Spreadsheet.xcu
+++ b/filter/source/config/fragments/filters/MWAW_Spreadsheet.xcu
@@ -9,7 +9,7 @@
 
 <node oor:name="MWAW_Spreadsheet" oor:op="replace">
     <prop oor:name="Flags">
-        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value>
+        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC</value>
     </prop>
     <prop oor:name="FilterService">
         <value>com.sun.star.comp.Calc.MWAWCalcImportFilter</value>
diff --git a/filter/source/config/fragments/filters/MWAW_Text_Document.xcu b/filter/source/config/fragments/filters/MWAW_Text_Document.xcu
index f030fb71b198..cfbd5556f29a 100644
--- a/filter/source/config/fragments/filters/MWAW_Text_Document.xcu
+++ b/filter/source/config/fragments/filters/MWAW_Text_Document.xcu
@@ -9,7 +9,7 @@
 
 <node oor:name="MWAW_Text_Document" oor:op="replace">
     <prop oor:name="Flags">
-        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value>
+        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC</value>
     </prop>
     <prop oor:name="FilterService">
         <value>com.sun.star.comp.Writer.MWAWImportFilter</value>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu
index 4c33a806fd9d..344843043b7c 100644
--- a/filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu
@@ -16,7 +16,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 -->
     <node oor:name="StarOffice XML (Base)" oor:op="replace">
-        <prop oor:name="Flags"><value>IMPORT OWN DEFAULT 3RDPARTYFILTER ENCRYPTION</value></prop>
+        <prop oor:name="Flags"><value>IMPORT OWN DEFAULT 3RDPARTYFILTER ENCRYPTION EXOTIC</value></prop>
         <prop oor:name="UIComponent"/>
         <prop oor:name="FilterService"/>
         <prop oor:name="UserData"/>
diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu
index ee3638bc0cc8..ba7db694d6ca 100644
--- a/filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu
+++ b/filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu
@@ -16,7 +16,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 -->
     <node oor:name="StarOffice XML (Writer)" oor:op="replace">
-        <prop oor:name="Flags"><value>IMPORT TEMPLATE OWN ALIEN PREFERRED ENCRYPTION</value></prop>
+        <prop oor:name="Flags"><value>IMPORT TEMPLATE OWN ALIEN PREFERRED ENCRYPTION EXOTIC</value></prop>
         <prop oor:name="UIComponent"/>
         <prop oor:name="FilterService"/>
         <prop oor:name="UserData"><value>CXML</value></prop>
diff --git a/filter/source/config/fragments/filters/T602Document.xcu b/filter/source/config/fragments/filters/T602Document.xcu
index 436d7c8ea2b6..bf8a68fa691a 100644
--- a/filter/source/config/fragments/filters/T602Document.xcu
+++ b/filter/source/config/fragments/filters/T602Document.xcu
@@ -16,7 +16,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 -->
     <node oor:name="T602Document" oor:op="replace">
-        <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
+        <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC</value></prop>
         <prop oor:name="UIComponent"/>
         <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.T602ImportFilter</value></prop>
         <prop oor:name="UserData"><value>602</value></prop>
diff --git a/filter/source/config/fragments/filters/XPM.xcu b/filter/source/config/fragments/filters/XPM.xcu
index 83c1e32c599b..8a67b710f1a2 100644
--- a/filter/source/config/fragments/filters/XPM.xcu
+++ b/filter/source/config/fragments/filters/XPM.xcu
@@ -16,7 +16,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 -->
     <node oor:name="XPM" oor:op="replace">
-        <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+        <prop oor:name="Flags"><value>IMPORT ALIEN EXOTIC</value></prop>
         <prop oor:name="UIComponent"/>
         <prop oor:name="FilterService"/>
         <prop oor:name="UserData"><value></value></prop>
diff --git a/filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu b/filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu
index 1eba0ffbbd3c..2b717c8cb944 100644
--- a/filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu
+++ b/filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu
@@ -16,7 +16,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 -->
     <node oor:name="writer_MIZI_Hwp_97" oor:op="replace">
-        <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER</value></prop>
+        <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER EXOTIC</value></prop>
         <prop oor:name="UIComponent"/>
         <prop oor:name="FilterService"><value>com.sun.comp.hwpimport.HwpImportFilter</value></prop>
         <prop oor:name="UserData"><value></value></prop>
diff --git a/include/comphelper/documentconstants.hxx b/include/comphelper/documentconstants.hxx
index 9447a7b17fc6..89d5178d33d5 100644
--- a/include/comphelper/documentconstants.hxx
+++ b/include/comphelper/documentconstants.hxx
@@ -83,6 +83,7 @@
 // Preferred               - preferred filter for a particular type
 // 3rdPartyFilter          - implemented as a UNO component
 // Default                 - default filter for this document type
+// Exotic                  - an unusual/legacy file-format, we don't normally see
 //
 // (The 3rdPartyFilter flag is here called StarONE)
 //
@@ -106,6 +107,7 @@ enum class SfxFilterFlags
     CONSULTSERVICE    = 0x00040000L,
     STARONEFILTER     = 0x00080000L,
     PACKED            = 0x00100000L,
+    EXOTIC            = 0x00200000L,
     COMBINED          = 0x00800000L,
 
     ENCRYPTION        = 0x01000000L,
@@ -118,7 +120,7 @@ enum class SfxFilterFlags
 
 namespace o3tl
 {
-    template<> struct typed_flags<SfxFilterFlags> : is_typed_flags<SfxFilterFlags, 0x779f157fL> {};
+    template<> struct typed_flags<SfxFilterFlags> : is_typed_flags<SfxFilterFlags, 0x77bf157fL> {};
 }
 
 #define SFX_FILTER_NOTINSTALLED (SfxFilterFlags::MUSTINSTALL | SfxFilterFlags::CONSULTSERVICE)
diff --git a/include/sfx2/docfilt.hxx b/include/sfx2/docfilt.hxx
index 2e8cc62c177d..ceeae3cf980f 100644
--- a/include/sfx2/docfilt.hxx
+++ b/include/sfx2/docfilt.hxx
@@ -82,7 +82,10 @@ public:
     bool GetSupportsSigning() const { return bool(nFormatType & SfxFilterFlags::SUPPORTSSIGNING); }
     bool GetGpgEncryption() const { return bool(nFormatType & SfxFilterFlags::GPGENCRYPTION); }
     bool IsOwnTemplateFormat() const { return bool(nFormatType & SfxFilterFlags::TEMPLATEPATH); }
+    /// not our built-in format
     bool IsAlienFormat() const { return bool(nFormatType & SfxFilterFlags::ALIEN); }
+    /// an unusual/legacy file to be loading
+    bool IsExoticFormat() const { return bool(nFormatType & SfxFilterFlags::EXOTIC); }
     bool CanImport() const { return bool(nFormatType & SfxFilterFlags::IMPORT); }
     bool CanExport() const { return bool(nFormatType & SfxFilterFlags::EXPORT); }
     SfxFilterFlags  GetFilterFlags() const  { return nFormatType; }
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index b514989055bc..a17583b31c01 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -743,6 +743,9 @@ public:
 
     SAL_DLLPRIVATE void ImplSign( bool bScriptingContent = false );
     SAL_DLLPRIVATE bool QuerySaveSizeExceededModules_Impl( const css::uno::Reference< css::task::XInteractionHandler >& xHandler );
+    SAL_DLLPRIVATE bool QueryAllowExoticFormat_Impl( const css::uno::Reference< css::task::XInteractionHandler >& xHandler,
+                                                     const OUString& rURL,
+                                                     const OUString& rFilterUIName);
 
     SAL_DLLPRIVATE void CheckOut( );
     SAL_DLLPRIVATE void CancelCheckOut( );
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 472771a5c15d..5154fec08bf2 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2188,6 +2188,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/document,\
 	DocumentEvent \
 	EmptyUndoStackException \
 	EventObject \
+	ExoticFileLoadException \
 	FilterOptionsRequest \
 	LinkUpdateModes \
 	LockFileCorruptRequest \
diff --git a/offapi/com/sun/star/document/ExoticFileLoadException.idl b/offapi/com/sun/star/document/ExoticFileLoadException.idl
new file mode 100644
index 000000000000..e742f7edbea7
--- /dev/null
+++ b/offapi/com/sun/star/document/ExoticFileLoadException.idl
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef __com_sun_star_document_ExoticFileLoadException_idl__
+#define __com_sun_star_document_ExoticFileLoadException_idl__
+
+#include <com/sun/star/uno/Exception.idl>
+
+module com { module sun { module star { module document {
+
+/** An exception used to notify loading of an exotic file format
+    @since LibreOffice 6.1
+*/
+exception ExoticFileLoadException : ::com::sun::star::uno::Exception
+{
+    /** contains the URL of the document
+     */
+    string URL;
+
+    /** contains the UI name of the filter
+     */
+    string FilterUIName;
+};
+
+
+}; }; }; };
+
+#endif
+
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index f9ea2cb3ae3a..0c004bbaf030 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -2438,6 +2438,29 @@
       <info>
         <desc>Contains security specific Office settings.</desc>
       </info>
+      <prop oor:name="LoadExoticFileFormats" oor:type="xs:int" oor:nillable="false">
+        <info>
+          <desc>Determines how exotic file formats should be handled.</desc>
+        </info>
+        <constraints>
+          <enumeration oor:value="0">
+            <info>
+              <desc>Refuse loading without question</desc>
+            </info>
+          </enumeration>
+          <enumeration oor:value="1">
+            <info>
+              <desc>Display a warning and let the user decide</desc>
+            </info>
+          </enumeration>
+          <enumeration oor:value="2">
+            <info>
+              <desc>Always load without question</desc>
+            </info>
+          </enumeration>
+        </constraints>
+        <value>2</value>
+      </prop>
       <prop oor:name="EnableExpertConfiguration" oor:type="xs:boolean" oor:nillable="false">
         <info>
           <desc>Determines if the user has access to the entire
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index d721b72438a8..b84e51fec330 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -214,6 +214,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/doc/doctempl \
     sfx2/source/doc/doctemplates \
     sfx2/source/doc/doctemplateslocal \
+    sfx2/source/doc/exoticfileloadexception \
     sfx2/source/doc/frmdescr \
     sfx2/source/doc/graphhelp \
     sfx2/source/doc/guisaveas \
diff --git a/sfx2/source/doc/exoticfileloadexception.cxx b/sfx2/source/doc/exoticfileloadexception.cxx
new file mode 100644
index 000000000000..46b3c63edd65
--- /dev/null
+++ b/sfx2/source/doc/exoticfileloadexception.cxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "exoticfileloadexception.hxx"
+
+#include <comphelper/interaction.hxx>
+#include <com/sun/star/document/ExoticFileLoadException.hpp>
+
+using namespace com::sun::star;
+
+ExoticFileLoadException::ExoticFileLoadException(const OUString& rURL,
+                                                 const OUString& rFilterUIName)
+{
+    document::ExoticFileLoadException aReq;
+    aReq.URL = rURL;
+    aReq.FilterUIName = rFilterUIName;
+
+    m_aRequest <<= aReq;
+
+    m_xAbort.set(uno::Reference<task::XInteractionAbort>(new comphelper::OInteractionAbort),
+                 uno::UNO_QUERY);
+    m_xApprove.set(uno::Reference<task::XInteractionApprove>(new comphelper::OInteractionApprove),
+                   uno::UNO_QUERY);
+    m_lContinuations.realloc(2);
+    m_lContinuations[0] = m_xApprove;
+    m_lContinuations[1] = m_xAbort;
+}
+
+bool ExoticFileLoadException::isApprove() const
+{
+    comphelper::OInteractionApprove* pBase
+        = static_cast<comphelper::OInteractionApprove*>(m_xApprove.get());
+    return pBase->wasSelected();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/exoticfileloadexception.hxx b/sfx2/source/doc/exoticfileloadexception.hxx
new file mode 100644
index 000000000000..3f8d480d8fb6
--- /dev/null
+++ b/sfx2/source/doc/exoticfileloadexception.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_EXOTICFILELOADEXCEPTION_HXX
+#define INCLUDED_SFX2_EXOTICFILELOADEXCEPTION_HXX
+
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <cppuhelper/implbase.hxx>
+
+class ExoticFileLoadException : public cppu::WeakImplHelper<css::task::XInteractionRequest>
+{
+    // C++ interface
+public:
+    ExoticFileLoadException(const OUString& rURL, const OUString& rFilterUIName);
+    bool isApprove() const;
+
+    // UNO interface
+public:
+    virtual css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>>
+        SAL_CALL getContinuations() override
+    {
+        return m_lContinuations;
+    }
+    css::uno::Any SAL_CALL getRequest() override { return m_aRequest; }
+
+    // member
+private:
+    css::uno::Any m_aRequest;
+    css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> m_lContinuations;
+    css::uno::Reference<css::task::XInteractionContinuation> m_xAbort;
+    css::uno::Reference<css::task::XInteractionContinuation> m_xApprove;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 5ecc8e11c123..21fd5cd69649 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -81,6 +81,7 @@
 #include <unotools/saveopt.hxx>
 #include <unotools/useroptions.hxx>
 #include <unotools/pathoptions.hxx>
+#include <unotools/securityoptions.hxx>
 #include <tools/urlobj.hxx>
 #include <tools/diagnose_ex.h>
 #include <unotools/ucbhelper.hxx>
@@ -127,6 +128,7 @@
 #include <appbaslib.hxx>
 #include <appdata.hxx>
 #include "objstor.hxx"
+#include "exoticfileloadexception.hxx"
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::container;
@@ -648,6 +650,11 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
         SetError( ERRCODE_IO_FILTERDISABLED );
     }
 
+    if ( pFilter && pFilter->IsExoticFormat() && !QueryAllowExoticFormat_Impl( getInteractionHandler(), aBaseURL, pMed->GetFilter()->GetUIName() ) )
+    {
+        SetError( ERRCODE_IO_ABORT );
+    }
+
     // initialize static language table so language-related extensions are learned before the document loads
     (void)SvtLanguageTable::GetLanguageEntryCount();
 
@@ -3537,7 +3544,35 @@ bool SfxObjectShell::QuerySaveSizeExceededModules_Impl( const uno::Reference< ta
     return true;
 }
 
-// comphelper::IEmbeddedHelper
+bool SfxObjectShell::QueryAllowExoticFormat_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const OUString& rURL, const OUString& rFilterUIName )
+{
+    if ( SvtSecurityOptions().isTrustedLocationUri( rURL ) )
+    {
+        // Always load from trusted location
+        return true;
+    }
+    if ( officecfg::Office::Common::Security::LoadExoticFileFormats::get() == 0 )
+    {
+        // Refuse loading without question
+        return false;
+    }
+    else if ( officecfg::Office::Common::Security::LoadExoticFileFormats::get() == 2 )
+    {
+        // Always load without question
+        return true;
+    }
+    else if ( officecfg::Office::Common::Security::LoadExoticFileFormats::get() == 1 && xHandler.is() )
+    {
+        // Display a warning and let the user decide
+        rtl::Reference<ExoticFileLoadException> xException(new ExoticFileLoadException( rURL, rFilterUIName ));
+        uno::Reference< task::XInteractionRequest > xReq( xException.get() );
+        xHandler->handle( xReq );
+        return xException.get()->isApprove();
+    }
+    // No interaction handler, default is to continue to load
+    return true;
+}
+
 uno::Reference< task::XInteractionHandler > SfxObjectShell::getInteractionHandler() const
 {
     uno::Reference< task::XInteractionHandler > xRet;
diff --git a/uui/inc/ids.hrc b/uui/inc/ids.hrc
index d5a418918ec5..84d409f083ef 100644
--- a/uui/inc/ids.hrc
+++ b/uui/inc/ids.hrc
@@ -34,6 +34,8 @@ const std::pair<const char*, ErrCode> RID_UUI_ERRHDL[] =
       ERRCODE_UUI_IO_TARGETALREADYEXISTS },
     { NC_("RID_UUI_ERRHDL", "You are about to save/export a password protected basic library containing module(s) \n$(ARG1)\nwhich are too large to store in binary format. If you wish users that don't have access to the library password to be able to run macros in those module(s) you must split those modules into a number of smaller modules. Do you wish to continue to save/export this library?"),
       ERRCODE_UUI_IO_MODULESIZEEXCEEDED },
+    { NC_("RID_UUI_ERRHDL", "Beware!\n\nYou are about to load a very unusual sort of file ($(ARG2)) from the URL:\n\n$(ARG1)\n\nAre you certain that this file is a legacy document created many years ago?"),
+      ERRCODE_UUI_IO_EXOTICFILEFORMAT },
     { NC_("RID_UUI_ERRHDL", "The data from $(ARG1) has an incorrect checksum."),
       ERRCODE_UUI_IO_BADCRC },
     { NC_("RID_UUI_ERRHDL", "The object $(ARG1) cannot be created in directory $(ARG2)."),
diff --git a/uui/inc/ids.hxx b/uui/inc/ids.hxx
index 2d3b6d4e7408..71beff973f02 100644
--- a/uui/inc/ids.hxx
+++ b/uui/inc/ids.hxx
@@ -86,6 +86,7 @@
 #define ERRCODE_UUI_LOCKING_NOT_LOCKED                          ErrCode(ErrCodeArea::Uui, 61)
 #define ERRCODE_UUI_LOCKING_LOCK_EXPIRED                        ErrCode(ErrCodeArea::Uui, 62)
 #define ERRCODE_UUI_CANNOT_ACTIVATE_FACTORY                     ErrCode(ErrCodeArea::Uui, 63)
+#define ERRCODE_UUI_IO_EXOTICFILEFORMAT                         ErrCode(ErrCodeArea::Uui, 64)
 
 #endif
 
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 2d7be0930178..c89a4d038bc7 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/configuration/backend/StratumCreationException.hpp>
 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
 #include <com/sun/star/document/BrokenPackageRequest.hpp>
+#include <com/sun/star/document/ExoticFileLoadException.hpp>
 #include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp>
 #include <com/sun/star/java/WrongJavaVersionException.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
@@ -434,6 +435,30 @@ UUIInteractionHelper::handleRequest_impl(
             return true;
         }
 
+        document::ExoticFileLoadException aExoticFileLoadException;
+        if (aAnyRequest >>= aExoticFileLoadException)
+        {
+            std::vector< OUString > aArguments;
+
+            if( !aExoticFileLoadException.URL.isEmpty() )
+            {
+                aArguments.push_back( aExoticFileLoadException.URL );
+            }
+            if( !aExoticFileLoadException.FilterUIName.isEmpty() )
+            {
+                aArguments.push_back( aExoticFileLoadException.FilterUIName );
+            }
+
+            handleErrorHandlerRequest( task::InteractionClassification_WARNING,
+                                       ERRCODE_UUI_IO_EXOTICFILEFORMAT,
+                                       aArguments,
+                                       rRequest->getContinuations(),
+                                       bObtainErrorStringOnly,
+                                       bHasErrorString,
+                                       rErrorString);
+            return true;
+        }
+
         ucb::NameClashException aNCException;
         if (aAnyRequest >>= aNCException)
         {
commit fdc21b3f40b66efeb98ca81b8caee5cd3e76673e
Author: Henry Castro <hcastro at collabora.com>
Date:   Thu Mar 15 14:23:48 2018 -0400

    lokdialog: do not lock events when opened ScFilter Dialog
    
    When exists 2 or more views and one of the views open the ScFilter dialog,
    the other views are locked and no event process.
    
    In tiled rendering case, collaborative editing is not functional with 2 or
    more views are locked, so the patch prevents locking the other views
    
    Change-Id: I0133d38ac5ecef4d3ebc22f3e922602704dcd0b3
    Reviewed-on: https://gerrit.libreoffice.org/51370
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    (cherry picked from commit 009d2756b1678477ec23d5647bd5004c4bff3a62)

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index a5a60d61d8b3..37f299827a92 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -30,10 +30,12 @@
 
 #include <comphelper/lok.hxx>
 #include <comphelper/propertyvalue.hxx>
+#include <sfx2/childwin.hxx>
 #include <sfx2/lokhelper.hxx>
 #include <svx/svdpage.hxx>
 #include <vcl/scheduler.hxx>
 #include <vcl/vclevent.hxx>
+#include <sc.hrc>
 
 #include <chrono>
 #include <cstddef>
@@ -91,6 +93,7 @@ public:
     void testLanguageStatus();
     void testMultiViewCopyPaste();
     void testIMESupport();
+    void testFilterDlg();
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
     CPPUNIT_TEST(testRowColumnSelections);
@@ -122,6 +125,7 @@ public:
     CPPUNIT_TEST(testLanguageStatus);
     CPPUNIT_TEST(testMultiViewCopyPaste);
     CPPUNIT_TEST(testIMESupport);
+    CPPUNIT_TEST(testFilterDlg);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1600,6 +1604,45 @@ void ScTiledRenderingTest::testIMESupport()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void ScTiledRenderingTest::testFilterDlg()
+{
+    comphelper::LibreOfficeKit::setActive();
+
+    createDoc("empty.ods");
+
+    // view #1
+    SfxViewShell* pView1 = SfxViewShell::Current();
+    int nView1 = SfxLokHelper::getView();
+
+    // view #2
+    SfxLokHelper::createView();
+    SfxViewShell* pView2 = SfxViewShell::Current();
+    CPPUNIT_ASSERT(pView1 != pView2);
+    {
+        pView2->GetViewFrame()->GetDispatcher()->Execute(SID_FILTER,
+            SfxCallMode::SLOT|SfxCallMode::RECORD);
+    }
+
+    Scheduler::ProcessEventsToIdle();
+    SfxChildWindow* pRefWindow = pView2->GetViewFrame()->GetChildWindow(SID_FILTER);
+    CPPUNIT_ASSERT(pRefWindow);
+
+    // switch to view 1
+    SfxLokHelper::setView(nView1);
+    CPPUNIT_ASSERT_EQUAL(true, pView2->GetViewFrame()->GetDispatcher()->IsLocked());
+    CPPUNIT_ASSERT_EQUAL(false, pView1->GetViewFrame()->GetDispatcher()->IsLocked());
+
+    KeyEvent aEvent(27, KEY_ESCAPE, 0);
+    Application::PostKeyEvent(VclEventId::WindowKeyInput, pRefWindow->GetWindow(), &aEvent);
+    Application::PostKeyEvent(VclEventId::WindowKeyUp, pRefWindow->GetWindow(), &aEvent);
+
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT_EQUAL(false, pView2->GetViewFrame()->GetDispatcher()->IsLocked());
+    CPPUNIT_ASSERT_EQUAL(false, pView1->GetViewFrame()->GetDispatcher()->IsLocked());
+
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index a78716d3fa66..81830b695cdc 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1554,20 +1554,25 @@ void ScModule::SetRefDialog( sal_uInt16 nId, bool bVis, SfxViewFrame* pViewFrm )
     }
 }
 
-static SfxChildWindow* lcl_GetChildWinFromAnyView( sal_uInt16 nId )
+static inline SfxChildWindow* lcl_GetChildWinFromCurrentView( sal_uInt16 nId )
 {
-    // First, try the current view
     SfxViewFrame* pViewFrm = SfxViewFrame::Current();
 
     // #i46999# current view frame can be null (for example, when closing help)
-    SfxChildWindow* pChildWnd = pViewFrm ? pViewFrm->GetChildWindow( nId ) : nullptr;
+    return pViewFrm ? pViewFrm->GetChildWindow( nId ) : nullptr;
+}
+
+static SfxChildWindow* lcl_GetChildWinFromAnyView( sal_uInt16 nId )
+{
+    // First, try the current view
+    SfxChildWindow* pChildWnd = lcl_GetChildWinFromCurrentView( nId );
     if ( pChildWnd )
         return pChildWnd;           // found in the current view
 
     //  if not found there, get the child window from any open view
     //  it can be open only in one view because nCurRefDlgId is global
 
-    pViewFrm = SfxViewFrame::GetFirst();
+    SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst();
     while ( pViewFrm )
     {
         pChildWnd = pViewFrm->GetChildWindow( nId );
@@ -1588,7 +1593,7 @@ bool ScModule::IsModalMode(SfxObjectShell* pDocSh)
 
     if ( nCurRefDlgId )
     {
-        SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
+        SfxChildWindow* pChildWnd = lcl_GetChildWinFromCurrentView( nCurRefDlgId );
         if ( pChildWnd )
         {
             IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
@@ -1596,15 +1601,6 @@ bool ScModule::IsModalMode(SfxObjectShell* pDocSh)
             bIsModal = pChildWnd->IsVisible() && pRefDlg &&
                 !( pRefDlg->IsRefInputMode() && pRefDlg->IsDocAllowed(pDocSh) );
         }
-        else
-        {
-            // in 592 and above, the dialog isn't visible in other views
-            //  if the dialog is open but can't be accessed, disable input
-            bIsModal = true;
-        }
-
-        //  pChildWnd can be 0 if the dialog has not been created by another Shell yet after
-        //  switching over(e.g. in GetFocus())
     }
     else if (pDocSh)
     {
@@ -1650,11 +1646,9 @@ bool ScModule::IsRefDialogOpen()
 
     if ( nCurRefDlgId )
     {
-        SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
+        SfxChildWindow* pChildWnd = lcl_GetChildWinFromCurrentView( nCurRefDlgId );
         if ( pChildWnd )
             bIsOpen = pChildWnd->IsVisible();
-        else
-            bIsOpen = true;     // for other views, see IsModalMode
     }
 
     return bIsOpen;
@@ -1674,15 +1668,13 @@ bool ScModule::IsFormulaMode()
 
     if ( nCurRefDlgId )
     {
-        SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
+        SfxChildWindow* pChildWnd = lcl_GetChildWinFromCurrentView( nCurRefDlgId );
         if ( pChildWnd )
         {
             IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
             assert(pRefDlg);
             bIsFormula = pChildWnd->IsVisible() && pRefDlg && pRefDlg->IsRefInputMode();
         }
-        else
-            bIsFormula = true;
     }
     else
     {
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index bc1ac159f7c8..a0a78a1c4beb 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -109,7 +109,7 @@ ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
     ScFormulaReferenceHelper::enableInput( true );
     ScFormulaReferenceHelper::EnableSpreadsheets();
     m_aHelper.Init();
-    ScFormulaReferenceHelper::SetDispatcherLock( true );
+    m_aHelper.SetDispatcherLock( true );
 
     notifyChange();
     fill();
@@ -552,7 +552,7 @@ void ScFormulaDlg::dispatch(bool _bOK, bool _bMatrixChecked)
     if ( aStrItem.GetValue().isEmpty() )
         aRetItem.SetValue( false );     // sal_False = Cancel
 
-    ScFormulaReferenceHelper::SetDispatcherLock( false ); // turn off modal-mode
+    m_aHelper.SetDispatcherLock( false ); // turn off modal-mode
 
     clear();
 
@@ -562,7 +562,7 @@ void ScFormulaDlg::dispatch(bool _bOK, bool _bMatrixChecked)
 }
 void ScFormulaDlg::setDispatcherLock( bool bLock )
 {
-    ScFormulaReferenceHelper::SetDispatcherLock( bLock );
+    m_aHelper.SetDispatcherLock( bLock );
 }
 void ScFormulaDlg::deleteFormData()
 {
diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx
index d9bf5d80df72..1abdb8b1a2e3 100644
--- a/sc/source/ui/inc/anyrefdg.hxx
+++ b/sc/source/ui/inc/anyrefdg.hxx
@@ -90,7 +90,7 @@ public:
 
     void         SetWindow(vcl::Window* _pWindow) { m_pWindow = _pWindow; }
     void                DoClose( sal_uInt16 nId );
-    static void         SetDispatcherLock( bool bLock );
+    void                SetDispatcherLock( bool bLock );
     static void         EnableSpreadsheets( bool bFlag = true );
     static void         ViewShellChanged();
 
@@ -126,7 +126,7 @@ protected:
     void                disposeRefHandler();
     bool                DoClose( sal_uInt16 nId );
 
-    static void         SetDispatcherLock( bool bLock );
+    void                SetDispatcherLock( bool bLock );
 
     virtual void        RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = nullptr ) override;
     virtual void        RefInputDone( bool bForced = false ) override;
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index bab95aa80539..e05b64eff127 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -648,26 +648,20 @@ void ScFormulaReferenceHelper::DoClose( sal_uInt16 nId )
 
 void ScFormulaReferenceHelper::SetDispatcherLock( bool bLock )
 {
-    //  lock / unlock only the dispatchers of Calc documents
-
-    ScDocShell* pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>));
-    while( pDocShell )
+    //  lock / unlock only the dispatcher of Calc document
+    SfxDispatcher* pDisp = nullptr;
+    if ( m_pBindings )
     {
-        SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell );
-        while( pFrame )
-        {
-            SfxDispatcher* pDisp = pFrame->GetDispatcher();
-            if (pDisp)
-                pDisp->Lock( bLock );
-
-            pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell );
-        }
-        pDocShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pDocShell, checkSfxObjectShell<ScDocShell>));
+        pDisp = m_pBindings->GetDispatcher();
+    }
+    else if(SfxViewFrame* pViewFrame = SfxViewFrame::Current())
+    {
+        if (dynamic_cast< ScTabViewShell* >(pViewFrame->GetViewShell()))
+            pDisp = pViewFrame->GetDispatcher();
     }
 
-    //  if a new view is created while the dialog is open,
-    //  that view's dispatcher is locked when trying to create the dialog
-    //  for that view (ScTabViewShell::CreateRefDialog)
+    if (pDisp)
+        pDisp->Lock(bLock);
 }
 
 void ScFormulaReferenceHelper::ViewShellChanged()
@@ -812,7 +806,7 @@ bool ScRefHandler::EnterRefMode()
 
     m_aHelper.Init();
 
-    ScFormulaReferenceHelper::SetDispatcherLock( true );
+    m_aHelper.SetDispatcherLock( true );
 
     return m_bInRefMode = true;
 }
@@ -901,7 +895,7 @@ bool ScRefHandler::DoClose( sal_uInt16 nId )
 
 void ScRefHandler::SetDispatcherLock( bool bLock )
 {
-    ScFormulaReferenceHelper::SetDispatcherLock( bLock );
+    m_aHelper.SetDispatcherLock( bLock );
 }
 
 void ScRefHandler::ViewShellChanged()
commit b3259c54074deb54dc862fcb21fee48c707dd874
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Mar 15 16:48:18 2018 +0530

    chart2 lok: tunnel context menu of the chart edit view
    
    Change-Id: I0c8b3cfe1666ad81f808871a87e4b0fa64ef593c
    Reviewed-on: https://gerrit.libreoffice.org/51345
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    (cherry picked from commit eb76e16abba16d88acd342779a8216dd64d60955)

diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index ec9e4323ffe2..ed3ef2bce8e2 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -58,15 +58,16 @@
 #include <com/sun/star/util/XUpdatable.hpp>
 #include <com/sun/star/awt/Rectangle.hpp>
 
+#include <comphelper/lok.hxx>
 #include <comphelper/propertysequence.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <comphelper/sequence.hxx>
 
 #include <toolkit/awt/vclxmenu.hxx>
 
+#include <sfx2/viewsh.hxx>
 #include <svx/svxids.hrc>
 #include <svx/ActionDescriptionProvider.hxx>
-
 #include <svx/obj3d.hxx>
 #include <svx/scene3d.hxx>
 #include <svx/svddrgmt.hxx>
@@ -1253,6 +1254,12 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
         if ( !xPopupController.is() || !xPopupMenu.is() )
             return;
 
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            PopupMenu* pPopupMenu = static_cast<PopupMenu*>(VCLXMenu::GetImplementation(xPopupMenu)->GetMenu());
+            pPopupMenu->SetLOKNotifier(SfxViewShell::Current());
+        }
+
         xPopupController->setPopupMenu( xPopupMenu );
         xPopupMenu->execute( css::uno::Reference< css::awt::XWindowPeer >( m_xFrame->getContainerWindow(), css::uno::UNO_QUERY ),
                              css::awt::Rectangle( aPos.X(), aPos.Y(), 0, 0 ),
commit 65823d698e7fc7e236fe3fcd5f23f0fe02a91b7e
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Mar 14 14:55:05 2018 +0530

    lokdialog: Invalidate upon window size change
    
    This problem can be seen with some of the dialogs like chart dialogs
    where not all of the area which should be invalidated is invalidated.
    The reason being that their container gets resized but not
    lok-invalidated.
    
    Change-Id: I12eb68e8644ca67b2666badb7b772b92a145c624
    Reviewed-on: https://gerrit.libreoffice.org/51264
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    (cherry picked from commit b2428496de5cd579f4cdb0f149e2cebb8b12dd4d)

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 4e38bcaba259..4c150b5e0009 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1386,6 +1386,12 @@ void Window::queue_resize(StateChangedType eReason)
         if (pBorderWindow)
             pBorderWindow->Resize();
     }
+
+    if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
+    {
+        if (GetParentDialog())
+            LogicInvalidate(nullptr);
+    }
 }
 
 namespace
commit 0d863ee8e701ab890ca44ac9e1364adec600bec6
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Mar 15 16:48:54 2018 +0530

    chart2 lok: give parent to data table dialog to tunnel it
    
    Change-Id: Ie82a9a6d9b499e5da34e04f0c2f5fc7c164b098e
    Reviewed-on: https://gerrit.libreoffice.org/51346
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    (cherry picked from commit a7e98725901412aa334a1abe87194e682c1ae836)

diff --git a/chart2/source/controller/main/ChartController_EditData.cxx b/chart2/source/controller/main/ChartController_EditData.cxx
index 3ad6b90b8770..e6d2f4fffe0c 100644
--- a/chart2/source/controller/main/ChartController_EditData.cxx
+++ b/chart2/source/controller/main/ChartController_EditData.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <ChartWindow.hxx>
 #include <ChartController.hxx>
 
 #include <dlg_DataEditor.hxx>
@@ -47,7 +48,7 @@ void ChartController::executeDispatch_EditData()
         UndoLiveUpdateGuardWithData aUndoGuard(
             SchResId( STR_ACTION_EDIT_CHART_DATA ),
             m_xUndoManager );
-        ScopedVclPtrInstance<DataEditor> aDataEditorDialog( nullptr, xChartDoc, m_xCC );
+        ScopedVclPtrInstance<DataEditor> aDataEditorDialog( GetChartWindow().get(), xChartDoc, m_xCC );
         if (aDataEditorDialog->Execute() == RET_OK)
             aDataEditorDialog->ApplyChangesToModel();
         aUndoGuard.commit();
commit 88ff7cb2dceae0ef170042e03eacf1f44b6a907d
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Mar 15 16:04:05 2018 +0100

    tdf#115675: Shape selection was breaking when changing pos/size from sidebar.
    
    Fixes also other potential breakages with the same root cause.
    
    Change-Id: I09b3650189f6edb28ab64652cd411b1dca7dca89
    Reviewed-on: https://gerrit.libreoffice.org/51342
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 5372d8022dd8ce8aaa3090014b319727e88b17f1)

diff --git a/sd/source/ui/func/fuarea.cxx b/sd/source/ui/func/fuarea.cxx
index 29d8cb5311a3..6311bf13c716 100644
--- a/sd/source/ui/func/fuarea.cxx
+++ b/sd/source/ui/func/fuarea.cxx
@@ -56,10 +56,7 @@ void FuArea::DoExecute( SfxRequest& rReq )
 
     const SfxItemSet* pArgs = rReq.GetArgs();
     if (pArgs)
-    {
-        mpViewShell->Cancel();
         return;
-    }
 
     SfxItemSet aNewAttr( mpDoc->GetPool() );
     mpView->GetAttributes( aNewAttr );
@@ -67,10 +64,7 @@ void FuArea::DoExecute( SfxRequest& rReq )
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact ? pFact->CreateSvxAreaTabDialog(mpViewShell->GetActiveWindow(), &aNewAttr, mpDoc, true) : nullptr);
     if (!pDlg)
-    {
-        mpViewShell->Cancel();
         return;
-    }
 
     pDlg->StartExecuteAsync([=](sal_Int32 nResult){
         if (nResult == RET_OK)
@@ -90,6 +84,9 @@ void FuArea::DoExecute( SfxRequest& rReq )
 
             mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
         }
+
+        // deferred until the dialog ends
+        mpViewShell->Cancel();
     });
 }
 
diff --git a/sd/source/ui/func/fuline.cxx b/sd/source/ui/func/fuline.cxx
index d4511fdcc610..71a35f4ec42e 100644
--- a/sd/source/ui/func/fuline.cxx
+++ b/sd/source/ui/func/fuline.cxx
@@ -64,10 +64,7 @@ void FuLine::DoExecute( SfxRequest& rReq )
 
     const SfxItemSet* pArgs = rReq.GetArgs();
     if (pArgs)
-    {
-        mpViewShell->Cancel();
         return;
-    }
 
     const SdrObject* pObj = nullptr;
     const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
@@ -81,10 +78,7 @@ void FuLine::DoExecute( SfxRequest& rReq )
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     VclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSvxLineTabDialog(mpViewShell->GetActiveWindow(), pNewAttr.get(), mpDoc, pObj, bHasMarked) : nullptr);
     if (!pDlg)
-    {
-        mpViewShell->Cancel();
         return;
-    }
 
     pDlg->StartExecuteAsync([=](sal_Int32 nResult){
         if (nResult == RET_OK)
@@ -106,6 +100,8 @@ void FuLine::DoExecute( SfxRequest& rReq )
 
             mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
         }
+
+        // deferred until the dialog ends
         mpViewShell->Cancel();
     });
 }
diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx
index ef2894cc37f5..33d4b0d2796f 100644
--- a/sd/source/ui/func/futransf.cxx
+++ b/sd/source/ui/func/futransf.cxx
@@ -67,12 +67,6 @@ void setUndo(::sd::View* pView, const SfxItemSet* pArgs)
 
 void FuTransform::DoExecute( SfxRequest& rReq )
 {
-    comphelper::ScopeGuard guard([&]() {
-        // cleanup when leaving
-        mpViewShell->Invalidate(SID_RULER_OBJECT);
-        mpViewShell->Cancel();
-    });
-
     if (!mpView->AreObjectsMarked())
         return;
 
@@ -124,7 +118,6 @@ void FuTransform::DoExecute( SfxRequest& rReq )
 
     std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq));
     rReq.Ignore(); // the 'old' request is not relevant any more
-    guard.dismiss(); // we'll invalidate explicitly after the dialog ends
 
     pDlg->StartExecuteAsync([=](sal_Int32 nResult){
         if (nResult == RET_OK)
@@ -133,6 +126,7 @@ void FuTransform::DoExecute( SfxRequest& rReq )
             setUndo(mpView, pRequest->GetArgs());
         }
 
+        // deferred until the dialog ends
         mpViewShell->Invalidate(SID_RULER_OBJECT);
         mpViewShell->Cancel();
     });
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 1979cb91bcb4..1311d8b551a1 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1367,21 +1367,27 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         case SID_ATTRIBUTES_LINE:  // BASIC
         {
             SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
-            // Cancel() called directly in FuTransform::Create()
+            if (rReq.GetArgs())
+                Cancel();
         }
         break;
 
         case SID_ATTRIBUTES_AREA:  // BASIC
         {
             SetCurrentFunction( FuArea::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
-            // Cancel() called directly in FuTransform::Create()
+            if (rReq.GetArgs())
+                Cancel();
         }
         break;
 
         case SID_ATTR_TRANSFORM:
         {
             SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
-            // Cancel() and Invalidate() called directly in FuTransform::Create()
+            if (rReq.GetArgs())
+            {
+                Invalidate(SID_RULER_OBJECT);
+                Cancel();
+            }
         }
         break;
 
commit bb3121094af3cf0a73c059ca7e37d4155e6ca087
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Mar 14 17:12:57 2018 +0000

    Allow lok to re-set temporary paths on second init.
    
    Change-Id: I40cd0538b573c2d090f56424e1110b938981a878
    Reviewed-on: https://gerrit.libreoffice.org/51292
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit 005abf983d34042a7ced46d886f8ef2250cb3fce)

diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 0e5f8774d3c3..53f4eba57829 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -130,9 +130,11 @@ class Desktop : public Application
                                     css::uno::Reference< css::uno::XComponentContext > const & context);
         static void             DeregisterServices();
 
+    public:
         static void             CreateTemporaryDirectory();
         static void             RemoveTemporaryDirectory();
 
+    private:
         static bool             InitializeConfiguration();
         static void             FlushConfiguration();
         static bool             InitializeQuickstartMode( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index a9534de375e0..ef7e7574ce10 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -92,6 +92,7 @@
 #include <unotools/configmgr.hxx>
 #include <unotools/syslocaleoptions.hxx>
 #include <unotools/mediadescriptor.hxx>
+#include <unotools/pathoptions.hxx>
 #include <osl/module.hxx>
 #include <comphelper/sequence.hxx>
 #include <sfx2/sfxbasemodel.hxx>
@@ -3814,6 +3815,13 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
 
         if (eStage != PRE_INIT)
         {
+            SAL_INFO("lok", "Re-initialize temp paths");
+            SvtPathOptions aOptions;
+            OUString aNewTemp;
+            osl::FileBase::getTempDirURL(aNewTemp);
+            aOptions.SetTempPath(aNewTemp);
+            desktop::Desktop::CreateTemporaryDirectory();
+
             SAL_INFO("lok", "Enabling RequestHandler");
 #ifdef IOS
             RequestHandler::Enable(true);
commit a909a07f8da5695daa9d669090d61c9f5c5a8659
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Mar 14 14:50:58 2018 +0530

    lokdialog: debug red-colored boundary for last painted region
    
    Easier to see what's going on inside the LOK dialog.
    
    Change-Id: I59974200af3d2356b7c27eb3dd4032a59c00dbed
    Reviewed-on: https://gerrit.libreoffice.org/51263
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    (cherry picked from commit 859b7b09f5b1330b7135744795c578358736ded3)

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index 5db79514aa4a..54c54848d20e 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -117,7 +117,13 @@ gtv_lok_dialog_draw(GtkWidget* pDialogDrawingArea, cairo_t* pCairo, gpointer)
     cairo_surface_mark_dirty(pSurface);
 
     cairo_set_source_surface(pCairo, pSurface, aRect.x, aRect.y);
+    // paint the dialog image
     cairo_paint(pCairo);
+
+    // debug red-colored border around the painted region
+    cairo_set_source_rgb(pCairo, 1.0, 0, 0);
+    cairo_rectangle(pCairo, aRect.x, aRect.y, nWidth, nHeight);
+    cairo_stroke(pCairo);
 }
 
 static gboolean
commit 137cca7c67e58e25328805ed2609337ca78c1e89
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Mar 13 12:39:11 2018 +0100

    tdf#116334: Actually when there is no handler, we have to return 'true'.
    
    Also use the return value of the link's Call() [as the SvTreeListBox::ExpandingHdl()
    is doing], the appropriate callbacks seem to return the expected 'false' in
    the cases I've reviewed...
    
    Change-Id: I0cdd63e8ec4c794839070b914150e0b32f743359
    Reviewed-on: https://gerrit.libreoffice.org/51211
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 1b9af08481b8f7f4bd15a30508606dff56b8e74f)

diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 5a28f90fb339..45a789633a87 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -427,8 +427,7 @@ void SvTreeListBox::DeselectHdl()
 
 bool SvTreeListBox::DoubleClickHdl()
 {
-    aDoubleClickHdl.Call( this );
-    return false;
+    return !aDoubleClickHdl.IsSet() || aDoubleClickHdl.Call(this);
 }
 
 
commit 43770a7aece6708d5ae6a55339e35f7145e85c6f
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Mar 8 21:07:40 2018 +0100

    lokdialog: Tunnel the spell-checking context menu with recommendations.
    
    Change-Id: I1a7952e88a3f89346c97d2516628b4a7a0423de6
    Reviewed-on: https://gerrit.libreoffice.org/51062
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>
    Reviewed-on: https://gerrit.libreoffice.org/51166
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 8938e8b153f32f3f5926baddb87cb76c8e72755a)

diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 8b5c4467cf58..eca6a6098365 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1025,7 +1025,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
         EPaM aP = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM);
         EPaM aP2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM2);
 
-        sal_uInt16 nId = aPopupMenu->Execute( pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose );
+        sal_uInt16 nId = aPopupMenu->Execute(pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose);
 
         aPaM2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP2);
         aPaM = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP);
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 2728b1ac8f21..a746414b462b 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -60,6 +60,7 @@ namespace vcl
 class Window;
 struct MenuLayoutData;
 typedef OutputDevice RenderContext; // same as in include/vcl/outdev.hxx
+class ILibreOfficeKitNotifier;
 }
 
 #define MENU_APPEND        (sal_uInt16(0xFFFF))
@@ -484,6 +485,8 @@ class VCL_DLLPUBLIC PopupMenu : public Menu
     friend struct MenuItemData;
 
 private:
+    const vcl::ILibreOfficeKitNotifier* mpLOKNotifier; ///< To emit the LOK callbacks eg. for dialog tunneling.
+
     SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const;
 
 protected:
@@ -518,6 +521,12 @@ public:
     static bool IsInExecute();
     static PopupMenu* GetActivePopupMenu();
 
+    /// Interface to register for dialog / window tunneling.
+    void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier)
+    {
+        mpLOKNotifier = pNotifier;
+    }
+
     PopupMenu& operator=( const PopupMenu& rMenu );
 };
 
diff --git a/sw/source/uibase/inc/olmenu.hxx b/sw/source/uibase/inc/olmenu.hxx
index a407f618810f..d37eb2edbfb5 100644
--- a/sw/source/uibase/inc/olmenu.hxx
+++ b/sw/source/uibase/inc/olmenu.hxx
@@ -128,7 +128,7 @@ public:
 
     ~SwSpellPopup();
 
-    Menu&   GetMenu()
+    PopupMenu& GetMenu()
     {
         return *m_xPopupMenu.get();
     }
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index da3f7a6a4cad..a6844d6bbe2a 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/linguistic2/ProofreadingResult.hpp>
 #include <com/sun/star/i18n/TextConversionOption.hpp>
 #include <linguistic/lngprops.hxx>
+#include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <comphelper/propertysequence.hxx>
@@ -719,11 +720,10 @@ bool SwView::ExecSpellPopup(const Point& rPt)
                 aEvent.ExecutePosition.Y = aPixPos.Y();
                 ScopedVclPtr<Menu> pMenu;
 
-                OUString sMenuName  = bUseGrammarContext ?
+                OUString sMenuName = bUseGrammarContext ?
                     OUString("private:resource/GrammarContextMenu") : OUString("private:resource/SpellContextMenu");
                 if (TryContextMenuInterception(xPopup->GetMenu(), sMenuName, pMenu, aEvent))
                 {
-
                     //! happy hacking for context menu modifying extensions of this
                     //! 'custom made' menu... *sigh* (code copied from sfx2 and framework)
                     if ( pMenu )
@@ -771,6 +771,9 @@ bool SwView::ExecSpellPopup(const Point& rPt)
                     }
                     else
                     {
+                        if (comphelper::LibreOfficeKit::isActive())
+                            xPopup->GetMenu().SetLOKNotifier(SfxViewShell::Current());
+
                         xPopup->Execute(aToFill.SVRect(), m_pEditWin);
                     }
                 }
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 61957f56cd6f..c9e1152a2d8a 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -20,6 +20,7 @@
 #include <tools/diagnose_ex.h>
 #include <tools/stream.hxx>
 
+#include <comphelper/lok.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/mnemonic.hxx>
 #include <vcl/image.hxx>
@@ -40,6 +41,7 @@
 #include <vcl/dockingarea.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/commandinfoprovider.hxx>
+#include <vcl/IDialogRenderable.hxx>
 
 #include <salinst.hxx>
 #include <svdata.hxx>
@@ -2693,12 +2695,14 @@ MenuFloatingWindow * PopupMenu::ImplGetFloatingWindow() const {
 }
 
 PopupMenu::PopupMenu()
+    : mpLOKNotifier(nullptr)
 {
     mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this);
 }
 
 PopupMenu::PopupMenu( const PopupMenu& rMenu )
-    : Menu()
+    : Menu(),
+      mpLOKNotifier(nullptr)
 {
     mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this);
     *this = rMenu;
@@ -2899,6 +2903,9 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const tools::R
     }
 
     VclPtrInstance<MenuFloatingWindow> pWin( this, pW, WB_BORDER | WB_SYSTEMWINDOW );
+    if (comphelper::LibreOfficeKit::isActive() && mpLOKNotifier)
+        pWin->SetLOKNotifier(mpLOKNotifier);
+
     if( pSVData->maNWFData.mbFlatMenu )
         pWin->SetBorderStyle( WindowBorderStyle::NOBORDER );
     else
commit 7337baa159ff11b037e688d37e2ee59d24b553e2
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Sun Mar 11 00:58:24 2018 +0100

    lokdialog: For floating menus, ignore the screen size in the LOK case.
    
    Change-Id: I85f6fcbc865eba7aac48a4c2e7d8c4bb82311581
    Reviewed-on: https://gerrit.libreoffice.org/51063
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>
    Reviewed-on: https://gerrit.libreoffice.org/51165
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 194fb89ba76837a93ae2af460a5e592bb7b5f21b)

diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 304fadb40eb9..a4482a29eb00 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -22,6 +22,7 @@
 #include <window.h>
 #include <salframe.hxx>
 
+#include <comphelper/lok.hxx>
 #include <vcl/layout.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/wrkwin.hxx>
@@ -297,6 +298,7 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow,
     }
 
     sal_uInt16 nArrangeIndex = 0;
+    const bool bLOKActive = comphelper::LibreOfficeKit::isActive();
 
     for ( ; nArrangeIndex < 5; nArrangeIndex++ )
     {
@@ -318,7 +320,7 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow,
                     if ( aPos.X() < aScreenRect.Left() )
                         bBreak = false;
                 }
-                if( bBreak )
+                if (bBreak || bLOKActive)
                 {
                     e1 = devRect.TopLeft();
                     e2 = devRect.BottomLeft();
@@ -342,7 +344,7 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow,
                     if ( aPos.X()+aSize.Width() > aScreenRect.Right() )
                         bBreak = false;
                 }
-                if( bBreak )
+                if (bBreak || bLOKActive)
                 {
                     e1 = devRect.TopRight();
                     e2 = devRect.BottomRight();
@@ -358,7 +360,7 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow,
                 aPos.Y() = devRect.Top()-aSize.Height()+1;
                 if ( aPos.Y() < aScreenRect.Top() )
                     bBreak = false;
-                if( bBreak )
+                if (bBreak || bLOKActive)
                 {
                     e1 = devRect.TopLeft();
                     e2 = devRect.TopRight();
@@ -373,7 +375,7 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow,
                 aPos = devRect.BottomLeft();
                 if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() )
                     bBreak = false;
-                if( bBreak )
+                if (bBreak || bLOKActive)
                 {
                     e1 = devRect.BottomLeft();
                     e2 = devRect.BottomRight();
@@ -387,6 +389,10 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow,
             default: break;
         }
 
+        // no further adjustement for LibreOfficeKit
+        if (bLOKActive)
+            break;
+
         // adjust if necessary
         if (bBreak)
         {
commit 0021f40cfd14d6f746d9a4eeed529beb3a0773e6
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Mar 12 17:27:10 2018 +0100

    Revert "lok: Don't freeze the LibreOfficeKit via the spell-checking popup..."
    
    This reverts commit 551e639f467813e52ff4301822b6a7f8778a2ef4.
    
    Change-Id: I0c7c85fe22d53aa5587ec119e1c3242682b88e43
    Reviewed-on: https://gerrit.libreoffice.org/51164
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit eda8d131c327a2fe360ac28a4b1014a4947a68bc)

diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 5a852f003605..8b5c4467cf58 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1025,11 +1025,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
         EPaM aP = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM);
         EPaM aP2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM2);
 
-        sal_uInt16 nId = 0;
-        // TODO for LOK, we'll need to convert the spelling popup menu to
-        // something much more sfx2-based & non-modal...
-        if (!comphelper::LibreOfficeKit::isActive())
-            nId = aPopupMenu->Execute( pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose );
+        sal_uInt16 nId = aPopupMenu->Execute( pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose );
 
         aPaM2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP2);
         aPaM = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP);
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index 63f41303f60a..da3f7a6a4cad 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -24,7 +24,6 @@
 #include <com/sun/star/linguistic2/ProofreadingResult.hpp>
 #include <com/sun/star/i18n/TextConversionOption.hpp>
 #include <linguistic/lngprops.hxx>
-#include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <comphelper/propertysequence.hxx>
@@ -722,14 +721,9 @@ bool SwView::ExecSpellPopup(const Point& rPt)
 
                 OUString sMenuName  = bUseGrammarContext ?
                     OUString("private:resource/GrammarContextMenu") : OUString("private:resource/SpellContextMenu");
-
-                if (comphelper::LibreOfficeKit::isActive())
-                {
-                    // TODO for LOK, we'll need to convert the spelling popup menu to
-                    // something much more sfx2-based & non-modal...
-                }
-                else if (TryContextMenuInterception(xPopup->GetMenu(), sMenuName, pMenu, aEvent))
+                if (TryContextMenuInterception(xPopup->GetMenu(), sMenuName, pMenu, aEvent))
                 {
+
                     //! happy hacking for context menu modifying extensions of this
                     //! 'custom made' menu... *sigh* (code copied from sfx2 and framework)
                     if ( pMenu )
commit 75f2d26ab6d83c91e8ce511926186e958f3e5000
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Mar 12 22:03:05 2018 +0530

    lokdocview: new property 'is-initialized'; fix gtktiledviewer for calc
    
    there's no lokdocview property to tell if the doc has been completely
    initialized (initializeForRendering() has been called, etc.). This new
    property takes care of that which we now use to ignore
    configure event fired before document is initialized for rendering.
    Configure event handler queries document for row/col header which
    asserts because some values hasn't been initialized yet.
    
    Change-Id: I58385b2cb56bf317fe20ecf0570b7095f7260174
    Reviewed-on: https://gerrit.libreoffice.org/51156
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    (cherry picked from commit f495a324921589d731d7d16f4554e36d4230476b)

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 5983b7f77e5b..c3ee592a5463 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -403,6 +403,15 @@ void LOKDocViewSigHandlers::window(LOKDocView* pDocView, gchar* pPayload, gpoint
 gboolean LOKDocViewSigHandlers::configureEvent(GtkWidget* pWidget, GdkEventConfigure* /*pEvent*/, gpointer /*pData*/)
 {
     GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pWidget)));
+
+    gboolean isInit = false;
+    g_object_get(G_OBJECT(window->lokdocview), "is-initialized", &isInit, nullptr);
+    if (!isInit)
+    {
+        g_info("Ignoring configure event; document not yet ready");
+        return false;
+    }
+
     LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(window->lokdocview));
     if (pDocument && pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_SPREADSHEET)
     {
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 5243e3887514..8fa945ae2db7 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -82,6 +82,7 @@ struct LOKDocViewPrivateImpl
     std::string m_aRenderingArguments;
     gdouble m_nLoadProgress;
     gboolean m_bIsLoading;
+    gboolean m_bInit; // initializeForRendering() has been called
     gboolean m_bCanZoomIn;
     gboolean m_bCanZoomOut;
     LibreOfficeKit* m_pOffice;
@@ -194,6 +195,7 @@ struct LOKDocViewPrivateImpl
     LOKDocViewPrivateImpl()
         : m_nLoadProgress(0),
         m_bIsLoading(false),
+        m_bInit(false),
         m_bCanZoomIn(true),
         m_bCanZoomOut(true),
         m_pOffice(nullptr),
@@ -292,6 +294,7 @@ enum
     PROP_LOAD_PROGRESS,
     PROP_ZOOM,
     PROP_IS_LOADING,
+    PROP_IS_INITIALIZED,
     PROP_DOC_WIDTH,
     PROP_DOC_HEIGHT,
     PROP_CAN_ZOOM_IN,
@@ -969,6 +972,9 @@ static gboolean postDocumentLoad(gpointer pData)
     gtk_widget_grab_focus(GTK_WIDGET(pLOKDocView));
     lok_doc_view_set_zoom(pLOKDocView, 1.0);
 
+    // we are completely loaded
+    priv->m_bInit = TRUE;
+
     return G_SOURCE_REMOVE;
 }
 
@@ -2574,6 +2580,9 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va
     case PROP_IS_LOADING:
         g_value_set_boolean (value, priv->m_bIsLoading);
         break;
+    case PROP_IS_INITIALIZED:
+        g_value_set_boolean (value, priv->m_bInit);
+        break;
     case PROP_DOC_WIDTH:
         g_value_set_long (value, priv->m_nDocumentWidthTwips);
         break;
@@ -2844,6 +2853,19 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
                                                       G_PARAM_STATIC_STRINGS));
 
     /**
+     * LOKDocView:is-initialized:
+     *
+     * Whether the requested document has completely loaded or not.
+     */
+    properties[PROP_IS_INITIALIZED] =
+        g_param_spec_boolean("is-initialized",
+                             "Has initialized",
+                             "Whether the view has completely initialized",
+                             FALSE,
+                             static_cast<GParamFlags>(G_PARAM_READABLE |
+                                                      G_PARAM_STATIC_STRINGS));
+
+    /**
      * LOKDocView:doc-width:
      *
      * The width of the currently loaded document in #LOKDocView in twips.
commit facabb8ecf6356c8f0012f91f0db0f0663faf53a
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Feb 13 00:22:44 2018 +0100

    Blind fix for MERGELIBS build
    
    It's g_aMergedLib instead of g_aMergedLibs, and osl::Module is not a
    unique_ptr or somesuch..
    
        commit 707f787cd991f9c59712cd3020d127d09605c792
        AuthorDate: Sun Feb 11 00:01:44 2018 +0100
        CommitDate: Mon Feb 12 22:27:55 2018 +0100
    
    Change-Id: I1f0266d189546dfe3b0d9eb449c878daebbf0da6
    (cherry picked from commit adff6293ce22d84e5a380aa649e7d0f0ffdc4d80)

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index cb3c5ae10152..35991601bc64 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1147,7 +1147,7 @@ void VclBuilder::preload()
 #ifndef DISABLE_DYNLOADING
 
 #if ENABLE_MERGELIBS
-    g_aMergedLibs->loadRelative(&thisModule, SVLIBRARY("merged"));
+    g_aMergedLib.loadRelative(&thisModule, SVLIBRARY("merged"));
 #endif
 // find -name '*ui*' | xargs grep 'class=".*lo-' |
 //     sed 's/.*class="//' | sed 's/-.*$//' | sort | uniq
@@ -1677,8 +1677,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
                 bool ok = false;
 #if ENABLE_MERGELIBS
                 if (!g_aMergedLib.is())
-                    g_aMergedLib->loadRelative(&thisModule, SVLIBRARY("merged"));
-                ok = g_aMergedLib->getFunctionSymbol(sFunction);
+                    g_aMergedLib.loadRelative(&thisModule, SVLIBRARY("merged"));
+                ok = g_aMergedLib.getFunctionSymbol(sFunction);
 #endif
                 if (!ok)
                     ok = pModule->loadRelative(&thisModule, sModule);


More information about the Libreoffice-commits mailing list