10#include <com/sun/star/text/DefaultNumberingProvider.hpp>
11#include <com/sun/star/text/XNumberingFormatter.hpp>
17#include <svx/strings.hrc>
27class NumberingToolBoxControl;
33 std::unique_ptr<SvxNumValueSet> mxValueSet;
34 std::unique_ptr<weld::CustomWeld> mxValueSetWin;
35 std::unique_ptr<weld::Button> mxMoreButton;
44 virtual void statusChanged(
const css::frame::FeatureStateEvent& rEvent )
override;
52 explicit NumberingToolBoxControl(
const css::uno::Reference< css::uno::XComponentContext >& rxContext );
57 virtual void SAL_CALL initialize(
const css::uno::Sequence< css::uno::Any >& aArguments )
override;
66NumberingPopup::NumberingPopup(NumberingToolBoxControl& rController,
68 :
WeldToolbarPopup(rController.getFrameInterface(), pParent,
"svx/ui/numberingwindow.ui",
"NumberingWindow")
69 , mePageType(ePageType)
71 , mxValueSet(new
SvxNumValueSet(m_xBuilder->weld_scrolled_window(
"valuesetwin", true)))
72 , mxValueSetWin(new
weld::CustomWeld(*m_xBuilder,
"valueset", *mxValueSet))
73 , mxMoreButton(m_xBuilder->weld_button(
"more"))
75 mxValueSet->SetStyle(WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NO_DIRECTSELECT);
76 mxValueSet->init(mePageType);
80 css::uno::Reference< css::text::XDefaultNumberingProvider > xDefNum = css::text::DefaultNumberingProvider::create(
mrController.getContext() );
84 css::uno::Reference< css::text::XNumberingFormatter > xFormat( xDefNum, css::uno::UNO_QUERY );
88 css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aNumberings(
89 xDefNum->getDefaultContinuousNumberingLevels( aLocale ) );
90 mxValueSet->SetNumberingSettings( aNumberings, xFormat, aLocale );
94 css::uno::Sequence< css::uno::Reference< css::container::XIndexAccess > > aOutline(
95 xDefNum->getDefaultOutlineNumberings( aLocale ) );
96 mxValueSet->SetOutlineNumberingSettings( aOutline, xFormat, aLocale );
104 mxValueSet->SetExtraSpacing( 2 );
105 Size aSize(mxValueSet->CalcWindowSizePixel(aItemSize));
107 mxValueSet->SetOutputSizePixel(aSize);
110 OUString aMoreItemText =
SvxResId( RID_SVXSTR_CUSTOMIZE );
112 AddStatusListener(
".uno:CurrentBulletListType" );
114 AddStatusListener(
".uno:CurrentNumListType" );
116 AddStatusListener(
".uno:CurrentOutlineType" );
119 mxMoreButton->set_image(xImage);
120 mxMoreButton->set_label(aMoreItemText);
121 mxMoreButton->connect_clicked(
LINK(
this, NumberingPopup, VSButtonClickSetHdl));
123 mxValueSet->SetSelectHdl(
LINK(
this, NumberingPopup, VSSelectValueSetHdl));
126void NumberingPopup::statusChanged(
const css::frame::FeatureStateEvent& rEvent )
128 mxValueSet->SetNoSelection();
131 if ( rEvent.State >>= nSelItem )
132 mxValueSet->SelectItem( nSelItem );
137 sal_uInt16 nSelItem = mxValueSet->GetSelectedItemId();
141 mrController.dispatchCommand(
".uno:SetBullet", aArgs );
146 mrController.dispatchCommand(
".uno:SetNumber", aArgs );
151 mrController.dispatchCommand(
".uno:SetOutline", aArgs );
156void NumberingPopup::GrabFocus()
158 mxValueSet->GrabFocus();
164 mrController.dispatchCommand(
".uno:OutlineBullet", aArgs );
169NumberingToolBoxControl::NumberingToolBoxControl(
const css::uno::Reference< css::uno::XComponentContext >& rxContext ):
170 svt::PopupWindowController( rxContext, css::
uno::
Reference< css::frame::XFrame >(), OUString() ),
175std::unique_ptr<WeldToolbarPopup> NumberingToolBoxControl::weldPopupWindow()
177 return std::make_unique<NumberingPopup>(*
this, m_pToolbar, mePageType);
183 std::make_unique<NumberingPopup>(*
this, pParent->
GetFrameWeld(), mePageType));
185 mxInterimPopover->Show();
187 return mxInterimPopover;
190void SAL_CALL NumberingToolBoxControl::initialize(
const css::uno::Sequence< css::uno::Any >& aArguments )
192 svt::PopupWindowController::initialize( aArguments );
194 if ( m_aCommandURL ==
".uno:DefaultBullet" )
196 else if ( m_aCommandURL ==
".uno:SetOutline" )
202 m_pToolbar->set_item_popover(m_aCommandURL, mxPopoverContainer->getTopLevel());
208 if (getToolboxId(nId, &pToolBox))
211 ? ToolBoxItemBits::DROPDOWNONLY
212 : ToolBoxItemBits::DROPDOWN;
217OUString SAL_CALL NumberingToolBoxControl::getImplementationName()
219 return "com.sun.star.comp.svx.NumberingToolBoxControl";
222css::uno::Sequence< OUString > SAL_CALL NumberingToolBoxControl::getSupportedServiceNames()
224 return {
"com.sun.star.frame.ToolbarController" };
227extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
229 css::uno::XComponentContext *rxContext,
230 css::uno::Sequence<css::uno::Any>
const & )
232 return cppu::acquire(
new NumberingToolBoxControl( rxContext ) );
SlideSorterController & mrController
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_NumberingToolBoxControl_get_implementation(css::uno::XComponentContext *rxContext, css::uno::Sequence< css::uno::Any > const &)
IMPL_LINK_NOARG(NumberingPopup, VSSelectValueSetHdl, ValueSet *, void)
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
static VclPtr< reference_type > Create(Arg &&... arg)
weld::Window * GetFrameWeld() const
virtual OutputDevice & get_ref_device()=0
OUString SvxResId(TranslateId aId)
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
#define LINK(Instance, Class, Member)
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
Reference< graphic::XGraphic > GetXGraphicForCommand(const OUString &rsCommandName, const Reference< frame::XFrame > &rxFrame, vcl::ImageType eImageType)