23#include <osl/diagnose.h>
27#include <svx/svxids.hrc>
34using ::com::sun::star::uno::Reference;
35using ::com::sun::star::frame::XFrame;
61 SID_ATTR_MACROITEM, SID_ATTR_MACROITEM,
91 mpImpl->m_xDeletePB->set_sensitive(
nullptr != pM);
93 OUString sEventMacro = rTreeView.
get_text(nSelected, 1);
95 OUString sScriptURI =
mpImpl->m_xMacroLB->GetSelectedScriptURI();
96 mpImpl->m_xAssignPB->set_sensitive(!sScriptURI.equalsIgnoreAsciiCase(sEventMacro));
99 mpImpl->m_xAssignPB->set_sensitive(
false);
103 :
SfxTabPage(pPage, pController,
"cui/ui/eventassignpage.ui",
"EventAssignPage", &rAttrSet)
108 mpImpl->m_aFillGroupIdle.SetPriority( TaskPriority::HIGHEST );
111 mpImpl->m_xAssignPB = m_xBuilder->weld_button(
"assign");
112 mpImpl->m_xDeletePB = m_xBuilder->weld_button(
"delete");
113 mpImpl->m_xGroupFrame = m_xBuilder->weld_widget(
"groupframe");
115 mpImpl->m_xMacroFrame = m_xBuilder->weld_frame(
"macroframe");
116 mpImpl->m_aStaticMacroLBLabel =
mpImpl->m_xMacroFrame->get_label();
134 rTreeView.
append(OUString::number(
static_cast<sal_Int32
>(nEventId)), rEventName);
148 mpImpl->m_xGroupFrame->show();
149 mpImpl->m_xMacroFrame->show();
161 if (eState == SfxItemState::DEFAULT &&
aTbl.
empty())
166 if (SfxItemState::SET != eState || aItem != *
static_cast<const SvxMacroItem*
>(pItem))
176 if (!
mpImpl->m_aFillGroupIdle.IsActive() )
177 mpImpl->m_aFillGroupIdle.Start();
187 if(
mpImpl->m_bGotEvents )
191 mpImpl->m_bGotEvents =
true;
193 for (
size_t nNo = 0, nCnt = rList.
size(); nNo < nCnt; ++nNo )
210 mpImpl->m_bGotEvents =
true;
212 for (
size_t nNo = 0, nCnt = rList.
size(); nNo < nCnt; ++nNo )
222 std::unique_ptr<weld::TreeIter> xIter(rListBox.
make_iterator());
241 DBG_ASSERT(nSelected != -1,
"Where does the empty entry come from?");
251 mpImpl->m_xGroupLB->GroupSelected();
252 const OUString sScriptURI = mpImpl->m_xMacroLB->GetSelectedScriptURI();
254 if( !sScriptURI.isEmpty() )
255 aLabelText = mpImpl->m_aStaticMacroLBLabel;
256 mpImpl->m_xMacroFrame->set_label( aLabelText );
268 AssignDeleteHdl(&rBtn);
273 AssignDeleteHdl(&rBtn);
283 DBG_ASSERT(nSelected != -1,
"Where does the empty entry come from?");
287 const bool bAssEnabled = pBtn !=
mpImpl->m_xDeletePB.get() &&
mpImpl->m_xAssignPB->get_sensitive();
296 sScriptURI =
mpImpl->m_xMacroLB->GetSelectedScriptURI();
297 if( sScriptURI.startsWith(
"vnd.sun.star.script:" ) )
304 OSL_ENSURE(
false,
"SfxMacroTabPage::AssignDeleteHdl_Impl: this branch is *not* dead? (out of interest: tell fs, please!)" );
310 rListBox.
set_text(nSelected, sScriptURI, 1);
320 std::unique_ptr<weld::WaitObject> xWait(pDialog ?
new weld::WaitObject(pDialog) :
nullptr);
330 mpImpl->m_xMacroLB->connect_row_activated( aLnk);
339 std::vector<int> aWidths
345 mpImpl->m_xEventLB->show();
347 mpImpl->m_xEventLB->set_sensitive(
true);
348 mpImpl->m_xGroupLB->set_sensitive(
true);
349 mpImpl->m_xMacroLB->set_sensitive(
true);
351 mpImpl->m_xGroupLB->SetFunctionListBox(
mpImpl->m_xMacroLB.get());
361 for (
int n = 0 ;
n < nEntryCnt; ++
n)
380 return std::make_unique<SfxMacroTabPage>( pPage, pController,
nullptr, rAttrSet );
386 return CreateSfxMacroTabPage(pPage, pController, *rAttrSet);
390 const Reference< XFrame >& rxDocumentFrame,
const SfxItemSet& rSet)
395 xPage->SetFrame(rxDocumentFrame);
const SfxEventNamesList & GetEvents() const
SfxEventName & at(size_t Index)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SfxMacroTabPage * GetTabPage()
SfxMacroAssignDlg(weld::Widget *pParent, const css::uno::Reference< css::frame::XFrame > &rxDocumentFrame, const SfxItemSet &rSet)
std::unique_ptr< weld::Button > m_xAssignPB
std::unique_ptr< CuiConfigGroupListBox > m_xGroupLB
std::unique_ptr< weld::Button > m_xDeletePB
OUString m_aStaticMacroLBLabel
std::unique_ptr< weld::Widget > m_xGroupFrame
std::unique_ptr< weld::Frame > m_xMacroFrame
std::unique_ptr< MacroEventListBox > m_xEventLB
std::unique_ptr< CuiConfigFunctionListBox > m_xMacroLB
void AddEvent(const OUString &rEventName, SvMacroItemId nEventId)
virtual bool FillItemSet(SfxItemSet *rSet) override
void AssignDeleteHdl(const weld::Widget *)
virtual void ActivatePage(const SfxItemSet &) override
virtual void Reset(const SfxItemSet *rSet) override
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
virtual ~SfxMacroTabPage() override
bool IsReadOnly() const override
virtual void PageCreated(const SfxAllItemSet &aSet) override
SfxMacroTabPage(weld::Container *pPage, weld::DialogController *pController, const css::uno::Reference< css::frame::XFrame > &rxDocumentFrame, const SfxItemSet &rSet)
std::unique_ptr< SfxMacroTabPage_Impl > mpImpl
void SetTabPage(std::unique_ptr< SfxTabPage > xTabPage)
weld::Container * get_content_area()
const SfxItemSet & GetItemSet() const
void SetFrame(const css::uno::Reference< css::frame::XFrame > &xFrame)
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
const SvxMacroTableDtor & GetMacroTable() const
void Erase(SvMacroItemId nEvent)
SvxMacro & Insert(SvMacroItemId nEvent, const SvxMacro &rMacro)
bool IsKeyValid(SvMacroItemId nEvent) const
const SvxMacro * Get(SvMacroItemId nEvent) const
const OUString & GetMacName() const
OUString GetLanguage() const
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const=0
void connect_row_activated(const Link< TreeView &, bool > &rLink)
virtual void set_text(int row, const OUString &rText, int col=-1)=0
virtual OUString get_text(int row, int col=-1) const=0
virtual int n_children() const=0
void connect_changed(const Link< TreeView &, void > &rLink)
virtual bool get_iter_first(TreeIter &rIter) const=0
void append(TreeIter *pRet=nullptr)
virtual void set_column_fixed_widths(const std::vector< int > &rWidths)=0
virtual void set_cursor(int pos)=0
virtual int get_selected_index() const=0
virtual OUString get_selected_id() const=0
virtual OUString get_id(int pos) const=0
#define DBG_ASSERT(sCon, aError)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define LINK(Instance, Class, Member)
constexpr OUStringLiteral SVX_MACRO_LANGUAGE_STARBASIC
constexpr OUStringLiteral SVX_MACRO_LANGUAGE_SF
static sal_uInt16 aPageRg[]
static OUString ConvertToUIName_Impl(SvxMacro const *pMacro)
IMPL_LINK(SfxMacroTabPage, AssignDeleteClickHdl_Impl, weld::Button &, rBtn, void)
IMPL_LINK_NOARG(SfxMacroTabPage, SelectEvent_Impl, weld::TreeView &, void)
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
Reference< XComponentContext > getProcessComponentContext()
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)