[Libreoffice-commits] core.git: Branch 'distro/vector/vector-5.4' - 3 commits - embeddedobj/source sfx2/source sw/qa sw/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 19 11:41:36 UTC 2019


 embeddedobj/source/commonembedding/embedobj.cxx    |   34 ++++++++++--------
 sfx2/source/view/viewsh.cxx                        |    4 +-
 sw/qa/extras/uiwriter/data/ole-save-while-edit.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx                 |   38 +++++++++++++++++++++
 sw/source/uibase/app/docsh.cxx                     |    8 ++++
 5 files changed, 68 insertions(+), 16 deletions(-)

New commits:
commit db175f7b0114fce67b2ae403b572e53fd8aa9f25
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jul 18 18:03:54 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jul 19 12:10:51 2019 +0200

    sw: fix missing OLE preview for actively edited OLE object on save
    
    Regression from commit 74844277cc2194c9e43f5bd7a6f78a9603da32f3 (disable
    generation of ole previews in ODF format until after load, 2016-09-13),
    if the user started an OLE edit in a Writer document, and saved without
    ending the OLE edit, then
    svt::EmbeddedObjectRef::UpdateReplacementOnDemand() removed the old
    replacement image, but no new one was created.
    
    Given that save is always an explicit user action (auto-save does not
    kick in for unmodified documents), restore the permission to update OLE
    replacement images during save.
    
    Do this check in SwDocShell::CalcLayoutForOLEObjects(), as that's
    OLE-related and is called from all the relevant save code paths (save,
    save-as, convert to alien formats).
    
    Reviewed-on: https://gerrit.libreoffice.org/75867
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit d33cc4f7edc2ce21a9c5a01a7f5e85cfd324c6d9)
    
    Conflicts:
            sw/qa/extras/uiwriter/uiwriter2.cxx
            sw/source/uibase/app/docsh.cxx
    
    Change-Id: Idaad43909cd744a379e713efd70ffd000e2692bc

diff --git a/sw/qa/extras/uiwriter/data/ole-save-while-edit.odt b/sw/qa/extras/uiwriter/data/ole-save-while-edit.odt
new file mode 100644
index 000000000000..33a2284dd314
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/ole-save-while-edit.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 66886a70fa05..735ab11d4518 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -108,6 +108,7 @@
 #include <sfx2/watermarkitem.hxx>
 #include <svtools/htmlout.hxx>
 #include <test/htmltesttools.hxx>
+#include <comphelper/lok.hxx>
 #include <wrthtml.hxx>
 
 namespace
@@ -279,6 +280,7 @@ public:
     void testHtmlCopyImages();
     void testTdf116789();
     void testTdf117225();
+    void testOleSaveWhileEdit();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -420,6 +422,7 @@ public:
     CPPUNIT_TEST(testHtmlCopyImages);
     CPPUNIT_TEST(testTdf116789);
     CPPUNIT_TEST(testTdf117225);
+    CPPUNIT_TEST(testOleSaveWhileEdit);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -5083,6 +5086,41 @@ void SwUiWriterTest::testTdf117225()
     CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
 }
 
+void SwUiWriterTest::testOleSaveWhileEdit()
+{
+    // Enable LOK mode, otherwise OCommonEmbeddedObject::SwitchStateTo_Impl() will throw when it
+    // finds out that the test runs headless.
+    comphelper::LibreOfficeKit::setActive();
+
+    // Load a document with a Draw doc in it.
+    SwDoc* pDoc = createDoc("ole-save-while-edit.odt");
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    pWrtShell->GotoObj(/*bNext=*/true, GotoObjFlags::Any);
+
+    // Select the frame and switch to the frame shell.
+    SwView* pView = pDoc->GetDocShell()->GetView();
+    pView->StopShellTimer();
+
+    // Start editing the OLE object.
+    pWrtShell->LaunchOLEObj();
+
+    // Save the document without existing the OLE edit.
+    uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+    xStorable->storeToURL(maTempFile.GetURL(), {});
+
+    uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
+        = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
+                                                      maTempFile.GetURL());
+    // Without the accompanying fix in place, this test would have failed: the OLE object lost its
+    // replacement on save if the edit was active while saving.
+    CPPUNIT_ASSERT(xNameAccess->hasByName("ObjectReplacements/Object 1"));
+
+    // Dispose the document while LOK is still active to avoid leaks.
+    mxComponent->dispose();
+    mxComponent.clear();
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 2f1815ab6598..18a079835957 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -1211,6 +1211,14 @@ void SwDocShell::CalcLayoutForOLEObjects()
     if (!m_pWrtShell)
         return;
 
+    if (m_pView && m_pView->GetIPClient())
+    {
+        // We have an active OLE edit: allow link updates, so an up to date replacement graphic can
+        // be created.
+        comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer();
+        rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true);
+    }
+
     SwIterator<SwContentNode,SwFormatColl> aIter( *m_pDoc->GetDfltGrfFormatColl() );
     for( SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
     {
commit b202fabd2123555fad0ca251ab3e8b7ab7c8d36a
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Mon Feb 26 13:55:21 2018 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jul 19 12:10:50 2019 +0200

    lok - chart - state switch issue triggers an OLE general error msg box
    
    Reviewed-on: https://gerrit.libreoffice.org/50368
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/50482
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    (cherry picked from commit a3646b25ac4c976b891d69759035345630c4f1a2)
    
    Change-Id: I6addd95d1ad3461b6e21328512cbd1301a36cd19

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index c70a7ba40bd6..af0e8bcbec0b 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -43,6 +43,7 @@
 #include <com/sun/star/embed/EmbedMisc.hpp>
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/lok.hxx>
 
 #include <vcl/svapp.hxx>
 
@@ -318,22 +319,25 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
                     catch( const uno::Exception& )
                     {}
 
-                    // if currently another object is UIactive it will be deactivated; usually this will activate the LM of
-                    // the container. Locking the LM will prevent flicker.
-                    xContainerLM->lock();
-                    xInplaceClient->activatingUI();
-                    bool bOk = m_xDocHolder->ShowUI( xContainerLM, xContainerDP, aModuleName );
-                    xContainerLM->unlock();
-
-                    if ( bOk )
-                    {
-                        m_nObjectState = nNextState;
-                        m_xDocHolder->ResizeHatchWindow();
-                    }
-                    else
+                    if (!comphelper::LibreOfficeKit::isActive())
                     {
-                        xInplaceClient->deactivatedUI();
-                        throw embed::WrongStateException(); //TODO: can't activate UI
+                        // if currently another object is UIactive it will be deactivated; usually this will activate the LM of
+                        // the container. Locking the LM will prevent flicker.
+                        xContainerLM->lock();
+                        xInplaceClient->activatingUI();
+                        bool bOk = m_xDocHolder->ShowUI( xContainerLM, xContainerDP, aModuleName );
+                        xContainerLM->unlock();
+
+                        if ( bOk )
+                        {
+                            m_nObjectState = nNextState;
+                            m_xDocHolder->ResizeHatchWindow();
+                        }
+                        else
+                        {
+                            xInplaceClient->deactivatedUI();
+                            throw embed::WrongStateException(); //TODO: can't activate UI
+                        }
                     }
                 }
                 else
commit 5633b42c8991a580ff1fb81177fc204b23763d79
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Tue Jun 27 23:35:08 2017 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jul 19 12:10:50 2019 +0200

    lok - add support for in place chart editing
    
    This commit add a minimal support for editing chart embedded in a
    spreadsheet or a text document or a presentation.
    Graphic objects can be moved and resized, text objects can be edited.
    
    Reviewed-on: https://gerrit.libreoffice.org/39342
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    (cherry picked from commit eba883c8a2ce045fc7bd3848d796ca10b7f4ba51)
    
    Change-Id: I8e637dabf328a94bd6bb0e309a245302cff421d8

diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 8fc744e5c033..5541bcaf96f3 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -841,9 +841,11 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveClient() const
     if ( !pClients )
         return nullptr;
 
+    bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
+
     for (SfxInPlaceClient* pIPClient : *pClients)
     {
-        if ( pIPClient->IsObjectUIActive() )
+        if ( pIPClient->IsObjectUIActive() || ( bIsTiledRendering && pIPClient->IsObjectInPlaceActive() ) )
             return pIPClient;
     }
 


More information about the Libreoffice-commits mailing list