summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx30
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx43
2 files changed, 40 insertions, 33 deletions
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 46f0bee4debd..163929e826d4 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -2683,23 +2683,27 @@ void SAL_CALL SfxBaseModel::checkIn( sal_Bool bIsMajor, const rtl::OUString& rMe
sal_Bool SfxBaseModel::getBoolPropertyValue( const rtl::OUString& rName ) throw ( uno::RuntimeException )
{
sal_Bool bValue = sal_False;
- SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
- if ( pMedium )
+ if ( m_pData->m_pObjectShell )
{
- try
+ SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
+ if ( pMedium )
{
- ::ucbhelper::Content aContent( pMedium->GetName( ),
- uno::Reference<ucb::XCommandEnvironment>(),
- comphelper::getProcessComponentContext() );
- com::sun::star::uno::Reference < beans::XPropertySetInfo > xProps = aContent.getProperties();
- if ( xProps->hasPropertyByName( rName ) )
+ try
{
- aContent.getPropertyValue( rName ) >>= bValue;
+ ::ucbhelper::Content aContent( pMedium->GetName( ),
+ uno::Reference<ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext() );
+ com::sun::star::uno::Reference < beans::XPropertySetInfo > xProps = aContent.getProperties();
+ if ( xProps->hasPropertyByName( rName ) )
+ {
+ aContent.getPropertyValue( rName ) >>= bValue;
+ }
+ }
+ catch ( const uno::Exception & )
+ {
+ // Simply ignore it: it's likely the document isn't versionable in that case
+ bValue = sal_False;
}
- }
- catch ( const uno::Exception & e )
- {
- throw uno::RuntimeException( e.Message, e.Context );
}
}
return bValue;
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index 81638ff2076b..dee5ea764914 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -1440,31 +1440,34 @@ void SfxBaseController::ShowInfoBars( )
{
// CMIS verifications
REFERENCE< document::XCmisDocument > xCmisDoc( m_pData->m_pViewShell->GetObjectShell()->GetModel(), uno::UNO_QUERY );
- beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( );
-
- if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
+ if ( xCmisDoc.is( ) )
{
- // Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut
- bool bFoundCheckedout = false;
- sal_Bool bCheckedOut = sal_False;
- for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i )
+ beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( );
+
+ if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
{
- if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" )
+ // Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut
+ bool bFoundCheckedout = false;
+ sal_Bool bCheckedOut = sal_False;
+ for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i )
{
- bFoundCheckedout = true;
- aCmisProperties[i].Value >>= bCheckedOut;
+ if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" )
+ {
+ bFoundCheckedout = true;
+ aCmisProperties[i].Value >>= bCheckedOut;
+ }
}
- }
- if ( !bCheckedOut )
- {
- // Get the Frame and show the InfoBar if not checked out
- SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame();
- std::vector< PushButton* > aButtons;
- PushButton* pBtn = new PushButton( &pViewFrame->GetWindow(), SfxResId( BT_CHECKOUT ) );
- pBtn->SetClickHdl( LINK( this, SfxBaseController, CheckOutHandler ) );
- aButtons.push_back( pBtn );
- pViewFrame->AppendInfoBar( "checkout", SfxResId( STR_NONCHECKEDOUT_DOCUMENT ), aButtons );
+ if ( !bCheckedOut )
+ {
+ // Get the Frame and show the InfoBar if not checked out
+ SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame();
+ std::vector< PushButton* > aButtons;
+ PushButton* pBtn = new PushButton( &pViewFrame->GetWindow(), SfxResId( BT_CHECKOUT ) );
+ pBtn->SetClickHdl( LINK( this, SfxBaseController, CheckOutHandler ) );
+ aButtons.push_back( pBtn );
+ pViewFrame->AppendInfoBar( "checkout", SfxResId( STR_NONCHECKEDOUT_DOCUMENT ), aButtons );
+ }
}
}
}