summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2016-11-06 01:19:01 +0300
committerCaolán McNamara <caolanm@redhat.com>2016-11-14 08:56:42 +0000
commit450762b224d62ded0c55144fee0796085dd4def3 (patch)
tree29ff18f83485fe8d0c3ad3f70f70f02b6c071a01 /basctl
parent6b35488c723e2f2266f7e377ad53a82af7b6fede (diff)
tdf#68118: Pass current document frame to SvxScriptSelectorDialog
... through MacroChooser Without this, current document's macros library is unavailable in "Assign" dialog Change-Id: I83baa3b98858260eab61e8f4fefde3f9979c6d83 Reviewed-on: https://gerrit.libreoffice.org/30600 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/basobj2.cxx11
-rw-r--r--basctl/source/basicide/macrodlg.cxx10
-rw-r--r--basctl/source/basicide/macrodlg.hxx9
-rw-r--r--basctl/source/inc/basobj.hxx6
4 files changed, 27 insertions, 9 deletions
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index b88a89f3b348..0d8b7d23e71f 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -42,11 +42,12 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
extern "C" {
- SAL_DLLPUBLIC_EXPORT rtl_uString* basicide_choose_macro( void* pOnlyInDocument_AsXModel, sal_Bool bChooseOnly, rtl_uString* pMacroDesc )
+ SAL_DLLPUBLIC_EXPORT rtl_uString* basicide_choose_macro( void* pOnlyInDocument_AsXModel, void* pDocFrame_AsXFrame, sal_Bool bChooseOnly, rtl_uString* pMacroDesc )
{
OUString aMacroDesc( pMacroDesc );
Reference< frame::XModel > aDocument( static_cast< frame::XModel* >( pOnlyInDocument_AsXModel ) );
- OUString aScriptURL = basctl::ChooseMacro( aDocument, bChooseOnly, aMacroDesc );
+ Reference< frame::XFrame > aDocFrame( static_cast< frame::XFrame* >( pDocFrame_AsXFrame ) );
+ OUString aScriptURL = basctl::ChooseMacro( aDocument, aDocFrame, bChooseOnly, aMacroDesc );
rtl_uString* pScriptURL = aScriptURL.pData;
rtl_uString_acquire( pScriptURL );
@@ -231,7 +232,9 @@ namespace
}
}
-OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument, bool bChooseOnly, const OUString& rMacroDesc )
+OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument,
+ const uno::Reference< frame::XFrame >& xDocFrame,
+ bool bChooseOnly, const OUString& rMacroDesc )
{
(void)rMacroDesc;
@@ -242,7 +245,7 @@ OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument,
OUString aScriptURL;
SbMethod* pMethod = nullptr;
- ScopedVclPtrInstance< MacroChooser > pChooser( nullptr, true );
+ ScopedVclPtrInstance< MacroChooser > pChooser( nullptr, xDocFrame, true );
if ( bChooseOnly || !SvtModuleOptions::IsBasicIDE() )
pChooser->SetMode(MacroChooser::ChooseOnly);
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index dcbccac9efcd..84273aed8cf4 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -46,8 +46,9 @@ using ::std::map;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-MacroChooser::MacroChooser( vcl::Window* pParnt, bool bCreateEntries )
+MacroChooser::MacroChooser( vcl::Window* pParnt, const Reference< frame::XFrame >& xDocFrame, bool bCreateEntries )
: SfxModalDialog(pParnt, "BasicMacroDialog", "modules/BasicIDE/ui/basicmacrodialog.ui")
+ , m_xDocumentFrame(xDocFrame)
, bNewDelIsDel(true)
// the Sfx doesn't ask the BasicManager whether modified or not
// => start saving in case of a change without a into the BasicIDE.
@@ -735,7 +736,12 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton, void )
OUString aComment( GetInfo( pMethod ) );
SfxMacroInfoItem aItem( SID_MACROINFO, pBasMgr, aLib, aMod, aSub, aComment );
SfxAllItemSet Args( SfxGetpApp()->GetPool() );
- SfxRequest aRequest( SID_CONFIG, SfxCallMode::SYNCHRON, Args );
+
+ SfxAllItemSet aInternalSet(SfxGetpApp()->GetPool());
+ if (m_xDocumentFrame.is())
+ aInternalSet.Put(SfxUnoFrameItem(SID_FILLFRAME, m_xDocumentFrame));
+
+ SfxRequest aRequest(SID_CONFIG, SfxCallMode::SYNCHRON, Args, aInternalSet);
aRequest.AppendItem( aItem );
SfxGetpApp()->ExecuteSlot( aRequest );
}
diff --git a/basctl/source/basicide/macrodlg.hxx b/basctl/source/basicide/macrodlg.hxx
index 052aa52edcaa..ea767af5f700 100644
--- a/basctl/source/basicide/macrodlg.hxx
+++ b/basctl/source/basicide/macrodlg.hxx
@@ -23,6 +23,8 @@
#include <bastype2.hxx>
#include <sfx2/basedlgs.hxx>
+#include "com/sun/star/frame/XFrame.hpp"
+
#include <vcl/button.hxx>
namespace basctl
@@ -50,7 +52,7 @@ private:
VclPtr<FixedText> m_pMacrosSaveInTxt;
VclPtr<TreeListBox> m_pBasicBox;
VclPtr<FixedText> m_pMacrosInTxt;
- OUString m_aMacrosInTxtBaseStr;
+ OUString m_aMacrosInTxtBaseStr;
VclPtr<SvTreeListBox> m_pMacroBox;
VclPtr<PushButton> m_pRunButton;
@@ -62,6 +64,9 @@ private:
VclPtr<PushButton> m_pNewLibButton;
VclPtr<PushButton> m_pNewModButton;
+ // For forwarding to Assign dialog
+ ::css::uno::Reference< ::css::frame::XFrame > m_xDocumentFrame;
+
bool bNewDelIsDel;
bool bForceStoreBasic;
@@ -85,7 +90,7 @@ private:
void RestoreMacroDescription();
public:
- MacroChooser( vcl::Window* pParent, bool bCreateEntries = true );
+ MacroChooser( vcl::Window* pParent, const ::css::uno::Reference< ::css::frame::XFrame >& xDocFrame, bool bCreateEntries = true );
virtual ~MacroChooser() override;
virtual void dispose() override;
diff --git a/basctl/source/inc/basobj.hxx b/basctl/source/inc/basobj.hxx
index 295cd96bf3a7..1dd039d4ce81 100644
--- a/basctl/source/inc/basobj.hxx
+++ b/basctl/source/inc/basobj.hxx
@@ -74,8 +74,12 @@ namespace basctl
// new methods for macros
OUString ChooseMacro(
- const css::uno::Reference< css::frame::XModel >& rxLimitToDocument,
+ const css::uno::Reference< css::frame::XModel >& rxLimitToDocument, const css::uno::Reference< css::frame::XFrame >& xDocFrame,
bool bChooseOnly, const OUString& rMacroDesc );
+ inline OUString ChooseMacro(
+ const css::uno::Reference< css::frame::XModel >& rxLimitToDocument,
+ bool bChooseOnly, const OUString& rMacroDesc )
+ { return ChooseMacro(rxLimitToDocument, css::uno::Reference< css::frame::XFrame >(), bChooseOnly, rMacroDesc); }
css::uno::Sequence< OUString > GetMethodNames(
const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName )