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
|
|
|
|
2010-11-04 10:36:00 +01:00
|
|
|
#include "basobj.hxx"
|
|
|
|
#include "iderdll.hxx"
|
|
|
|
#include "iderdll2.hxx"
|
|
|
|
#include "iderid.hxx"
|
|
|
|
#include "macrodlg.hxx"
|
|
|
|
#include "moduldlg.hxx"
|
|
|
|
#include "basidesh.hxx"
|
|
|
|
#include "basidesh.hrc"
|
|
|
|
#include "baside2.hxx"
|
|
|
|
#include "basicmod.hxx"
|
|
|
|
#include "basdoc.hxx"
|
|
|
|
|
2008-03-06 18:13:26 +00:00
|
|
|
#include <com/sun/star/document/XEmbeddedScripts.hpp>
|
|
|
|
#include <com/sun/star/document/XScriptInvocationContext.hpp>
|
2010-11-04 10:36:00 +01:00
|
|
|
|
2012-06-29 08:30:14 +02:00
|
|
|
#include <basic/sbmeth.hxx>
|
2010-11-04 10:36:00 +01:00
|
|
|
#include <basic/sbx.hxx>
|
|
|
|
#include <framework/documentundoguard.hxx>
|
|
|
|
#include <tools/diagnose_ex.h>
|
|
|
|
#include <unotools/moduleoptions.hxx>
|
2011-11-21 23:33:54 -05:00
|
|
|
#include <vcl/msgbox.hxx>
|
2010-11-04 10:36:00 +01:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <memory>
|
2001-08-03 14:14:56 +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
|
|
|
namespace basctl
|
|
|
|
{
|
|
|
|
|
2001-06-22 13:45:11 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
|
2001-08-03 14:14:56 +00:00
|
|
|
|
2001-07-25 06:23:37 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
extern "C" {
|
2011-01-14 11:16:25 +01:00
|
|
|
SAL_DLLPUBLIC_EXPORT rtl_uString* basicide_choose_macro( void* pOnlyInDocument_AsXModel, sal_Bool bChooseOnly, rtl_uString* pMacroDesc )
|
2001-07-25 06:23:37 +00:00
|
|
|
{
|
|
|
|
::rtl::OUString aMacroDesc( pMacroDesc );
|
2007-03-15 14:54:30 +00:00
|
|
|
Reference< frame::XModel > aDocument( static_cast< frame::XModel* >( pOnlyInDocument_AsXModel ) );
|
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
|
|
|
::rtl::OUString aScriptURL = basctl::ChooseMacro( aDocument, bChooseOnly, aMacroDesc );
|
2001-08-03 14:14:56 +00:00
|
|
|
rtl_uString* pScriptURL = aScriptURL.pData;
|
|
|
|
rtl_uString_acquire( pScriptURL );
|
2001-07-25 06:23:37 +00:00
|
|
|
|
2001-08-03 14:14:56 +00:00
|
|
|
return pScriptURL;
|
2001-07-25 06:23:37 +00:00
|
|
|
}
|
2011-01-14 11:16:25 +01:00
|
|
|
SAL_DLLPUBLIC_EXPORT void basicide_macro_organizer( sal_Int16 nTabId )
|
2004-05-19 07:01:37 +00:00
|
|
|
{
|
|
|
|
OSL_TRACE("in basicide_macro_organizer");
|
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
|
|
|
basctl::Organize( nTabId );
|
2004-05-19 07:01:37 +00:00
|
|
|
}
|
2001-07-25 06:23:37 +00:00
|
|
|
}
|
2001-06-22 13:45:11 +00:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2011-01-14 11:16:25 +01:00
|
|
|
void Organize( sal_Int16 tabId )
|
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
|
|
|
EnsureIde();
|
2004-07-23 11:03:15 +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 aDesc;
|
|
|
|
if (Shell* pShell = GetShell())
|
|
|
|
if (BaseWindow* pCurWin = pShell->GetCurWindow())
|
2004-07-23 11:03:15 +00:00
|
|
|
aDesc = pCurWin->CreateEntryDescriptor();
|
|
|
|
|
|
|
|
Window* pParent = Application::GetDefDialogParent();
|
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
|
|
|
OrganizeDialog(pParent, tabId, aDesc).Execute();
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2001-06-22 13:45:11 +00:00
|
|
|
//----------------------------------------------------------------------------
|
2000-09-29 10:02:42 +00:00
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool IsValidSbxName( const String& rName )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2011-01-14 11:16:25 +01:00
|
|
|
for ( sal_uInt16 nChar = 0; nChar < rName.Len(); nChar++ )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2012-04-18 00:23:42 +09:00
|
|
|
sal_Unicode c = rName.GetChar(nChar);
|
2012-08-07 08:36:40 +02:00
|
|
|
bool bValid = (
|
|
|
|
( c >= 'A' && c <= 'Z' ) ||
|
|
|
|
( c >= 'a' && c <= 'z' ) ||
|
|
|
|
( c >= '0' && c <= '9' && nChar ) ||
|
|
|
|
( c == '_' )
|
|
|
|
);
|
2000-09-29 10:02:42 +00:00
|
|
|
if ( !bValid )
|
2012-08-07 08:36:40 +02:00
|
|
|
return false;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
2012-08-07 08:36:40 +02:00
|
|
|
return true;
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-07-31 10:14:06 +09:00
|
|
|
static bool StringCompareLessThan( const String& rStr1, const String& rStr2 )
|
2000-09-29 10:02:42 +00:00
|
|
|
{
|
2008-07-07 11:20:01 +00:00
|
|
|
return (rStr1.CompareIgnoreCaseToAscii( rStr2 ) == COMPARE_LESS);
|
2000-09-29 10:02:42 +00:00
|
|
|
}
|
|
|
|
|
2001-06-22 13:45:11 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-07-07 11:20:01 +00:00
|
|
|
Sequence< ::rtl::OUString > GetMergedLibraryNames( const Reference< script::XLibraryContainer >& xModLibContainer, const Reference< script::XLibraryContainer >& xDlgLibContainer )
|
2001-07-06 14:56:29 +00:00
|
|
|
{
|
2001-09-03 10:56:10 +00:00
|
|
|
// create a sorted list of module library names
|
|
|
|
::std::vector<String> aModLibList;
|
|
|
|
if ( xModLibContainer.is() )
|
2001-07-06 14:56:29 +00:00
|
|
|
{
|
2001-09-03 10:56:10 +00:00
|
|
|
Sequence< ::rtl::OUString > aModLibNames = xModLibContainer->getElementNames();
|
|
|
|
sal_Int32 nModLibCount = aModLibNames.getLength();
|
|
|
|
const ::rtl::OUString* pModLibNames = aModLibNames.getConstArray();
|
|
|
|
for ( sal_Int32 i = 0 ; i < nModLibCount ; i++ )
|
|
|
|
aModLibList.push_back( pModLibNames[ i ] );
|
|
|
|
::std::sort( aModLibList.begin() , aModLibList.end() , StringCompareLessThan );
|
2001-07-06 14:56:29 +00:00
|
|
|
}
|
|
|
|
|
2001-09-03 10:56:10 +00:00
|
|
|
// create a sorted list of dialog library names
|
|
|
|
::std::vector<String> aDlgLibList;
|
|
|
|
if ( xDlgLibContainer.is() )
|
2001-07-06 14:56:29 +00:00
|
|
|
{
|
2001-09-03 10:56:10 +00:00
|
|
|
Sequence< ::rtl::OUString > aDlgLibNames = xDlgLibContainer->getElementNames();
|
|
|
|
sal_Int32 nDlgLibCount = aDlgLibNames.getLength();
|
|
|
|
const ::rtl::OUString* pDlgLibNames = aDlgLibNames.getConstArray();
|
|
|
|
for ( sal_Int32 i = 0 ; i < nDlgLibCount ; i++ )
|
|
|
|
aDlgLibList.push_back( pDlgLibNames[ i ] );
|
|
|
|
::std::sort( aDlgLibList.begin() , aDlgLibList.end() , StringCompareLessThan );
|
2001-07-06 14:56:29 +00:00
|
|
|
}
|
|
|
|
|
2001-09-03 10:56:10 +00:00
|
|
|
// merge both lists
|
|
|
|
::std::vector<String> aLibList( aModLibList.size() + aDlgLibList.size() );
|
|
|
|
::std::merge( aModLibList.begin(), aModLibList.end(), aDlgLibList.begin(), aDlgLibList.end(), aLibList.begin(), StringCompareLessThan );
|
|
|
|
::std::vector<String>::iterator aIterEnd = ::std::unique( aLibList.begin(), aLibList.end() ); // move unique elements to the front
|
|
|
|
aLibList.erase( aIterEnd, aLibList.end() ); // remove duplicates
|
|
|
|
|
|
|
|
// copy to sequence
|
|
|
|
sal_Int32 nLibCount = aLibList.size();
|
|
|
|
Sequence< ::rtl::OUString > aSeqLibNames( nLibCount );
|
|
|
|
for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
|
|
|
|
aSeqLibNames.getArray()[ i ] = aLibList[ i ];
|
|
|
|
|
|
|
|
return aSeqLibNames;
|
2001-07-06 14:56:29 +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
|
|
|
bool RenameModule (
|
|
|
|
Window* pErrorParent,
|
|
|
|
const ScriptDocument& rDocument,
|
|
|
|
const ::rtl::OUString& rLibName,
|
|
|
|
const ::rtl::OUString& rOldName,
|
|
|
|
const ::rtl::OUString& rNewName
|
|
|
|
)
|
2001-08-29 11:29:09 +00:00
|
|
|
{
|
2007-03-15 14:54:30 +00:00
|
|
|
if ( !rDocument.hasModule( rLibName, rOldName ) )
|
2001-09-03 10:56:10 +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
|
|
|
OSL_FAIL( "basctl::RenameModule: old module name is invalid!" );
|
2007-03-15 14:54:30 +00:00
|
|
|
return false;
|
2001-09-03 10:56:10 +00:00
|
|
|
}
|
|
|
|
|
2007-03-15 14:54:30 +00:00
|
|
|
if ( rDocument.hasModule( rLibName, rNewName ) )
|
2001-06-22 13:45:11 +00:00
|
|
|
{
|
2012-04-29 23:36:57 +01:00
|
|
|
ErrorBox aError( pErrorParent, WB_OK | WB_DEF_OK, IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2) );
|
2007-03-15 14:54:30 +00:00
|
|
|
aError.Execute();
|
|
|
|
return false;
|
2001-06-22 13:45:11 +00:00
|
|
|
}
|
|
|
|
|
2007-08-03 08:58:20 +00:00
|
|
|
// #i74440
|
2011-12-10 02:54:11 -05:00
|
|
|
if ( rNewName.isEmpty() )
|
2007-08-03 08:58:20 +00:00
|
|
|
{
|
2012-04-29 23:36:57 +01:00
|
|
|
ErrorBox aError( pErrorParent, WB_OK | WB_DEF_OK, IDE_RESSTR(RID_STR_BADSBXNAME) );
|
2007-08-03 08:58:20 +00:00
|
|
|
aError.Execute();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-03-15 14:54:30 +00:00
|
|
|
if ( !rDocument.renameModule( rLibName, rOldName, rNewName ) )
|
|
|
|
return false;
|
2001-06-28 14:26:41 +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
|
|
|
if (Shell* pShell = GetShell())
|
2001-06-28 14:26:41 +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
|
|
|
if (ModulWindow* pWin = pShell->FindBasWin(rDocument, rLibName, rNewName, false, true))
|
2001-06-28 14:26:41 +00:00
|
|
|
{
|
2001-09-25 08:14:46 +00:00
|
|
|
// set new name in window
|
|
|
|
pWin->SetName( rNewName );
|
2001-08-15 12:54:43 +00:00
|
|
|
|
|
|
|
// set new module in module window
|
2012-08-17 07:29:20 +02:00
|
|
|
pWin->SetSbModule( (SbModule*)pWin->GetBasic()->FindModule( rNewName ) );
|
2001-06-28 14:26:41 +00:00
|
|
|
|
|
|
|
// update tabwriter
|
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
|
|
|
sal_uInt16 nId = pShell->GetWindowId( pWin );
|
2001-06-28 14:26:41 +00:00
|
|
|
DBG_ASSERT( nId, "No entry in Tabbar!" );
|
|
|
|
if ( nId )
|
|
|
|
{
|
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
|
|
|
TabBar& rTabBar = pShell->GetTabBar();
|
|
|
|
rTabBar.SetPageText(nId, rNewName);
|
|
|
|
rTabBar.Sort();
|
|
|
|
rTabBar.MakeVisible(rTabBar.GetCurPageId());
|
2001-06-28 14:26:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-03-15 14:54:30 +00:00
|
|
|
return true;
|
2001-06-28 14:26:41 +00:00
|
|
|
}
|
|
|
|
|
2010-11-04 10:36:00 +01:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
struct MacroExecutionData
|
|
|
|
{
|
|
|
|
ScriptDocument aDocument;
|
|
|
|
SbMethodRef xMethod;
|
|
|
|
|
|
|
|
MacroExecutionData()
|
|
|
|
:aDocument( ScriptDocument::NoDocument )
|
|
|
|
,xMethod( NULL )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class MacroExecution
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DECL_STATIC_LINK( MacroExecution, ExecuteMacroEvent, MacroExecutionData* );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
IMPL_STATIC_LINK( MacroExecution, ExecuteMacroEvent, MacroExecutionData*, i_pData )
|
|
|
|
{
|
2010-11-05 09:05:25 +01:00
|
|
|
(void)pThis;
|
2010-11-04 10:36:00 +01:00
|
|
|
ENSURE_OR_RETURN( i_pData, "wrong MacroExecutionData", 0L );
|
|
|
|
// take ownership of the data
|
|
|
|
::std::auto_ptr< MacroExecutionData > pData( i_pData );
|
|
|
|
|
|
|
|
DBG_ASSERT( pData->xMethod->GetParent()->GetFlags() & SBX_EXTSEARCH, "Kein EXTSEARCH!" );
|
|
|
|
|
|
|
|
// in case this is a document-local macro, try to protect the document's Undo Manager from
|
|
|
|
// flawed scripts
|
|
|
|
::std::auto_ptr< ::framework::DocumentUndoGuard > pUndoGuard;
|
|
|
|
if ( pData->aDocument.isDocument() )
|
|
|
|
pUndoGuard.reset( new ::framework::DocumentUndoGuard( pData->aDocument.getDocument() ) );
|
|
|
|
|
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(pData->xMethod);
|
2010-11-04 10:36:00 +01:00
|
|
|
|
|
|
|
return 1L;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-28 14:26:41 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
::rtl::OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument, bool bChooseOnly, const ::rtl::OUString& rMacroDesc )
|
2001-09-03 10:56:10 +00:00
|
|
|
{
|
2007-01-16 15:30:02 +00:00
|
|
|
(void)rMacroDesc;
|
|
|
|
|
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
|
|
|
EnsureIde();
|
2001-09-03 10:56:10 +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
|
|
|
GetExtraData()->ChoosingMacro() = true;
|
2001-09-03 10:56:10 +00:00
|
|
|
|
|
|
|
String aScriptURL;
|
2012-07-31 10:14:06 +09:00
|
|
|
bool bError = false;
|
2001-09-03 10:56:10 +00:00
|
|
|
SbMethod* pMethod = NULL;
|
|
|
|
|
2012-07-26 01:28:37 +09:00
|
|
|
::std::auto_ptr< MacroChooser > pChooser( new MacroChooser( NULL, true ) );
|
2001-09-03 10:56:10 +00:00
|
|
|
if ( bChooseOnly || !SvtModuleOptions().IsBasicIDE() )
|
|
|
|
pChooser->SetMode( MACROCHOOSER_CHOOSEONLY );
|
|
|
|
|
2007-03-15 14:54:30 +00:00
|
|
|
if ( !bChooseOnly && rxLimitToDocument.is() )
|
2002-04-22 15:59:54 +00:00
|
|
|
// Hack!
|
|
|
|
pChooser->SetMode( MACROCHOOSER_RECORDING );
|
|
|
|
|
2001-09-03 10:56:10 +00:00
|
|
|
short nRetValue = pChooser->Execute();
|
|
|
|
|
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
|
|
|
GetExtraData()->ChoosingMacro() = false;
|
2001-09-03 10:56:10 +00:00
|
|
|
|
|
|
|
switch ( nRetValue )
|
|
|
|
{
|
|
|
|
case MACRO_OK_RUN:
|
|
|
|
{
|
|
|
|
pMethod = pChooser->GetMacro();
|
2002-04-22 15:59:54 +00:00
|
|
|
if ( !pMethod && pChooser->GetMode() == MACROCHOOSER_RECORDING )
|
|
|
|
pMethod = pChooser->CreateMacro();
|
2001-09-03 10:56:10 +00:00
|
|
|
|
2010-11-04 10:36:00 +01:00
|
|
|
if ( !pMethod )
|
|
|
|
break;
|
|
|
|
|
|
|
|
SbModule* pModule = pMethod->GetModule();
|
2012-01-15 11:30:24 +01:00
|
|
|
if ( !pModule )
|
|
|
|
{
|
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
|
|
|
SAL_WARN( "basctl.basicide", "basctl::ChooseMacro: No Module found!" );
|
2012-01-15 11:30:24 +01:00
|
|
|
break;
|
|
|
|
}
|
2010-11-04 10:36:00 +01:00
|
|
|
|
2011-11-21 20:13:24 -05:00
|
|
|
StarBASIC* pBasic = dynamic_cast<StarBASIC*>(pModule->GetParent());
|
2012-01-15 11:30:24 +01:00
|
|
|
if ( !pBasic )
|
|
|
|
{
|
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
|
|
|
SAL_WARN( "basctl.basicide", "basctl::ChooseMacro: No Basic found!" );
|
2012-01-15 11:30:24 +01:00
|
|
|
break;
|
|
|
|
}
|
2010-11-04 10:36:00 +01: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
|
|
|
BasicManager* pBasMgr = FindBasicManager( pBasic );
|
2012-01-15 11:30:24 +01:00
|
|
|
if ( !pBasMgr )
|
|
|
|
{
|
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
|
|
|
SAL_WARN( "basctl.basicide", "basctl::ChooseMacro: No BasicManager found!" );
|
2012-01-15 11:30:24 +01:00
|
|
|
break;
|
|
|
|
}
|
2010-11-04 10:36:00 +01:00
|
|
|
|
|
|
|
// name
|
|
|
|
String aName;
|
|
|
|
aName += pBasic->GetName();
|
|
|
|
aName += '.';
|
|
|
|
aName += pModule->GetName();
|
|
|
|
aName += '.';
|
|
|
|
aName += pMethod->GetName();
|
|
|
|
|
|
|
|
// language
|
2012-07-02 16:02:38 +01:00
|
|
|
rtl::OUString aLanguage("Basic");
|
2010-11-04 10:36:00 +01:00
|
|
|
|
|
|
|
// location
|
2012-07-02 16:02:38 +01:00
|
|
|
rtl::OUString aLocation;
|
2010-11-04 10:36:00 +01:00
|
|
|
ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
|
|
|
|
if ( aDocument.isDocument() )
|
2001-09-03 10:56:10 +00:00
|
|
|
{
|
2010-11-04 10:36:00 +01:00
|
|
|
// document basic
|
2012-07-02 16:02:38 +01:00
|
|
|
aLocation = rtl::OUString("document");
|
2001-09-03 10:56:10 +00:00
|
|
|
|
2010-11-04 10:36:00 +01:00
|
|
|
if ( rxLimitToDocument.is() )
|
|
|
|
{
|
|
|
|
uno::Reference< frame::XModel > xLimitToDocument( rxLimitToDocument );
|
|
|
|
|
|
|
|
uno::Reference< document::XEmbeddedScripts > xScripts( rxLimitToDocument, UNO_QUERY );
|
|
|
|
if ( !xScripts.is() )
|
|
|
|
{ // the document itself does not support embedding scripts
|
|
|
|
uno::Reference< document::XScriptInvocationContext > xContext( rxLimitToDocument, UNO_QUERY );
|
|
|
|
if ( xContext.is() )
|
|
|
|
xScripts = xContext->getScriptContainer();
|
|
|
|
if ( xScripts.is() )
|
|
|
|
{ // but it is able to refer to a document which actually does support this
|
|
|
|
xLimitToDocument.set( xScripts, UNO_QUERY );
|
|
|
|
if ( !xLimitToDocument.is() )
|
2001-09-03 10:56:10 +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
|
|
|
OSL_ENSURE( false, "basctl::ChooseMacro: a script container which is no document!?" );
|
2010-11-04 10:36:00 +01:00
|
|
|
xLimitToDocument = rxLimitToDocument;
|
2001-09-03 10:56:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-11-04 10:36:00 +01:00
|
|
|
|
|
|
|
if ( xLimitToDocument != aDocument.getDocument() )
|
|
|
|
{
|
|
|
|
// error
|
2012-07-31 10:14:06 +09:00
|
|
|
bError = true;
|
2010-11-04 10:36:00 +01:00
|
|
|
ErrorBox( NULL, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_ERRORCHOOSEMACRO ) ) ).Execute();
|
|
|
|
}
|
2001-09-03 10:56:10 +00:00
|
|
|
}
|
|
|
|
}
|
2010-11-04 10:36:00 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// application basic
|
2012-07-02 16:02:38 +01:00
|
|
|
aLocation = rtl::OUString("application");
|
2010-11-04 10:36:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// script URL
|
|
|
|
if ( !bError )
|
|
|
|
{
|
2012-07-02 16:02:38 +01:00
|
|
|
aScriptURL = rtl::OUString("vnd.sun.star.script:");
|
2010-11-04 10:36:00 +01:00
|
|
|
aScriptURL += aName;
|
2012-07-02 16:02:38 +01:00
|
|
|
aScriptURL += rtl::OUString("?language=");
|
2010-11-04 10:36:00 +01:00
|
|
|
aScriptURL += aLanguage;
|
2012-07-02 16:02:38 +01:00
|
|
|
aScriptURL += rtl::OUString("&location=");
|
2010-11-04 10:36:00 +01:00
|
|
|
aScriptURL += aLocation;
|
|
|
|
}
|
2001-09-03 10:56:10 +00:00
|
|
|
|
2010-11-04 10:36:00 +01:00
|
|
|
if ( !rxLimitToDocument.is() )
|
2001-09-03 10:56:10 +00:00
|
|
|
{
|
2010-11-04 10:36:00 +01:00
|
|
|
MacroExecutionData* pExecData = new MacroExecutionData;
|
|
|
|
pExecData->aDocument = aDocument;
|
|
|
|
pExecData->xMethod = pMethod; // keep alive until the event has been processed
|
|
|
|
Application::PostUserEvent( STATIC_LINK( NULL, MacroExecution, ExecuteMacroEvent ), pExecData );
|
2001-09-03 10:56:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-11-04 10:36:00 +01:00
|
|
|
return aScriptURL;
|
2001-09-03 10:56:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2011-12-10 02:54:11 -05:00
|
|
|
Sequence< ::rtl::OUString > GetMethodNames( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rModName )
|
2001-09-03 10:56:10 +00:00
|
|
|
throw(NoSuchElementException )
|
|
|
|
{
|
2007-03-15 14:54:30 +00:00
|
|
|
Sequence< ::rtl::OUString > aSeqMethods;
|
2001-09-03 10:56:10 +00:00
|
|
|
|
2007-03-15 14:54:30 +00:00
|
|
|
// get module
|
|
|
|
::rtl::OUString aOUSource;
|
|
|
|
if ( rDocument.getModule( rLibName, rModName, aOUSource ) )
|
2001-09-03 10:56:10 +00:00
|
|
|
{
|
2007-03-15 14:54:30 +00:00
|
|
|
SbModuleRef xModule = new SbModule( rModName );
|
|
|
|
xModule->SetSource32( aOUSource );
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16 nCount = xModule->GetMethods()->Count();
|
|
|
|
sal_uInt16 nRealCount = nCount;
|
|
|
|
for ( sal_uInt16 i = 0; i < nCount; i++ )
|
2007-03-15 14:54:30 +00:00
|
|
|
{
|
|
|
|
SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( i );
|
2010-08-06 09:35:51 +02:00
|
|
|
if( pMethod->IsHidden() )
|
|
|
|
--nRealCount;
|
|
|
|
}
|
|
|
|
aSeqMethods.realloc( nRealCount );
|
|
|
|
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16 iTarget = 0;
|
|
|
|
for ( sal_uInt16 i = 0 ; i < nCount; ++i )
|
2010-08-06 09:35:51 +02:00
|
|
|
{
|
|
|
|
SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( i );
|
|
|
|
if( pMethod->IsHidden() )
|
|
|
|
continue;
|
2007-03-15 14:54:30 +00:00
|
|
|
DBG_ASSERT( pMethod, "Method not found! (NULL)" );
|
2010-08-06 09:35:51 +02:00
|
|
|
aSeqMethods.getArray()[ iTarget++ ] = pMethod->GetName();
|
2007-03-15 14:54:30 +00:00
|
|
|
}
|
2001-09-03 10:56:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return aSeqMethods;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2004-07-23 11:03:15 +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
|
|
|
bool HasMethod (
|
|
|
|
ScriptDocument const& rDocument,
|
|
|
|
rtl::OUString const& rLibName,
|
|
|
|
rtl::OUString const& rModName,
|
|
|
|
rtl::OUString const& rMethName
|
|
|
|
)
|
2004-07-23 11:03:15 +00:00
|
|
|
{
|
2012-07-31 10:14:06 +09:00
|
|
|
bool bHasMethod = false;
|
2004-07-23 11:03:15 +00:00
|
|
|
|
2007-03-15 14:54:30 +00:00
|
|
|
::rtl::OUString aOUSource;
|
|
|
|
if ( rDocument.hasModule( rLibName, rModName ) && rDocument.getModule( rLibName, rModName, aOUSource ) )
|
2004-07-23 11:03:15 +00:00
|
|
|
{
|
|
|
|
SbModuleRef xModule = new SbModule( rModName );
|
|
|
|
xModule->SetSource32( aOUSource );
|
|
|
|
SbxArray* pMethods = xModule->GetMethods();
|
|
|
|
if ( pMethods )
|
|
|
|
{
|
|
|
|
SbMethod* pMethod = (SbMethod*)pMethods->Find( rMethName, SbxCLASS_METHOD );
|
2010-08-06 09:35:51 +02:00
|
|
|
if ( pMethod && !pMethod->IsHidden() )
|
2012-07-31 10:14:06 +09:00
|
|
|
bHasMethod = true;
|
2004-07-23 11:03:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bHasMethod;
|
|
|
|
}
|
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
|
|
|
|
2004-07-23 11:03:15 +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
|
|
|
} // namespace basctl
|
2010-10-12 15:57:08 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|