tdf#120658 - Reworking of dialogues Organize macros

(make from 5 existing only one)

Much of what makes up this patch is adapted from existing code that is
used to organize and select macros and to assign macros to shortcut
keys. Comments in the patch say where code is borrowed from.

Known issues:

+ Scripting framework library rename for BeanShell, Java, and JavaScript
always returns fail when there are no macro entries in the library even
though it actually succeeds. The same thing happens using
SvxScriptOrgDialog::renameEntry.

+ Deleting Basic macros from the Macro Manager dialog is not implemented
yet.

Change-Id: If4da04549f8b39675910cbbd1f94dd9a6b73c31a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176254
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Jim Raykowski 2024-10-07 10:56:34 -08:00
parent 0f3f371028
commit 55e86edcb3
62 changed files with 3834 additions and 155 deletions

View file

@ -29,6 +29,8 @@ $(eval $(call gb_Library_set_include,basctl,\
-I$(WORKDIR)/SdiTarget/basctl/sdi \
))
$(eval $(call gb_Library_add_defs,basctl,-DBASCTL_DLLIMPLEMENTATION))
$(eval $(call gb_Library_use_external,basctl,boost_headers))
$(eval $(call gb_Library_use_custom_headers,basctl,\

View file

@ -576,7 +576,7 @@
#include <iderid.hxx>
#include <localizationmgr.hxx>
#include <managelang.hxx>
#include <scriptdocument.hxx>
#include <basctl/scriptdocument.hxx>
#endif // PCH_LEVEL >= 4
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -244,6 +244,8 @@ BasicManager* FindBasicManager( StarBASIC const * pLib )
void MarkDocumentModified( const ScriptDocument& rDocument )
{
SfxGetpApp()->Broadcast(SfxHint(SfxHintId::ScriptDocumentChanged));
Shell* pShell = GetShell();
// does not have to come from a document...

View file

@ -764,21 +764,26 @@ bool QueryReplaceMacro( std::u16string_view rName, weld::Widget* pParent )
bool QueryDelDialog( std::u16string_view rName, weld::Widget* pParent )
{
EnsureIde();
return QueryDel( rName, IDEResId( RID_STR_QUERYDELDIALOG ), pParent );
}
bool QueryDelLib( std::u16string_view rName, bool bRef, weld::Widget* pParent )
{
EnsureIde();
return QueryDel( rName, IDEResId( bRef ? RID_STR_QUERYDELLIBREF : RID_STR_QUERYDELLIB ), pParent );
}
bool QueryDelModule( std::u16string_view rName, weld::Widget* pParent )
{
EnsureIde();
return QueryDel( rName, IDEResId( RID_STR_QUERYDELMODULE ), pParent );
}
bool QueryPassword(weld::Widget* pDialogParent, const Reference< script::XLibraryContainer >& xLibContainer, const OUString& rLibName, OUString& rPassword, bool bRepeat, bool bNewTitle)
{
EnsureIde();
bool bOK = false;
sal_uInt16 nRet = 0;

View file

@ -18,7 +18,7 @@
*/
#include <doceventnotifier.hxx>
#include <scriptdocument.hxx>
#include <basctl/scriptdocument.hxx>
#include <com/sun/star/frame/theGlobalEventBroadcaster.hpp>

View file

@ -18,7 +18,7 @@
*/
#include <docsignature.hxx>
#include <scriptdocument.hxx>
#include <basctl/scriptdocument.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/signaturestate.hxx>

View file

@ -464,7 +464,13 @@ IMPL_LINK( LibPage, ButtonHdl, weld::Button&, rButton, void )
else if (&rButton == m_xInsertLibButton.get())
InsertLib();
else if (&rButton == m_xExportButton.get())
Export();
{
std::unique_ptr<weld::TreeIter> xCurEntry(m_xLibBox->make_iterator());
if (!m_xLibBox->get_cursor(xCurEntry.get()))
return;
OUString aLibName(m_xLibBox->get_text(*xCurEntry, 0));
Export(m_aCurDocument, aLibName, m_pDialog->getDialog());
}
else if (&rButton == m_xDelButton.get())
DeleteCurrent();
else if (&rButton == m_xPasswordButton.get())
@ -565,9 +571,32 @@ void LibPage::NewLib()
void LibPage::InsertLib()
{
auto remove_entry = [this](OUString& rLibName) { // remove listbox entry
int nEntry = FindEntry(*m_xLibBox, rLibName);
if (nEntry != -1)
m_xLibBox->remove(nEntry);
};
auto insert_entry = [this](OUString& rLibName) { // insert listbox entry
m_xLibBox->make_unsorted();
ImpInsertLibEntry(rLibName, m_xLibBox->n_children());
m_xLibBox->make_sorted();
m_xLibBox->set_cursor(m_xLibBox->find_text(rLibName));
};
ImportLib(m_aCurDocument, m_pDialog->getDialog(), remove_entry, insert_entry, {});
}
void ImportLib(const ScriptDocument& rDocument, weld::Dialog* pDialog,
const std::function<void(OUString& rLibName)>& func_remove_entry,
const std::function<void(OUString& rLibName)>& func_insert_entry,
const std::function<void()>& func_insert_entries)
{
basctl::EnsureIde();
const Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() );
// file open dialog
sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_pDialog->getDialog());
sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, pDialog);
aDlg.SetContext(sfx2::FileDialogHelper::BasicInsertLib);
const Reference <XFilePicker3>& xFP = aDlg.GetFilePicker();
@ -643,7 +672,7 @@ void LibPage::InsertLib()
if (aLibNames.hasElements())
{
// library import dialog
xLibDlg = std::make_shared<LibDialog>(m_pDialog->getDialog());
xLibDlg = std::make_shared<LibDialog>(pDialog);
xLibDlg->SetStorageName(aURLObj.getName());
weld::TreeView& rView = xLibDlg->GetLibBox();
rView.make_unsorted();
@ -671,7 +700,7 @@ void LibPage::InsertLib()
if (!xLibDlg)
{
std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_pDialog->getDialog(),
std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pDialog,
VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_NOLIBINSTORAGE)));
xErrorBox->run();
return;
@ -685,9 +714,12 @@ void LibPage::InsertLib()
if ( aExtension != aLibExtension && aExtension != aContExtension )
xLibDlg->EnableReference(false);
weld::DialogController::runAsync(xLibDlg, [aContExtension, xDlgURLObj=std::move(xDlgURLObj), aExtension,
aLibExtension, xModURLObj=std::move(xModURLObj), xLibDlg,
xDlgLibContImport, xModLibContImport, this](sal_Int32 nResult)
weld::DialogController::runAsync(
xLibDlg,
[aContExtension, xDlgURLObj = std::move(xDlgURLObj), aExtension, aLibExtension,
xModURLObj = std::move(xModURLObj), xLibDlg, xDlgLibContImport, xModLibContImport,
rDocument, pDialog, func_remove_entry, func_insert_entry,
func_insert_entries](sal_Int32 nResult)
{
if (!nResult )
return;
@ -702,8 +734,10 @@ void LibPage::InsertLib()
if (rView.get_toggle(nLib) == TRISTATE_TRUE)
{
OUString aLibName(rView.get_text(nLib));
Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
Reference<script::XLibraryContainer2> xModLibContainer(
rDocument.getLibraryContainer(E_SCRIPTS), UNO_QUERY);
Reference<script::XLibraryContainer2> xDlgLibContainer(
rDocument.getLibraryContainer(E_DIALOGS), UNO_QUERY);
// check, if the library is already existing
if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) ) ||
@ -714,8 +748,10 @@ void LibPage::InsertLib()
// check, if the library is the Standard library
if ( aLibName == "Standard" )
{
std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_pDialog->getDialog(),
VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_REPLACESTDLIB)));
std::unique_ptr<weld::MessageDialog> xErrorBox(
Application::CreateMessageDialog(
pDialog, VclMessageType::Warning, VclButtonsType::Ok,
IDEResId(RID_STR_REPLACESTDLIB)));
xErrorBox->run();
continue;
}
@ -726,8 +762,10 @@ void LibPage::InsertLib()
{
OUString aErrStr( IDEResId(RID_STR_REPLACELIB) );
aErrStr = aErrStr.replaceAll("XX", aLibName) + "\n" + IDEResId(RID_STR_LIBISREADONLY);
std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_pDialog->getDialog(),
VclMessageType::Warning, VclButtonsType::Ok, aErrStr));
std::unique_ptr<weld::MessageDialog> xErrorBox(
Application::CreateMessageDialog(pDialog,
VclMessageType::Warning,
VclButtonsType::Ok, aErrStr));
xErrorBox->run();
continue;
}
@ -743,8 +781,9 @@ void LibPage::InsertLib()
else
aErrStr = IDEResId(RID_STR_IMPORTNOTPOSSIBLE);
aErrStr = aErrStr.replaceAll("XX", aLibName) + "\n" +IDEResId(RID_STR_SBXNAMEALLREADYUSED);
std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_pDialog->getDialog(),
VclMessageType::Warning, VclButtonsType::Ok, aErrStr));
std::unique_ptr<weld::MessageDialog> xErrorBox(
Application::CreateMessageDialog(pDialog, VclMessageType::Warning,
VclButtonsType::Ok, aErrStr));
xErrorBox->run();
continue;
}
@ -758,14 +797,17 @@ void LibPage::InsertLib()
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContImport, UNO_QUERY );
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) && !bReference )
{
bOK = QueryPassword(m_pDialog->getDialog(), xModLibContImport, aLibName, aPassword, true, true);
bOK = QueryPassword(pDialog, xModLibContImport, aLibName, aPassword,
true, true);
if ( !bOK )
{
OUString aErrStr( IDEResId(RID_STR_NOIMPORT) );
aErrStr = aErrStr.replaceAll("XX", aLibName);
std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_pDialog->getDialog(),
VclMessageType::Warning, VclButtonsType::Ok, aErrStr));
std::unique_ptr<weld::MessageDialog> xErrorBox(
Application::CreateMessageDialog(pDialog,
VclMessageType::Warning,
VclButtonsType::Ok, aErrStr));
xErrorBox->run();
continue;
}
@ -775,10 +817,7 @@ void LibPage::InsertLib()
// remove existing libraries
if ( bRemove )
{
// remove listbox entry
int nEntry_ = FindEntry(*m_xLibBox, aLibName);
if (nEntry_ != -1)
m_xLibBox->remove(nEntry_);
func_remove_entry(aLibName); // LibPage::InsertLib
// remove module library
if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
@ -901,29 +940,24 @@ void LibPage::InsertLib()
}
}
// insert listbox entry
m_xLibBox->make_unsorted();
ImpInsertLibEntry( aLibName, m_xLibBox->n_children() );
m_xLibBox->make_sorted();
m_xLibBox->set_cursor( m_xLibBox->find_text(aLibName) );
func_insert_entry(aLibName); // LibPage::InsertLib
bChanges = true;
}
}
if ( bChanges )
MarkDocumentModified( m_aCurDocument );
if (bChanges)
{
func_insert_entries(); // MacroManager
MarkDocumentModified(rDocument);
}
});
}
void LibPage::Export()
void Export(const ScriptDocument& rDocument, const OUString& aLibName, weld::Dialog* pDialog)
{
std::unique_ptr<weld::TreeIter> xCurEntry(m_xLibBox->make_iterator());
if (!m_xLibBox->get_cursor(xCurEntry.get()))
return;
OUString aLibName(m_xLibBox->get_text(*xCurEntry, 0));
// Password verification
Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
Reference<script::XLibraryContainer2> xModLibContainer(rDocument.getLibraryContainer(E_SCRIPTS),
UNO_QUERY);
if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && !xModLibContainer->isLibraryLoaded( aLibName ) )
{
@ -934,13 +968,13 @@ void LibPage::Export()
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
{
OUString aPassword;
bOK = QueryPassword(m_pDialog->getDialog(), xModLibContainer, aLibName, aPassword);
bOK = QueryPassword(pDialog, xModLibContainer, aLibName, aPassword);
}
if ( !bOK )
return;
}
std::unique_ptr<ExportDialog> xNewDlg(new ExportDialog(m_pDialog->getDialog()));
std::unique_ptr<ExportDialog> xNewDlg(new ExportDialog(pDialog));
if (xNewDlg->run() != RET_OK)
return;
@ -951,24 +985,24 @@ void LibPage::Export()
//parent of file dialog from ExportAs...
xNewDlg.reset();
if (bExportAsPackage)
ExportAsPackage( aLibName );
ExportAsPackage(rDocument, aLibName, pDialog);
else
ExportAsBasic( aLibName );
ExportAsBasic(rDocument, aLibName, pDialog);
}
catch(const util::VetoException& ) // user canceled operation
{
}
}
void LibPage::implExportLib( const OUString& aLibName, const OUString& aTargetURL,
const Reference< task::XInteractionHandler >& Handler )
void implExportLib(const ScriptDocument& rScriptDocument, const OUString& aLibName,
const OUString& aTargetURL, const Reference<task::XInteractionHandler>& Handler)
{
Reference< script::XLibraryContainerExport > xModLibContainerExport
( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
Reference< script::XLibraryContainerExport > xDlgLibContainerExport
( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
Reference<script::XLibraryContainerExport> xModLibContainerExport(
rScriptDocument.getLibraryContainer(E_SCRIPTS), UNO_QUERY);
Reference<script::XLibraryContainerExport> xDlgLibContainerExport(
rScriptDocument.getLibraryContainer(E_DIALOGS), UNO_QUERY);
if ( xModLibContainerExport.is() )
xModLibContainerExport->exportLibrary( aLibName, aTargetURL, Handler );
xModLibContainerExport->exportLibrary(aLibName, aTargetURL, Handler);
if (!xDlgLibContainerExport.is())
return;
@ -1011,10 +1045,13 @@ Reference< XProgressHandler > OLibCommandEnvironment::getProgressHandler()
return xRet;
}
void LibPage::ExportAsPackage( const OUString& aLibName )
void ExportAsPackage(const ScriptDocument& rScriptDocument, const OUString& aLibName,
weld::Dialog* pDialog)
{
EnsureIde();
// file open dialog
sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, FileDialogFlags::NONE, m_pDialog->getDialog());
sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILESAVE_SIMPLE,
FileDialogFlags::NONE, pDialog);
aDlg.SetContext(sfx2::FileDialogHelper::BasicExportPackage);
const Reference <XFilePicker3>& xFP = aDlg.GetFilePicker();
@ -1049,7 +1086,7 @@ void LibPage::ExportAsPackage( const OUString& aLibName )
if( xSFA->exists( aSourcePath ) )
xSFA->kill( aSourcePath );
Reference< task::XInteractionHandler > xDummyHandler( new DummyInteractionHandler( xHandler ) );
implExportLib( aLibName, aTmpPath, xDummyHandler );
implExportLib(rScriptDocument, aLibName, aTmpPath, xDummyHandler);
Reference< XCommandEnvironment > xCmdEnv = new OLibCommandEnvironment(xHandler);
@ -1113,11 +1150,13 @@ void LibPage::ExportAsPackage( const OUString& aLibName )
xSFA->kill( aMetaInfFolder );
}
void LibPage::ExportAsBasic( const OUString& aLibName )
void ExportAsBasic(const ScriptDocument& rScriptDocument, const OUString& aLibName,
weld::Dialog* pDialog)
{
EnsureIde();
// Folder picker
const Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() );
Reference< XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_pDialog->getDialog());
Reference<XFolderPicker2> xFolderPicker = sfx2::createFolderPicker(xContext, pDialog);
Reference< task::XInteractionHandler2 > xHandler( task::InteractionHandler::createWithParent(xContext, nullptr) );
xFolderPicker->setTitle(IDEResId(RID_STR_EXPORTBASIC));
@ -1136,7 +1175,7 @@ void LibPage::ExportAsBasic( const OUString& aLibName )
GetExtraData()->SetAddLibPath(aTargetURL);
Reference< task::XInteractionHandler > xDummyHandler( new DummyInteractionHandler( xHandler ) );
implExportLib( aLibName, aTargetURL, xDummyHandler );
implExportLib(rScriptDocument, aLibName, aTargetURL, xDummyHandler);
}
}

View file

@ -27,6 +27,8 @@
#include <vcl/weld.hxx>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <basctl/basctldllpublic.hxx>
class SvxPasswordDialog;
namespace basctl
@ -185,11 +187,6 @@ class LibPage final : public OrganizePage
void DeleteCurrent();
void NewLib();
void InsertLib();
void implExportLib( const OUString& aLibName, const OUString& aTargetURL,
const css::uno::Reference< css::task::XInteractionHandler >& Handler );
void Export();
void ExportAsPackage( const OUString& aLibName );
void ExportAsBasic( const OUString& aLibName );
void EndTabDialog();
void FillListBox();
void InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
@ -202,6 +199,14 @@ public:
virtual void ActivatePage() override;
};
void implExportLib(const ScriptDocument& rScriptDocument, const OUString& aLibName,
const OUString& aTargetURL,
const css::uno::Reference<css::task::XInteractionHandler>& Handler);
void ExportAsPackage(const ScriptDocument& rScriptDocument, const OUString& aLibName,
weld::Dialog* pDialog);
void ExportAsBasic(const ScriptDocument& rScriptDocument, const OUString& aLibName,
weld::Dialog* pDialog);
class OrganizeDialog : public weld::GenericDialogController
{
private:

View file

@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <sbxitem.hxx>
#include <basctl/sbxitem.hxx>
#include <sal/log.hxx>
#include <utility>

View file

@ -18,7 +18,7 @@
*/
#include <memory>
#include <scriptdocument.hxx>
#include <basctl/scriptdocument.hxx>
#include <basobj.hxx>
#include <strings.hrc>
#include <iderid.hxx>

View file

@ -24,7 +24,7 @@
#include <vcl/InterimItemWindow.hxx>
#include "doceventnotifier.hxx"
#include "scriptdocument.hxx"
#include <basctl/scriptdocument.hxx>
namespace basctl
{

View file

@ -19,7 +19,7 @@
#pragma once
#include "doceventnotifier.hxx"
#include "sbxitem.hxx"
#include <basctl/sbxitem.hxx>
#include "ObjectCatalog.hxx"
#include <com/sun/star/container/XContainerListener.hpp>

View file

@ -18,7 +18,8 @@
*/
#pragma once
#include "scriptdocument.hxx"
#include <basctl/basctldllpublic.hxx>
#include <basctl/scriptdocument.hxx>
#include <tools/long.hxx>
class SbMethod;
@ -44,14 +45,10 @@ namespace basctl
void BasicStopped( bool* pbAppWindowDisabled = nullptr, bool* pbDispatcherLocked = nullptr, sal_uInt16* pnWaitCount = nullptr,
SfxUInt16Item** ppSWActionCount = nullptr, SfxUInt16Item** ppSWLockViewCount = nullptr );
bool IsValidSbxName( std::u16string_view rName );
SAL_RET_MAYBENULL BasicManager* FindBasicManager( StarBASIC const * pLib );
SAL_RET_MAYBENULL SfxBindings* GetBindingsPtr();
SAL_RET_MAYBENULL SfxDispatcher* GetDispatcher ();
void InvalidateDebuggerSlots();
// libraries
@ -98,8 +95,6 @@ namespace basctl
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: */

View file

@ -26,7 +26,7 @@
#include "doceventnotifier.hxx"
#include <vcl/weld.hxx>
#include "sbxitem.hxx"
#include <basctl/sbxitem.hxx>
#include <o3tl/typed_flags_set.hxx>
class SbModule;

View file

@ -18,9 +18,9 @@
*/
#pragma once
#include "scriptdocument.hxx"
#include "sbxitem.hxx"
#include <basctl/basctldllpublic.hxx>
#include <basctl/scriptdocument.hxx>
#include <basctl/sbxitem.hxx>
#include <svtools/scrolladaptor.hxx>
#include <svtools/tabbar.hxx>
#include <basic/sbdef.hxx>
@ -297,10 +297,6 @@ 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
{

View file

@ -23,7 +23,7 @@
#include <string_view>
#include "scriptdocument.hxx"
#include <basctl/scriptdocument.hxx>
#include <com/sun/star/resource/XStringResourceManager.hpp>

View file

@ -134,6 +134,8 @@
<menu:menupopup>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -32,6 +32,7 @@ $(eval $(call gb_Library_use_sdk_api,cui))
$(eval $(call gb_Library_use_libraries,cui,\
$(call gb_Helper_optional,AVMEDIA,avmedia) \
basctl \
basegfx \
comphelper \
cppu \
@ -147,6 +148,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
cui/source/dialogs/GraphicTestsDialog \
cui/source/dialogs/ImageViewerDialog \
cui/source/dialogs/scriptdlg \
cui/source/dialogs/MacroManagerDialog \
cui/source/dialogs/SignatureLineDialogBase \
cui/source/dialogs/SignatureLineDialog \
cui/source/dialogs/SignSignatureLineDialog \

View file

@ -116,6 +116,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/listdialog \
cui/uiconfig/ui/macroassigndialog \
cui/uiconfig/ui/macroassignpage \
cui/uiconfig/ui/macromanagerdialog \
cui/uiconfig/ui/macroselectordialog \
cui/uiconfig/ui/menuassignpage \
cui/uiconfig/ui/mosaicdialog \

View file

@ -62,8 +62,11 @@ inline constexpr OUString RID_SVXBMP_THEME_DEFAULT_BIG = u"svx/res/galdefl.png"_
inline constexpr OUString RID_CUIBMP_HARDDISK = u"res/harddisk_16.png"_ustr;
inline constexpr OUString RID_CUIBMP_LIB = u"res/im30820.png"_ustr;
inline constexpr OUString RID_CUIBMP_DIALOG = u"res/im30823.png"_ustr;
inline constexpr OUString RID_CUIBMP_MACRO = u"res/im30821.png"_ustr;
inline constexpr OUString RID_CUIBMP_DOC = u"res/im30826.png"_ustr;
inline constexpr OUString RID_CUIBMP_LOCKED = u"res/lock.png"_ustr;
inline constexpr OUString RID_CUIBMP_LINKED = u"sw/res/nc20007.png"_ustr;
inline constexpr OUString RID_SVXBMP_SCRIPT = u"res/script.png"_ustr;

View file

@ -436,4 +436,33 @@
#define STR_STYLE_NO_LANGUAGE NC_("STR_STYLE_NO_LANGUAGE", "Check if styles have a language set.")
#define STR_DOCUMENT_TITLE NC_("STR_DOCUMENT_TITLE", "Check if the document title is set.")
// Unified script organizer selector
#define STR_LIBRARY NC_("STR_LIBRARY", "Library")
#define STR_MODULE NC_("STR_MODULE", "Module")
#define STR_DIALOG NC_("STR_DIALOG", "Dialog")
#define STR_MACRO NC_("STR_MACRO", "Macro")
#define STR_INPUTDIALOG_NEWLIBRARYTITLE NC_("STR_INPUTDIALOG_NEWLIBRARYTITLE", "New Library")
#define STR_INPUTDIALOG_NEWLIBRARYLABEL NC_("STR_INPUTDIALOG_NEWLIBRARYLABEL", "Please enter a name for the new library:")
#define STR_INPUTDIALOG_NEWMODULETITLE NC_("STR_INPUTDIALOG_NEWMODULETITLE", "New Module")
#define STR_INPUTDIALOG_NEWMODULELABEL NC_("STR_INPUTDIALOG_NEWMODULELABEL", "Please enter a name for the new module:")
#define STR_INPUTDIALOG_NEWDIALOGTITLE NC_("STR_INPUTDIALOG_NEWDIALOGTITLE", "New Dialog")
#define STR_INPUTDIALOG_NEWDIALOGLABEL NC_("STR_INPUTDIALOG_NEWDIALOGLABEL", "Please enter a name for the new dialog:")
#define STR_INPUTDIALOG_NEWMACROTITLE NC_("STR_INPUTDIALOG_NEWMACROTITLE", "New Macro")
#define STR_INPUTDIALOG_NEWMACROLABEL NC_("STR_INPUTDIALOG_NEWMACROLABEL", "Please enter a name for the new macro:")
#define STR_INPUTDIALOG_RENAMELIBRARYTITLE NC_("STR_INPUTDIALOG_RENAMELIBRARYTITLE", "Rename Library")
#define STR_INPUTDIALOG_RENAMELIBRARYLABEL NC_("STR_INPUTDIALOG_RENAMELIBRARYLABEL", "Please enter a name to rename the library:")
#define STR_INPUTDIALOG_RENAMEMODULETITLE NC_("STR_INPUTDIALOG_RENAMEMODULETITLE", "Rename Module")
#define STR_INPUTDIALOG_RENAMEMODULELABEL NC_("STR_INPUTDIALOG_RENAMEMODULELABEL", "Please enter a name to rename the module:")
#define STR_INPUTDIALOG_RENAMEDIALOGTITLE NC_("STR_INPUTDIALOG_RENAMEDIALOGTITLE", "Rename Dialog")
#define STR_INPUTDIALOG_RENAMEDIALOGLABEL NC_("STR_INPUTDIALOG_RENAMEDIALOGLABEL", "Please enter a name to rename the dialog:")
#define STR_INPUTDIALOG_RENAMEMACROTITLE NC_("STR_INPUTDIALOG_RENAMEMACROTITLE", "Rename Macro")
#define STR_INPUTDIALOG_RENAMEMACROLABEL NC_("STR_INPUTDIALOG_RENAMEMACROLABEL", "Please enter a name to rename the macro:")
#define STR_LIBISREADONLY NC_("STR_LIBISREADONLY", "This library is read-only.")
#define STR_SBXNAMEALLREADYUSED NC_("STR_SBXNAMEALLREADYUSED", "Name already exists")
#define STR_SELECTEDENTRYNOTFOUND NC_("STR_SELECTEDENTRYNOTFOUND", "The selected entry doesn't exist. It will be removed from the list.")
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -540,6 +540,9 @@ void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::scrip
for ( Reference< browse::XBrowseNode > const & theChild : children )
{
if (!theChild.is())
continue;
bool bDisplay = true;
OUString uiName = theChild->getName();
if ( bIsRootNode )
@ -576,6 +579,9 @@ void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::scrip
for ( const auto& rxNode : grandchildren )
{
if (!rxNode.is())
continue;
if ( rxNode->getType() == browse::BrowseNodeTypes::CONTAINER )
{
bChildOnDemand = true;
@ -875,59 +881,59 @@ void CuiConfigGroupListBox::GroupSelected()
case SfxCfgKind::GROUP_SCRIPTCONTAINER:
{
if (!m_xTreeView->iter_has_child(*xIter))
{
Reference< browse::XBrowseNode > rootNode(
static_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
Reference< browse::XBrowseNode > rootNode(
static_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
try {
if ( rootNode->hasChildNodes() )
try {
if ( rootNode->hasChildNodes() )
{
const Sequence< Reference< browse::XBrowseNode > > children =
rootNode->getChildNodes();
for ( const Reference< browse::XBrowseNode >& childNode : children )
{
const Sequence< Reference< browse::XBrowseNode > > children =
rootNode->getChildNodes();
if (!childNode.is())
continue;
for ( const Reference< browse::XBrowseNode >& childNode : children )
if (childNode->getType() == browse::BrowseNodeTypes::SCRIPT)
{
if (childNode->getType() == browse::BrowseNodeTypes::SCRIPT)
OUString uri, description;
Reference < beans::XPropertySet >xPropSet( childNode, UNO_QUERY );
if (!xPropSet.is())
{
OUString uri, description;
Reference < beans::XPropertySet >xPropSet( childNode, UNO_QUERY );
if (!xPropSet.is())
{
continue;
}
Any value =
xPropSet->getPropertyValue(u"URI"_ustr);
value >>= uri;
try
{
value = xPropSet->getPropertyValue(u"Description"_ustr);
value >>= description;
}
catch (Exception &) {
// do nothing, the description will be empty
}
OUString* pScriptURI = new OUString( uri );
OUString aImage = GetImage(childNode, Reference< XComponentContext >(), false);
m_pFunctionListBox->aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI ));
m_pFunctionListBox->aArr.back()->sCommand = uri;
m_pFunctionListBox->aArr.back()->sLabel = childNode->getName();
m_pFunctionListBox->aArr.back()->sHelpText = description;
OUString sId(weld::toId(m_pFunctionListBox->aArr.back().get()));
m_pFunctionListBox->append(sId, childNode->getName(), aImage);
continue;
}
Any value =
xPropSet->getPropertyValue(u"URI"_ustr);
value >>= uri;
try
{
value = xPropSet->getPropertyValue(u"Description"_ustr);
value >>= description;
}
catch (Exception &) {
// do nothing, the description will be empty
}
OUString* pScriptURI = new OUString( uri );
OUString aImage = GetImage(childNode, Reference< XComponentContext >(), false);
m_pFunctionListBox->aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI ));
m_pFunctionListBox->aArr.back()->sCommand = uri;
m_pFunctionListBox->aArr.back()->sLabel = childNode->getName();
m_pFunctionListBox->aArr.back()->sHelpText = description;
OUString sId(weld::toId(m_pFunctionListBox->aArr.back().get()));
m_pFunctionListBox->append(sId, childNode->getName(), aImage);
}
}
}
catch (RuntimeException&) {
// do nothing, the entry will not be displayed in the UI
}
}
catch (RuntimeException&) {
// do nothing, the entry will not be displayed in the UI
}
break;
}
@ -1032,23 +1038,10 @@ IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter&, rIter, boo
#if HAVE_FEATURE_SCRIPTING
void CuiConfigGroupListBox::SelectMacro( const SfxMacroInfoItem *pItem )
{
auto const rMacro = pItem->GetQualifiedName();
sal_Int32 nIdx {rMacro.lastIndexOf('.')};
const std::u16string_view aMethod( rMacro.subView(nIdx + 1) );
std::u16string_view aLib;
std::u16string_view aModule;
if ( nIdx>0 )
{
// string contains at least 2 tokens
nIdx = rMacro.lastIndexOf('.', nIdx);
if (nIdx != -1)
{
// string contains at least 3 tokens
aLib = o3tl::getToken(rMacro, 0, '.' );
sal_Int32 nIdx2 = nIdx + 1;
aModule = o3tl::getToken(rMacro, 0, '.', nIdx2 );
}
}
const std::u16string_view aLocation = pItem->GetLocation();
const std::u16string_view aLib = pItem->GetLib();
const std::u16string_view aModule = pItem->GetModule();
const std::u16string_view aMethod = pItem->GetMethod();
std::unique_ptr<weld::TreeIter> xIter = m_xTreeView->make_iterator();
if (!m_xTreeView->get_iter_first(*xIter))
@ -1065,6 +1058,8 @@ void CuiConfigGroupListBox::SelectMacro( const SfxMacroInfoItem *pItem )
{
do
{
if (aLocation != m_xTreeView->get_text(*xLocationIter))
continue;
m_xTreeView->expand_row(*xLocationIter);
std::unique_ptr<weld::TreeIter> xLibIter = m_xTreeView->make_iterator(xLocationIter.get());
if (m_xTreeView->iter_children(*xLibIter))
@ -1074,6 +1069,34 @@ void CuiConfigGroupListBox::SelectMacro( const SfxMacroInfoItem *pItem )
OUString aEntryLib = m_xTreeView->get_text(*xLibIter);
if (aEntryLib == aLib)
{
if (aModule.empty())
{
m_xTreeView->scroll_to_row(*xLibIter);
m_xTreeView->select(*xLibIter);
GroupSelected();
weld::TreeView& rFunctionListBoxTreeView
= m_pFunctionListBox->get_widget();
std::unique_ptr<weld::TreeIter> xFunctionListBoxIter
= rFunctionListBoxTreeView.make_iterator();
if (!rFunctionListBoxTreeView.get_iter_first(
*xFunctionListBoxIter))
return;
do
{
OUString aEntryMethod = rFunctionListBoxTreeView.get_text(
*xFunctionListBoxIter);
if (aEntryMethod == aMethod)
{
rFunctionListBoxTreeView.scroll_to_row(
*xFunctionListBoxIter);
rFunctionListBoxTreeView.select(*xFunctionListBoxIter);
return;
}
} while (
rFunctionListBoxTreeView.iter_next(*xFunctionListBoxIter));
return;
}
m_xTreeView->expand_row(*xLibIter);
std::unique_ptr<weld::TreeIter> xModIter = m_xTreeView->make_iterator(xLibIter.get());
if (m_xTreeView->iter_children(*xModIter))

File diff suppressed because it is too large Load diff

View file

@ -94,6 +94,8 @@
#include <fileextcheckdlg.hxx>
#include <TextColumnsPage.hxx>
#include <MacroManagerDialog.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::container;
@ -134,6 +136,7 @@ IMPL_ABSTDLG_CLASS_ASYNC(AbstractPasswordToOpenModifyDialog,weld::DialogControll
IMPL_ABSTDLG_CLASS_ASYNC(AbstractQrCodeGenDialog,QrCodeGenDialog)
IMPL_ABSTDLG_CLASS_ASYNC(AbstractPasteDialog,SfxDialogController)
IMPL_ABSTDLG_CLASS_ASYNC(AbstractScriptSelectorDialog,SfxDialogController)
IMPL_ABSTDLG_CLASS_ASYNC(AbstractMacroManagerDialog,SfxDialogController)
IMPL_ABSTDLG_CLASS_ASYNC(AbstractSpellDialog,SfxDialogController)
IMPL_ABSTDLG_CLASS_ASYNC(AbstractSvxAreaTabDialog,SfxTabDialogController)
IMPL_ABSTDLG_CLASS_ASYNC(AbstractSvxCaptionDialog,SfxTabDialogController)
@ -996,6 +999,18 @@ void AbstractScriptSelectorDialog_Impl::SetRunLabel()
m_xDlg->SetRunLabel();
}
VclPtr<AbstractMacroManagerDialog>
AbstractDialogFactory_Impl::CreateMacroManagerDialog(weld::Window* pParent,
const Reference<frame::XFrame>& rxFrame)
{
return VclPtr<AbstractMacroManagerDialog_Impl>::Create(
std::make_shared<MacroManagerDialog>(pParent, rxFrame));
}
OUString AbstractMacroManagerDialog_Impl::GetScriptURL() const { return m_xDlg->GetScriptURL(); }
void AbstractMacroManagerDialog_Impl::LoadLastUsedMacro() const { m_xDlg->LoadLastUsedMacro(); }
VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog(weld::Window* pParent,
const OUString& rLanguage)
{

View file

@ -60,6 +60,8 @@
#include <zoom.hxx>
#include <AdditionsDialog.hxx>
#include <MacroManagerDialog.hxx>
#define DECL_ABSTDLG_CLASS_(Class,Base,Dialog,StdPtr) \
class Class##_Impl final : public Base \
{ \
@ -206,6 +208,13 @@ DECL_ABSTDLG_CLASS_ASYNC(AbstractScriptSelectorDialog,SvxScriptSelectorDialog)
virtual void SetRunLabel() override;
};
// AbstractMacroManagerDialog_Impl
DECL_ABSTDLG_CLASS_ASYNC(AbstractMacroManagerDialog,MacroManagerDialog)
virtual OUString GetScriptURL() const override;
virtual void LoadLastUsedMacro() const override;
};
// AbstractGalleryIdDialog_Impl
DECL_ABSTDLG_CLASS(AbstractGalleryIdDialog,GalleryIdDialog)
virtual sal_uInt32 GetId() const override;
@ -575,6 +584,10 @@ public:
virtual VclPtr<AbstractScriptSelectorDialog> CreateScriptSelectorDialog(weld::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& rxFrame) override;
virtual VclPtr<AbstractMacroManagerDialog> CreateMacroManagerDialog(weld::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& rxFrame) override;
virtual void ShowAsyncScriptErrorDialog(weld::Window* pParent, const css::uno::Any& rException) override;
virtual VclPtr<VclAbstractDialog> CreateSvxMacroAssignDlg(

View file

@ -0,0 +1,255 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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/.
*/
#pragma once
#include <sal/config.h>
#include <vector>
#include <basctl/scriptdocument.hxx>
#include <svx/passwd.hxx>
#include <svl/lstner.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/DispatchInformation.hpp>
#include <com/sun/star/script/browse/XBrowseNode.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
struct ScriptContainerInfo
{
css::script::browse::XBrowseNode* pBrowseNode;
ScriptContainerInfo(css::script::browse::XBrowseNode* pObj)
: pBrowseNode(pObj)
{
}
};
struct ScriptInfo
{
css::script::browse::XBrowseNode* pBrowseNode;
OUString sURL;
OUString sDescription;
ScriptInfo(css::script::browse::XBrowseNode* pObj, const OUString& rsUrl,
const OUString& rsDesc)
: pBrowseNode(pObj)
, sURL(rsUrl)
, sDescription(rsDesc)
{
}
};
typedef std::vector<std::unique_ptr<ScriptInfo>> ScriptInfoArr;
// inspired by class CuiConfigFunctionListBox
// cui/source/inc/cfgutil.hxx
class ScriptsListBox
{
friend class ScriptContainersListBox; // for access to aArr
ScriptInfoArr aArr;
std::unique_ptr<weld::TreeView> m_xTreeView;
std::unique_ptr<weld::TreeIter> m_xScratchIter;
DECL_LINK(QueryTooltip, const weld::TreeIter& rIter, OUString);
public:
ScriptsListBox(std::unique_ptr<weld::TreeView> xTreeView);
~ScriptsListBox();
void ClearAll();
static OUString GetDescriptionText(const OUString& rId);
OUString GetSelectedScriptName();
void connect_changed(const Link<weld::TreeView&, void>& rLink)
{
m_xTreeView->connect_changed(rLink);
}
void connect_popup_menu(const Link<const CommandEvent&, bool>& rLink)
{
m_xTreeView->connect_popup_menu(rLink);
}
void connect_row_activated(const Link<weld::TreeView&, bool>& rLink)
{
m_xTreeView->connect_row_activated(rLink);
}
void freeze() { m_xTreeView->freeze(); }
void thaw() { m_xTreeView->thaw(); }
void append(const OUString& rId, const OUString& rStr, const OUString& rImage,
const weld::TreeIter* pParent = nullptr)
{
m_xTreeView->insert(pParent, -1, &rStr, &rId, nullptr, nullptr, false,
m_xScratchIter.get());
m_xTreeView->set_image(*m_xScratchIter, rImage);
}
int n_children() const { return m_xTreeView->n_children(); }
std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig = nullptr) const
{
return m_xTreeView->make_iterator(pOrig);
}
OUString get_id(const weld::TreeIter& rIter) const { return m_xTreeView->get_id(rIter); }
bool get_selected(weld::TreeIter* pIter) const { return m_xTreeView->get_selected(pIter); }
OUString get_selected_id() const
{
if (!m_xTreeView->get_selected(m_xScratchIter.get()))
return OUString();
return m_xTreeView->get_id(*m_xScratchIter);
}
void select(int pos) { m_xTreeView->select(pos); }
weld::TreeView& get_widget() { return *m_xTreeView; }
void Remove(const weld::TreeIter& rEntry);
};
enum class ScriptContainerType
{
LOCATION,
LANGUAGE,
LIBRARY,
MODULEORDIALOG
};
class MacroManagerDialog;
// locations, libraries, modules, and dialogs
class ScriptContainersListBox
{
friend class MacroManagerDialog;
ScriptsListBox* m_pScriptsListBox;
css::uno::Reference<css::uno::XComponentContext> m_xContext;
css::uno::Reference<css::frame::XFrame> m_xFrame;
std::unique_ptr<weld::TreeView> m_xTreeView;
void Remove(const weld::TreeIter* pEntryIter, bool bRemoveEntryIter);
void Fill(const weld::TreeIter* pEntryIter);
basctl::ScriptDocument GetScriptDocument(const weld::TreeIter* pIter = nullptr);
DECL_LINK(ExpandingHdl, const weld::TreeIter&, bool);
DECL_LINK(QueryTooltip, const weld::TreeIter& rIter, OUString);
// for weld::WaitObject which seems not to always behave as expected without the
// dialog window as a parent
MacroManagerDialog* m_pMacroManagerDialog;
public:
ScriptContainersListBox(std::unique_ptr<weld::TreeView> xTreeView,
MacroManagerDialog* pMacroManagerDialog);
~ScriptContainersListBox();
void connect_changed(const Link<weld::TreeView&, void>& rLink)
{
m_xTreeView->connect_changed(rLink);
}
void set_size_request(int nWidth, int nHeight)
{
m_xTreeView->set_size_request(nWidth, nHeight);
}
weld::TreeView& get_widget() { return *m_xTreeView; }
void ClearAll();
void Init(const css::uno::Reference<css::uno::XComponentContext>& xContext,
const css::uno::Reference<css::frame::XFrame>& xFrame);
void SetScriptsListBox(ScriptsListBox* pBox) { m_pScriptsListBox = pBox; }
void ScriptContainerSelected();
void Insert(const css::uno::Reference<css::script::browse::XBrowseNode>& xInsertNode,
const weld::TreeIter* pParentEntry, const OUString& rsUiName,
const OUString& rsImage, bool bChildOnDemand = false, int nPos = -1,
weld::TreeIter* pRet = nullptr);
OUString GetContainerName(const weld::TreeIter& rIter,
const ScriptContainerType eScriptContainerType);
OUString GetSelectedEntryContainerName(ScriptContainerType eScriptContainerType);
};
enum class InputDialogMode;
class MacroManagerDialog : public weld::GenericDialogController, public SfxListener
{
OUString m_aScriptsListBoxLabelBaseStr;
// For forwarding to Assign dialog
css::uno::Reference<css::frame::XFrame> m_xDocumentFrame;
std::unique_ptr<weld::Label> m_xDialogDescription;
std::unique_ptr<ScriptContainersListBox> m_xScriptContainersListBox;
std::unique_ptr<ScriptsListBox> m_xScriptsListBox;
std::unique_ptr<weld::Label> m_xScriptContainersListBoxLabel;
std::unique_ptr<weld::Label> m_xScriptsListBoxLabel;
std::unique_ptr<weld::Button> m_xRunButton;
std::unique_ptr<weld::Button> m_xCloseButton;
std::unique_ptr<weld::TextView> m_xDescriptionText;
std::unique_ptr<weld::Frame> m_xDescriptionFrame;
std::unique_ptr<weld::Button> m_xNewLibraryButton;
std::unique_ptr<weld::Button> m_xNewModuleButton;
std::unique_ptr<weld::Button> m_xNewDialogButton;
std::unique_ptr<weld::Button> m_xLibraryModuleDialogEditButton;
std::unique_ptr<weld::Button> m_xLibraryModuleDialogRenameButton;
std::unique_ptr<weld::Button> m_xLibraryModuleDialogDeleteButton;
std::unique_ptr<weld::Button> m_xLibraryPasswordButton;
std::unique_ptr<weld::Button> m_xLibraryImportButton;
std::unique_ptr<weld::Button> m_xLibraryExportButton;
std::unique_ptr<weld::Button> m_xMacroEditButton;
std::unique_ptr<weld::Button> m_xMacroDeleteButton;
std::unique_ptr<weld::Button> m_xMacroCreateButton;
std::unique_ptr<weld::Button> m_xMacroRenameButton;
std::unique_ptr<weld::Button> m_xAssignButton;
DECL_LINK(ClickHdl, weld::Button&, void);
DECL_LINK(SelectHdl, weld::TreeView&, void);
DECL_LINK(FunctionDoubleClickHdl, weld::TreeView&, bool);
DECL_LINK(ContextMenuHdl, const CommandEvent&, bool);
DECL_LINK(CheckPasswordHdl, SvxPasswordDialog*, bool);
void BasicScriptsCreateLibrary(const basctl::ScriptDocument& rDocument);
void BasicScriptsCreateModule(const basctl::ScriptDocument& rDocument);
void BasicScriptsCreateDialog(const basctl::ScriptDocument& rDocument);
void BasicScriptsLibraryModuleDialogEdit(const basctl::ScriptDocument& rDocument);
void BasicScriptsLibraryModuleDialogRename(const basctl::ScriptDocument& rDocument);
void BasicScriptsLibraryModuleDialogDelete(const basctl::ScriptDocument& rDocument);
void BasicScriptsLibraryPassword(const basctl::ScriptDocument& rDocument);
void BasicScriptsMacroEdit(const basctl::ScriptDocument& rDocument);
bool IsLibraryReadOnlyOrFailedPasswordQuery(const basctl::ScriptDocument& rDocument,
weld::TreeIter* pIter);
void ScriptingFrameworkScriptsCreateEntry(InputDialogMode eInputDialogMode);
void ScriptingFrameworkScriptsRenameEntry(weld::TreeView& rTreeView,
const weld::TreeIter& rEntry);
void ScriptingFrameworkScriptsDeleteEntry(weld::TreeView& rTreeView,
const weld::TreeIter& rEntry);
static bool getBoolProperty(css::uno::Reference<css::beans::XPropertySet> const& xProps,
OUString const& propName);
OUString getListOfChildren(const css::uno::Reference<css::script::browse::XBrowseNode>& node,
int depth);
css::uno::Reference<css::script::browse::XBrowseNode>
getBrowseNode(const weld::TreeView& rTreeView, const weld::TreeIter& rTreeIter);
void UpdateUI();
void CheckButtons();
virtual void Notify(SfxBroadcaster&, const SfxHint& rHint) override;
public:
MacroManagerDialog(weld::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& xFrame);
virtual ~MacroManagerDialog() override;
OUString GetScriptURL() const;
void SaveLastUsedMacro();
void LoadLastUsedMacro();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */

View file

@ -195,11 +195,6 @@ class CuiConfigGroupListBox
std::unique_ptr<weld::TreeView> m_xTreeView;
std::unique_ptr<weld::TreeIter> m_xScratchIter;
static OUString GetImage(
const css::uno::Reference< css::script::browse::XBrowseNode >& node,
css::uno::Reference< css::uno::XComponentContext > const & xCtx,
bool bIsRootNode);
static css::uno::Reference< css::uno::XInterface > getDocumentModel(
css::uno::Reference< css::uno::XComponentContext > const & xCtx,
std::u16string_view docName);
@ -232,6 +227,11 @@ public:
void SelectMacro(const SfxMacroInfoItem*);
#endif
void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
static OUString GetImage(
const css::uno::Reference< css::script::browse::XBrowseNode >& node,
css::uno::Reference< css::uno::XComponentContext > const & xCtx,
bool bIsRootNode);
};
class SvxScriptSelectorDialog : public weld::GenericDialogController

View file

@ -0,0 +1,564 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface domain="cui">
<requires lib="gtk+" version="3.20"/>
<object class="GtkTreeStore" id="liststore1">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkTreeStore" id="liststore2">
<columns>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkDialog" id="MacroManagerDialog">
<property name="can-focus">False</property>
<property name="border-width">6</property>
<property name="title" translatable="yes" context="macromanagerdialog|MacroManagerDialog">Macro Manager</property>
<property name="modal">True</property>
<property name="default-width">0</property>
<property name="default-height">0</property>
<property name="type-hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<object class="GtkButton" id="close">
<property name="label" translatable="yes" context="stock">Close</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="no-show-all">True</property>
<property name="use-underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="help">
<property name="label" translatable="yes" context="stock">_Help</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="use-underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack-type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="spacing">6</property>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView" id="scriptcontainers">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="has-tooltip">True</property>
<property name="model">liststore1</property>
<property name="headers-visible">False</property>
<property name="search-column">1</property>
<property name="enable-tree-lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<property name="spacing">6</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext4"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="layout-style">start</property>
<child>
<object class="GtkButton" id="newlibrary">
<property name="label" translatable="yes" context="macromanagerdialog|newlibrary">New Library...</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="newlibrary-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="macromanagerdialog|extended_tip|newlibrary">Creates a new library.</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="newmodule">
<property name="label" translatable="yes" context="macromanagerdialog|newmodule">New Module...</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="newdialog">
<property name="label" translatable="yes" context="macromanagerdialog|newdialog">New Dialog...</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="librarymoduledialogedit">
<property name="label" translatable="yes" context="macromanagerdialog|librarymoduledialogedit">Edit</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="librarymoduledialogrename">
<property name="label" translatable="yes" context="macromanagerdialog|librarymoduledialogrename">Rename...</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="librarymoduledialogdelete">
<property name="label" translatable="yes" context="macromanagerdialog|librarymoduledialogdelete">Delete...</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkButton" id="librarypassword">
<property name="label" translatable="yes" context="macromanagerdialog|librarypassword">Password...</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="librarypassword-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="macromanagerdialog|extended_tip|librarypassword">Assigns or edits the password for the selected library.</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
</packing>
</child>
<child>
<object class="GtkButton" id="libraryimport">
<property name="label" translatable="yes" context="macromanagerdialog|libraryimport">Import...</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="libraryimport-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="macromanagerdialog|extended_tip|libraryimport">Locate the Basic library that you want to add to the current list, and then click Open.</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
<child>
<object class="GtkButton" id="libraryexport">
<property name="label" translatable="yes" context="macromanagerdialog|libraryexport">Export...</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">8</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="scriptcontainerlistboxlabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-bottom">6</property>
<property name="label" translatable="yes" context="macromanagerdialog|scriptcontainerlistboxlabel">Libraries/Modules/Dialogs</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView" id="scripts">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="model">liststore2</property>
<property name="headers-visible">False</property>
<property name="search-column">0</property>
<property name="show-expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="layout-style">start</property>
<child>
<object class="GtkButton" id="run">
<property name="label" translatable="yes" context="macromanagerdialog|run">Run</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="assign">
<property name="label" translatable="yes" context="macromanagerdialog|assign">Assign...</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="macrocreate">
<property name="label" translatable="yes" context="macromanagerdialog|macrocreate">Create...</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="macroedit">
<property name="label" translatable="yes" context="macromanagerdialog|macroedit">Edit</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="macrorename">
<property name="label" translatable="yes" context="macromanagerdialog|macrorename">Rename...</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="macrodelete">
<property name="label" translatable="yes" context="macromanagerdialog|macrodelete">Delete...</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="scriptslistboxlabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-bottom">6</property>
<property name="label" translatable="yes" context="macromanagerdialog|scriptslistboxlabel">Existing macros in:</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="descriptionframe">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="height-request">100</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<child>
<object class="GtkTextView" id="description">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="editable">False</property>
<property name="wrap-mode">word</property>
<property name="cursor-visible">False</property>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-bottom">6</property>
<property name="label" translatable="yes" context="macromanagerdialog|label1">_Description</property>
<property name="use-underline">True</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">close</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
</object>
</interface>

View file

@ -120,6 +120,8 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -75,6 +75,8 @@
<menu:menupopup>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -58,6 +58,8 @@
<menu:menupopup>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -59,6 +59,8 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -84,6 +84,8 @@
<menu:menupopup>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -32,6 +32,8 @@
<menu:menupopup>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -45,6 +45,8 @@
<menu:menupopup>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>
<menu:menuitem menu:id=".uno:ScriptOrganizer"/>

View file

@ -0,0 +1,23 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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/.
*/
#pragma once
#include <sal/config.h>
#include <sal/types.h>
#if defined BASCTL_DLLIMPLEMENTATION
#define BASCTL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
#else
#define BASCTL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
#endif
#define BASCTL_DLLPRIVATE SAL_DLLPRIVATE
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */

View file

@ -0,0 +1,43 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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/.
*/
#pragma once
#include <sal/config.h>
#include "basctldllapi.h"
#include "scriptdocument.hxx"
#include <sfx2/dispatch.hxx>
#include <vcl/weld.hxx>
namespace basctl
{
BASCTL_DLLPUBLIC bool IsValidSbxName(std::u16string_view rName);
BASCTL_DLLPUBLIC SAL_RET_MAYBENULL SfxDispatcher* GetDispatcher();
BASCTL_DLLPUBLIC void MarkDocumentModified(const ScriptDocument& rDocument);
BASCTL_DLLPUBLIC bool QueryDelDialog(std::u16string_view rName, weld::Widget* pParent);
BASCTL_DLLPUBLIC bool QueryDelModule(std::u16string_view rName, weld::Widget* pParent);
BASCTL_DLLPUBLIC bool QueryDelLib(std::u16string_view rName, bool bRef, weld::Widget* pParent);
BASCTL_DLLPUBLIC bool
QueryPassword(weld::Widget* pDialogParent,
const css::uno::Reference<css::script::XLibraryContainer>& xLibContainer,
const OUString& rLibName, OUString& rPassword, bool bRepeat = false,
bool bNewTitle = false);
BASCTL_DLLPUBLIC void ImportLib(const ScriptDocument& rDocument, weld::Dialog* pDialog,
const std::function<void(OUString& rLibName)>& func_remove_entry,
const std::function<void(OUString& rLibName)>& func_insert_entry,
const std::function<void()>& func_insert_entries);
BASCTL_DLLPUBLIC void Export(const ScriptDocument& rDocument, const OUString& aLibName,
weld::Dialog* pDialog);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */

View file

@ -18,6 +18,7 @@
*/
#pragma once
#include "basctldllapi.h"
#include "scriptdocument.hxx"
#include <svl/poolitem.hxx>
@ -34,7 +35,7 @@ enum SbxItemType
SBX_TYPE_METHOD
};
class SbxItem : public SfxPoolItem
class BASCTL_DLLPUBLIC SbxItem : public SfxPoolItem
{
const ScriptDocument m_aDocument;
const OUString m_aLibName;

View file

@ -19,6 +19,8 @@
#pragma once
#include "basctldllapi.h"
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
@ -61,7 +63,7 @@ namespace basctl
/** encapsulates a document which contains Basic scripts and dialogs
*/
class ScriptDocument
class BASCTL_DLLPUBLIC ScriptDocument
{
private:
class Impl;

View file

@ -36,6 +36,7 @@ class SFX2_DLLPUBLIC SfxMacroInfoItem final : public SfxPoolItem
OUString aModuleName;
OUString aMethodName;
OUString aCommentText;
OUString aLocationName;
public:
static SfxPoolItem* CreateDefault();
@ -44,7 +45,8 @@ public:
OUString aLibName,
OUString aModuleName,
OUString aMethodName,
OUString aComment);
OUString aComment,
OUString aLocation = OUString());
virtual SfxMacroInfoItem* Clone( SfxItemPool *pPool = nullptr ) const override;
virtual bool operator==( const SfxPoolItem& ) const override;
@ -63,6 +65,7 @@ public:
const BasicManager* GetBasicManager() const
{ return pBasicManager; }
OUString GetQualifiedName() const;
const OUString& GetLocation() const { return aLocationName; }
};
#endif

View file

@ -112,6 +112,16 @@ public:
virtual void SetRunLabel() = 0;
};
class AbstractMacroManagerDialog : virtual public VclAbstractDialog
{
protected:
virtual ~AbstractMacroManagerDialog() override = default;
public:
virtual OUString GetScriptURL() const = 0;
virtual void LoadLastUsedMacro() const = 0;
};
namespace com::sun::star::frame { class XFrame; }
class SFX2_DLLPUBLIC SfxAbstractDialogFactory : virtual public VclAbstractDialogFactory
@ -140,6 +150,11 @@ public:
virtual VclPtr<AbstractScriptSelectorDialog> CreateScriptSelectorDialog(weld::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& rxFrame) = 0;
virtual VclPtr<AbstractMacroManagerDialog>
CreateMacroManagerDialog(weld::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame)
= 0;
virtual void ShowAsyncScriptErrorDialog( weld::Window* pParent, const css::uno::Any& rException ) = 0;
virtual VclPtr<VclAbstractDialog> CreateOptionsDialog(

View file

@ -300,6 +300,7 @@ class SvxZoomItem;
#define SID_OPTIONS_PAGEID TypedWhichId<SfxUInt16Item>(SID_SFX_START + 1747)
#define SID_GPGSIGN TypedWhichId<SfxBoolItem>(SID_SFX_START + 1748)
#define FN_INVERT_BACKGROUND (SID_SFX_START + 1749)
#define SID_MACROMANAGER (SID_SFX_START + 1750)
// SID_SFX_free_END (SID_SFX_START + 3999)
#define SID_OPEN_NEW_VIEW TypedWhichId<SfxBoolItem>(SID_SFX_START + 520)

View file

@ -84,6 +84,8 @@ enum class SfxHintId {
// basctl
BasCtlDlgEd,
ScriptDocumentChanged,
// reportdesign
ReportDesignDlgEd,
@ -266,6 +268,7 @@ inline std::basic_ostream<charT, traits> & operator <<(
case SfxHintId::BasicInfoWanted: return stream << "BasicInfoWanted";
case SfxHintId::BasicStart: return stream << "BasicStart";
case SfxHintId::BasicStop: return stream << "BasicStop";
case SfxHintId::ScriptDocumentChanged: return stream << "ScriptDocumentChanged";
case SfxHintId::FmDesignModeChanged: return stream << "FmDesignModeChanged";
case SfxHintId::EditSourceParasMoved: return stream << "EditSourceParasMoved";
case SfxHintId::EditSourceSelectionChanged: return stream << "EditSourceSelectionChanged";

View file

@ -23,7 +23,7 @@
#include <sfx2/basedlgs.hxx>
#include <svx/svxdllapi.h>
class UNLESS_MERGELIBS(SVX_DLLPUBLIC) SvxPasswordDialog final : public SfxDialogController
class UNLESS_MERGELIBS_MORE(SVX_DLLPUBLIC) SvxPasswordDialog final : public SfxDialogController
{
private:
OUString m_aOldPasswdErrStr;

View file

@ -430,6 +430,9 @@ public:
virtual VclPtr<AbstractScriptSelectorDialog> CreateScriptSelectorDialog(weld::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& rxFrame) override = 0;
virtual VclPtr<AbstractMacroManagerDialog> CreateMacroManagerDialog(weld::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& rxFrame) override = 0;
virtual void ShowAsyncScriptErrorDialog(weld::Window* pParent, const css::uno::Any& rException) override = 0;
virtual VclPtr<VclAbstractDialog> CreateSvxMacroAssignDlg(

View file

@ -5531,6 +5531,17 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
<value>1</value>
</prop>
</node>
<node oor:name=".uno:MacroManager" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Macro Manager...</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
<prop oor:name="IsExperimental" oor:type="xs:boolean">
<value>true</value>
</prop>
</node>
<node oor:name=".uno:Gallery" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Gallery</value>

View file

@ -249,6 +249,8 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu" >
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -720,6 +720,8 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -595,6 +595,8 @@
</menu:menu>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -637,6 +637,8 @@
</menu:menu>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -289,6 +289,11 @@ shell SfxApplication
[
ExecMethod = OfaExec_Impl;
]
SID_MACROMANAGER
[
ExecMethod = OfaExec_Impl;
StateMethod = OfaState_Impl;
]
SID_INET_DLG // status(final)
[
ExecMethod = OfaExec_Impl;

View file

@ -2427,6 +2427,23 @@ SfxVoidItem RunMacro SID_RUNMACRO
GroupId = SfxGroupId::Macro;
]
SfxVoidItem MacroManager SID_MACROMANAGER
()
[
AutoUpdate = FALSE,
FastCall = TRUE,
ReadOnlyDoc = TRUE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
AccelConfig = TRUE,
MenuConfig = TRUE,
ToolBoxConfig = TRUE,
GroupId = SfxGroupId::Macro;
]
SfxVoidItem GotoLine SID_GOTOLINE
[

View file

@ -1894,6 +1894,56 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
rReq.Done();
}
break;
case SID_MACROMANAGER:
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
Reference<XFrame> xFrame(GetRequestFrame(rReq));
if (!xFrame.is())
{
if (const SfxViewFrame* pViewFrame = SfxViewFrame::Current())
xFrame = pViewFrame->GetFrame().GetFrameInterface();
}
VclPtr<AbstractMacroManagerDialog> pDlg(
pFact->CreateMacroManagerDialog(lcl_getDialogParent(xFrame), xFrame));
OSL_ENSURE(pDlg, "SfxApplication::OfaExec_Impl(SID_MACROMANAGER): no dialog!");
if (pDlg)
{
pDlg->StartExecuteAsync(
[pDlg, xFrame](sal_Int32 nDialogResult)
{
if (!nDialogResult)
{
pDlg->disposeOnce();
return;
}
Sequence<Any> args;
Sequence<sal_Int16> outIndex;
Sequence<Any> outArgs;
Any ret;
Reference<XInterface> xScriptContext;
Reference<XController> xController;
if (xFrame.is())
xController = xFrame->getController();
if (xController.is())
xScriptContext = xController->getModel();
if (!xScriptContext.is())
xScriptContext = xController;
SfxObjectShell::CallXScript(xScriptContext, pDlg->GetScriptURL(), args, ret,
outIndex, outArgs);
pDlg->disposeOnce();
});
pDlg->LoadLastUsedMacro();
}
rReq.Done();
}
break;
#endif // HAVE_FEATURE_SCRIPTING
case SID_OFFICE_CHECK_PLZ:
@ -2015,6 +2065,7 @@ void SfxApplication::OfaState_Impl(SfxItemSet &rSet)
rSet.DisableItem(SID_MACROORGANIZER);
rSet.DisableItem(SID_SCRIPTORGANIZER);
rSet.DisableItem(SID_BASICIDE_APPEAR);
rSet.DisableItem(SID_MACROMANAGER);
}
}

View file

@ -33,13 +33,15 @@ SfxMacroInfoItem::SfxMacroInfoItem(
OUString _aLibName,
OUString _aModuleName,
OUString _aMethodName,
OUString _aComment) :
OUString _aComment,
OUString _aLocationName) :
SfxPoolItem(nWhichId, SfxItemType::SfxMacroInfoItemType),
pBasicManager(pMgr),
aLibName(std::move(_aLibName)),
aModuleName(std::move(_aModuleName)),
aMethodName(std::move(_aMethodName)),
aCommentText(std::move(_aComment))
aCommentText(std::move(_aComment)),
aLocationName(std::move(_aLocationName))
{
}

View file

@ -237,8 +237,6 @@ basctl/source/inc/docsignature.hxx
basctl/source/inc/localizationmgr.hxx
basctl/source/inc/managelang.hxx
basctl/source/inc/propbrw.hxx
basctl/source/inc/sbxitem.hxx
basctl/source/inc/scriptdocument.hxx
basegfx/source/color/bcolormodifier.cxx
basegfx/source/color/bcolortools.cxx
basegfx/source/curve/b2dbeziertools.cxx
@ -4740,6 +4738,8 @@ include/avmedia/mediaitem.hxx
include/avmedia/mediaplayer.hxx
include/avmedia/mediatoolbox.hxx
include/avmedia/mediawindow.hxx
include/basctl/sbxitem.hxx
include/basctl/scriptdocument.hxx
include/basegfx/color/bcolor.hxx
include/basegfx/color/bcolormodifier.hxx
include/basegfx/curve/b2dbeziertools.hxx

View file

@ -129,6 +129,8 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -760,6 +760,8 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -624,6 +624,8 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -704,6 +704,8 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -658,6 +658,8 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -802,6 +802,8 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>

View file

@ -750,6 +750,8 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:MacroManager"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:MacroRecorder"/>
<menu:menuitem menu:id=".uno:RunMacro"/>
<menu:menuitem menu:id=".uno:BasicIDEAppear"/>