2010-10-12 15:57:08 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-12 17:02:47 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2011-11-21 23:33:54 -05:00
|
|
|
#include "baside2.hxx"
|
|
|
|
#include "brkdlg.hxx"
|
|
|
|
#include "iderdll.hxx"
|
|
|
|
#include "iderdll2.hxx"
|
2012-03-11 21:40:02 +01:00
|
|
|
#include "objdlg.hxx"
|
2012-08-17 07:29:20 +02:00
|
|
|
#include "moduldlg.hxx"
|
|
|
|
#include "docsignature.hxx"
|
2011-11-21 23:33:54 -05:00
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
#include "helpid.hrc"
|
2011-11-21 23:33:54 -05:00
|
|
|
#include "baside2.hrc"
|
|
|
|
|
2012-06-29 08:30:14 +02:00
|
|
|
#include <basic/basmgr.hxx>
|
2011-11-21 23:33:54 -05:00
|
|
|
#include <basic/basrdll.hxx>
|
2012-06-29 08:30:14 +02:00
|
|
|
#include <basic/sbmeth.hxx>
|
2011-11-21 23:33:54 -05:00
|
|
|
#include <com/sun/star/script/ModuleType.hpp>
|
|
|
|
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
|
|
|
|
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
|
2013-02-12 09:23:05 +02:00
|
|
|
#include <com/sun/star/ui/dialogs/FilePicker.hpp>
|
2001-07-05 08:20:52 +00:00
|
|
|
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
|
2001-07-03 15:33:31 +00:00
|
|
|
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
|
2011-11-21 23:33:54 -05:00
|
|
|
#include <comphelper/processfactory.hxx>
|
2012-10-30 00:00:51 +00:00
|
|
|
#include <comphelper/string.hxx>
|
2012-06-29 08:30:14 +02:00
|
|
|
#include <sfx2/dinfdlg.hxx>
|
|
|
|
#include <sfx2/dispatch.hxx>
|
2000-09-29 10:02:42 +00:00
|
|
|
#include <sfx2/docfile.hxx>
|
2012-06-29 08:30:14 +02:00
|
|
|
#include <sfx2/printer.hxx>
|
|
|
|
#include <sfx2/request.hxx>
|
|
|
|
#include <svl/aeitem.hxx>
|
|
|
|
#include <svl/srchitem.hxx>
|
2012-08-17 07:29:20 +02:00
|
|
|
#include <svl/visitem.hxx>
|
2012-06-29 08:30:14 +02:00
|
|
|
#include <svl/whiter.hxx>
|
2012-08-06 20:52:37 +02:00
|
|
|
#include <vcl/xtextedt.hxx>
|
2011-11-21 23:33:54 -05:00
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
|
|
|
#include <vcl/msgbox.hxx>
|
2012-08-17 07:29:20 +02:00
|
|
|
#include <cassert>
|
2013-07-23 12:42:37 +02:00
|
|
|
#include <basic/codecompletecache.hxx>
|
|
|
|
#include <svtools/miscopt.hxx>
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
namespace basctl
|
|
|
|
{
|
2001-11-09 14:41:40 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace Print
|
|
|
|
{
|
2012-09-07 10:31:53 +02:00
|
|
|
long const nLeftMargin = 1700;
|
|
|
|
long const nRightMargin = 900;
|
|
|
|
long const nTopMargin = 2000;
|
|
|
|
long const nBottomMargin = 1000;
|
|
|
|
long const nBorder = 300;
|
2012-09-02 16:21:08 +02:00
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
short const ValidWindow = 0x1234;
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2007-08-03 08:57:30 +00:00
|
|
|
#if defined(OW) || defined(MTF)
|
2012-09-02 16:21:08 +02:00
|
|
|
char const FilterMask_All[] = "*";
|
2000-09-29 10:02:42 +00:00
|
|
|
#else
|
2012-09-02 16:21:08 +02:00
|
|
|
char const FilterMask_All[] = "*.*";
|
2000-09-29 10:02:42 +00:00
|
|
|
#endif
|
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
} // namespace
|
|
|
|
|
2001-05-21 08:57:57 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
2001-07-03 15:33:31 +00:00
|
|
|
using namespace ::com::sun::star::ui::dialogs;
|
2000-11-21 16:58:31 +00:00
|
|
|
using namespace utl;
|
2001-05-21 08:57:57 +00:00
|
|
|
using namespace comphelper;
|
|
|
|
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2007-01-19 07:43:06 +00:00
|
|
|
DBG_NAME( ModulWindow )
|
2000-09-29 10:02:42 +00:00
|
|
|
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
TYPEINIT1( ModulWindow , BaseWindow );
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
2012-10-01 13:03:37 -03:00
|
|
|
void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage, const OUString& rTitle, bool bOutput )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
Size const aSz = pPrinter->GetOutputSize();
|
2000-09-29 10:02:42 +00:00
|
|
|
|
|
|
|
const Color aOldLineColor( pPrinter->GetLineColor() );
|
|
|
|
const Color aOldFillColor( pPrinter->GetFillColor() );
|
|
|
|
const Font aOldFont( pPrinter->GetFont() );
|
|
|
|
|
|
|
|
pPrinter->SetLineColor( Color( COL_BLACK ) );
|
|
|
|
pPrinter->SetFillColor();
|
|
|
|
|
|
|
|
Font aFont( aOldFont );
|
|
|
|
aFont.SetWeight( WEIGHT_BOLD );
|
|
|
|
aFont.SetAlign( ALIGN_BOTTOM );
|
|
|
|
pPrinter->SetFont( aFont );
|
|
|
|
|
|
|
|
long nFontHeight = pPrinter->GetTextHeight();
|
|
|
|
|
2011-08-22 11:39:37 +02:00
|
|
|
// 1st Border => line, 2+3 Border = free space
|
2012-09-02 16:21:08 +02:00
|
|
|
long nYTop = Print::nTopMargin - 3*Print::nBorder - nFontHeight;
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
long nXLeft = Print::nLeftMargin - Print::nBorder;
|
|
|
|
long nXRight = aSz.Width() - Print::nRightMargin + Print::nBorder;
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2009-05-19 11:32:44 +00:00
|
|
|
if( bOutput )
|
2012-09-02 16:21:08 +02:00
|
|
|
pPrinter->DrawRect(Rectangle(
|
|
|
|
Point(nXLeft, nYTop),
|
|
|
|
Size(nXRight - nXLeft, aSz.Height() - nYTop - Print::nBottomMargin + Print::nBorder)
|
|
|
|
));
|
2000-09-29 10:02:42 +00:00
|
|
|
|
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
long nY = Print::nTopMargin - 2*Print::nBorder;
|
|
|
|
Point aPos(Print::nLeftMargin, nY);
|
2009-05-19 11:32:44 +00:00
|
|
|
if( bOutput )
|
|
|
|
pPrinter->DrawText( aPos, rTitle );
|
2000-09-29 10:02:42 +00:00
|
|
|
if ( nPages != 1 )
|
|
|
|
{
|
|
|
|
aFont.SetWeight( WEIGHT_NORMAL );
|
|
|
|
pPrinter->SetFont( aFont );
|
|
|
|
aPos.X() += pPrinter->GetTextWidth( rTitle );
|
2011-12-05 00:47:35 -05:00
|
|
|
|
2009-05-19 11:32:44 +00:00
|
|
|
if( bOutput )
|
2011-12-05 00:47:35 -05:00
|
|
|
{
|
2013-08-21 15:07:31 +02:00
|
|
|
OUString aPageStr = " [" + IDE_RESSTR(RID_STR_PAGE) + " " + OUString::number( nCurPage ) + "]";
|
2012-12-26 14:44:52 -02:00
|
|
|
pPrinter->DrawText( aPos, aPageStr );
|
2011-12-05 00:47:35 -05:00
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
nY = Print::nTopMargin - Print::nBorder;
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2009-05-19 11:32:44 +00:00
|
|
|
if( bOutput )
|
|
|
|
pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) );
|
2000-09-29 10:02:42 +00:00
|
|
|
|
|
|
|
pPrinter->SetFont( aOldFont );
|
|
|
|
pPrinter->SetFillColor( aOldFillColor );
|
|
|
|
pPrinter->SetLineColor( aOldLineColor );
|
|
|
|
}
|
|
|
|
|
2013-01-20 10:51:58 +01:00
|
|
|
void lcl_ConvertTabsToSpaces( OUString& rLine )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2013-01-20 10:51:58 +01:00
|
|
|
if ( !rLine.isEmpty() )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2013-01-20 10:51:58 +01:00
|
|
|
OUStringBuffer aResult( rLine );
|
|
|
|
sal_Int32 nPos = 0;
|
|
|
|
sal_Int32 nMax = aResult.getLength();
|
2000-09-29 10:02:42 +00:00
|
|
|
while ( nPos < nMax )
|
|
|
|
{
|
2013-01-20 10:51:58 +01:00
|
|
|
if ( aResult[nPos] == '\t' )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2011-08-22 11:39:37 +02:00
|
|
|
// not 4 Blanks, but at 4 TabPos:
|
2013-01-20 10:51:58 +01:00
|
|
|
OUStringBuffer aBlanker;
|
2012-10-30 00:00:51 +00:00
|
|
|
string::padToLength(aBlanker, ( 4 - ( nPos % 4 ) ), ' ');
|
2013-01-20 10:51:58 +01:00
|
|
|
aResult.remove( nPos, 1 );
|
|
|
|
aResult.insert( nPos, aBlanker.makeStringAndClear() );
|
|
|
|
nMax = aResult.getLength();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
2012-10-30 00:00:51 +00:00
|
|
|
++nPos;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
2013-01-20 10:51:58 +01:00
|
|
|
rLine = aResult.makeStringAndClear();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
// 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,
|
2012-10-01 13:03:37 -03:00
|
|
|
OUString aLibName, OUString aName, OUString& aModule
|
2012-08-17 07:29:20 +02:00
|
|
|
) :
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
BaseWindow(pParent, rDocument, aLibName, aName),
|
2012-08-17 07:29:20 +02:00
|
|
|
rLayout(*pParent),
|
2012-09-02 16:21:08 +02:00
|
|
|
nValid(ValidWindow),
|
2012-08-17 07:29:20 +02:00
|
|
|
aXEditorWindow(this),
|
|
|
|
m_aModule(aModule)
|
2001-06-28 14:26:41 +00:00
|
|
|
{
|
|
|
|
DBG_CTOR( ModulWindow, 0 );
|
|
|
|
aXEditorWindow.Show();
|
2010-03-03 19:59:09 +00:00
|
|
|
SetBackground();
|
|
|
|
}
|
|
|
|
|
|
|
|
SbModuleRef ModulWindow::XModule()
|
|
|
|
{
|
2010-04-08 16:36:31 +01:00
|
|
|
// ModuleWindows can now be created as a result of the
|
|
|
|
// modules getting created via the api. This is a result of an
|
|
|
|
// elementInserted event from the BasicLibrary container.
|
|
|
|
// However the SbModule is also created from a different listener to
|
|
|
|
// the same event ( in basmgr ) Therefore it is possible when we look
|
|
|
|
// for xModule it may not yet be available, here we keep tring to access
|
|
|
|
// the module until such time as it exists
|
|
|
|
|
2010-03-03 19:59:09 +00:00
|
|
|
if ( !xModule.Is() )
|
2004-07-23 11:01:17 +00:00
|
|
|
{
|
2010-03-03 19:59:09 +00:00
|
|
|
BasicManager* pBasMgr = GetDocument().getBasicManager();
|
|
|
|
if ( pBasMgr )
|
2004-07-23 11:01:17 +00:00
|
|
|
{
|
2010-03-03 19:59:09 +00:00
|
|
|
StarBASIC* pBasic = pBasMgr->GetLib( GetLibName() );
|
|
|
|
if ( pBasic )
|
|
|
|
{
|
|
|
|
xBasic = pBasic;
|
|
|
|
xModule = (SbModule*)pBasic->FindModule( GetName() );
|
|
|
|
}
|
2004-07-23 11:01:17 +00:00
|
|
|
}
|
|
|
|
}
|
2010-03-03 19:59:09 +00:00
|
|
|
return xModule;
|
2001-06-28 14:26:41 +00:00
|
|
|
}
|
|
|
|
|
2010-12-11 22:45:31 +01:00
|
|
|
ModulWindow::~ModulWindow()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_DTOR( ModulWindow, 0 );
|
|
|
|
nValid = 0;
|
|
|
|
|
|
|
|
StarBASIC::Stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-11 22:45:31 +01:00
|
|
|
void ModulWindow::GetFocus()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
if (nValid != ValidWindow)
|
2000-09-29 10:02:42 +00:00
|
|
|
return;
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
aXEditorWindow.GetEdtWindow().GrabFocus();
|
2011-08-22 11:39:37 +02:00
|
|
|
// don't call basic calls because focus is somewhere else...
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ModulWindow::DoInit()
|
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
2011-08-22 11:39:37 +02:00
|
|
|
|
2000-09-29 10:02:42 +00:00
|
|
|
if ( GetVScrollBar() )
|
|
|
|
GetVScrollBar()->Hide();
|
|
|
|
GetHScrollBar()->Show();
|
|
|
|
GetEditorWindow().InitScrollBars();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-11 22:45:31 +01:00
|
|
|
void ModulWindow::Paint( const Rectangle& )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-12-11 22:45:31 +01:00
|
|
|
void ModulWindow::Resize()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
aXEditorWindow.SetPosSizePixel( Point( 0, 0 ),
|
|
|
|
Size( GetOutputSizePixel() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ModulWindow::CheckCompileBasic()
|
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
|
2010-03-03 19:59:09 +00:00
|
|
|
if ( XModule().Is() )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2011-08-22 11:39:37 +02:00
|
|
|
// never compile while running!
|
2012-08-07 08:36:40 +02:00
|
|
|
bool const bRunning = StarBASIC::IsRunning();
|
|
|
|
bool const bModified = ( !xModule->IsCompiled() ||
|
2001-10-24 09:27:33 +00:00
|
|
|
( GetEditEngine() && GetEditEngine()->IsModified() ) );
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2001-10-24 09:27:33 +00:00
|
|
|
if ( !bRunning && bModified )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
bool bDone = false;
|
2004-01-06 16:11:19 +00:00
|
|
|
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
GetShell()->GetViewFrame()->GetWindow().EnterWait();
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2001-10-24 09:27:33 +00:00
|
|
|
if( bModified )
|
|
|
|
{
|
|
|
|
AssertValidEditEngine();
|
2012-07-23 19:00:41 +09:00
|
|
|
GetEditorWindow().SetSourceInBasic();
|
2001-10-24 09:27:33 +00:00
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool bWasModified = GetBasic()->IsModified();
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2001-10-24 09:27:33 +00:00
|
|
|
bDone = GetBasic()->Compile( xModule );
|
|
|
|
if ( !bWasModified )
|
2012-08-07 08:36:40 +02:00
|
|
|
GetBasic()->SetModified(false);
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2001-10-24 09:27:33 +00:00
|
|
|
if ( bDone )
|
|
|
|
{
|
|
|
|
GetBreakPoints().SetBreakPointsInBasic( xModule );
|
|
|
|
}
|
|
|
|
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
GetShell()->GetViewFrame()->GetWindow().LeaveWait();
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2001-10-24 09:27:33 +00:00
|
|
|
aStatus.bError = !bDone;
|
2012-07-20 06:11:34 +09:00
|
|
|
aStatus.bIsRunning = false;
|
2001-10-24 09:27:33 +00:00
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-20 06:11:34 +09:00
|
|
|
bool ModulWindow::BasicExecute()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
2004-05-03 06:56:52 +00:00
|
|
|
|
|
|
|
// #116444# check security settings before macro execution
|
2007-03-15 14:52:11 +00:00
|
|
|
ScriptDocument aDocument( GetDocument() );
|
|
|
|
if ( aDocument.isDocument() )
|
2004-05-03 06:56:52 +00:00
|
|
|
{
|
2007-10-09 14:21:22 +00:00
|
|
|
if ( !aDocument.allowMacros() )
|
2004-05-03 06:56:52 +00:00
|
|
|
{
|
2012-04-29 23:36:57 +01:00
|
|
|
WarningBox( this, WB_OK, IDE_RESSTR(RID_STR_CANNOTRUNMACRO)).Execute();
|
2012-07-20 06:11:34 +09:00
|
|
|
return false;
|
2004-05-03 06:56:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-29 10:02:42 +00:00
|
|
|
CheckCompileBasic();
|
|
|
|
|
2010-03-03 19:59:09 +00:00
|
|
|
if ( XModule().Is() && xModule->IsCompiled() && !aStatus.bError )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2010-12-11 07:39:25 -08:00
|
|
|
if ( GetBreakPoints().size() )
|
2000-09-29 10:02:42 +00:00
|
|
|
aStatus.nBasicFlags = aStatus.nBasicFlags | SbDEBUG_BREAK;
|
|
|
|
|
|
|
|
if ( !aStatus.bIsRunning )
|
|
|
|
{
|
|
|
|
DBG_ASSERT( xModule.Is(), "Kein Modul!" );
|
|
|
|
AddStatus( BASWIN_RUNNINGBASIC );
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16 nStart, nEnd, nCurMethodStart = 0;
|
2010-03-02 12:39:31 +00:00
|
|
|
TextSelection aSel = GetEditView()->GetSelection();
|
2010-09-29 14:32:58 +01:00
|
|
|
// Init cursor to top
|
|
|
|
nCurMethodStart = ( aSel.GetStart().GetPara() + 1 );
|
2000-09-29 10:02:42 +00:00
|
|
|
SbMethod* pMethod = 0;
|
2011-08-22 11:39:37 +02:00
|
|
|
// first Macro, else blind "Main" (ExtSearch?)
|
2011-01-14 11:16:25 +01:00
|
|
|
for ( sal_uInt16 nMacro = 0; nMacro < xModule->GetMethods()->Count(); nMacro++ )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
SbMethod* pM = (SbMethod*)xModule->GetMethods()->Get( nMacro );
|
|
|
|
DBG_ASSERT( pM, "Method?" );
|
|
|
|
pM->GetLineRange( nStart, nEnd );
|
2010-09-29 14:32:58 +01:00
|
|
|
if ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2010-09-29 14:32:58 +01:00
|
|
|
// matched a method to the cursor position
|
2000-09-29 10:02:42 +00:00
|
|
|
pMethod = pM;
|
2010-09-29 14:32:58 +01:00
|
|
|
break;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( !pMethod )
|
2010-03-03 12:59:39 +00:00
|
|
|
{
|
2010-09-29 14:32:58 +01:00
|
|
|
// If not in a method then prompt the user
|
2012-10-01 13:03:37 -03:00
|
|
|
return ( !ChooseMacro( uno::Reference< frame::XModel >(), false, OUString() ).isEmpty() );
|
2010-03-03 12:59:39 +00:00
|
|
|
}
|
|
|
|
if ( pMethod )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
pMethod->SetDebugFlags( aStatus.nBasicFlags );
|
2012-08-07 08:36:40 +02:00
|
|
|
BasicDLL::SetDebugMode( true );
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
RunMethod( pMethod );
|
2012-08-07 08:36:40 +02:00
|
|
|
BasicDLL::SetDebugMode( false );
|
|
|
|
// if cancelled during Interactive=false
|
|
|
|
BasicDLL::EnableBreak( true );
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
ClearStatus( BASWIN_RUNNINGBASIC );
|
|
|
|
}
|
|
|
|
else
|
2012-07-20 06:11:34 +09:00
|
|
|
aStatus.bIsRunning = false; // cancel of Reschedule()
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-07-20 06:11:34 +09:00
|
|
|
bool bDone = !aStatus.bError;
|
2000-09-29 10:02:42 +00:00
|
|
|
|
|
|
|
return bDone;
|
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool ModulWindow::CompileBasic()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
CheckCompileBasic();
|
2001-10-24 09:27:33 +00:00
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
return XModule().Is() && xModule->IsCompiled();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-07-20 06:11:34 +09:00
|
|
|
bool ModulWindow::BasicRun()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
|
|
|
|
aStatus.nBasicFlags = 0;
|
2012-08-07 08:36:40 +02:00
|
|
|
return BasicExecute();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-07-20 06:11:34 +09:00
|
|
|
bool ModulWindow::BasicStepOver()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
aStatus.nBasicFlags = SbDEBUG_STEPINTO | SbDEBUG_STEPOVER;
|
2012-08-07 08:36:40 +02:00
|
|
|
return BasicExecute();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-20 06:11:34 +09:00
|
|
|
bool ModulWindow::BasicStepInto()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
|
|
|
|
aStatus.nBasicFlags = SbDEBUG_STEPINTO;
|
2012-08-07 08:36:40 +02:00
|
|
|
return BasicExecute();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-07-20 06:11:34 +09:00
|
|
|
bool ModulWindow::BasicStepOut()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
|
|
|
|
aStatus.nBasicFlags = SbDEBUG_STEPOUT;
|
2012-08-07 08:36:40 +02:00
|
|
|
return BasicExecute();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ModulWindow::BasicStop()
|
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
|
|
|
|
GetBasic()->Stop();
|
2012-07-20 06:11:34 +09:00
|
|
|
aStatus.bIsRunning = false;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-07-24 17:46:32 +09:00
|
|
|
bool ModulWindow::LoadBasic()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
2012-07-24 17:46:32 +09:00
|
|
|
bool bDone = false;
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2013-02-12 09:23:05 +02:00
|
|
|
Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
|
|
|
|
Reference < XFilePicker3 > xFP = FilePicker::createWithMode(xContext, TemplateDescription::FILEOPEN_SIMPLE);
|
2001-05-21 08:57:57 +00:00
|
|
|
|
2011-12-09 01:58:49 -05:00
|
|
|
if ( !aCurPath.isEmpty() )
|
2001-05-21 08:57:57 +00:00
|
|
|
xFP->setDisplayDirectory ( aCurPath );
|
|
|
|
|
2013-02-12 09:23:05 +02:00
|
|
|
xFP->appendFilter( "BASIC" , "*.bas" );
|
|
|
|
xFP->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), OUString( FilterMask_All ) );
|
|
|
|
xFP->setCurrentFilter( "BASIC" );
|
2001-05-21 08:57:57 +00:00
|
|
|
|
|
|
|
if( xFP->execute() == RET_OK )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-10-01 13:03:37 -03:00
|
|
|
Sequence< OUString > aPaths = xFP->getFiles();
|
2001-05-21 08:57:57 +00:00
|
|
|
aCurPath = aPaths[0];
|
2012-05-24 11:38:12 +02:00
|
|
|
SfxMedium aMedium( aCurPath, STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE );
|
2000-09-29 10:02:42 +00:00
|
|
|
SvStream* pStream = aMedium.GetInStream();
|
|
|
|
if ( pStream )
|
|
|
|
{
|
|
|
|
AssertValidEditEngine();
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uLong nLines = CalcLineCount( *pStream );
|
2000-09-29 10:02:42 +00:00
|
|
|
// nLines*4: ReadText/Formatting/Highlighting/Formatting
|
2013-07-27 17:01:36 +01:00
|
|
|
GetEditorWindow().CreateProgress( IDEResId(RID_STR_GENERATESOURCE).toString(), nLines*4 );
|
2012-08-07 08:36:40 +02:00
|
|
|
GetEditEngine()->SetUpdateMode( false );
|
2000-09-29 10:02:42 +00:00
|
|
|
GetEditView()->Read( *pStream );
|
2012-08-07 08:36:40 +02:00
|
|
|
GetEditEngine()->SetUpdateMode( true );
|
2011-08-22 11:39:37 +02:00
|
|
|
GetEditorWindow().Update();
|
2000-09-29 10:02:42 +00:00
|
|
|
GetEditorWindow().ForceSyntaxTimeout();
|
|
|
|
GetEditorWindow().DestroyProgress();
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uLong nError = aMedium.GetError();
|
2000-09-29 10:02:42 +00:00
|
|
|
if ( nError )
|
|
|
|
ErrorHandler::HandleError( nError );
|
|
|
|
else
|
2012-07-24 17:46:32 +09:00
|
|
|
bDone = true;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
2012-04-29 23:36:57 +01:00
|
|
|
ErrorBox( this, WB_OK | WB_DEF_OK, IDE_RESSTR(RID_STR_COULDNTREAD) ).Execute();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
return bDone;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-24 17:46:32 +09:00
|
|
|
bool ModulWindow::SaveBasicSource()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
2012-07-24 17:46:32 +09:00
|
|
|
bool bDone = false;
|
2001-05-21 08:57:57 +00:00
|
|
|
|
2013-02-12 09:23:05 +02:00
|
|
|
Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
|
|
|
|
Reference < XFilePicker3 > xFP = FilePicker::createWithMode(xContext, TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD);
|
2001-05-21 08:57:57 +00:00
|
|
|
|
|
|
|
Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY);
|
2012-08-07 08:36:40 +02:00
|
|
|
xFPControl->enableControl(ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, false);
|
2001-07-23 09:55:47 +00:00
|
|
|
Any aValue;
|
2012-08-07 08:36:40 +02:00
|
|
|
aValue <<= sal_True;
|
2001-07-23 09:55:47 +00:00
|
|
|
xFPControl->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue);
|
2001-05-21 08:57:57 +00:00
|
|
|
|
2011-12-09 01:58:49 -05:00
|
|
|
if ( !aCurPath.isEmpty() )
|
2001-05-21 08:57:57 +00:00
|
|
|
xFP->setDisplayDirectory ( aCurPath );
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2013-02-12 09:23:05 +02:00
|
|
|
xFP->appendFilter( "BASIC", "*.bas" );
|
|
|
|
xFP->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), OUString( FilterMask_All ) );
|
|
|
|
xFP->setCurrentFilter( "BASIC" );
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2001-05-21 08:57:57 +00:00
|
|
|
if( xFP->execute() == RET_OK )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-10-01 13:03:37 -03:00
|
|
|
Sequence< OUString > aPaths = xFP->getFiles();
|
2001-05-21 08:57:57 +00:00
|
|
|
aCurPath = aPaths[0];
|
2012-05-24 11:38:12 +02:00
|
|
|
SfxMedium aMedium( aCurPath, STREAM_WRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC );
|
2000-09-29 10:02:42 +00:00
|
|
|
SvStream* pStream = aMedium.GetOutStream();
|
|
|
|
if ( pStream )
|
|
|
|
{
|
2004-01-06 16:11:19 +00:00
|
|
|
EnterWait();
|
2000-09-29 10:02:42 +00:00
|
|
|
AssertValidEditEngine();
|
|
|
|
GetEditEngine()->Write( *pStream );
|
|
|
|
aMedium.Commit();
|
2004-01-06 16:11:19 +00:00
|
|
|
LeaveWait();
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uLong nError = aMedium.GetError();
|
2000-09-29 10:02:42 +00:00
|
|
|
if ( nError )
|
|
|
|
ErrorHandler::HandleError( nError );
|
|
|
|
else
|
2012-07-24 17:46:32 +09:00
|
|
|
bDone = true;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
2013-07-27 17:01:36 +01:00
|
|
|
ErrorBox( this, WB_OK | WB_DEF_OK, IDEResId(RID_STR_COULDNTWRITE).toString() ).Execute();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return bDone;
|
|
|
|
}
|
|
|
|
|
2012-10-01 13:03:37 -03:00
|
|
|
extern bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName ); // defined in baside3.cxx
|
2009-09-11 09:40:28 +00:00
|
|
|
|
2012-07-24 17:46:32 +09:00
|
|
|
bool ModulWindow::ImportDialog()
|
2009-09-11 09:40:28 +00:00
|
|
|
{
|
|
|
|
const ScriptDocument& rDocument = GetDocument();
|
2012-10-01 13:03:37 -03:00
|
|
|
OUString aLibName = GetLibName();
|
2011-12-09 01:58:49 -05:00
|
|
|
return implImportDialog( this, aCurPath, rDocument, aLibName );
|
2009-09-11 09:40:28 +00:00
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-07-24 17:46:32 +09:00
|
|
|
bool ModulWindow::ToggleBreakPoint( sal_uLong nLine )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2010-03-03 19:59:09 +00:00
|
|
|
DBG_ASSERT( XModule().Is(), "Kein Modul!" );
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-07-24 17:46:32 +09:00
|
|
|
bool bNewBreakPoint = false;
|
2001-10-24 09:27:33 +00:00
|
|
|
|
2010-03-03 19:59:09 +00:00
|
|
|
if ( XModule().Is() )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2001-10-24 09:27:33 +00:00
|
|
|
CheckCompileBasic();
|
|
|
|
if ( aStatus.bError )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-07-24 17:46:32 +09:00
|
|
|
return false;
|
2001-10-24 09:27:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BreakPoint* pBrk = GetBreakPoints().FindBreakPoint( nLine );
|
2011-08-22 11:39:37 +02:00
|
|
|
if ( pBrk ) // remove
|
2001-10-24 09:27:33 +00:00
|
|
|
{
|
2011-01-14 11:16:25 +01:00
|
|
|
xModule->ClearBP( (sal_uInt16)nLine );
|
2010-12-11 07:39:25 -08:00
|
|
|
delete GetBreakPoints().remove( pBrk );
|
2001-10-24 09:27:33 +00:00
|
|
|
}
|
2011-08-22 11:39:37 +02:00
|
|
|
else // create one
|
2001-10-24 09:27:33 +00:00
|
|
|
{
|
2011-01-14 11:16:25 +01:00
|
|
|
if ( xModule->SetBP( (sal_uInt16)nLine) )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2001-10-24 09:27:33 +00:00
|
|
|
GetBreakPoints().InsertSorted( new BreakPoint( nLine ) );
|
2012-07-24 17:46:32 +09:00
|
|
|
bNewBreakPoint = true;
|
2001-10-24 09:27:33 +00:00
|
|
|
if ( StarBASIC::IsRunning() )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2011-01-14 11:16:25 +01:00
|
|
|
for ( sal_uInt16 nMethod = 0; nMethod < xModule->GetMethods()->Count(); nMethod++ )
|
2001-10-24 09:27:33 +00:00
|
|
|
{
|
|
|
|
SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( nMethod );
|
|
|
|
DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" );
|
|
|
|
pMethod->SetDebugFlags( pMethod->GetDebugFlags() | SbDEBUG_BREAK );
|
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
2001-10-24 09:27:33 +00:00
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return bNewBreakPoint;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModulWindow::UpdateBreakPoint( const BreakPoint& rBrk )
|
|
|
|
{
|
2010-03-03 19:59:09 +00:00
|
|
|
DBG_ASSERT( XModule().Is(), "Kein Modul!" );
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2010-03-03 19:59:09 +00:00
|
|
|
if ( XModule().Is() )
|
2001-10-24 09:27:33 +00:00
|
|
|
{
|
|
|
|
CheckCompileBasic();
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2001-10-24 09:27:33 +00:00
|
|
|
if ( rBrk.bEnabled )
|
2011-01-14 11:16:25 +01:00
|
|
|
xModule->SetBP( (sal_uInt16)rBrk.nLine );
|
2001-10-24 09:27:33 +00:00
|
|
|
else
|
2011-01-14 11:16:25 +01:00
|
|
|
xModule->ClearBP( (sal_uInt16)rBrk.nLine );
|
2001-10-24 09:27:33 +00:00
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-24 17:46:32 +09:00
|
|
|
bool ModulWindow::BasicToggleBreakPoint()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
AssertValidEditEngine();
|
|
|
|
|
|
|
|
TextSelection aSel = GetEditView()->GetSelection();
|
2011-08-22 11:39:37 +02:00
|
|
|
aSel.GetStart().GetPara()++; // Basic lines start at 1!
|
2000-09-29 10:02:42 +00:00
|
|
|
aSel.GetEnd().GetPara()++;
|
|
|
|
|
2012-07-24 17:46:32 +09:00
|
|
|
bool bNewBreakPoint = false;
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2011-01-14 11:16:25 +01:00
|
|
|
for ( sal_uLong nLine = aSel.GetStart().GetPara(); nLine <= aSel.GetEnd().GetPara(); nLine++ )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
if ( ToggleBreakPoint( nLine ) )
|
2012-07-24 17:46:32 +09:00
|
|
|
bNewBreakPoint = true;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
aXEditorWindow.GetBrkWindow().Invalidate();
|
|
|
|
return bNewBreakPoint;
|
|
|
|
}
|
|
|
|
|
2003-04-11 16:37:21 +00:00
|
|
|
|
|
|
|
void ModulWindow::BasicToggleBreakPointEnabled()
|
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
AssertValidEditEngine();
|
|
|
|
|
|
|
|
ExtTextView* pView = GetEditView();
|
|
|
|
if ( pView )
|
|
|
|
{
|
|
|
|
TextSelection aSel = pView->GetSelection();
|
|
|
|
BreakPointList& rList = GetBreakPoints();
|
|
|
|
|
2011-01-14 11:16:25 +01:00
|
|
|
for ( sal_uLong nLine = ++aSel.GetStart().GetPara(), nEnd = ++aSel.GetEnd().GetPara(); nLine <= nEnd; ++nLine )
|
2003-04-11 16:37:21 +00:00
|
|
|
{
|
|
|
|
BreakPoint* pBrk = rList.FindBreakPoint( nLine );
|
|
|
|
if ( pBrk )
|
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
pBrk->bEnabled = !pBrk->bEnabled;
|
2003-04-11 16:37:21 +00:00
|
|
|
UpdateBreakPoint( *pBrk );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GetBreakPointWindow().Invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ModulWindow::ManageBreakPoints()
|
|
|
|
{
|
|
|
|
BreakPointWindow& rBrkWin = GetBreakPointWindow();
|
|
|
|
BreakPointDialog aBrkDlg( &rBrkWin, GetBreakPoints() );
|
|
|
|
aBrkDlg.Execute();
|
|
|
|
rBrkWin.Invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-24 21:41:31 +00:00
|
|
|
long ModulWindow::BasicErrorHdl( StarBASIC * pBasic )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
GoOnTop();
|
|
|
|
|
|
|
|
// ReturnWert: BOOL
|
2011-08-22 11:39:37 +02:00
|
|
|
// FALSE: cancel
|
|
|
|
// TRUE: go on....
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16 nErrorLine = pBasic->GetLine() - 1;
|
|
|
|
sal_uInt16 nErrCol1 = pBasic->GetCol1();
|
|
|
|
sal_uInt16 nErrCol2 = pBasic->GetCol2();
|
2000-09-29 10:02:42 +00:00
|
|
|
if ( nErrCol2 != 0xFFFF )
|
|
|
|
nErrCol2++;
|
|
|
|
|
|
|
|
AssertValidEditEngine();
|
|
|
|
GetEditView()->SetSelection( TextSelection( TextPaM( nErrorLine, nErrCol1 ), TextPaM( nErrorLine, nErrCol2 ) ) );
|
|
|
|
|
2011-08-22 11:39:37 +02:00
|
|
|
// if other basic, the IDE should try to display the correct module
|
2012-08-07 08:36:40 +02:00
|
|
|
bool const bMarkError = pBasic == GetBasic();
|
2000-09-29 10:02:42 +00:00
|
|
|
if ( bMarkError )
|
2012-08-07 08:36:40 +02:00
|
|
|
aXEditorWindow.GetBrkWindow().SetMarkerPos(nErrorLine, true);
|
2005-04-18 13:24:20 +00:00
|
|
|
|
|
|
|
// #i47002#
|
|
|
|
Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( this );
|
|
|
|
|
2001-09-11 14:40:15 +00:00
|
|
|
ErrorHandler::HandleError( StarBASIC::GetErrorCode() );
|
2005-04-18 13:24:20 +00:00
|
|
|
|
|
|
|
// #i47002#
|
|
|
|
Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
|
|
|
|
if ( !pWindow )
|
2012-08-07 08:36:40 +02:00
|
|
|
return false;
|
2005-04-18 13:24:20 +00:00
|
|
|
|
2000-09-29 10:02:42 +00:00
|
|
|
if ( bMarkError )
|
2012-09-02 16:21:08 +02:00
|
|
|
aXEditorWindow.GetBrkWindow().SetNoMarker();
|
2012-08-07 08:36:40 +02:00
|
|
|
return false;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2010-12-11 22:45:31 +01:00
|
|
|
long ModulWindow::BasicBreakHdl( StarBASIC* pBasic )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
|
2007-01-16 15:28:29 +00:00
|
|
|
// #i69280 Required in Window despite normal usage in next command!
|
|
|
|
(void)pBasic;
|
|
|
|
|
2011-08-22 11:39:37 +02:00
|
|
|
// Return value: sal_uInt16 => see SB-Debug-Flags
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16 nErrorLine = pBasic->GetLine();
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2011-08-22 11:39:37 +02:00
|
|
|
|
2000-09-29 10:02:42 +00:00
|
|
|
BreakPoint* pBrk = GetBreakPoints().FindBreakPoint( nErrorLine );
|
2003-11-05 11:38:01 +00:00
|
|
|
if ( pBrk )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2003-11-05 11:38:01 +00:00
|
|
|
pBrk->nHitCount++;
|
2011-11-30 13:33:26 +01:00
|
|
|
if ( pBrk->nHitCount <= pBrk->nStopAfter && GetBasic()->IsBreak() )
|
2011-08-22 11:39:37 +02:00
|
|
|
return aStatus.nBasicFlags; // go on...
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2011-08-22 11:39:37 +02:00
|
|
|
nErrorLine--; // EditEngine starts at 0, Basic at 1
|
|
|
|
|
2000-09-29 10:02:42 +00:00
|
|
|
AssertValidEditEngine();
|
|
|
|
GetEditView()->SetSelection( TextSelection( TextPaM( nErrorLine, 0 ), TextPaM( nErrorLine, 0 ) ) );
|
|
|
|
aXEditorWindow.GetBrkWindow().SetMarkerPos( nErrorLine );
|
|
|
|
|
2012-08-17 13:10:45 +01:00
|
|
|
rLayout.UpdateDebug(false);
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-07-20 06:11:34 +09:00
|
|
|
aStatus.bIsInReschedule = true;
|
|
|
|
aStatus.bIsRunning = true;
|
2000-09-29 10:02:42 +00:00
|
|
|
|
|
|
|
AddStatus( BASWIN_INRESCHEDULE );
|
|
|
|
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
InvalidateDebuggerSlots();
|
2000-09-29 10:02:42 +00:00
|
|
|
|
|
|
|
while( aStatus.bIsRunning )
|
|
|
|
Application::Yield();
|
|
|
|
|
2012-07-20 06:11:34 +09:00
|
|
|
aStatus.bIsInReschedule = false;
|
2012-09-02 16:21:08 +02:00
|
|
|
aXEditorWindow.GetBrkWindow().SetNoMarker();
|
2000-09-29 10:02:42 +00:00
|
|
|
|
|
|
|
ClearStatus( BASWIN_INRESCHEDULE );
|
|
|
|
|
|
|
|
return aStatus.nBasicFlags;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModulWindow::BasicAddWatch()
|
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
AssertValidEditEngine();
|
2012-08-07 08:36:40 +02:00
|
|
|
bool bAdd = true;
|
2000-09-29 10:02:42 +00:00
|
|
|
if ( !GetEditView()->HasSelection() )
|
|
|
|
{
|
|
|
|
TextPaM aWordStart;
|
2012-10-01 13:03:37 -03:00
|
|
|
OUString aWord = GetEditEngine()->GetWord( GetEditView()->GetSelection().GetEnd(), &aWordStart );
|
2011-12-09 01:58:49 -05:00
|
|
|
if ( !aWord.isEmpty() )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
TextSelection aSel( aWordStart );
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16& rIndex = aSel.GetEnd().GetIndex();
|
2011-12-09 01:58:49 -05:00
|
|
|
rIndex = rIndex + aWord.getLength();
|
2000-09-29 10:02:42 +00:00
|
|
|
GetEditView()->SetSelection( aSel );
|
2012-08-07 08:36:40 +02:00
|
|
|
bAdd = true;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( bAdd )
|
|
|
|
{
|
|
|
|
TextSelection aSel = GetEditView()->GetSelection();
|
2012-08-17 07:29:20 +02:00
|
|
|
if ( aSel.GetStart().GetPara() == aSel.GetEnd().GetPara() ) // single line selection
|
|
|
|
rLayout.BasicAddWatch(GetEditView()->GetSelected());
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-28 22:08:26 +01:00
|
|
|
void ModulWindow::EditMacro( const OUString& rMacroName )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
2010-03-03 19:59:09 +00:00
|
|
|
DBG_ASSERT( XModule().Is(), "Kein Modul!" );
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2010-03-03 19:59:09 +00:00
|
|
|
if ( XModule().Is() )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2001-10-24 09:27:33 +00:00
|
|
|
CheckCompileBasic();
|
|
|
|
|
|
|
|
if ( !aStatus.bError )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16 nStart, nEnd;
|
2001-10-24 09:27:33 +00:00
|
|
|
SbMethod* pMethod = (SbMethod*)xModule->Find( rMacroName, SbxCLASS_METHOD );
|
|
|
|
if ( pMethod )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2001-10-24 09:27:33 +00:00
|
|
|
pMethod->GetLineRange( nStart, nEnd );
|
|
|
|
if ( nStart )
|
|
|
|
{
|
|
|
|
nStart--;
|
|
|
|
nEnd--;
|
|
|
|
}
|
|
|
|
TextSelection aSel( TextPaM( nStart, 0 ), TextPaM( nStart, 0 ) );
|
|
|
|
AssertValidEditEngine();
|
|
|
|
TextView * pView = GetEditView();
|
2011-08-22 11:39:37 +02:00
|
|
|
// scroll if applicabel so that first line is at the top
|
2001-10-24 09:27:33 +00:00
|
|
|
long nVisHeight = GetOutputSizePixel().Height();
|
|
|
|
if ( (long)pView->GetTextEngine()->GetTextHeight() > nVisHeight )
|
|
|
|
{
|
|
|
|
long nMaxY = pView->GetTextEngine()->GetTextHeight() - nVisHeight;
|
|
|
|
long nOldStartY = pView->GetStartDocPos().Y();
|
|
|
|
long nNewStartY = nStart * pView->GetTextEngine()->GetCharHeight();
|
2013-04-11 00:21:40 -03:00
|
|
|
nNewStartY = std::min( nNewStartY, nMaxY );
|
2001-10-24 09:27:33 +00:00
|
|
|
pView->Scroll( 0, -(nNewStartY-nOldStartY) );
|
2012-08-07 08:36:40 +02:00
|
|
|
pView->ShowCursor( false, true );
|
2001-10-24 09:27:33 +00:00
|
|
|
GetEditVScrollBar().SetThumbPos( pView->GetStartDocPos().Y() );
|
|
|
|
}
|
|
|
|
pView->SetSelection( aSel );
|
|
|
|
pView->ShowCursor();
|
|
|
|
pView->GetWindow()->GrabFocus();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-11 22:45:31 +01:00
|
|
|
void ModulWindow::StoreData()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
2011-08-22 11:39:37 +02:00
|
|
|
// StoreData is called when the BasicManager is destroyed or
|
|
|
|
// this window is closed.
|
|
|
|
// => interrupts undesired!
|
2012-07-23 19:00:41 +09:00
|
|
|
GetEditorWindow().SetSourceInBasic();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-07-20 06:11:34 +09:00
|
|
|
bool ModulWindow::CanClose()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
2012-07-20 06:11:34 +09:00
|
|
|
return true;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-20 06:11:34 +09:00
|
|
|
bool ModulWindow::AllowUndo()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
return GetEditorWindow().CanModify();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-11 22:45:31 +01:00
|
|
|
void ModulWindow::UpdateData()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
2010-03-03 19:59:09 +00:00
|
|
|
DBG_ASSERT( XModule().Is(), "Kein Modul!" );
|
2011-08-22 11:39:37 +02:00
|
|
|
// UpdateData is called when the source has changed from outside
|
|
|
|
// => interrupts undesired!
|
2001-08-29 11:29:09 +00:00
|
|
|
|
2010-03-03 19:59:09 +00:00
|
|
|
if ( XModule().Is() )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2003-04-23 15:38:46 +00:00
|
|
|
SetModule( xModule->GetSource32() );
|
2001-10-24 09:27:33 +00:00
|
|
|
|
|
|
|
if ( GetEditView() )
|
|
|
|
{
|
|
|
|
TextSelection aSel = GetEditView()->GetSelection();
|
2012-09-02 16:21:08 +02:00
|
|
|
setTextEngineText(*GetEditEngine(), xModule->GetSource32());
|
2001-10-24 09:27:33 +00:00
|
|
|
GetEditView()->SetSelection( aSel );
|
2012-08-07 08:36:40 +02:00
|
|
|
GetEditEngine()->SetModified( false );
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
MarkDocumentModified( GetDocument() );
|
2001-10-24 09:27:33 +00:00
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-19 11:32:44 +00:00
|
|
|
sal_Int32 ModulWindow::countPages( Printer* pPrinter )
|
|
|
|
{
|
|
|
|
return FormatAndPrint( pPrinter, -1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModulWindow::printPage( sal_Int32 nPage, Printer* pPrinter )
|
|
|
|
{
|
|
|
|
FormatAndPrint( pPrinter, nPage );
|
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2009-05-19 11:32:44 +00:00
|
|
|
/* implementation note: this is totally inefficient for the XRenderable interface
|
|
|
|
usage since the whole "document" will be format for every page. Should this ever
|
|
|
|
become a problem we should
|
|
|
|
- format only once for every new printer
|
|
|
|
- keep an index list for each page which is the starting paragraph
|
|
|
|
*/
|
|
|
|
sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
|
|
|
|
AssertValidEditEngine();
|
|
|
|
|
|
|
|
MapMode eOldMapMode( pPrinter->GetMapMode() );
|
|
|
|
Font aOldFont( pPrinter->GetFont() );
|
|
|
|
|
|
|
|
Font aFont( GetEditEngine()->GetFont() );
|
|
|
|
aFont.SetAlign( ALIGN_BOTTOM );
|
2012-08-07 08:36:40 +02:00
|
|
|
aFont.SetTransparent( true );
|
2000-09-29 10:02:42 +00:00
|
|
|
aFont.SetSize( Size( 0, 360 ) );
|
|
|
|
pPrinter->SetFont( aFont );
|
|
|
|
pPrinter->SetMapMode( MAP_100TH_MM );
|
|
|
|
|
2013-01-20 10:51:58 +01:00
|
|
|
OUString aTitle( CreateQualifiedName() );
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16 nLineHeight = (sal_uInt16) pPrinter->GetTextHeight(); // etwas mehr.
|
|
|
|
sal_uInt16 nParaSpace = 10;
|
2000-09-29 10:02:42 +00:00
|
|
|
|
|
|
|
Size aPaperSz = pPrinter->GetOutputSize();
|
2012-09-02 16:21:08 +02:00
|
|
|
aPaperSz.Width() -= (Print::nLeftMargin + Print::nRightMargin);
|
|
|
|
aPaperSz.Height() -= (Print::nTopMargin + Print::nBottomMargin);
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2011-08-22 11:39:37 +02:00
|
|
|
// nLinepPage is not correct if there's a line break
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16 nLinespPage = (sal_uInt16) (aPaperSz.Height()/nLineHeight);
|
2013-03-24 20:34:33 +01:00
|
|
|
sal_uInt16 nCharspLine = (sal_uInt16) (aPaperSz.Width() / pPrinter->GetTextWidth( "X" ) );
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uLong nParas = GetEditEngine()->GetParagraphCount();
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16 nPages = (sal_uInt16) (nParas/nLinespPage+1 );
|
|
|
|
sal_uInt16 nCurPage = 1;
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2009-05-19 11:32:44 +00:00
|
|
|
lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nPrintPage == 0 );
|
2012-09-02 16:21:08 +02:00
|
|
|
Point aPos( Print::nLeftMargin, Print::nTopMargin );
|
2011-01-14 11:16:25 +01:00
|
|
|
for ( sal_uLong nPara = 0; nPara < nParas; nPara++ )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2013-01-20 10:51:58 +01:00
|
|
|
OUString aLine( GetEditEngine()->GetText( nPara ) );
|
2000-09-29 10:02:42 +00:00
|
|
|
lcl_ConvertTabsToSpaces( aLine );
|
2013-01-20 10:51:58 +01:00
|
|
|
sal_uInt16 nLines = aLine.getLength()/nCharspLine+1;
|
2011-01-14 11:16:25 +01:00
|
|
|
for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2013-01-20 10:51:58 +01:00
|
|
|
OUString aTmpLine = aLine.copy(nLine*nCharspLine, nCharspLine );
|
2000-09-29 10:02:42 +00:00
|
|
|
aPos.Y() += nLineHeight;
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( aPos.Y() > ( aPaperSz.Height() + Print::nTopMargin ) )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
nCurPage++;
|
2009-05-19 11:32:44 +00:00
|
|
|
lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nCurPage-1 == nPrintPage );
|
2012-09-02 16:21:08 +02:00
|
|
|
aPos = Point(Print::nLeftMargin, Print::nTopMargin + nLineHeight);
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
2009-05-19 11:32:44 +00:00
|
|
|
if( nCurPage-1 == nPrintPage )
|
|
|
|
pPrinter->DrawText( aPos, aTmpLine );
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
aPos.Y() += nParaSpace;
|
|
|
|
}
|
|
|
|
|
|
|
|
pPrinter->SetFont( aOldFont );
|
|
|
|
pPrinter->SetMapMode( eOldMapMode );
|
2009-05-19 11:32:44 +00:00
|
|
|
|
|
|
|
return sal_Int32(nCurPage);
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
void ModulWindow::ExecuteCommand (SfxRequest& rReq)
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
AssertValidEditEngine();
|
2012-08-17 07:29:20 +02:00
|
|
|
switch (rReq.GetSlot())
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2011-08-21 18:12:16 -05:00
|
|
|
case SID_DELETE:
|
|
|
|
{
|
|
|
|
KeyEvent aFakeDelete( 0, KEY_DELETE );
|
|
|
|
GetEditView()->KeyInput( aFakeDelete );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SID_SELECTALL:
|
|
|
|
GetEditView()->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
|
|
|
|
break;
|
2000-09-29 10:02:42 +00:00
|
|
|
case SID_BASICRUN:
|
|
|
|
{
|
|
|
|
BasicRun();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_BASICCOMPILE:
|
|
|
|
{
|
|
|
|
CompileBasic();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_BASICSTEPOVER:
|
|
|
|
{
|
|
|
|
BasicStepOver();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_BASICSTEPINTO:
|
|
|
|
{
|
|
|
|
BasicStepInto();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_BASICSTEPOUT:
|
|
|
|
{
|
|
|
|
BasicStepOut();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_BASICLOAD:
|
|
|
|
{
|
|
|
|
LoadBasic();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_BASICSAVEAS:
|
|
|
|
{
|
|
|
|
SaveBasicSource();
|
|
|
|
}
|
|
|
|
break;
|
2009-09-11 09:40:28 +00:00
|
|
|
case SID_IMPORT_DIALOG:
|
|
|
|
{
|
|
|
|
ImportDialog();
|
|
|
|
}
|
|
|
|
break;
|
2000-09-29 10:02:42 +00:00
|
|
|
case SID_BASICIDE_MATCHGROUP:
|
2012-07-24 12:42:43 +01:00
|
|
|
{
|
|
|
|
GetEditView()->MatchGroup();
|
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
break;
|
|
|
|
case SID_BASICIDE_TOGGLEBRKPNT:
|
|
|
|
{
|
|
|
|
BasicToggleBreakPoint();
|
|
|
|
}
|
|
|
|
break;
|
2003-04-11 16:37:21 +00:00
|
|
|
case SID_BASICIDE_MANAGEBRKPNTS:
|
|
|
|
{
|
|
|
|
ManageBreakPoints();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_BASICIDE_TOGGLEBRKPNTENABLED:
|
|
|
|
{
|
|
|
|
BasicToggleBreakPointEnabled();
|
|
|
|
}
|
|
|
|
break;
|
2000-09-29 10:02:42 +00:00
|
|
|
case SID_BASICIDE_ADDWATCH:
|
|
|
|
{
|
|
|
|
BasicAddWatch();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_BASICIDE_REMOVEWATCH:
|
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
rLayout.BasicRemoveWatch();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-07-22 14:32:00 +02:00
|
|
|
case SID_BASICIDE_CODECOMPLETITION:
|
|
|
|
{
|
2013-07-23 12:42:37 +02:00
|
|
|
SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), false);
|
|
|
|
CodeCompleteOptions::SetCodeCompleteOn( pItem && pItem->GetValue() );
|
2013-07-22 14:32:00 +02:00
|
|
|
}
|
|
|
|
break;
|
2000-09-29 10:02:42 +00:00
|
|
|
case SID_CUT:
|
|
|
|
{
|
2001-11-12 21:39:49 +00:00
|
|
|
if ( !IsReadOnly() )
|
|
|
|
{
|
|
|
|
GetEditView()->Cut();
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
if (SfxBindings* pBindings = GetBindingsPtr())
|
2006-01-03 11:41:51 +00:00
|
|
|
pBindings->Invalidate( SID_DOC_MODIFIED );
|
2001-11-12 21:39:49 +00:00
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_COPY:
|
|
|
|
{
|
|
|
|
GetEditView()->Copy();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_PASTE:
|
|
|
|
{
|
2001-11-12 21:39:49 +00:00
|
|
|
if ( !IsReadOnly() )
|
|
|
|
{
|
|
|
|
GetEditView()->Paste();
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
if (SfxBindings* pBindings = GetBindingsPtr())
|
2006-01-03 11:41:51 +00:00
|
|
|
pBindings->Invalidate( SID_DOC_MODIFIED );
|
2001-11-12 21:39:49 +00:00
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_BASICIDE_BRKPNTSCHANGED:
|
|
|
|
{
|
|
|
|
GetBreakPointWindow().Invalidate();
|
|
|
|
}
|
|
|
|
break;
|
2012-08-17 07:29:20 +02:00
|
|
|
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))
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
MarkDocumentModified(m_aDocument);
|
2012-08-17 07:29:20 +02:00
|
|
|
}
|
|
|
|
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:
|
|
|
|
{
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
DocumentSignature aSignature(m_aDocument);
|
2012-08-17 07:29:20 +02:00
|
|
|
if (aSignature.supportsSignatures())
|
|
|
|
{
|
|
|
|
aSignature.signScriptingContent();
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
if (SfxBindings* pBindings = GetBindingsPtr())
|
2012-08-17 07:29:20 +02:00
|
|
|
pBindings->Invalidate(SID_SIGNATURE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-12-11 22:45:31 +01:00
|
|
|
void ModulWindow::GetState( SfxItemSet &rSet )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
SfxWhichIter aIter(rSet);
|
2011-01-14 11:16:25 +01:00
|
|
|
for ( sal_uInt16 nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich() )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
switch ( nWh )
|
|
|
|
{
|
2001-11-12 21:39:49 +00:00
|
|
|
case SID_CUT:
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2001-11-12 21:39:49 +00:00
|
|
|
if ( !GetEditView() || !GetEditView()->HasSelection() )
|
|
|
|
rSet.DisableItem( nWh );
|
|
|
|
|
|
|
|
if ( IsReadOnly() )
|
|
|
|
rSet.DisableItem( nWh );
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2001-11-12 21:39:49 +00:00
|
|
|
case SID_COPY:
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2001-11-12 21:39:49 +00:00
|
|
|
if ( !GetEditView() || !GetEditView()->HasSelection() )
|
|
|
|
rSet.DisableItem( nWh );
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2001-11-09 14:41:40 +00:00
|
|
|
case SID_PASTE:
|
|
|
|
{
|
2001-11-12 21:39:49 +00:00
|
|
|
if ( !IsPasteAllowed() )
|
|
|
|
rSet.DisableItem( nWh );
|
|
|
|
|
|
|
|
if ( IsReadOnly() )
|
2001-11-09 14:41:40 +00:00
|
|
|
rSet.DisableItem( nWh );
|
|
|
|
}
|
|
|
|
break;
|
2000-09-29 10:02:42 +00:00
|
|
|
case SID_BASICIDE_STAT_POS:
|
|
|
|
{
|
|
|
|
TextView* pView = GetEditView();
|
|
|
|
if ( pView )
|
|
|
|
{
|
|
|
|
TextSelection aSel = pView->GetSelection();
|
2013-01-20 10:51:58 +01:00
|
|
|
OUString aPos = OUString( IDEResId( RID_STR_LINE ) ) +
|
|
|
|
" " +
|
|
|
|
OUString::number(aSel.GetEnd().GetPara()+1) +
|
|
|
|
", " +
|
|
|
|
OUString( IDEResId( RID_STR_COLUMN ) ) +
|
|
|
|
" " +
|
|
|
|
OUString::number(aSel.GetEnd().GetIndex()+1);
|
2000-09-29 10:02:42 +00:00
|
|
|
SfxStringItem aItem( SID_BASICIDE_STAT_POS, aPos );
|
|
|
|
rSet.Put( aItem );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_ATTR_INSERT:
|
|
|
|
{
|
|
|
|
TextView* pView = GetEditView();
|
|
|
|
if ( pView )
|
|
|
|
{
|
|
|
|
SfxBoolItem aItem( SID_ATTR_INSERT, pView->IsInsertMode() );
|
|
|
|
rSet.Put( aItem );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2012-08-17 07:29:20 +02:00
|
|
|
case SID_SHOWLINES:
|
|
|
|
{
|
|
|
|
rSet.Put(SfxBoolItem(nWh, bSourceLinesEnabled));
|
|
|
|
break;
|
|
|
|
}
|
2013-07-23 12:42:37 +02:00
|
|
|
case SID_BASICIDE_CODECOMPLETITION:
|
|
|
|
{
|
|
|
|
SvtMiscOptions aMiscOptions;
|
|
|
|
if( aMiscOptions.IsExperimentalMode() )
|
|
|
|
{
|
|
|
|
rSet.Put(SfxBoolItem( nWh, CodeCompleteOptions::IsCodeCompleteOn() ));
|
|
|
|
std::cerr <<"code complete set to: " << CodeCompleteOptions::IsCodeCompleteOn() << std::endl;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rSet.Put( SfxVisibilityItem(nWh, false) );
|
|
|
|
//CodeCompleteOptions::SetCodeCompleteOn( false );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-11 22:45:31 +01:00
|
|
|
void ModulWindow::DoScroll( ScrollBar* pCurScrollBar )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
if ( ( pCurScrollBar == GetHScrollBar() ) && GetEditView() )
|
|
|
|
{
|
2011-08-22 11:39:37 +02:00
|
|
|
// don't scroll with the value but rather use the Thumb-Pos for the VisArea:
|
2000-09-29 10:02:42 +00:00
|
|
|
long nDiff = GetEditView()->GetStartDocPos().X() - pCurScrollBar->GetThumbPos();
|
|
|
|
GetEditView()->Scroll( nDiff, 0 );
|
2012-08-07 08:36:40 +02:00
|
|
|
GetEditView()->ShowCursor( false, true );
|
2000-09-29 10:02:42 +00:00
|
|
|
pCurScrollBar->SetThumbPos( GetEditView()->GetStartDocPos().X() );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool ModulWindow::IsModified()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
return GetEditEngine() && GetEditEngine()->IsModified();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-12-11 22:45:31 +01:00
|
|
|
void ModulWindow::GoOnTop()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
GetShell()->GetViewFrame()->ToTop();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 13:03:37 -03:00
|
|
|
OUString ModulWindow::GetSbModuleName()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-10-01 13:03:37 -03:00
|
|
|
OUString aModuleName;
|
2010-03-03 19:59:09 +00:00
|
|
|
if ( XModule().Is() )
|
2000-09-29 10:02:42 +00:00
|
|
|
aModuleName = xModule->GetName();
|
|
|
|
return aModuleName;
|
|
|
|
}
|
|
|
|
|
2012-10-01 13:03:37 -03:00
|
|
|
OUString ModulWindow::GetTitle()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2001-08-29 11:29:09 +00:00
|
|
|
return GetSbModuleName();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ModulWindow::FrameWindowMoved()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-24 17:46:32 +09:00
|
|
|
void ModulWindow::ShowCursor( bool bOn )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
if ( GetEditEngine() )
|
|
|
|
{
|
|
|
|
TextView* pView = GetEditEngine()->GetActiveView();
|
|
|
|
if ( pView )
|
|
|
|
{
|
|
|
|
if ( bOn )
|
|
|
|
pView->ShowCursor();
|
|
|
|
else
|
|
|
|
pView->HideCursor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ModulWindow::AssertValidEditEngine()
|
|
|
|
{
|
|
|
|
if ( !GetEditEngine() )
|
|
|
|
GetEditorWindow().CreateEditEngine();
|
|
|
|
}
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
void ModulWindow::Activating ()
|
|
|
|
{
|
|
|
|
aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled);
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
2000-09-29 10:02:42 +00:00
|
|
|
void ModulWindow::Deactivating()
|
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
Hide();
|
2000-09-29 10:02:42 +00:00
|
|
|
if ( GetEditView() )
|
|
|
|
GetEditView()->EraseVirtualDevice();
|
|
|
|
}
|
|
|
|
|
2012-07-24 17:46:32 +09:00
|
|
|
sal_uInt16 ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem, bool bFromStart )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
if (IsSuspended())
|
|
|
|
return 0;
|
|
|
|
|
2011-08-22 11:39:37 +02:00
|
|
|
// one could also relinquish syntaxhighlighting/formatting instead of the stupid replace-everything...
|
2001-03-09 15:57:00 +00:00
|
|
|
AssertValidEditEngine();
|
|
|
|
ExtTextView* pView = GetEditView();
|
|
|
|
TextSelection aSel;
|
|
|
|
if ( bFromStart )
|
|
|
|
{
|
|
|
|
aSel = pView->GetSelection();
|
|
|
|
if ( !rSearchItem.GetBackward() )
|
|
|
|
pView->SetSelection( TextSelection() );
|
|
|
|
else
|
|
|
|
pView->SetSelection( TextSelection( TextPaM( 0xFFFFFFFF, 0xFFFF ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
|
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool const bForward = !rSearchItem.GetBackward();
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16 nFound = 0;
|
2001-03-09 15:57:00 +00:00
|
|
|
if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND ) ||
|
|
|
|
( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL ) )
|
|
|
|
{
|
|
|
|
nFound = pView->Search( rSearchItem.GetSearchOptions() , bForward );
|
|
|
|
}
|
|
|
|
else if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE ) ||
|
|
|
|
( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL ) )
|
|
|
|
{
|
2005-01-13 16:49:06 +00:00
|
|
|
if ( !IsReadOnly() )
|
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
bool const bAll = rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL;
|
2005-01-13 16:49:06 +00:00
|
|
|
nFound = pView->Replace( rSearchItem.GetSearchOptions() , bAll , bForward );
|
|
|
|
}
|
2001-03-09 15:57:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( bFromStart && !nFound )
|
|
|
|
pView->SetSelection( aSel );
|
|
|
|
|
|
|
|
return nFound;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2011-03-09 16:20:50 -06:00
|
|
|
::svl::IUndoManager* ModulWindow::GetUndoManager()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
if ( GetEditEngine() )
|
|
|
|
return &GetEditEngine()->GetUndoManager();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-03-09 16:20:50 -06:00
|
|
|
sal_uInt16 ModulWindow::GetSearchOptions()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16 nOptions = SEARCH_OPTIONS_SEARCH |
|
2005-01-13 16:49:06 +00:00
|
|
|
SEARCH_OPTIONS_WHOLE_WORDS |
|
|
|
|
SEARCH_OPTIONS_BACKWARDS |
|
|
|
|
SEARCH_OPTIONS_REG_EXP |
|
|
|
|
SEARCH_OPTIONS_EXACT |
|
|
|
|
SEARCH_OPTIONS_SELECTION |
|
|
|
|
SEARCH_OPTIONS_SIMILARITY;
|
|
|
|
|
|
|
|
if ( !IsReadOnly() )
|
|
|
|
{
|
|
|
|
nOptions |= SEARCH_OPTIONS_REPLACE;
|
|
|
|
nOptions |= SEARCH_OPTIONS_REPLACE_ALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nOptions;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2010-12-11 22:45:31 +01:00
|
|
|
void ModulWindow::BasicStarted()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2010-03-03 19:59:09 +00:00
|
|
|
if ( XModule().Is() )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-07-20 06:11:34 +09:00
|
|
|
aStatus.bIsRunning = true;
|
2003-11-05 11:38:01 +00:00
|
|
|
BreakPointList& rList = GetBreakPoints();
|
2010-12-11 07:39:25 -08:00
|
|
|
if ( rList.size() )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2003-11-05 11:38:01 +00:00
|
|
|
rList.ResetHitCount();
|
|
|
|
rList.SetBreakPointsInBasic( xModule );
|
2011-01-14 11:16:25 +01:00
|
|
|
for ( sal_uInt16 nMethod = 0; nMethod < xModule->GetMethods()->Count(); nMethod++ )
|
2001-10-24 09:27:33 +00:00
|
|
|
{
|
|
|
|
SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( nMethod );
|
|
|
|
DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" );
|
|
|
|
pMethod->SetDebugFlags( pMethod->GetDebugFlags() | SbDEBUG_BREAK );
|
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-11 22:45:31 +01:00
|
|
|
void ModulWindow::BasicStopped()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-07-20 06:11:34 +09:00
|
|
|
aStatus.bIsRunning = false;
|
2012-09-02 16:21:08 +02:00
|
|
|
GetBreakPointWindow().SetNoMarker();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
EntryDescriptor ModulWindow::CreateEntryDescriptor()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2007-03-15 14:52:11 +00:00
|
|
|
ScriptDocument aDocument( GetDocument() );
|
2013-03-28 22:08:26 +01:00
|
|
|
OUString aLibName( GetLibName() );
|
2007-03-15 14:52:11 +00:00
|
|
|
LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
|
2013-03-22 13:52:16 -03:00
|
|
|
OUString aModName( GetName() );
|
2013-03-28 22:08:26 +01:00
|
|
|
OUString aLibSubName;
|
2010-03-03 19:59:09 +00:00
|
|
|
if( xBasic.Is() && aDocument.isInVBAMode() && XModule().Is() )
|
2010-03-02 12:39:31 +00:00
|
|
|
{
|
|
|
|
switch( xModule->GetModuleType() )
|
|
|
|
{
|
2010-04-16 17:28:52 +02:00
|
|
|
case script::ModuleType::DOCUMENT:
|
2010-03-02 12:39:31 +00:00
|
|
|
{
|
2013-03-28 22:08:26 +01:00
|
|
|
aLibSubName = OUString( IDEResId( RID_STR_DOCUMENT_OBJECTS ) );
|
2010-03-02 12:39:31 +00:00
|
|
|
uno::Reference< container::XNameContainer > xLib = aDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
|
|
|
|
if( xLib.is() )
|
|
|
|
{
|
2012-10-01 13:03:37 -03:00
|
|
|
OUString sObjName;
|
2010-04-20 10:31:03 +01:00
|
|
|
ModuleInfoHelper::getObjectName( xLib, aModName, sObjName );
|
2011-11-22 00:20:15 -05:00
|
|
|
if( !sObjName.isEmpty() )
|
2010-03-02 12:39:31 +00:00
|
|
|
{
|
2013-03-22 13:52:16 -03:00
|
|
|
aModName += " (" + sObjName + ")";
|
2010-03-02 12:39:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2010-04-16 17:28:52 +02:00
|
|
|
case script::ModuleType::FORM:
|
2013-03-28 22:08:26 +01:00
|
|
|
aLibSubName = OUString( IDEResId( RID_STR_USERFORMS ) );
|
2010-03-02 12:39:31 +00:00
|
|
|
break;
|
2010-04-16 17:28:52 +02:00
|
|
|
case script::ModuleType::NORMAL:
|
2013-03-28 22:08:26 +01:00
|
|
|
aLibSubName = OUString( IDEResId( RID_STR_NORMAL_MODULES ) );
|
2010-03-02 12:39:31 +00:00
|
|
|
break;
|
2010-04-16 17:28:52 +02:00
|
|
|
case script::ModuleType::CLASS:
|
2013-03-28 22:08:26 +01:00
|
|
|
aLibSubName = OUString( IDEResId( RID_STR_CLASS_MODULES ) );
|
2010-03-02 12:39:31 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
return EntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aModName, OBJ_TYPE_MODULE );
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
void ModulWindow::SetReadOnly (bool b)
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
|
|
|
if ( GetEditView() )
|
|
|
|
GetEditView()->SetReadOnly( b );
|
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool ModulWindow::IsReadOnly()
|
2001-11-12 21:39:49 +00:00
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
return GetEditView() && GetEditView()->IsReadOnly();
|
2001-11-12 21:39:49 +00:00
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool ModulWindow::IsPasteAllowed()
|
2001-11-12 21:39:49 +00:00
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
bool bPaste = false;
|
2001-11-12 21:39:49 +00:00
|
|
|
|
|
|
|
// get clipboard
|
|
|
|
Reference< datatransfer::clipboard::XClipboard > xClipboard = GetClipboard();
|
|
|
|
if ( xClipboard.is() )
|
|
|
|
{
|
|
|
|
// get clipboard content
|
|
|
|
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
|
|
|
|
Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents();
|
|
|
|
Application::AcquireSolarMutex( nRef );
|
|
|
|
if ( xTransf.is() )
|
|
|
|
{
|
|
|
|
datatransfer::DataFlavor aFlavor;
|
|
|
|
SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor );
|
|
|
|
if ( xTransf->isDataFlavorSupported( aFlavor ) )
|
2012-08-07 08:36:40 +02:00
|
|
|
bPaste = true;
|
2001-11-12 21:39:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bPaste;
|
|
|
|
}
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
void ModulWindow::OnNewDocument ()
|
|
|
|
{
|
|
|
|
aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
char const* ModulWindow::GetHid () const
|
|
|
|
{
|
|
|
|
return HID_BASICIDE_MODULWINDOW;
|
|
|
|
}
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
ItemType ModulWindow::GetType () const
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
return TYPE_MODULE;
|
2012-08-17 07:29:20 +02:00
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
bool ModulWindow::HasActiveEditor () const
|
|
|
|
{
|
|
|
|
return !IsSuspended();
|
|
|
|
}
|
2012-08-12 17:08:16 -04:00
|
|
|
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
void ModulWindow::UpdateModule ()
|
|
|
|
{
|
2012-10-01 13:03:37 -03:00
|
|
|
OUString const aModule = getTextEngineText(*GetEditEngine());
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
// 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);
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
MarkDocumentModified(m_aDocument);
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// ModulWindowLayout
|
|
|
|
// =================
|
|
|
|
//
|
|
|
|
|
|
|
|
ModulWindowLayout::ModulWindowLayout (Window* pParent, ObjectCatalog& rObjectCatalog_) :
|
|
|
|
Layout(pParent),
|
|
|
|
pChild(0),
|
|
|
|
aWatchWindow(this),
|
|
|
|
aStackWindow(this),
|
|
|
|
rObjectCatalog(rObjectCatalog_)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
void ModulWindowLayout::UpdateDebug (bool bBasicStopped)
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
aWatchWindow.UpdateWatches(bBasicStopped);
|
|
|
|
aStackWindow.UpdateCalls();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
void ModulWindowLayout::Paint (Rectangle const&)
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2013-07-27 17:01:36 +01:00
|
|
|
DrawText(Point(), IDEResId(RID_STR_NOMODULE).toString());
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
// virtual
|
|
|
|
void ModulWindowLayout::DataChanged (DataChangedEvent const& rDCEvt)
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
Layout::DataChanged(rDCEvt);
|
|
|
|
if (rDCEvt.GetType() == DATACHANGED_SETTINGS && (rDCEvt.GetFlags() & SETTINGS_STYLE))
|
|
|
|
aSyntaxColors.SettingsChanged();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
void ModulWindowLayout::Activating (BaseWindow& rChild)
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
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());
|
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
void ModulWindowLayout::Deactivating ()
|
|
|
|
{
|
|
|
|
aSyntaxColors.SetActiveEditor(0);
|
|
|
|
Layout::Deactivating();
|
|
|
|
aWatchWindow.Hide();
|
|
|
|
aStackWindow.Hide();
|
|
|
|
rObjectCatalog.Hide();
|
|
|
|
pChild = 0;
|
|
|
|
}
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
void ModulWindowLayout::GetState (SfxItemSet &rSet, unsigned nWhich)
|
|
|
|
{
|
|
|
|
switch (nWhich)
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-31 12:44:47 +02:00
|
|
|
case SID_SHOW_PROPERTYBROWSER:
|
|
|
|
rSet.Put(SfxVisibilityItem(nWhich, false));
|
|
|
|
break;
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
case SID_BASICIDE_CHOOSEMACRO:
|
|
|
|
rSet.Put(SfxVisibilityItem(nWhich, true));
|
|
|
|
break;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
2012-08-17 07:29:20 +02:00
|
|
|
}
|
2012-08-06 14:28:28 +02:00
|
|
|
|
2013-03-28 22:08:26 +01:00
|
|
|
void ModulWindowLayout::BasicAddWatch (OUString const& rWatchStr)
|
2012-08-17 07:29:20 +02:00
|
|
|
{
|
|
|
|
aWatchWindow.AddWatch(rWatchStr);
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
void ModulWindowLayout::BasicRemoveWatch ()
|
|
|
|
{
|
|
|
|
DBG_CHKTHIS( ModulWindow, 0 );
|
|
|
|
aWatchWindow.RemoveSelectedWatch();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-09-07 10:31:53 +02:00
|
|
|
void ModulWindowLayout::OnFirstSize (long const nWidth, long const nHeight)
|
2012-08-17 07:29:20 +02:00
|
|
|
{
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-06 14:28:28 +02:00
|
|
|
//
|
2012-08-17 07:29:20 +02:00
|
|
|
// SyntaxColors
|
|
|
|
// ============
|
2012-08-06 14:28:28 +02:00
|
|
|
//
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
ModulWindowLayout::SyntaxColors::SyntaxColors () :
|
|
|
|
pEditor(0)
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
aConfig.AddListener(this);
|
|
|
|
|
|
|
|
aColors[TT_UNKNOWN] =
|
|
|
|
aColors[TT_WHITESPACE] =
|
|
|
|
aColors[TT_EOL] =
|
|
|
|
Application::GetSettings().GetStyleSettings().GetFieldTextColor();
|
|
|
|
|
|
|
|
NewConfig(true);
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
ModulWindowLayout::SyntaxColors::~SyntaxColors ()
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
aConfig.RemoveListener(this);
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
void ModulWindowLayout::SyntaxColors::SettingsChanged ()
|
2002-07-05 09:22:53 +00:00
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
Color const aColor = Application::GetSettings().GetStyleSettings().GetFieldTextColor();
|
|
|
|
if (aColor != aColors[TT_UNKNOWN])
|
2002-07-05 09:22:53 +00:00
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
aColors[TT_UNKNOWN] =
|
|
|
|
aColors[TT_WHITESPACE] =
|
|
|
|
aColors[TT_EOL] =
|
|
|
|
aColor;
|
|
|
|
if (pEditor)
|
|
|
|
pEditor->UpdateSyntaxHighlighting();
|
2002-07-05 09:22:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// virtual
|
2012-08-17 07:29:20 +02:00
|
|
|
void ModulWindowLayout::SyntaxColors::ConfigurationChanged (utl::ConfigurationBroadcaster*, sal_uInt32)
|
2002-07-05 09:22:53 +00:00
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
NewConfig(false);
|
2002-07-05 09:22:53 +00:00
|
|
|
}
|
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
// when a new configuration has to be set
|
|
|
|
void ModulWindowLayout::SyntaxColors::NewConfig (bool bFirst)
|
2002-07-05 09:22:53 +00:00
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
static struct
|
2002-07-05 09:22:53 +00:00
|
|
|
{
|
2012-08-17 07:29:20 +02:00
|
|
|
TokenTypes eTokenType;
|
|
|
|
svtools::ColorConfigEntry eEntry;
|
2002-07-05 09:22:53 +00:00
|
|
|
}
|
2012-08-17 07:29:20 +02:00
|
|
|
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();
|
2002-07-05 09:22:53 +00:00
|
|
|
}
|
|
|
|
|
2012-07-23 18:48:47 +02:00
|
|
|
|
2012-08-17 07:29:20 +02:00
|
|
|
} // namespace basctl
|
2012-08-06 14:28:28 +02:00
|
|
|
|
2010-10-12 15:57:08 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|