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 .
|
|
|
|
*/
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
#include "scriptdocument.hxx"
|
|
|
|
#include "basobj.hxx"
|
|
|
|
#include "basidesh.hrc"
|
|
|
|
#include "iderid.hxx"
|
|
|
|
#include "dlgeddef.hxx"
|
2007-10-09 14:24:54 +00:00
|
|
|
#include "doceventnotifier.hxx"
|
|
|
|
#include "documentenumeration.hxx"
|
2007-03-15 14:59:30 +00:00
|
|
|
|
Revert "fdo#46808, Convert awt::UnoControlDialogModel to new style"
This reverts commit 6c61b20a8d4a6dcac28801cde82a211fb7e30654. As discussed at
<http://lists.freedesktop.org/archives/libreoffice/2013-May/052449.html> "Re:
fdo#46808, Convert awt::UnoControlDialogModel to new style problem" why the odd
change in 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get
CreateUnoDialog() work again" appears to fix things again:
The problem is that the implementation of the css.awt.UnoControlDialogModel
involves UNO aggregation
(IMPL_CREATE_INSTANCE_WITH_GEOMETRY(UnoControlDialogModel) in
toolkit/soruce/helper/registerservices.cxx creating a
OGeometryControlModel<UnoControlDialogModel> instance that aggregates a
UnoControlDialogModel instance). That means that queryInterface can return a
reference to something that is technically a different object, and that's
what's happening here, and explains why calling setPropertyValue in two
different ways on what logically appears to be a single object can end up
calling two different implementations (of two different physical objects).
(UNO aggregation is known to be broken and should not be used. Nevertheless,
there's still code that does---code that is a horrible mess and hard to clean
up.)
That all this worked as intended in the past is just sheer luck, but any
way of substantially touching it is asking for trouble. I'm going to
revert 6c61b20a8d4a6dcac28801cde82a211fb7e30654 again.
I wasn't able to revert without also reverting
be50ad28f5bbdaeff527f646481ce263843c2401 "fdo#46808, Convert
awt::XUnoControlDialog to new style," as the two were tightly dependant. Also
reverts all the follow-up fixes cb4b6dde8fda2a5848e11063028bf44d72f85431
"-Werror,-Wuninitialized" (sans the const-ness fix in
UpdateHandler::insertControlModel), 697a007c61b9cabceb9767fad87cd5822b300452
"Fix exception specifications," 2ce6828bbbf6ba181bb2276adeec279e74151ef6 "fix
awt::UnoControlModelDialog crash," and 2e2a4827ce6708f0e8677dba9cc92e1479a44086
"scripting: get CreateUnoDialog() work again."
Conflicts:
basctl/source/dlged/dlged.cxx
filter/source/t602/t602filter.cxx
xmlscript/test/imexp.cxx
Change-Id: I5d133468062f3ca36300db52fbd699be1ac72998
2013-05-24 22:44:30 +02:00
|
|
|
#include <com/sun/star/uri/UriReferenceFactory.hpp>
|
|
|
|
#include <com/sun/star/util/theMacroExpander.hpp>
|
2007-03-15 14:59:30 +00:00
|
|
|
#include <com/sun/star/document/MacroExecMode.hpp>
|
Revert "fdo#46808, Convert awt::UnoControlDialogModel to new style"
This reverts commit 6c61b20a8d4a6dcac28801cde82a211fb7e30654. As discussed at
<http://lists.freedesktop.org/archives/libreoffice/2013-May/052449.html> "Re:
fdo#46808, Convert awt::UnoControlDialogModel to new style problem" why the odd
change in 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get
CreateUnoDialog() work again" appears to fix things again:
The problem is that the implementation of the css.awt.UnoControlDialogModel
involves UNO aggregation
(IMPL_CREATE_INSTANCE_WITH_GEOMETRY(UnoControlDialogModel) in
toolkit/soruce/helper/registerservices.cxx creating a
OGeometryControlModel<UnoControlDialogModel> instance that aggregates a
UnoControlDialogModel instance). That means that queryInterface can return a
reference to something that is technically a different object, and that's
what's happening here, and explains why calling setPropertyValue in two
different ways on what logically appears to be a single object can end up
calling two different implementations (of two different physical objects).
(UNO aggregation is known to be broken and should not be used. Nevertheless,
there's still code that does---code that is a horrible mess and hard to clean
up.)
That all this worked as intended in the past is just sheer luck, but any
way of substantially touching it is asking for trouble. I'm going to
revert 6c61b20a8d4a6dcac28801cde82a211fb7e30654 again.
I wasn't able to revert without also reverting
be50ad28f5bbdaeff527f646481ce263843c2401 "fdo#46808, Convert
awt::XUnoControlDialog to new style," as the two were tightly dependant. Also
reverts all the follow-up fixes cb4b6dde8fda2a5848e11063028bf44d72f85431
"-Werror,-Wuninitialized" (sans the const-ness fix in
UpdateHandler::insertControlModel), 697a007c61b9cabceb9767fad87cd5822b300452
"Fix exception specifications," 2ce6828bbbf6ba181bb2276adeec279e74151ef6 "fix
awt::UnoControlModelDialog crash," and 2e2a4827ce6708f0e8677dba9cc92e1479a44086
"scripting: get CreateUnoDialog() work again."
Conflicts:
basctl/source/dlged/dlged.cxx
filter/source/t602/t602filter.cxx
xmlscript/test/imexp.cxx
Change-Id: I5d133468062f3ca36300db52fbd699be1ac72998
2013-05-24 22:44:30 +02:00
|
|
|
#include <com/sun/star/frame/XStorable.hpp>
|
2007-10-09 14:24:54 +00:00
|
|
|
#include <com/sun/star/frame/FrameSearchFlag.hpp>
|
|
|
|
#include <com/sun/star/frame/XDesktop.hpp>
|
|
|
|
#include <com/sun/star/frame/XModel2.hpp>
|
Revert "fdo#46808, Convert awt::UnoControlDialogModel to new style"
This reverts commit 6c61b20a8d4a6dcac28801cde82a211fb7e30654. As discussed at
<http://lists.freedesktop.org/archives/libreoffice/2013-May/052449.html> "Re:
fdo#46808, Convert awt::UnoControlDialogModel to new style problem" why the odd
change in 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get
CreateUnoDialog() work again" appears to fix things again:
The problem is that the implementation of the css.awt.UnoControlDialogModel
involves UNO aggregation
(IMPL_CREATE_INSTANCE_WITH_GEOMETRY(UnoControlDialogModel) in
toolkit/soruce/helper/registerservices.cxx creating a
OGeometryControlModel<UnoControlDialogModel> instance that aggregates a
UnoControlDialogModel instance). That means that queryInterface can return a
reference to something that is technically a different object, and that's
what's happening here, and explains why calling setPropertyValue in two
different ways on what logically appears to be a single object can end up
calling two different implementations (of two different physical objects).
(UNO aggregation is known to be broken and should not be used. Nevertheless,
there's still code that does---code that is a horrible mess and hard to clean
up.)
That all this worked as intended in the past is just sheer luck, but any
way of substantially touching it is asking for trouble. I'm going to
revert 6c61b20a8d4a6dcac28801cde82a211fb7e30654 again.
I wasn't able to revert without also reverting
be50ad28f5bbdaeff527f646481ce263843c2401 "fdo#46808, Convert
awt::XUnoControlDialog to new style," as the two were tightly dependant. Also
reverts all the follow-up fixes cb4b6dde8fda2a5848e11063028bf44d72f85431
"-Werror,-Wuninitialized" (sans the const-ness fix in
UpdateHandler::insertControlModel), 697a007c61b9cabceb9767fad87cd5822b300452
"Fix exception specifications," 2ce6828bbbf6ba181bb2276adeec279e74151ef6 "fix
awt::UnoControlModelDialog crash," and 2e2a4827ce6708f0e8677dba9cc92e1479a44086
"scripting: get CreateUnoDialog() work again."
Conflicts:
basctl/source/dlged/dlged.cxx
filter/source/t602/t602filter.cxx
xmlscript/test/imexp.cxx
Change-Id: I5d133468062f3ca36300db52fbd699be1ac72998
2013-05-24 22:44:30 +02:00
|
|
|
#include <com/sun/star/awt/XWindow2.hpp>
|
|
|
|
#include <com/sun/star/document/XEmbeddedScripts.hpp>
|
2010-07-27 14:43:33 +02:00
|
|
|
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
|
|
|
|
#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
#include <sfx2/objsh.hxx>
|
|
|
|
#include <sfx2/app.hxx>
|
|
|
|
#include <sfx2/viewfrm.hxx>
|
|
|
|
#include <sfx2/bindings.hxx>
|
|
|
|
#include <sfx2/docfile.hxx>
|
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
|
|
|
|
#include <basic/basicmanagerrepository.hxx>
|
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
#include <xmlscript/xmldlg_imexp.hxx>
|
|
|
|
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <unotools/syslocale.hxx>
|
2007-10-09 14:24:54 +00:00
|
|
|
|
|
|
|
#include <unotools/collatorwrapper.hxx>
|
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
#include <tools/diagnose_ex.h>
|
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
#include <comphelper/processfactory.hxx>
|
2008-06-25 12:09:48 +00:00
|
|
|
#include <comphelper/documentinfo.hxx>
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2010-10-16 03:15:49 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2007-10-09 14:24:54 +00:00
|
|
|
|
|
|
|
#include <cppuhelper/implbase1.hxx>
|
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
#include <rtl/uri.hxx>
|
2008-04-24 17:07:01 +00:00
|
|
|
#include <rtl/bootstrap.hxx>
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
#include <osl/process.h>
|
|
|
|
#include <osl/file.hxx>
|
|
|
|
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
namespace basctl
|
|
|
|
{
|
|
|
|
using ::com::sun::star::uno::Sequence;
|
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using ::com::sun::star::frame::XModel;
|
|
|
|
using ::com::sun::star::beans::XPropertySet;
|
|
|
|
using ::com::sun::star::script::XLibraryContainer;
|
|
|
|
using ::com::sun::star::uno::UNO_QUERY_THROW;
|
2007-10-09 14:24:54 +00:00
|
|
|
using ::com::sun::star::uno::UNO_SET_THROW;
|
2007-03-15 14:59:30 +00:00
|
|
|
using ::com::sun::star::beans::XPropertySetInfo;
|
|
|
|
using ::com::sun::star::uno::Exception;
|
|
|
|
using ::com::sun::star::container::XNameContainer;
|
|
|
|
using ::com::sun::star::container::NoSuchElementException;
|
|
|
|
using ::com::sun::star::uno::UNO_QUERY;
|
|
|
|
using ::com::sun::star::task::XStatusIndicator;
|
|
|
|
using ::com::sun::star::uno::makeAny;
|
|
|
|
using ::com::sun::star::script::XLibraryContainer2;
|
|
|
|
using ::com::sun::star::lang::XMultiServiceFactory;
|
2012-10-12 08:57:24 +02:00
|
|
|
using ::com::sun::star::uri::UriReferenceFactory;
|
2007-03-15 14:59:30 +00:00
|
|
|
using ::com::sun::star::uri::XUriReferenceFactory;
|
|
|
|
using ::com::sun::star::uri::XUriReference;
|
|
|
|
using ::com::sun::star::uno::XComponentContext;
|
|
|
|
using ::com::sun::star::util::XMacroExpander;
|
2013-02-08 11:02:37 +02:00
|
|
|
using ::com::sun::star::util::theMacroExpander;
|
2007-03-15 14:59:30 +00:00
|
|
|
using ::com::sun::star::io::XInputStreamProvider;
|
|
|
|
using ::com::sun::star::uno::Any;
|
|
|
|
using ::com::sun::star::io::XInputStream;
|
2007-10-09 14:24:54 +00:00
|
|
|
using ::com::sun::star::frame::XStorable;
|
|
|
|
using ::com::sun::star::util::XModifiable;
|
|
|
|
using ::com::sun::star::frame::XController;
|
|
|
|
using ::com::sun::star::frame::XFrame;
|
|
|
|
using ::com::sun::star::util::URL;
|
|
|
|
using ::com::sun::star::frame::XDispatchProvider;
|
|
|
|
using ::com::sun::star::frame::XDispatch;
|
|
|
|
using ::com::sun::star::beans::PropertyValue;
|
|
|
|
using ::com::sun::star::frame::XDesktop;
|
|
|
|
using ::com::sun::star::container::XEnumerationAccess;
|
|
|
|
using ::com::sun::star::container::XEnumeration;
|
|
|
|
using ::com::sun::star::frame::XModel2;
|
|
|
|
using ::com::sun::star::awt::XWindow2;
|
|
|
|
using ::com::sun::star::document::XEventListener;
|
|
|
|
using ::com::sun::star::lang::EventObject;
|
|
|
|
using ::com::sun::star::uno::RuntimeException;
|
|
|
|
using ::com::sun::star::document::XEventBroadcaster;
|
|
|
|
using ::com::sun::star::document::XEmbeddedScripts;
|
2010-03-02 12:39:31 +00:00
|
|
|
using ::com::sun::star::script::ModuleInfo;
|
2010-07-27 14:43:33 +02:00
|
|
|
using ::com::sun::star::script::vba::XVBACompatibility;
|
|
|
|
using ::com::sun::star::script::vba::XVBAModuleInfo;
|
2013-04-01 18:45:57 +02:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
|
2007-10-09 14:24:54 +00:00
|
|
|
namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag;
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
//====================================================================
|
|
|
|
//= helper
|
|
|
|
//====================================================================
|
|
|
|
namespace
|
|
|
|
{
|
2013-09-22 16:58:29 +01:00
|
|
|
static bool StringCompareLessThan( const OUString& lhs, const OUString& rhs )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2013-09-22 16:58:29 +01:00
|
|
|
return ( lhs.compareToIgnoreAsciiCase( rhs ) < 0 );
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
class FilterDocuments : public docs::IDocumentDescriptorFilter
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
public:
|
|
|
|
FilterDocuments( bool _bFilterInvisible ) : m_bFilterInvisible( _bFilterInvisible ) { }
|
|
|
|
|
2012-03-14 13:27:56 +01:00
|
|
|
virtual ~FilterDocuments() {}
|
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
virtual bool includeDocument( const docs::DocumentDescriptor& _rDocument ) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool impl_isDocumentVisible_nothrow( const docs::DocumentDescriptor& _rDocument ) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_bFilterInvisible;
|
|
|
|
};
|
|
|
|
|
|
|
|
bool FilterDocuments::impl_isDocumentVisible_nothrow( const docs::DocumentDescriptor& _rDocument ) const
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
for ( docs::Controllers::const_iterator controller = _rDocument.aControllers.begin();
|
|
|
|
controller != _rDocument.aControllers.end();
|
|
|
|
++controller
|
|
|
|
)
|
|
|
|
{
|
|
|
|
Reference< XFrame > xFrame( (*controller)->getFrame(), UNO_SET_THROW );
|
|
|
|
Reference< XWindow2 > xContainer( xFrame->getContainerWindow(), UNO_QUERY_THROW );
|
|
|
|
if ( xContainer->isVisible() )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return false;
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
bool FilterDocuments::includeDocument( const docs::DocumentDescriptor& _rDocument ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
Reference< XEmbeddedScripts > xScripts( _rDocument.xModel, UNO_QUERY );
|
|
|
|
if ( !xScripts.is() )
|
|
|
|
return false;
|
|
|
|
if ( !m_bFilterInvisible || impl_isDocumentVisible_nothrow( _rDocument ) )
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcl_getAllModels_throw( docs::Documents& _out_rModels, bool _bVisibleOnly )
|
|
|
|
{
|
|
|
|
_out_rModels.clear();
|
|
|
|
|
|
|
|
FilterDocuments aFilter( _bVisibleOnly );
|
2012-09-19 13:15:15 +02:00
|
|
|
docs::DocumentEnumeration aEnum(
|
|
|
|
comphelper::getProcessComponentContext(), &aFilter );
|
2007-10-09 14:24:54 +00:00
|
|
|
|
|
|
|
aEnum.getDocuments( _out_rModels );
|
2007-03-15 14:59:30 +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
|
|
|
class ScriptDocument::Impl : public DocumentEventListener
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
private:
|
2007-10-09 14:24:54 +00:00
|
|
|
bool m_bIsApplication;
|
|
|
|
bool m_bValid;
|
|
|
|
bool m_bDocumentClosed;
|
|
|
|
Reference< XModel > m_xDocument;
|
|
|
|
Reference< XModifiable > m_xDocModify;
|
|
|
|
Reference< XEmbeddedScripts > m_xScriptAccess;
|
|
|
|
::std::auto_ptr< DocumentEventNotifier >
|
|
|
|
m_pDocListener;
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
public:
|
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
|
|
|
Impl ();
|
|
|
|
Impl (Reference<XModel> const& rxDocument);
|
|
|
|
~Impl ();
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
/** determines whether the instance refers to a valid "document" with script and
|
|
|
|
dialog libraries
|
|
|
|
*/
|
|
|
|
inline bool isValid() const { return m_bValid; }
|
2007-10-09 14:24:54 +00:00
|
|
|
/** determines whether the instance refers to a non-closed document
|
|
|
|
*/
|
|
|
|
inline bool isAlive() const { return m_bValid ? ( m_bIsApplication ? true : !m_bDocumentClosed ) : false; }
|
2007-03-15 14:59:30 +00:00
|
|
|
/// determines whether the "document" refers to the application in real
|
|
|
|
inline bool isApplication() const { return m_bValid && m_bIsApplication; }
|
|
|
|
/// determines whether the document refers to a real document (instead of the application)
|
|
|
|
inline bool isDocument() const { return m_bValid && !m_bIsApplication; }
|
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
/** invalidates the instance
|
|
|
|
*/
|
|
|
|
void invalidate();
|
|
|
|
|
|
|
|
const Reference< XModel >&
|
|
|
|
getDocumentRef() const { return m_xDocument; }
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
/// returns a library container belonging to the document
|
|
|
|
Reference< XLibraryContainer >
|
|
|
|
getLibraryContainer( LibraryContainerType _eType ) const;
|
|
|
|
|
|
|
|
/// determines whether a given library is part of the shared installation
|
2012-10-14 19:00:25 -03:00
|
|
|
bool isLibraryShared( const OUString& _rLibName, LibraryContainerType _eType );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
/** returns the current frame of the document
|
|
|
|
|
|
|
|
To be called for documents only, not for the application.
|
|
|
|
|
|
|
|
If <FALSE/> is returned, an assertion will be raised in non-product builds.
|
|
|
|
*/
|
|
|
|
bool getCurrentFrame( Reference< XFrame >& _out_rxFrame ) const;
|
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
// versions with the same signature/semantics as in ScriptDocument itself
|
|
|
|
bool isReadOnly() const;
|
2010-03-02 12:39:31 +00:00
|
|
|
bool isInVBAMode() const;
|
2007-03-15 14:59:30 +00:00
|
|
|
BasicManager*
|
|
|
|
getBasicManager() const;
|
|
|
|
Reference< XModel >
|
|
|
|
getDocument() const;
|
|
|
|
void setDocumentModified() const;
|
|
|
|
bool isDocumentModified() const;
|
|
|
|
bool saveDocument( const Reference< XStatusIndicator >& _rxStatusIndicator ) const;
|
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString getTitle() const;
|
|
|
|
OUString getURL() const;
|
2007-10-09 14:24:54 +00:00
|
|
|
|
|
|
|
bool allowMacros() const;
|
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
Reference< XNameContainer >
|
2012-10-14 19:00:25 -03:00
|
|
|
getLibrary( LibraryContainerType _eType, const OUString& _rLibName, bool _bLoadLibrary ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
SAL_THROW((NoSuchElementException));
|
2012-10-14 19:00:25 -03:00
|
|
|
bool hasLibrary( LibraryContainerType _eType, const OUString& _rLibName ) const;
|
2007-03-15 14:59:30 +00:00
|
|
|
Reference< XNameContainer >
|
2012-10-14 19:00:25 -03:00
|
|
|
getOrCreateLibrary( LibraryContainerType _eType, const OUString& _rLibName ) const;
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
void loadLibraryIfExists( LibraryContainerType _eType, const OUString& _rLibrary );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool removeModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName, const OUString& _rModuleName );
|
|
|
|
bool hasModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName, const OUString& _rModName ) const;
|
|
|
|
bool getModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName, const OUString& _rObjectName, Any& _out_rModuleOrDialog );
|
|
|
|
bool renameModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName, const OUString& _rOldName, const OUString& _rNewName, const Reference< XNameContainer >& _rxExistingDialogModel );
|
|
|
|
bool createModule( const OUString& _rLibName, const OUString& _rModName, bool _bCreateMain, OUString& _out_rNewModuleCode ) const;
|
|
|
|
bool insertModuleOrDialog( LibraryContainerType _eType, const OUString& _rObjectName, const OUString& _rModName, const Any& _rElement ) const;
|
|
|
|
bool updateModule( const OUString& _rLibName, const OUString& _rModName, const OUString& _rModuleCode ) const;
|
|
|
|
bool createDialog( const OUString& _rLibName, const OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const;
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
protected:
|
|
|
|
// DocumentEventListener
|
|
|
|
virtual void onDocumentCreated( const ScriptDocument& _rDocument );
|
|
|
|
virtual void onDocumentOpened( const ScriptDocument& _rDocument );
|
|
|
|
virtual void onDocumentSave( const ScriptDocument& _rDocument );
|
|
|
|
virtual void onDocumentSaveDone( const ScriptDocument& _rDocument );
|
|
|
|
virtual void onDocumentSaveAs( const ScriptDocument& _rDocument );
|
|
|
|
virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument );
|
|
|
|
virtual void onDocumentClosed( const ScriptDocument& _rDocument );
|
|
|
|
virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument );
|
|
|
|
virtual void onDocumentModeChanged( const ScriptDocument& _rDocument );
|
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
private:
|
2007-10-09 14:24:54 +00:00
|
|
|
bool impl_initDocument_nothrow( const Reference< XModel >& _rxModel );
|
2007-03-15 14:59:30 +00:00
|
|
|
};
|
|
|
|
|
2007-10-09 14:24:54 +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
|
|
|
//= ScriptDocument::Impl - implementation
|
2007-10-09 14:24:54 +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
|
|
|
ScriptDocument::Impl::Impl()
|
2007-10-09 14:24:54 +00:00
|
|
|
:m_bIsApplication( true )
|
2007-03-15 14:59:30 +00:00
|
|
|
,m_bValid( true )
|
2007-10-09 14:24:54 +00:00
|
|
|
,m_bDocumentClosed( false )
|
2007-03-15 14:59:30 +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
|
|
|
ScriptDocument::Impl::Impl( const Reference< XModel >& _rxDocument )
|
2007-10-09 14:24:54 +00:00
|
|
|
:m_bIsApplication( false )
|
2007-03-15 14:59:30 +00:00
|
|
|
,m_bValid( false )
|
2007-10-09 14:24:54 +00:00
|
|
|
,m_bDocumentClosed( false )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
if ( _rxDocument.is() )
|
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
if ( impl_initDocument_nothrow( _rxDocument ) )
|
2007-03-15 14:59:30 +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
|
|
|
ScriptDocument::Impl::~Impl()
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
invalidate();
|
|
|
|
}
|
2007-03-15 14:59:30 +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 ScriptDocument::Impl::invalidate()
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
m_bIsApplication = false;
|
|
|
|
m_bValid = false;
|
|
|
|
m_bDocumentClosed = false;
|
|
|
|
|
|
|
|
m_xDocument.clear();
|
|
|
|
m_xDocModify.clear();
|
|
|
|
m_xScriptAccess.clear();
|
|
|
|
|
|
|
|
if ( m_pDocListener.get() )
|
|
|
|
m_pDocListener->dispose();
|
|
|
|
}
|
|
|
|
|
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 ScriptDocument::Impl::impl_initDocument_nothrow( const Reference< XModel >& _rxModel )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
2007-03-15 14:59:30 +00:00
|
|
|
try
|
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
m_xDocument.set ( _rxModel, UNO_SET_THROW );
|
|
|
|
m_xDocModify.set ( _rxModel, UNO_QUERY_THROW );
|
|
|
|
m_xScriptAccess.set ( _rxModel, UNO_QUERY );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
m_bValid = m_xScriptAccess.is();
|
|
|
|
|
|
|
|
if ( m_bValid )
|
|
|
|
m_pDocListener.reset( new DocumentEventNotifier( *this, _rxModel ) );
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
m_bValid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !m_bValid )
|
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
invalidate();
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
2007-10-09 14:24:54 +00:00
|
|
|
|
|
|
|
return m_bValid;
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
2010-11-08 03:57:20 -05: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
|
|
|
Reference< XLibraryContainer > ScriptDocument::Impl::getLibraryContainer( LibraryContainerType _eType ) const
|
2007-03-15 14:59:30 +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( isValid(), "ScriptDocument::Impl::getLibraryContainer: invalid!" );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
Reference< XLibraryContainer > xContainer;
|
|
|
|
if ( !isValid() )
|
|
|
|
return xContainer;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if ( isApplication() )
|
|
|
|
xContainer.set( _eType == E_SCRIPTS ? SFX_APP()->GetBasicContainer() : SFX_APP()->GetDialogContainer(), UNO_QUERY_THROW );
|
|
|
|
else
|
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
xContainer.set(
|
|
|
|
_eType == E_SCRIPTS ? m_xScriptAccess->getBasicLibraries() : m_xScriptAccess->getDialogLibraries(),
|
2007-03-15 14:59:30 +00:00
|
|
|
UNO_QUERY_THROW );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return xContainer;
|
|
|
|
}
|
|
|
|
|
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 ScriptDocument::Impl::isReadOnly() const
|
2007-03-15 14:59:30 +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( isValid(), "ScriptDocument::Impl::isReadOnly: invalid state!" );
|
|
|
|
OSL_ENSURE( !isApplication(), "ScriptDocument::Impl::isReadOnly: not allowed to be called for the application!" );
|
2007-10-09 14:24:54 +00:00
|
|
|
|
|
|
|
bool bIsReadOnly = true;
|
|
|
|
if ( isValid() && !isApplication() )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// note that XStorable is required by the OfficeDocument service
|
|
|
|
Reference< XStorable > xDocStorable( m_xDocument, UNO_QUERY_THROW );
|
|
|
|
bIsReadOnly = xDocStorable->isReadonly();
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bIsReadOnly;
|
2007-03-15 14:59:30 +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 ScriptDocument::Impl::isInVBAMode() const
|
2010-03-02 12:39:31 +00:00
|
|
|
{
|
|
|
|
bool bResult = false;
|
|
|
|
if ( !isApplication() )
|
|
|
|
{
|
2010-07-27 14:43:33 +02:00
|
|
|
Reference< XVBACompatibility > xVBACompat( getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
|
2010-03-02 12:39:31 +00:00
|
|
|
if ( xVBACompat.is() )
|
2010-07-27 14:43:33 +02:00
|
|
|
bResult = xVBACompat->getVBACompatibilityMode();
|
2010-03-02 12:39:31 +00:00
|
|
|
}
|
|
|
|
return bResult;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05: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* ScriptDocument::Impl::getBasicManager() const
|
2007-03-15 14:59:30 +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( isValid(), "ScriptDocument::Impl::getBasicManager: invalid state!" );
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( !isValid() )
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if ( isApplication() )
|
|
|
|
return SFX_APP()->GetBasicManager();
|
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
return ::basic::BasicManagerRepository::getDocumentBasicManager( m_xDocument );
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05: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
|
|
|
Reference< XModel > ScriptDocument::Impl::getDocument() const
|
2007-03-15 14:59:30 +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( isValid(), "ScriptDocument::Impl::getDocument: invalid state!" );
|
|
|
|
OSL_ENSURE( isDocument(), "ScriptDocument::Impl::getDocument: for documents only!" );
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( !isValid() || !isDocument() )
|
|
|
|
return NULL;
|
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
return m_xDocument;
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
Reference< XNameContainer > ScriptDocument::Impl::getLibrary( LibraryContainerType _eType, const OUString& _rLibName, bool _bLoadLibrary ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
SAL_THROW((NoSuchElementException))
|
|
|
|
{
|
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( isValid(), "ScriptDocument::Impl::getLibrary: invalid state!" );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
Reference< XNameContainer > xContainer;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XLibraryContainer > xLibContainer = getLibraryContainer( _eType );
|
|
|
|
if ( isValid() )
|
|
|
|
{
|
|
|
|
if ( xLibContainer.is() )
|
|
|
|
xContainer.set( xLibContainer->getByName( _rLibName ), UNO_QUERY_THROW );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !xContainer.is() )
|
|
|
|
throw NoSuchElementException();
|
|
|
|
|
|
|
|
// load library
|
|
|
|
if ( _bLoadLibrary && !xLibContainer->isLibraryLoaded( _rLibName ) )
|
|
|
|
xLibContainer->loadLibrary( _rLibName );
|
|
|
|
}
|
|
|
|
catch( const NoSuchElementException& )
|
|
|
|
{
|
|
|
|
throw; // allowed to leave
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
|
|
|
|
return xContainer;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::Impl::hasLibrary( LibraryContainerType _eType, const OUString& _rLibName ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
bool bHas = false;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XLibraryContainer > xLibContainer = getLibraryContainer( _eType );
|
|
|
|
bHas = xLibContainer.is() && xLibContainer->hasByName( _rLibName );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return bHas;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
Reference< XNameContainer > ScriptDocument::Impl::getOrCreateLibrary( LibraryContainerType _eType, const OUString& _rLibName ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
Reference< XNameContainer > xLibrary;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XLibraryContainer > xLibContainer( getLibraryContainer( _eType ), UNO_QUERY_THROW );
|
|
|
|
if ( xLibContainer->hasByName( _rLibName ) )
|
|
|
|
xLibrary.set( xLibContainer->getByName( _rLibName ), UNO_QUERY_THROW );
|
|
|
|
else
|
|
|
|
xLibrary.set( xLibContainer->createLibrary( _rLibName ), UNO_QUERY_THROW );
|
|
|
|
|
|
|
|
if ( !xLibContainer->isLibraryLoaded( _rLibName ) )
|
|
|
|
xLibContainer->loadLibrary( _rLibName );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return xLibrary;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
void ScriptDocument::Impl::loadLibraryIfExists( LibraryContainerType _eType, const OUString& _rLibrary )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XLibraryContainer > xLibContainer( getLibraryContainer( _eType ) );
|
|
|
|
if ( xLibContainer.is() && xLibContainer->hasByName( _rLibrary ) && !xLibContainer->isLibraryLoaded( _rLibrary ) )
|
|
|
|
xLibContainer->loadLibrary( _rLibrary );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::Impl::removeModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName, const OUString& _rModuleName )
|
2007-03-15 14:59:30 +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( isValid(), "ScriptDocument::Impl::removeModuleOrDialog: invalid!" );
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( isValid() )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, true ) );
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( xLib.is() )
|
|
|
|
{
|
|
|
|
xLib->removeByName( _rModuleName );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::Impl::hasModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName, const OUString& _rModName ) const
|
2007-03-15 14:59:30 +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( isValid(), "ScriptDocument::Impl::hasModuleOrDialog: invalid!" );
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( !isValid() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, true ) );
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( xLib.is() )
|
|
|
|
return xLib->hasByName( _rModName );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::Impl::getModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName, const OUString& _rObjectName, Any& _out_rModuleOrDialog )
|
2007-03-15 14:59:30 +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( isValid(), "ScriptDocument::Impl::getModuleOrDialog: invalid!" );
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( !isValid() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
_out_rModuleOrDialog.clear();
|
|
|
|
try
|
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, true ), UNO_QUERY_THROW );
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( xLib->hasByName( _rObjectName ) )
|
|
|
|
{
|
|
|
|
_out_rModuleOrDialog = xLib->getByName( _rObjectName );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::Impl::renameModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName,
|
|
|
|
const OUString& _rOldName, const OUString& _rNewName, const Reference< XNameContainer >& _rxExistingDialogModel )
|
2007-03-15 14:59:30 +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( isValid(), "ScriptDocument::Impl::renameModuleOrDialog: invalid!" );
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( !isValid() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, true ), UNO_QUERY_THROW );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
// get element
|
|
|
|
Any aElement( xLib->getByName( _rOldName ) );
|
|
|
|
|
|
|
|
// remove element from container
|
|
|
|
xLib->removeByName( _rOldName );
|
|
|
|
|
|
|
|
// if it's a dialog, import and export, to reflect the new name
|
|
|
|
if ( _eType == E_DIALOGS )
|
|
|
|
{
|
|
|
|
// create dialog model
|
2012-09-19 13:15:15 +02:00
|
|
|
Reference< XComponentContext > aContext(
|
|
|
|
comphelper::getProcessComponentContext() );
|
2007-03-15 14:59:30 +00:00
|
|
|
Reference< XNameContainer > xDialogModel;
|
|
|
|
if ( _rxExistingDialogModel.is() )
|
|
|
|
xDialogModel = _rxExistingDialogModel;
|
|
|
|
else
|
Revert "fdo#46808, Convert awt::UnoControlDialogModel to new style"
This reverts commit 6c61b20a8d4a6dcac28801cde82a211fb7e30654. As discussed at
<http://lists.freedesktop.org/archives/libreoffice/2013-May/052449.html> "Re:
fdo#46808, Convert awt::UnoControlDialogModel to new style problem" why the odd
change in 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get
CreateUnoDialog() work again" appears to fix things again:
The problem is that the implementation of the css.awt.UnoControlDialogModel
involves UNO aggregation
(IMPL_CREATE_INSTANCE_WITH_GEOMETRY(UnoControlDialogModel) in
toolkit/soruce/helper/registerservices.cxx creating a
OGeometryControlModel<UnoControlDialogModel> instance that aggregates a
UnoControlDialogModel instance). That means that queryInterface can return a
reference to something that is technically a different object, and that's
what's happening here, and explains why calling setPropertyValue in two
different ways on what logically appears to be a single object can end up
calling two different implementations (of two different physical objects).
(UNO aggregation is known to be broken and should not be used. Nevertheless,
there's still code that does---code that is a horrible mess and hard to clean
up.)
That all this worked as intended in the past is just sheer luck, but any
way of substantially touching it is asking for trouble. I'm going to
revert 6c61b20a8d4a6dcac28801cde82a211fb7e30654 again.
I wasn't able to revert without also reverting
be50ad28f5bbdaeff527f646481ce263843c2401 "fdo#46808, Convert
awt::XUnoControlDialog to new style," as the two were tightly dependant. Also
reverts all the follow-up fixes cb4b6dde8fda2a5848e11063028bf44d72f85431
"-Werror,-Wuninitialized" (sans the const-ness fix in
UpdateHandler::insertControlModel), 697a007c61b9cabceb9767fad87cd5822b300452
"Fix exception specifications," 2ce6828bbbf6ba181bb2276adeec279e74151ef6 "fix
awt::UnoControlModelDialog crash," and 2e2a4827ce6708f0e8677dba9cc92e1479a44086
"scripting: get CreateUnoDialog() work again."
Conflicts:
basctl/source/dlged/dlged.cxx
filter/source/t602/t602filter.cxx
xmlscript/test/imexp.cxx
Change-Id: I5d133468062f3ca36300db52fbd699be1ac72998
2013-05-24 22:44:30 +02:00
|
|
|
xDialogModel.set(
|
|
|
|
( aContext->getServiceManager()->
|
|
|
|
createInstanceWithContext(
|
|
|
|
"com.sun.star.awt.UnoControlDialogModel",
|
|
|
|
aContext ) ),
|
|
|
|
UNO_QUERY_THROW );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
// import dialog model
|
|
|
|
Reference< XInputStreamProvider > xISP( aElement, UNO_QUERY_THROW );
|
|
|
|
if ( !_rxExistingDialogModel.is() )
|
|
|
|
{
|
|
|
|
Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW );
|
2012-09-19 13:15:15 +02:00
|
|
|
::xmlscript::importDialogModel( xInput, xDialogModel, aContext, isDocument() ? getDocument() : Reference< XModel >() );
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// set new name as property
|
|
|
|
Reference< XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY_THROW );
|
|
|
|
xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rNewName ) );
|
|
|
|
|
|
|
|
// export dialog model
|
2012-09-19 13:15:15 +02:00
|
|
|
xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext, isDocument() ? getDocument() : Reference< XModel >() );
|
2007-03-15 14:59:30 +00:00
|
|
|
aElement <<= xISP;
|
|
|
|
}
|
|
|
|
|
|
|
|
// insert element by new name in container
|
2010-10-06 10:16:13 +01:00
|
|
|
if ( _eType == E_SCRIPTS )
|
2010-03-02 12:39:31 +00:00
|
|
|
{
|
|
|
|
Reference< XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
|
|
|
|
if ( xVBAModuleInfo->hasModuleInfo( _rOldName ) )
|
|
|
|
{
|
|
|
|
ModuleInfo sModuleInfo = xVBAModuleInfo->getModuleInfo( _rOldName );
|
|
|
|
xVBAModuleInfo->removeModuleInfo( _rOldName );
|
|
|
|
xVBAModuleInfo->insertModuleInfo( _rNewName, sModuleInfo );
|
|
|
|
}
|
|
|
|
}
|
2007-03-15 14:59:30 +00:00
|
|
|
xLib->insertByName( _rNewName, aElement );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::Impl::createModule( const OUString& _rLibName, const OUString& _rModName, bool _bCreateMain, OUString& _out_rNewModuleCode ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2012-10-14 19:00:25 -03:00
|
|
|
_out_rNewModuleCode = OUString();
|
2007-03-15 14:59:30 +00:00
|
|
|
try
|
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
Reference< XNameContainer > xLib( getLibrary( E_SCRIPTS, _rLibName, true ) );
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( !xLib.is() || xLib->hasByName( _rModName ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// create new module
|
2012-10-14 19:00:25 -03:00
|
|
|
_out_rNewModuleCode = "REM ***** BASIC *****\n\n" ;
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( _bCreateMain )
|
2012-10-14 19:00:25 -03:00
|
|
|
_out_rNewModuleCode += "Sub Main\n\nEnd Sub\n" ;
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
// insert module into library
|
|
|
|
xLib->insertByName( _rModName, makeAny( _out_rNewModuleCode ) );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::Impl::insertModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName, const OUString& _rObjectName, const Any& _rElement ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XNameContainer > xLib( getOrCreateLibrary( _eType, _rLibName ), UNO_QUERY_THROW );
|
|
|
|
if ( xLib->hasByName( _rObjectName ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
xLib->insertByName( _rObjectName, _rElement );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::Impl::updateModule( const OUString& _rLibName, const OUString& _rModName, const OUString& _rModuleCode ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XNameContainer > xLib( getOrCreateLibrary( E_SCRIPTS, _rLibName ), UNO_QUERY_THROW );
|
|
|
|
if ( !xLib->hasByName( _rModName ) )
|
|
|
|
return false;
|
2010-04-19 11:02:13 +01:00
|
|
|
xLib->replaceByName( _rModName, makeAny( _rModuleCode ) );
|
2007-03-15 14:59:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::Impl::createDialog( const OUString& _rLibName, const OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
Reference< XNameContainer > xLib( getLibrary( E_DIALOGS, _rLibName, true ), UNO_QUERY_THROW );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
// create dialog
|
|
|
|
_out_rDialogProvider.clear();
|
|
|
|
if ( xLib->hasByName( _rDialogName ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// create new dialog model
|
2012-09-19 13:15:15 +02:00
|
|
|
Reference< XComponentContext > aContext(
|
|
|
|
comphelper::getProcessComponentContext() );
|
Revert "fdo#46808, Convert awt::UnoControlDialogModel to new style"
This reverts commit 6c61b20a8d4a6dcac28801cde82a211fb7e30654. As discussed at
<http://lists.freedesktop.org/archives/libreoffice/2013-May/052449.html> "Re:
fdo#46808, Convert awt::UnoControlDialogModel to new style problem" why the odd
change in 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get
CreateUnoDialog() work again" appears to fix things again:
The problem is that the implementation of the css.awt.UnoControlDialogModel
involves UNO aggregation
(IMPL_CREATE_INSTANCE_WITH_GEOMETRY(UnoControlDialogModel) in
toolkit/soruce/helper/registerservices.cxx creating a
OGeometryControlModel<UnoControlDialogModel> instance that aggregates a
UnoControlDialogModel instance). That means that queryInterface can return a
reference to something that is technically a different object, and that's
what's happening here, and explains why calling setPropertyValue in two
different ways on what logically appears to be a single object can end up
calling two different implementations (of two different physical objects).
(UNO aggregation is known to be broken and should not be used. Nevertheless,
there's still code that does---code that is a horrible mess and hard to clean
up.)
That all this worked as intended in the past is just sheer luck, but any
way of substantially touching it is asking for trouble. I'm going to
revert 6c61b20a8d4a6dcac28801cde82a211fb7e30654 again.
I wasn't able to revert without also reverting
be50ad28f5bbdaeff527f646481ce263843c2401 "fdo#46808, Convert
awt::XUnoControlDialog to new style," as the two were tightly dependant. Also
reverts all the follow-up fixes cb4b6dde8fda2a5848e11063028bf44d72f85431
"-Werror,-Wuninitialized" (sans the const-ness fix in
UpdateHandler::insertControlModel), 697a007c61b9cabceb9767fad87cd5822b300452
"Fix exception specifications," 2ce6828bbbf6ba181bb2276adeec279e74151ef6 "fix
awt::UnoControlModelDialog crash," and 2e2a4827ce6708f0e8677dba9cc92e1479a44086
"scripting: get CreateUnoDialog() work again."
Conflicts:
basctl/source/dlged/dlged.cxx
filter/source/t602/t602filter.cxx
xmlscript/test/imexp.cxx
Change-Id: I5d133468062f3ca36300db52fbd699be1ac72998
2013-05-24 22:44:30 +02:00
|
|
|
Reference< XNameContainer > xDialogModel(
|
|
|
|
aContext->getServiceManager()->createInstanceWithContext(
|
|
|
|
"com.sun.star.awt.UnoControlDialogModel", aContext ),
|
|
|
|
UNO_QUERY_THROW );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
// set name property
|
Revert "fdo#46808, Convert awt::UnoControlDialogModel to new style"
This reverts commit 6c61b20a8d4a6dcac28801cde82a211fb7e30654. As discussed at
<http://lists.freedesktop.org/archives/libreoffice/2013-May/052449.html> "Re:
fdo#46808, Convert awt::UnoControlDialogModel to new style problem" why the odd
change in 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get
CreateUnoDialog() work again" appears to fix things again:
The problem is that the implementation of the css.awt.UnoControlDialogModel
involves UNO aggregation
(IMPL_CREATE_INSTANCE_WITH_GEOMETRY(UnoControlDialogModel) in
toolkit/soruce/helper/registerservices.cxx creating a
OGeometryControlModel<UnoControlDialogModel> instance that aggregates a
UnoControlDialogModel instance). That means that queryInterface can return a
reference to something that is technically a different object, and that's
what's happening here, and explains why calling setPropertyValue in two
different ways on what logically appears to be a single object can end up
calling two different implementations (of two different physical objects).
(UNO aggregation is known to be broken and should not be used. Nevertheless,
there's still code that does---code that is a horrible mess and hard to clean
up.)
That all this worked as intended in the past is just sheer luck, but any
way of substantially touching it is asking for trouble. I'm going to
revert 6c61b20a8d4a6dcac28801cde82a211fb7e30654 again.
I wasn't able to revert without also reverting
be50ad28f5bbdaeff527f646481ce263843c2401 "fdo#46808, Convert
awt::XUnoControlDialog to new style," as the two were tightly dependant. Also
reverts all the follow-up fixes cb4b6dde8fda2a5848e11063028bf44d72f85431
"-Werror,-Wuninitialized" (sans the const-ness fix in
UpdateHandler::insertControlModel), 697a007c61b9cabceb9767fad87cd5822b300452
"Fix exception specifications," 2ce6828bbbf6ba181bb2276adeec279e74151ef6 "fix
awt::UnoControlModelDialog crash," and 2e2a4827ce6708f0e8677dba9cc92e1479a44086
"scripting: get CreateUnoDialog() work again."
Conflicts:
basctl/source/dlged/dlged.cxx
filter/source/t602/t602filter.cxx
xmlscript/test/imexp.cxx
Change-Id: I5d133468062f3ca36300db52fbd699be1ac72998
2013-05-24 22:44:30 +02:00
|
|
|
Reference< XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY_THROW );
|
|
|
|
xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
// export dialog model
|
2012-09-19 13:15:15 +02:00
|
|
|
_out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext, isDocument() ? getDocument() : Reference< XModel >() );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
// insert dialog into library
|
|
|
|
xLib->insertByName( _rDialogName, makeAny( _out_rDialogProvider ) );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
|
|
|
|
return _out_rDialogProvider.is();
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05: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 ScriptDocument::Impl::setDocumentModified() const
|
2007-03-15 14:59:30 +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( isValid() && isDocument(), "ScriptDocument::Impl::setDocumentModified: only to be called for real documents!" );
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( isValid() && isDocument() )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
m_xDocModify->setModified( true );
|
2007-10-09 14:24:54 +00:00
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
}
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05: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 ScriptDocument::Impl::isDocumentModified() const
|
2007-03-15 14:59:30 +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( isValid() && isDocument(), "ScriptDocument::Impl::isDocumentModified: only to be called for real documents!" );
|
2007-10-09 14:24:54 +00:00
|
|
|
bool bIsModified = false;
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( isValid() && isDocument() )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
bIsModified = m_xDocModify->isModified();
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bIsModified;
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05: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 ScriptDocument::Impl::saveDocument( const Reference< XStatusIndicator >& _rxStatusIndicator ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
Reference< XFrame > xFrame;
|
|
|
|
if ( !getCurrentFrame( xFrame ) )
|
2007-03-15 14:59:30 +00:00
|
|
|
return false;
|
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
Sequence< PropertyValue > aArgs;
|
2007-03-15 14:59:30 +00:00
|
|
|
if ( _rxStatusIndicator.is() )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
aArgs.realloc(1);
|
2012-10-14 19:00:25 -03:00
|
|
|
aArgs[0].Name = "StatusIndicator" ;
|
2007-10-09 14:24:54 +00:00
|
|
|
aArgs[0].Value <<= _rxStatusIndicator;
|
|
|
|
}
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
URL aURL;
|
2012-10-14 19:00:25 -03:00
|
|
|
aURL.Complete = ".uno:Save" ;
|
2007-10-09 14:24:54 +00:00
|
|
|
aURL.Main = aURL.Complete;
|
2012-10-14 19:00:25 -03:00
|
|
|
aURL.Protocol = ".uno:" ;
|
|
|
|
aURL.Path = "Save" ;
|
2007-10-09 14:24:54 +00:00
|
|
|
|
|
|
|
Reference< XDispatchProvider > xDispProv( xFrame, UNO_QUERY_THROW );
|
|
|
|
Reference< XDispatch > xDispatch(
|
2012-10-14 19:00:25 -03:00
|
|
|
xDispProv->queryDispatch( aURL, "_self", FrameSearchFlag::AUTO ),
|
2007-10-09 14:24:54 +00:00
|
|
|
UNO_SET_THROW );
|
|
|
|
|
|
|
|
xDispatch->dispatch( aURL, aArgs );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2007-03-15 14:59:30 +00:00
|
|
|
return false;
|
2007-10-09 14:24:54 +00:00
|
|
|
}
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString ScriptDocument::Impl::getTitle() const
|
2007-10-09 14:24:54 +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_PRECOND( isValid() && isDocument(), "ScriptDocument::Impl::getTitle: for documents only!" );
|
2007-10-09 14:24:54 +00:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString sTitle;
|
2007-10-09 14:24:54 +00:00
|
|
|
if ( isValid() && isDocument() )
|
|
|
|
{
|
2008-06-25 12:09:48 +00:00
|
|
|
sTitle = ::comphelper::DocumentInfo::getDocumentTitle( m_xDocument );
|
2007-10-09 14:24:54 +00:00
|
|
|
}
|
|
|
|
return sTitle;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString ScriptDocument::Impl::getURL() const
|
2007-10-09 14:24:54 +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_PRECOND( isValid() && isDocument(), "ScriptDocument::Impl::getURL: for documents only!" );
|
2007-10-09 14:24:54 +00:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString sURL;
|
2007-10-09 14:24:54 +00:00
|
|
|
if ( isValid() && isDocument() )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
sURL = m_xDocument->getURL();
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sURL;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05: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 ScriptDocument::Impl::allowMacros() const
|
2007-10-09 14:24:54 +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( isValid() && isDocument(), "ScriptDocument::Impl::allowMacros: for documents only!" );
|
2007-10-09 14:24:54 +00:00
|
|
|
bool bAllow = false;
|
|
|
|
if ( isValid() && isDocument() )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
bAllow = m_xScriptAccess->getAllowMacroExecution();
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bAllow;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05: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 ScriptDocument::Impl::getCurrentFrame( Reference< XFrame >& _out_rxFrame ) const
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
_out_rxFrame.clear();
|
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_PRECOND( isValid() && isDocument(), "ScriptDocument::Impl::getCurrentFrame: documents only!" );
|
2007-10-09 14:24:54 +00:00
|
|
|
if ( !isValid() || !isDocument() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XModel > xDocument( m_xDocument, UNO_SET_THROW );
|
|
|
|
Reference< XController > xController( xDocument->getCurrentController(), UNO_SET_THROW );
|
|
|
|
_out_rxFrame.set( xController->getFrame(), UNO_SET_THROW );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
|
|
|
|
return _out_rxFrame.is();
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::Impl::isLibraryShared( const OUString& _rLibName, LibraryContainerType _eType )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
bool bIsShared = false;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XLibraryContainer2 > xLibContainer( getLibraryContainer( _eType ), UNO_QUERY_THROW );
|
|
|
|
|
|
|
|
if ( !xLibContainer->hasByName( _rLibName ) || !xLibContainer->isLibraryLink( _rLibName ) )
|
|
|
|
return false;
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString aFileURL;
|
2012-10-12 08:57:24 +02:00
|
|
|
Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
|
|
|
|
Reference< XUriReferenceFactory > xUriFac = UriReferenceFactory::create(xContext);
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString aLinkURL( xLibContainer->getLibraryLinkURL( _rLibName ) );
|
2007-03-15 14:59:30 +00:00
|
|
|
Reference< XUriReference > xUriRef( xUriFac->parse( aLinkURL ), UNO_QUERY_THROW );
|
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString aScheme = xUriRef->getScheme();
|
2012-12-29 11:32:51 -02:00
|
|
|
if ( aScheme.equalsIgnoreAsciiCase("file") )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
aFileURL = aLinkURL;
|
|
|
|
}
|
2012-12-29 11:32:51 -02:00
|
|
|
else if ( aScheme.equalsIgnoreAsciiCase("vnd.sun.star.pkg") )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString aAuthority = xUriRef->getAuthority();
|
2012-12-29 11:32:51 -02:00
|
|
|
if ( aAuthority.matchIgnoreAsciiCase("vnd.sun.star.expand:") )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString aDecodedURL( aAuthority.copy( sizeof ( "vnd.sun.star.expand:" ) - 1 ) );
|
2007-03-15 14:59:30 +00:00
|
|
|
aDecodedURL = ::rtl::Uri::decode( aDecodedURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
|
2013-02-08 11:02:37 +02:00
|
|
|
Reference< XMacroExpander > xMacroExpander = theMacroExpander::get(xContext);
|
2007-03-15 14:59:30 +00:00
|
|
|
aFileURL = xMacroExpander->expandMacros( aDecodedURL );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-09 22:23:22 -02:00
|
|
|
if ( !aFileURL.isEmpty() )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
::osl::DirectoryItem aFileItem;
|
2011-04-13 21:39:36 +02:00
|
|
|
::osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL );
|
2007-03-15 14:59:30 +00:00
|
|
|
OSL_VERIFY( ::osl::DirectoryItem::get( aFileURL, aFileItem ) == ::osl::FileBase::E_None );
|
|
|
|
OSL_VERIFY( aFileItem.getFileStatus( aFileStatus ) == ::osl::FileBase::E_None );
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString aCanonicalFileURL( aFileStatus.getFileURL() );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString aSearchURL1( "share/basic" );
|
|
|
|
OUString aSearchURL2( "share/uno_packages" );
|
|
|
|
OUString aSearchURL3( "share/extensions" );
|
2011-12-10 02:59:29 -05:00
|
|
|
if( aCanonicalFileURL.indexOf( aSearchURL1 ) >= 0 ||
|
|
|
|
aCanonicalFileURL.indexOf( aSearchURL2 ) >= 0 ||
|
|
|
|
aCanonicalFileURL.indexOf( aSearchURL3 ) >= 0 )
|
2010-04-21 16:04:34 +02:00
|
|
|
bIsShared = true;
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
|
|
|
|
return bIsShared;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05: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 ScriptDocument::Impl::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
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 ScriptDocument::Impl::onDocumentOpened( const ScriptDocument& /*_rDocument*/ )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
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 ScriptDocument::Impl::onDocumentSave( const ScriptDocument& /*_rDocument*/ )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
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 ScriptDocument::Impl::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
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 ScriptDocument::Impl::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
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 ScriptDocument::Impl::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
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 ScriptDocument::Impl::onDocumentClosed( const ScriptDocument& _rDocument )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
DBG_TESTSOLARMUTEX();
|
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_PRECOND( isValid(), "ScriptDocument::Impl::onDocumentClosed: should not be listening if I'm not valid!" );
|
2007-10-09 14:24:54 +00:00
|
|
|
|
|
|
|
bool bMyDocument = m_xDocument == _rDocument.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
|
|
|
OSL_PRECOND( bMyDocument, "ScriptDocument::Impl::onDocumentClosed: didn't want to know *this*!" );
|
2007-10-09 14:24:54 +00:00
|
|
|
if ( bMyDocument )
|
|
|
|
{
|
|
|
|
m_bDocumentClosed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05: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 ScriptDocument::Impl::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
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 ScriptDocument::Impl::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/ )
|
2007-10-09 14:24:54 +00:00
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
//====================================================================
|
|
|
|
//= ScriptDocument
|
|
|
|
//====================================================================
|
|
|
|
ScriptDocument::ScriptDocument()
|
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
|
|
|
:m_pImpl(new Impl)
|
|
|
|
{ }
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
ScriptDocument::ScriptDocument( ScriptDocument::SpecialDocument _eType )
|
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
|
|
|
:m_pImpl( new Impl( Reference< XModel >() ) )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
OSL_ENSURE( _eType == NoDocument, "ScriptDocument::ScriptDocument: unknown SpecialDocument type!" );
|
|
|
|
(void)_eType;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
ScriptDocument::ScriptDocument( const Reference< XModel >& _rxDocument )
|
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
|
|
|
:m_pImpl( new Impl( _rxDocument ) )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
OSL_ENSURE( _rxDocument.is(), "ScriptDocument::ScriptDocument: document must not be NULL!" );
|
2007-03-15 14:59:30 +00:00
|
|
|
// a NULL document results in an uninitialized instance, and for this
|
|
|
|
// purpose, there is a dedicated constructor
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
ScriptDocument::ScriptDocument( const ScriptDocument& _rSource )
|
|
|
|
:m_pImpl( _rSource.m_pImpl )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
ScriptDocument::~ScriptDocument()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
const ScriptDocument& ScriptDocument::getApplicationScriptDocument()
|
|
|
|
{
|
|
|
|
static ScriptDocument s_aApplicationScripts;
|
|
|
|
return s_aApplicationScripts;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
ScriptDocument ScriptDocument::getDocumentForBasicManager( const BasicManager* _pManager )
|
|
|
|
{
|
|
|
|
if ( _pManager == SFX_APP()->GetBasicManager() )
|
|
|
|
return getApplicationScriptDocument();
|
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
docs::Documents aDocuments;
|
|
|
|
lcl_getAllModels_throw( aDocuments, false );
|
|
|
|
|
|
|
|
for ( docs::Documents::const_iterator doc = aDocuments.begin();
|
|
|
|
doc != aDocuments.end();
|
|
|
|
++doc
|
|
|
|
)
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
const BasicManager* pDocBasicManager = ::basic::BasicManagerRepository::getDocumentBasicManager( doc->xModel );
|
|
|
|
if ( ( pDocBasicManager != SFX_APP()->GetBasicManager() )
|
|
|
|
&& ( pDocBasicManager == _pManager )
|
2007-03-15 14:59:30 +00:00
|
|
|
)
|
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
return ScriptDocument( doc->xModel );
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-12 11:29:14 +01:00
|
|
|
OSL_FAIL( "ScriptDocument::getDocumentForBasicManager: did not find a document for this manager!" );
|
2007-03-15 14:59:30 +00:00
|
|
|
return ScriptDocument( NoDocument );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
ScriptDocument ScriptDocument::getDocumentWithURLOrCaption( const OUString& _rUrlOrCaption )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
ScriptDocument aDocument( getApplicationScriptDocument() );
|
2011-12-09 22:23:22 -02:00
|
|
|
if ( _rUrlOrCaption.isEmpty() )
|
2007-10-09 14:24:54 +00:00
|
|
|
return aDocument;
|
|
|
|
|
|
|
|
docs::Documents aDocuments;
|
|
|
|
lcl_getAllModels_throw( aDocuments, false );
|
|
|
|
|
|
|
|
for ( docs::Documents::const_iterator doc = aDocuments.begin();
|
|
|
|
doc != aDocuments.end();
|
|
|
|
++doc
|
|
|
|
)
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
const ScriptDocument aCheck = ScriptDocument( doc->xModel );
|
|
|
|
if ( _rUrlOrCaption == aCheck.getTitle()
|
|
|
|
|| _rUrlOrCaption == aCheck.getURL()
|
|
|
|
)
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
aDocument = aCheck;
|
|
|
|
break;
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
}
|
2007-10-09 14:24:54 +00:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
return aDocument;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
namespace
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
struct DocumentTitleLess : public ::std::binary_function< ScriptDocument, ScriptDocument, bool >
|
|
|
|
{
|
|
|
|
DocumentTitleLess( const CollatorWrapper& _rCollator )
|
|
|
|
:m_aCollator( _rCollator )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator()( const ScriptDocument& _lhs, const ScriptDocument& _rhs ) const
|
|
|
|
{
|
|
|
|
return m_aCollator.compareString( _lhs.getTitle(), _rhs.getTitle() ) < 0;
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
const CollatorWrapper m_aCollator;
|
|
|
|
};
|
|
|
|
}
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
ScriptDocuments ScriptDocument::getAllScriptDocuments( ScriptDocument::ScriptDocumentList _eListType )
|
|
|
|
{
|
|
|
|
ScriptDocuments aScriptDocs;
|
|
|
|
|
|
|
|
// include application?
|
|
|
|
if ( _eListType == AllWithApplication )
|
|
|
|
aScriptDocs.push_back( getApplicationScriptDocument() );
|
|
|
|
|
|
|
|
// obtain documents
|
|
|
|
try
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
docs::Documents aDocuments;
|
|
|
|
lcl_getAllModels_throw( aDocuments, true /* exclude invisible */ );
|
|
|
|
|
|
|
|
for ( docs::Documents::const_iterator doc = aDocuments.begin();
|
|
|
|
doc != aDocuments.end();
|
|
|
|
++doc
|
2007-03-15 14:59:30 +00:00
|
|
|
)
|
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
// exclude documents without script/library containers
|
|
|
|
ScriptDocument aDoc( doc->xModel );
|
|
|
|
if ( !aDoc.isValid() )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
aScriptDocs.push_back( aDoc );
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
2007-10-09 14:24:54 +00:00
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
// sort document list by doc title?
|
|
|
|
if ( _eListType == DocumentsSorted )
|
|
|
|
{
|
2012-11-20 12:57:26 +02:00
|
|
|
CollatorWrapper aCollator( ::comphelper::getProcessComponentContext() );
|
2012-11-23 23:06:10 +01:00
|
|
|
aCollator.loadDefaultCollator( SvtSysLocale().GetLanguageTag().getLocale(), 0 );
|
2007-10-09 14:24:54 +00:00
|
|
|
::std::sort( aScriptDocs.begin(), aScriptDocs.end(), DocumentTitleLess( aCollator ) );
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
return aScriptDocs;
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
bool ScriptDocument::operator==( const ScriptDocument& _rhs ) const
|
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
return m_pImpl->getDocumentRef() == _rhs.m_pImpl->getDocumentRef();
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
sal_Int32 ScriptDocument::hashCode() const
|
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
return sal::static_int_cast<sal_Int32>(reinterpret_cast< sal_IntPtr >( m_pImpl->getDocumentRef().get() ));
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
bool ScriptDocument::isValid() const
|
|
|
|
{
|
|
|
|
return m_pImpl->isValid();
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
bool ScriptDocument::isAlive() const
|
|
|
|
{
|
|
|
|
return m_pImpl->isAlive();
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
Reference< XLibraryContainer > ScriptDocument::getLibraryContainer( LibraryContainerType _eType ) const
|
|
|
|
{
|
|
|
|
return m_pImpl->getLibraryContainer( _eType );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
Reference< XNameContainer > ScriptDocument::getLibrary( LibraryContainerType _eType, const OUString& _rLibName, bool _bLoadLibrary ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
SAL_THROW((NoSuchElementException))
|
|
|
|
{
|
|
|
|
return m_pImpl->getLibrary( _eType, _rLibName, _bLoadLibrary );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::hasLibrary( LibraryContainerType _eType, const OUString& _rLibName ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->hasLibrary( _eType, _rLibName );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
Reference< XNameContainer > ScriptDocument::getOrCreateLibrary( LibraryContainerType _eType, const OUString& _rLibName ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->getOrCreateLibrary( _eType, _rLibName );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
void ScriptDocument::loadLibraryIfExists( LibraryContainerType _eType, const OUString& _rLibrary )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
m_pImpl->loadLibraryIfExists( _eType, _rLibrary );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
Sequence< OUString > ScriptDocument::getObjectNames( LibraryContainerType _eType, const OUString& _rLibName ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2012-10-14 19:00:25 -03:00
|
|
|
Sequence< OUString > aModuleNames;
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2008-03-06 18:13:50 +00:00
|
|
|
if ( hasLibrary( _eType, _rLibName ) )
|
|
|
|
{
|
|
|
|
Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, false ) );
|
|
|
|
if ( xLib.is() )
|
|
|
|
aModuleNames = xLib->getElementNames();
|
|
|
|
}
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
|
|
|
|
// sort
|
|
|
|
::std::sort( aModuleNames.getArray() , aModuleNames.getArray() + aModuleNames.getLength() , StringCompareLessThan );
|
|
|
|
|
|
|
|
return aModuleNames;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString ScriptDocument::createObjectName( LibraryContainerType _eType, const OUString& _rLibName ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString aObjectName;
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2012-10-18 11:39:10 +02:00
|
|
|
OUString aBaseName = _eType == E_SCRIPTS ? OUString("Module") : OUString("Dialog");
|
2007-03-15 14:59:30 +00:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
Sequence< OUString > aUsedNames( getObjectNames( _eType, _rLibName ) );
|
|
|
|
::std::set< OUString > aUsedNamesCheck;
|
2007-03-15 14:59:30 +00:00
|
|
|
::std::copy( aUsedNames.getConstArray(), aUsedNames.getConstArray() + aUsedNames.getLength(),
|
2012-10-14 19:00:25 -03:00
|
|
|
::std::insert_iterator< ::std::set< OUString > >( aUsedNamesCheck, aUsedNamesCheck.begin() ) );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
bool bValid = false;
|
2011-12-15 15:13:04 +00:00
|
|
|
sal_Int32 i = 1;
|
2007-03-15 14:59:30 +00:00
|
|
|
while ( !bValid )
|
|
|
|
{
|
|
|
|
aObjectName = aBaseName;
|
2013-08-21 15:07:31 +02:00
|
|
|
aObjectName += OUString::number( i );
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
if ( aUsedNamesCheck.find( aObjectName ) == aUsedNamesCheck.end() )
|
2012-08-07 08:36:40 +02:00
|
|
|
bValid = true;
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return aObjectName;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
Sequence< OUString > ScriptDocument::getLibraryNames() const
|
2007-03-15 14:59:30 +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 GetMergedLibraryNames( getLibraryContainer( E_SCRIPTS ), getLibraryContainer( E_DIALOGS ) );
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
bool ScriptDocument::isReadOnly() const
|
|
|
|
{
|
|
|
|
return m_pImpl->isReadOnly();
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
bool ScriptDocument::isApplication() const
|
|
|
|
{
|
|
|
|
return m_pImpl->isApplication();
|
|
|
|
}
|
|
|
|
|
2010-03-02 12:39:31 +00:00
|
|
|
bool ScriptDocument::isInVBAMode() const
|
|
|
|
{
|
|
|
|
return m_pImpl->isInVBAMode();
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
BasicManager* ScriptDocument::getBasicManager() const
|
|
|
|
{
|
|
|
|
return m_pImpl->getBasicManager();
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
Reference< XModel > ScriptDocument::getDocument() const
|
|
|
|
{
|
|
|
|
return m_pImpl->getDocument();
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
Reference< XModel > ScriptDocument::getDocumentOrNull() const
|
|
|
|
{
|
|
|
|
if ( isDocument() )
|
|
|
|
return m_pImpl->getDocument();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::removeModule( const OUString& _rLibName, const OUString& _rModuleName ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->removeModuleOrDialog( E_SCRIPTS, _rLibName, _rModuleName );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::hasModule( const OUString& _rLibName, const OUString& _rModuleName ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->hasModuleOrDialog( E_SCRIPTS, _rLibName, _rModuleName );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::getModule( const OUString& _rLibName, const OUString& _rModName, OUString& _out_rModuleSource ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
Any aCode;
|
|
|
|
if ( !m_pImpl->getModuleOrDialog( E_SCRIPTS, _rLibName, _rModName, aCode ) )
|
|
|
|
return false;
|
|
|
|
OSL_VERIFY( aCode >>= _out_rModuleSource );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::renameModule( const OUString& _rLibName, const OUString& _rOldName, const OUString& _rNewName ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->renameModuleOrDialog( E_SCRIPTS, _rLibName, _rOldName, _rNewName, NULL );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::createModule( const OUString& _rLibName, const OUString& _rModName, bool _bCreateMain, OUString& _out_rNewModuleCode ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
if ( !m_pImpl->createModule( _rLibName, _rModName, _bCreateMain, _out_rNewModuleCode ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// doc shell modified
|
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( *const_cast< ScriptDocument* >( this ) ); // here?
|
2007-03-15 14:59:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::insertModule( const OUString& _rLibName, const OUString& _rModName, const OUString& _rModuleCode ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->insertModuleOrDialog( E_SCRIPTS, _rLibName, _rModName, makeAny( _rModuleCode ) );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::updateModule( const OUString& _rLibName, const OUString& _rModName, const OUString& _rModuleCode ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->updateModule( _rLibName, _rModName, _rModuleCode );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::removeDialog( const OUString& _rLibName, const OUString& _rDialogName ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->removeModuleOrDialog( E_DIALOGS, _rLibName, _rDialogName );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::hasDialog( const OUString& _rLibName, const OUString& _rDialogName ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->hasModuleOrDialog( E_DIALOGS, _rLibName, _rDialogName );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::getDialog( const OUString& _rLibName, const OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
Any aCode;
|
|
|
|
if ( !m_pImpl->getModuleOrDialog( E_DIALOGS, _rLibName, _rDialogName, aCode ) )
|
|
|
|
return false;
|
|
|
|
OSL_VERIFY( aCode >>= _out_rDialogProvider );
|
|
|
|
return _out_rDialogProvider.is();
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::renameDialog( const OUString& _rLibName, const OUString& _rOldName, const OUString& _rNewName, const Reference< XNameContainer >& _rxExistingDialogModel ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->renameModuleOrDialog( E_DIALOGS, _rLibName, _rOldName, _rNewName, _rxExistingDialogModel );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::createDialog( const OUString& _rLibName, const OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
if ( !m_pImpl->createDialog( _rLibName, _rDialogName, _out_rDialogProvider ) )
|
|
|
|
return 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( *const_cast< ScriptDocument* >( this ) ); // here?
|
2007-03-15 14:59:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
bool ScriptDocument::insertDialog( const OUString& _rLibName, const OUString& _rDialogName, const Reference< XInputStreamProvider >& _rxDialogProvider ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->insertModuleOrDialog( E_DIALOGS, _rLibName, _rDialogName, makeAny( _rxDialogProvider ) );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
void ScriptDocument::setDocumentModified() const
|
|
|
|
{
|
|
|
|
m_pImpl->setDocumentModified();
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
bool ScriptDocument::isDocumentModified() const
|
|
|
|
{
|
|
|
|
return m_pImpl->isDocumentModified();
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-03-15 14:59:30 +00:00
|
|
|
bool ScriptDocument::saveDocument( const Reference< XStatusIndicator >& _rxStatusIndicator ) const
|
|
|
|
{
|
|
|
|
return m_pImpl->saveDocument( _rxStatusIndicator );
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
LibraryLocation ScriptDocument::getLibraryLocation( const OUString& _rLibName ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN;
|
2011-12-09 22:23:22 -02:00
|
|
|
if ( !_rLibName.isEmpty() )
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
|
|
|
if ( isDocument() )
|
|
|
|
{
|
|
|
|
eLocation = LIBRARY_LOCATION_DOCUMENT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( ( hasLibrary( E_SCRIPTS, _rLibName ) && !m_pImpl->isLibraryShared( _rLibName, E_SCRIPTS ) )
|
|
|
|
|| ( hasLibrary( E_DIALOGS, _rLibName ) && !m_pImpl->isLibraryShared( _rLibName, E_DIALOGS ) )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
eLocation = LIBRARY_LOCATION_USER;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eLocation = LIBRARY_LOCATION_SHARE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return eLocation;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString ScriptDocument::getTitle( LibraryLocation _eLocation, LibraryType _eType ) const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString aTitle;
|
2007-03-15 14:59:30 +00:00
|
|
|
|
|
|
|
switch ( _eLocation )
|
|
|
|
{
|
|
|
|
case LIBRARY_LOCATION_USER:
|
|
|
|
{
|
|
|
|
switch ( _eType )
|
|
|
|
{
|
2012-04-29 23:36:57 +01:00
|
|
|
case LIBRARY_TYPE_MODULE: aTitle = IDE_RESSTR(RID_STR_USERMACROS); break;
|
|
|
|
case LIBRARY_TYPE_DIALOG: aTitle = IDE_RESSTR(RID_STR_USERDIALOGS); break;
|
|
|
|
case LIBRARY_TYPE_ALL: aTitle = IDE_RESSTR(RID_STR_USERMACROSDIALOGS); break;
|
2007-03-15 14:59:30 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LIBRARY_LOCATION_SHARE:
|
|
|
|
{
|
|
|
|
switch ( _eType )
|
|
|
|
{
|
2012-04-29 23:36:57 +01:00
|
|
|
case LIBRARY_TYPE_MODULE: aTitle = IDE_RESSTR(RID_STR_SHAREMACROS); break;
|
|
|
|
case LIBRARY_TYPE_DIALOG: aTitle = IDE_RESSTR(RID_STR_SHAREDIALOGS); break;
|
|
|
|
case LIBRARY_TYPE_ALL: aTitle = IDE_RESSTR(RID_STR_SHAREMACROSDIALOGS); break;
|
2007-03-15 14:59:30 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LIBRARY_LOCATION_DOCUMENT:
|
2007-10-09 14:24:54 +00:00
|
|
|
aTitle = getTitle();
|
|
|
|
break;
|
2007-03-15 14:59:30 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aTitle;
|
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString ScriptDocument::getTitle() const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
return m_pImpl->getTitle();
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2012-10-14 19:00:25 -03:00
|
|
|
OUString ScriptDocument::getURL() const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
return m_pImpl->getURL();
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
bool ScriptDocument::isActive() const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
bool bIsActive( false );
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XFrame > xFrame;
|
|
|
|
if ( m_pImpl->getCurrentFrame( xFrame ) )
|
|
|
|
bIsActive = xFrame->isActive();
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return bIsActive;
|
2007-03-15 14:59:30 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 03:57:20 -05:00
|
|
|
|
2007-10-09 14:24:54 +00:00
|
|
|
bool ScriptDocument::allowMacros() const
|
2007-03-15 14:59:30 +00:00
|
|
|
{
|
2007-10-09 14:24:54 +00:00
|
|
|
return m_pImpl->allowMacros();
|
2007-03-15 14:59:30 +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: */
|