summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--offapi/com/sun/star/document/XCmisDocument.idl4
-rw-r--r--sfx2/inc/sfx2/sfxbasemodel.hxx2
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx26
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx2
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx16
5 files changed, 49 insertions, 1 deletions
diff --git a/offapi/com/sun/star/document/XCmisDocument.idl b/offapi/com/sun/star/document/XCmisDocument.idl
index 82ac4ff8e4a9..c456808071d9 100644
--- a/offapi/com/sun/star/document/XCmisDocument.idl
+++ b/offapi/com/sun/star/document/XCmisDocument.idl
@@ -24,6 +24,10 @@ interface XCmisDocument : com::sun::star::uno::XInterface
*/
void checkOut( );
+ /** Tells whether a document can support versioning or not.
+ */
+ boolean isVersionable( );
+
/** Contains the properties values named after their CMIS ID.
*/
[attribute] com::sun::star::beans::PropertyValues CmisPropertiesValues;
diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx
index 7a3b4a592281..3cabf59a7933 100644
--- a/sfx2/inc/sfx2/sfxbasemodel.hxx
+++ b/sfx2/inc/sfx2/sfxbasemodel.hxx
@@ -1423,6 +1423,8 @@ public:
virtual void SAL_CALL checkOut( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL isVersionable( ) throw ( ::com::sun::star::uno::RuntimeException );
+
//____________________________________________________________________________________________________
// SfxListener
//____________________________________________________________________________________________________
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 9c3786f532a1..cc2abe9ec95d 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -2577,6 +2577,32 @@ void SAL_CALL SfxBaseModel::checkOut( ) throw ( uno::RuntimeException )
}
}
+sal_Bool SAL_CALL SfxBaseModel::isVersionable( ) throw ( uno::RuntimeException )
+{
+ sal_Bool bVersionable = sal_False;
+ SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
+ if ( pMedium )
+ {
+ try
+ {
+ ::ucbhelper::Content aContent( pMedium->GetName( ),
+ uno::Reference<ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext() );
+ com::sun::star::uno::Reference < beans::XPropertySetInfo > xProps = aContent.getProperties();
+ ::rtl::OUString aIsVersionableProp( "IsVersionable" );
+ if ( xProps->hasPropertyByName( aIsVersionableProp ) )
+ {
+ aContent.getPropertyValue( aIsVersionableProp ) >>= bVersionable;
+ }
+ }
+ catch ( const uno::Exception & e )
+ {
+ throw uno::RuntimeException( e.Message, e.Context );
+ }
+ }
+ return bVersionable;
+}
+
void SfxBaseModel::loadCmisProperties( )
{
SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index 9fb52af07f6b..26e5ee54481b 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -1442,7 +1442,7 @@ void SfxBaseController::ShowInfoBars( )
REFERENCE< document::XCmisDocument > xCmisDoc( m_pData->m_pViewShell->GetObjectShell()->GetModel(), uno::UNO_QUERY );
beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( );
- if ( aCmisProperties.hasElements( ) )
+ if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
{
// Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut
bool bFoundCheckedout = false;
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index a2d8f4a2eb41..966576bec254 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -544,6 +544,19 @@ namespace cmis
xRow->appendVoid( rProp );
}
}
+ else if ( rProp.Name == "IsVersionable" )
+ {
+ try
+ {
+ libcmis::ObjectPtr object = getObject( xEnv );
+ sal_Bool bIsVersionable = object->getTypeDescription( )->isVersionable( );
+ xRow->appendBoolean( rProp, bIsVersionable );
+ }
+ catch ( const libcmis::Exception& )
+ {
+ xRow->appendVoid( rProp );
+ }
+ }
else
SAL_INFO( "cmisucp", "Looking for unsupported property " << rProp.Name );
}
@@ -975,6 +988,9 @@ namespace cmis
beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CmisPropertiesDisplayNames" ) ),
-1, getCppuType( static_cast< const beans::PropertyValues * >( 0 ) ),
beans::PropertyAttribute::BOUND ),
+ beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVersionable" ) ),
+ -1, getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
};
const int nProps = SAL_N_ELEMENTS(aGenericProperties);