[Libreoffice-commits] .: 7 commits - basctl/Library_basctl.mk basctl/sdi basctl/source basctl/uiconfig officecfg/registry sfx2/inc sfx2/sdi
Norbert Thiebaud
nthiebaud at kemper.freedesktop.org
Thu Nov 17 16:41:31 PST 2011
basctl/Library_basctl.mk | 1
basctl/sdi/baside.sdi | 5
basctl/source/basicide/baside2.cxx | 5
basctl/source/basicide/baside2.hxx | 11 +
basctl/source/basicide/baside2b.cxx | 100 ++++++----
basctl/source/basicide/basides1.cxx | 41 ++++
basctl/source/basicide/linenumberwindow.cxx | 94 +++++++++
basctl/source/basicide/linenumberwindow.hxx | 32 +++
basctl/source/inc/basidesh.hxx | 1
basctl/uiconfig/basicide/menubar/menubar.xml | 1
officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu | 6
sfx2/inc/sfx2/sfxsids.hrc | 3
sfx2/sdi/sfx.sdi | 24 ++
13 files changed, 290 insertions(+), 34 deletions(-)
New commits:
commit ae78e3e913f39e2cc6d2b6f83f38c2ea225ab53e
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Thu Nov 17 18:38:37 2011 -0600
fix issue with unsupported typedef on Mac
diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx
index deba85d..fb7bed6 100644
--- a/basctl/source/basicide/linenumberwindow.cxx
+++ b/basctl/source/basicide/linenumberwindow.cxx
@@ -30,12 +30,12 @@ void LineNumberWindow::Paint( const Rectangle& )
GetParent()->Resize();
- ulong windowHeight = GetOutputSize().Height();
- ulong nLineHeight = GetTextHeight();
+ int windowHeight = GetOutputSize().Height();
+ int nLineHeight = GetTextHeight();
- ulong startY = txtView->GetStartDocPos().Y();
- ulong nStartLine = startY / nLineHeight + 1;
- ulong nEndLine = (startY + windowHeight) / nLineHeight + 1;
+ int startY = txtView->GetStartDocPos().Y();
+ int nStartLine = startY / nLineHeight + 1;
+ int nEndLine = (startY + windowHeight) / nLineHeight + 1;
if(txtEngine->GetParagraphCount() + 1 < nEndLine)
nEndLine = txtEngine->GetParagraphCount() + 1;
@@ -43,7 +43,7 @@ void LineNumberWindow::Paint( const Rectangle& )
nWidth = String::CreateFromInt64(nEndLine).Len() * 10;
sal_Int64 y = (nStartLine - 1) * nLineHeight;
- for(ulong i = nStartLine; i <= nEndLine; ++i, y += nLineHeight)
+ for(int i = nStartLine; i <= nEndLine; ++i, y += nLineHeight)
DrawText(Point(0, y - nCurYOffset), String::CreateFromInt64(i));
}
@@ -88,7 +88,7 @@ bool LineNumberWindow::SyncYOffset()
return true;
}
-ulong LineNumberWindow::GetWidth()
+int LineNumberWindow::GetWidth()
{
return (nWidth < 20 ? 20 : nWidth);
}
diff --git a/basctl/source/basicide/linenumberwindow.hxx b/basctl/source/basicide/linenumberwindow.hxx
index fd30171..b94fae9 100644
--- a/basctl/source/basicide/linenumberwindow.hxx
+++ b/basctl/source/basicide/linenumberwindow.hxx
@@ -9,7 +9,7 @@ class LineNumberWindow : public Window
{
private:
ModulWindow* pModulWindow;
- ulong nWidth;
+ int nWidth;
long nCurYOffset;
virtual void DataChanged(DataChangedEvent const & rDCEvt);
@@ -26,7 +26,7 @@ public:
bool SyncYOffset();
long& GetCurYOffset();
- ulong GetWidth();
+ int GetWidth();
};
#endif // BASICIDE_LINENUMBERWINDOW_HXX
commit cc09ce22e9404e7aa6c8b27dbe675a447a95eb05
Author: August Sodora <augsod at gmail.com>
Date: Thu Nov 17 00:42:15 2011 -0500
Removed unused includes
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index a80e9e4..1fb174a 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -29,44 +29,38 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basctl.hxx"
-#include <vector>
#define _BASIC_TEXTPORTIONS
-#include <basic/sbdef.hxx>
-#include <ide_pch.hxx>
+#include "helpid.hrc"
+#include "baside2.hrc"
-#include <tools/urlobj.hxx>
-#include <unotools/charclass.hxx>
-#include <svl/urihelper.hxx>
-#include <basic/sbx.hxx>
+#include "baside2.hxx"
+#include "basobj.hxx"
+#include "brkdlg.hxx"
+#include "iderdll.hxx"
+#include "iderdll2.hxx"
+#include "objdlg.hxx"
+
+#include <basic/sbmeth.hxx>
+#include <basic/sbuno.hxx>
+#include <com/sun/star/script/XLibraryContainer2.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <vcl/msgbox.hxx>
#include <vcl/sound.hxx>
+#include <svl/urihelper.hxx>
#include <svtools/xtextedt.hxx>
#include <svtools/txtattr.hxx>
#include <svtools/textwindowpeer.hxx>
-#include <basic/sbuno.hxx>
-
-#include <helpid.hrc>
-#include <baside2.hrc>
-#include <baside2.hxx>
-#include <brkdlg.hxx>
-#include <objdlg.hxx>
-#include <basobj.hxx>
-#include <iderdll.hxx>
-#include <iderdll2.hxx>
#include <vcl/taskpanelist.hxx>
#include <vcl/help.hxx>
-
#include <unotools/sourceviewconfig.hxx>
-#include <com/sun/star/script/XLibraryContainer2.hpp>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/string.hxx>
-
-
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-
long nVirtToolBoxHeight; // inited in WatchWindow, used in Stackwindow
long nHeaderBarHeight;
commit d27db6c53415a7ccea9cb7bfa97be10995874fcf
Author: August Sodora <augsod at gmail.com>
Date: Thu Nov 17 00:19:47 2011 -0500
Fixed scrolling bug
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 2a4d8ce..a80e9e4 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -333,6 +333,7 @@ void EditorWindow::Resize()
pEditView->SetStartDocPos( aStartDocPos );
pEditView->ShowCursor();
pModulWindow->GetBreakPointWindow().GetCurYOffset() = aStartDocPos.Y();
+ pModulWindow->GetLineNumberWindow().GetCurYOffset() = aStartDocPos.Y();
}
InitScrollBars();
if ( nVisY != pEditView->GetStartDocPos().Y() )
@@ -574,6 +575,7 @@ void EditorWindow::CreateEditEngine()
pEditView->SetStartDocPos( Point( 0, 0 ) );
pEditView->SetSelection( TextSelection() );
pModulWindow->GetBreakPointWindow().GetCurYOffset() = 0;
+ pModulWindow->GetLineNumberWindow().GetCurYOffset() = 0;
pEditEngine->SetUpdateMode( sal_True );
Update(); // has only been invalidated at UpdateMode = sal_True
@@ -661,7 +663,9 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
pModulWindow->GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() );
pModulWindow->GetBreakPointWindow().DoScroll
( 0, pModulWindow->GetBreakPointWindow().GetCurYOffset() - pEditView->GetStartDocPos().Y() );
- pModulWindow->GetLineNumberWindow().Invalidate();
+ pModulWindow->GetLineNumberWindow().DoScroll
+ ( 0, pModulWindow->GetLineNumberWindow().GetCurYOffset() - pEditView->GetStartDocPos().Y() );
+ pModulWindow->Invalidate();
}
else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED )
{
@@ -1681,6 +1685,7 @@ IMPL_LINK( ComplexEditorWindow, ScrollHdl, ScrollBar *, pCurScrollBar )
long nDiff = aEdtWindow.GetEditView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos();
aEdtWindow.GetEditView()->Scroll( 0, nDiff );
aBrkWindow.DoScroll( 0, nDiff );
+ aLineNumberWindow.DoScroll(0, nDiff);
aEdtWindow.GetEditView()->ShowCursor( sal_False, sal_True );
pCurScrollBar->SetThumbPos( aEdtWindow.GetEditView()->GetStartDocPos().Y() );
}
diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx
index 5168da1..deba85d 100644
--- a/basctl/source/basicide/linenumberwindow.cxx
+++ b/basctl/source/basicide/linenumberwindow.cxx
@@ -7,7 +7,8 @@
LineNumberWindow::LineNumberWindow( Window* pParent, ModulWindow* pModulWin ) :
Window( pParent, WB_BORDER ),
pModulWindow(pModulWin),
- nWidth(1)
+ nWidth(1),
+ nCurYOffset(0)
{
SetBackground(Wallpaper(GetSettings().GetStyleSettings().GetFieldColor()));
}
@@ -16,6 +17,9 @@ LineNumberWindow::~LineNumberWindow() { }
void LineNumberWindow::Paint( const Rectangle& )
{
+ if(SyncYOffset())
+ return;
+
ExtTextEngine* txtEngine = pModulWindow->GetEditEngine();
if(!txtEngine)
return;
@@ -27,9 +31,9 @@ void LineNumberWindow::Paint( const Rectangle& )
GetParent()->Resize();
ulong windowHeight = GetOutputSize().Height();
- ulong startY = txtView->GetStartDocPos().Y();
ulong nLineHeight = GetTextHeight();
+ ulong startY = txtView->GetStartDocPos().Y();
ulong nStartLine = startY / nLineHeight + 1;
ulong nEndLine = (startY + windowHeight) / nLineHeight + 1;
@@ -38,8 +42,9 @@ void LineNumberWindow::Paint( const Rectangle& )
nWidth = String::CreateFromInt64(nEndLine).Len() * 10;
- for(ulong i = nStartLine, y = 0; i < nEndLine; ++i, y += nLineHeight)
- DrawText(Point(0, y), String::CreateFromInt64(i));
+ sal_Int64 y = (nStartLine - 1) * nLineHeight;
+ for(ulong i = nStartLine; i <= nEndLine; ++i, y += nLineHeight)
+ DrawText(Point(0, y - nCurYOffset), String::CreateFromInt64(i));
}
void LineNumberWindow::DataChanged(DataChangedEvent const & rDCEvt)
@@ -56,3 +61,34 @@ void LineNumberWindow::DataChanged(DataChangedEvent const & rDCEvt)
}
}
}
+
+void LineNumberWindow::DoScroll(long nHorzScroll, long nVertScroll)
+{
+ nCurYOffset -= nVertScroll;
+ Window::Scroll(nHorzScroll, nVertScroll);
+}
+
+long& LineNumberWindow::GetCurYOffset()
+{
+ return nCurYOffset;
+}
+
+bool LineNumberWindow::SyncYOffset()
+{
+ TextView* pView = pModulWindow->GetEditView();
+ if (!pView)
+ return false;
+
+ long nViewYOffset = pView->GetStartDocPos().Y();
+ if (nCurYOffset == nViewYOffset)
+ return false;
+
+ nCurYOffset = nViewYOffset;
+ Invalidate();
+ return true;
+}
+
+ulong LineNumberWindow::GetWidth()
+{
+ return (nWidth < 20 ? 20 : nWidth);
+}
diff --git a/basctl/source/basicide/linenumberwindow.hxx b/basctl/source/basicide/linenumberwindow.hxx
index 885ea14..fd30171 100644
--- a/basctl/source/basicide/linenumberwindow.hxx
+++ b/basctl/source/basicide/linenumberwindow.hxx
@@ -10,6 +10,7 @@ class LineNumberWindow : public Window
private:
ModulWindow* pModulWindow;
ulong nWidth;
+ long nCurYOffset;
virtual void DataChanged(DataChangedEvent const & rDCEvt);
@@ -20,7 +21,12 @@ public:
LineNumberWindow( Window* pParent, ModulWindow* pModulWin );
~LineNumberWindow();
- ulong GetWidth() { return (nWidth < 20 ? 20 : nWidth); }
+ void DoScroll( long nHorzScroll, long nVertScroll );
+
+ bool SyncYOffset();
+ long& GetCurYOffset();
+
+ ulong GetWidth();
};
#endif // BASICIDE_LINENUMBERWINDOW_HXX
commit a1deac6043ffdc5fba454f92c42e46de0943f7f7
Author: August Sodora <augsod at gmail.com>
Date: Wed Nov 16 16:45:38 2011 -0500
Finished making it possible to toggle line numbers in the basic ide
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 98e1b74..e449ba9 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -1401,6 +1401,11 @@ sal_Bool ModulWindow::IsReadOnly()
return bReadOnly;
}
+void ModulWindow::SetLineNumberDisplay(bool b)
+{
+ aXEditorWindow.SetLineNumberDisplay(b);
+}
+
sal_Bool ModulWindow::IsPasteAllowed()
{
sal_Bool bPaste = sal_False;
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 1de34d7..48a65c9 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -290,6 +290,7 @@ private:
LineNumberWindow aLineNumberWindow;
EditorWindow aEdtWindow;
ScrollBar aEWVScrollBar;
+ bool bLineNumberDisplay;
virtual void DataChanged(DataChangedEvent const & rDCEvt);
@@ -304,6 +305,8 @@ public:
LineNumberWindow& GetLineNumberWindow() { return aLineNumberWindow; }
EditorWindow& GetEdtWindow() { return aEdtWindow; }
ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; }
+
+ void SetLineNumberDisplay(bool b);
};
@@ -365,6 +368,8 @@ public:
virtual void SetReadOnly( sal_Bool bReadOnly );
virtual sal_Bool IsReadOnly();
+ void SetLineNumberDisplay(bool);
+
StarBASIC* GetBasic() { XModule(); return xBasic; }
SbModule* GetSbModule() { return xModule; }
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index be08268..2a4d8ce 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1630,13 +1630,13 @@ ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
aBrkWindow( this ),
aLineNumberWindow( this, pParent ),
aEdtWindow( this ),
- aEWVScrollBar( this, WB_VSCROLL | WB_DRAG )
+ aEWVScrollBar( this, WB_VSCROLL | WB_DRAG ),
+ bLineNumberDisplay(false)
{
aEdtWindow.SetModulWindow( pParent );
aBrkWindow.SetModulWindow( pParent );
aEdtWindow.Show();
aBrkWindow.Show();
- aLineNumberWindow.Show();
aEWVScrollBar.SetLineSize( SCROLL_LINE );
aEWVScrollBar.SetPageSize( SCROLL_PAGE );
@@ -1659,8 +1659,16 @@ void ComplexEditorWindow::Resize()
Size aLnSz(aLineNumberWindow.GetWidth(), aSz.Height());
aLineNumberWindow.SetPosSizePixel(Point(DWBORDER+aBrkSz.Width() - 1, DWBORDER), aLnSz);
- Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow.GetWidth() - nSBWidth + 2, aSz.Height());
- aEdtWindow.SetPosSizePixel( Point( DWBORDER+aBrkSz.Width()+aLnSz.Width()-1, DWBORDER ), aEWSz );
+ if(bLineNumberDisplay)
+ {
+ Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow.GetWidth() - nSBWidth + 2, aSz.Height());
+ aEdtWindow.SetPosSizePixel( Point( DWBORDER+aBrkSz.Width()+aLnSz.Width()-1, DWBORDER ), aEWSz );
+ }
+ else
+ {
+ Size aEWSz(aSz.Width() - nBrkWidth - nSBWidth + 1, aSz.Height());
+ aEdtWindow.SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aEWSz);
+ }
aEWVScrollBar.SetPosSizePixel( Point( aOutSz.Width()-DWBORDER-nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) );
}
@@ -1696,6 +1704,20 @@ void ComplexEditorWindow::DataChanged(DataChangedEvent const & rDCEvt)
}
}
+void ComplexEditorWindow::SetLineNumberDisplay(bool b)
+{
+ if(b == bLineNumberDisplay)
+ return;
+
+ if(b)
+ aLineNumberWindow.Show();
+ else
+ aLineNumberWindow.Hide();
+
+ bLineNumberDisplay = b;
+ Resize();
+}
+
uno::Reference< awt::XWindowPeer >
EditorWindow::GetComponentInterface(sal_Bool bCreate)
{
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index d7caa95..68eaaa4 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -114,7 +114,7 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
lcl_GetSourceLinesEnabledValue() = bValue;
if ( pCurWin && pCurWin->IsA( TYPE( ModulWindow ) ) )
{
-// (ModuleWindow*)(pCurWin)->SetLineNumberDisplay( bValue );
+ dynamic_cast<ModulWindow*>(pCurWin)->SetLineNumberDisplay( bValue );
}
}
break;
commit a4074e34039b0e570a3aa08cdffde1562892df17
Author: August Sodora <augsod at gmail.com>
Date: Wed Nov 16 14:50:26 2011 -0500
Preparing to add option for line numbers in the basic ide
diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi
index 37b2f08..11a97fe 100644
--- a/basctl/sdi/baside.sdi
+++ b/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;
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 234fad7..d7caa95 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -85,6 +85,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 )
@@ -92,6 +105,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();
@@ -797,6 +824,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 a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index 15fd8f2..9d66a6d 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/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 a/basctl/uiconfig/basicide/menubar/menubar.xml b/basctl/uiconfig/basicide/menubar/menubar.xml
index d9174bf..24322b8 100644
--- a/basctl/uiconfig/basicide/menubar/menubar.xml
+++ b/basctl/uiconfig/basicide/menubar/menubar.xml
@@ -49,6 +49,7 @@
<menu:menuitem menu:id=".uno:StatusBarVisible"/>
<menu:menuitem menu:id=".uno:ShowImeStatusWindow"/>
<menu:menuitem menu:id=".uno:GotoLine"/>
+ <menu:menuitem menu:id=".uno:ShowLines"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:FullScreen"/>
</menu:menupopup>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu
index e512d3c..c711808 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu
@@ -8,6 +8,12 @@
<value xml:lang="en-US">Goto Line Number...</value>
</prop>
</node>
+ <node oor:name=".uno:ShowLines" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Display Source Line Number...</value>
+ </prop>
+ </node>
+
</node>
<node oor:name="Popups">
</node>
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index 568b21b..da4c57b 100755
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -315,7 +315,8 @@
#define SID_ENCRYPTIONDATA (SID_SFX_START + 1722)
#define SID_PASSWORDINTERACTION (SID_SFX_START + 1723)
#define SID_GOTOLINE (SID_SFX_START + 1724)
-#define SID_SFX_free_START (SID_SFX_START + 1725)
+#define SID_SHOWLINES (SID_SFX_START + 1725)
+#define SID_SFX_free_START (SID_SFX_START + 1726)
#define SID_SFX_free_END (SID_SFX_START + 3999)
#define SID_OPEN_NEW_VIEW (SID_SFX_START + 520)
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index b73f17a..47577ea 100755
--- a/sfx2/sdi/sfx.sdi
+++ b/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
commit deb6bcf8d91a14767ed4cd6c377e1ffe6b6a9521
Author: August Sodora <augsod at gmail.com>
Date: Wed Nov 16 14:48:49 2011 -0500
Added missing files
diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx
new file mode 100644
index 0000000..5168da1
--- /dev/null
+++ b/basctl/source/basicide/linenumberwindow.cxx
@@ -0,0 +1,58 @@
+#include "baside2.hxx"
+#include "linenumberwindow.hxx"
+
+#include <svtools/xtextedt.hxx>
+#include <svtools/textview.hxx>
+
+LineNumberWindow::LineNumberWindow( Window* pParent, ModulWindow* pModulWin ) :
+ Window( pParent, WB_BORDER ),
+ pModulWindow(pModulWin),
+ nWidth(1)
+{
+ SetBackground(Wallpaper(GetSettings().GetStyleSettings().GetFieldColor()));
+}
+
+LineNumberWindow::~LineNumberWindow() { }
+
+void LineNumberWindow::Paint( const Rectangle& )
+{
+ ExtTextEngine* txtEngine = pModulWindow->GetEditEngine();
+ if(!txtEngine)
+ return;
+
+ TextView* txtView = pModulWindow->GetEditView();
+ if(!txtView)
+ return;
+
+ GetParent()->Resize();
+
+ ulong windowHeight = GetOutputSize().Height();
+ ulong startY = txtView->GetStartDocPos().Y();
+ ulong nLineHeight = GetTextHeight();
+
+ ulong nStartLine = startY / nLineHeight + 1;
+ ulong nEndLine = (startY + windowHeight) / nLineHeight + 1;
+
+ if(txtEngine->GetParagraphCount() + 1 < nEndLine)
+ nEndLine = txtEngine->GetParagraphCount() + 1;
+
+ nWidth = String::CreateFromInt64(nEndLine).Len() * 10;
+
+ for(ulong i = nStartLine, y = 0; i < nEndLine; ++i, y += nLineHeight)
+ DrawText(Point(0, y), String::CreateFromInt64(i));
+}
+
+void LineNumberWindow::DataChanged(DataChangedEvent const & rDCEvt)
+{
+ Window::DataChanged(rDCEvt);
+ if (rDCEvt.GetType() == DATACHANGED_SETTINGS
+ && (rDCEvt.GetFlags() & SETTINGS_STYLE) != 0)
+ {
+ Color aColor(GetSettings().GetStyleSettings().GetFieldColor());
+ if (aColor != rDCEvt.GetOldSettings()->GetStyleSettings().GetFieldColor())
+ {
+ SetBackground(Wallpaper(aColor));
+ Invalidate();
+ }
+ }
+}
diff --git a/basctl/source/basicide/linenumberwindow.hxx b/basctl/source/basicide/linenumberwindow.hxx
new file mode 100644
index 0000000..885ea14
--- /dev/null
+++ b/basctl/source/basicide/linenumberwindow.hxx
@@ -0,0 +1,26 @@
+#ifndef BASICIDE_LINENUMBERWINDOW_HXX
+#define BASICIDE_LINENUMBERWINDOW_HXX
+
+#include <vcl/window.hxx>
+
+class ModulWindow;
+
+class LineNumberWindow : public Window
+{
+private:
+ ModulWindow* pModulWindow;
+ ulong nWidth;
+
+ virtual void DataChanged(DataChangedEvent const & rDCEvt);
+
+protected:
+ virtual void Paint( const Rectangle& );
+
+public:
+ LineNumberWindow( Window* pParent, ModulWindow* pModulWin );
+ ~LineNumberWindow();
+
+ ulong GetWidth() { return (nWidth < 20 ? 20 : nWidth); }
+};
+
+#endif // BASICIDE_LINENUMBERWINDOW_HXX
commit 291bd1f0bfd0d7639e4a211a6e3d267403ddc44c
Author: August Sodora <augsod at gmail.com>
Date: Fri Nov 11 14:22:11 2011 -0500
Add line numbers to basic ide
diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk
index c806980..b1badf4 100644
--- a/basctl/Library_basctl.mk
+++ b/basctl/Library_basctl.mk
@@ -94,6 +94,7 @@ $(eval $(call gb_Library_add_exception_objects,basctl,\
basctl/source/basicide/docsignature \
basctl/source/basicide/documentenumeration \
basctl/source/basicide/iderdll \
+ basctl/source/basicide/linenumberwindow \
basctl/source/basicide/localizationmgr \
basctl/source/basicide/macrodlg \
basctl/source/basicide/moduldl2 \
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 6af6c06..1de34d7 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -42,6 +42,7 @@ class SvxSearchItem;
#include <svtools/headbar.hxx>
#include <vcl/button.hxx>
+#include <basic/sbstar.hxx>
#include <basic/sbmod.hxx>
#include <vcl/split.hxx>
#include "svl/lstner.hxx"
@@ -50,6 +51,8 @@ class SvxSearchItem;
#include <sfx2/progress.hxx>
#include <svtools/syntaxhighlight.hxx>
+#include "linenumberwindow.hxx"
+
DBG_NAMEEX( ModulWindow )
#define MARKER_NOMARKER 0xFFFF
@@ -284,6 +287,7 @@ class ComplexEditorWindow : public Window
{
private:
BreakPointWindow aBrkWindow;
+ LineNumberWindow aLineNumberWindow;
EditorWindow aEdtWindow;
ScrollBar aEWVScrollBar;
@@ -297,6 +301,7 @@ public:
ComplexEditorWindow( ModulWindow* pParent );
BreakPointWindow& GetBrkWindow() { return aBrkWindow; }
+ LineNumberWindow& GetLineNumberWindow() { return aLineNumberWindow; }
EditorWindow& GetEdtWindow() { return aEdtWindow; }
ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; }
};
@@ -402,6 +407,7 @@ public:
EditorWindow& GetEditorWindow() { return aXEditorWindow.GetEdtWindow(); }
BreakPointWindow& GetBreakPointWindow() { return aXEditorWindow.GetBrkWindow(); }
+ LineNumberWindow& GetLineNumberWindow() { return aXEditorWindow.GetLineNumberWindow(); }
ScrollBar& GetEditVScrollBar() { return aXEditorWindow.GetEWVScrollBar(); }
ExtTextEngine* GetEditEngine() { return GetEditorWindow().GetEditEngine(); }
ExtTextView* GetEditView() { return GetEditorWindow().GetEditView(); }
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 8f348d2..be08268 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -580,6 +580,7 @@ void EditorWindow::CreateEditEngine()
pModulWindow->GetLayout()->GetWatchWindow().Update();
pModulWindow->GetLayout()->GetStackWindow().Update();
pModulWindow->GetBreakPointWindow().Update();
+ pModulWindow->GetLineNumberWindow().Update();
pEditView->ShowCursor( sal_True, sal_True );
@@ -660,6 +661,7 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
pModulWindow->GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() );
pModulWindow->GetBreakPointWindow().DoScroll
( 0, pModulWindow->GetBreakPointWindow().GetCurYOffset() - pEditView->GetStartDocPos().Y() );
+ pModulWindow->GetLineNumberWindow().Invalidate();
}
else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED )
{
@@ -669,6 +671,8 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
long nTextHeight = pEditEngine->GetTextHeight();
if ( nTextHeight < nOutHeight )
pEditView->Scroll( 0, pEditView->GetStartDocPos().Y() );
+
+ pModulWindow->GetLineNumberWindow().Invalidate();
}
SetScrollBarRanges();
@@ -792,7 +796,10 @@ void EditorWindow::ImplSetFont()
aFont = GetFont();
if ( pModulWindow )
+ {
pModulWindow->GetBreakPointWindow().SetFont( aFont );
+ pModulWindow->GetLineNumberWindow().SetFont( aFont );
+ }
if ( pEditEngine )
{
@@ -873,6 +880,7 @@ void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, sal_Bool bInserted
{
pModulWindow->GetBreakPoints().reset();
pModulWindow->GetBreakPointWindow().Invalidate();
+ pModulWindow->GetLineNumberWindow().Invalidate();
aHighlighter.initialize( HIGHLIGHT_BASIC );
}
else
@@ -886,6 +894,11 @@ void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, sal_Bool bInserted
aInvRec.Top() = nY;
pModulWindow->GetBreakPointWindow().Invalidate( aInvRec );
+ Size aLnSz(pModulWindow->GetLineNumberWindow().GetWidth(),
+ GetOutputSizePixel().Height() - 2 * DWBORDER);
+ pModulWindow->GetLineNumberWindow().SetPosSizePixel(Point(DWBORDER + 19, DWBORDER), aLnSz);
+ pModulWindow->GetLineNumberWindow().Invalidate();
+
if ( bDoSyntaxHighlight )
{
String aDummy;
@@ -1612,12 +1625,10 @@ void StackWindow::UpdateCalls()
aTreeListBox.SetUpdateMode( sal_True );
}
-
-
-
ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
Window( pParent, WB_3DLOOK | WB_CLIPCHILDREN ),
aBrkWindow( this ),
+ aLineNumberWindow( this, pParent ),
aEdtWindow( this ),
aEWVScrollBar( this, WB_VSCROLL | WB_DRAG )
{
@@ -1625,6 +1636,7 @@ ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
aBrkWindow.SetModulWindow( pParent );
aEdtWindow.Show();
aBrkWindow.Show();
+ aLineNumberWindow.Show();
aEWVScrollBar.SetLineSize( SCROLL_LINE );
aEWVScrollBar.SetPageSize( SCROLL_PAGE );
@@ -1632,8 +1644,6 @@ ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
aEWVScrollBar.Show();
}
-
-
void ComplexEditorWindow::Resize()
{
Size aOutSz = GetOutputSizePixel();
@@ -1643,11 +1653,14 @@ void ComplexEditorWindow::Resize()
long nBrkWidth = 20;
long nSBWidth = aEWVScrollBar.GetSizePixel().Width();
- Size aBrkSz( Size( nBrkWidth, aSz.Height() ) );
+ Size aBrkSz(nBrkWidth, aSz.Height());
aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
- Size aEWSz( Size( aSz.Width() - nBrkWidth - nSBWidth + 2, aSz.Height() ) );
- aEdtWindow.SetPosSizePixel( Point( DWBORDER+aBrkSz.Width()-1, DWBORDER ), aEWSz );
+ Size aLnSz(aLineNumberWindow.GetWidth(), aSz.Height());
+ aLineNumberWindow.SetPosSizePixel(Point(DWBORDER+aBrkSz.Width() - 1, DWBORDER), aLnSz);
+
+ Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow.GetWidth() - nSBWidth + 2, aSz.Height());
+ aEdtWindow.SetPosSizePixel( Point( DWBORDER+aBrkSz.Width()+aLnSz.Width()-1, DWBORDER ), aEWSz );
aEWVScrollBar.SetPosSizePixel( Point( aOutSz.Width()-DWBORDER-nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) );
}
More information about the Libreoffice-commits
mailing list