diff options
author | Samuel Mehrbrodt <s.mehrbrodt@gmail.com> | 2014-08-29 00:35:07 +0200 |
---|---|---|
committer | Bosdonnat Cedric <cedric.bosdonnat@free.fr> | 2014-08-29 03:42:38 -0500 |
commit | c6270de939d5ee51b61dc4ac02c52f1d9b5b1e47 (patch) | |
tree | c725d5d85b3bd93ecf1d5632bb69d3a33f5bf593 /sfx2 | |
parent | d54b2bd8dcc393bb168386a5c0ec4ce40bb3c6d4 (diff) |
fdo#80538 Show an infobar when document is in read-only mode
and remove the Edit icon from the toolbar
Change-Id: I27d9506bd0fb76b3f1ad056a9866f7744674a3e2
Reviewed-on: https://gerrit.libreoffice.org/11182
Reviewed-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
Tested-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/view.src | 12 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 18 |
2 files changed, 27 insertions, 3 deletions
diff --git a/sfx2/source/view/view.src b/sfx2/source/view/view.src index c4213fc2bbdb..85472fe00d7f 100644 --- a/sfx2/source/view/view.src +++ b/sfx2/source/view/view.src @@ -84,7 +84,11 @@ String STR_REPAIREDDOCUMENT String STR_NONCHECKEDOUT_DOCUMENT { - Text [ en-US ] = "Document is not checked out on server" ; + Text [ en-US ] = "This document is not checked out on the server." ; +}; +String STR_READONLY_DOCUMENT +{ + Text [ en-US ] = "This document is opened in read-only mode." ; }; PushButton BT_CHECKOUT @@ -93,5 +97,11 @@ PushButton BT_CHECKOUT Size = MAP_APPFONT( 30 , 0 ); Text[ en-US ] = "Check out"; }; +PushButton BT_READONLY_EDIT +{ + Pos = MAP_APPFONT( 0 , 0 ); + Size = MAP_APPFONT( 70 , 0 ); + Text[ en-US ] = "Edit document"; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index a01e9162f2ae..efef8f4106ff 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -416,6 +416,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) return; } + RemoveInfoBar("readonly"); pSh->SetReadOnlyUI( false ); } @@ -1246,7 +1247,6 @@ const SvBorder& SfxViewFrame::GetBorderPixelImpl void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - if( IsDowning_Impl()) return; @@ -1268,7 +1268,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) SfxDispatcher *pDispat = GetDispatcher(); bool bWasReadOnly = pDispat->GetReadOnly_Impl(); bool bIsReadOnly = xObjSh->IsReadOnly(); - if ( !bWasReadOnly != !bIsReadOnly ) + if ( bWasReadOnly != bIsReadOnly ) { // Then also TITLE_CHANGED UpdateTitle(); @@ -1356,6 +1356,14 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) // because each document has its own SfxBindings. //GetDispatcher()->GetBindings()->InvalidateAll(true); } + else + { + std::vector< PushButton* > aButtons; + PushButton* pBtn = new PushButton( &GetWindow(), SfxResId(BT_READONLY_EDIT)); + pBtn->SetClickHdl(LINK(this, SfxViewFrame, SwitchReadOnlyHandler)); + aButtons.push_back( pBtn ); + AppendInfoBar("readonly", SfxResId(STR_READONLY_DOCUMENT), aButtons); + } break; } @@ -1370,6 +1378,12 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } } +IMPL_LINK_NOARG(SfxViewFrame, SwitchReadOnlyHandler) +{ + GetDispatcher()->Execute(SID_EDITDOC); + return 0; +} + void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) { |