diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-10-18 00:08:31 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-10-31 12:03:29 +0100 |
commit | 793ea6fe90209dbf2b659a44a302306a05888011 (patch) | |
tree | 82381f3b8283f8c5d0c8da72e5b238e6b087766f /sfx2/source | |
parent | bb93b038a70ef7a810b6b9d447856ed77c590e40 (diff) |
CMIS: don't show up checkout info bar if the document is not versionable
Change-Id: I7761e0b06e151822a63a7273a4e61d5cdc648311
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 26 | ||||
-rw-r--r-- | sfx2/source/view/sfxbasecontroller.cxx | 2 |
2 files changed, 27 insertions, 1 deletions
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; |