sc/qa/uitest/calc_tests7/save_readonly_with_password.py | 5 +++-- sc/qa/uitest/calc_tests8/tdf147086.py | 3 ++- sc/qa/uitest/calc_tests9/tdf115933.py | 3 ++- sc/qa/uitest/calc_tests9/tdf118938.py | 3 ++- sc/qa/uitest/calc_tests9/tdf144996.py | 6 +++--- sfx2/source/doc/objmisc.cxx | 8 +++++++- 6 files changed, 19 insertions(+), 9 deletions(-)
New commits: commit 861028593d7351d5ae8a0b8840ef8018b467f5de Author: Henry Castro <hcas...@collabora.com> AuthorDate: Mon Sep 18 17:05:56 2023 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Thu Sep 21 16:03:19 2023 +0200 uitest: add "Silent" property parameter add option to not popup the read-only dialog when load and excel file. Signed-off-by: Henry Castro <hcas...@collabora.com> Change-Id: I5e0ac06e3e872f156f6150f4b8bead61e7986c25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157036 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sc/qa/uitest/calc_tests7/save_readonly_with_password.py b/sc/qa/uitest/calc_tests7/save_readonly_with_password.py index 02f125e3008f..0e4e75785bea 100644 --- a/sc/qa/uitest/calc_tests7/save_readonly_with_password.py +++ b/sc/qa/uitest/calc_tests7/save_readonly_with_password.py @@ -8,6 +8,7 @@ # from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.beans import PropertyValue from org.libreoffice.unotest import systemPathToFileUrl from uitest.uihelper.common import select_by_text from tempfile import TemporaryDirectory @@ -48,7 +49,7 @@ class save_readonly_with_password(UITestCase): self.ui_test.wait_until_file_is_available(xFilePath) - with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + with self.ui_test.load_file(systemPathToFileUrl(xFilePath), [PropertyValue(Name="Silent", Value=True)]) as document: self.assertTrue(document.isReadonly()) @@ -84,7 +85,7 @@ class save_readonly_with_password(UITestCase): self.ui_test.wait_until_file_is_available(xFilePath) - with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + with self.ui_test.load_file(systemPathToFileUrl(xFilePath), [PropertyValue(Name="Silent", Value=True)]) as document: self.assertTrue(document.isReadonly()) diff --git a/sc/qa/uitest/calc_tests8/tdf147086.py b/sc/qa/uitest/calc_tests8/tdf147086.py index f594edb696f6..4decfa3dd3b3 100755 --- a/sc/qa/uitest/calc_tests8/tdf147086.py +++ b/sc/qa/uitest/calc_tests8/tdf147086.py @@ -8,6 +8,7 @@ # from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.beans import PropertyValue from org.libreoffice.unotest import systemPathToFileUrl from uitest.uihelper.common import select_by_text from tempfile import TemporaryDirectory @@ -46,7 +47,7 @@ class tdf147086(UITestCase): self.ui_test.wait_until_file_is_available(xFilePath) - with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + with self.ui_test.load_file(systemPathToFileUrl(xFilePath), [PropertyValue(Name="Silent", Value=True)]) as document: self.assertTrue(document.isReadonly()) diff --git a/sc/qa/uitest/calc_tests9/tdf115933.py b/sc/qa/uitest/calc_tests9/tdf115933.py index 0fe7fec06758..128b80652e47 100644 --- a/sc/qa/uitest/calc_tests9/tdf115933.py +++ b/sc/qa/uitest/calc_tests9/tdf115933.py @@ -8,6 +8,7 @@ # from uitest.framework import UITestCase from uitest.uihelper.common import get_url_for_data_file +from com.sun.star.beans import PropertyValue from libreoffice.uno.propertyvalue import mkPropertyValues #Bug 115933 - XLSX <fileSharing> password protected with algorithmName, hashValue, saltValue and spinCount @@ -15,7 +16,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf115933(UITestCase): def test_tdf115933(self): - with self.ui_test.load_file(get_url_for_data_file("tdf115933.xlsx")): + with self.ui_test.load_file(get_url_for_data_file("tdf115933.xlsx"), [PropertyValue(Name="Silent", Value=True)]): #The document was created in Excel. calcDoc = self.xUITest.getTopFocusWindow() gridwin = calcDoc.getChild("grid_window") diff --git a/sc/qa/uitest/calc_tests9/tdf118938.py b/sc/qa/uitest/calc_tests9/tdf118938.py index eede90451e67..33f8cde75d82 100644 --- a/sc/qa/uitest/calc_tests9/tdf118938.py +++ b/sc/qa/uitest/calc_tests9/tdf118938.py @@ -9,6 +9,7 @@ from uitest.framework import UITestCase from uitest.uihelper.common import get_url_for_data_file from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.beans import PropertyValue #Bug 118938 - FILESAVE to Microsoft Excel 2007-2013 XML (.xlsx) files as read-only # with additional password protection for editing not working (Calc) @@ -16,7 +17,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf118938(UITestCase): def test_tdf118938(self): - with self.ui_test.load_file(get_url_for_data_file("tdf118938.xlsx")): + with self.ui_test.load_file(get_url_for_data_file("tdf118938.xlsx"), [PropertyValue(Name="Silent", Value=True)]): #The document was created in Calc after this fix. document = self.ui_test.get_component() diff --git a/sc/qa/uitest/calc_tests9/tdf144996.py b/sc/qa/uitest/calc_tests9/tdf144996.py index eabd61ddb117..fcfb366feb8a 100644 --- a/sc/qa/uitest/calc_tests9/tdf144996.py +++ b/sc/qa/uitest/calc_tests9/tdf144996.py @@ -10,7 +10,7 @@ from uitest.framework import UITestCase from uitest.uihelper.common import get_url_for_data_file from libreoffice.uno.propertyvalue import mkPropertyValues - +from com.sun.star.beans import PropertyValue class tdf144996(UITestCase): @@ -20,7 +20,7 @@ class tdf144996(UITestCase): # so using save doesn't affect the original file xFilePath = get_url_for_data_file("tdf144996.xlsx") - with self.ui_test.load_file(xFilePath) as document: + with self.ui_test.load_file(xFilePath, [PropertyValue(Name="Silent", Value=True)]) as document: self.assertTrue(document.isReadonly()) @@ -34,7 +34,7 @@ class tdf144996(UITestCase): # Confirm file format popup pass - with self.ui_test.load_file(xFilePath) as document: + with self.ui_test.load_file(xFilePath, [PropertyValue(Name="Silent", Value=True)]) as document: self.assertTrue(document.isReadonly()) diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 57698b41f82e..07e73189df61 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1113,7 +1113,13 @@ void SfxObjectShell::FinishedLoading( SfxLoadedFlags nFlags ) INetURLObject::DecodeMechanism::WithCharset); } - if (aFilterName.indexOf("Excel") != -1) + bool bSilent = false; + if (const SfxBoolItem* pSilentNameItem = + SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), + SID_SILENT, false)) + bSilent = pSilentNameItem->GetValue(); + + if (!bSilent && aFilterName.indexOf("Excel") != -1) { Reference<task::XInteractionHandler> xHandler(pMedium->GetInteractionHandler()); if (xHandler.is())