summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-10-09 10:47:32 +0200
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-10-11 17:31:17 +0200
commitf5a84d8c1a44d82f2ca96a3d219a4cb05ab71a39 (patch)
treeb77f960a094406e1ad3eecc8e7402a97ba300754 /sfx2
parent97aa108f2b595145d63b00d515489030a849957e (diff)
CMIS: Provide the CMIS properties in the UNO API of documents
Change-Id: Ieb48f615a80e1fa2d49b4efada1f8f9fc4349c29
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/sfxbasemodel.hxx27
-rw-r--r--sfx2/source/doc/objstor.cxx21
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx28
3 files changed, 72 insertions, 4 deletions
diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx
index 0fae6b8c766d..8b7097f4ff68 100644
--- a/sfx2/inc/sfx2/sfxbasemodel.hxx
+++ b/sfx2/inc/sfx2/sfxbasemodel.hxx
@@ -32,6 +32,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/frame/XController2.hpp>
+#include <com/sun/star/document/XCmisDocument.hpp>
#include <com/sun/star/document/XDocumentInfo.hpp>
#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
@@ -87,9 +88,9 @@
#include <com/sun/star/task/XInteractionHandler.hpp>
//________________________________________________________________________________________________________
-#ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_32
-#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_32
-#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 32
+#ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_33
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_33
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 33
#include <comphelper/implbase_var.hxx>
#endif
@@ -209,9 +210,10 @@ namespace sfx { namespace intern {
SfxListener
*/
-typedef ::comphelper::WeakImplHelper32 < XCHILD
+typedef ::comphelper::WeakImplHelper33 < XCHILD
, XDOCUMENTINFOSUPPLIER
, ::com::sun::star::document::XDocumentPropertiesSupplier
+ , ::com::sun::star::document::XCmisDocument
, ::com::sun::star::rdf::XDocumentMetadataAccess
, ::com::sun::star::document::XDocumentRecovery
, ::com::sun::star::document::XUndoManagerSupplier
@@ -1402,6 +1404,23 @@ public:
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::WrappedTargetException);
+ // XCmisDocument
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ SAL_CALL getCmisPropertiesValues()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setCmisPropertiesValues(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& _cmispropertiesvalues )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ SAL_CALL getCmisPropertiesDisplayNames()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setCmisPropertiesDisplayNames(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& _cmispropertiesdisplaynames )
+ throw (::com::sun::star::uno::RuntimeException);
+
//____________________________________________________________________________________________________
// SfxListener
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index b9b5f0480551..ec6b25236f86 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/document/XCmisDocument.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/document/XExporter.hpp>
@@ -744,6 +745,26 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
com::sun::star::uno::Reference < XPropertySetInfo > xProps = aContent.getProperties();
if ( xProps.is() )
{
+ // Copy all the CMIS properties to the document (if there is any)
+ ::rtl::OUString aCmisPropsValues( "CmisPropertiesValues" );
+ ::rtl::OUString aCmisPropsNames( "CmisPropertiesDisplayNames" );
+ uno::Reference< document::XCmisDocument > xCmisDoc( GetModel( ), uno::UNO_QUERY_THROW );
+ if ( xProps->hasPropertyByName( aCmisPropsValues ) )
+ {
+ beans::PropertyValues aCmisValues;
+ aContent.getPropertyValue( aCmisPropsValues ) >>= aCmisValues;
+ xCmisDoc->setCmisPropertiesValues( aCmisValues );
+
+ // TODO For CMIS case, try to look for cmis:isVersionSeriesCheckedOut
+ // If set to false, then show InfoBar to propose checkOut
+ }
+ if ( xProps->hasPropertyByName( aCmisPropsNames ) )
+ {
+ beans::PropertyValues aPropNames;
+ aContent.getPropertyValue( aCmisPropsNames ) >>= aPropNames;
+ xCmisDoc->setCmisPropertiesDisplayNames( aPropNames );
+ }
+
::rtl::OUString aAuthor( "Author" );
::rtl::OUString aKeywords( "Keywords" );
::rtl::OUString aSubject( "Subject" );
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index f7c5f30cbdfe..ea8fdfabf8f7 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -211,6 +211,8 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
css::uno::Reference< css::frame::XUntitledNumbers > m_xNumberedControllers;
uno::Reference< rdf::XDocumentMetadataAccess> m_xDocumentMetadata;
::rtl::Reference< ::sfx2::DocumentUndoManager > m_pDocumentUndoManager;
+ uno::Sequence< beans::PropertyValue> m_cmisPropertiesValues;
+ uno::Sequence< beans::PropertyValue> m_cmisPropertiesDisplayNames;
IMPL_SfxBaseModel_DataContainer( ::osl::Mutex& rMutex, SfxObjectShell* pObjectShell )
@@ -229,6 +231,8 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
, m_xNumberedControllers ()
, m_xDocumentMetadata () // lazy
, m_pDocumentUndoManager ()
+ , m_cmisPropertiesValues ()
+ , m_cmisPropertiesDisplayNames ()
{
// increase global instance counter.
++g_nInstanceCounter;
@@ -2514,6 +2518,30 @@ void SAL_CALL SfxBaseModel::notifyDocumentEvent( const ::rtl::OUString&, const u
throw lang::NoSupportException( ::rtl::OUString( "SfxBaseModel controlls all the sent notifications itself!" ), uno::Reference< uno::XInterface >() );
}
+uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getCmisPropertiesValues()
+ throw ( uno::RuntimeException )
+{
+ return m_pData->m_cmisPropertiesValues;
+}
+
+void SAL_CALL SfxBaseModel::setCmisPropertiesValues( const uno::Sequence< beans::PropertyValue >& _cmispropertiesvalues )
+ throw ( uno::RuntimeException )
+{
+ m_pData->m_cmisPropertiesValues = _cmispropertiesvalues;
+}
+
+uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getCmisPropertiesDisplayNames()
+ throw ( uno::RuntimeException )
+{
+ return m_pData->m_cmisPropertiesDisplayNames;
+}
+
+void SAL_CALL SfxBaseModel::setCmisPropertiesDisplayNames( const uno::Sequence< beans::PropertyValue >& _cmispropertiesdisplaynames )
+ throw ( uno::RuntimeException )
+{
+ m_pData->m_cmisPropertiesDisplayNames = _cmispropertiesdisplaynames;
+}
+
//________________________________________________________________________________________________________
// SfxListener
//________________________________________________________________________________________________________