From 117fdb9898dcc379b4f83437e858c57fd1d11911 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 21 Nov 2012 22:21:40 +0100 Subject: convert users of XDocumentInfo to XDocumentProperties Change-Id: I10f395f90d554d0ec26fe9f2654ae839e21c7ee5 --- svtools/source/contnr/contentenumeration.cxx | 25 +++++++++++-------------- svtools/source/contnr/contentenumeration.hxx | 7 ++++--- 2 files changed, 15 insertions(+), 17 deletions(-) (limited to 'svtools') diff --git a/svtools/source/contnr/contentenumeration.cxx b/svtools/source/contnr/contentenumeration.cxx index c317a233abdc..766221a5badc 100644 --- a/svtools/source/contnr/contentenumeration.cxx +++ b/svtools/source/contnr/contentenumeration.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -71,6 +72,8 @@ namespace svt using ::com::sun::star::ucb::XContentAccess; using ::com::sun::star::ucb::XCommandEnvironment; using ::com::sun::star::beans::XPropertySet; + using ::com::sun::star::beans::PropertyValue; + using ::com::sun::star::document::DocumentProperties; using ::rtl::OUString; using ::ucbhelper::ResultSetInclude; using ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS; @@ -379,26 +382,20 @@ namespace svt try { ::osl::MutexGuard aGuard( m_aMutex ); - if( !m_xDocInfo.is() ) + if (!m_xDocProps.is()) { - m_xDocInfo = m_xDocInfo.query( - ::comphelper::getProcessServiceFactory()->createInstance( - String( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.StandaloneDocumentInfo") ) - ) - ); + m_xDocProps.set(DocumentProperties::create( + ::comphelper::getProcessComponentContext())); } - DBG_ASSERT( m_xDocInfo.is(), "FileViewContentEnumerator::implGetDocTitle: no DocumentProperties service!" ); - if ( !m_xDocInfo.is() ) + assert(m_xDocProps.is()); + if (!m_xDocProps.is()) return sal_False; - m_xDocInfo->loadFromURL( _rTargetURL ); - Reference< XPropertySet > xPropSet( m_xDocInfo, UNO_QUERY ); + m_xDocProps->loadFromMedium(_rTargetURL, Sequence()); - Any aAny = xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" )) ); - - OUString sTitle; - if ( ( aAny >>= sTitle ) && !sTitle.isEmpty() ) + OUString const sTitle(m_xDocProps->getTitle()); + if (!sTitle.isEmpty()) { _rRet = sTitle; bRet = sal_True; diff --git a/svtools/source/contnr/contentenumeration.hxx b/svtools/source/contnr/contentenumeration.hxx index 8188bde91f59..775f2a661f25 100644 --- a/svtools/source/contnr/contentenumeration.hxx +++ b/svtools/source/contnr/contentenumeration.hxx @@ -21,7 +21,7 @@ #define SVTOOLS_SOURCE_CONTNR_CONTENTENUMERATION_HXX #include -#include +#include #include #include #include @@ -198,8 +198,9 @@ namespace svt IEnumerationResultHandler* m_pResultHandler; bool m_bCancelled; - mutable ::com::sun::star::uno::Reference< ::com::sun::star::document::XStandaloneDocumentInfo > - m_xDocInfo; + mutable ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> + m_xDocProps; ::com::sun::star::uno::Sequence< ::rtl::OUString > m_rBlackList; -- cgit