From 4fd449b1ca4dce9f1425fc035291651bfc510a3e Mon Sep 17 00:00:00 2001 From: Cao Cuong Ngo Date: Fri, 27 Sep 2013 21:42:14 +0200 Subject: Google Drive files don't need Checkout bar. Plus, the Name property has been changed to Id, that was the reason the Checkin bar disappeared. Change-Id: I03f6ef4e1399c0f8b2a347ca8acd8a42daffa497 --- sfx2/source/doc/objserv.cxx | 24 ++++++++++++++++-------- sfx2/source/view/sfxbasecontroller.cxx | 19 ++++++++++++------- 2 files changed, 28 insertions(+), 15 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index fc4076961672..3a2ce2e7eb20 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -947,17 +947,22 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) ) { // Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut - bool bFoundCheckedout = false; + bool bIsGoogleFile = false; sal_Bool bCheckedOut = sal_False; - for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i ) + for ( sal_Int32 i = 0; i < aCmisProperties.getLength(); ++i ) { - if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" ) + if ( aCmisProperties[i].Id == "cmis:isVersionSeriesCheckedOut" ) { - bFoundCheckedout = true; - aCmisProperties[i].Value >>= bCheckedOut; + uno::Sequence< sal_Bool > bTmp; + aCmisProperties[i].Value >>= bTmp; + bCheckedOut = bTmp[0]; } + // using title to know if it's a Google Drive file + // maybe there's a safer way. + if ( aCmisProperties[i].Name == "title" ) + bIsGoogleFile = true; } - bShow = !bCheckedOut; + bShow = !bCheckedOut && !bIsGoogleFile; } if ( !bShow ) @@ -982,10 +987,13 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) sal_Bool bCheckedOut = sal_False; for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i ) { - if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" ) + if ( aCmisProperties[i].Id == "cmis:isVersionSeriesCheckedOut" ) { bFoundCheckedout = true; - aCmisProperties[i].Value >>= bCheckedOut; + uno::Sequence< sal_Bool > bTmp; + aCmisProperties[i].Value >>= bTmp; + bCheckedOut = bTmp[0]; + } } bShow = bCheckedOut; diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 5ebbf71ac902..a119281a43af 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1434,18 +1434,23 @@ void SfxBaseController::ShowInfoBars( ) if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) ) { // Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut - bool bFoundCheckedout = false; + // and find if it is a Google Drive file. + bool bIsGoogleFile = false; sal_Bool bCheckedOut = sal_False; - for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i ) + for ( sal_Int32 i = 0; i < aCmisProperties.getLength(); ++i ) { - if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" ) - { - bFoundCheckedout = true; - aCmisProperties[i].Value >>= bCheckedOut; + if ( aCmisProperties[i].Id == "cmis:isVersionSeriesCheckedOut" ) { + uno::Sequence< sal_Bool > bTmp; + aCmisProperties[i].Value >>= bTmp; + bCheckedOut = bTmp[0]; } + // if it is a Google Drive file, we don't need the checkout bar, + // still need the checkout feature for the version dialog. + if ( aCmisProperties[i].Name == "title" ) + bIsGoogleFile = true; } - if ( !bCheckedOut ) + if ( !bCheckedOut && !bIsGoogleFile ) { // Get the Frame and show the InfoBar if not checked out SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame(); -- cgit