[Libreoffice-commits] .: 2 commits - basctl/Library_basctl.mk basctl/source
Noel Power
noelp at kemper.freedesktop.org
Fri Aug 17 05:18:29 PDT 2012
basctl/Library_basctl.mk | 1
basctl/source/accessibility/accessibledialogcontrolshape.cxx | 2
basctl/source/accessibility/accessibledialogwindow.cxx | 2
basctl/source/basicide/baside2.cxx | 620 ++++-------
basctl/source/basicide/baside2.hxx | 177 +--
basctl/source/basicide/baside2b.cxx | 342 +++---
basctl/source/basicide/baside3.cxx | 114 +-
basctl/source/basicide/basides1.cxx | 454 ++------
basctl/source/basicide/basides2.cxx | 62 -
basctl/source/basicide/basides3.cxx | 34
basctl/source/basicide/basidesh.cxx | 80 -
basctl/source/basicide/basobj2.cxx | 9
basctl/source/basicide/basobj3.cxx | 20
basctl/source/basicide/bastype2.hxx | 14
basctl/source/basicide/bastypes.cxx | 248 +++-
basctl/source/basicide/layout.cxx | 341 ++++++
basctl/source/basicide/layout.hxx | 122 ++
basctl/source/basicide/linenumberwindow.cxx | 6
basctl/source/basicide/linenumberwindow.hxx | 9
basctl/source/basicide/localizationmgr.cxx | 20
basctl/source/basicide/objdlg.cxx | 8
basctl/source/basicide/objdlg.hxx | 8
basctl/source/inc/accessibledialogcontrolshape.hxx | 9
basctl/source/inc/accessibledialogwindow.hxx | 9
basctl/source/inc/baside3.hxx | 54
basctl/source/inc/basidesh.hxx | 65 -
basctl/source/inc/bastypes.hxx | 101 +
27 files changed, 1712 insertions(+), 1219 deletions(-)
New commits:
commit e03553ab7515b60851dfca2c16a2fcae7a49f441
Author: Noel Power <noel.power at suse.com>
Date: Fri Aug 17 13:10:45 2012 +0100
followup changes to 44861f2435a0c487d4fb5b196f7e4fe7f9569396
a) got rid of defaulted params in virtual base class methods
b) made some no-op virtual methods in the base class pure thus making the base
class abstract
c) made LayoutManager no longer inherit utl::ConfigurationListener as it wasn't
actually listening or acting on any configuration changes
Change-Id: Iab1783f6b5a35b130287a2aedbd1dc8413793182
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index fbda06a..95201da 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -691,7 +691,7 @@ long ModulWindow::BasicErrorHdl( StarBASIC * pBasic )
aErrorTextPrefixBuf.append(IDE_RESSTR(RID_STR_RUNTIMEERROR));
aErrorTextPrefixBuf.append(StarBASIC::GetVBErrorCode(pBasic->GetErrorCode()));
aErrorTextPrefixBuf.append(' ');
- rLayout.UpdateDebug();
+ rLayout.UpdateDebug(false);
}
::rtl::OUString aErrorTextPrefix(aErrorTextPrefixBuf.makeStringAndClear());
// if other basic, the IDE should try to display the correct module
@@ -739,7 +739,7 @@ long ModulWindow::BasicBreakHdl( StarBASIC* pBasic )
GetEditView()->SetSelection( TextSelection( TextPaM( nErrorLine, 0 ), TextPaM( nErrorLine, 0 ) ) );
aXEditorWindow.GetBrkWindow().SetMarkerPos( nErrorLine );
- rLayout.UpdateDebug();
+ rLayout.UpdateDebug(false);
aStatus.bIsInReschedule = true;
aStatus.bIsRunning = true;
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index e1e6392..0319dd2 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -435,7 +435,7 @@ public:
virtual void Activating (IDEBaseWindow&);
virtual void Deactivating ();
virtual void GetState (SfxItemSet&, unsigned nWhich);
- virtual void UpdateDebug (bool bBasicStopped = false);
+ virtual void UpdateDebug (bool bBasicStopped);
public:
void BasicAddWatch (String const&);
void BasicRemoveWatch ();
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 841c4bc..233e01c 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -699,8 +699,6 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
break;
default:
- if (pLayout)
- pLayout->ExecuteGlobal(rReq);
if (pCurWin)
pCurWin->ExecuteGlobal(rReq);
break;
diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx
index 7fd33d7..684a26b 100644
--- a/basctl/source/basicide/layout.cxx
+++ b/basctl/source/basicide/layout.cxx
@@ -108,17 +108,6 @@ void Layout::Deactivating ()
pChild = 0;
}
-void Layout::ExecuteGlobal (SfxRequest&)
-{ }
-
-void Layout::GetState (SfxItemSet&, unsigned /*nWhich*/)
-{ }
-
-void Layout::UpdateDebug (bool bBasicStopped)
-{
- static_cast<void>(bBasicStopped);
-}
-
// virtual
void Layout::DataChanged (DataChangedEvent const& rDCEvt)
{
@@ -145,16 +134,6 @@ void Layout::DataChanged (DataChangedEvent const& rDCEvt)
}
}
-// virtual
-void Layout::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 )
-{ }
-
-// This virtual function is called the first time when the Layout has nonzero size.
-// The overrider can initialize the docking windows.
-void Layout::OnFirstSize (int, int)
-{ }
-
-
//
// SplittedSide
// ============
diff --git a/basctl/source/basicide/layout.hxx b/basctl/source/basicide/layout.hxx
index eca1b98..2f733f8 100644
--- a/basctl/source/basicide/layout.hxx
+++ b/basctl/source/basicide/layout.hxx
@@ -40,7 +40,7 @@ namespace basctl
// Layout -- the common base of ModulLayout and DialogLayout.
// Handles the splitting lines and the dockable windows.
//
-class Layout: public Window, public utl::ConfigurationListener
+class Layout: public Window
{
public:
void DockaWindow (DockingWindow*);
@@ -48,9 +48,8 @@ public:
virtual void Activating (IDEBaseWindow&);
virtual void Deactivating ();
- virtual void ExecuteGlobal (SfxRequest&);
- virtual void GetState (SfxItemSet&, unsigned nWhich);
- virtual void UpdateDebug (bool bBasicStopped = false);
+ virtual void GetState (SfxItemSet&, unsigned nWhich) = 0;
+ virtual void UpdateDebug (bool bBasicStopped ) = 0;
protected:
Layout (Window* pParent);
@@ -63,10 +62,8 @@ protected:
// Window:
virtual void Resize ();
virtual void DataChanged (DataChangedEvent const& rDCEvt);
- // ConfigurationListener:
- virtual void ConfigurationChanged (utl::ConfigurationBroadcaster*, sal_uInt32);
// new:
- virtual void OnFirstSize (int nWidth, int nHeight);
+ virtual void OnFirstSize (int nWidth, int nHeight) = 0;
private:
// the main child window (either ModulWindow or DialogWindow)
diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx
index f54e9ad..dda678b 100644
--- a/basctl/source/inc/baside3.hxx
+++ b/basctl/source/inc/baside3.hxx
@@ -127,7 +127,7 @@ public:
virtual void Activating (IDEBaseWindow&);
virtual void Deactivating ();
virtual void GetState (SfxItemSet&, unsigned nWhich);
-
+ virtual void UpdateDebug (bool){};
protected:
// Layout:
virtual void OnFirstSize (int nWidth, int nHeight);
commit 44861f2435a0c487d4fb5b196f7e4fe7f9569396
Author: Uray M. János <uray.janos at gmail.com>
Date: Fri Aug 17 07:29:20 2012 +0200
Object Catalog in Dialog Editor
Change-Id: Ia74faa1452a4200c28fbd7c63130700df0a70b24
Object Catalog in Dialog Editor
Change-Id: I97f2e0497b0e87cf630bba16dd98f9f7d0bb86e7
diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk
index c2d23f6..3e7db4c 100644
--- a/basctl/Library_basctl.mk
+++ b/basctl/Library_basctl.mk
@@ -88,6 +88,7 @@ $(eval $(call gb_Library_add_exception_objects,basctl,\
basctl/source/basicide/docsignature \
basctl/source/basicide/documentenumeration \
basctl/source/basicide/iderdll \
+ basctl/source/basicide/layout \
basctl/source/basicide/linenumberwindow \
basctl/source/basicide/localizationmgr \
basctl/source/basicide/macrodlg \
diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx
index 4b8f05d..ccfd4af 100644
--- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx
+++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx
@@ -45,7 +45,7 @@ using namespace ::comphelper;
// class AccessibleDialogControlShape
// -----------------------------------------------------------------------------
-AccessibleDialogControlShape::AccessibleDialogControlShape( DialogWindow* pDialogWindow, DlgEdObj* pDlgEdObj )
+AccessibleDialogControlShape::AccessibleDialogControlShape (basctl::DialogWindow* pDialogWindow, DlgEdObj* pDlgEdObj)
:AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() )
,m_pDialogWindow( pDialogWindow )
,m_pDlgEdObj( pDlgEdObj )
diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx
index 4621e7e..a36c5b2 100644
--- a/basctl/source/accessibility/accessibledialogwindow.cxx
+++ b/basctl/source/accessibility/accessibledialogwindow.cxx
@@ -105,7 +105,7 @@ bool AccessibleDialogWindow::ChildDescriptor::operator<( const ChildDescriptor&
// class AccessibleDialogWindow
// -----------------------------------------------------------------------------
-AccessibleDialogWindow::AccessibleDialogWindow( DialogWindow* pDialogWindow )
+AccessibleDialogWindow::AccessibleDialogWindow (basctl::DialogWindow* pDialogWindow)
:AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() )
,m_pDialogWindow( pDialogWindow )
{
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 3d2bfd8..fbda06a 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -22,7 +22,10 @@
#include "iderdll.hxx"
#include "iderdll2.hxx"
#include "objdlg.hxx"
+#include "moduldlg.hxx"
+#include "docsignature.hxx"
+#include "helpid.hrc"
#include "baside2.hrc"
#include <basic/basmgr.hxx>
@@ -41,13 +44,15 @@
#include <sfx2/request.hxx>
#include <svl/aeitem.hxx>
#include <svl/srchitem.hxx>
+#include <svl/visitem.hxx>
#include <svl/whiter.hxx>
#include <vcl/xtextedt.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/msgbox.hxx>
+#include <cassert>
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
+namespace basctl
+{
#define LMARGPRN 1700
#define RMARGPRN 900
@@ -74,6 +79,9 @@ DBG_NAME( ModulWindow )
TYPEINIT1( ModulWindow , IDEBaseWindow );
+namespace
+{
+
void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage, const ::rtl::OUString& rTitle, bool bOutput )
{
short nLeftMargin = LMARGPRN;
@@ -160,17 +168,31 @@ void lcl_ConvertTabsToSpaces( String& rLine )
}
}
-ModulWindow::ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDocument, ::rtl::OUString aLibName,
- ::rtl::OUString aName, ::rtl::OUString& aModule )
- :IDEBaseWindow( pParent, rDocument, aLibName, aName )
- ,aXEditorWindow( this )
- ,m_aModule( aModule )
+// until we have some configuration lets just keep
+// persist this value for the process lifetime
+bool bSourceLinesEnabled = false;
+
+} // namespace
+
+
+//
+// ModulWindow
+// ===========
+//
+
+ModulWindow::ModulWindow (
+ ModulWindowLayout* pParent,
+ ScriptDocument const& rDocument,
+ rtl::OUString aLibName, rtl::OUString aName, rtl::OUString& aModule
+) :
+ IDEBaseWindow(pParent, rDocument, aLibName, aName),
+ rLayout(*pParent),
+ nValid(VALIDWINDOW),
+ aXEditorWindow(this),
+ m_aModule(aModule)
{
DBG_CTOR( ModulWindow, 0 );
- nValid = VALIDWINDOW;
- pLayout = pParent;
aXEditorWindow.Show();
-
SetBackground();
}
@@ -514,8 +536,13 @@ bool ModulWindow::SaveBasicSource()
return bDone;
}
+} // namespace basctl
+
bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName );
+namespace basctl
+{
+
bool ModulWindow::ImportDialog()
{
const ScriptDocument& rDocument = GetDocument();
@@ -664,7 +691,7 @@ long ModulWindow::BasicErrorHdl( StarBASIC * pBasic )
aErrorTextPrefixBuf.append(IDE_RESSTR(RID_STR_RUNTIMEERROR));
aErrorTextPrefixBuf.append(StarBASIC::GetVBErrorCode(pBasic->GetErrorCode()));
aErrorTextPrefixBuf.append(' ');
- pLayout->GetStackWindow().UpdateCalls();
+ rLayout.UpdateDebug();
}
::rtl::OUString aErrorTextPrefix(aErrorTextPrefixBuf.makeStringAndClear());
// if other basic, the IDE should try to display the correct module
@@ -712,8 +739,7 @@ long ModulWindow::BasicBreakHdl( StarBASIC* pBasic )
GetEditView()->SetSelection( TextSelection( TextPaM( nErrorLine, 0 ), TextPaM( nErrorLine, 0 ) ) );
aXEditorWindow.GetBrkWindow().SetMarkerPos( nErrorLine );
- pLayout->GetWatchWindow().UpdateWatches();
- pLayout->GetStackWindow().UpdateCalls();
+ rLayout.UpdateDebug();
aStatus.bIsInReschedule = true;
aStatus.bIsRunning = true;
@@ -755,24 +781,13 @@ void ModulWindow::BasicAddWatch()
if ( bAdd )
{
TextSelection aSel = GetEditView()->GetSelection();
- if ( aSel.GetStart().GetPara() == aSel.GetEnd().GetPara() )
- {
- aWatchStr = GetEditView()->GetSelected();
- pLayout->GetWatchWindow().AddWatch( aWatchStr );
- pLayout->GetWatchWindow().UpdateWatches();
- }
+ if ( aSel.GetStart().GetPara() == aSel.GetEnd().GetPara() ) // single line selection
+ rLayout.BasicAddWatch(GetEditView()->GetSelected());
}
}
-void ModulWindow::BasicRemoveWatch()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- pLayout->GetWatchWindow().RemoveSelectedWatch();
-}
-
-
void ModulWindow::EditMacro( const String& rMacroName )
{
DBG_CHKTHIS( ModulWindow, 0 );
@@ -941,12 +956,11 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
}
-void ModulWindow::ExecuteCommand( SfxRequest& rReq )
+void ModulWindow::ExecuteCommand (SfxRequest& rReq)
{
DBG_CHKTHIS( ModulWindow, 0 );
AssertValidEditEngine();
- sal_uInt16 nSlot = rReq.GetSlot();
- switch ( nSlot )
+ switch (rReq.GetSlot())
{
case SID_DELETE:
{
@@ -1024,7 +1038,7 @@ void ModulWindow::ExecuteCommand( SfxRequest& rReq )
break;
case SID_BASICIDE_REMOVEWATCH:
{
- BasicRemoveWatch();
+ rLayout.BasicRemoveWatch();
}
break;
case SID_CUT:
@@ -1032,8 +1046,7 @@ void ModulWindow::ExecuteCommand( SfxRequest& rReq )
if ( !IsReadOnly() )
{
GetEditView()->Cut();
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
+ if (SfxBindings* pBindings = BasicIDE::GetBindingsPtr())
pBindings->Invalidate( SID_DOC_MODIFIED );
}
}
@@ -1048,8 +1061,7 @@ void ModulWindow::ExecuteCommand( SfxRequest& rReq )
if ( !IsReadOnly() )
{
GetEditView()->Paste();
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
+ if (SfxBindings* pBindings = BasicIDE::GetBindingsPtr())
pBindings->Invalidate( SID_DOC_MODIFIED );
}
}
@@ -1059,6 +1071,52 @@ void ModulWindow::ExecuteCommand( SfxRequest& rReq )
GetBreakPointWindow().Invalidate();
}
break;
+ case SID_SHOWLINES:
+ {
+ SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), false);
+ bSourceLinesEnabled = pItem && pItem->GetValue();
+ aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled);
+ }
+ break;
+ case SID_BASICIDE_DELETECURRENT:
+ {
+ if (QueryDelModule(m_aName, this))
+ if (m_aDocument.removeModule(m_aLibName, m_aName))
+ BasicIDE::MarkDocumentModified(m_aDocument);
+ }
+ break;
+ case FID_SEARCH_OFF:
+ GrabFocus();
+ break;
+ case SID_GOTOLINE:
+ {
+ GotoLineDialog aGotoDlg(this);
+ if (aGotoDlg.Execute())
+ if (sal_Int32 const nLine = aGotoDlg.GetLineNumber())
+ {
+ TextSelection const aSel(TextPaM(nLine - 1, 0), TextPaM(nLine - 1, 0));
+ GetEditView()->SetSelection(aSel);
+ }
+ break;
+ }
+ }
+}
+
+void ModulWindow::ExecuteGlobal (SfxRequest& rReq)
+{
+ switch (rReq.GetSlot())
+ {
+ case SID_SIGNATURE:
+ {
+ basctl::DocumentSignature aSignature(m_aDocument);
+ if (aSignature.supportsSignatures())
+ {
+ aSignature.signScriptingContent();
+ if (SfxBindings* pBindings = BasicIDE::GetBindingsPtr())
+ pBindings->Invalidate(SID_SIGNATURE);
+ }
+ }
+ break;
}
}
@@ -1124,6 +1182,11 @@ void ModulWindow::GetState( SfxItemSet &rSet )
}
}
break;
+ case SID_SHOWLINES:
+ {
+ rSet.Put(SfxBoolItem(nWh, bSourceLinesEnabled));
+ break;
+ }
}
}
}
@@ -1191,25 +1254,30 @@ void ModulWindow::ShowCursor( bool bOn )
}
-Window* ModulWindow::GetLayoutWindow()
-{
- return pLayout;
-}
-
void ModulWindow::AssertValidEditEngine()
{
if ( !GetEditEngine() )
GetEditorWindow().CreateEditEngine();
}
+void ModulWindow::Activating ()
+{
+ aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled);
+ Show();
+}
+
void ModulWindow::Deactivating()
{
+ Hide();
if ( GetEditView() )
GetEditView()->EraseVirtualDevice();
}
sal_uInt16 ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem, bool bFromStart )
{
+ if (IsSuspended())
+ return 0;
+
// one could also relinquish syntaxhighlighting/formatting instead of the stupid replace-everything...
AssertValidEditEngine();
ExtTextView* pView = GetEditView();
@@ -1354,11 +1422,6 @@ void ModulWindow::SetLineNumberDisplay(bool b)
aXEditorWindow.SetLineNumberDisplay(b);
}
-void ModulWindow::SetObjectCatalogDisplay(bool b)
-{
- aXEditorWindow.SetObjectCatalogDisplay(b);
-}
-
bool ModulWindow::IsPasteAllowed()
{
bool bPaste = false;
@@ -1383,374 +1446,207 @@ bool ModulWindow::IsPasteAllowed()
return bPaste;
}
-ModulWindowLayout::ModulWindowLayout( Window* pParent ) :
- Window(pParent, WB_CLIPCHILDREN),
- bFirstArrange(true),
- aLeftSplit(this, WB_HSCROLL),
- aBottomSplit(this, WB_VSCROLL),
- aVertSplit(this, WB_HSCROLL),
- aObjectCatalog(this),
- aWatchWindow(this),
- aStackWindow(this),
- m_pModulWindow(0),
- m_aImagesNormal(IDEResId(RID_IMGLST_LAYOUT))
+void ModulWindow::OnNewDocument ()
+{
+ aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled);
+}
+
+char const* ModulWindow::GetHid () const
+{
+ return HID_BASICIDE_MODULWINDOW;
+}
+BasicIDEType ModulWindow::GetType () const
{
- SetBackground(GetSettings().GetStyleSettings().GetWindowColor());
+ return BASICIDE_TYPE_MODULE;
+}
- Color splitterColor(GetSettings().GetStyleSettings().GetShadowColor());
+bool ModulWindow::HasActiveEditor () const
+{
+ return !IsSuspended();
+}
- aLeftSplit.SetLineColor(splitterColor);
- aLeftSplit.SetFillColor(splitterColor);
- aBottomSplit.SetLineColor(splitterColor);
- aBottomSplit.SetFillColor(splitterColor);
- aVertSplit.SetLineColor(splitterColor);
- aVertSplit.SetFillColor(splitterColor);
- aLeftSplit.Show();
- aBottomSplit.Show();
- aVertSplit.Show();
- aLeftSplit.SetSplitHdl( LINK(this, ModulWindowLayout, SplitHdl) );
- aBottomSplit.SetSplitHdl( LINK(this, ModulWindowLayout, SplitHdl) );
- aVertSplit.SetSplitHdl( LINK(this, ModulWindowLayout, SplitHdl) );
+void ModulWindow::UpdateModule ()
+{
+ rtl::OUString const aModule = getTextEngineText(GetEditEngine());
- aWatchWindow.Show();
- aStackWindow.Show();
- aObjectCatalog.Show();
-
- Color aColor(GetSettings().GetStyleSettings().GetFieldTextColor());
- m_aSyntaxColors[TT_UNKNOWN] = aColor;
- m_aSyntaxColors[TT_WHITESPACE] = aColor;
- m_aSyntaxColors[TT_EOL] = aColor;
- m_aColorConfig.AddListener(this);
- m_aSyntaxColors[TT_IDENTIFIER]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICIDENTIFIER).nColor);
- m_aSyntaxColors[TT_NUMBER]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICNUMBER).nColor);
- m_aSyntaxColors[TT_STRING]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICSTRING).nColor);
- m_aSyntaxColors[TT_COMMENT]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICCOMMENT).nColor);
- m_aSyntaxColors[TT_ERROR]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICERROR).nColor);
- m_aSyntaxColors[TT_OPERATOR]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICOPERATOR).nColor);
- m_aSyntaxColors[TT_KEYWORDS]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICKEYWORD).nColor);
-
- Font aFont( GetFont() );
- Size aSz( aFont.GetSize() );
- aSz.Height() *= 3;
- aSz.Height() /= 2;
- aFont.SetSize( aSz );
- aFont.SetWeight( WEIGHT_BOLD );
- aFont.SetColor(GetSettings().GetStyleSettings().GetWindowTextColor());
- SetFont( aFont );
+ // update module in basic
+ assert(xModule);
+
+ // update module in module window
+ SetModule(aModule);
+
+ // update module in library
+ OSL_VERIFY(m_aDocument.updateModule(m_aLibName, m_aName, aModule));
+
+ GetEditEngine()->SetModified(false);
+ BasicIDE::MarkDocumentModified(m_aDocument);
}
-ModulWindowLayout::~ModulWindowLayout()
+
+//
+// ModulWindowLayout
+// =================
+//
+
+ModulWindowLayout::ModulWindowLayout (Window* pParent, ObjectCatalog& rObjectCatalog_) :
+ Layout(pParent),
+ pChild(0),
+ aWatchWindow(this),
+ aStackWindow(this),
+ rObjectCatalog(rObjectCatalog_)
+{ }
+
+void ModulWindowLayout::UpdateDebug (bool bBasicStopped)
{
- m_aColorConfig.RemoveListener(this);
+ aWatchWindow.UpdateWatches(bBasicStopped);
+ aStackWindow.UpdateCalls();
}
-void ModulWindowLayout::Resize()
+void ModulWindowLayout::Paint (Rectangle const&)
{
- // ScrollBars, etc. happens in BasicIDEShell:Adjust...
- ArrangeWindows();
+ DrawText(Point(), String(IDEResId(RID_STR_NOMODULE)));
}
-void ModulWindowLayout::Paint( const Rectangle& )
+// virtual
+void ModulWindowLayout::DataChanged (DataChangedEvent const& rDCEvt)
{
- DrawText( Point(), String( IDEResId( RID_STR_NOMODULE ) ) );
+ Layout::DataChanged(rDCEvt);
+ if (rDCEvt.GetType() == DATACHANGED_SETTINGS && (rDCEvt.GetFlags() & SETTINGS_STYLE))
+ aSyntaxColors.SettingsChanged();
}
-void ModulWindowLayout::ArrangeWindows()
+void ModulWindowLayout::Activating (IDEBaseWindow& rChild)
{
- static long const nSplitThickness = 2;
- static double const
- fDefaultLeftSplit = 0.2,
- fDefaultBottomSplit = 0.75,
- fDefaultVertSplit = 0.67;
+ assert(dynamic_cast<ModulWindow*>(&rChild));
+ pChild = &static_cast<ModulWindow&>(rChild);
+ aWatchWindow.Show();
+ aStackWindow.Show();
+ rObjectCatalog.Show();
+ rObjectCatalog.SetLayoutWindow(this);
+ rObjectCatalog.UpdateEntries();
+ Layout::Activating(rChild);
+ aSyntaxColors.SetActiveEditor(&pChild->GetEditorWindow());
+}
- Size const aSize = GetOutputSizePixel();
- long const nWidth = aSize.Width(), nHeight = aSize.Height();
- if (!nWidth || !nHeight) // empty size
- return;
+void ModulWindowLayout::Deactivating ()
+{
+ aSyntaxColors.SetActiveEditor(0);
+ Layout::Deactivating();
+ aWatchWindow.Hide();
+ aStackWindow.Hide();
+ rObjectCatalog.Hide();
+ pChild = 0;
+}
- // When ArrangeWindows() is called first,
- // the initial positions of the splitter lines are set.
- if (bFirstArrange)
+void ModulWindowLayout::GetState (SfxItemSet &rSet, unsigned nWhich)
+{
+ switch (nWhich)
{
- aLeftSplit.SetSplitPosPixel(aSize.Width() * fDefaultLeftSplit);
- aBottomSplit.SetSplitPosPixel(aSize.Height() * fDefaultBottomSplit);
- aVertSplit.SetSplitPosPixel(aSize.Width() * fDefaultVertSplit);
- bFirstArrange = false;
+ case SID_BASICIDE_CHOOSEMACRO:
+ rSet.Put(SfxVisibilityItem(nWhich, true));
+ break;
}
+}
- // resizing windows to the splitting lines
- long const nLeftSplitPos = aLeftSplit.GetSplitPosPixel();
- long const nBottomSplitPos = aBottomSplit.GetSplitPosPixel();
- long const nVertSplitPos = aVertSplit.GetSplitPosPixel();
- // which window is docked?
- bool const bObjCat = !aObjectCatalog.IsFloatingMode() && aObjectCatalog.IsVisible();
- bool const bWatchWin = !aWatchWindow.IsFloatingMode() && aWatchWindow.IsVisible();
- bool const bStackWin = !aStackWindow.IsFloatingMode() && aStackWindow.IsVisible();
- long const nBottom = bStackWin || bWatchWin ? nBottomSplitPos : nHeight;
- // left splitting line
- if (bObjCat)
- {
- aLeftSplit.SetDragRectPixel(Rectangle(Point(0, 0), Size(nWidth, nBottom)));
- aLeftSplit.SetPosPixel(Point(nLeftSplitPos, 0));
- aLeftSplit.SetSizePixel(Size(nSplitThickness, nBottom));
- aLeftSplit.Show();
- }
- else
- aLeftSplit.Hide();
- // bottom splitting line
- if (bWatchWin || bStackWin)
- {
- aBottomSplit.SetDragRectPixel(Rectangle(Point(0, 0), aSize));
- aBottomSplit.SetPosPixel(Point(0, nBottomSplitPos));
- aBottomSplit.SetSizePixel(Size(nWidth, nSplitThickness));
- aBottomSplit.Show();
- }
- else
- aBottomSplit.Hide();
- // vertical (bottom) splitting line
- if (bWatchWin || bStackWin)
- {
- Point const aPos(nVertSplitPos, nBottomSplitPos + nSplitThickness);
- aVertSplit.SetDragRectPixel(Rectangle(Point(0, aPos.Y()), Size(nWidth, nHeight - aPos.Y())));
- aVertSplit.SetPosSizePixel(aPos, Size(nSplitThickness, nHeight - aPos.Y()));
- aVertSplit.Show();
- }
- else
- aVertSplit.Hide();
- // editor window
- if (m_pModulWindow)
- {
- DBG_CHKOBJ(m_pModulWindow, ModulWindow, 0);
- long const nLeft = bObjCat ? nLeftSplitPos + nSplitThickness : 0;
- m_pModulWindow->SetPosSizePixel(
- Point(nLeft, 0),
- Size(nWidth - nLeft, nBottom)
- );
- }
- // object catalog (left)
- if (bObjCat)
- {
- aObjectCatalog.SetPosPixel(Point(0, 0));
- aObjectCatalog.SetSizePixel(Size(nLeftSplitPos, nBottom));
- }
- // watch (bottom left)
- if (bWatchWin)
- {
- Point const aPos(0, nBottomSplitPos + nSplitThickness);
- aWatchWindow.SetPosPixel(aPos);
- aWatchWindow.SetSizePixel(Size(nVertSplitPos, nHeight - aPos.Y()));
- }
- // call stack (bottom right)
- if (bStackWin)
- {
- Point const aPos(nVertSplitPos + nSplitThickness, nBottomSplitPos + nSplitThickness);
- aStackWindow.SetPosPixel(aPos);
- aStackWindow.SetSizePixel(Size(nWidth - aPos.X(), nHeight - aPos.Y()));
- }
+void ModulWindowLayout::BasicAddWatch (String const& rWatchStr)
+{
+ aWatchWindow.AddWatch(rWatchStr);
}
-IMPL_LINK( ModulWindowLayout, SplitHdl, Splitter *, pSplitter )
-{
- // The split line cannot be closer to the edges than nMargin pixels.
- static long const nMargin = 16;
- // Checking margins:
- if (long const nSize = pSplitter->IsHorizontal() ?
- GetOutputSizePixel().Width() :
- GetOutputSizePixel().Height()
- ) {
- long const nPos = pSplitter->GetSplitPosPixel();
- if (nPos < nMargin)
- pSplitter->SetSplitPosPixel(nMargin);
- if (nPos > nSize - nMargin)
- pSplitter->SetSplitPosPixel(nSize - nMargin);
- }
- ArrangeWindows();
- return 0;
+void ModulWindowLayout::BasicRemoveWatch ()
+{
+ DBG_CHKTHIS( ModulWindow, 0 );
+ aWatchWindow.RemoveSelectedWatch();
}
+void ModulWindowLayout::OnFirstSize (int const nWidth, int const nHeight)
+{
+ AddToLeft(&rObjectCatalog, Size(nWidth * 0.20, nHeight * 0.75));
+ AddToBottom(&aWatchWindow, Size(nWidth * 0.67, nHeight * 0.25));
+ AddToBottom(&aStackWindow, Size(nWidth * 0.33, nHeight * 0.25));
+}
+
+
//
-// IsToBeDocked() -- test whether dock or child:
-// true: Floating
-// false: Child
+// SyntaxColors
+// ============
//
-bool ModulWindowLayout::IsToBeDocked (
- DockingWindow* pDockingWindow, Point const& rPos, Rectangle& rRect
-) {
- Point const aPos = ScreenToOutputPixel(rPos);
- Size const aSize = GetOutputSizePixel();
- long const nWidth = aSize.Width(), nHeight = aSize.Height();
-
- if (aPos.X() > 0 && aPos.X() < nWidth && aPos.Y() > 0 && aPos.Y() < nHeight)
- {
- long const nLeftSplit = aLeftSplit.GetSplitPosPixel();
- long const nBottomSplit = aBottomSplit.GetSplitPosPixel();
- long const nVertSplit = aVertSplit.GetSplitPosPixel();
- if (pDockingWindow == &aObjectCatalog)
- {
- if (aPos.Y() < nBottomSplit && aPos.X() < nLeftSplit)
- {
- rRect = Rectangle(
- OutputToScreenPixel(Point(0, 0)),
- Size(nLeftSplit, nBottomSplit)
- );
- return true;
- }
- }
- else if (pDockingWindow == &aWatchWindow)
- {
- if (aPos.Y() > nBottomSplit && aPos.X() < nVertSplit)
- {
- rRect = Rectangle(
- OutputToScreenPixel(Point(0, nBottomSplit)),
- Size(nVertSplit, nHeight - nBottomSplit)
- );
- return true;
- }
- }
- else if (pDockingWindow == &aStackWindow)
- {
- if (aPos.Y() > nBottomSplit && aPos.X() > nVertSplit)
- {
- rRect = Rectangle(
- OutputToScreenPixel(Point(nVertSplit, nBottomSplit)),
- Size(nWidth - nVertSplit, nHeight - nBottomSplit)
- );
- return true;
- }
- }
- }
- return false;
-}
-void ModulWindowLayout::DockaWindow (DockingWindow*)
+ModulWindowLayout::SyntaxColors::SyntaxColors () :
+ pEditor(0)
{
- ArrangeWindows();
+ aConfig.AddListener(this);
+
+ aColors[TT_UNKNOWN] =
+ aColors[TT_WHITESPACE] =
+ aColors[TT_EOL] =
+ Application::GetSettings().GetStyleSettings().GetFieldTextColor();
+
+ NewConfig(true);
}
-void ModulWindowLayout::SetModulWindow (ModulWindow* pModulWindow)
+ModulWindowLayout::SyntaxColors::~SyntaxColors ()
{
- m_pModulWindow = pModulWindow;
- ArrangeWindows();
+ aConfig.RemoveListener(this);
}
-// virtual
-void ModulWindowLayout::DataChanged(DataChangedEvent const & rDCEvt)
+void ModulWindowLayout::SyntaxColors::SettingsChanged ()
{
- Window::DataChanged(rDCEvt);
- if (rDCEvt.GetType() == DATACHANGED_SETTINGS
- && (rDCEvt.GetFlags() & SETTINGS_STYLE) != 0)
+ Color const aColor = Application::GetSettings().GetStyleSettings().GetFieldTextColor();
+ if (aColor != aColors[TT_UNKNOWN])
{
- bool bInvalidate = false;
- Color aColor(GetSettings().GetStyleSettings().GetWindowColor());
- if (aColor
- != rDCEvt.GetOldSettings()->GetStyleSettings().GetWindowColor())
- {
- SetBackground(Wallpaper(aColor));
- bInvalidate = true;
- }
- aColor = GetSettings().GetStyleSettings().GetWindowTextColor();
- if (aColor != rDCEvt.GetOldSettings()->
- GetStyleSettings().GetWindowTextColor())
- {
- Font aFont(GetFont());
- aFont.SetColor(aColor);
- SetFont(aFont);
- bInvalidate = true;
- }
- if (bInvalidate)
- Invalidate();
- aColor = GetSettings().GetStyleSettings().GetFieldTextColor();
- if (aColor != m_aSyntaxColors[TT_UNKNOWN])
- {
- m_aSyntaxColors[TT_UNKNOWN] = aColor;
- m_aSyntaxColors[TT_WHITESPACE] = aColor;
- m_aSyntaxColors[TT_EOL] = aColor;
- updateSyntaxHighlighting();
- }
+ aColors[TT_UNKNOWN] =
+ aColors[TT_WHITESPACE] =
+ aColors[TT_EOL] =
+ aColor;
+ if (pEditor)
+ pEditor->UpdateSyntaxHighlighting();
}
}
// virtual
-void ModulWindowLayout::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 )
+void ModulWindowLayout::SyntaxColors::ConfigurationChanged (utl::ConfigurationBroadcaster*, sal_uInt32)
{
- {
- Color aColor(m_aColorConfig.GetColorValue(svtools::BASICIDENTIFIER).
- nColor);
- bool bChanged = aColor != m_aSyntaxColors[TT_IDENTIFIER];
- m_aSyntaxColors[TT_IDENTIFIER] = aColor;
- aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICNUMBER).nColor);
- if (bChanged || aColor != m_aSyntaxColors[TT_NUMBER])
- bChanged = true;
- m_aSyntaxColors[TT_NUMBER] = aColor;
- aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICSTRING).nColor);
- if (bChanged || aColor != m_aSyntaxColors[TT_STRING])
- bChanged = true;
- m_aSyntaxColors[TT_STRING] = aColor;
- aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICCOMMENT).
- nColor);
- if (bChanged || aColor != m_aSyntaxColors[TT_COMMENT])
- bChanged = true;
- m_aSyntaxColors[TT_COMMENT] = aColor;
- aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICERROR).nColor);
- if (bChanged || aColor != m_aSyntaxColors[TT_ERROR])
- bChanged = true;
- m_aSyntaxColors[TT_ERROR] = aColor;
- aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICOPERATOR).
- nColor);
- if (bChanged || aColor != m_aSyntaxColors[TT_OPERATOR])
- bChanged = true;
- m_aSyntaxColors[TT_OPERATOR] = aColor;
- aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICKEYWORD).
- nColor);
- if (bChanged || aColor != m_aSyntaxColors[TT_KEYWORDS])
- bChanged = true;
- m_aSyntaxColors[TT_KEYWORDS] = aColor;
- if (bChanged)
- updateSyntaxHighlighting();
- }
+ NewConfig(false);
}
-void ModulWindowLayout::updateSyntaxHighlighting()
+// when a new configuration has to be set
+void ModulWindowLayout::SyntaxColors::NewConfig (bool bFirst)
{
- if (m_pModulWindow != 0)
+ static struct
{
- EditorWindow & rEditor = m_pModulWindow->GetEditorWindow();
- sal_uLong nCount = rEditor.GetEditEngine()->GetParagraphCount();
- for (sal_uLong i = 0; i < nCount; ++i)
- rEditor.DoDelayedSyntaxHighlight(i);
+ TokenTypes eTokenType;
+ svtools::ColorConfigEntry eEntry;
}
+ const vIds[] =
+ {
+ { TT_IDENTIFIER, svtools::BASICIDENTIFIER },
+ { TT_NUMBER, svtools::BASICNUMBER },
+ { TT_STRING, svtools::BASICSTRING },
+ { TT_COMMENT, svtools::BASICCOMMENT },
+ { TT_ERROR, svtools::BASICERROR },
+ { TT_OPERATOR, svtools::BASICOPERATOR },
+ { TT_KEYWORDS, svtools::BASICKEYWORD },
+ };
+
+ bool bChanged = false;
+ for (unsigned i = 0; i != sizeof vIds / sizeof vIds[0]; ++i)
+ {
+ Color const aColor = aConfig.GetColorValue(vIds[i].eEntry).nColor;
+ Color& rMyColor = aColors[vIds[i].eTokenType];
+ if (bFirst || aColor != rMyColor)
+ {
+ rMyColor = aColor;
+ bChanged = true;
+ }
+ }
+ if (bChanged && !bFirst && pEditor)
+ pEditor->UpdateSyntaxHighlighting();
}
-Image ModulWindowLayout::getImage(sal_uInt16 nId) const
-{
- return m_aImagesNormal.GetImage(nId);
-}
-
-// shows or hides the Object Catalog window (depending on its state)
-void ModulWindowLayout::ToggleObjectCatalog ()
-{
- // show or hide?
- bool const bShow = !aObjectCatalog.IsVisible();
- bShow ? aObjectCatalog.Show() : aObjectCatalog.Hide();
- if (m_pModulWindow)
- m_pModulWindow->SetObjectCatalogDisplay(bShow);
- // refreshing
- ArrangeWindows();
-}
-// Updates the Object Catalog window.
-void ModulWindowLayout::UpdateObjectCatalog ()
-{
- aObjectCatalog.UpdateEntries();
-}
+} // namespace basctl
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index e3aeeed..e1e6392 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -20,12 +20,13 @@
#ifndef BASCTL_BASIDE2_HXX
#define BASCTL_BASIDE2_HXX
-#include <svheader.hxx>
-
+#include "layout.hxx"
#include <bastypes.hxx>
#include <bastype3.hxx>
#include <basidesh.hxx>
+#include <svheader.hxx>
+
class ExtTextEngine;
class ExtTextView;
class SvxSearchItem;
@@ -40,22 +41,25 @@ class SvxSearchItem;
#include <svtools/colorcfg.hxx>
#include <sfx2/progress.hxx>
-#include <svtools/syntaxhighlight.hxx>
#include <unotools/options.hxx>
#include "breakpoint.hxx"
#include "linenumberwindow.hxx"
-#include "objdlg.hxx"
#include <set>
-DBG_NAMEEX( ModulWindow )
-
#define MARKER_NOMARKER 0xFFFF
namespace com { namespace sun { namespace star { namespace beans {
class XMultiPropertySet;
} } } }
+namespace basctl
+{
+
+class ObjectCatalog;
+
+DBG_NAMEEX( ModulWindow )
+
// #108672 Helper functions to get/set text in TextEngine
// using the stream interface (get/setText() only supports
// tools Strings limited to 64K).
@@ -90,10 +94,10 @@ class EditorWindow : public Window, public SfxListener
{
private:
class ChangesListener;
- friend class ChangesListener;
ExtTextView* pEditView;
ExtTextEngine* pEditEngine;
+ ModulWindow& rModulWindow;
rtl::Reference< ChangesListener > listener_;
osl::Mutex mutex_;
@@ -107,7 +111,6 @@ private:
SyntaxLineSet aSyntaxLineTable;
DECL_LINK(SyntaxTimerHdl, void *);
ProgressInfo* pProgress;
- ModulWindow* pModulWindow;
virtual void DataChanged(DataChangedEvent const & rDCEvt);
@@ -141,7 +144,7 @@ protected:
bool ImpCanModify();
public:
- EditorWindow( Window* pParent );
+ EditorWindow (Window* pParent, ModulWindow*);
~EditorWindow();
ExtTextEngine* GetEditEngine() const { return pEditEngine; }
@@ -157,23 +160,23 @@ public:
void CreateEditEngine();
void SetScrollBarRanges();
void InitScrollBars();
- void SetModulWindow( ModulWindow* pWin )
- { pModulWindow = pWin; }
void ForceSyntaxTimeout();
bool SetSourceInBasic();
bool CanModify() { return ImpCanModify(); }
+
+ void UpdateSyntaxHighlighting ();
};
class BreakPointWindow : public Window
{
private:
+ ModulWindow& rModulWindow;
long nCurYOffset;
- sal_uInt16 nMarkerPos;
+ sal_uInt16 nMarkerPos;
BreakPointList aBreakPointList;
- ModulWindow* pModulWindow;
bool bErrorMarker;
virtual void DataChanged(DataChangedEvent const & rDCEvt);
@@ -191,12 +194,9 @@ protected:
bool SyncYOffset();
public:
- BreakPointWindow( Window* pParent );
+ BreakPointWindow (Window* pParent, ModulWindow*);
~BreakPointWindow();
- void SetModulWindow( ModulWindow* pWin )
- { pModulWindow = pWin; }
-
void SetMarkerPos( sal_uInt16 nLine, bool bErrorMarker = false );
void DoScroll( long nHorzScroll, long nVertScroll );
@@ -249,7 +249,7 @@ protected:
public:
- WatchWindow( Window* pParent );
+ WatchWindow (Layout* pParent);
~WatchWindow();
void AddWatch( const String& rVName );
@@ -271,7 +271,7 @@ protected:
virtual void Paint( const Rectangle& rRect );
public:
- StackWindow( Window* pParent );
+ StackWindow (Layout* pParent);
~StackWindow();
void UpdateCalls();
@@ -285,8 +285,6 @@ private:
LineNumberWindow aLineNumberWindow;
EditorWindow aEdtWindow;
ScrollBar aEWVScrollBar;
- bool bLineNumberDisplay;
- bool bObjectCatalogDisplay;
virtual void DataChanged(DataChangedEvent const & rDCEvt);
@@ -303,32 +301,25 @@ public:
ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; }
void SetLineNumberDisplay(bool b);
- void SetObjectCatalogDisplay(bool b);
};
class ModulWindow: public IDEBaseWindow
{
- friend class BasicIDEShell;
-
private:
+ ModulWindowLayout& rLayout;
StarBASICRef xBasic;
short nValid;
ComplexEditorWindow aXEditorWindow;
BasicStatus aStatus;
SbModuleRef xModule;
- ModulWindowLayout* pLayout;
::rtl::OUString aCurPath;
::rtl::OUString m_aModule;
- long BasicErrorHdl( StarBASIC* pBasic );
- long BasicBreakHdl( StarBASIC* pBasic );
-
void CheckCompileBasic();
bool BasicExecute();
void GoOnTop();
- void AssertValidEditEngine();
sal_Int32 FormatAndPrint( Printer* pPrinter, sal_Int32 nPage = -1 );
SbModuleRef XModule();
@@ -336,7 +327,6 @@ protected:
virtual void Resize();
virtual void GetFocus();
virtual void Paint( const Rectangle& );
- virtual void Deactivating();
virtual void DoInit();
virtual void DoScroll( ScrollBar* pCurScrollBar );
@@ -347,7 +337,8 @@ public:
~ModulWindow();
- virtual void ExecuteCommand( SfxRequest& rReq );
+ virtual void ExecuteCommand (SfxRequest& rReq);
+ virtual void ExecuteGlobal (SfxRequest& rReq);
virtual void GetState( SfxItemSet& );
virtual void StoreData();
virtual void UpdateData();
@@ -363,7 +354,6 @@ public:
virtual bool IsReadOnly();
void SetLineNumberDisplay(bool);
- void SetObjectCatalogDisplay(bool);
StarBASIC* GetBasic() { XModule(); return xBasic; }
@@ -384,6 +374,10 @@ public:
void BasicAddWatch();
void BasicRemoveWatch();
+ long BasicErrorHdl( StarBASIC* pBasic );
+ long BasicBreakHdl( StarBASIC* pBasic );
+ void AssertValidEditEngine();
+
bool LoadBasic();
bool SaveBasicSource();
bool ImportDialog();
@@ -401,9 +395,7 @@ public:
void ShowCursor( bool bOn );
virtual sal_uInt16 GetSearchOptions();
- sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem, bool bFromStart = false );
-
- virtual Window* GetLayoutWindow();
+ virtual sal_uInt16 StartSearchAndReplace (SvxSearchItem const&, bool bFromStart = false);
EditorWindow& GetEditorWindow() { return aXEditorWindow.GetEdtWindow(); }
BreakPointWindow& GetBreakPointWindow() { return aXEditorWindow.GetBrkWindow(); }
@@ -412,7 +404,7 @@ public:
ExtTextEngine* GetEditEngine() { return GetEditorWindow().GetEditEngine(); }
ExtTextView* GetEditView() { return GetEditorWindow().GetEditView(); }
BreakPointList& GetBreakPoints() { return GetBreakPointWindow().GetBreakPoints(); }
- ModulWindowLayout* GetLayout() const { return pLayout; }
+ ModulWindowLayout& GetLayout () { return rLayout; }
virtual void BasicStarted();
virtual void BasicStopped();
@@ -422,67 +414,78 @@ public:
const ::rtl::OUString& GetModule() const { return m_aModule; }
void SetModule( const ::rtl::OUString& aModule ) { m_aModule = aModule; }
+
+ virtual void Activating ();
+ virtual void Deactivating ();
+
+ virtual void OnNewDocument ();
+ virtual char const* GetHid () const;
+ virtual BasicIDEType GetType () const;
+ virtual bool HasActiveEditor () const;
+
+ void UpdateModule ();
};
-class ModulWindowLayout: public Window, public utl::ConfigurationListener
+class ModulWindowLayout: public Layout
{
-private:
- // is ArrangeWindows() called first in this object?
- bool bFirstArrange;
+public:
+ ModulWindowLayout (Window* pParent, ObjectCatalog&);
+public:
+ // Layout:
+ virtual void Activating (IDEBaseWindow&);
+ virtual void Deactivating ();
+ virtual void GetState (SfxItemSet&, unsigned nWhich);
+ virtual void UpdateDebug (bool bBasicStopped = false);
+public:
+ void BasicAddWatch (String const&);
+ void BasicRemoveWatch ();
+ Color GetSyntaxColor (TokenTypes eType) const { return aSyntaxColors.GetColor(eType); }
- // splitter lines
- Splitter aLeftSplit, aBottomSplit, aVertSplit;
+protected:
+ // Window:
+ virtual void Paint (const Rectangle& rRect);
+ // Layout:
+ virtual void OnFirstSize (int nWidth, int nHeight);
+private:
+ // main child window
+ ModulWindow* pChild;
// dockable windows
- ObjectCatalog aObjectCatalog;
WatchWindow aWatchWindow;
StackWindow aStackWindow;
-
- ModulWindow* m_pModulWindow;
-
- Color m_aSyntaxColors[TT_KEYWORDS + 1];
- svtools::ColorConfig m_aColorConfig;
-
- ImageList m_aImagesNormal;
-
- virtual void DataChanged(DataChangedEvent const & rDCEvt);
-
- virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
-
- void updateSyntaxHighlighting();
-
- DECL_LINK( SplitHdl, Splitter * );
-
- void ArrangeWindows();
-
-protected:
- virtual void Resize();
- virtual void Paint( const Rectangle& rRect );
-
-public:
- ModulWindowLayout( Window* pParent );
- ~ModulWindowLayout();
-
- void DockaWindow( DockingWindow* pDockingWin );
- bool IsToBeDocked( DockingWindow* pDockingWin, const Point& rPos, Rectangle& rRect );
-
- void SetModulWindow( ModulWindow* pModWin );
- ModulWindow* GetModulWindow() const { return m_pModulWindow; }
-
- WatchWindow& GetWatchWindow() { return aWatchWindow; }
- StackWindow& GetStackWindow() { return aStackWindow; }
- ObjectCatalog& GetObjectCatalog() { return aObjectCatalog; }
-
- Image getImage(sal_uInt16 nId) const;
-
- inline Color const & getSyntaxColor(TokenTypes eType) const
- { return m_aSyntaxColors[eType]; }
-
- void ToggleObjectCatalog ();
- bool HasObjectCatalog () const { return aObjectCatalog.IsVisible(); }
- void UpdateObjectCatalog ();
+ ObjectCatalog& rObjectCatalog;
+private:
+ virtual void DataChanged (DataChangedEvent const& rDCEvt);
+private:
+ // SyntaxColors -- stores Basic syntax highlighting colors
+ class SyntaxColors : public utl::ConfigurationListener
+ {
+ public:
+ SyntaxColors ();
+ ~SyntaxColors ();
+ public:
+ void SetActiveEditor (EditorWindow* pEditor_) { pEditor = pEditor_; }
+ void SettingsChanged ();
+ public:
+ Color GetColor (TokenTypes eType) const { return aColors[eType]; }
+
+ private:
+ virtual void ConfigurationChanged (utl::ConfigurationBroadcaster*, sal_uInt32);
+ void NewConfig (bool bFirst);
+
+ private:
+ // the color values (the indexes are TokenTypes, see svtools/syntaxhighlight.hxx)
+ Color aColors[TT_KEYWORDS + 1];
+ // the configuration
+ svtools::ColorConfig aConfig;
+ // the active editor
+ EditorWindow* pEditor;
+
+ } aSyntaxColors;
};
+} // namespace basctl
+
#endif // BASCTL_BASIDE2_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index dd6337e..a784d4d 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -41,9 +41,13 @@
#include <vcl/xtextedt.hxx>
#include <vcl/txtattr.hxx>
#include <svtools/textwindowpeer.hxx>
+#include <svtools/syntaxhighlight.hxx>
#include <vcl/taskpanelist.hxx>
#include <vcl/help.hxx>
+namespace basctl
+{
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -62,6 +66,12 @@ SbxVariable* IsSbxVariable (SbxBase* pBase)
return 0;
}
+Image GetImage (unsigned nId)
+{
+ static ImageList const aImagesNormal(IDEResId(RID_IMGLST_LAYOUT));
+ return aImagesNormal.GetImage(nId);
+}
+
} // namespace
#define SCROLL_LINE 12
@@ -99,7 +109,7 @@ void setTextEngineText( ExtTextEngine* pEngine, const ::rtl::OUString aStr )
pEngine->Read( aMemStream );
}
-void lcl_DrawIDEWindowFrame( DockingWindow* pWin )
+void lcl_DrawIDEWindowFrame( BasicDockingWindow* pWin )
{
if ( pWin->IsFloatingMode() )
return;
@@ -147,6 +157,12 @@ void lcl_SeparateNameAndIndex( const String& rVName, String& rVar, String& rInde
}
}
+
+//
+// EditorWindow
+// ============
+//
+
class EditorWindow::ChangesListener:
public cppu::WeakImplHelper1< beans::XPropertiesChangeListener >
{
@@ -172,25 +188,21 @@ private:
EditorWindow & editor_;
};
-EditorWindow::EditorWindow( Window* pParent ) :
- Window( pParent, WB_BORDER )
-{
- bDoSyntaxHighlight = true;
- bDelayHighlight = true;
- pModulWindow = 0;
- pEditView = 0;
- pEditEngine = 0;
- bHighlightning = false;
- pProgress = 0;
- nCurTextWidth = 0;
- SetBackground(
- Wallpaper(GetSettings().GetStyleSettings().GetFieldColor()));
+EditorWindow::EditorWindow (Window* pParent, ModulWindow* pModulWindow) :
+ Window(pParent, WB_BORDER),
+ pEditView(0),
+ pEditEngine(0),
+ rModulWindow(*pModulWindow),
+ nCurTextWidth(0),
+ pProgress(0),
+ bHighlightning(false),
+ bDoSyntaxHighlight(true),
+ bDelayHighlight(true)
+{
+ SetBackground(Wallpaper(GetSettings().GetStyleSettings().GetFieldColor()));
SetPointer( Pointer( POINTER_TEXT ) );
-
SetHelpId( HID_BASICIDE_EDITORWINDOW );
- // Using "this" in ctor is a little fishy, but should work here at least as
- // long as there are no derivations:
listener_ = new ChangesListener(*this);
Reference< beans::XMultiPropertySet > n(
officecfg::Office::Common::Font::SourceViewFont::get(),
@@ -206,7 +218,6 @@ EditorWindow::EditorWindow( Window* pParent ) :
}
-
EditorWindow::~EditorWindow()
{
Reference< beans::XMultiPropertySet > n;
@@ -364,8 +375,8 @@ void EditorWindow::Resize()
aStartDocPos.Y() = nMaxVisAreaStart;
pEditView->SetStartDocPos( aStartDocPos );
pEditView->ShowCursor();
- pModulWindow->GetBreakPointWindow().GetCurYOffset() = aStartDocPos.Y();
- pModulWindow->GetLineNumberWindow().GetCurYOffset() = aStartDocPos.Y();
+ rModulWindow.GetBreakPointWindow().GetCurYOffset() = aStartDocPos.Y();
+ rModulWindow.GetLineNumberWindow().GetCurYOffset() = aStartDocPos.Y();
}
InitScrollBars();
if ( nVisY != pEditView->GetStartDocPos().Y() )
@@ -410,7 +421,7 @@ void EditorWindow::Command( const CommandEvent& rCEvt )
( rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL ) ||
( rCEvt.GetCommand() == COMMAND_AUTOSCROLL ) )
{
- HandleScrollCommand( rCEvt, pModulWindow->GetHScrollBar(), &pModulWindow->GetEditVScrollBar() );
+ HandleScrollCommand( rCEvt, rModulWindow.GetHScrollBar(), &rModulWindow.GetEditVScrollBar() );
}
}
}
@@ -424,7 +435,7 @@ bool EditorWindow::ImpCanModify()
// Remove markers in the modules in Notify at Basic::Stoped
if ( QueryBox( 0, WB_OK_CANCEL, String( IDEResId( RID_STR_WILLSTOPPRG ) ) ).Execute() == RET_OK )
{
- pModulWindow->GetBasicStatus().bIsRunning = false;
+ rModulWindow.GetBasicStatus().bIsRunning = false;
BasicIDE::StopBasic();
}
else
@@ -439,11 +450,11 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
return;
#if OSL_DEBUG_LEVEL > 1
- Range aRange = pModulWindow->GetHScrollBar()->GetRange(); (void)aRange;
- long nVisSz = pModulWindow->GetHScrollBar()->GetVisibleSize(); (void)nVisSz;
- long nPapSz = pModulWindow->GetHScrollBar()->GetPageSize(); (void)nPapSz;
- long nLinSz = pModulWindow->GetHScrollBar()->GetLineSize(); (void)nLinSz;
- long nThumb = pModulWindow->GetHScrollBar()->GetThumbPos(); (void)nThumb;
+ Range aRange = rModulWindow.GetHScrollBar()->GetRange(); (void)aRange;
+ long nVisSz = rModulWindow.GetHScrollBar()->GetVisibleSize(); (void)nVisSz;
+ long nPapSz = rModulWindow.GetHScrollBar()->GetPageSize(); (void)nPapSz;
+ long nLinSz = rModulWindow.GetHScrollBar()->GetLineSize(); (void)nLinSz;
+ long nThumb = rModulWindow.GetHScrollBar()->GetThumbPos(); (void)nThumb;
#endif
bool const bWasModified = pEditEngine->IsModified();
// see if there is an accelerator to be processed first
@@ -521,31 +532,14 @@ bool EditorWindow::SetSourceInBasic()
{
if ( !StarBASIC::IsRunning() ) // Not at runtime!
{
- ::rtl::OUString aModule = getTextEngineText( pEditEngine );
-
- // update module in basic
-#ifdef DBG_UTIL
- SbModule* pModule = pModulWindow->GetSbModule();
-#endif
- DBG_ASSERT(pModule, "EditorWindow::SetSourceInBasic: No Module found!");
-
- // update module in module window
- pModulWindow->SetModule( aModule );
-
- // update module in library
- ScriptDocument aDocument( pModulWindow->GetDocument() );
- String aLibName = pModulWindow->GetLibName();
- String aName = pModulWindow->GetName();
- OSL_VERIFY( aDocument.updateModule( aLibName, aName, aModule ) );
-
- pEditEngine->SetModified(false);
- BasicIDE::MarkDocumentModified( aDocument );
+ rModulWindow.UpdateModule();
bChanged = true;
}
}
return bChanged;
}
+} // namespace basctl
// Returns the position of the last character of any of the following
// EOL char combinations: CR, CR/LF, LF, return -1 if no EOL is found
@@ -566,6 +560,9 @@ sal_Int32 searchEOL( const ::rtl::OUString& rStr, sal_Int32 fromIndex )
}
+namespace basctl
+{
+
void EditorWindow::CreateEditEngine()
{
if ( pEditEngine )
@@ -586,7 +583,7 @@ void EditorWindow::CreateEditEngine()
bool bWasDoSyntaxHighlight = bDoSyntaxHighlight;
bDoSyntaxHighlight = false; // too slow for large texts...
- ::rtl::OUString aOUSource( pModulWindow->GetModule() );
+ rtl::OUString aOUSource(rModulWindow.GetModule());
sal_Int32 nLines = 0;
sal_Int32 nIndex = -1;
do
@@ -604,15 +601,10 @@ void EditorWindow::CreateEditEngine()
pEditView->SetStartDocPos( Point( 0, 0 ) );
pEditView->SetSelection( TextSelection() );
- pModulWindow->GetBreakPointWindow().GetCurYOffset() = 0;
- pModulWindow->GetLineNumberWindow().GetCurYOffset() = 0;
+ rModulWindow.GetBreakPointWindow().GetCurYOffset() = 0;
+ rModulWindow.GetLineNumberWindow().GetCurYOffset() = 0;
pEditEngine->SetUpdateMode(true);
- Update(); // has only been invalidated at UpdateMode = true
-
- pModulWindow->GetLayout()->GetWatchWindow().Update();
- pModulWindow->GetLayout()->GetStackWindow().Update();
- pModulWindow->GetBreakPointWindow().Update();
- pModulWindow->GetLineNumberWindow().Update();
+ rModulWindow.Update(); // has only been invalidated at UpdateMode = true
pEditView->ShowCursor( true, true );
@@ -638,19 +630,19 @@ void EditorWindow::CreateEditEngine()
if ( pBindings )
pBindings->Invalidate( SID_BASICIDE_STAT_POS );
- DBG_ASSERT( pModulWindow->GetBreakPointWindow().GetCurYOffset() == 0, "CreateEditEngine: Brechpunkte verschoben?" );
+ DBG_ASSERT( rModulWindow.GetBreakPointWindow().GetCurYOffset() == 0, "CreateEditEngine: Brechpunkte verschoben?" );
// set readonly mode for readonly libraries
- ScriptDocument aDocument( pModulWindow->GetDocument() );
- ::rtl::OUString aOULibName( pModulWindow->GetLibName() );
+ ScriptDocument aDocument(rModulWindow.GetDocument());
+ rtl::OUString aOULibName(rModulWindow.GetLibName());
Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) )
{
- pModulWindow->SetReadOnly(true);
+ rModulWindow.SetReadOnly(true);
}
if ( aDocument.isDocument() && aDocument.isReadOnly() )
- pModulWindow->SetReadOnly(true);
+ rModulWindow.SetReadOnly(true);
}
// virtual
@@ -688,13 +680,13 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
TextHint const& rTextHint = *pTextHint;
if( rTextHint.GetId() == TEXT_HINT_VIEWSCROLLED )
{
- if ( pModulWindow->GetHScrollBar() )
- pModulWindow->GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() );
- pModulWindow->GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() );
- pModulWindow->GetBreakPointWindow().DoScroll
- ( 0, pModulWindow->GetBreakPointWindow().GetCurYOffset() - pEditView->GetStartDocPos().Y() );
- pModulWindow->GetLineNumberWindow().DoScroll
- ( 0, pModulWindow->GetLineNumberWindow().GetCurYOffset() - pEditView->GetStartDocPos().Y() );
+ if ( rModulWindow.GetHScrollBar() )
+ rModulWindow.GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() );
+ rModulWindow.GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() );
+ rModulWindow.GetBreakPointWindow().DoScroll
+ ( 0, rModulWindow.GetBreakPointWindow().GetCurYOffset() - pEditView->GetStartDocPos().Y() );
+ rModulWindow.GetLineNumberWindow().DoScroll
+ ( 0, rModulWindow.GetLineNumberWindow().GetCurYOffset() - pEditView->GetStartDocPos().Y() );
}
else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED )
{
@@ -705,21 +697,21 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
if ( nTextHeight < nOutHeight )
pEditView->Scroll( 0, pEditView->GetStartDocPos().Y() );
- pModulWindow->GetLineNumberWindow().Invalidate();
+ rModulWindow.GetLineNumberWindow().Invalidate();
}
SetScrollBarRanges();
}
else if( rTextHint.GetId() == TEXT_HINT_TEXTFORMATTED )
{
- if ( pModulWindow->GetHScrollBar() )
+ if ( rModulWindow.GetHScrollBar() )
{
sal_uLong nWidth = pEditEngine->CalcTextWidth();
if ( (long)nWidth != nCurTextWidth )
{
nCurTextWidth = nWidth;
- pModulWindow->GetHScrollBar()->SetRange( Range( 0, (long)nCurTextWidth-1) );
- pModulWindow->GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() );
+ rModulWindow.GetHScrollBar()->SetRange( Range( 0, (long)nCurTextWidth-1) );
+ rModulWindow.GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() );
}
}
long nPrevTextWidth = nCurTextWidth;
@@ -749,10 +741,10 @@ void EditorWindow::SetScrollBarRanges()
if ( !pEditEngine )
return;
- if ( pModulWindow->GetHScrollBar() )
- pModulWindow->GetHScrollBar()->SetRange( Range( 0, nCurTextWidth-1 ) );
+ if ( rModulWindow.GetHScrollBar() )
+ rModulWindow.GetHScrollBar()->SetRange( Range( 0, nCurTextWidth-1 ) );
- pModulWindow->GetEditVScrollBar().SetRange( Range( 0, pEditEngine->GetTextHeight()-1 ) );
+ rModulWindow.GetEditVScrollBar().SetRange( Range( 0, pEditEngine->GetTextHeight()-1 ) );
}
void EditorWindow::InitScrollBars()
@@ -762,19 +754,19 @@ void EditorWindow::InitScrollBars()
SetScrollBarRanges();
Size aOutSz( GetOutputSizePixel() );
- pModulWindow->GetEditVScrollBar().SetVisibleSize( aOutSz.Height() );
- pModulWindow->GetEditVScrollBar().SetPageSize( aOutSz.Height() * 8 / 10 );
- pModulWindow->GetEditVScrollBar().SetLineSize( GetTextHeight() );
- pModulWindow->GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() );
- pModulWindow->GetEditVScrollBar().Show();
+ rModulWindow.GetEditVScrollBar().SetVisibleSize( aOutSz.Height() );
+ rModulWindow.GetEditVScrollBar().SetPageSize( aOutSz.Height() * 8 / 10 );
+ rModulWindow.GetEditVScrollBar().SetLineSize( GetTextHeight() );
+ rModulWindow.GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() );
+ rModulWindow.GetEditVScrollBar().Show();
- if ( pModulWindow->GetHScrollBar() )
+ if ( rModulWindow.GetHScrollBar() )
{
- pModulWindow->GetHScrollBar()->SetVisibleSize( aOutSz.Width() );
- pModulWindow->GetHScrollBar()->SetPageSize( aOutSz.Width() * 8 / 10 );
- pModulWindow->GetHScrollBar()->SetLineSize( GetTextWidth( rtl::OUString('x') ) );
- pModulWindow->GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() );
- pModulWindow->GetHScrollBar()->Show();
+ rModulWindow.GetHScrollBar()->SetVisibleSize( aOutSz.Width() );
+ rModulWindow.GetHScrollBar()->SetPageSize( aOutSz.Width() * 8 / 10 );
+ rModulWindow.GetHScrollBar()->SetLineSize( GetTextWidth( rtl::OUString('x') ) );
+ rModulWindow.GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() );
+ rModulWindow.GetHScrollBar()->Show();
}
}
@@ -799,14 +791,21 @@ void EditorWindow::ImpDoHighlight( sal_uLong nLine )
for ( size_t i = 0; i < aPortions.size(); i++ )
{
HighlightPortion& r = aPortions[i];
- const Color& rColor = dynamic_cast<ModulWindowLayout*>(pModulWindow->GetLayoutWindow())->getSyntaxColor(r.tokenType);
- pEditEngine->SetAttrib( TextAttribFontColor( rColor ), nLine, r.nBegin, r.nEnd, true );
+ Color const aColor = rModulWindow.GetLayout().GetSyntaxColor(r.tokenType);
+ pEditEngine->SetAttrib( TextAttribFontColor(aColor), nLine, r.nBegin, r.nEnd, true );
}
pEditEngine->SetModified( bWasModified );
}
}
+void EditorWindow::UpdateSyntaxHighlighting ()
+{
+ unsigned nCount = pEditEngine->GetParagraphCount();
+ for (unsigned i = 0; i < nCount; ++i)
+ DoDelayedSyntaxHighlight(i);
+}
+
void EditorWindow::ImplSetFont()
{
rtl::OUString sFontName(
@@ -817,18 +816,14 @@ void EditorWindow::ImplSetFont()
Font aTmpFont( OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, Application::GetSettings().GetUILanguage(), 0 , this ) );
sFontName = aTmpFont.GetName();
}
- Size aFontSize(
- 0, officecfg::Office::Common::Font::SourceViewFont::FontHeight::get() );
+ Size aFontSize(0, officecfg::Office::Common::Font::SourceViewFont::FontHeight::get());
Font aFont( sFontName, aFontSize );
aFont.SetColor( GetSettings().GetStyleSettings().GetFieldTextColor() );
SetPointFont( aFont );
aFont = GetFont();
- if ( pModulWindow )
- {
- pModulWindow->GetBreakPointWindow().SetFont( aFont );
- pModulWindow->GetLineNumberWindow().SetFont( aFont );
- }
+ rModulWindow.GetBreakPointWindow().SetFont( aFont );
+ rModulWindow.GetLineNumberWindow().SetFont( aFont );
if ( pEditEngine )
{
@@ -904,26 +899,26 @@ void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, bool bInserted )
if ( !bInserted && ( nPara == TEXT_PARA_ALL ) )
{
- pModulWindow->GetBreakPoints().reset();
- pModulWindow->GetBreakPointWindow().Invalidate();
- pModulWindow->GetLineNumberWindow().Invalidate();
+ rModulWindow.GetBreakPoints().reset();
+ rModulWindow.GetBreakPointWindow().Invalidate();
+ rModulWindow.GetLineNumberWindow().Invalidate();
aHighlighter.initialize( HIGHLIGHT_BASIC );
}
else
{
- pModulWindow->GetBreakPoints().AdjustBreakPoints( (sal_uInt16)nPara+1, bInserted );
+ rModulWindow.GetBreakPoints().AdjustBreakPoints( (sal_uInt16)nPara+1, bInserted );
long nLineHeight = GetTextHeight();
- Size aSz = pModulWindow->GetBreakPointWindow().GetOutputSize();
+ Size aSz = rModulWindow.GetBreakPointWindow().GetOutputSize();
Rectangle aInvRec( Point( 0, 0 ), aSz );
- long nY = nPara*nLineHeight - pModulWindow->GetBreakPointWindow().GetCurYOffset();
+ long nY = nPara*nLineHeight - rModulWindow.GetBreakPointWindow().GetCurYOffset();
aInvRec.Top() = nY;
- pModulWindow->GetBreakPointWindow().Invalidate( aInvRec );
+ rModulWindow.GetBreakPointWindow().Invalidate( aInvRec );
- Size aLnSz(pModulWindow->GetLineNumberWindow().GetWidth(),
+ Size aLnSz(rModulWindow.GetLineNumberWindow().GetWidth(),
GetOutputSizePixel().Height() - 2 * DWBORDER);
- pModulWindow->GetLineNumberWindow().SetPosSizePixel(Point(DWBORDER + 19, DWBORDER), aLnSz);
- pModulWindow->GetLineNumberWindow().Invalidate();
+ rModulWindow.GetLineNumberWindow().SetPosSizePixel(Point(DWBORDER + 19, DWBORDER), aLnSz);
+ rModulWindow.GetLineNumberWindow().Invalidate();
if ( bDoSyntaxHighlight )
{
@@ -951,22 +946,21 @@ void EditorWindow::ForceSyntaxTimeout()
}
+//
+// BreakPointWindow
+// ================
+//
-BreakPointWindow::BreakPointWindow( Window* pParent ) :
- Window( pParent, WB_BORDER )
+BreakPointWindow::BreakPointWindow (Window* pParent, ModulWindow* pModulWindow) :
+ Window(pParent, WB_BORDER),
+ rModulWindow(*pModulWindow),
+ nCurYOffset(0), // memorize nCurYOffset and not take it from EditEngine
+ nMarkerPos(MARKER_NOMARKER)
{
- pModulWindow = 0;
- nCurYOffset = 0;
setBackgroundColor(GetSettings().GetStyleSettings().GetFieldColor());
- nMarkerPos = MARKER_NOMARKER;
-
- // memorize nCurYOffset and not take it from EditEngine
-
- SetHelpId( HID_BASICIDE_BREAKPOINTWINDOW );
+ SetHelpId(HID_BASICIDE_BREAKPOINTWINDOW);
}
-
-
BreakPointWindow::~BreakPointWindow()
{
}
@@ -985,27 +979,24 @@ void BreakPointWindow::Paint( const Rectangle& )
if ( SyncYOffset() )
return;
- Size aOutSz( GetOutputSize() );
- long nLineHeight = GetTextHeight();
-
- ModulWindowLayout* pModulWindowLayout = dynamic_cast<ModulWindowLayout*>(pModulWindow->GetLayoutWindow());
+ Size const aOutSz = GetOutputSize();
+ long const nLineHeight = GetTextHeight();
- Image aBrk1(pModulWindowLayout->getImage(IMGID_BRKENABLED));
- Image aBrk0(pModulWindowLayout->getImage(IMGID_BRKDISABLED));
- Size aBmpSz( aBrk1.GetSizePixel() );
- aBmpSz = PixelToLogic( aBmpSz );
- Point aBmpOff( 0, 0 );
- aBmpOff.X() = ( aOutSz.Width() - aBmpSz.Width() ) / 2;
- aBmpOff.Y() = ( nLineHeight - aBmpSz.Height() ) / 2;
+ Image const aBrk[2] = { GetImage(IMGID_BRKDISABLED), GetImage(IMGID_BRKENABLED) };
+ Size const aBmpSz = PixelToLogic(aBrk[1].GetSizePixel());
+ Point const aBmpOff(
+ (aOutSz.Width() - aBmpSz.Width()) / 2,
+ (nLineHeight - aBmpSz.Height()) / 2
+ );
- for ( size_t i = 0, n = GetBreakPoints().size(); i < n ; ++i )
+ for (size_t i = 0, n = GetBreakPoints().size(); i < n; ++i)
{
- BreakPoint* pBrk = GetBreakPoints().at( i );
- size_t nLine = pBrk->nLine-1;
- size_t nY = nLine*nLineHeight - nCurYOffset;
- DrawImage( Point( 0, nY ) + aBmpOff, pBrk->bEnabled ? aBrk1 : aBrk0 );
+ BreakPoint& rBrk = *GetBreakPoints().at(i);
+ size_t const nLine = rBrk.nLine - 1;
+ size_t const nY = nLine*nLineHeight - nCurYOffset;
+ DrawImage(Point(0, nY) + aBmpOff, aBrk[rBrk.bEnabled]);
}
- ShowMarker( true );
+ ShowMarker(true);
}
@@ -1034,11 +1025,10 @@ void BreakPointWindow::ShowMarker( bool bShow )
if ( nMarkerPos == MARKER_NOMARKER )
return;
- Size aOutSz( GetOutputSize() );
- long nLineHeight = GetTextHeight();
+ Size const aOutSz = GetOutputSize();
+ long const nLineHeight = GetTextHeight();
- ModulWindowLayout* pModulWindowLayout = dynamic_cast<ModulWindowLayout*>(pModulWindow->GetLayoutWindow());
- Image aMarker(pModulWindowLayout->getImage(bErrorMarker ? IMGID_ERRORMARKER : IMGID_STEPMARKER));
+ Image aMarker = GetImage(bErrorMarker ? IMGID_ERRORMARKER : IMGID_STEPMARKER);
Size aMarkerSz( aMarker.GetSizePixel() );
aMarkerSz = PixelToLogic( aMarkerSz );
@@ -1082,7 +1072,7 @@ void BreakPointWindow::MouseButtonDown( const MouseEvent& rMEvt )
long nLineHeight = GetTextHeight();
long nYPos = aMousePos.Y() + nCurYOffset;
long nLine = nYPos / nLineHeight + 1;
- pModulWindow->ToggleBreakPoint( (sal_uLong)nLine );
+ rModulWindow.ToggleBreakPoint( (sal_uLong)nLine );
Invalidate();
}
}
@@ -1106,7 +1096,7 @@ void BreakPointWindow::Command( const CommandEvent& rCEvt )
case RID_ACTIV:
{
pBrk->bEnabled = !pBrk->bEnabled;
- pModulWindow->UpdateBreakPoint( *pBrk );
+ rModulWindow.UpdateBreakPoint( *pBrk );
Invalidate();
}
break;
@@ -1139,7 +1129,7 @@ void BreakPointWindow::Command( const CommandEvent& rCEvt )
bool BreakPointWindow::SyncYOffset()
{
- TextView* pView = pModulWindow->GetEditView();
+ TextView* pView = rModulWindow.GetEditView();
if ( pView )
{
long nViewYOffset = pView->GetStartDocPos().Y();
@@ -1176,12 +1166,20 @@ void BreakPointWindow::setBackgroundColor(Color aColor)
}
-const sal_uInt16 ITEM_ID_VARIABLE = 1;
-const sal_uInt16 ITEM_ID_VALUE = 2;
-const sal_uInt16 ITEM_ID_TYPE = 3;
+//
+// WatchWindow
+// ===========
+//
-WatchWindow::WatchWindow( Window* pParent ) :
- BasicDockingWindow( pParent ),
+namespace
+{
+ const sal_uInt16 ITEM_ID_VARIABLE = 1;
+ const sal_uInt16 ITEM_ID_VALUE = 2;
+ const sal_uInt16 ITEM_ID_TYPE = 3;
+}
+
+WatchWindow::WatchWindow (Layout* pParent) :
+ BasicDockingWindow(pParent),
aWatchStr( IDEResId( RID_STR_REMOVEWATCH ) ),
aXEdit( this, IDEResId( RID_EDT_WATCHEDIT ) ),
aRemoveWatchButton( this, IDEResId( RID_IMGBTN_REMOVEWATCH ) ),
@@ -1406,6 +1404,8 @@ void WatchWindow::AddWatch( const String& rVName )
aTreeListBox.Select(pNewEntry, true);
aTreeListBox.MakeVisible(pNewEntry);
aRemoveWatchButton.Enable();
+
+ UpdateWatches();
}
bool WatchWindow::RemoveSelectedWatch()
@@ -1503,7 +1503,6 @@ IMPL_LINK( WatchWindow, EditAccHdl, Accelerator *, pAcc )
{
AddWatch( aCurText );
aXEdit.SetSelection( Selection( 0, 0xFFFF ) );
- UpdateWatches();
}
}
break;
@@ -1523,8 +1522,13 @@ void WatchWindow::UpdateWatches( bool bBasicStopped )
}
-StackWindow::StackWindow( Window* pParent ) :
- BasicDockingWindow( pParent ),
+//
+// StackWindow
+// ===========
+//
+
+StackWindow::StackWindow (Layout* pParent) :
+ BasicDockingWindow(pParent),
aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP ),
aStackStr( IDEResId( RID_STR_STACK ) )
{
@@ -1642,17 +1646,19 @@ void StackWindow::UpdateCalls()
aTreeListBox.SetUpdateMode(true);
}
+
+//
+// ComplexEditorWindow
+// ===================
+//
+
ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
Window( pParent, WB_3DLOOK | WB_CLIPCHILDREN ),
- aBrkWindow( this ),
- aLineNumberWindow( this, pParent ),
- aEdtWindow( this ),
- aEWVScrollBar( this, WB_VSCROLL | WB_DRAG ),
- bLineNumberDisplay(false),
- bObjectCatalogDisplay(true)
-{
- aEdtWindow.SetModulWindow( pParent );
- aBrkWindow.SetModulWindow( pParent );
+ aBrkWindow(this, pParent),
+ aLineNumberWindow(this, pParent),
+ aEdtWindow(this, pParent),
+ aEWVScrollBar( this, WB_VSCROLL | WB_DRAG )
+{
aEdtWindow.Show();
aBrkWindow.Show();
@@ -1675,7 +1681,7 @@ void ComplexEditorWindow::Resize()
Size aLnSz(aLineNumberWindow.GetWidth(), aSz.Height());
- if(bLineNumberDisplay)
+ if (aLineNumberWindow.IsVisible())
{
aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
aLineNumberWindow.SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aLnSz);
@@ -1726,18 +1732,7 @@ void ComplexEditorWindow::DataChanged(DataChangedEvent const & rDCEvt)
void ComplexEditorWindow::SetLineNumberDisplay(bool b)
{
- bLineNumberDisplay = b;
- Resize();
-
- if(b)
- aLineNumberWindow.Show();
- else
- aLineNumberWindow.Hide();
-}
-
-void ComplexEditorWindow::SetObjectCatalogDisplay(bool b)
-{
- bObjectCatalogDisplay = b;
+ aLineNumberWindow.Show(b);
Resize();
}
@@ -1758,6 +1753,12 @@ EditorWindow::GetComponentInterface(sal_Bool bCreate)
return xPeer;
}
+
+//
+// WatchTreeListBox
+// ================
+//
+
WatchTreeListBox::WatchTreeListBox( Window* pParent, WinBits nWinBits )
: SvHeaderTabListBox( pParent, nWinBits )
{}
@@ -2251,4 +2252,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
setBasicWatchMode( false );
}
+
+} // namespace basctl
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index adf4581..951b5be 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -32,6 +32,7 @@
#include "idetemp.hxx"
#include "localizationmgr.hxx"
#include "propbrw.hxx"
+#include "objdlg.hxx"
#include <basic/basmgr.hxx>
#include <com/sun/star/resource/StringResourceWithLocation.hpp>
@@ -46,6 +47,7 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/request.hxx>
#include <svl/aeitem.hxx>
+#include <svl/visitem.hxx>
#include <svl/whiter.hxx>
#include <tools/diagnose_ex.h>
#include <tools/urlobj.hxx>
@@ -59,6 +61,9 @@ using namespace ::com::sun::star::io;
using namespace ::com::sun::star::resource;
using namespace ::com::sun::star::ui::dialogs;
+namespace basctl
+{
+
#if defined(UNX)
#define FILTERMASK_ALL "*"
#else
@@ -69,10 +74,15 @@ DBG_NAME( DialogWindow )
TYPEINIT1( DialogWindow, IDEBaseWindow );
-DialogWindow::DialogWindow( Window* pParent, const ScriptDocument& rDocument, ::rtl::OUString aLibName, ::rtl::OUString aName,
- const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xDialogModel )
- :IDEBaseWindow( pParent, rDocument, aLibName, aName )
- ,pUndoMgr(NULL)
+DialogWindow::DialogWindow (
+ DialogWindowLayout* pParent,
+ ScriptDocument const& rDocument,
+ rtl::OUString aLibName, rtl::OUString aName,
+ com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> const& xDialogModel
+) :
+ IDEBaseWindow(pParent, rDocument, aLibName, aName),
+ rLayout(*pParent),
+ pUndoMgr(0)
{
InitSettings( true, true, true );
@@ -395,12 +405,19 @@ void DialogWindow::GetState( SfxItemSet& rSet )
rSet.DisableItem( nWh );
}
break;
+ 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
+ rSet.DisableItem(nWh);
+ rSet.Put(SfxVisibilityItem(nWh, false));
+ break;
+ }
}
}
}
-
-
void DialogWindow::ExecuteCommand( SfxRequest& rReq )
{
switch ( rReq.GetSlot() )
@@ -647,6 +664,17 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq )
case SID_IMPORT_DIALOG:
ImportDialog();
break;
+
+ case SID_BASICIDE_DELETECURRENT:
+ if (QueryDelDialog(m_aName, this))
+ {
+ if (BasicIDE::RemoveDialog(m_aDocument, m_aLibName, m_aName))
+ {
+ BasicIDE::MarkDocumentModified(m_aDocument);
+ BasicIDEGlobals::GetShell()->RemoveWindow(this, true);
+ }
+ }
+ break;
}
rReq.Done();
@@ -865,6 +893,9 @@ bool DialogWindow::SaveDialog()
return bDone;
}
+} // namespace basctl
+
+
extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft,
const ::com::sun::star::lang::Locale& rLocaleRight );
@@ -952,6 +983,7 @@ LanguageMismatchQueryBox::LanguageMismatchQueryBox( Window* pParent,
SetImage( QueryBox::GetStandardImage() );
}
+
bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName )
{
bool bDone = false;
@@ -1239,7 +1271,7 @@ bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const Scri
bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP );
if( bSuccess )
{
- DialogWindow* pNewDlgWin = pIDEShell->CreateDlgWin( rDocument, aLibName, aNewDlgName );
+ basctl::DialogWindow* pNewDlgWin = pIDEShell->CreateDlgWin( rDocument, aLibName, aNewDlgName );
pIDEShell->SetCurWindow( pNewDlgWin, true );
}
@@ -1252,6 +1284,10 @@ bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const Scri
return bDone;
}
+
+namespace basctl
+{
+
bool DialogWindow::ImportDialog()
{
DBG_CHKTHIS( DialogWindow, 0 );
@@ -1348,10 +1384,18 @@ void DialogWindow::StoreData()
}
}
+void DialogWindow::Activating ()
+{
+ UpdateBrowser();
+ Show();
+}
+
void DialogWindow::Deactivating()
{
+ Hide();
if ( IsModified() )
BasicIDE::MarkDocumentModified( GetDocument() );
+ DisableBrowser();
}
sal_Int32 DialogWindow::countPages( Printer* pPrinter )
@@ -1400,4 +1444,60 @@ void DialogWindow::InitSettings(bool bFont, bool bForeground, bool bBackground)
return (::com::sun::star::accessibility::XAccessible*) new AccessibleDialogWindow( this );
}
+char const* DialogWindow::GetHid () const
+{
+ return HID_BASICIDE_DIALOGWINDOW;
+}
+BasicIDEType DialogWindow::GetType () const
+{
+ return BASICIDE_TYPE_DIALOG;
+}
+
+
+//
+// DialogWindowLayout
+// ==================
+//
+
+DialogWindowLayout::DialogWindowLayout (Window* pParent, ObjectCatalog& rObjectCatalog_) :
+ Layout(pParent),
+ pChild(0),
+ rObjectCatalog(rObjectCatalog_)
+{ }
+
+void DialogWindowLayout::Activating (IDEBaseWindow& rChild)
+{
+ assert(dynamic_cast<DialogWindow*>(&rChild));
+ pChild = &static_cast<DialogWindow&>(rChild);
+ rObjectCatalog.SetLayoutWindow(this);
+ rObjectCatalog.UpdateEntries();
+ rObjectCatalog.Show();
+ Layout::Activating(rChild);
+}
+
+void DialogWindowLayout::Deactivating ()
+{
+ Layout::Deactivating();
+ rObjectCatalog.Hide();
+ pChild = 0;
+}
+
+void DialogWindowLayout::GetState (SfxItemSet& rSet, unsigned nWhich)
+{
+ switch (nWhich)
+ {
+ case SID_BASICIDE_CHOOSEMACRO:
+ rSet.Put(SfxVisibilityItem(nWhich, false));
+ break;
+ }
+}
+
+void DialogWindowLayout::OnFirstSize (int const nWidth, int const nHeight)
+{
+ AddToLeft(&rObjectCatalog, Size(nWidth * 0.2, nHeight));
+}
+
+
+} // namespace basctl
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 97447f4..841c4bc 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -30,7 +30,6 @@
#include "iderdll2.hxx"
#include "localizationmgr.hxx"
#include "managelang.hxx"
-#include "moduldlg.hxx"
#include <basic/basmgr.hxx>
#include <basic/sbmeth.hxx>
@@ -57,18 +56,10 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::frame;
-// 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();
-}
+using basctl::ModulWindow;
+using basctl::ModulWindowLayout;
+using basctl::DialogWindow;
+using basctl::DialogWindowLayout;
void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
{
@@ -77,214 +68,135 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
switch ( rReq.GetSlot() )
{
- case SID_SHOWLINES:
- {
- SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), false);
- bool const bValue = pItem && pItem->GetValue();
- lcl_GetSourceLinesEnabledValue() = bValue;
- if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin))
- pMCurWin->SetLineNumberDisplay(bValue);
- }
- break;
-
case SID_BASICIDE_HIDECURPAGE:
{
pCurWin->StoreData();
RemoveWindow( pCurWin, false );
}
break;
- case SID_BASICIDE_DELETECURRENT:
+ case SID_BASICIDE_RENAMECURRENT:
{
- ScriptDocument aDocument( pCurWin->GetDocument() );
- ::rtl::OUString aLibName = pCurWin->GetLibName();
- ::rtl::OUString aName = pCurWin->GetName();
-
- if (dynamic_cast<ModulWindow*>(pCurWin))
+ pTabBar->StartEditMode( pTabBar->GetCurPageId() );
+ }
+ break;
+ case FID_SEARCH_NOW:
+ {
+ if (!pCurWin->HasActiveEditor())
+ break;
+ DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
+ SfxItemSet const& rArgs = *rReq.GetArgs();
+ // unfortunately I don't know the ID:
+ sal_uInt16 nWhich = rArgs.GetWhichByPos( 0 );
+ DBG_ASSERT( nWhich, "Wich fuer SearchItem ?" );
+ SfxPoolItem const& rItem = rArgs.Get(nWhich);
+ DBG_ASSERT(dynamic_cast<SvxSearchItem const*>(&rItem), "no searchitem!");
+ SvxSearchItem const& rSearchItem = static_cast<SvxSearchItem const&>(rItem);
+ // memorize item because of the adjustments...
+ BasicIDEGlobals::GetExtraData()->SetSearchItem(rSearchItem);
+ sal_Int32 nFound = 0;
+ bool bCanceled = false;
+ if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL)
{
- if ( QueryDelModule( aName, pCurWin ) )
+ sal_uInt16 nActModWindows = 0;
+ for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it)
{
- if ( aDocument.removeModule( aLibName, aName ) )
- {
- BasicIDE::MarkDocumentModified( aDocument );
- }
+ IDEBaseWindow* pWin = it->second;
+ if (pWin->HasActiveEditor())
+ nActModWindows++;
}
- }
- else
- {
- if ( QueryDelDialog( aName, pCurWin ) )
+
+ if ( nActModWindows <= 1 || ( !rSearchItem.GetSelection() && QueryBox( pCurWin, WB_YES_NO|WB_DEF_YES, String(IDEResId(RID_STR_SEARCHALLMODULES)) ).Execute() == RET_YES ) )
{
- if ( BasicIDE::RemoveDialog( aDocument, aLibName, aName ) )
+ for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it)
{
- RemoveWindow( pCurWin, true );
- BasicIDE::MarkDocumentModified( aDocument );
+ IDEBaseWindow* pWin = it->second;
+ nFound += pWin->StartSearchAndReplace(rSearchItem);
}
}
+ else
+ nFound = pCurWin->StartSearchAndReplace(rSearchItem);
+
+ rtl::OUString aReplStr(IDE_RESSTR(RID_STR_SEARCHREPLACES));
+ aReplStr = aReplStr.replaceAll("XX", rtl::OUString::valueOf(nFound));
+ InfoBox( pCurWin, aReplStr ).Execute();
}
- }
- break;
- case SID_BASICIDE_RENAMECURRENT:
- {
- pTabBar->StartEditMode( pTabBar->GetCurPageId() );
- }
- break;
- case FID_SEARCH_NOW:
- {
- if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin))
+ else
{
- DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
- const SfxItemSet* pArgs = rReq.GetArgs();
- // unfortunately I don't know the ID:
- sal_uInt16 nWhich = pArgs->GetWhichByPos( 0 );
- DBG_ASSERT( nWhich, "Wich fuer SearchItem ?" );
- const SfxPoolItem& rItem = pArgs->Get( nWhich );
- IDEWindowTable::const_iterator it;
- if (SvxSearchItem const* pSearchItem = dynamic_cast<SvxSearchItem const*>(&rItem))
+ nFound = pCurWin->StartSearchAndReplace(rSearchItem);
+ if ( !nFound && !rSearchItem.GetSelection() )
{
- // memorize item because of the adjustments...
- BasicIDEGlobals::GetExtraData()->SetSearchItem(*pSearchItem);
- sal_Int32 nFound = 0;
- bool bCanceled = false;
- if (pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL)
+ // search other modules...
+ bool bChangeCurWindow = false;
+ WindowTableIt it;
+ for (it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it)
+ if (it->second == pCurWin)
+ break;
+ if (it != aIDEWindowTable.end())
+ ++it;
+ IDEBaseWindow* pWin = it != aIDEWindowTable.end() ? it->second : 0;
+
+ bool bSearchedFromStart = false;
+ while ( !nFound && !bCanceled && ( pWin || !bSearchedFromStart ) )
{
- sal_uInt16 nActModWindows = 0;
- for( it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it )
+ if ( !pWin )
{
- IDEBaseWindow* pWin = it->second;
- if (!pWin->IsSuspended() && dynamic_cast<ModulWindow*>(pWin))
- nActModWindows++;
+ SfxViewFrame* pViewFrame = GetViewFrame();
+ SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SEARCH_DLG ) : NULL;
+ Window* pParent = pChildWin ? pChildWin->GetWindow() : NULL;
+ QueryBox aQuery(pParent, WB_YES_NO|WB_DEF_YES, IDE_RESSTR(RID_STR_SEARCHFROMSTART));
+ if ( aQuery.Execute() == RET_YES )
+ {
+ it = aIDEWindowTable.begin();
+ if ( it != aIDEWindowTable.end() )
+ pWin = it->second;
+ bSearchedFromStart = true;
+ }
+ else
+ bCanceled = true;
}
- if ( ( nActModWindows <= 1 ) || ( !pSearchItem->GetSelection() && QueryBox( pCurWin, WB_YES_NO|WB_DEF_YES, String( IDEResId( RID_STR_SEARCHALLMODULES ) ) ).Execute() == RET_YES ) )
+ if (pWin && pWin->HasActiveEditor())
{
- for( it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it )
+ if ( pWin != pCurWin )
{
- IDEBaseWindow* pWin = it->second;
- if (!pWin->IsSuspended())
- if (ModulWindow* pMWin = dynamic_cast<ModulWindow*>(pWin))
- nFound += pMWin->StartSearchAndReplace(*pSearchItem);
+ if ( pCurWin )
+ pWin->SetSizePixel( pCurWin->GetSizePixel() );
+ nFound = pWin->StartSearchAndReplace(rSearchItem, true);
+ }
+ if ( nFound )
+ {
+ bChangeCurWindow = true;
+ break;
}
}
- else
- nFound = pMCurWin->StartSearchAndReplace(*pSearchItem);
-
- ::rtl::OUString aReplStr(IDE_RESSTR(RID_STR_SEARCHREPLACES));
- aReplStr = aReplStr.replaceAll("XX", rtl::OUString::valueOf(nFound));
- InfoBox( pCurWin, aReplStr ).Execute();
- }
- else
- {
- nFound = pMCurWin->StartSearchAndReplace(*pSearchItem);
- if ( !nFound && !pSearchItem->GetSelection() )
+ if ( pWin && ( pWin != pCurWin ) )
{
- // search other modules...
- bool bChangeCurWindow = false;
- for( it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it )
- if ( it->second == pCurWin)
- break;
if ( it != aIDEWindowTable.end() )
++it;
- IDEBaseWindow* pWin = NULL;
- if ( it != aIDEWindowTable.end() )
- pWin = it->second;
-
- bool bSearchedFromStart = false;
- while ( !nFound && !bCanceled && ( pWin || !bSearchedFromStart ) )
- {
- if ( !pWin )
- {
- SfxViewFrame* pViewFrame = GetViewFrame();
- SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SEARCH_DLG ) : NULL;
- Window* pParent = pChildWin ? pChildWin->GetWindow() : NULL;
- QueryBox aQuery(pParent, WB_YES_NO|WB_DEF_YES, IDE_RESSTR(RID_STR_SEARCHFROMSTART));
- if ( aQuery.Execute() == RET_YES )
- {
- it = aIDEWindowTable.begin();
- if ( it != aIDEWindowTable.end() )
- pWin = it->second;
- bSearchedFromStart = true;
- }
- else
- bCanceled = true;
- }
-
- if (ModulWindow* pMWin = dynamic_cast<ModulWindow*>(pWin))
- if (!pWin->IsSuspended())
- {
- if ( pWin != pCurWin )
- {
- if ( pCurWin )
- pWin->SetSizePixel( pCurWin->GetSizePixel() );
- nFound = pMWin->StartSearchAndReplace(*pSearchItem, true);
- }
- if ( nFound )
- {
- bChangeCurWindow = true;
- break;
- }
- }
- if ( pWin && ( pWin != pCurWin ) )
- {
- if ( it != aIDEWindowTable.end() )
- ++it;
- if ( it != aIDEWindowTable.end() )
- pWin = it->second;
- else
- pWin = 0;
- }
- else
- pWin = 0;
- }
- if ( !nFound && bSearchedFromStart )
- nFound = pMCurWin->StartSearchAndReplace(*pSearchItem, true);
- if ( bChangeCurWindow )
- SetCurWindow( pWin, true );
+ pWin = it != aIDEWindowTable.end() ? it->second : 0;
}
- if ( !nFound && !bCanceled )
- InfoBox( pCurWin, String( IDEResId( RID_STR_SEARCHNOTFOUND ) ) ).Execute();
+ else
+ pWin = 0;
}
-
- rReq.Done();
+ if ( !nFound && bSearchedFromStart )
+ nFound = pCurWin->StartSearchAndReplace(rSearchItem, true);
+ if ( bChangeCurWindow )
+ SetCurWindow( pWin, true );
}
- else
- DBG_ASSERT(false, "no searchitem!");
+ if ( !nFound && !bCanceled )
+ InfoBox( pCurWin, String(IDEResId(RID_STR_SEARCHNOTFOUND)) ).Execute();
}
- }
- break;
- case FID_SEARCH_OFF:
- {
- if (dynamic_cast<ModulWindow*>(pCurWin))
- pCurWin->GrabFocus();
+
+ rReq.Done();
}
break;
case SID_UNDO:
case SID_REDO:
- {
if ( GetUndoManager() && pCurWin->AllowUndo() )
- {
GetViewFrame()->ExecuteSlot( rReq );
- }
- }
- break;
- case SID_GOTOLINE:
- {
- if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin))
- {
- std::auto_ptr< GotoLineDialog > xGotoDlg( new GotoLineDialog( pCurWin ) );
- if ( xGotoDlg->Execute() )
- {
- rtl::OUString sText = xGotoDlg->GetText();
-
- sal_Int32 nLine = xGotoDlg->GetLineNumber();
-
- if ( nLine )
- pMCurWin->GetEditView()->SetSelection( TextSelection( TextPaM( nLine - 1 , 0 ), TextPaM( nLine - 1, 0 ) ) );
- }
- }
- }
+ break;
default:
- {
pCurWin->ExecuteCommand( rReq );
- }
}
}
@@ -350,22 +262,6 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
}
}
break;
- case SID_SIGNATURE:
- {
- if ( pCurWin )
- {
- ::basctl::DocumentSignature aSignature( pCurWin->GetDocument() );
- if ( aSignature.supportsSignatures() )
- {
- aSignature.signScriptingContent();
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_SIGNATURE );
- }
- }
- }
- break;
-
case SID_BASICIDE_MODULEDLG:
{
if ( rReq.GetArgs() )
@@ -441,10 +337,13 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
break;
case SID_BASICIDE_OBJCAT:
- pModulLayout->ToggleObjectCatalog();
+ // toggling object catalog
+ aObjectCatalog.Show(!aObjectCatalog.IsVisible());
+ if (pLayout)
+ pLayout->ArrangeWindows();
// refresh the button state
if (SfxBindings* pBindings = BasicIDE::GetBindingsPtr())
- pBindings->Invalidate(nSlot);
+ pBindings->Invalidate(SID_BASICIDE_OBJCAT);
break;
case SID_BASICIDE_NAMECHANGEDONTAB:
@@ -519,7 +418,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
case SID_BASICIDE_STOREALLMODULESOURCES:
case SID_BASICIDE_UPDATEALLMODULESOURCES:
{
- for( IDEWindowTable::const_iterator it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it )
+ for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it)
{
IDEBaseWindow* pWin = it->second;
if (!pWin->IsSuspended() && dynamic_cast<ModulWindow*>(pWin))
@@ -793,11 +692,18 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
case SID_BASICIDE_MANAGE_LANG:
{
- ManageLanguageDialog aDlg( GetCurWindow(), GetCurLocalizationMgr() );
+ ManageLanguageDialog aDlg(pCurWin, m_pCurLocalizationMgr);
aDlg.Execute();
rReq.Done();
}
break;
+
+ default:
+ if (pLayout)
+ pLayout->ExecuteGlobal(rReq);
+ if (pCurWin)
+ pCurWin->ExecuteGlobal(rReq);
+ break;
}
}
@@ -808,20 +714,6 @@ 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 && !dynamic_cast<ModulWindow*>(pCurWin))
- {
- rSet.DisableItem( nWh );
- rSet.Put(SfxVisibilityItem(nWh, false));
- }
- else
- rSet.Put( SfxBoolItem( nWh, lcl_GetSourceLinesEnabledValue() ) );
- break;
- }
case SID_DOCINFO:
{
rSet.DisableItem( nWh );
@@ -872,25 +764,12 @@ void BasicIDEShell::GetState(SfxItemSet &rSet)
rSet.DisableItem( nWh );
}
break;
- case SID_BASICIDE_CHOOSEMACRO:
case SID_BASICIDE_OBJCAT:
- {
- // FIXME: hide Object Catalog icon from the toolbar,
- // when window type is not macro editor.
- if(pCurWin && !dynamic_cast<ModulWindow*>(pCurWin))
- {
- rSet.DisableItem( nWh );
- rSet.Put(SfxVisibilityItem(nWh, false));
- }
+ if (pLayout)
+ rSet.Put(SfxBoolItem(nWh, aObjectCatalog.IsVisible()));
else
- {
- if (nWh == SID_BASICIDE_OBJCAT)
- rSet.Put(SfxBoolItem(nWh, pModulLayout && pModulLayout->HasObjectCatalog()));
- else
- rSet.Put(SfxVisibilityItem(nWh, true));
- }
+ rSet.Put(SfxVisibilityItem(nWh, false));
break;
- }
case SID_BASICIDE_SHOWSBX:
case SID_BASICIDE_CREATEMACRO:
case SID_BASICIDE_EDITMACRO:
@@ -1098,6 +977,9 @@ void BasicIDEShell::GetState(SfxItemSet &rSet)
}
break;
}
+ default:
+ if (pLayout)
+ pLayout->GetState(rSet, nWh);
}
}
if ( pCurWin )
@@ -1120,67 +1002,25 @@ sal_Bool BasicIDEShell::HasUIFeature( sal_uInt32 nFeature )
void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, bool bUpdateTabBar, bool bRememberAsCurrent )
{
- // an EditWindow must be set at Sfx for resizing...
- if ( !pNewWin && ( GetWindow() != pModulLayout ) )
- {
- pModulLayout->Show();
- AdjustPosSizePixel( Point( 0, 0 ), GetViewFrame()->GetWindow().GetOutputSizePixel() );
- SetWindow( pModulLayout );
- EnableScrollbars( false );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list