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>
This commit is contained in:
Samuel Mehrbrodt 2014-08-29 00:35:07 +02:00 committed by Bosdonnat Cedric
parent d54b2bd8dc
commit c6270de939
20 changed files with 32 additions and 29 deletions

View file

@ -151,8 +151,10 @@
#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_PASSWD_MIN_LEN1 (RID_SFX_START+127)
#define STR_MODULENOTINSTALLED (RID_SFX_START+128)
#define BT_READONLY_EDIT (RID_SFX_START+127)
#define STR_READONLY_DOCUMENT (RID_SFX_START+128)
#define STR_PASSWD_MIN_LEN1 (RID_SFX_START+129)
#define STR_MODULENOTINSTALLED (RID_SFX_START+130)
#define STR_ACCTITLE_PRODUCTIVITYTOOLS (RID_SFX_START+157)
#define SFX_THUMBNAIL_TEXT (RID_SFX_START+158)

View file

@ -77,6 +77,7 @@ private:
protected:
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
DECL_LINK( SwitchReadOnlyHandler, void * );
SAL_DLLPRIVATE void KillDispatcher_Impl();
virtual ~SfxViewFrame();

View file

@ -26,8 +26,6 @@
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF"/>
<toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Print"/>

View file

@ -20,7 +20,6 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:SaveAs"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF"/>

View file

@ -26,8 +26,6 @@
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false" toolbar:helpid="5502"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:helpid="5331"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF" toolbar:helpid="6674"/>
<toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Print"/>

View file

@ -20,7 +20,6 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:SaveAs"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF"/>

View file

@ -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: */

View file

@ -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 )
{

View file

@ -26,8 +26,6 @@
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false" toolbar:helpid="5502"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:helpid="5331"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF" toolbar:helpid="6674"/>
<toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Print"/>

View file

@ -20,7 +20,6 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:SaveAs"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF"/>

View file

@ -26,8 +26,6 @@
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false" toolbar:helpid="5502"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:helpid="5331"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF" toolbar:helpid="6674"/>
<toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Print"/>

View file

@ -20,7 +20,6 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:SaveAs"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF"/>

View file

@ -26,8 +26,6 @@
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false" toolbar:helpid="5502"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:helpid="5331"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF" toolbar:helpid="6674"/>
<toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Print"/>

View file

@ -20,7 +20,6 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:SaveAs"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF"/>

View file

@ -26,8 +26,6 @@
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false" toolbar:helpid="5502"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:helpid="5331"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF" toolbar:helpid="6674"/>
<toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Print"/>

View file

@ -20,7 +20,6 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:SaveAs"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF"/>

View file

@ -26,8 +26,6 @@
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false" toolbar:helpid="5502"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:helpid="5331"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF" toolbar:helpid="6674"/>
<toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Print"/>

View file

@ -20,7 +20,6 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:SaveAs"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF"/>

View file

@ -26,8 +26,6 @@
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false" toolbar:helpid="5502"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:helpid="5331"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF" toolbar:helpid="6674"/>
<toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Print"/>

View file

@ -20,7 +20,6 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:SaveAs"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:EditDoc"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF"/>