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);
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));
159 sal_uInt16 nCode = rKCode.
GetCode();
164 sal_Int32
nIndex = m_nSelectedRows - 1;
165 sal_Int32 nOrigIndex =
nIndex;
166 sal_Int32
nCount = m_xListBox->n_children();
184 m_xListBox->scroll_to_row(
nIndex);
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() )
216 Reference < XURLTransformer > xTrans( URLTransformer::create(::comphelper::getProcessComponentContext()) );
220 Reference< XDispatch >
xDispatch = xDispatchProvider->queryDispatch(
aTargetURL, OUString(), 0 );
230 : PopupWindowController(rContext, nullptr, OUString())
236 PopupWindowController::initialize(rArguments);
240 if (!getToolboxId(
nId, &pToolBox) && !m_pToolbar)
243 if (getModuleName() !=
"com.sun.star.script.BasicIDE")
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)
290 OUString aQuickHelpText;
291 if (rEvent.State >>= aQuickHelpText)
294 m_pToolbar->set_item_tooltip_text(m_aCommandURL, 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));
331 return "com.sun.star.comp.svx.UndoRedoToolBoxControl";
336 return {
"com.sun.star.frame.ToolbarController" };
339extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
341 css::uno::XComponentContext* rContext,
342 css::uno::Sequence<css::uno::Any>
const & )
css::uno::Reference< css::lang::XComponent > m_xFrame
OUString GetURLPath(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
void Do(sal_Int16 nCount)
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &rEvent) override
virtual VclPtr< vcl::Window > createVclPopupWindow(vcl::Window *pParent) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
void SetInfo(sal_Int32 nCount)
SvxUndoRedoControl(const css::uno::Reference< css::uno::XComponentContext > &rContext)
std::vector< OUString > aUndoRedoList
void SetText(const OUString &rText)
virtual std::unique_ptr< WeldToolbarPopup > weldPopupWindow() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ~SvxUndoRedoControl() override
virtual OUString SAL_CALL getImplementationName() override
static VclPtr< reference_type > Create(Arg &&... arg)
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
weld::Window * GetFrameWeld() const
OUString SvxResId(TranslateId aId)
Reference< XDispatch > xDispatch
constexpr sal_uInt16 KEY_PAGEDOWN
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_DOWN
constexpr sal_uInt16 KEY_PAGEUP
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 &)
IMPL_LINK_NOARG(SvxPopupWindowListBox, ActivateHdl, weld::TreeView &, bool)
IMPL_LINK(SvxPopupWindowListBox, MouseMoveHdl, const MouseEvent &, rMEvt, bool)
#define LINK(Instance, Class, Member)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)