31 #include <svx/strings.hrc>
36 #include <com/sun/star/util/URLTransformer.hpp>
37 #include <com/sun/star/frame/XDispatchProvider.hpp>
63 const std::vector<OUString>& rUndoRedoList);
67 m_xListBox->grab_focus();
72 const std::vector<OUString>& rUndoRedoList)
73 :
WeldToolbarPopup(pControl->getFrameInterface(), pParent,
"svx/ui/floatingundoredo.ui",
"FloatingUndoRedo")
75 , m_xListBox(m_xBuilder->weld_tree_view(
"treeview"))
76 , m_xScratchIter(m_xListBox->make_iterator())
79 m_xListBox->set_selection_mode(SelectionMode::Multiple);
81 for (
const OUString& s : rUndoRedoList)
83 if (!rUndoRedoList.empty())
106 pId = getCommandURL() ==
".uno:Undo" ? RID_SVXSTR_NUM_UNDO_ACTION : RID_SVXSTR_NUM_REDO_ACTION;
108 pId = getCommandURL() ==
".uno:Undo" ? RID_SVXSTR_NUM_UNDO_ACTIONS : RID_SVXSTR_NUM_REDO_ACTIONS;
109 OUString aActionStr =
SvxResId(pId);
110 OUString aText = aActionStr.replaceAll(
"$(ARG1)", OUString::number(nCount));
131 if (m_xListBox->get_dest_row_at_pos(rMEvt.GetPosPixel(), m_xScratchIter.get(),
false))
132 UpdateRow(m_xListBox->get_iter_index_in_parent(*m_xScratchIter));
138 if (m_xListBox->get_dest_row_at_pos(rMEvt.GetPosPixel(), m_xScratchIter.get(),
false))
140 UpdateRow(m_xListBox->get_iter_index_in_parent(*m_xScratchIter));
141 ActivateHdl(*m_xListBox);
148 if (m_xListBox->get_dest_row_at_pos(rMEvt.GetPosPixel(), m_xScratchIter.get(),
false))
149 UpdateRow(m_xListBox->get_iter_index_in_parent(*m_xScratchIter));
164 sal_Int32
nIndex = m_nSelectedRows - 1;
165 sal_Int32 nOrigIndex = nIndex;
166 sal_Int32
nCount = m_xListBox->n_children();
173 nIndex -= m_nVisRows;
175 nIndex += m_nVisRows;
179 if (nIndex >= nCount)
182 if (nIndex != nOrigIndex)
184 m_xListBox->scroll_to_row(nIndex);
185 if (nIndex > nOrigIndex)
187 for (
int i = nOrigIndex + 1;
i <= nIndex; ++
i)
192 for (
int i = nOrigIndex - 1;
i >= nIndex; --
i)
211 Reference< XDispatchProvider > xDispatchProvider(
m_xFrame, UNO_QUERY );
212 if ( !xDispatchProvider.is() )
217 aTargetURL.Complete = m_aCommandURL;
218 xTrans->parseStrict( aTargetURL );
220 Reference< XDispatch >
xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 );
221 if ( xDispatch.is() )
225 xDispatch->dispatch(aTargetURL, aArgs);
236 PopupWindowController::initialize(rArguments);
240 if (!getToolboxId(nId, &pToolBox) && !m_pToolbar)
243 if (getModuleName() !=
"com.sun.star.script.BasicIDE")
248 aDefaultTooltip = m_pToolbar->get_item_tooltip_text(m_aCommandURL.toUtf8());
266 if (rEvent.FeatureURL.Main ==
".uno:GetUndoStrings" || rEvent.FeatureURL.Main ==
".uno:GetRedoStrings")
268 css::uno::Sequence<OUString> aStrings;
269 rEvent.State >>= aStrings;
270 aUndoRedoList = comphelper::sequenceToContainer<std::vector<OUString>>(aStrings);
274 PopupWindowController::statusChanged(rEvent);
278 if (!getToolboxId(nId, &pToolBox) && !m_pToolbar)
281 if (!rEvent.IsEnabled)
284 m_pToolbar->set_item_tooltip_text(m_aCommandURL.toUtf8(),
aDefaultTooltip);
290 OUString aQuickHelpText;
291 if (rEvent.State >>= aQuickHelpText)
294 m_pToolbar->set_item_tooltip_text(m_aCommandURL.toUtf8(), aQuickHelpText);
302 if ( m_aCommandURL ==
".uno:Undo" )
303 updateStatus(
".uno:GetUndoStrings");
305 updateStatus(
".uno:GetRedoStrings");
307 return std::make_unique<SvxPopupWindowListBox>(
this, m_pToolbar,
aUndoRedoList);
312 if ( m_aCommandURL ==
".uno:Undo" )
313 updateStatus(
".uno:GetUndoStrings");
315 updateStatus(
".uno:GetRedoStrings");
320 std::move(xPopupWin));
324 mxInterimPopover->Show();
331 return "com.sun.star.comp.svx.UndoRedoToolBoxControl";
336 return {
"com.sun.star.frame.ToolbarController" };
339 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
341 css::uno::XComponentContext* rContext,
342 css::uno::Sequence<css::uno::Any>
const & )
#define LINK(Instance, Class, Member)
virtual ~SvxUndoRedoControl() override
OUString GetURLPath(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::lang::XComponent > m_xFrame
std::vector< OUString > aUndoRedoList
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &rEvent) override
sal_uInt16 GetCode() const
SvxUndoRedoControl(const css::uno::Reference< css::uno::XComponentContext > &rContext)
constexpr sal_uInt16 KEY_UP
void SetText(const OUString &rText)
weld::Window * GetFrameWeld() const
OUString SvxResId(TranslateId aId)
constexpr sal_uInt16 KEY_PAGEUP
sal_uInt16 GetModifier() const
IMPL_LINK(SvxPopupWindowListBox, MouseMoveHdl, const MouseEvent &, rMEvt, bool)
constexpr sal_uInt16 KEY_DOWN
void Do(sal_Int16 nCount)
constexpr sal_uInt16 KEY_PAGEDOWN
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
void SetInfo(sal_Int32 nCount)
Reference< XDispatch > xDispatch
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_UndoRedoToolBoxControl_get_implementation(css::uno::XComponentContext *rContext, css::uno::Sequence< css::uno::Any > const &)
virtual VclPtr< vcl::Window > createVclPopupWindow(vcl::Window *pParent) override
static VclPtr< reference_type > Create(Arg &&...arg)
Reference< XComponentContext > getProcessComponentContext()
IMPL_LINK_NOARG(SvxPopupWindowListBox, ActivateHdl, weld::TreeView &, bool)
virtual std::unique_ptr< WeldToolbarPopup > weldPopupWindow() override