basctl/source/basicide/basobj2.cxx | 11 +++++++---- basctl/source/basicide/macrodlg.cxx | 10 ++++++++-- basctl/source/basicide/macrodlg.hxx | 9 +++++++-- basctl/source/inc/basobj.hxx | 6 +++++- compilerplugins/clang/unusedmethods.py | 2 +- include/sfx2/request.hxx | 1 + sfx2/source/appl/appserv.cxx | 16 +++++++++++----- sfx2/source/control/request.cxx | 12 ++++++++++++ 8 files changed, 52 insertions(+), 15 deletions(-)
New commits: commit 450762b224d62ded0c55144fee0796085dd4def3 Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Sun Nov 6 01:19:01 2016 +0300 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 <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index b88a89f..0d8b7d2 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 dcbccac..84273ae 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 052aa52..ea767af 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 295cd96..1dd039d 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 ) diff --git a/compilerplugins/clang/unusedmethods.py b/compilerplugins/clang/unusedmethods.py index 1e2a674..1f6c2bc 100755 --- a/compilerplugins/clang/unusedmethods.py +++ b/compilerplugins/clang/unusedmethods.py @@ -68,7 +68,7 @@ unusedMethodsExclusionSet = set([ # loaded by dlopen() "void * getStandardAccessibleFactory()", "void * getSvtAccessibilityComponentFactory()", - "struct _rtl_uString * basicide_choose_macro(void *,unsigned char,struct _rtl_uString *)", + "struct _rtl_uString * basicide_choose_macro(void *,void *,unsigned char,struct _rtl_uString *)", "void basicide_macro_organizer(short)", "long basicide_handle_basic_error(void *)", "class com::sun::star::uno::XInterface * org_libreoffice_chart2_Chart2ToolboxController(class com::sun::star::uno::XComponentContext *,const class com::sun::star::uno::Sequence<class com::sun::star::uno::Any> &)", diff --git a/include/sfx2/request.hxx b/include/sfx2/request.hxx index 1ebc08b..a30d3ab 100644 --- a/include/sfx2/request.hxx +++ b/include/sfx2/request.hxx @@ -62,6 +62,7 @@ public: SfxRequest( const SfxSlot* pSlot, const css::uno::Sequence < css::beans::PropertyValue >& rArgs, SfxCallMode nCallMode, SfxItemPool &rPool ); SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs ); + SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs, const SfxAllItemSet& rSfxInternalArgs ); SfxRequest( const SfxRequest& rOrig ); virtual ~SfxRequest() override; diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 7345027..e804007 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1190,17 +1190,17 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) #ifndef DISABLE_DYNLOADING -typedef rtl_uString* (SAL_CALL *basicide_choose_macro)(void*, sal_Bool, rtl_uString*); +typedef rtl_uString* (SAL_CALL *basicide_choose_macro)(void*, void*, sal_Bool, rtl_uString*); extern "C" { static void SAL_CALL thisModule() {} } #else -extern "C" rtl_uString* basicide_choose_macro(void*, sal_Bool, rtl_uString*); +extern "C" rtl_uString* basicide_choose_macro(void*, void*, sal_Bool, rtl_uString*); #endif -OUString ChooseMacro( const Reference< XModel >& rxLimitToDocument, bool bChooseOnly ) +OUString ChooseMacro( const Reference< XModel >& rxLimitToDocument, const Reference< XFrame >& xDocFrame, bool bChooseOnly ) { #ifndef DISABLE_DYNLOADING osl::Module aMod; @@ -1220,7 +1220,7 @@ OUString ChooseMacro( const Reference< XModel >& rxLimitToDocument, bool bChoose // call basicide_choose_macro in basctl OUString rMacroDesc; - rtl_uString* pScriptURL = pSymbol( rxLimitToDocument.get(), bChooseOnly, rMacroDesc.pData ); + rtl_uString* pScriptURL = pSymbol( rxLimitToDocument.get(), xDocFrame.get(), bChooseOnly, rMacroDesc.pData ); OUString aScriptURL( pScriptURL ); rtl_uString_release( pScriptURL ); return aScriptURL; @@ -1469,7 +1469,13 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) } } - rReq.SetReturnValue( SfxStringItem( rReq.GetSlot(), ChooseMacro( xLimitToModel, bChooseOnly ) ) ); + Reference< XFrame > xFrame; + const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl(); + const SfxUnoFrameItem* pFrameItem = SfxItemSet::GetItem<SfxUnoFrameItem>(pIntSet, SID_FILLFRAME, false); + if (pFrameItem) + xFrame = pFrameItem->GetFrame(); + + rReq.SetReturnValue(SfxStringItem(rReq.GetSlot(), ChooseMacro(xLimitToModel, xFrame, bChooseOnly))); rReq.Done(); } break; diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index 2cadc79..2c8f1ea 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -267,6 +267,18 @@ SfxRequest::SfxRequest } +SfxRequest::SfxRequest +( + sal_uInt16 nSlotId, + SfxCallMode nMode, + const SfxAllItemSet& rSfxArgs, + const SfxAllItemSet& rSfxInternalArgs +) +: SfxRequest(nSlotId, nMode, rSfxArgs) +{ + SetInternalArgs_Impl(rSfxInternalArgs); +} + SfxCallMode SfxRequest::GetCallMode() const { return pImpl->nCallMode;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits