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


On 14/11/11 17:17, Noel Power wrote:
ok, since let me try and help with this, I am trying to add the menu and some supporting code to tie that in, when I have it done I hope you can take the patch and look at dynamically displaying/undisplaying the linenumbers. Perhaps as a start you could assume the ComplexEditor will be constructed with no line numbers displayed ( e.g. the linenumberwindow should not be shown ) You could add a method void ComplexEditor::SetLineNumberDisplay( bool ) which would show/hide the linenumber windows and do/call whatever resizing magic that needs to happen. How does that sound?

Noel
The attached patch adds the menu item, there is a new method BasicIDEShell::SourceLinesDisplayed() that you could use in the ComplexEditor constructor to decide if linenumbers are shown are not ( no need now to assume they are not shown ). There is also some handling code 'commented out' when the 'View | Display Source Line Numbers ' menu option is selected. That commented out code will call ModuleWindow::SetLineNumberDisplay( bool ) You need of course to create that method and tunnel the call to the ComplexEditor::SetLineNumberDisplay() method.... or something similar.

hth,

Noel

p.s. if you manage to get line number to toggle nicely probably there is no need to put this in the feature branch be we could just commit it.
diff --git basctl/sdi/baside.sdi basctl/sdi/baside.sdi
index f40e239..d297663 100644
--- basctl/sdi/baside.sdi
+++ basctl/sdi/baside.sdi
@@ -39,6 +39,11 @@ shell BasicIDEShell
     // ========================================================
     // Current, je nach aktuellem Fenster:
     // ========================================================
+    SID_SHOWLINES
+    [
+        StateMethod = GetState;
+        ExecMethod  = ExecuteCurrent;
+    ]
     SID_BASICIDE_HIDECURPAGE
     [
         ExecMethod  = ExecuteCurrent;
index 6a5cd13..b8fe0f2 100644
--- basctl/source/basicide/basides1.cxx
+++ basctl/source/basicide/basides1.cxx
@@ -34,6 +34,7 @@
 #include <basic/sbx.hxx>
 #define _SVSTDARR_STRINGS
 #include <svl/svstdarr.hxx>
+#include <svl/visitem.hxx>
 #include <ide_pch.hxx>
 
 #define _SOLAR__PRIVATE 1
@@ -83,6 +84,19 @@ using namespace ::com::sun::star::frame;
 class SvxSearchItem;
 
 
+// until we have some configuration lets just keep
+// persist this value for the process lifetime
+bool& lcl_GetSourceLinesEnabledValue()
+{
+    static bool bSourceLinesEnabled(false);
+    return bSourceLinesEnabled;
+}
+
+bool  BasicIDEShell::SourceLinesDisplayed()
+{
+    return lcl_GetSourceLinesEnabledValue();
+}
+
 void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
 {
     if ( !pCurWin )
@@ -90,6 +104,20 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
 
     switch ( rReq.GetSlot() )
     {
+        case SID_SHOWLINES: 
+        {
+            SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), sal_False);
+            bool bValue = false;
+            if ( pItem )
+                bValue = pItem->GetValue();
+            lcl_GetSourceLinesEnabledValue() = bValue; 
+            if ( pCurWin && pCurWin->IsA( TYPE( ModulWindow ) ) )
+            {
+//                (ModuleWindow*)(pCurWin)->SetLineNumberDisplay( bValue );
+            }
+        }
+        break;
+
         case SID_BASICIDE_HIDECURPAGE:
         {
             pCurWin->StoreData();
@@ -779,6 +807,20 @@ void BasicIDEShell::GetState(SfxItemSet &rSet)
     {
         switch ( nWh )
         {
+            case SID_SHOWLINES: 
+            {
+                // if this is not a module window hide the 
+                // setting, doesn't make sense for example if the
+                // dialog editor is open
+                if( pCurWin && !pCurWin->IsA( TYPE( ModulWindow ) ) )
+                {
+                    rSet.DisableItem( nWh );
+                    rSet.Put(SfxVisibilityItem(nWh, sal_False));
+                }
+                else
+                    rSet.Put( SfxBoolItem( nWh, lcl_GetSourceLinesEnabledValue() ) );
+                break;
+            }
             case SID_DOCINFO:
             {
                 rSet.DisableItem( nWh );
diff --git basctl/source/inc/basidesh.hxx basctl/source/inc/basidesh.hxx
index 15fd8f27..9d66a6d 100644
--- basctl/source/inc/basidesh.hxx
+++ basctl/source/inc/basidesh.hxx
@@ -227,6 +227,7 @@ public:
 
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
                         GetCurrentDocument() const;
+    bool SourceLinesDisplayed();
 
 };
 
diff --git basctl/uiconfig/basicide/menubar/menubar.xml basctl/uiconfig/basicide/menubar/menubar.xml
index 4583ca2..fa99e98 100644
--- basctl/uiconfig/basicide/menubar/menubar.xml
+++ basctl/uiconfig/basicide/menubar/menubar.xml
@@ -48,6 +48,7 @@
             <menu:menuitem menu:id=".uno:AvailableToolbars"/>
             <menu:menuitem menu:id=".uno:StatusBarVisible"/>
             <menu:menuitem menu:id=".uno:ShowImeStatusWindow"/>
+            <menu:menuitem menu:id=".uno:ShowLines"/>
             <menu:menuseparator/>
             <menu:menuitem menu:id=".uno:FullScreen"/>
         </menu:menupopup>
diff --git officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu 
officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu
index 6750028..c6e7aa2 100644
--- officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu
+++ officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu
@@ -3,6 +3,11 @@
 <oor:component-data oor:name="BasicIDECommands" oor:package="org.openoffice.Office.UI" 
xmlns:oor="http://openoffice.org/2001/registry"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
     <node oor:name="UserInterface">
         <node oor:name="Commands">
+             <node oor:name=".uno:ShowLines" oor:op="replace">
+                 <prop oor:name="Label" oor:type="xs:string">
+                     <value xml:lang="en-US">Display Source Line Numbers</value>
+                 </prop>
+            </node>
         </node>
         <node oor:name="Popups">
         </node>
diff --git sfx2/inc/sfx2/sfxsids.hrc sfx2/inc/sfx2/sfxsids.hrc
index baf4b56..3a5e375 100755
--- sfx2/inc/sfx2/sfxsids.hrc
+++ sfx2/inc/sfx2/sfxsids.hrc
@@ -314,7 +314,8 @@
 #define SID_SUGGESTEDSAVEASNAME             (SID_SFX_START + 1721)
 #define SID_ENCRYPTIONDATA                  (SID_SFX_START + 1722)
 #define SID_PASSWORDINTERACTION             (SID_SFX_START + 1723)
-#define SID_SFX_free_START                  (SID_SFX_START + 1724)
+#define SID_SHOWLINES                       (SID_SFX_START + 1724)
+#define SID_SFX_free_START                  (SID_SFX_START + 1725)
 #define SID_SFX_free_END                    (SID_SFX_START + 3999)
 
 #define SID_OPEN_NEW_VIEW                   (SID_SFX_START + 520)
diff --git sfx2/sdi/sfx.sdi sfx2/sdi/sfx.sdi
index b5b432f..bd165e7 100755
--- sfx2/sdi/sfx.sdi
+++ sfx2/sdi/sfx.sdi
@@ -3593,6 +3593,30 @@ SfxBoolItem ReccomendReadonly SID_RECOMMENDREADONLY
     GroupId = ;
 ]
 
+//----------------------------------------------------FALSE
+SfxBoolItem ShowLines SID_SHOWLINES
+
+[
+    /* flags: */
+    AutoUpdate = TRUE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = TRUE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Synchron;
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_MACRO;
+]
 
 //--------------------------------------------------------------------------
 SfxVoidItem RunMacro SID_RUNMACRO

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.