[Libreoffice-commits] core.git: include/sfx2 offapi/com sfx2/source sw/qa

2020-04-29 Thread Xisco Fauli (via logerrit)
 include/sfx2/sfxbasecontroller.hxx |1 
 offapi/com/sun/star/frame/XInfobarProvider.idl |9 ++
 sfx2/source/view/sfxbasecontroller.cxx |7 +
 sw/qa/uitest/classification/classification.py  |   34 +
 4 files changed, 41 insertions(+), 10 deletions(-)

New commits:
commit 1f4a2b698cb5bb987cad5bc2a5503e23dd8a7b9c
Author: Xisco Fauli 
AuthorDate: Tue Apr 21 15:04:19 2020 +0200
Commit: Miklos Vajna 
CommitDate: Wed Apr 29 12:05:40 2020 +0200

[API CHANGE] uitest: make HasInfoBarWithID accessible from API

This is useful for checking in uitests whether the infobar exists

Change-Id: I436c2659abd40756673634f7cd1f8e4846c03836
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92635
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/sfx2/sfxbasecontroller.hxx 
b/include/sfx2/sfxbasecontroller.hxx
index 33a14090e3e7..7fd536a14ef7 100644
--- a/include/sfx2/sfxbasecontroller.hxx
+++ b/include/sfx2/sfxbasecontroller.hxx
@@ -186,6 +186,7 @@ public:
 const OUString& sSecondaryMessage,
 sal_Int32 aInfobarType) override;
 virtual void SAL_CALL removeInfobar(const OUString& sId) override;
+virtual sal_Bool SAL_CALL hasInfobar(const OUString& sId) override;
 
 // FIXME: TL needs this in sw/source/ui/uno/unotxdoc.cxx now;
 // either the _Impl name should vanish or there should be an "official" API
diff --git a/offapi/com/sun/star/frame/XInfobarProvider.idl 
b/offapi/com/sun/star/frame/XInfobarProvider.idl
index 1fbaa4657188..889be2aa4bcd 100644
--- a/offapi/com/sun/star/frame/XInfobarProvider.idl
+++ b/offapi/com/sun/star/frame/XInfobarProvider.idl
@@ -94,6 +94,15 @@ interface XInfobarProvider: uno::XInterface
 If no such Infobar exists (it might have been closed by the user 
already)
  */
 void removeInfobar([in] string id) 
raises(com::sun::star::container::NoSuchElementException);
+
+/** Check if Infobar exists.
+
+@param id
+The ID which was used when creating this Infobar.
+
+@since LibreOffice 7.0
+ */
+boolean hasInfobar([in] string id);
 };
 
 
diff --git a/sfx2/source/view/sfxbasecontroller.cxx 
b/sfx2/source/view/sfxbasecontroller.cxx
index 1ad856065b8e..9baebe0be2ff 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -1535,4 +1535,11 @@ void SAL_CALL SfxBaseController::removeInfobar(const 
OUString& sId)
 pViewFrame->RemoveInfoBar(sId);
 }
 
+sal_Bool SAL_CALL SfxBaseController::hasInfobar(const OUString& sId)
+{
+SolarMutexGuard aGuard;
+SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame();
+return pViewFrame->HasInfoBarWithID(sId);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/uitest/classification/classification.py 
b/sw/qa/uitest/classification/classification.py
index 373d4b5ad012..e7fde9d70ec7 100644
--- a/sw/qa/uitest/classification/classification.py
+++ b/sw/qa/uitest/classification/classification.py
@@ -10,14 +10,13 @@ from uitest.uihelper.common import select_pos
 from uitest.uihelper.calc import enter_text_to_cell
 from libreoffice.calc.document import get_cell_by_position
 from libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.uihelper.common import get_state_as_dict, type_text
+from uitest.uihelper.common import get_state_as_dict
 from uitest.debug import sleep
-# import org.libreoffice.unotest
-# import pathlib
-from uitest.path import get_srcdir_url
+import org.libreoffice.unotest
+import pathlib
+
 def get_url_for_data_file(file_name):
-#return 
pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
-return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name
+return 
pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
 
 #TSCP: add advanced classification dialog 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=71ee09947d5a71105d64fd225bb3672dfa7ce834
 # This adds an advanced classification dialog, which enables the user
@@ -69,6 +68,13 @@ class classification(UITestCase):
 # 
self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf")
 xOKBtn = xDialog.getChild("ok")
 self.ui_test.close_dialog_through_button(xOKBtn)
+
+header = 
document.StyleFamilies.PageStyles.Standard.HeaderText.createEnumeration().nextElement()
+self.assertEqual(header.String, "Confidential")
+
+controller = self.ui_test.get_component().getCurrentController()
+self.assertTrue(controller.hasInfobar("classification"))
+
 #verify watermark
 #Bug 122586 - Classification: by using the dialog, Watermark text from 
policy is not placed in the document
 self.ui_test.execute_dialog_through_command(".uno:Watermark")
@@ -103,13 +109,15 @@ class classification(UITestCase):
  

[Libreoffice-commits] core.git: include/sfx2 offapi/com sfx2/source sw/qa

2019-11-13 Thread Serge Krot (via logerrit)
 include/sfx2/sfxsids.hrc |3 ++-
 include/sfx2/viewsh.hxx  |1 +
 offapi/com/sun/star/document/MediaDescriptor.idl |6 ++
 offapi/com/sun/star/frame/XModel2.idl|2 +-
 sfx2/source/appl/appuno.cxx  |   18 ++
 sfx2/source/doc/sfxbasemodel.cxx |5 +
 sfx2/source/view/viewfrm.cxx |   22 +-
 sfx2/source/view/viewsh.cxx  |9 +
 sw/qa/python/check_xmodel.py |4 +++-
 9 files changed, 62 insertions(+), 8 deletions(-)

New commits:
commit a474e2267cdcb1707333acdea1353d883d58c801
Author: Serge Krot 
AuthorDate: Tue Nov 12 21:52:05 2019 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Wed Nov 13 12:45:39 2019 +0100

Add document level option to lock down edit doc command

Change-Id: I431fa4cd0daa52c885030dbadcc4052b5a890d34
Reviewed-on: https://gerrit.libreoffice.org/82553
Reviewed-by: Serge Krot (CIB) 
Tested-by: Serge Krot (CIB) 
Reviewed-on: https://gerrit.libreoffice.org/82576
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 2e1dbf6ff748..9fa90a5f6226 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -268,8 +268,9 @@ class SvxSearchItem;
 #define SID_DIALOG_PARENT   (SID_SFX_START + 1735)
 #define SID_LOCK_PRINT  (SID_SFX_START + 1736)
 #define SID_LOCK_SAVE   (SID_SFX_START + 1737)
+#define SID_LOCK_EDITDOC(SID_SFX_START + 1738)
 
-//  SID_SFX_free_START  (SID_SFX_START + 1738)
+//  SID_SFX_free_START  (SID_SFX_START + 1739)
 //  SID_SFX_free_END(SID_SFX_START + 3999)
 
 #define SID_OPEN_NEW_VIEW   (SID_SFX_START + 520)
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index a1a225aa1b28..d65fae656b16 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -292,6 +292,7 @@ public:
 bool isExportLocked();
 bool isPrintLocked();
 bool isSaveLocked();
+bool isEditDocLocked();
 
 SAL_DLLPRIVATE SfxInPlaceClient* GetUIActiveIPClient_Impl() const;
 SAL_DLLPRIVATE void AddContextMenuInterceptor_Impl( const 
css::uno::Reference < css::ui::XContextMenuInterceptor >& xInterceptor );
diff --git a/offapi/com/sun/star/document/MediaDescriptor.idl 
b/offapi/com/sun/star/document/MediaDescriptor.idl
index 72ee23fcd2ee..728ef4ab4a29 100644
--- a/offapi/com/sun/star/document/MediaDescriptor.idl
+++ b/offapi/com/sun/star/document/MediaDescriptor.idl
@@ -590,6 +590,12 @@ service MediaDescriptor
 @since LibreOffice 6.4
  */
 [optional,property] boolean LockSave;
+
+/** Setting this option will disable switching to edit mode from read-only 
mode.
+ *
+@since LibreOffice 6.4
+ */
+[optional,property] boolean LockEditDoc;
 };
 
 
diff --git a/offapi/com/sun/star/frame/XModel2.idl 
b/offapi/com/sun/star/frame/XModel2.idl
index 128d5ced20d6..4221a527c380 100644
--- a/offapi/com/sun/star/frame/XModel2.idl
+++ b/offapi/com/sun/star/frame/XModel2.idl
@@ -146,7 +146,7 @@ interface XModel2 : com::sun::star::frame::XModel
 com::sun::star::document::MediaDescriptor::LockExport
 com::sun::star::document::MediaDescriptor::LockPrint
 com::sun::star::document::MediaDescriptor::LockSave
-
+com::sun::star::document::MediaDescriptor::LockEditDoc
 
 
 @throws com::sun::star::lang::IllegalArgumentException When trying to 
set an unsupported property
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index c633978076d9..bfbe90dc896b 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -173,6 +173,7 @@ static char const sLockContentExtraction[] = 
"LockContentExtraction";
 static char const sLockExport[] = "LockExport";
 static char const sLockPrint[] = "LockPrint";
 static char const sLockSave[] = "LockSave";
+static char const sLockEditDoc[] = "LockEditDoc";
 
 static bool isMediaDescriptor( sal_uInt16 nSlotId )
 {
@@ -879,6 +880,14 @@ void TransformParameters( sal_uInt16 nSlotId, const 
uno::Sequence>= bVal);
+DBG_ASSERT( bOK, "invalid type for LockEditDoc" );
+if (bOK)
+rSet.Put( SfxBoolItem( SID_LOCK_EDITDOC, bVal ) );
+}
 #ifdef DBG_UTIL
 else
 --nFoundArgs;
@@ -1104,6 +1113,8 @@ void TransformItems( sal_uInt16 nSlotId, const 
SfxItemSet& rSet, uno::Sequence(nId));
@@ -1681,6 +1694,11 @@ void TransformItems( sal_uInt16 nSlotId, const 
SfxItemSet& rSet, uno::Sequence(pItem)->GetValue() ;
 }
+if ( rSet.GetItemState( SID_LOCK_EDITDOC, false,  ) == 
SfxItemState::SET )
+{
+pValue[nActProp].Name =