31#include <svx/strings.hrc>
32#include <svx/svxids.hrc>
63 :
svt::PopupWindowController( rContext, nullptr, OUString() )
65 addStatusListener(
".uno:LineDash");
76 if (!getToolboxId(
nId, &pToolBox) && !m_pToolbar)
79 if ( rEvent.FeatureURL.Complete == m_aCommandURL )
82 m_pToolbar->set_item_sensitive(m_aCommandURL, rEvent.IsEnabled);
99 bool bNoneLineStyle =
false;
105 BitmapEx aEmpty(xList->GetBitmapForUISolidLine());
110 m_pToolbar->set_item_image(m_aCommandURL, aGraf.
GetXGraphic());
114 bNoneLineStyle =
true;
120 Graphic aGraf(xList->GetBitmapForUISolidLine());
121 m_pToolbar->set_item_image(m_aCommandURL, aGraf.
GetXGraphic());
130 m_pToolbar->set_item_image(m_aCommandURL, aGraf.
GetXGraphic());
145 m_pToolbar->set_menu_item_active(m_aCommandURL, !m_pToolbar->get_menu_item_active(m_aCommandURL));
156 svt::PopupWindowController::initialize( rArguments );
166 if ( getToolboxId(
nId, &pToolBox ) )
194 return std::make_unique<SvxLineBox>(
this, m_pToolbar,
m_xBtnUpdater->GetStyleIndex());
209 return "com.sun.star.comp.svx.LineStyleToolBoxControl";
214 return {
"com.sun.star.frame.ToolbarController" };
217extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
219 css::uno::XComponentContext* rContext,
220 css::uno::Sequence<css::uno::Any>
const & )
230 explicit SvxLineEndToolBoxControl(
const css::uno::Reference<css::uno::XComponentContext>& rContext );
233 virtual void SAL_CALL initialize(
const css::uno::Sequence<css::uno::Any>& rArguments )
override;
239 virtual void SAL_CALL execute(sal_Int16 nKeyModifier)
override;
251 std::unique_ptr<ValueSet> mxLineEndSet;
252 std::unique_ptr<weld::CustomWeld> mxLineEndSetWin;
262 mxLineEndSet->GrabFocus();
266 SvxLineEndWindow(SvxLineEndToolBoxControl* pControl,
weld::Widget* pParent);
267 virtual void statusChanged(
const css::frame::FeatureStateEvent& rEvent )
override;
274SvxLineEndWindow::SvxLineEndWindow(SvxLineEndToolBoxControl* pControl,
weld::Widget* pParent)
275 :
WeldToolbarPopup(pControl->getFrameInterface(), pParent,
"svx/ui/floatinglineend.ui",
"FloatingLineEnd")
276 , mxControl(pControl)
277 , mxLineEndSet(new
ValueSet(m_xBuilder->weld_scrolled_window(
"valuesetwin", true)))
278 , mxLineEndSetWin(new
weld::CustomWeld(*m_xBuilder,
"valueset", *mxLineEndSet))
292 DBG_ASSERT( mpLineEndList.is(),
"LineEndList not found" );
294 mxLineEndSet->SetSelectHdl(
LINK(
this, SvxLineEndWindow, SelectHdl ) );
295 mxLineEndSet->SetColCount(
gnCols );
300 AddStatusListener(
".uno:LineEndListState");
305 std::unique_ptr<XLineEndItem> pLineEndItem;
306 std::unique_ptr<XLineStartItem> pLineStartItem;
307 sal_uInt16
nId = mxLineEndSet->GetSelectedItemId();
331 if ( pLineStartItem )
334 pLineStartItem->QueryValue(
a );
339 pLineEndItem->QueryValue(
a );
346 mxLineEndSet->SetNoSelection();
348 mxControl->dispatchCommand(mxControl->getCommandURL(), aArgs);
350 mxControl->EndPopupMode();
353void SvxLineEndWindow::FillValueSet()
355 if( !mpLineEndList.is() )
365 mpLineEndList->Insert(std::make_unique<XLineEndEntry>(aNothing,
369 BitmapEx aBmp = mpLineEndList->GetUiBitmap( nCount );
370 OSL_ENSURE( !aBmp.
IsEmpty(),
"UI bitmap was not created" );
373 pVD->SetOutputSizePixel( maBmpSize,
false );
374 maBmpSize.setWidth( maBmpSize.Width() / 2 );
376 Point aPt1( maBmpSize.Width(), 0 );
378 pVD->DrawBitmapEx(
Point(), aBmp );
379 mxLineEndSet->InsertItem(1,
Image(pVD->GetBitmapEx(aPt0, maBmpSize)), pEntry->
GetName());
380 mxLineEndSet->InsertItem(2,
Image(pVD->GetBitmapEx(aPt1, maBmpSize)), pEntry->
GetName());
382 mpLineEndList->Remove(nCount);
387 DBG_ASSERT( pEntry,
"Could not access LineEndEntry" );
388 aBmp = mpLineEndList->GetUiBitmap( i );
389 OSL_ENSURE( !aBmp.
IsEmpty(),
"UI bitmap was not created" );
391 pVD->DrawBitmapEx( aPt0, aBmp );
392 mxLineEndSet->InsertItem(
static_cast<sal_uInt16
>((i+1)*2L+1),
393 Image(pVD->GetBitmapEx(aPt0, maBmpSize)), pEntry->
GetName());
394 mxLineEndSet->InsertItem(
static_cast<sal_uInt16
>((i+2)*2L),
395 Image(pVD->GetBitmapEx(aPt1, maBmpSize)), pEntry->
GetName());
397 mnLines = std::min(
static_cast<sal_uInt16
>(nCount + 1), sal_uInt16(
MAX_LINES) );
398 mxLineEndSet->SetLineCount( mnLines );
403void SvxLineEndWindow::statusChanged(
const css::frame::FeatureStateEvent& rEvent )
405 if ( rEvent.FeatureURL.Complete !=
".uno:LineEndListState" )
409 css::uno::Reference< css::uno::XWeak > xWeak;
410 if ( rEvent.State >>= xWeak )
412 mpLineEndList.set(
static_cast< XLineEndList*
>( xWeak.get() ) );
413 DBG_ASSERT( mpLineEndList.is(),
"LineEndList not found" );
415 mxLineEndSet->Clear();
420void SvxLineEndWindow::SetSize()
422 sal_uInt16 nItemCount = mxLineEndSet->GetItemCount();
423 sal_uInt16 nMaxLines = nItemCount /
gnCols;
425 WinBits nBits = mxLineEndSet->GetStyle();
426 if ( mnLines == nMaxLines )
427 nBits &= ~WB_VSCROLL;
430 mxLineEndSet->SetStyle( nBits );
432 Size aSize( maBmpSize );
433 aSize.AdjustWidth(6 );
434 aSize.AdjustHeight(6 );
435 aSize = mxLineEndSet->CalcWindowSizePixel( aSize );
436 mxLineEndSet->GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height());
437 mxLineEndSet->SetOutputSizePixel(aSize);
440SvxLineEndToolBoxControl::SvxLineEndToolBoxControl(
const css::uno::Reference<css::uno::XComponentContext>& rContext )
441 :
svt::PopupWindowController( rContext, nullptr, OUString() )
445void SAL_CALL SvxLineEndToolBoxControl::execute(sal_Int16 )
450 m_pToolbar->set_menu_item_active(m_aCommandURL, !m_pToolbar->get_menu_item_active(m_aCommandURL));
459void SvxLineEndToolBoxControl::initialize(
const css::uno::Sequence<css::uno::Any>& rArguments )
461 svt::PopupWindowController::initialize( rArguments );
466 m_pToolbar->set_item_popover(m_aCommandURL, mxPopoverContainer->getTopLevel());
471 if ( getToolboxId( nId, &pToolBox ) )
475std::unique_ptr<WeldToolbarPopup> SvxLineEndToolBoxControl::weldPopupWindow()
477 return std::make_unique<SvxLineEndWindow>(
this, m_pToolbar);
483 std::make_unique<SvxLineEndWindow>(
this, pParent->
GetFrameWeld()));
485 mxInterimPopover->Show();
487 mxInterimPopover->SetText(
SvxResId(RID_SVXSTR_LINEEND));
489 return mxInterimPopover;
492OUString SvxLineEndToolBoxControl::getImplementationName()
494 return "com.sun.star.comp.svx.LineEndToolBoxControl";
497css::uno::Sequence<OUString> SvxLineEndToolBoxControl::getSupportedServiceNames()
499 return {
"com.sun.star.frame.ToolbarController" };
502extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
504 css::uno::XComponentContext* rContext,
505 css::uno::Sequence<css::uno::Any>
const & )
507 return cppu::acquire(
new SvxLineEndToolBoxControl( rContext ) );
511 :
WeldToolbarPopup(pControl->getFrameInterface(), pParent,
"svx/ui/floatinglinestyle.ui",
"FloatingLineStyle")
512 , mxControl(pControl)
513 , mxLineStyleSet(new
ValueSet(m_xBuilder->weld_scrolled_window(
"valuesetwin", true)))
514 , mxLineStyleSetWin(new
weld::CustomWeld(*m_xBuilder,
"valueset", *mxLineStyleSet))
547 auto aBmp = pList->GetBitmapForUISolidLine();
556 const BitmapEx aBitmap = pList->GetUiBitmap(
i);
561 sal_uInt16 nLines = std::min(
static_cast<sal_uInt16
>(
nCount + 2), sal_uInt16(
MAX_LINES) );
566 nBits &= ~WB_VSCROLL;
571 Size aSize(aBmpSize);
581 drawing::LineStyle eXLS;
582 sal_Int32
nPos = mxLineStyleSet->GetSelectedItemId();
588 eXLS = drawing::LineStyle_NONE;
592 eXLS = drawing::LineStyle_SOLID;
597 eXLS = drawing::LineStyle_DASH;
599 if (
nPos != -1 && pObjSh && pObjSh->
GetItem(SID_DASH_LIST))
610 mxControl->dispatchLineStyleCommand(
".uno:LineDash", aArgs);
615 eStyle == drawing::DashStyle_RECT || eStyle == drawing::DashStyle_RECTRELATIVE
616 ? css::drawing::LineCap_BUTT
617 : css::drawing::LineCap_ROUND );
620 mxControl->dispatchLineStyleCommand(
".uno:LineCap", aArgs2);
630 mxControl->dispatchLineStyleCommand(
".uno:XLineStyle", aArgs);
632 mxControl->EndPopupMode();
static const AllSettings & GetSettings()
bool Erase(const Color &rFillColor)
const Size & GetSizePixel() const
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
tools::Long AdjustWidth(tools::Long n)
constexpr tools::Long Width() const
const XDashListRef & GetDashList() const
std::unique_ptr< ValueSet > mxLineStyleSet
virtual void GrabFocus() override
void Fill(const XDashListRef &pList)
SvxLineBox(SvxLineStyleToolBoxControl *pControl, weld::Widget *pParent, int nInitialIndex)
virtual ~SvxLineBox() override
static VclPtr< reference_type > Create(Arg &&... arg)
const XDash & GetDash() const
css::drawing::DashStyle GetDashStyle() const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
const basegfx::B2DPolyPolygon & GetLineEnd() const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
const OUString & GetName() const
weld::Window * GetFrameWeld() const
#define DBG_ASSERT(sCon, aError)
OUString SvxResId(TranslateId aId)
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
constexpr OUStringLiteral HID_POPUP_LINEEND
constexpr OUStringLiteral HID_POPUP_LINEEND_CTRL
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_LineEndToolBoxControl_get_implementation(css::uno::XComponentContext *rContext, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_LineStyleToolBoxControl_get_implementation(css::uno::XComponentContext *rContext, css::uno::Sequence< css::uno::Any > const &)
constexpr sal_uInt16 gnCols
IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet *, void)
std::function< bool(const OUString &, const css::uno::Any &)> LineStyleSelectFunction
std::function< void(bool)> LineStyleIsNoneFunction
#define LINK(Instance, Class, Member)
bool dispatchCommand(const OUString &rCommand, const uno::Reference< css::frame::XFrame > &rFrame, const css::uno::Sequence< css::beans::PropertyValue > &rArguments, const uno::Reference< css::frame::XDispatchResultListener > &rListener)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
#define WB_NO_DIRECTSELECT