Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index


Hi,

I'm working on fdo#80538 <https://bugs.freedesktop.org/show_bug.cgi?id=80538> (adding an infobar when document is in read-only mode). With the attached patch the infobar is shown when you enable the non-edit mode via toolbar, but I can't get the button to leave read-only mode in there.

Can someone give me a hint what's wrong with my code?

Thanks
Samuel
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index d29222f..3947c75 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -196,6 +196,7 @@ private:
     DECL_LINK( SimpleRefAborted, OUString* );
     DECL_LINK( SimpleRefChange, OUString* );
     DECL_LINK( FormControlActivated, void* );
+    DECL_LINK( ReadOnlyHandler, void * );
 
 protected:
     virtual void    Activate(bool bMDI) SAL_OVERRIDE;
diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx
index 53223c4..79be98f 100644
--- a/sc/source/ui/view/tabvwsh5.cxx
+++ b/sc/source/ui/view/tabvwsh5.cxx
@@ -38,6 +38,7 @@
 #include "editsh.hxx"
 #include "hints.hxx"
 #include "cellvalue.hxx"
+#include "scresid.hxx"
 #include <svl/sharedstring.hxx>
 
 void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
@@ -116,6 +117,16 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                                                 &aItem, 0L );
 
                     UpdateInputContext();
+                    if (bReadOnly) {
+                        std::vector< PushButton* > aButtons;
+                        PushButton* pBtn = new PushButton( &GetViewFrame()->GetWindow(), 
ScResId(SCSTR_PAGEBREAKSHELL));
+                        pBtn->SetClickHdl( LINK( this, ScTabViewShell, ReadOnlyHandler ) );
+                        aButtons.push_back( pBtn );
+                        GetViewFrame()->AppendInfoBar("readonly", 
ScGlobal::GetRscString(STR_READONLYERR), aButtons);
+                    }
+                    else {
+                        GetViewFrame()->RemoveInfoBar("readonly");
+                    }
                 }
                 break;
 
@@ -304,6 +315,14 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
     SfxViewShell::Notify( rBC, rHint );
 }
 
+
+
+IMPL_LINK_NOARG ( ScTabViewShell, ReadOnlyHandler )
+{
+    return 0;
+}
+
+
 SvxNumberInfoItem* ScTabViewShell::MakeNumberInfoItem( ScDocument* pDoc, ScViewData* pViewData )
 {
 

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.