diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk index c8069807dbf2..b1badf4defe9 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 6af6c060411a..1de34d7a3ad3 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -42,6 +42,7 @@ class SvxSearchItem; #include #include +#include #include #include #include "svl/lstner.hxx" @@ -50,6 +51,8 @@ class SvxSearchItem; #include #include +#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 8f348d2d38f7..be082689227a 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() ) ); }