summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/inc/sfx2/sfx.hrc2
-rw-r--r--sfx2/inc/sfx2/sfxbasecontroller.hxx1
-rw-r--r--sfx2/source/doc/objstor.cxx3
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx41
-rw-r--r--sfx2/source/view/view.src12
-rw-r--r--sfx2/source/view/viewfrm.cxx5
6 files changed, 60 insertions, 4 deletions
diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc
index 7971b85ed241..cd1ecdc05d15 100644
--- a/sfx2/inc/sfx2/sfx.hrc
+++ b/sfx2/inc/sfx2/sfx.hrc
@@ -172,6 +172,8 @@
#define STR_PASSWD (RID_SFX_START+122)
#define STR_PASSWD_EMPTY (RID_SFX_START+123)
#define STR_PASSWD_MIN_LEN (RID_SFX_START+124)
+#define STR_NONCHECKEDOUT_DOCUMENT (RID_SFX_START+125)
+#define BT_CHECKOUT (RID_SFX_START+126)
#define STR_ACCTITLE_PRODUCTIVITYTOOLS (RID_SFX_START+157)
//=========================================================================
diff --git a/sfx2/inc/sfx2/sfxbasecontroller.hxx b/sfx2/inc/sfx2/sfxbasecontroller.hxx
index aa142f3c69f9..cf265300a1bd 100644
--- a/sfx2/inc/sfx2/sfxbasecontroller.hxx
+++ b/sfx2/inc/sfx2/sfxbasecontroller.hxx
@@ -383,6 +383,7 @@ private:
};
SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect );
SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const;
+ SAL_DLLPRIVATE void ShowInfoBars( );
//________________________________________________________________________________________________________
// private variables
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index ec6b25236f86..fa4116b565c0 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -754,9 +754,6 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
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 ) )
{
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index 33cc346acab4..89ead633f11b 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/util/XCloseBroadcaster.hpp>
#include <com/sun/star/util/XCloseListener.hpp>
#include <com/sun/star/util/CloseVetoException.hpp>
+#include <com/sun/star/document/XCmisDocument.hpp>
#include <com/sun/star/document/XViewDataSupplier.hpp>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -58,6 +59,8 @@
#include <sfx2/unoctitm.hxx>
#include <sfx2/childwin.hxx>
#include <sfx2/sfxsids.hrc>
+#include <sfx2/sfx.hrc>
+#include <sfx2/sfxresid.hxx>
#include <workwin.hxx>
#include <sfx2/objface.hxx>
@@ -581,6 +584,7 @@ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame
if ( m_pData->m_pViewShell )
{
ConnectSfxFrame_Impl( E_CONNECT );
+ ShowInfoBars( );
// attaching the frame to the controller is the last step in the creation of a new view, so notify this
SfxViewEventHint aHint( SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), m_pData->m_pViewShell->GetObjectShell(), uno::Reference< frame::XController2 >( this ) );
@@ -1428,6 +1432,43 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect )
pViewFrame->GetBindings().Invalidate( nViewNo + SID_VIEWSHELL0 );
}
+void SfxBaseController::ShowInfoBars( )
+{
+ if ( m_pData->m_pViewShell )
+ {
+ // CMIS verifications
+ REFERENCE< document::XCmisDocument > xCmisDoc( m_pData->m_pViewShell->GetObjectShell()->GetModel(), uno::UNO_QUERY );
+ beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( );
+
+ if ( aCmisProperties.hasElements( ) )
+ {
+ // 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 )
+ {
+ 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 ) );
+ // TODO Set the handler
+ aButtons.push_back( pBtn );
+ pViewFrame->AppendInfoBar( SfxResId( STR_NONCHECKEDOUT_DOCUMENT ), aButtons );
+ }
+ }
+ }
+}
+
+
//=============================================================================
css::uno::Reference< css::frame::XTitle > SfxBaseController::impl_getTitleHelper ()
{
diff --git a/sfx2/source/view/view.src b/sfx2/source/view/view.src
index a4fa3110ac72..cc2ebbb13143 100644
--- a/sfx2/source/view/view.src
+++ b/sfx2/source/view/view.src
@@ -161,3 +161,15 @@ String STR_REPAIREDDOCUMENT
{
Text [ en-US ] = " (repaired document)" ;
};
+
+String STR_NONCHECKEDOUT_DOCUMENT
+{
+ Text [ en-US ] = "Document is not checked out on server" ;
+};
+
+PushButton BT_CHECKOUT
+{
+ Pos = MAP_APPFONT( 0 , 0 );
+ Size = MAP_APPFONT( 30 , 0 );
+ Text[ en-US ] = "Check out";
+};
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index ad8dfc729128..9d459c6daedf 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -3353,7 +3353,10 @@ void SfxViewFrame::ActivateToolPanel_Impl( const ::rtl::OUString& i_rPanelURL )
void SfxViewFrame::AppendInfoBar( const rtl::OUString& sMessage, std::vector< PushButton* > aButtons )
{
const sal_uInt16 nId = SfxInfoBarContainerChild::GetChildWindowId();
- ShowChildWindow( nId );
+
+ // Make sure the InfoBar container is visible
+ if ( !HasChildWindow( nId ) )
+ ToggleChildWindow( nId );
SfxChildWindow* pChild = GetChildWindow( nId );
SfxInfoBarContainerWindow* pInfoBars = ( SfxInfoBarContainerWindow* )pChild->GetWindow();
pInfoBars->appendInfoBar( sMessage, aButtons );