summaryrefslogtreecommitdiffstats
path: root/basctl/source/inc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /basctl/source/inc
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'basctl/source/inc')
-rw-r--r--basctl/source/inc/IDEComboBox.hxx271
-rw-r--r--basctl/source/inc/ObjectCatalog.hxx60
-rw-r--r--basctl/source/inc/accessibledialogcontrolshape.hxx132
-rw-r--r--basctl/source/inc/accessibledialogwindow.hxx155
-rw-r--r--basctl/source/inc/baside3.hxx154
-rw-r--r--basctl/source/inc/basidectrlr.hxx68
-rw-r--r--basctl/source/inc/basidesh.hxx219
-rw-r--r--basctl/source/inc/basobj.hxx106
-rw-r--r--basctl/source/inc/bastype2.hxx278
-rw-r--r--basctl/source/inc/bastypes.hxx312
-rw-r--r--basctl/source/inc/dlged.hxx210
-rw-r--r--basctl/source/inc/dlgedclip.hxx53
-rw-r--r--basctl/source/inc/dlgeddef.hxx47
-rw-r--r--basctl/source/inc/dlgedfac.hxx43
-rw-r--r--basctl/source/inc/dlgedfunc.hxx80
-rw-r--r--basctl/source/inc/dlgedlist.hxx74
-rw-r--r--basctl/source/inc/dlgedmod.hxx45
-rw-r--r--basctl/source/inc/dlgedobj.hxx195
-rw-r--r--basctl/source/inc/dlgedpage.hxx52
-rw-r--r--basctl/source/inc/dlgedview.hxx59
-rw-r--r--basctl/source/inc/doceventnotifier.hxx82
-rw-r--r--basctl/source/inc/docsignature.hxx74
-rw-r--r--basctl/source/inc/iderid.hxx31
-rw-r--r--basctl/source/inc/layout.hxx133
-rw-r--r--basctl/source/inc/localizationmgr.hxx151
-rw-r--r--basctl/source/inc/managelang.hxx98
-rw-r--r--basctl/source/inc/propbrw.hxx85
-rw-r--r--basctl/source/inc/sbxitem.hxx65
-rw-r--r--basctl/source/inc/scriptdocument.hxx481
29 files changed, 3813 insertions, 0 deletions
diff --git a/basctl/source/inc/IDEComboBox.hxx b/basctl/source/inc/IDEComboBox.hxx
new file mode 100644
index 000000000..a5e7008a4
--- /dev/null
+++ b/basctl/source/inc/IDEComboBox.hxx
@@ -0,0 +1,271 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <svl/stritem.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include <vcl/InterimItemWindow.hxx>
+
+#include "doceventnotifier.hxx"
+#include "scriptdocument.hxx"
+
+namespace basctl
+{
+/*!
+ * @brief Manage states of macro and dialog Library ComboBox
+ *
+ * @see LibBox Class
+ */
+class LibBoxControl : public SfxToolBoxControl
+{
+public:
+ /*!
+ * Macro for registering two methods
+ *
+ * @code
+ * static SfxToolBoxControl* CreateImpl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
+ * static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule* pMod=nullptr)
+ * @endcode
+ * @see Macro SFX_IMPL_TOOLBOX_CONTROL
+ */
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ /*!
+ * @param nSlotId -- the slot as internal operation number
+ * @param nId -- this item's unique id in ToolBox
+ * @param rTbx -- the ToolBox which contains this ComboBox
+ */
+ LibBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
+
+ /*!
+ * Triggered if state was changed
+ *
+ * @param nSlotID -- the slot as internal operation number (not used in this place)
+ * @param eState -- enum value which contains ComboBox state
+ * @param pState --
+ */
+ virtual void StateChangedAtToolBoxControl(sal_uInt16 nSlotID, SfxItemState eState,
+ const SfxPoolItem* pState) override;
+ /*!
+ * Create combobox of Macro and Dialog Library
+ *
+ * @param pParent -- parent window
+ * @return ComboBox of macro and dialog Library
+ */
+ virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
+};
+
+/*!
+ * @brief Base class for all ComboBox elements.
+ *
+ * Base class for ComboBoxes which need to update their content according
+ * to the list of open documents.
+ */
+class DocListenerBox : public InterimItemWindow, public DocumentEventListener
+{
+private:
+ DECL_LINK(SelectHdl, weld::ComboBox&, void);
+ DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+
+protected:
+ std::unique_ptr<weld::ComboBox> m_xWidget;
+
+ /// @param pParent -- parent window
+ DocListenerBox(vcl::Window* pParent);
+ virtual ~DocListenerBox() override;
+ virtual void dispose() override;
+
+ virtual void Select() = 0;
+ virtual void FillBox() = 0;
+
+ /// key strokes the ComboBox receives
+ virtual bool HandleKeyInput(const KeyEvent& rKEvt);
+
+private:
+ // DocumentEventListener
+ virtual void onDocumentCreated(const ScriptDocument& _rDoc) override;
+ virtual void onDocumentOpened(const ScriptDocument& _rDoc) override;
+ virtual void onDocumentSave(const ScriptDocument& _rDoc) override;
+ virtual void onDocumentSaveDone(const ScriptDocument& _rDoc) override;
+ virtual void onDocumentSaveAs(const ScriptDocument& _rDoc) override;
+ virtual void onDocumentSaveAsDone(const ScriptDocument& _rDoc) override;
+ virtual void onDocumentClosed(const ScriptDocument& _rDoc) override;
+ virtual void onDocumentTitleChanged(const ScriptDocument& _rDoc) override;
+ virtual void onDocumentModeChanged(const ScriptDocument& _rDoc) override;
+
+ DocumentEventNotifier maNotifier;
+
+public:
+ void set_sensitive(bool bSensitive);
+};
+
+/*!
+ * @brief Macros and Dialogs Library ComboBox
+ *
+ * @see LibBoxControl Class
+ */
+class LibBox : public DocListenerBox
+{
+public:
+ /// @param pParent
+ LibBox(vcl::Window* pParent);
+ virtual ~LibBox() override;
+ virtual void dispose() override;
+
+ /*!
+ * Update selection in ComboBox of macro and dialog Library
+ *
+ * @param pItem -- string that was selected
+ */
+ void Update(const SfxStringItem* pItem);
+
+protected:
+ /// Called for setting language when user selects a language in ComboBox
+ virtual void Select() override;
+
+private:
+ static void ReleaseFocus();
+
+ /*!
+ * Insert name library in specified position
+ *
+ * @param rDocument -- macro or dialog
+ * @param eLocation -- enum value of Locations
+ */
+ void InsertEntries(const ScriptDocument& rDocument, LibraryLocation eLocation);
+
+ void ClearBox();
+ void NotifyIDE();
+
+ /// Fill up the combobox
+ virtual void FillBox() override;
+
+ /*!
+ * Handle keystrokes
+ *
+ * @param rKEvt represents key event
+ * @return a bool value: true if was handled, and false if there was nothing handled
+ */
+ virtual bool HandleKeyInput(const KeyEvent& rKEvt) override;
+
+ DECL_LINK(FocusInHdl, weld::Widget&, void);
+ DECL_LINK(FocusOutHdl, weld::Widget&, void);
+
+ OUString maCurrentText;
+ bool mbIgnoreSelect;
+ bool mbFillBox; ///< If true, when FillBox() is called
+};
+
+/*!
+ * @brief Manage stats of Language ComboBox
+ *
+ * @see LanguageBox Class
+ */
+class LanguageBoxControl : public SfxToolBoxControl
+{
+public:
+ /*! Macro for registering two methods
+ *
+ * @code
+ * static SfxToolBoxControl* CreateImpl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
+ * static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule* pMod=nullptr)
+ * @endcode
+ * @see Macro SFX_IMPL_TOOLBOX_CONTROL
+ */
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ /*!
+ * @param nSlotId -- the slot as internal operation number
+ * @param nId -- this item's unique id in ToolBox
+ * @param rTbx -- the ToolBox which contains this ComboBox
+ */
+ LanguageBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
+
+ /*!
+ * Triggered if state was changed
+ *
+ * @param nSlotID -- the slot as internal operation number (not used in this place)
+ * @param eState -- enum value which contains ComboBox state
+ * @param pState --
+ */
+ virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState) override;
+ /*!
+ * Create ComboBox of Language
+ *
+ * @param pParent
+ * @return LanguageBox ComboBox
+ */
+ virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
+};
+
+/*!
+ * @brief Class language ComboBox
+ *
+ * @see LanguageBoxControl Class
+ */
+class LanguageBox : public DocListenerBox
+{
+public:
+ /*!
+ * @param pParent
+ */
+ LanguageBox(vcl::Window* pParent);
+ virtual ~LanguageBox() override;
+ virtual void dispose() override;
+
+ /*!
+ * Update selection in ComboBox of macro and dialog Library
+ *
+ * @param pItem -- string that was selected
+ */
+ void Update(const SfxStringItem* pItem);
+
+protected:
+ /// Called for setting language when user selects a language in ComboBox
+ virtual void Select() override;
+
+ /*!
+ * Handle keystrokes
+ *
+ * @param rKEvt represents key event
+ * @return a bool value: true if was handled, and false if there was nothing handled
+ */
+ virtual bool HandleKeyInput(const KeyEvent& rKEvt) override;
+
+private:
+ /// Delete all languages from ComboBox
+ void ClearBox();
+ /// Switch interface of dialog to selected language
+ void SetLanguage();
+
+ /// Fill up the language combobox
+ virtual void FillBox() override;
+
+ OUString msNotLocalizedStr;
+ OUString msDefaultLanguageStr;
+ OUString msCurrentText;
+
+ bool mbIgnoreSelect; ///< do not use in this class
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/ObjectCatalog.hxx b/basctl/source/inc/ObjectCatalog.hxx
new file mode 100644
index 000000000..a5b63eef4
--- /dev/null
+++ b/basctl/source/inc/ObjectCatalog.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include "bastype2.hxx"
+#include "bastypes.hxx"
+
+#include <vcl/weld.hxx>
+
+namespace basctl
+{
+/*!
+ * @brief A docking window that contains a tree of the currently loaded macros
+ *
+ * The class creates Object Catalog window with the currently loaded macros
+ * in a tree structure which allows user to quickly select the necessary
+ * macro in BasicIDE.
+ */
+class ObjectCatalog : public DockingWindow
+{
+public:
+ explicit ObjectCatalog(vcl::Window* pParent);
+ virtual ~ObjectCatalog() override;
+ virtual void dispose() override;
+
+ /// Update the entries of Object Catalog Treelist
+ void UpdateEntries() { m_xTree->UpdateEntries(); }
+ void SetCurrentEntry(BaseWindow* pCurWin);
+
+private:
+ std::unique_ptr<weld::Label> m_xTitle; ///< Title of the Object Catalog window
+ std::unique_ptr<SbTreeListBox> m_xTree; ///< The Treelist of the objects in window
+
+ /*!
+ * Function for resize by DockingWindow.
+ * It is called by DockingWindow when IsFloatingMode() changes.
+ */
+ virtual void ToggleFloatingMode() override;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/accessibledialogcontrolshape.hxx b/basctl/source/inc/accessibledialogcontrolshape.hxx
new file mode 100644
index 000000000..2fbf73aa4
--- /dev/null
+++ b/basctl/source/inc/accessibledialogcontrolshape.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <comphelper/accessiblecomponenthelper.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <vcl/vclptr.hxx>
+
+namespace vcl { class Window; }
+
+namespace utl {
+ class AccessibleStateSetHelper;
+}
+
+namespace basctl
+{
+
+class DlgEdObj;
+class DialogWindow;
+
+
+
+typedef ::cppu::ImplHelper3<
+ css::accessibility::XAccessible,
+ css::lang::XServiceInfo,
+ css::beans::XPropertyChangeListener > AccessibleDialogControlShape_BASE;
+
+class AccessibleDialogControlShape final : public comphelper::OAccessibleExtendedComponentHelper,
+ public AccessibleDialogControlShape_BASE
+{
+ friend class AccessibleDialogWindow;
+
+private:
+ VclPtr<DialogWindow> m_pDialogWindow;
+ DlgEdObj* m_pDlgEdObj;
+ bool m_bFocused;
+ bool m_bSelected;
+
+ css::awt::Rectangle m_aBounds;
+ css::uno::Reference< css::beans::XPropertySet > m_xControlModel;
+
+ bool IsFocused() const;
+ bool IsSelected() const;
+
+ void SetFocused (bool bFocused);
+ void SetSelected (bool bSelected);
+
+ css::awt::Rectangle GetBounds() const;
+ void SetBounds( const css::awt::Rectangle& aBounds );
+
+ vcl::Window* GetWindow() const;
+
+ OUString GetModelStringProperty( OUString const & pPropertyName );
+
+ void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ // OCommonAccessibleComponent
+ virtual css::awt::Rectangle implGetBounds() override;
+
+ // XComponent
+ virtual void SAL_CALL disposing() override;
+
+public:
+ AccessibleDialogControlShape (DialogWindow*, DlgEdObj*);
+ virtual ~AccessibleDialogControlShape() override;
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& rSource ) override;
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& rEvent ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XAccessible
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override;
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
+ virtual OUString SAL_CALL getAccessibleDescription( ) override;
+ virtual OUString SAL_CALL getAccessibleName( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
+ virtual css::lang::Locale SAL_CALL getLocale( ) override;
+
+ // XAccessibleComponent
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
+ virtual void SAL_CALL grabFocus( ) override;
+ virtual sal_Int32 SAL_CALL getForeground( ) override;
+ virtual sal_Int32 SAL_CALL getBackground( ) override;
+
+ // XAccessibleExtendedComponent
+ virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override;
+ virtual OUString SAL_CALL getTitledBorderText( ) override;
+ virtual OUString SAL_CALL getToolTipText( ) override;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/accessibledialogwindow.hxx b/basctl/source/inc/accessibledialogwindow.hxx
new file mode 100644
index 000000000..2c3a06524
--- /dev/null
+++ b/basctl/source/inc/accessibledialogwindow.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <comphelper/accessiblecomponenthelper.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <svl/lstner.hxx>
+#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
+
+class VclSimpleEvent;
+class VclWindowEvent;
+
+namespace utl {
+ class AccessibleStateSetHelper;
+}
+
+namespace basctl
+{
+
+class DialogWindow;
+class DlgEditor;
+class DlgEdModel;
+class DlgEdObj;
+
+
+
+typedef ::cppu::ImplHelper3 <
+ css::accessibility::XAccessible,
+ css::accessibility::XAccessibleSelection,
+ css::lang::XServiceInfo > AccessibleDialogWindow_BASE;
+
+class AccessibleDialogWindow final : public comphelper::OAccessibleExtendedComponentHelper,
+ public AccessibleDialogWindow_BASE,
+ public SfxListener
+{
+private:
+
+ class ChildDescriptor
+ {
+ public:
+ DlgEdObj* pDlgEdObj;
+ css::uno::Reference< css::accessibility::XAccessible > rxAccessible;
+
+ ChildDescriptor( DlgEdObj* _pDlgEdObj );
+
+ bool operator==( const ChildDescriptor& rDesc );
+ bool operator<( const ChildDescriptor& rDesc ) const;
+ };
+
+ typedef std::vector< ChildDescriptor > AccessibleChildren;
+
+ AccessibleChildren m_aAccessibleChildren;
+ VclPtr<basctl::DialogWindow> m_pDialogWindow;
+ DlgEdModel* m_pDlgEdModel;
+
+ void UpdateFocused();
+ void UpdateSelected();
+ void UpdateBounds();
+
+ bool IsChildVisible( const ChildDescriptor& rDesc );
+
+ void InsertChild( const ChildDescriptor& rDesc );
+ void RemoveChild( const ChildDescriptor& rDesc );
+ void UpdateChild( const ChildDescriptor& rDesc );
+ void UpdateChildren();
+ void SortChildren();
+
+ DECL_LINK( WindowEventListener, VclWindowEvent&, void );
+
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ // OCommonAccessibleComponent
+ virtual css::awt::Rectangle implGetBounds( ) override;
+
+ // XComponent
+ virtual void SAL_CALL disposing() override;
+
+public:
+ AccessibleDialogWindow (basctl::DialogWindow*);
+ virtual ~AccessibleDialogWindow() override;
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XAccessible
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override;
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
+ virtual OUString SAL_CALL getAccessibleDescription( ) override;
+ virtual OUString SAL_CALL getAccessibleName( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
+ virtual css::lang::Locale SAL_CALL getLocale( ) override;
+
+ // XAccessibleComponent
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
+ virtual void SAL_CALL grabFocus( ) override;
+ virtual sal_Int32 SAL_CALL getForeground( ) override;
+ virtual sal_Int32 SAL_CALL getBackground( ) override;
+
+ // XAccessibleExtendedComponent
+ virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override;
+ virtual OUString SAL_CALL getTitledBorderText( ) override;
+ virtual OUString SAL_CALL getToolTipText( ) override;
+
+ // XAccessibleSelection
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override;
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override;
+ virtual void SAL_CALL clearAccessibleSelection() override;
+ virtual void SAL_CALL selectAllAccessibleChildren( ) override;
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) override;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx
new file mode 100644
index 000000000..cc53d0f11
--- /dev/null
+++ b/basctl/source/inc/baside3.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include "dlged.hxx"
+#include "layout.hxx"
+#include "bastypes.hxx"
+#include "propbrw.hxx"
+#include <svl/undo.hxx>
+#include <memory>
+
+class Printer;
+class StarBASIC;
+class SfxItemSet;
+class SfxUndoManager;
+class SdrUndoAction;
+
+namespace basctl
+{
+
+class DlgEditor;
+class DlgEdModel;
+class DlgEdPage;
+class DlgEdView;
+
+class DialogWindowLayout;
+class ObjectCatalog;
+
+bool implImportDialog(weld::Window* pWin, const ScriptDocument& rDocument, const OUString& rLibName);
+
+class DialogWindow: public BaseWindow
+{
+private:
+ DialogWindowLayout& m_rLayout;
+ std::unique_ptr<DlgEditor> m_pEditor;
+ std::unique_ptr<SfxUndoManager> m_pUndoMgr; // never nullptr
+ sal_uInt16 m_nControlSlotId;
+
+protected:
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual void Resize() override;
+ virtual void dispose() override;
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void Command( const CommandEvent& rCEvt ) override;
+ virtual void LoseFocus() override;
+
+ static void NotifyUndoActionHdl( std::unique_ptr<SdrUndoAction> );
+ virtual void DoInit() override;
+ virtual void DoScroll( ScrollBar* pCurScrollBar ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ void InitSettings();
+
+public:
+ DialogWindow (DialogWindowLayout* pParent, ScriptDocument const& rDocument, const OUString& aLibName, const OUString& aName, css::uno::Reference<css::container::XNameContainer> const& xDialogModel);
+
+ virtual void ExecuteCommand( SfxRequest& rReq ) override;
+ virtual void GetState( SfxItemSet& ) override;
+ DlgEditor& GetEditor() const { return *m_pEditor; }
+ css::uno::Reference< css::container::XNameContainer > const & GetDialog() const;
+ DlgEdModel& GetModel() const;
+ DlgEdPage& GetPage() const;
+ DlgEdView& GetView() const;
+ bool RenameDialog( const OUString& rNewName );
+ void DisableBrowser();
+ void UpdateBrowser();
+ void SaveDialog();
+ void ImportDialog();
+
+ virtual OUString GetTitle() override;
+ virtual EntryDescriptor CreateEntryDescriptor() override;
+ virtual void SetReadOnly (bool bReadOnly) override;
+ virtual bool IsReadOnly() override;
+
+ virtual void StoreData() override;
+ virtual bool IsModified() override;
+ bool IsPasteAllowed();
+
+ virtual SfxUndoManager* GetUndoManager() override;
+ // return number of pages to be printed
+ virtual sal_Int32 countPages( Printer* pPrinter ) override;
+ // print page
+ virtual void printPage (sal_Int32 nPage, Printer*) override;
+
+ virtual void Activating () override;
+ virtual void Deactivating () override;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+
+ virtual OString GetHid () const override;
+ virtual ItemType GetType () const override;
+};
+
+
+// DialogWindowLayout
+
+class DialogWindowLayout : public Layout
+{
+public:
+ DialogWindowLayout (vcl::Window* pParent, ObjectCatalog&);
+ virtual ~DialogWindowLayout() override;
+ virtual void dispose() override;
+public:
+ void ShowPropertyBrowser ();
+ void UpdatePropertyBrowser ();
+ void DisablePropertyBrowser ();
+public:
+ // Layout:
+ virtual void Activating (BaseWindow&) override;
+ virtual void Deactivating () override;
+ virtual void ExecuteGlobal (SfxRequest&) override;
+ virtual void GetState (SfxItemSet&, unsigned nWhich) override;
+ virtual void UpdateDebug (bool) override {};
+protected:
+ // Layout:
+ virtual void OnFirstSize (tools::Long nWidth, tools::Long nHeight) override;
+
+private:
+ // dockable windows:
+ // object catalog (owned by Shell)
+ ObjectCatalog& rObjectCatalog;
+ // property browser (created by this, deleted by toolkit)
+ VclPtr<PropBrw> pPropertyBrowser;
+
+private:
+ void AddPropertyBrowser ();
+private:
+ friend class DialogWindow;
+};
+
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/basidectrlr.hxx b/basctl/source/inc/basidectrlr.hxx
new file mode 100644
index 000000000..a32e1ffd9
--- /dev/null
+++ b/basctl/source/inc/basidectrlr.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <sfx2/sfxbasecontroller.hxx>
+
+namespace basctl
+{
+
+class Shell;
+
+class Controller :
+ public comphelper::OMutexAndBroadcastHelper,
+ public comphelper::OPropertyContainer,
+ public comphelper::OPropertyArrayUsageHelper<Controller>,
+ public SfxBaseController
+{
+private:
+ // properties
+ sal_Int32 m_nIconId;
+
+public:
+ Controller (Shell* pViewShell);
+ virtual ~Controller() override;
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
+
+ // XTypeProvider ( ::SfxBaseController )
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+
+protected:
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
new file mode 100644
index 000000000..5378a5228
--- /dev/null
+++ b/basctl/source/inc/basidesh.hxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#pragma once
+
+#include "doceventnotifier.hxx"
+#include "sbxitem.hxx"
+#include "ObjectCatalog.hxx"
+
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <sfx2/viewsh.hxx>
+#include <svx/ifaceids.hxx>
+#include <svl/srchitem.hxx>
+#include <vcl/scrbar.hxx>
+#include <map>
+#include <memory>
+#include <string_view>
+
+class SfxViewFactory;
+class SdrView;
+class TabBar;
+class SbxObject;
+class SbModule;
+class StarBASIC;
+
+namespace basctl
+{
+class Layout;
+class ModulWindow;
+class ModulWindowLayout;
+class DialogWindow;
+class DialogWindowLayout;
+class TabBar;
+class BaseWindow;
+class LocalizationMgr;
+
+class Shell :
+ public SfxViewShell,
+ public DocumentEventListener
+{
+public:
+ typedef std::map<sal_uInt16, VclPtr<BaseWindow> > WindowTable;
+
+private:
+ friend class JavaDebuggingListenerImpl;
+ friend class LocalizationMgr;
+ friend bool implImportDialog(weld::Window* pWin, const ScriptDocument& rDocument, const OUString& rLibName); // defined in baside3.cxx
+
+ WindowTable aWindowTable;
+ sal_uInt16 nCurKey;
+ VclPtr<BaseWindow> pCurWin;
+ ScriptDocument m_aCurDocument;
+ OUString m_aCurLibName;
+ std::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr;
+
+ VclPtr<ScrollBar> aHScrollBar;
+ VclPtr<ScrollBar> aVScrollBar;
+ VclPtr<ScrollBarBox> aScrollBarBox;
+ VclPtr<TabBar> pTabBar; // basctl::TabBar
+ bool bCreatingWindow;
+
+ // layout windows
+ VclPtr<ModulWindowLayout> pModulLayout;
+ VclPtr<DialogWindowLayout> pDialogLayout;
+ VclPtr<Layout> pLayout; // the active layout window
+ // common object catalog window
+ VclPtr<ObjectCatalog> aObjectCatalog;
+
+ bool m_bAppBasicModified;
+ bool mbJustOpened = false;
+
+ DocumentEventNotifier m_aNotifier;
+
+ friend class ContainerListenerImpl;
+ css::uno::Reference< css::container::XContainerListener > m_xLibListener;
+ std::unique_ptr<SvxSearchItem> mpSearchItem;
+
+ void Init();
+ void InitTabBar();
+ void InitScrollBars();
+ void CheckWindows();
+ void RemoveWindows( const ScriptDocument& rDocument, std::u16string_view rLibName );
+ void UpdateWindows();
+ static void InvalidateBasicIDESlots();
+ void StoreAllWindowData( bool bPersistent = true );
+ void SetMDITitle();
+ void EnableScrollbars( bool bEnable );
+ void SetCurLib( const ScriptDocument& rDocument, const OUString& aLibName, bool bUpdateWindows = true , bool bCheck = true );
+ void SetCurLibForLocalization( const ScriptDocument& rDocument, const OUString& aLibName );
+
+ DECL_LINK( TabBarHdl, ::TabBar*, void );
+
+ static unsigned nShellCount;
+
+private:
+ void AdjustPosSizePixel( const Point &rPos, const Size &rSize );
+ virtual void OuterResizePixel( const Point &rPos, const Size &rSize ) override;
+ sal_uInt16 InsertWindowInTable (BaseWindow* pNewWin);
+ virtual bool PrepareClose( bool bUI = true ) override;
+
+ void SetCurWindow (BaseWindow* pNewWin, bool bUpdateTabBar = false, bool bRememberAsCurrent = true);
+ void ManageToolbars();
+
+ VclPtr<ModulWindow> CreateBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName );
+ VclPtr<DialogWindow> CreateDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rDlgName );
+
+ VclPtr<ModulWindow> ShowActiveModuleWindow( StarBASIC const * pBasic );
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+
+ virtual void Activate(bool bMDI) override;
+ virtual void Deactivate(bool bMDI) override;
+
+ virtual void Move() override;
+ virtual void ShowCursor( bool bOn = true ) override;
+
+ // DocumentEventListener
+ virtual void onDocumentCreated( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentOpened( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentSave( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentClosed( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ) override;
+
+public:
+ SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH )
+ SFX_DECL_VIEWFACTORY(Shell);
+
+private:
+ /// SfxInterface initializer.
+ static void InitInterface_Impl();
+
+public:
+ Shell( SfxViewFrame *pFrame, SfxViewShell *pOldSh );
+ virtual ~Shell() override;
+
+ BaseWindow* GetCurWindow() const { return pCurWin; }
+ OUString const& GetCurLibName() const { return m_aCurLibName; }
+ const std::shared_ptr<LocalizationMgr>& GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; }
+
+ TabBar& GetTabBar() { return *pTabBar; }
+ WindowTable& GetWindowTable() { return aWindowTable; }
+ sal_uInt16 GetWindowId (BaseWindow const* pWin) const;
+
+ SdrView* GetCurDlgView() const;
+
+ SfxUndoManager* GetUndoManager() override;
+
+ virtual css::uno::Reference< css::view::XRenderable > GetRenderable() override;
+
+ // virtual sal_uInt16 Print( SfxProgress &rProgress, sal_Bool bIsAPI, PrintDialog *pPrintDialog = 0 );
+ virtual SfxPrinter* GetPrinter( bool bCreate = false ) override;
+ virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL ) override;
+ virtual OUString GetSelectionText( bool bCompleteWords = false, bool bOnlyASample = false ) override;
+ virtual bool HasSelection( bool bText = true ) const override;
+
+ void GetState( SfxItemSet& );
+ void ExecuteGlobal( SfxRequest& rReq );
+ void ExecuteSearch( SfxRequest& rReq );
+ void ExecuteCurrent( SfxRequest& rReq );
+ void ExecuteBasic( SfxRequest& rReq );
+ void ExecuteDialog( SfxRequest& rReq );
+
+ virtual bool HasUIFeature(SfxShellFeature nFeature) const override;
+
+ bool CallBasicErrorHdl( StarBASIC const * pBasic );
+ BasicDebugFlags CallBasicBreakHdl( StarBASIC const * pBasic );
+
+ VclPtr<BaseWindow> FindWindow( const ScriptDocument& rDocument, std::u16string_view rLibName, std::u16string_view rName, ItemType nType, bool bFindSuspended = false );
+ VclPtr<DialogWindow> FindDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rName, bool bCreateIfNotExist = false, bool bFindSuspended = false );
+ VclPtr<ModulWindow> FindBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName, bool bCreateIfNotExist = false, bool bFindSuspended = false );
+ VclPtr<BaseWindow> FindApplicationWindow();
+ bool NextPage( bool bPrev );
+
+ bool IsAppBasicModified () const { return m_bAppBasicModified; }
+ void SetAppBasicModified (bool bModified) { m_bAppBasicModified = bModified; }
+
+ // For Dialog Drag&Drop in Dialog Organizer:
+ // (defined in moduldlg.cxx)
+ static void CopyDialogResources(
+ css::uno::Reference< css::io::XInputStreamProvider >& io_xISP,
+ const ScriptDocument& rSourceDoc, const OUString& rSourceLibName, const ScriptDocument& rDestDoc,
+ const OUString& rDestLibName, std::u16string_view rDlgName );
+
+ static void InvalidateControlSlots();
+
+ virtual css::uno::Reference< css::frame::XModel >
+ GetCurrentDocument() const override;
+
+ void UpdateObjectCatalog () { aObjectCatalog->UpdateEntries(); }
+
+ void RemoveWindow (BaseWindow* pWindow, bool bDestroy, bool bAllowChangeCurWindow = true);
+};
+
+} // namespace basctl
+
+// This typedef helps baside.sdi,
+// because I don't know how to use nested names in it.
+typedef basctl::Shell basctl_Shell;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/basobj.hxx b/basctl/source/inc/basobj.hxx
new file mode 100644
index 000000000..46d0f9392
--- /dev/null
+++ b/basctl/source/inc/basobj.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#pragma once
+
+#include "scriptdocument.hxx"
+#include <tools/long.hxx>
+
+class SbMethod;
+class SbModule;
+class SbxVariable;
+class StarBASIC;
+class SfxUInt16Item;
+class SfxBindings;
+class SfxDispatcher;
+namespace weld { class Widget; class Window; }
+
+namespace basctl
+{
+ void Organize(weld::Window* pParent, sal_Int16 tabId);
+
+
+ // help methods for the general use:
+ SbMethod* CreateMacro( SbModule* pModule, const OUString& rMacroName );
+ void RunMethod( SbMethod const * pMethod );
+
+ StarBASIC* FindBasic( const SbxVariable* pVar );
+ void StopBasic();
+ tools::Long HandleBasicError( StarBASIC const * pBasic );
+ void BasicStopped( bool* pbAppWindowDisabled = nullptr, bool* pbDispatcherLocked = nullptr, sal_uInt16* pnWaitCount = nullptr,
+ SfxUInt16Item** ppSWActionCount = nullptr, SfxUInt16Item** ppSWLockViewCount = nullptr );
+
+ bool IsValidSbxName( const OUString& rName );
+
+ BasicManager* FindBasicManager( StarBASIC const * pLib );
+
+ SfxBindings* GetBindingsPtr();
+
+ SfxDispatcher* GetDispatcher ();
+
+ void InvalidateDebuggerSlots();
+
+ // libraries
+
+ css::uno::Sequence< OUString > GetMergedLibraryNames(
+ const css::uno::Reference< css::script::XLibraryContainer >& xModLibContainer,
+ const css::uno::Reference< css::script::XLibraryContainer >& xDlgLibContainer );
+
+ /** renames a module
+
+ Will show an error message when renaming fails because the new name is already used.
+ */
+ bool RenameModule(
+ weld::Widget* pErrorParent, const ScriptDocument& rDocument,
+ const OUString& rLibName, const OUString& rOldName, const OUString& rNewName );
+
+ // new methods for macros
+
+ OUString ChooseMacro(weld::Window* pParent,
+ const css::uno::Reference< css::frame::XModel >& rxLimitToDocument, const css::uno::Reference< css::frame::XFrame >& xDocFrame,
+ bool bChooseOnly );
+ inline OUString ChooseMacro(weld::Window* pParent, const css::uno::Reference<css::frame::XModel>& rLimitToDocument)
+ { return ChooseMacro(pParent, rLimitToDocument, css::uno::Reference< css::frame::XFrame >(), false/*bChooseOnly*/); }
+
+ /// @throws css::container::NoSuchElementException
+ /// @throws css::uno::RuntimeException
+ css::uno::Sequence< OUString > GetMethodNames(
+ const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName );
+
+ bool HasMethod(
+ const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName, const OUString& rMethName );
+
+ // new methods for dialogs
+
+ /** renames a dialog
+
+ Will show an error message when renaming fails because the new name is already used.
+
+ @throws css::container::ElementExistException
+ @throws css::container::NoSuchElementException
+ @throws css::uno::RuntimeException
+ */
+ bool RenameDialog(weld::Widget* pErrorParent, const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rOldName, const OUString& rNewName);
+
+ bool RemoveDialog( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rDlgName );
+
+ void MarkDocumentModified( const ScriptDocument& rDocument );
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/bastype2.hxx b/basctl/source/inc/bastype2.hxx
new file mode 100644
index 000000000..0161797f1
--- /dev/null
+++ b/basctl/source/inc/bastype2.hxx
@@ -0,0 +1,278 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <memory>
+
+#include "doceventnotifier.hxx"
+
+#include <vcl/weld.hxx>
+#include "sbxitem.hxx"
+#include <o3tl/typed_flags_set.hxx>
+
+class SbModule;
+class SbxVariable;
+
+enum class BrowseMode
+{
+ Modules = 0x01,
+ Subs = 0x02,
+ Dialogs = 0x04,
+ All = Modules | Subs | Dialogs,
+};
+namespace o3tl {
+ template<> struct typed_flags<BrowseMode> : is_typed_flags<BrowseMode, 0x7> {};
+}
+
+namespace basctl
+{
+using namespace ::com::sun::star::uno;
+
+enum EntryType
+{
+ OBJ_TYPE_UNKNOWN,
+ OBJ_TYPE_DOCUMENT,
+ OBJ_TYPE_LIBRARY,
+ OBJ_TYPE_MODULE,
+ OBJ_TYPE_DIALOG,
+ OBJ_TYPE_METHOD,
+ OBJ_TYPE_DOCUMENT_OBJECTS,
+ OBJ_TYPE_USERFORMS,
+ OBJ_TYPE_NORMAL_MODULES,
+ OBJ_TYPE_CLASS_MODULES
+};
+
+class Entry
+{
+private:
+ EntryType m_eType;
+
+public:
+ explicit Entry(EntryType eType)
+ : m_eType(eType)
+ {
+ }
+
+ virtual ~Entry();
+
+ Entry(Entry const &) = default;
+ Entry(Entry &&) = default;
+ Entry & operator =(Entry const &) = default;
+ Entry & operator =(Entry &&) = default;
+
+ EntryType GetType () const { return m_eType; }
+};
+
+class DocumentEntry : public Entry
+{
+private:
+ ScriptDocument m_aDocument;
+ LibraryLocation m_eLocation;
+
+public:
+ DocumentEntry (
+ ScriptDocument aDocument,
+ LibraryLocation eLocation,
+ EntryType eType = OBJ_TYPE_DOCUMENT
+ );
+ virtual ~DocumentEntry () override;
+
+ ScriptDocument const& GetDocument() const { return m_aDocument; }
+ LibraryLocation GetLocation() const { return m_eLocation; }
+};
+
+class LibEntry : public DocumentEntry
+{
+private:
+ OUString m_aLibName;
+
+public:
+ LibEntry (
+ ScriptDocument const& rDocument,
+ LibraryLocation eLocation,
+ OUString aLibName
+ );
+ virtual ~LibEntry () override;
+
+ OUString const& GetLibName () const { return m_aLibName; }
+};
+
+class EntryDescriptor
+{
+ ScriptDocument m_aDocument;
+ LibraryLocation m_eLocation;
+ OUString m_aLibName;
+ OUString m_aLibSubName; // for vba entry: Document Objects, Class Modules, Forms and Normal Modules
+ OUString m_aName;
+ OUString m_aMethodName;
+ EntryType m_eType;
+
+public:
+ EntryDescriptor ();
+ EntryDescriptor (
+ ScriptDocument aDocument,
+ LibraryLocation eLocation,
+ OUString aLibName,
+ OUString aLibSubName,
+ OUString aName,
+ EntryType eType
+ );
+ EntryDescriptor (
+ ScriptDocument aDocument,
+ LibraryLocation eLocation,
+ OUString aLibName,
+ OUString aLibSubName,
+ OUString aName,
+ OUString aMethodName,
+ EntryType eType
+ );
+
+ ScriptDocument const& GetDocument() const { return m_aDocument; }
+ LibraryLocation GetLocation() const { return m_eLocation; }
+
+ const OUString& GetLibName() const { return m_aLibName; }
+ const OUString& GetLibSubName() const { return m_aLibSubName; }
+ const OUString& GetName() const { return m_aName; }
+ const OUString& GetMethodName() const { return m_aMethodName; }
+ void SetMethodName( const OUString& aMethodName ) { m_aMethodName = aMethodName; }
+
+ EntryType GetType() const { return m_eType; }
+ void SetType( EntryType eType ) { m_eType = eType; }
+};
+
+
+/*
+ Classification of types and pointers in the Entries:
+
+ OBJ_TYPE_DOCUMENT DocumentEntry
+ OBJ_TYPE_LIBRARY Entry
+ OBJ_TYPE_MODULE Entry
+ OBJ_TYPE_DIALOG Entry
+ OBJ_TYPE_METHOD Entry
+
+*/
+
+class SbTreeListBox : public DocumentEventListener
+{
+private:
+ std::unique_ptr<weld::TreeView> m_xControl;
+ std::unique_ptr<weld::TreeIter> m_xScratchIter;
+ weld::Window* m_pTopLevel;
+ bool m_bFreezeOnFirstAddRemove;
+ BrowseMode nMode;
+ DocumentEventNotifier m_aNotifier;
+ void SetEntryBitmaps(const weld::TreeIter& rIter, const OUString& rImage);
+
+protected:
+ DECL_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool);
+ DECL_LINK(OpenCurrentHdl, weld::TreeView&, bool);
+ void ImpCreateLibEntries(const weld::TreeIter& rShellRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation);
+ void ImpCreateLibSubEntries(const weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName);
+ void ImpCreateLibSubEntriesInVBAMode(const weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName );
+ void ImpCreateLibSubSubEntriesInVBAMode(const weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName);
+ bool ImpFindEntry(weld::TreeIter& rIter, std::u16string_view rText);
+
+ // DocumentEventListener
+ virtual void onDocumentCreated( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentOpened( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentSave( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentClosed( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ) override;
+ virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ) override;
+
+public:
+ SbTreeListBox(std::unique_ptr<weld::TreeView> xControl, weld::Window* pTopLevel);
+ virtual ~SbTreeListBox() override;
+
+ void ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
+ void ScanAllEntries();
+ void UpdateEntries();
+
+ bool IsEntryProtected(const weld::TreeIter* pEntry);
+
+ void SetMode( BrowseMode nM ) { nMode = nM; }
+ BrowseMode GetMode() const { return nMode; }
+
+ SbModule* FindModule(const weld::TreeIter* pEntry);
+ SbxVariable* FindVariable(const weld::TreeIter* pEntry);
+ bool FindRootEntry(const ScriptDocument& rDocument, LibraryLocation eLocation, weld::TreeIter& rIter);
+ bool FindEntry(std::u16string_view rText, EntryType eType, weld::TreeIter& rIter);
+ EntryDescriptor GetEntryDescriptor(const weld::TreeIter* pEntry);
+
+ static ItemType ConvertType (EntryType eType);
+ bool IsValidEntry(const weld::TreeIter& rEntry);
+ void AddEntry(const OUString& rText, const OUString& rImage,
+ const weld::TreeIter* pParent, bool bChildrenOnDemand,
+ std::unique_ptr<Entry>&& rUserData,
+ weld::TreeIter* pRet = nullptr);
+
+ void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xControl->connect_changed(rLink); }
+ std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pIter = nullptr) const { return m_xControl->make_iterator(pIter); }
+ void copy_iterator(const weld::TreeIter& rSource, weld::TreeIter& rDest) const { m_xControl->copy_iterator(rSource, rDest); }
+ bool get_selected(weld::TreeIter* pIter) const { return m_xControl->get_selected(pIter); }
+ void select(const weld::TreeIter& rIter) { m_xControl->select(rIter); }
+ void unselect(const weld::TreeIter& rIter) { m_xControl->unselect(rIter); }
+ void remove(const weld::TreeIter& rIter) { m_xControl->remove(rIter); }
+ bool get_cursor(weld::TreeIter* pIter) const { return m_xControl->get_cursor(pIter); }
+ void set_cursor(const weld::TreeIter& rIter) { m_xControl->set_cursor(rIter); }
+ OUString get_text(const weld::TreeIter& rIter) const { return m_xControl->get_text(rIter); }
+ void set_text(const weld::TreeIter& rIter, const OUString& rText) { m_xControl->set_text(rIter, rText); }
+ OUString get_id(const weld::TreeIter& rIter) const { return m_xControl->get_id(rIter); }
+ bool get_iter_first(weld::TreeIter& rIter) const { return m_xControl->get_iter_first(rIter); }
+ bool iter_next_sibling(weld::TreeIter& rIter) const { return m_xControl->iter_next_sibling(rIter); }
+ bool iter_children(weld::TreeIter& rIter) const { return m_xControl->iter_children(rIter); }
+ bool iter_parent(weld::TreeIter& rIter) const { return m_xControl->iter_parent(rIter); }
+ int get_iter_depth(const weld::TreeIter& rIter) const { return m_xControl->get_iter_depth(rIter); }
+ bool get_row_expanded(const weld::TreeIter& rIter) const { return m_xControl->get_row_expanded(rIter); }
+ void expand_row(const weld::TreeIter& rIter) { m_xControl->expand_row(rIter); }
+ void set_size_request(int nWidth, int nHeight) { m_xControl->set_size_request(nWidth, nHeight); }
+ float get_approximate_digit_width() const { return m_xControl->get_approximate_digit_width(); }
+ int get_height_rows(int nRows) const { return m_xControl->get_height_rows(nRows); }
+ int get_iter_index_in_parent(const weld::TreeIter& rIter) const { return m_xControl->get_iter_index_in_parent(rIter); }
+ void connect_editing(const Link<const weld::TreeIter&, bool>& rStartLink,
+ const Link<const std::pair<const weld::TreeIter&, OUString>&, bool>& rEndLink)
+ {
+ m_xControl->connect_editing(rStartLink, rEndLink);
+ }
+
+ void make_sorted() { m_xControl->make_sorted(); };
+
+ void RemoveEntry(const weld::TreeIter& rIter);
+ void RemoveEntry(const ScriptDocument&);
+
+ OUString GetRootEntryName(const ScriptDocument& rDocument, LibraryLocation eLocation) const;
+ static OUString GetRootEntryBitmaps(const ScriptDocument& rDocument);
+
+ void SetCurrentEntry (EntryDescriptor const &);
+
+ weld::TreeView& get_widget() { return *m_xControl; }
+
+private:
+ LibraryType GetLibraryType() const;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx
new file mode 100644
index 000000000..04d308fc7
--- /dev/null
+++ b/basctl/source/inc/bastypes.hxx
@@ -0,0 +1,312 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#pragma once
+
+#include "scriptdocument.hxx"
+
+#include "sbxitem.hxx"
+#include <svtools/tabbar.hxx>
+#include <basic/sbdef.hxx>
+#include <vcl/dockwin.hxx>
+#include <vcl/weld.hxx>
+
+#include <string_view>
+#include <unordered_map>
+
+class SbModule;
+class SfxItemSet;
+class SfxRequest;
+class SvxSearchItem;
+class Printer;
+enum class SearchOptionFlags;
+class SfxUndoManager;
+
+namespace weld
+{
+ class Widget;
+}
+
+namespace basctl
+{
+
+class Layout;
+class ModulWindow;
+class DialogWindow;
+
+constexpr auto LINE_SEP_CR = 0x0D;
+constexpr auto LINE_SEP = 0x0A;
+
+// Implementation: baside2b.cxx
+sal_Int32 searchEOL( std::u16string_view rStr, sal_Int32 fromIndex );
+
+// Meaning of bToBeKilled:
+// While being in a reschedule-loop, I may not destroy the window.
+// It must first break from the reschedule-loop to self-destroy then.
+// Does unfortunately not work that way: Destroying Window with living Child!
+
+struct BasicStatus
+{
+ bool bIsRunning : 1;
+ bool bError : 1;
+ bool bIsInReschedule : 1;
+ BasicDebugFlags nBasicFlags;
+
+ BasicStatus():
+ bIsRunning(false),
+ bError(false),
+ bIsInReschedule(false),
+ nBasicFlags(BasicDebugFlags::NONE) { }
+};
+
+
+// basctl::DockingWindow -- special docking window for the Basic IDE
+// Not to be confused with ::DockingWindow from vcl.
+
+class DockingWindow : public ResizableDockingWindow
+{
+public:
+ DockingWindow(vcl::Window* pParent, const OUString& rUIXMLDescription, const OString& rID);
+ DockingWindow(Layout* pParent);
+ virtual ~DockingWindow() override;
+ virtual void dispose() override;
+ void ResizeIfDocking (Point const&, Size const&);
+ void ResizeIfDocking (Size const&);
+ Size GetDockingSize () const { return aDockingRect.GetSize(); }
+ void SetLayoutWindow (Layout*);
+public:
+ void Show (bool = true);
+ void Hide ();
+
+protected:
+ virtual bool Docking( const Point& rPos, tools::Rectangle& rRect ) override;
+ virtual void EndDocking( const tools::Rectangle& rRect, bool bFloatMode ) override;
+ virtual void ToggleFloatingMode() override;
+ virtual bool PrepareToggleFloatingMode() override;
+ virtual void StartDocking() override;
+
+protected:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+
+private:
+ // the position and the size of the floating window
+ tools::Rectangle aFloatingRect;
+ // the position and the size of the docking window
+ tools::Rectangle aDockingRect;
+ // the parent layout window (only when docking)
+ VclPtr<Layout> pLayout;
+ // > 0: shown, <= 0: hidden, ++ by Show() and -- by Hide()
+ int nShowCount;
+
+ static WinBits const StyleBits;
+
+private:
+ void DockThis ();
+};
+
+
+// basctl::TabBar
+// Not to be confused with ::TabBar from svtools.
+
+class TabBar : public ::TabBar
+{
+protected:
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void Command( const CommandEvent& rCEvt ) override;
+
+ virtual TabBarAllowRenamingReturnCode AllowRenaming() override;
+ virtual void EndRenaming() override;
+
+public:
+ TabBar (vcl::Window* pParent);
+
+ void Sort();
+};
+
+enum BasicWindowStatus
+{
+ BASWIN_RUNNINGBASIC = 0x01,
+ BASWIN_TOBEKILLED = 0x02,
+ BASWIN_SUSPENDED = 0x04,
+ BASWIN_INRESCHEDULE = 0x08
+};
+
+class EntryDescriptor;
+
+
+// BaseWindow -- the base of both ModulWindow and DialogWindow.
+
+class BaseWindow : public vcl::Window
+{
+private:
+ VclPtr<ScrollBar> pShellHScrollBar;
+ VclPtr<ScrollBar> pShellVScrollBar;
+
+ DECL_LINK( ScrollHdl, ScrollBar*, void );
+ int nStatus;
+
+ ScriptDocument m_aDocument;
+ OUString m_aLibName;
+ OUString m_aName;
+
+ friend class ModulWindow;
+ friend class DialogWindow;
+
+protected:
+ virtual void DoScroll( ScrollBar* pCurScrollBar );
+
+public:
+ BaseWindow( vcl::Window* pParent, ScriptDocument aDocument, OUString aLibName, OUString aName );
+ virtual ~BaseWindow() override;
+ virtual void dispose() override;
+
+ void Init();
+ virtual void DoInit();
+ virtual void Activating () = 0;
+ virtual void Deactivating () = 0;
+ void GrabScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll );
+
+ ScrollBar* GetHScrollBar() const { return pShellHScrollBar; }
+ ScrollBar* GetVScrollBar() const { return pShellVScrollBar; }
+
+ virtual void ExecuteCommand (SfxRequest&);
+ virtual void ExecuteGlobal (SfxRequest&);
+ virtual void GetState (SfxItemSet&) = 0;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+
+ virtual void StoreData();
+ virtual void UpdateData();
+
+ // return number of pages to be printed
+ virtual sal_Int32 countPages( Printer* pPrinter ) = 0;
+ // print page
+ virtual void printPage( sal_Int32 nPage, Printer* pPrinter ) = 0;
+
+ virtual OUString GetTitle();
+ OUString CreateQualifiedName();
+ virtual EntryDescriptor CreateEntryDescriptor() = 0;
+
+ virtual bool IsModified();
+
+ virtual bool AllowUndo();
+
+ virtual void SetReadOnly (bool bReadOnly);
+ virtual bool IsReadOnly();
+
+ int GetStatus() const { return nStatus; }
+ void SetStatus(int n) { nStatus = n; }
+ void AddStatus(int n) { nStatus |= n; }
+ void ClearStatus(int n) { nStatus &= ~n; }
+
+ virtual SfxUndoManager* GetUndoManager ();
+
+ virtual SearchOptionFlags GetSearchOptions();
+ virtual sal_uInt16 StartSearchAndReplace (SvxSearchItem const&, bool bFromStart = false);
+
+ virtual void BasicStarted();
+ virtual void BasicStopped();
+
+ bool IsSuspended() const { return nStatus & BASWIN_SUSPENDED; }
+
+ const ScriptDocument&
+ GetDocument() const { return m_aDocument; }
+ bool IsDocument( const ScriptDocument& rDocument ) const { return rDocument == m_aDocument; }
+ const OUString& GetLibName() const { return m_aLibName; }
+
+ const OUString& GetName() const { return m_aName; }
+ void SetName( const OUString& aName ) { m_aName = aName; }
+
+ virtual void OnNewDocument ();
+ virtual OString GetHid () const = 0;
+ virtual ItemType GetType () const = 0;
+ void InsertLibInfo () const;
+ bool Is (ScriptDocument const&, std::u16string_view, std::u16string_view, ItemType, bool bFindSuspended);
+ virtual bool HasActiveEditor () const;
+};
+
+class LibInfo
+{
+public:
+ class Item;
+public:
+ LibInfo ();
+ ~LibInfo ();
+public:
+ void InsertInfo (ScriptDocument const&, OUString const& rLibName, OUString const& rCurrentName, ItemType eCurrentType);
+ void RemoveInfoFor (ScriptDocument const&);
+ Item const* GetInfo (ScriptDocument const&, OUString const& rLibName);
+
+private:
+ class Key
+ {
+ private:
+ ScriptDocument m_aDocument;
+ OUString m_aLibName;
+
+ public:
+ Key (ScriptDocument , OUString aLibName);
+ public:
+ bool operator == (Key const&) const;
+ struct Hash
+ {
+ size_t operator () (Key const&) const;
+ };
+ public:
+ const ScriptDocument& GetDocument() const { return m_aDocument; }
+ };
+public:
+ class Item
+ {
+ private:
+ OUString m_aCurrentName;
+ ItemType m_eCurrentType;
+
+ public:
+ Item (OUString aCurrentName, ItemType eCurrentType);
+ const OUString& GetCurrentName() const { return m_aCurrentName; }
+ ItemType GetCurrentType() const { return m_eCurrentType; }
+ };
+private:
+ typedef std::unordered_map<Key, Item, Key::Hash> Map;
+ Map m_aMap;
+};
+
+void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines );
+OUString CreateMgrAndLibStr( std::u16string_view rMgrName, std::u16string_view rLibName );
+sal_uInt32 CalcLineCount( SvStream& rStream );
+
+bool QueryReplaceMacro( std::u16string_view rName, weld::Widget* pParent );
+bool QueryDelMacro( std::u16string_view rName, weld::Widget* pParent );
+bool QueryDelDialog( std::u16string_view rName, weld::Widget* pParent );
+bool QueryDelModule( std::u16string_view rName, weld::Widget* pParent );
+bool QueryDelLib( std::u16string_view rName, bool bRef, weld::Widget* pParent );
+bool QueryPassword(weld::Widget* pDialogParent, const css::uno::Reference< css::script::XLibraryContainer >& xLibContainer, const OUString& rLibName, OUString& rPassword, bool bRepeat = false, bool bNewTitle = false);
+
+class ModuleInfoHelper
+{
+ ModuleInfoHelper (const ModuleInfoHelper&) = delete;
+ ModuleInfoHelper& operator = (const ModuleInfoHelper&) = delete;
+public:
+ static void getObjectName( const css::uno::Reference< css::container::XNameContainer >& rLib, const OUString& rModName, OUString& rObjName );
+ static sal_Int32 getModuleType( const css::uno::Reference< css::container::XNameContainer >& rLib, const OUString& rModName );
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx
new file mode 100644
index 000000000..9e5147dfc
--- /dev/null
+++ b/basctl/source/inc/dlged.hxx
@@ -0,0 +1,210 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/datatransfer/DataFlavor.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <o3tl/deleter.hxx>
+#include <svl/SfxBroadcaster.hxx>
+#include <svl/hint.hxx>
+#include <svx/svdobjkind.hxx>
+#include <tools/gen.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/idle.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/window.hxx>
+
+#include <memory>
+
+class ScrollBar;
+class Printer;
+class KeyEvent;
+class MouseEvent;
+class Timer;
+namespace vcl { class Window; }
+
+namespace basctl
+{
+
+class DialogWindowLayout;
+
+constexpr auto DLGED_PAGE_WIDTH_MIN = 1280;
+constexpr auto DLGED_PAGE_HEIGHT_MIN = 1024;
+
+// DlgEdHint
+
+
+class DlgEdObj;
+
+class DlgEdHint: public SfxHint
+{
+public:
+ enum Kind {
+ UNKNOWN,
+ WINDOWSCROLLED,
+ LAYERCHANGED,
+ OBJORDERCHANGED,
+ SELECTIONCHANGED,
+ };
+
+private:
+ Kind eKind;
+ DlgEdObj* pDlgEdObj;
+
+public:
+ DlgEdHint (Kind);
+ DlgEdHint (Kind, DlgEdObj* pObj);
+ virtual ~DlgEdHint() override;
+
+ Kind GetKind() const { return eKind; }
+ DlgEdObj* GetObject() const { return pDlgEdObj; }
+};
+
+
+// DlgEditor
+
+
+class DlgEdModel;
+class DlgEdPage;
+class DlgEdView;
+class DlgEdForm;
+class DlgEdFactory;
+class DlgEdFunc;
+
+class DlgEditor: public SfxBroadcaster
+{
+public:
+ enum Mode {
+ INSERT,
+ SELECT,
+ TEST,
+ READONLY,
+ };
+
+private:
+ DECL_LINK(MarkTimeout, Timer *, void);
+
+ static void Print( Printer* pPrinter, const OUString& rTitle );
+
+private:
+ VclPtr<ScrollBar> pHScroll;
+ VclPtr<ScrollBar> pVScroll;
+ std::unique_ptr<DlgEdModel> pDlgEdModel; // never nullptr
+ DlgEdPage* pDlgEdPage; // never nullptr
+ std::unique_ptr<DlgEdView> pDlgEdView; // never nullptr
+ DlgEdForm* pDlgEdForm; // never nullptr
+ css::uno::Reference< css::container::XNameContainer > m_xUnoControlDialogModel;
+ css::uno::Reference< css::awt::XControlContainer > m_xControlContainer;
+ css::uno::Sequence< css::datatransfer::DataFlavor > m_ClipboardDataFlavors;
+ css::uno::Sequence< css::datatransfer::DataFlavor > m_ClipboardDataFlavorsResource;
+ css::uno::Reference< css::util::XNumberFormatsSupplier > m_xSupplier;
+ std::unique_ptr<DlgEdFactory, o3tl::default_delete<DlgEdFactory>> pObjFac; // never nullptr
+ vcl::Window& rWindow; // DialogWindow
+ std::unique_ptr<DlgEdFunc> pFunc;
+ DialogWindowLayout& rLayout;
+ Mode eMode;
+ SdrObjKind eActObj;
+ bool bFirstDraw;
+ bool bCreateOK;
+ tools::Rectangle aPaintRect;
+ bool bDialogModelChanged;
+ Idle aMarkIdle;
+ tools::Long mnPaintGuard;
+ css::uno::Reference< css::frame::XModel > m_xDocument;
+
+public:
+ DlgEditor (
+ vcl::Window&, DialogWindowLayout&,
+ css::uno::Reference<css::frame::XModel> const& xModel,
+ css::uno::Reference<css::container::XNameContainer> const & xDialogModel
+ );
+ virtual ~DlgEditor() override;
+
+ vcl::Window& GetWindow() const { return rWindow; }
+
+ /** returns the control container associated with our window
+ @see GetWindow
+ @see SetWindow
+ */
+ css::uno::Reference< css::awt::XControlContainer > const &
+ GetWindowControlContainer();
+
+ void SetScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll );
+ void InitScrollBars();
+ ScrollBar* GetHScroll() const { return pHScroll; }
+ ScrollBar* GetVScroll() const { return pVScroll; }
+ void DoScroll();
+ void UpdateScrollBars();
+
+ void SetDialog (const css::uno::Reference<css::container::XNameContainer>& xUnoControlDialogModel);
+ void ResetDialog ();
+ const css::uno::Reference< css::container::XNameContainer >& GetDialog() const
+ {return m_xUnoControlDialogModel;}
+
+ css::uno::Reference< css::util::XNumberFormatsSupplier > const & GetNumberFormatsSupplier();
+
+ DlgEdModel& GetModel() const { return *pDlgEdModel; }
+ DlgEdView& GetView() const { return *pDlgEdView; }
+ DlgEdPage& GetPage() const { return *pDlgEdPage; }
+
+ void ShowDialog();
+
+ bool UnmarkDialog();
+ bool RemarkDialog();
+
+ void SetDialogModelChanged() { bDialogModelChanged = true; }
+
+ bool IsModified () const;
+ void ClearModifyFlag();
+
+ void MouseButtonDown( const MouseEvent& rMEvt );
+ void MouseButtonUp( const MouseEvent& rMEvt );
+ void MouseMove( const MouseEvent& rMEvt );
+ void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
+ bool KeyInput( const KeyEvent& rKEvt );
+
+ void SetMode (Mode eMode);
+ void SetInsertObj(SdrObjKind eObj);
+ void CreateDefaultObject();
+ Mode GetMode() const { return eMode; }
+ bool IsCreateOK() const { return bCreateOK; }
+
+ void Cut();
+ void Copy();
+ void Paste();
+ void Delete();
+ bool IsPasteAllowed();
+
+ void ShowProperties();
+ void UpdatePropertyBrowserDelayed();
+
+ static void printPage( sal_Int32 nPage, Printer* pPrinter, const OUString& );
+
+ bool AdjustPageSize();
+
+ bool isInPaint() const { return mnPaintGuard > 0; }
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/dlgedclip.hxx b/basctl/source/inc/dlgedclip.hxx
new file mode 100644
index 000000000..0bb7a7416
--- /dev/null
+++ b/basctl/source/inc/dlgedclip.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
+#include <cppuhelper/implbase.hxx>
+
+namespace basctl
+{
+
+
+class DlgEdTransferableImpl final : public ::cppu::WeakImplHelper< css::datatransfer::XTransferable,
+ css::datatransfer::clipboard::XClipboardOwner >
+{
+private:
+ css::uno::Sequence< css::datatransfer::DataFlavor > m_SeqFlavors;
+ css::uno::Sequence< css::uno::Any > m_SeqData;
+
+ static bool compareDataFlavors( const css::datatransfer::DataFlavor& lFlavor, const css::datatransfer::DataFlavor& rFlavor );
+
+public:
+ DlgEdTransferableImpl( const css::uno::Sequence< css::datatransfer::DataFlavor >& aSeqFlavors, const css::uno::Sequence< css::uno::Any >& aSeqData );
+ virtual ~DlgEdTransferableImpl() override;
+
+ // XTransferable
+ virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& rFlavor ) override;
+ virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() override;
+ virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& rFlavor ) override;
+
+ // XClipboardOwner
+ virtual void SAL_CALL lostOwnership( const css::uno::Reference< css::datatransfer::clipboard::XClipboard >& xClipboard, const css::uno::Reference< css::datatransfer::XTransferable >& xTrans ) override;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/dlgeddef.hxx b/basctl/source/inc/dlgeddef.hxx
new file mode 100644
index 000000000..ffb726b21
--- /dev/null
+++ b/basctl/source/inc/dlgeddef.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+
+namespace basctl
+{
+
+// control properties
+#define DLGED_PROP_BACKGROUNDCOLOR "BackgroundColor"
+inline constexpr OUStringLiteral DLGED_PROP_DROPDOWN = u"Dropdown";
+inline constexpr OUStringLiteral DLGED_PROP_FORMATSSUPPLIER = u"FormatsSupplier";
+inline constexpr OUStringLiteral DLGED_PROP_HEIGHT = u"Height";
+inline constexpr OUStringLiteral DLGED_PROP_LABEL = u"Label";
+inline constexpr OUStringLiteral DLGED_PROP_NAME = u"Name";
+inline constexpr OUStringLiteral DLGED_PROP_ORIENTATION = u"Orientation";
+inline constexpr OUStringLiteral DLGED_PROP_POSITIONX = u"PositionX";
+inline constexpr OUStringLiteral DLGED_PROP_POSITIONY = u"PositionY";
+inline constexpr OUStringLiteral DLGED_PROP_STEP = u"Step";
+inline constexpr OUStringLiteral DLGED_PROP_TABINDEX = u"TabIndex";
+#define DLGED_PROP_TEXTCOLOR "TextColor"
+#define DLGED_PROP_TEXTLINECOLOR "TextLineColor"
+inline constexpr OUStringLiteral DLGED_PROP_WIDTH = u"Width";
+inline constexpr OUStringLiteral DLGED_PROP_DECORATION = u"Decoration";
+
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/dlgedfac.hxx b/basctl/source/inc/dlgedfac.hxx
new file mode 100644
index 000000000..f200b01f8
--- /dev/null
+++ b/basctl/source/inc/dlgedfac.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <svx/svdobj.hxx>
+#include <tools/link.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+
+namespace basctl
+{
+// DlgEdFactory
+
+class DlgEdFactory
+{
+ const css::uno::Reference<css::frame::XModel> mxModel;
+
+public:
+ DlgEdFactory(css::uno::Reference<css::frame::XModel> xModel);
+ ~DlgEdFactory() COVERITY_NOEXCEPT_FALSE;
+
+ DECL_LINK(MakeObject, SdrObjCreatorParams, SdrObject*);
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/dlgedfunc.hxx b/basctl/source/inc/dlgedfunc.hxx
new file mode 100644
index 000000000..9e20f3901
--- /dev/null
+++ b/basctl/source/inc/dlgedfunc.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <vcl/event.hxx>
+#include <vcl/timer.hxx>
+#include <tools/link.hxx>
+#include <tools/gen.hxx>
+
+namespace basctl
+{
+class DlgEditor;
+
+// DlgEdFunc
+
+class DlgEdFunc /* : public LinkHdl */
+{
+protected:
+ DlgEditor& rParent;
+ Timer aScrollTimer;
+
+ DECL_LINK(ScrollTimeout, Timer*, void);
+ void ForceScroll(const Point& rPos);
+
+public:
+ explicit DlgEdFunc(DlgEditor& rParent);
+ virtual ~DlgEdFunc();
+
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+ virtual bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual void MouseMove(const MouseEvent& rMEvt);
+ bool KeyInput(const KeyEvent& rKEvt);
+};
+
+// DlgEdFuncInsert
+
+class DlgEdFuncInsert : public DlgEdFunc
+{
+public:
+ explicit DlgEdFuncInsert(DlgEditor& rParent);
+ virtual ~DlgEdFuncInsert() override;
+
+ virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
+ virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
+ virtual void MouseMove(const MouseEvent& rMEvt) override;
+};
+
+// DlgEdFuncSelect
+
+class DlgEdFuncSelect : public DlgEdFunc
+{
+public:
+ explicit DlgEdFuncSelect(DlgEditor& rParent);
+ virtual ~DlgEdFuncSelect() override;
+
+ virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
+ virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
+ virtual void MouseMove(const MouseEvent& rMEvt) override;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/dlgedlist.hxx b/basctl/source/inc/dlgedlist.hxx
new file mode 100644
index 000000000..373f38b14
--- /dev/null
+++ b/basctl/source/inc/dlgedlist.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+
+namespace basctl
+{
+class DlgEdObj;
+
+// DlgEdPropListenerImpl
+
+typedef ::cppu::WeakImplHelper<css::beans::XPropertyChangeListener> PropertyChangeListenerHelper;
+
+class DlgEdPropListenerImpl : public PropertyChangeListenerHelper
+{
+private:
+ DlgEdObj& rDlgEdObj;
+
+public:
+ explicit DlgEdPropListenerImpl(DlgEdObj&);
+ virtual ~DlgEdPropListenerImpl() override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override;
+};
+
+// DlgEdEvtContListenerImpl
+
+typedef ::cppu::WeakImplHelper<css::container::XContainerListener> ContainerListenerHelper;
+
+class DlgEdEvtContListenerImpl : public ContainerListenerHelper
+{
+private:
+ DlgEdObj& rDlgEdObj;
+
+public:
+ explicit DlgEdEvtContListenerImpl(DlgEdObj&);
+ virtual ~DlgEdEvtContListenerImpl() override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& Event) override;
+ virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& Event) override;
+ virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& Event) override;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/dlgedmod.hxx b/basctl/source/inc/dlgedmod.hxx
new file mode 100644
index 000000000..24a97905b
--- /dev/null
+++ b/basctl/source/inc/dlgedmod.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <svx/svdmodel.hxx>
+
+namespace basctl
+{
+// DlgEdModel
+
+class DlgEdModel : public SdrModel
+{
+ friend class DlgEdPage;
+
+private:
+ DlgEdModel(const DlgEdModel&) = delete;
+ void operator=(const DlgEdModel& rSrcModel) = delete;
+
+public:
+ DlgEdModel();
+ virtual ~DlgEdModel() override;
+
+ virtual rtl::Reference<SdrPage> AllocPage(bool bMasterPage) override;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/dlgedobj.hxx b/basctl/source/inc/dlgedobj.hxx
new file mode 100644
index 000000000..d5e29cf48
--- /dev/null
+++ b/basctl/source/inc/dlgedobj.hxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <svx/svdouno.hxx>
+
+#include <optional>
+
+#include <map>
+
+namespace basctl
+{
+
+typedef std::multimap< sal_Int16, OUString > IndexToNameMap;
+
+
+class DlgEdForm;
+class DlgEditor;
+
+
+// DlgEdObj
+
+
+class DlgEdObj: public SdrUnoObj
+{
+ friend class DlgEditor;
+ friend class DlgEdFactory;
+ friend class DlgEdPropListenerImpl;
+ friend class DlgEdForm;
+
+private:
+ bool bIsListening;
+ DlgEdForm* pDlgEdForm;
+ css::uno::Reference< css::beans::XPropertyChangeListener> m_xPropertyChangeListener;
+ css::uno::Reference< css::container::XContainerListener> m_xContainerListener;
+
+private:
+ DlgEditor& GetDialogEditor ();
+
+protected:
+ DlgEdObj(SdrModel& rSdrModel);
+ // copy constructor
+ DlgEdObj(SdrModel& rSdrModel, DlgEdObj const & rSource);
+ DlgEdObj(
+ SdrModel& rSdrModel,
+ const OUString& rModelName,
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac);
+
+ // protected destructor
+ virtual ~DlgEdObj() override;
+
+ virtual void NbcMove( const Size& rSize ) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
+
+ using SfxListener::StartListening;
+ void StartListening();
+ using SfxListener::EndListening;
+ void EndListening(bool bRemoveListener);
+ bool isListening() const { return bIsListening; }
+
+ bool TransformSdrToControlCoordinates(
+ sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
+ sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
+ bool TransformSdrToFormCoordinates(
+ sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
+ sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
+ bool TransformControlToSdrCoordinates(
+ sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
+ sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
+ bool TransformFormToSdrCoordinates(
+ sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
+ sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
+
+public:
+ void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; }
+ DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; }
+
+ virtual SdrInventor GetObjInventor() const override;
+ virtual SdrObjKind GetObjIdentifier() const override;
+
+ virtual DlgEdObj* CloneSdrObject(SdrModel& rTargetModel) const override; // not working yet
+
+ // FullDrag support
+ virtual SdrObjectUniquePtr getFullDragClone() const override;
+
+ bool supportsService( OUString const & serviceName ) const;
+ OUString GetDefaultName() const;
+ OUString GetUniqueName() const;
+
+ sal_Int32 GetStep() const;
+ virtual void UpdateStep();
+
+ void SetDefaults();
+ virtual void SetRectFromProps();
+ virtual void SetPropsFromRect();
+
+ css::uno::Reference< css::awt::XControl > GetControl() const;
+
+ virtual void PositionAndSizeChange( const css::beans::PropertyChangeEvent& evt );
+ /// @throws css::container::NoSuchElementException
+ /// @throws css::uno::RuntimeException
+ void NameChange( const css::beans::PropertyChangeEvent& evt );
+ /// @throws css::uno::RuntimeException
+ void TabIndexChange( const css::beans::PropertyChangeEvent& evt );
+
+ // PropertyChangeListener
+ /// @throws css::uno::RuntimeException
+ void _propertyChange(const css::beans::PropertyChangeEvent& evt);
+
+ // ContainerListener
+ /// @throws css::uno::RuntimeException
+ void _elementInserted();
+ /// @throws css::uno::RuntimeException
+ void _elementReplaced();
+ /// @throws css::uno::RuntimeException
+ void _elementRemoved();
+
+ virtual void SetLayer(SdrLayerID nLayer) override;
+ void MakeDataAware( const css::uno::Reference< css::frame::XModel >& xModel );
+};
+
+
+// DlgEdForm
+
+
+class DlgEdForm: public DlgEdObj
+{
+ friend class DlgEditor;
+ friend class DlgEdFactory;
+
+private:
+ DlgEditor& rDlgEditor;
+ std::vector<DlgEdObj*> pChildren;
+
+ mutable ::std::optional< css::awt::DeviceInfo > mpDeviceInfo;
+
+private:
+ explicit DlgEdForm(
+ SdrModel& rSdrModel,
+ DlgEditor&);
+
+protected:
+ virtual void NbcMove( const Size& rSize ) override;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
+ virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
+
+ // protected destructor
+ virtual ~DlgEdForm() override;
+
+public:
+ DlgEditor& GetDlgEditor () const { return rDlgEditor; }
+
+ void AddChild( DlgEdObj* pDlgEdObj );
+ void RemoveChild( DlgEdObj* pDlgEdObj );
+ std::vector<DlgEdObj*> const& GetChildren() const { return pChildren; }
+
+ virtual void UpdateStep() override;
+
+ virtual void SetRectFromProps() override;
+ virtual void SetPropsFromRect() override;
+
+ virtual void PositionAndSizeChange( const css::beans::PropertyChangeEvent& evt ) override;
+
+ void UpdateTabIndices();
+ void UpdateTabOrder();
+ void UpdateGroups();
+ void UpdateTabOrderAndGroups();
+
+ css::awt::DeviceInfo getDeviceInfo() const;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/dlgedpage.hxx b/basctl/source/inc/dlgedpage.hxx
new file mode 100644
index 000000000..91efc12ed
--- /dev/null
+++ b/basctl/source/inc/dlgedpage.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <svx/svdpage.hxx>
+
+namespace basctl
+{
+// DlgEdPage
+
+class DlgEdModel;
+class DlgEdForm;
+
+class DlgEdPage final : public SdrPage
+{
+ DlgEdPage& operator=(const DlgEdPage&) = delete;
+ DlgEdPage(const DlgEdPage&) = delete;
+
+ DlgEdForm* pDlgEdForm;
+
+public:
+ explicit DlgEdPage(DlgEdModel& rModel, bool bMasterPage = false);
+ virtual ~DlgEdPage() override;
+
+ virtual rtl::Reference<SdrPage> CloneSdrPage(SdrModel& rTargetModel) const override;
+
+ void SetDlgEdForm(DlgEdForm* pForm) { pDlgEdForm = pForm; }
+ DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; }
+
+ virtual SdrObject* SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum) override;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/dlgedview.hxx b/basctl/source/inc/dlgedview.hxx
new file mode 100644
index 000000000..195dee840
--- /dev/null
+++ b/basctl/source/inc/dlgedview.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+
+#pragma once
+
+#include <svx/svdview.hxx>
+
+namespace basctl
+{
+
+class DlgEditor;
+
+
+// DlgEdView
+
+
+class DlgEdView : public SdrView
+{
+private:
+ DlgEditor& rDlgEditor;
+
+public:
+
+ DlgEdView(
+ SdrModel& rSdrModel,
+ OutputDevice& rOut,
+ DlgEditor& rEditor);
+
+ virtual ~DlgEdView() override;
+
+ virtual void MarkListHasChanged() override;
+ virtual void MakeVisible( const tools::Rectangle& rRect, vcl::Window& rWin ) override;
+
+protected:
+ /// override to handle HitTest for some objects specially
+ using SdrView::CheckSingleSdrObjectHit;
+ virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay) const override;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/doceventnotifier.hxx b/basctl/source/inc/doceventnotifier.hxx
new file mode 100644
index 000000000..25fd2a7a8
--- /dev/null
+++ b/basctl/source/inc/doceventnotifier.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/frame/XModel.hpp>
+
+#include <rtl/ref.hxx>
+
+
+namespace basctl
+{
+
+
+ class ScriptDocument;
+
+
+ class SAL_NO_VTABLE DocumentEventListener
+ {
+ public:
+ DocumentEventListener(const DocumentEventListener&) = delete;
+ const DocumentEventListener& operator=(const DocumentEventListener&) = delete;
+ DocumentEventListener() = default;
+
+ virtual void onDocumentCreated( const ScriptDocument& _rDocument ) = 0;
+ virtual void onDocumentOpened( const ScriptDocument& _rDocument ) = 0;
+ virtual void onDocumentSave( const ScriptDocument& _rDocument ) = 0;
+ virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ) = 0;
+ virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ) = 0;
+ virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ) = 0;
+ virtual void onDocumentClosed( const ScriptDocument& _rDocument ) = 0;
+ virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ) = 0;
+ virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ) = 0;
+
+ virtual ~DocumentEventListener();
+ };
+
+
+ /** allows registering at theGlobalEventBroadcaster for global document events
+ */
+ class DocumentEventNotifier
+ {
+ public:
+ /** create a notifier instance which notifies about events of all documents in the whole application
+ */
+ DocumentEventNotifier (DocumentEventListener&);
+
+ /** creates a notifier instance which notifies about events at a single document
+ */
+ DocumentEventNotifier (DocumentEventListener&, css::uno::Reference<css::frame::XModel> const& rxDocument);
+
+ ~DocumentEventNotifier();
+
+ public:
+ void dispose();
+
+ private:
+ class Impl;
+ rtl::Reference<Impl> m_pImpl;
+ };
+
+
+} // namespace basctl
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/docsignature.hxx b/basctl/source/inc/docsignature.hxx
new file mode 100644
index 000000000..1681807d3
--- /dev/null
+++ b/basctl/source/inc/docsignature.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#pragma once
+
+#include <sfx2/signaturestate.hxx>
+#include <vcl/weld.hxx>
+
+class SfxObjectShell;
+
+namespace basctl
+{
+
+
+ class ScriptDocument;
+
+ /// encapsulates (actions on) the signature/state of a document
+ class DocumentSignature
+ {
+ public:
+ /** creates a DocumentSignature instance for the given document
+
+ If the given ScriptDocument instance refers to the application, or to a document
+ which does not support being signed, the DocumentSignature instance is invalid afterwards.
+ */
+ explicit DocumentSignature (ScriptDocument const&);
+
+ /** determines whether the instance is valid
+
+ An instance is valid if and only if it has been constructed with a document
+ which supports signatures.
+ */
+ bool supportsSignatures() const;
+
+ /** signs the scripting content inside the document
+
+ @precond
+ isValid returns <TRUE/>
+ */
+ void signScriptingContent(weld::Window* pDialogParent) const;
+
+ /** retrieves the state of the signature of the scripting content inside the document
+
+ If the instance is not valid, then SIGNATURESTATE_NOSIGNATURES is returned.
+ */
+ SignatureState getScriptingSignatureState() const;
+
+ private:
+ DocumentSignature() = delete;
+
+ private:
+ SfxObjectShell* m_pShell;
+ };
+
+
+} // namespace basctl
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/iderid.hxx b/basctl/source/inc/iderid.hxx
new file mode 100644
index 000000000..83cbc3d0c
--- /dev/null
+++ b/basctl/source/inc/iderid.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+#include <unotools/resmgr.hxx>
+
+namespace basctl
+{
+OUString IDEResId(TranslateId aId);
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/layout.hxx b/basctl/source/inc/layout.hxx
new file mode 100644
index 000000000..29b44896b
--- /dev/null
+++ b/basctl/source/inc/layout.hxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include "bastypes.hxx"
+#include <vcl/split.hxx>
+#include <vcl/vclptr.hxx>
+
+#include <vector>
+
+class DockingWindow;
+class SfxRequest;
+class SfxItemSet;
+
+namespace basctl
+{
+class DockingWindow;
+class BaseWindow;
+
+// Layout -- the common base of ModulLayout and DialogLayout.
+// Handles the splitting lines and the dockable windows.
+
+class Layout : public vcl::Window
+{
+public:
+ void ArrangeWindows();
+
+ virtual void Activating(BaseWindow&);
+ virtual void Deactivating();
+ virtual void ExecuteGlobal(SfxRequest&) {}
+ virtual void GetState(SfxItemSet&, unsigned nWhich) = 0;
+ virtual void UpdateDebug(bool bBasicStopped) = 0;
+
+ virtual ~Layout() override;
+ virtual void dispose() override;
+
+protected:
+ explicit Layout(vcl::Window* pParent);
+
+ void AddToLeft(DockingWindow* pWin, Size const& rSize) { aLeftSide.Add(pWin, rSize); }
+ void AddToBottom(DockingWindow* pWin, Size const& rSize) { aBottomSide.Add(pWin, rSize); }
+ void Remove(DockingWindow*);
+ bool HasSize() const { return !bFirstSize; }
+
+ // Window:
+ virtual void Resize() override;
+ virtual void DataChanged(DataChangedEvent const& rDCEvt) override;
+ // new:
+ virtual void OnFirstSize(tools::Long nWidth, tools::Long nHeight) = 0;
+
+private:
+ // the main child window (either ModulWindow or DialogWindow)
+ VclPtr<BaseWindow> pChild;
+
+ // when this window has at first (nonempty) size
+ bool bFirstSize;
+
+ // horizontal or vertical split strip
+ class SplittedSide
+ {
+ public:
+ enum class Side
+ {
+ Left,
+ Bottom
+ };
+ SplittedSide(Layout*, Side);
+ void Add(DockingWindow*, Size const&);
+ void Remove(DockingWindow*);
+ bool IsEmpty() const;
+ tools::Long GetSize() const;
+ void ArrangeIn(tools::Rectangle const&);
+ void dispose();
+
+ private:
+ // the layout window
+ Layout& rLayout;
+ // horizontal or vertical strip?
+ bool bVertical;
+ // lower (top or left) or higher (bottom or right) strip?
+ bool bLower;
+ // rectangle to move in
+ tools::Rectangle aRect;
+ // size (width or height)
+ tools::Long nSize;
+ // the main splitting line
+ VclPtr<Splitter> aSplitter;
+ // the dockable windows (and some data)
+ struct Item
+ {
+ // pointer to the dockable window
+ VclPtr<DockingWindow> pWin;
+ // starting and ending position in the strip
+ // They may be different from the actual window position, because
+ // the window may fill the space of the adjacent currently
+ // non-docking windows, but this change is not stored in these
+ // variables. These change only when the splitter lines are moved.
+ tools::Long nStartPos, nEndPos;
+ // splitter line window before the window
+ // (the first one is always nullptr)
+ VclPtr<Splitter> pSplit;
+ };
+ std::vector<Item> vItems;
+
+ Point MakePoint(tools::Long, tools::Long) const;
+ Size MakeSize(tools::Long, tools::Long) const;
+ static bool IsDocking(DockingWindow const&);
+ DECL_LINK(SplitHdl, Splitter*, void);
+ void CheckMarginsFor(Splitter*);
+ void InitSplitter(Splitter&);
+ } aLeftSide, aBottomSide;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/localizationmgr.hxx b/basctl/source/inc/localizationmgr.hxx
new file mode 100644
index 000000000..3e2ff0fc5
--- /dev/null
+++ b/basctl/source/inc/localizationmgr.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include "scriptdocument.hxx"
+
+#include <com/sun/star/resource/XStringResourceManager.hpp>
+
+namespace basctl
+{
+
+class Shell;
+class DlgEditor;
+
+class LocalizationMgr
+{
+ css::uno::Reference< css::resource::XStringResourceManager > m_xStringResourceManager;
+
+ Shell* m_pShell;
+
+ ScriptDocument m_aDocument;
+ OUString m_aLibName;
+
+ css::lang::Locale m_aLocaleBeforeBasicStart;
+
+ enum HandleResourceMode
+ {
+ SET_IDS,
+ RESET_IDS,
+ RENAME_DIALOG_IDS,
+ RENAME_CONTROL_IDS,
+ REMOVE_IDS_FROM_RESOURCE,
+ MOVE_RESOURCES,
+ COPY_RESOURCES
+ };
+ static sal_Int32 implHandleControlResourceProperties(const css::uno::Any& rControlAny,
+ std::u16string_view aDialogName,
+ std::u16string_view aCtrlName,
+ const css::uno::Reference< css::resource::XStringResourceManager >& xStringResourceManager,
+ const css::uno::Reference< css::resource::XStringResourceResolver >& xSourceStringResolver,
+ HandleResourceMode eMode );
+
+ void enableResourceForAllLibraryDialogs()
+ {
+ implEnableDisableResourceForAllLibraryDialogs( SET_IDS );
+ }
+ void disableResourceForAllLibraryDialogs()
+ {
+ implEnableDisableResourceForAllLibraryDialogs( RESET_IDS );
+ }
+ void implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode );
+
+public:
+ LocalizationMgr(Shell*, ScriptDocument , OUString aLibName,
+ const css::uno::Reference < css::resource::XStringResourceManager >& xStringResourceManager );
+
+ const css::uno::Reference< css::resource::XStringResourceManager >& getStringResourceManager() const
+ {
+ return m_xStringResourceManager;
+ }
+
+ bool isLibraryLocalized();
+
+ void handleTranslationbar();
+
+ void handleAddLocales( const css::uno::Sequence
+ < css::lang::Locale >& aLocaleSeq );
+
+ void handleRemoveLocales( const css::uno::Sequence
+ < css::lang::Locale >& aLocaleSeq );
+
+ void handleSetDefaultLocale(const css::lang::Locale& rLocale);
+
+ void handleSetCurrentLocale(const css::lang::Locale& rLocale);
+
+ void handleBasicStarted();
+
+ void handleBasicStopped();
+
+ static void setControlResourceIDsForNewEditorObject(DlgEditor const * pEditor,
+ const css::uno::Any& rControlAny, std::u16string_view aCtrlName);
+
+ static void renameControlResourceIDsForEditorObject(DlgEditor const * pEditor,
+ const css::uno::Any& rControlAny, std::u16string_view aNewCtrlName);
+
+ static void deleteControlResourceIDsForDeletedEditorObject(DlgEditor const * pEditor,
+ const css::uno::Any& rControlAny, std::u16string_view aCtrlName);
+
+ static void setStringResourceAtDialog( const ScriptDocument& rDocument, const OUString& aLibName, std::u16string_view aDlgName,
+ const css::uno::Reference< css::container::XNameContainer >& xDialogModel );
+
+ static void renameStringResourceIDs( const ScriptDocument& rDocument, const OUString& aLibName, std::u16string_view aDlgName,
+ const css::uno::Reference< css::container::XNameContainer >& xDialogModel );
+
+ static void removeResourceForDialog( const ScriptDocument& rDocument, const OUString& aLibName, std::u16string_view aDlgName,
+ const css::uno::Reference< css::container::XNameContainer >& xDialogModel );
+
+ static css::uno::Reference< css::resource::XStringResourceManager >
+ getStringResourceFromDialogLibrary( const css::uno::Reference< css::container::XNameContainer >& xDialogLib );
+
+ // Clipboard / Drag & Drop
+ static void resetResourceForDialog(
+ const css::uno::Reference< css::container::XNameContainer >& xDialogModel,
+ const css::uno::Reference< css::resource::XStringResourceManager >& xStringResourceManager );
+
+ static void setResourceIDsForDialog(
+ const css::uno::Reference< css::container::XNameContainer >& xDialogModel,
+ const css::uno::Reference< css::resource::XStringResourceManager >& xStringResourceManager );
+
+ static void copyResourcesForPastedEditorObject( DlgEditor const * pEditor,
+ const css::uno::Any& rControlAny, std::u16string_view aCtrlName,
+ const css::uno::Reference< css::resource::XStringResourceResolver >& xSourceStringResolver );
+
+ static void copyResourceForDroppedDialog(
+ const css::uno::Reference< css::container::XNameContainer >& xDialogModel,
+ std::u16string_view aDialogName,
+ const css::uno::Reference< css::resource::XStringResourceManager >& xStringResourceManager,
+ const css::uno::Reference< css::resource::XStringResourceResolver >& xSourceStringResolver );
+
+ static void copyResourceForDialog(
+ const css::uno::Reference< css::container::XNameContainer >& xDialogModel,
+ const css::uno::Reference< css::resource::
+ XStringResourceResolver >& xSourceStringResolver,
+ const css::uno::Reference< css::resource::
+ XStringResourceManager >& xTargetStringResourceManager );
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/managelang.hxx b/basctl/source/inc/managelang.hxx
new file mode 100644
index 000000000..58dd41890
--- /dev/null
+++ b/basctl/source/inc/managelang.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <utility>
+#include <vcl/weld.hxx>
+
+class SvxLanguageBox;
+
+namespace basctl
+{
+
+class LocalizationMgr;
+
+struct LanguageEntry
+{
+ css::lang::Locale m_aLocale;
+ bool m_bIsDefault;
+
+ LanguageEntry( css::lang::Locale _aLocale,
+ bool _bIsDefault ) :
+ m_aLocale(std::move( _aLocale )),
+ m_bIsDefault( _bIsDefault ) {}
+};
+
+extern bool localesAreEqual( const css::lang::Locale& rLocaleLeft,
+ const css::lang::Locale& rLocaleRight );
+
+class ManageLanguageDialog : public weld::GenericDialogController
+{
+private:
+ std::shared_ptr<LocalizationMgr> m_xLocalizationMgr;
+
+ OUString m_sDefLangStr;
+ OUString m_sCreateLangStr;
+
+ std::unique_ptr<weld::TreeView> m_xLanguageLB;
+ std::unique_ptr<weld::Button> m_xAddPB;
+ std::unique_ptr<weld::Button> m_xDeletePB;
+ std::unique_ptr<weld::Button> m_xMakeDefPB;
+
+ void Init();
+ void FillLanguageBox();
+ void ClearLanguageBox();
+
+ DECL_LINK(AddHdl, weld::Button&, void);
+ DECL_LINK(DeleteHdl, weld::Button&, void);
+ DECL_LINK(MakeDefHdl, weld::Button&, void);
+ DECL_LINK(SelectHdl, weld::TreeView&, void);
+
+public:
+ ManageLanguageDialog(weld::Window* pParent, std::shared_ptr<LocalizationMgr> _pLMgr);
+ virtual ~ManageLanguageDialog() override;
+};
+
+class SetDefaultLanguageDialog : public weld::GenericDialogController
+{
+private:
+ std::shared_ptr<LocalizationMgr> m_xLocalizationMgr;
+
+ void FillLanguageBox();
+
+ std::unique_ptr<weld::Label> m_xLanguageFT;
+ std::unique_ptr<weld::TreeView> m_xLanguageLB;
+ std::unique_ptr<weld::Label> m_xCheckLangFT;
+ std::unique_ptr<weld::TreeView> m_xCheckLangLB;
+ std::unique_ptr<weld::Label> m_xDefinedFT;
+ std::unique_ptr<weld::Label> m_xAddedFT;
+ std::unique_ptr<weld::Label> m_xAltTitle;
+ std::unique_ptr<SvxLanguageBox> m_xLanguageCB;
+
+public:
+ SetDefaultLanguageDialog(weld::Window* pParent, std::shared_ptr<LocalizationMgr> xLMgr);
+ virtual ~SetDefaultLanguageDialog() override;
+
+ css::uno::Sequence< css::lang::Locale > GetLocales() const;
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/propbrw.hxx b/basctl/source/inc/propbrw.hxx
new file mode 100644
index 000000000..c9ad80344
--- /dev/null
+++ b/basctl/source/inc/propbrw.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <vector>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XFrame2.hpp>
+#include <svl/lstner.hxx>
+#include <svl/SfxBroadcaster.hxx>
+#include <svx/svdmark.hxx>
+#include "bastypes.hxx"
+
+class SfxBindings;
+class SdrView;
+class SfxViewShell;
+
+namespace basctl
+{
+
+class DialogWindowLayout;
+
+class PropBrw final : public DockingWindow, public SfxListener, public SfxBroadcaster
+{
+private:
+ VclPtr<vcl::Window> m_xContentArea;
+ bool m_bInitialStateChange;
+
+ css::uno::Reference< css::frame::XFrame2 >
+ m_xMeAsFrame;
+ css::uno::Reference< css::beans::XPropertySet >
+ m_xBrowserController;
+ css::uno::Reference< css::frame::XModel >
+ m_xContextDocument;
+
+ SdrView* pView;
+ virtual bool Close() override;
+
+ typedef std::vector< css::uno::Reference< css::uno::XInterface> > InterfaceArray;
+
+ static css::uno::Sequence< css::uno::Reference< css::uno::XInterface > >
+ CreateMultiSelectionSequence( const SdrMarkList& _rMarkList );
+ void implSetNewObjectSequence( const css::uno::Sequence
+ < css::uno::Reference< css::uno::XInterface > >& _rObjectSeq );
+
+ void implSetNewObject( const css::uno::Reference< css::beans::XPropertySet >& _rxObject);
+
+ static OUString GetHeadlineName( const css::uno::Reference< css::beans::XPropertySet >& _rxObject);
+
+public:
+ explicit PropBrw (DialogWindowLayout&);
+ virtual ~PropBrw() override;
+ virtual void dispose() override;
+ // note: changing the Context document to an instance other than the one given in the ctor is not supported
+ // currently
+ void Update( const SfxViewShell* pShell );
+
+private:
+ void ImplUpdate( const css::uno::Reference< css::frame::XModel >& _rxContextDocument, SdrView* pView );
+ void ImplDestroyController();
+ void ImplReCreateController();
+};
+
+} // namespace basctl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/sbxitem.hxx b/basctl/source/inc/sbxitem.hxx
new file mode 100644
index 000000000..941ffd3e0
--- /dev/null
+++ b/basctl/source/inc/sbxitem.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#pragma once
+
+#include "scriptdocument.hxx"
+#include <svl/poolitem.hxx>
+
+namespace basctl
+{
+
+enum ItemType
+{
+ TYPE_UNKNOWN,
+ TYPE_SHELL,
+ TYPE_LIBRARY,
+ TYPE_MODULE,
+ TYPE_DIALOG,
+ TYPE_METHOD
+};
+
+class SbxItem : public SfxPoolItem
+{
+ const ScriptDocument m_aDocument;
+ const OUString m_aLibName;
+ const OUString m_aName;
+ const OUString m_aMethodName;
+ ItemType m_eType;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SbxItem(sal_uInt16 nWhich, ScriptDocument aDocument, OUString aLibName, OUString aName, ItemType);
+ SbxItem(sal_uInt16 nWhich, ScriptDocument aDocument, OUString aLibName, OUString aName, OUString aMethodName, ItemType eType);
+
+ virtual SbxItem* Clone(SfxItemPool *pPool = nullptr) const override;
+ virtual bool operator==(const SfxPoolItem&) const override;
+
+ ScriptDocument const& GetDocument () const { return m_aDocument; }
+ OUString const& GetLibName () const { return m_aLibName; }
+ OUString const& GetName () const { return m_aName; }
+ OUString const& GetMethodName () const { return m_aMethodName; }
+ ItemType GetType () const { return m_eType; }
+};
+
+} // namespace basctl
+
+// For baside.sdi, because I don't know how to use nested names in it.
+using basctl::SbxItem;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/inc/scriptdocument.hxx b/basctl/source/inc/scriptdocument.hxx
new file mode 100644
index 000000000..da7f2b50d
--- /dev/null
+++ b/basctl/source/inc/scriptdocument.hxx
@@ -0,0 +1,481 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/io/XInputStreamProvider.hpp>
+
+#include <memory>
+#include <vector>
+
+class SfxListener;
+
+class BasicManager;
+
+
+namespace basctl
+{
+
+ enum LibraryContainerType
+ {
+ E_SCRIPTS,
+ E_DIALOGS
+ };
+
+ enum LibraryLocation
+ {
+ LIBRARY_LOCATION_UNKNOWN,
+ LIBRARY_LOCATION_USER,
+ LIBRARY_LOCATION_SHARE,
+ LIBRARY_LOCATION_DOCUMENT
+ };
+
+ enum class LibraryType
+ {
+ Module,
+ Dialog,
+ All
+ };
+
+ class ScriptDocument;
+ typedef std::vector< ScriptDocument > ScriptDocuments;
+
+ /** encapsulates a document which contains Basic scripts and dialogs
+ */
+ class ScriptDocument
+ {
+ private:
+ class Impl;
+ std::shared_ptr<Impl> m_pImpl;
+
+ private:
+ /** creates a ScriptDocument instance which operates on the application-wide
+ scripts and dialogs
+ */
+ ScriptDocument();
+
+ public:
+ enum SpecialDocument { NoDocument };
+ /** creates a ScriptDocument instance which does refers to neither the application-wide,
+ nor a specific real document's scripts.
+
+ This constructor might come handy when you need some kind of uninitialized
+ ScriptDocument, which you do not want to operate on (yet), but initialize later
+ by assignment.
+
+ <member>isValid</member> will return <FALSE/> for a ScriptDocument constructed
+ this way.
+ */
+ explicit ScriptDocument( SpecialDocument _eType );
+
+ /** creates a ScriptDocument instance which refers to a document given as
+ XModel
+
+ @param _rxDocument
+ the document. Must not be <NULL/>.
+ */
+ explicit ScriptDocument( const css::uno::Reference< css::frame::XModel >& _rxDocument );
+
+ /** returns a reference to a shared ScriptDocument instance which
+ operates on the application-wide scripts and dialogs
+ */
+ static const ScriptDocument&
+ getApplicationScriptDocument();
+
+ /** returns a (newly created) ScriptDocument instance for the document to
+ which a given BasicManager belongs
+
+ If the basic manager is the application's basic manager, then the (shared)
+ ScriptDocument instance which is responsible for the application is returned.
+
+ @see getApplicationScriptDocument
+ */
+ static ScriptDocument
+ getDocumentForBasicManager( const BasicManager* _pManager );
+
+ /** returns a (newly created) ScriptDocument instance for the document
+ with a given caption or URL
+
+ If there is no document with the given caption, then the (shared)
+ ScriptDocument instance which is responsible for the application is returned.
+
+ @see getApplicationScriptDocument
+ */
+ static ScriptDocument
+ getDocumentWithURLOrCaption( std::u16string_view _rUrlOrCaption );
+
+ /** operation mode for getAllScriptDocuments
+ */
+ enum ScriptDocumentList
+ {
+ /** all ScriptDocuments, including the dedicated one which represents
+ the application-wide scripts/dialogs.
+ */
+ AllWithApplication,
+ /** real documents only, sorted lexicographically by their title (using the sys locale's default
+ collator)
+ */
+ DocumentsSorted
+ };
+
+ /** returns the set of ScriptDocument instances, one for each open document which
+ contains Basic/Dialog containers; plus an additional instance for
+ the application, if desired
+
+ Documents which are not visible - i.e. do not have a visible frame.
+
+ @param _bIncludingApplication
+ <TRUE/> if the application-wide scripts/dialogs should also be represented
+ by a ScriptDocument
+ */
+ static ScriptDocuments
+ getAllScriptDocuments( ScriptDocumentList _eListType );
+
+ // comparison
+ bool operator==( const ScriptDocument& _rhs ) const;
+ bool operator!=( const ScriptDocument& _rhs ) const { return !( *this == _rhs ); }
+
+ /// retrieves a (pretty simple) hash code for the document
+ sal_Int32 hashCode() const;
+
+ /** determines whether the document is actually able to contain Basic/Dialog libraries
+
+ Note that validity does not automatically imply the document can be used for active
+ work. Instead, it is possible the document is closed already (or being closed currently).
+ In this case, isValid will return <TRUE/>, but isAlive will return <FALSE/>.
+
+ @return
+ <TRUE/> if the instance refers to a document which contains Basic/Dialog libraries,
+ or the application as a whole, <FALSE/> otherwise.
+
+ @see isAlive
+ */
+ bool isValid() const;
+
+ /** determines whether the document instance is alive
+
+ If the instance is not valid, <FALSE/> is returned.
+
+ If the instance refers to a real document, which is already closed, or just being closed,
+ the method returns <FALSE/>.
+
+ If the instance refers to the application, <TRUE/> is returned.
+
+ @see isValid
+ */
+ bool isAlive() const;
+
+ bool isInVBAMode() const;
+ /// returns the BasicManager associated with this instance
+ BasicManager*
+ getBasicManager() const;
+
+ /** returns the UNO component representing the document which the instance operates on
+
+ Must not be used when the instance operates on the application-wide
+ Basic/Dialog libraries.
+ */
+ css::uno::Reference< css::frame::XModel >
+ getDocument() const;
+
+ /** returns the UNO component representing the document which the instance operates on
+
+ May be used when the instance operates on the application-wide
+ Basic/Dialog libraries, in this case it returns <NULL/>.
+ */
+ css::uno::Reference< css::frame::XModel >
+ getDocumentOrNull() const;
+
+ /** returns the Basic or Dialog library container of the document
+
+ If the document is not valid, <NULL/> is returned.
+ */
+ css::uno::Reference< css::script::XLibraryContainer >
+ getLibraryContainer( LibraryContainerType _eType ) const;
+
+ /** determines whether there exists a library of the given type, with the given name
+ */
+ bool hasLibrary( LibraryContainerType _eType, const OUString& _rLibName ) const;
+
+ /** returns a script or dialog library given by name
+
+ @param _eType
+ the type of library to load
+ @param _rLibName
+ the name of the script library
+ @param _bLoadLibrary
+ <TRUE/> if and only if the library should be loaded.
+
+ @throws NoSuchElementException
+ if there is no script library with the given name
+ */
+ css::uno::Reference< css::container::XNameContainer >
+ getLibrary( LibraryContainerType _eType, const OUString& _rLibName, bool _bLoadLibrary ) const;
+
+ /** creates a script or dialog library in the document, or returns an existing one
+
+ If <code>_rLibName</code> denotes an existing library which does not need to be created,
+ then this library will automatically be loaded, and then returned.
+ */
+ css::uno::Reference< css::container::XNameContainer >
+ getOrCreateLibrary( LibraryContainerType _eType, const OUString& _rLibName ) const;
+
+ /** returns the names of the modules in a given script or dialog library of the document
+ */
+ css::uno::Sequence< OUString >
+ getObjectNames( LibraryContainerType _eType, const OUString& _rLibName ) const;
+
+ /** retrieves a name for a newly to be created module or dialog
+ */
+ OUString createObjectName( LibraryContainerType _eType, const OUString& _rLibName ) const;
+
+ /** loads a script or dialog library given by name, if there is such a library
+ */
+ void loadLibraryIfExists( LibraryContainerType _eType, const OUString& _rLibrary );
+
+ /// retrieves the (combined) names of all script and dialog libraries
+ css::uno::Sequence< OUString >
+ getLibraryNames() const;
+
+ /** removes a given script module from the document
+
+ @return
+ <TRUE/> if and only if the removal was successful. When <FALSE/> is returned,
+ this will reported as assertion in a non-product build.
+ */
+ bool removeModule( const OUString& _rLibName, const OUString& _rModuleName ) const;
+
+ /** creates a module with the given name in the given library
+ @param _rLibName
+ the library name
+ @param _rModName
+ the name of the to-be-created module
+ @param _bCreateMain
+ determines whether or not a function Main should be created
+ @param _out_rNewModuleCode
+ the source code of the newly created module
+ @return
+ <TRUE/> if and only if the creation was successful
+ */
+ bool createModule( const OUString& _rLibName, const OUString& _rModName, bool _bCreateMain, OUString& _out_rNewModuleCode ) const;
+
+ /** inserts a given piece as code as module
+ @param _rLibName
+ the name of the library to insert the module into. If a library with this name does
+ not yet exist, it will be created.
+ @param _rModName
+ the name of the module to insert the code as. Must denote a name which is not yet
+ used in the module library.
+ @param _rModuleCode
+ the code of the new module
+ @return
+ <TRUE/> if and only if the insertion was successful.
+ */
+ bool insertModule( const OUString& _rLibName, const OUString& _rModName, const OUString& _rModuleCode ) const;
+
+ /** updates a given module with new code
+ @param _rLibName
+ the name of the library the modules lives in. Must denote an existing module library.
+ @param _rModName
+ the name of the module to update. Must denote an existing module in the given library.
+ @param _rModuleCode
+ the new module code.
+ @return
+ <TRUE/> if and only if the insertion was successful.
+ */
+ bool updateModule( const OUString& _rLibName, const OUString& _rModName, const OUString& _rModuleCode ) const;
+
+ /// determines whether a module with the given name exists in the given library
+ bool hasModule( const OUString& _rLibName, const OUString& _rModName ) const;
+
+ /** retrieves a module's source
+ @param _rLibName
+ the library name where the module is located
+ @param _rModName
+ the module name
+ @param _out_rModuleSource
+ takes the module's source upon successful return
+ @return
+ <TRUE/> if and only if the code could be successfully retrieved, <FALSE/> otherwise
+ */
+ bool getModule( const OUString& _rLibName, const OUString& _rModName, OUString& _rModuleSource ) const;
+
+ /** renames a module
+ @param _rLibName
+ the library where the module lives in. Must denote an existing library.
+ @param _rOldName
+ the old module name. Must denote an existing module.
+ @param _rNewName
+ the new module name
+ @return
+ <TRUE/> if and only if renaming was successful.
+ */
+ bool renameModule( const OUString& _rLibName, const OUString& _rOldName, const OUString& _rNewName ) const;
+
+ /** removes a given dialog from the document
+
+ @return
+ <TRUE/> if and only if the removal was successful. When <FALSE/> is returned,
+ this will reported as assertion in a non-product build.
+ */
+ bool removeDialog( const OUString& _rLibName, const OUString& _rDialogName ) const;
+
+ /// determines whether a dialog with the given name exists in the given library
+ bool hasDialog( const OUString& _rLibName, const OUString& _rDialogName ) const;
+
+ /** retrieves a dialog
+ @param _rLibName
+ the library name where the module is located
+ @param _rDialogName
+ the dialog's name
+ @param _out_rDialogSource
+ takes the provider for the dialog's description, upon successful return
+ @return
+ <TRUE/> if and only if the dialog could be successfully retrieved, <FALSE/> otherwise
+ */
+ bool getDialog(
+ const OUString& _rLibName,
+ const OUString& _rDialogName,
+ css::uno::Reference< css::io::XInputStreamProvider >& _out_rDialogProvider
+ ) const;
+
+ /** renames a dialog
+ @param _rLibName
+ the library where the dialog lives in. Must denote an existing library.
+ @param _rOldName
+ the old dialog name. Must denote an existing dialog.
+ @param _rNewName
+ the new dialog name
+ @param _rxExistingDialogModel
+ the existing model of the dialog, if already loaded in the IDE
+ @return
+ <TRUE/> if and only if renaming was successful.
+ */
+ bool renameDialog(
+ const OUString& _rLibName,
+ const OUString& _rOldName,
+ const OUString& _rNewName,
+ const css::uno::Reference< css::container::XNameContainer >& _rxExistingDialogModel
+ ) const;
+
+ /** create a dialog
+ @param _rLibName
+ the library name where the module is located
+ @param _rDialogName
+ the dialog's name
+ @param _out_rDialogSource
+ takes the provider for the dialog's description, upon successful return
+ @return
+ <TRUE/> if and only if the dialog could be successfully retrieved, <FALSE/> otherwise
+ */
+ bool createDialog(
+ const OUString& _rLibName,
+ const OUString& _rDialogName,
+ css::uno::Reference< css::io::XInputStreamProvider >& _out_rDialogProvider
+ ) const;
+
+ /** inserts a given dialog into a given library
+
+ @param _rLibName
+ the name of the library to insert the dialog into. If a library with this name does
+ not yet exist, it will be created.
+ @param _rModName
+ the name of the dialog to insert. Must denote a name which is not yet
+ used in the dialog library.
+ @param _rDialogProvider
+ the provider of the dialog's description
+ @return
+ <TRUE/> if and only if the insertion was successful.
+ */
+ bool insertDialog(
+ const OUString& _rLibName,
+ const OUString& _rDialogName,
+ const css::uno::Reference< css::io::XInputStreamProvider >& _rDialogProvider
+ ) const;
+
+ /** determines whether the document is read-only
+
+ cannot be called if the document operates on the application-wide scripts
+ */
+ bool isReadOnly() const;
+
+ /** determines whether the ScriptDocument instance operates on the whole application,
+ as opposed to a real document
+ */
+ bool isApplication() const;
+
+ /** determines whether the ScriptDocument instance operates on a real document,
+ as opposed to the whole application
+ */
+ bool isDocument() const { return isValid() && !isApplication(); }
+
+ /** marks the document as modified
+ @precond
+ the instance operates on a real document, not on the application
+ @see isDocument
+ */
+ void setDocumentModified() const;
+
+ /** determines whether the document is modified
+ @precond
+ the instance operates on a real document, not on the application
+ @see isDocument
+ */
+ bool isDocumentModified() const;
+
+ /** saves the document, if the instance refers to a real document
+ @precond
+ <code>isApplication</code> returns <FALSE/>
+ */
+ void saveDocument(
+ const css::uno::Reference< css::task::XStatusIndicator >& _rxStatusIndicator
+ ) const;
+
+ /// returns the location of a library given by name
+ LibraryLocation
+ getLibraryLocation( const OUString& _rLibName ) const;
+
+ /// returns the title for the document
+ OUString getTitle( LibraryLocation _eLocation, LibraryType _eType = LibraryType::All ) const;
+
+ /** returns the title of the document
+
+ to be used for valid documents only
+ */
+ OUString getTitle() const;
+
+ /** determines whether the document is currently the one-and-only application-wide active document
+ */
+ bool isActive() const;
+
+ /** determines whether macro execution for this document is allowed
+
+ only to be called for real documents (->isDocument)
+ */
+ bool allowMacros() const;
+ };
+
+
+} // namespace basctl
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */