summaryrefslogtreecommitdiff
path: root/ucb/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2023-10-27 21:14:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-10-28 14:27:44 +0200
commit4d85dfd54942e1fc442f3d1a424207ab61b65806 (patch)
tree7f124f583223011ab574754ed1786a56f4de7399 /ucb/source
parent4a4e8a7aa2c9631f199014c125a1a926d327a005 (diff)
use more XModel3::getArgs2
to avoid needing to query other, rather expensive properties Change-Id: I34ebc7a03e468f0a7fa9964954e5690ad336016a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158579 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb/source')
-rw-r--r--ucb/source/ucp/tdoc/tdoc_docmgr.cxx17
-rw-r--r--ucb/source/ucp/tdoc/tdoc_docmgr.hxx4
2 files changed, 15 insertions, 6 deletions
diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
index 0e11f546bb1e..39fa5bc828b5 100644
--- a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
@@ -556,13 +556,20 @@ void OfficeDocumentsManager::updateStreamDateModified(OUString const & uri) {
bool OfficeDocumentsManager::isDocumentPreview(
- const uno::Reference< frame::XModel > & xModel )
+ const uno::Reference< frame::XModel3 > & xModel )
{
if ( !xModel.is() )
return false;
- bool bIsPreview = ::comphelper::NamedValueCollection::getOrDefault( xModel->getArgs(), u"Preview", false );
- return bIsPreview;
+ uno::Sequence<beans::PropertyValue> props = xModel->getArgs2( { "Preview" } );
+ for (const auto & rProp : props)
+ if (rProp.Name == "Preview")
+ {
+ bool bIsPreview = false;
+ rProp.Value >>= bIsPreview;
+ return bIsPreview;
+ }
+ return false;
}
@@ -664,11 +671,13 @@ bool OfficeDocumentsManager::isOfficeDocument(
xStorageBasedDoc( xModel, uno::UNO_QUERY );
if ( !xStorageBasedDoc.is() )
return false;
+ uno::Reference< frame::XModel3 > xModel3( xDoc, uno::UNO_QUERY );
+ assert(xModel3 && "anything implementing frame:XModel is expected to implement XModel3 as well");
if ( !isWithoutOrInTopLevelFrame( xModel ) )
return false;
- if ( isDocumentPreview( xModel ) )
+ if ( isDocumentPreview( xModel3 ) )
return false;
if ( isHelpDocument( xModel ) )
diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx
index 8daf9eba60e4..7115d0fe8e99 100644
--- a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx
@@ -25,7 +25,7 @@
#include <com/sun/star/document/XDocumentEventListener.hpp>
#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XModel3.hpp>
#include <com/sun/star/frame/XModuleManager2.hpp>
#include <com/sun/star/frame/XGlobalEventBroadcaster.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -133,7 +133,7 @@ namespace tdoc_ucp {
const css::uno::Reference< css::uno::XInterface > & xDoc );
static bool isDocumentPreview(
- const css::uno::Reference< css::frame::XModel > & xModel );
+ const css::uno::Reference< css::frame::XModel3 > & xModel );
static bool isWithoutOrInTopLevelFrame(
const css::uno::Reference< css::frame::XModel > & xModel );