diff options
author | Samuel Mehrbrodt <s.mehrbrodt@gmail.com> | 2014-08-29 00:35:07 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-02-06 16:40:44 +0100 |
commit | add80f5cce7d5d222b20e8c0237072a6a3601437 (patch) | |
tree | 7c97fa385b7a86662b4f56be2c8ed3f4ec2c24f0 /sfx2 | |
parent | 14afffdd80774efcf185a538b22e95ffcd85b117 (diff) |
fdo#80538 Show an infobar when document is in read-only mode
and remove the Edit icon from the toolbar
Reviewed-on: https://gerrit.libreoffice.org/11182
Reviewed-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
Tested-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
Conflicts:
include/sfx2/sfx.hrc
include/sfx2/viewfrm.hxx
Change-Id: I27d9506bd0fb76b3f1ad056a9866f7744674a3e2
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 eb2de4eb7525..806394196514 100644 --- a/sfx2/source/view/view.src +++ b/sfx2/source/view/view.src @@ -92,7 +92,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 @@ -101,5 +105,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 9cb15a0f1444..4014167e3b0d 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 ); } @@ -1250,7 +1251,6 @@ const SvBorder& SfxViewFrame::GetBorderPixelImpl void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - if( IsDowning_Impl()) return; @@ -1272,7 +1272,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(); @@ -1360,6 +1360,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; } @@ -1374,6 +1382,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 ) { |