summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/uibase/shells/data/ole-save-preview-update.odtbin0 -> 16006 bytes
-rw-r--r--sw/qa/uibase/shells/shells.cxx33
-rw-r--r--sw/source/uibase/shells/basesh.cxx4
3 files changed, 34 insertions, 3 deletions
diff --git a/sw/qa/uibase/shells/data/ole-save-preview-update.odt b/sw/qa/uibase/shells/data/ole-save-preview-update.odt
new file mode 100644
index 000000000000..353ce7fa050c
--- /dev/null
+++ b/sw/qa/uibase/shells/data/ole-save-preview-update.odt
Binary files differ
diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx
index c1012d6af1d1..fbdf35758156 100644
--- a/sw/qa/uibase/shells/shells.cxx
+++ b/sw/qa/uibase/shells/shells.cxx
@@ -26,16 +26,21 @@
#include <IDocumentDrawModelAccess.hxx>
#include <drawdoc.hxx>
+static char const DATA_DIRECTORY[] = "/sw/qa/uibase/shells/data/";
+
/// Covers sw/source/uibase/shells/ fixes.
class SwUibaseShellsTest : public SwModelTestBase
{
public:
- SwDoc* createDoc();
+ SwDoc* createDoc(const char* pName = nullptr);
};
-SwDoc* SwUibaseShellsTest::createDoc()
+SwDoc* SwUibaseShellsTest::createDoc(const char* pName)
{
- loadURL("private:factory/swriter", nullptr);
+ if (!pName)
+ loadURL("private:factory/swriter", nullptr);
+ else
+ load(DATA_DIRECTORY, pName);
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
@@ -112,6 +117,28 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testShapeTextAlignment)
#endif
}
+CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOleSavePreviewUpdate)
+{
+ // Load a document with 2 charts in it. The second is down enough that you have to scroll to
+ // trigger its rendering. Previews are missing for both.
+ createDoc("ole-save-preview-update.odt");
+
+ // Explicitly update OLE previews, etc.
+ dispatchCommand(mxComponent, ".uno:UpdateAll", {});
+
+ // Save the document and see if we get the previews.
+ 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, because the object
+ // replacements were not generated, even after UpdateAll.
+ CPPUNIT_ASSERT(xNameAccess->hasByName("ObjectReplacements/Object 1"));
+ CPPUNIT_ASSERT(xNameAccess->hasByName("ObjectReplacements/Object 2"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 64fd150e1700..c01c31da877c 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -716,6 +716,10 @@ void SwBaseShell::Execute(SfxRequest &rReq)
case FN_UPDATE_ALL:
{
+ comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer
+ = GetObjectShell()->getEmbeddedObjectContainer();
+ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true);
+
SwView& rTempView = GetView();
rSh.EnterStdMode();
if( !rSh.GetLinkManager().GetLinks().empty() )