LibreOffice Module svx (master)  1
linectrl.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <tools/debug.hxx>
21 #include <vcl/settings.hxx>
22 #include <vcl/svapp.hxx>
23 #include <vcl/toolbox.hxx>
24 #include <vcl/virdev.hxx>
25 #include <sfx2/objsh.hxx>
26 
27 #include <svtools/toolbarmenu.hxx>
29 #include <svtools/valueset.hxx>
30 
31 #include <svx/strings.hrc>
32 #include <svx/svxids.hrc>
33 #include <helpids.h>
34 
35 #include <svx/drawitem.hxx>
36 #include <svx/xlineit0.hxx>
37 #include <svx/xlncapit.hxx>
38 #include <svx/xlndsit.hxx>
39 #include <svx/xlnstit.hxx>
40 #include <svx/xlnedit.hxx>
41 #include <svx/xtable.hxx>
42 #include <svx/linectrl.hxx>
43 #include <svx/itemwin.hxx>
44 #include <svx/dialmgr.hxx>
45 #include <tbxcolorupdate.hxx>
46 
47 #include <memory>
48 
49 #include <comphelper/lok.hxx>
51 
52 using namespace ::com::sun::star::uno;
53 using namespace ::com::sun::star::beans;
54 using namespace ::com::sun::star::util;
55 using namespace ::com::sun::star::frame;
56 using namespace ::com::sun::star::lang;
57 using namespace ::com::sun::star;
58 
59 // For End Line Controller
60 #define MAX_LINES 12
61 
62 SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext )
63  : svt::PopupWindowController( rContext, nullptr, OUString() )
64 {
65  addStatusListener(".uno:LineDash");
66 }
67 
69 {
70 }
71 
72 void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( const frame::FeatureStateEvent& rEvent )
73 {
74  ToolBox* pToolBox = nullptr;
76  if (!getToolboxId(nId, &pToolBox) && !m_pToolbar)
77  return;
78 
79  OString sId(m_aCommandURL.toUtf8());
80 
81  if ( rEvent.FeatureURL.Complete == m_aCommandURL )
82  {
83  if (m_pToolbar)
84  m_pToolbar->set_item_sensitive(sId, rEvent.IsEnabled);
85  else
86  pToolBox->EnableItem( nId, rEvent.IsEnabled );
87  }
88 
89  m_xBtnUpdater->Update(rEvent);
90 
92  if (!pSh)
93  return;
94 
95  const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST );
96  if (!pItem)
97  return;
98 
99  XDashListRef xList = pItem->GetDashList();
100  int nIndex = m_xBtnUpdater->GetStyleIndex();
101  bool bNoneLineStyle = false;
102  switch (nIndex)
103  {
104  case -1:
105  case 0:
106  {
107  BitmapEx aEmpty(xList->GetBitmapForUISolidLine());
108  aEmpty.Erase(Application::GetSettings().GetStyleSettings().GetFieldColor());
109  if (m_pToolbar)
110  {
111  Graphic aGraf(aEmpty);
112  m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
113  }
114  else
115  pToolBox->SetItemImage(nId, Image(aEmpty));
116  bNoneLineStyle = true;
117  break;
118  }
119  case 1:
120  if (m_pToolbar)
121  {
122  Graphic aGraf(xList->GetBitmapForUISolidLine());
123  m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
124  }
125  else
126  pToolBox->SetItemImage(nId, Image(xList->GetBitmapForUISolidLine()));
127  break;
128  default:
129  if (m_pToolbar)
130  {
131  Graphic aGraf(xList->GetUiBitmap(nIndex - 2));
132  m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
133  }
134  else
135  pToolBox->SetItemImage(nId, Image(xList->GetUiBitmap(nIndex - 2)));
136  break;
137  }
139  m_aLineStyleIsNoneFunction(bNoneLineStyle);
140 }
141 
142 void SAL_CALL SvxLineStyleToolBoxControl::execute(sal_Int16 /*KeyModifier*/)
143 {
144  if (m_pToolbar)
145  {
146  // Toggle the popup also when toolbutton is activated
147  const OString aId(m_aCommandURL.toUtf8());
148  m_pToolbar->set_menu_item_active(aId, !m_pToolbar->get_menu_item_active(aId));
149  }
150  else
151  {
152  // Open the popup also when Enter key is pressed.
154  }
155 }
156 
157 void SvxLineStyleToolBoxControl::initialize( const css::uno::Sequence<css::uno::Any>& rArguments )
158 {
159  svt::PopupWindowController::initialize( rArguments );
160 
161  if (m_pToolbar)
162  {
163  mxPopoverContainer.reset(new ToolbarPopupContainer(m_pToolbar));
164  m_pToolbar->set_item_popover(m_aCommandURL.toUtf8(), mxPopoverContainer->getTopLevel());
165  }
166 
167  ToolBox* pToolBox = nullptr;
169  if ( getToolboxId( nId, &pToolBox ) )
170  {
171  pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY );
172  }
173 
175 }
176 
178 {
179  m_aLineStyleSelectFunction = rLineStyleSelectFunction;
180 }
181 
183 {
184  m_aLineStyleIsNoneFunction = rLineStyleIsNoneFunction;
185 }
186 
187 void SvxLineStyleToolBoxControl::dispatchLineStyleCommand(const OUString& rCommand, const Sequence<PropertyValue>& rArgs)
188 {
190  return;
191 
192  dispatchCommand(rCommand, rArgs);
193 }
194 
195 std::unique_ptr<WeldToolbarPopup> SvxLineStyleToolBoxControl::weldPopupWindow()
196 {
197  return std::make_unique<SvxLineBox>(this, m_pToolbar, m_xBtnUpdater->GetStyleIndex());
198 }
199 
201 {
202  mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent,
203  std::make_unique<SvxLineBox>(this, pParent->GetFrameWeld(), m_xBtnUpdater->GetStyleIndex()));
204 
205  mxInterimPopover->Show();
206 
207  return mxInterimPopover;
208 }
209 
211 {
212  return "com.sun.star.comp.svx.LineStyleToolBoxControl";
213 }
214 
216 {
217  return { "com.sun.star.frame.ToolbarController" };
218 }
219 
220 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
222  css::uno::XComponentContext* rContext,
223  css::uno::Sequence<css::uno::Any> const & )
224 {
225  return cppu::acquire( new SvxLineStyleToolBoxControl( rContext ) );
226 }
227 
228 namespace {
229 
230 class SvxLineEndToolBoxControl final : public svt::PopupWindowController
231 {
232 public:
233  explicit SvxLineEndToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
234 
235  // XInitialization
236  virtual void SAL_CALL initialize( const css::uno::Sequence<css::uno::Any>& rArguments ) override;
237 
238  // XServiceInfo
239  virtual OUString SAL_CALL getImplementationName() override;
240  virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
241 
242  virtual void SAL_CALL execute(sal_Int16 nKeyModifier) override;
243 
244 private:
245  virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override;
246  virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override;
247 };
248 
249 class SvxLineEndWindow final : public WeldToolbarPopup
250 {
251 private:
252  XLineEndListRef mpLineEndList;
254  std::unique_ptr<ValueSet> mxLineEndSet;
255  std::unique_ptr<weld::CustomWeld> mxLineEndSetWin;
256  sal_uInt16 mnLines;
257  Size maBmpSize;
258 
259  DECL_LINK( SelectHdl, ValueSet*, void );
260  void FillValueSet();
261  void SetSize();
262 
263  virtual void GrabFocus() override
264  {
265  mxLineEndSet->GrabFocus();
266  }
267 
268 public:
269  SvxLineEndWindow(SvxLineEndToolBoxControl* pControl, weld::Widget* pParent);
270  virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
271 };
272 
273 }
274 
275 constexpr sal_uInt16 gnCols = 2;
276 
277 SvxLineEndWindow::SvxLineEndWindow(SvxLineEndToolBoxControl* pControl, weld::Widget* pParent)
278  : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "svx/ui/floatinglineend.ui", "FloatingLineEnd")
279  , mxControl(pControl)
280  , mxLineEndSet(new ValueSet(m_xBuilder->weld_scrolled_window("valuesetwin", true)))
281  , mxLineEndSetWin(new weld::CustomWeld(*m_xBuilder, "valueset", *mxLineEndSet))
282  , mnLines(12)
283 {
284  mxLineEndSet->SetStyle(mxLineEndSet->GetStyle() | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT);
285  mxLineEndSet->SetHelpId(HID_POPUP_LINEEND_CTRL);
286  m_xTopLevel->set_help_id(HID_POPUP_LINEEND);
287 
289  if ( pDocSh )
290  {
291  const SfxPoolItem* pItem = pDocSh->GetItem( SID_LINEEND_LIST );
292  if( pItem )
293  mpLineEndList = static_cast<const SvxLineEndListItem*>( pItem )->GetLineEndList();
294  }
295  DBG_ASSERT( mpLineEndList.is(), "LineEndList not found" );
296 
297  mxLineEndSet->SetSelectHdl( LINK( this, SvxLineEndWindow, SelectHdl ) );
298  mxLineEndSet->SetColCount( gnCols );
299 
300  // ValueSet fill with entries of LineEndList
301  FillValueSet();
302 
303  AddStatusListener( ".uno:LineEndListState");
304 }
305 
306 IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, void)
307 {
308  std::unique_ptr<XLineEndItem> pLineEndItem;
309  std::unique_ptr<XLineStartItem> pLineStartItem;
310  sal_uInt16 nId = mxLineEndSet->GetSelectedItemId();
311 
312  if( nId == 1 )
313  {
314  pLineStartItem.reset(new XLineStartItem());
315  }
316  else if( nId == 2 )
317  {
318  pLineEndItem.reset(new XLineEndItem());
319  }
320  else if( nId % 2 ) // beginning of line
321  {
322  const XLineEndEntry* pEntry = mpLineEndList->GetLineEnd( (nId - 1) / 2 - 1 );
323  pLineStartItem.reset(new XLineStartItem(pEntry->GetName(), pEntry->GetLineEnd()));
324  }
325  else // end of line
326  {
327  const XLineEndEntry* pEntry = mpLineEndList->GetLineEnd( nId / 2 - 2 );
328  pLineEndItem.reset(new XLineEndItem(pEntry->GetName(), pEntry->GetLineEnd()));
329  }
330 
331  OUString name;
332  Any a;
333 
334  if ( pLineStartItem )
335  {
336  name = "LineStart";
337  pLineStartItem->QueryValue( a );
338  }
339  else
340  {
341  name = "LineEnd";
342  pLineEndItem->QueryValue( a );
343  }
344  Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue(name, a) };
345 
346  /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
347  This instance may be deleted in the meantime (i.e. when a dialog is opened
348  while in Dispatch()), accessing members will crash in this case. */
349  mxLineEndSet->SetNoSelection();
350 
351  mxControl->dispatchCommand(mxControl->getCommandURL(), aArgs);
352 
353  mxControl->EndPopupMode();
354 }
355 
356 void SvxLineEndWindow::FillValueSet()
357 {
358  if( !mpLineEndList.is() )
359  return;
360 
362 
363  tools::Long nCount = mpLineEndList->Count();
364 
365  // First entry: no line end.
366  // An entry is temporarily added to get the UI bitmap
367  basegfx::B2DPolyPolygon aNothing;
368  mpLineEndList->Insert(std::make_unique<XLineEndEntry>(aNothing,
369  comphelper::LibreOfficeKit::isActive() ? SvxResId(RID_SVXSTR_INVISIBLE)
370  : SvxResId(RID_SVXSTR_NONE)));
371  const XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(nCount);
372  BitmapEx aBmp = mpLineEndList->GetUiBitmap( nCount );
373  OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" );
374 
375  maBmpSize = aBmp.GetSizePixel();
376  pVD->SetOutputSizePixel( maBmpSize, false );
377  maBmpSize.setWidth( maBmpSize.Width() / 2 );
378  Point aPt0( 0, 0 );
379  Point aPt1( maBmpSize.Width(), 0 );
380 
381  pVD->DrawBitmapEx( Point(), aBmp );
382  mxLineEndSet->InsertItem(1, Image(pVD->GetBitmapEx(aPt0, maBmpSize)), pEntry->GetName());
383  mxLineEndSet->InsertItem(2, Image(pVD->GetBitmapEx(aPt1, maBmpSize)), pEntry->GetName());
384 
385  mpLineEndList->Remove(nCount);
386 
387  for( tools::Long i = 0; i < nCount; i++ )
388  {
389  pEntry = mpLineEndList->GetLineEnd( i );
390  DBG_ASSERT( pEntry, "Could not access LineEndEntry" );
391  aBmp = mpLineEndList->GetUiBitmap( i );
392  OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" );
393 
394  pVD->DrawBitmapEx( aPt0, aBmp );
395  mxLineEndSet->InsertItem(static_cast<sal_uInt16>((i+1)*2L+1),
396  Image(pVD->GetBitmapEx(aPt0, maBmpSize)), pEntry->GetName());
397  mxLineEndSet->InsertItem(static_cast<sal_uInt16>((i+2)*2L),
398  Image(pVD->GetBitmapEx(aPt1, maBmpSize)), pEntry->GetName());
399  }
400  mnLines = std::min( static_cast<sal_uInt16>(nCount + 1), sal_uInt16(MAX_LINES) );
401  mxLineEndSet->SetLineCount( mnLines );
402 
403  SetSize();
404 }
405 
406 void SvxLineEndWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent )
407 {
408  if ( rEvent.FeatureURL.Complete != ".uno:LineEndListState" )
409  return;
410 
411  // The list of line ends (LineEndList) has changed
412  css::uno::Reference< css::uno::XWeak > xWeak;
413  if ( rEvent.State >>= xWeak )
414  {
415  mpLineEndList.set( static_cast< XLineEndList* >( xWeak.get() ) );
416  DBG_ASSERT( mpLineEndList.is(), "LineEndList not found" );
417 
418  mxLineEndSet->Clear();
419  FillValueSet();
420  }
421 }
422 
423 void SvxLineEndWindow::SetSize()
424 {
425  sal_uInt16 nItemCount = mxLineEndSet->GetItemCount();
426  sal_uInt16 nMaxLines = nItemCount / gnCols;
427 
428  WinBits nBits = mxLineEndSet->GetStyle();
429  if ( mnLines == nMaxLines )
430  nBits &= ~WB_VSCROLL;
431  else
432  nBits |= WB_VSCROLL;
433  mxLineEndSet->SetStyle( nBits );
434 
435  Size aSize( maBmpSize );
436  aSize.AdjustWidth(6 );
437  aSize.AdjustHeight(6 );
438  aSize = mxLineEndSet->CalcWindowSizePixel( aSize );
439  mxLineEndSet->GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height());
440  mxLineEndSet->SetOutputSizePixel(aSize);
441 }
442 
443 SvxLineEndToolBoxControl::SvxLineEndToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext )
444  : svt::PopupWindowController( rContext, nullptr, OUString() )
445 {
446 }
447 
448 void SAL_CALL SvxLineEndToolBoxControl::execute(sal_Int16 /*KeyModifier*/)
449 {
450  if (m_pToolbar)
451  {
452  // Toggle the popup also when toolbutton is activated
453  const OString aId(m_aCommandURL.toUtf8());
454  m_pToolbar->set_menu_item_active(aId, !m_pToolbar->get_menu_item_active(aId));
455  }
456  else
457  {
458  // Open the popup also when Enter key is pressed.
459  createPopupWindow();
460  }
461 }
462 
463 void SvxLineEndToolBoxControl::initialize( const css::uno::Sequence<css::uno::Any>& rArguments )
464 {
465  svt::PopupWindowController::initialize( rArguments );
466 
467  if (m_pToolbar)
468  {
469  mxPopoverContainer.reset(new ToolbarPopupContainer(m_pToolbar));
470  m_pToolbar->set_item_popover(m_aCommandURL.toUtf8(), mxPopoverContainer->getTopLevel());
471  }
472 
473  ToolBox* pToolBox = nullptr;
475  if ( getToolboxId( nId, &pToolBox ) )
476  pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY );
477 }
478 
479 std::unique_ptr<WeldToolbarPopup> SvxLineEndToolBoxControl::weldPopupWindow()
480 {
481  return std::make_unique<SvxLineEndWindow>(this, m_pToolbar);
482 }
483 
484 VclPtr<vcl::Window> SvxLineEndToolBoxControl::createVclPopupWindow( vcl::Window* pParent )
485 {
486  mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent,
487  std::make_unique<SvxLineEndWindow>(this, pParent->GetFrameWeld()));
488 
489  mxInterimPopover->Show();
490 
491  mxInterimPopover->SetText(SvxResId(RID_SVXSTR_LINEEND));
492 
493  return mxInterimPopover;
494 }
495 
496 OUString SvxLineEndToolBoxControl::getImplementationName()
497 {
498  return "com.sun.star.comp.svx.LineEndToolBoxControl";
499 }
500 
501 css::uno::Sequence<OUString> SvxLineEndToolBoxControl::getSupportedServiceNames()
502 {
503  return { "com.sun.star.frame.ToolbarController" };
504 }
505 
506 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
508  css::uno::XComponentContext* rContext,
509  css::uno::Sequence<css::uno::Any> const & )
510 {
511  return cppu::acquire( new SvxLineEndToolBoxControl( rContext ) );
512 }
513 
514 SvxLineBox::SvxLineBox(SvxLineStyleToolBoxControl* pControl, weld::Widget* pParent, int nInitialIndex)
515  : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "svx/ui/floatinglinestyle.ui", "FloatingLineStyle")
516  , mxControl(pControl)
517  , mxLineStyleSet(new ValueSet(m_xBuilder->weld_scrolled_window("valuesetwin", true)))
518  , mxLineStyleSetWin(new weld::CustomWeld(*m_xBuilder, "valueset", *mxLineStyleSet))
519 {
521 
522  FillControl();
523 
524  mxLineStyleSet->SelectItem(nInitialIndex + 1);
525 
526  mxLineStyleSet->SetSelectHdl( LINK( this, SvxLineBox, SelectHdl ) );
527 }
528 
530 {
531  mxLineStyleSet->GrabFocus();
532 }
533 
535 {
536 }
537 
538 // Fills the listbox (provisional) with strings
539 
540 void SvxLineBox::Fill( const XDashListRef &pList )
541 {
542  mxLineStyleSet->Clear();
543 
544  if( !pList.is() )
545  return;
546 
547  // entry for 'none'
548  mxLineStyleSet->InsertItem(1, Image(), pList->GetStringForUiNoLine());
549 
550  // entry for solid line
551  auto aBmp = pList->GetBitmapForUISolidLine();
552  Size aBmpSize = aBmp.GetSizePixel();
553  mxLineStyleSet->InsertItem(2, Image(aBmp), pList->GetStringForUiSolidLine());
554 
555  // entries for dashed lines
556  tools::Long nCount = pList->Count();
557  for( tools::Long i = 0; i < nCount; i++ )
558  {
559  const XDashEntry* pEntry = pList->GetDash(i);
560  const BitmapEx aBitmap = pList->GetUiBitmap(i);
561 
562  mxLineStyleSet->InsertItem(i + 3, Image(aBitmap), pEntry->GetName());
563  }
564 
565  sal_uInt16 nLines = std::min( static_cast<sal_uInt16>(nCount + 2), sal_uInt16(MAX_LINES) );
566  mxLineStyleSet->SetLineCount(nLines);
567 
568  WinBits nBits = mxLineStyleSet->GetStyle();
569  if ( nLines == mxLineStyleSet->GetItemCount() )
570  nBits &= ~WB_VSCROLL;
571  else
572  nBits |= WB_VSCROLL;
573  mxLineStyleSet->SetStyle( nBits );
574 
575  Size aSize(aBmpSize);
576  aSize.AdjustWidth(6);
577  aSize.AdjustHeight(6);
578  aSize = mxLineStyleSet->CalcWindowSizePixel(aSize);
579  mxLineStyleSet->GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height());
580  mxLineStyleSet->SetOutputSizePixel(aSize);
581 }
582 
584 {
585  drawing::LineStyle eXLS;
586  sal_Int32 nPos = mxLineStyleSet->GetSelectedItemId();
587  --nPos; // ids start at 1, get the pos of the id
588 
589  switch ( nPos )
590  {
591  case 0:
592  eXLS = drawing::LineStyle_NONE;
593  break;
594 
595  case 1:
596  eXLS = drawing::LineStyle_SOLID;
597  break;
598 
599  default:
600  {
601  eXLS = drawing::LineStyle_DASH;
602 
603  if ( nPos != -1 &&
605  SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) )
606  {
607  // LineDashItem will only be sent if it also has a dash.
608  // Notify cares!
609  SvxDashListItem const * pItem = SfxObjectShell::Current()->GetItem( SID_DASH_LIST );
610  const XDashEntry* pEntry = pItem->GetDashList()->GetDash(nPos - 2);
611  XLineDashItem aLineDashItem(pEntry->GetName(), pEntry->GetDash());
612 
613  Any a;
614  aLineDashItem.QueryValue ( a );
615  Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("LineDash", a) };
616  mxControl->dispatchLineStyleCommand(".uno:LineDash", aArgs);
617 
618  // set also cap style using the toolbar line style selection popup
619  css::drawing::DashStyle eStyle = pEntry->GetDash().GetDashStyle();
620  XLineCapItem aLineCapItem(
621  eStyle == drawing::DashStyle_RECT || eStyle == drawing::DashStyle_RECTRELATIVE
622  ? css::drawing::LineCap_BUTT
623  : css::drawing::LineCap_ROUND );
624  aLineCapItem.QueryValue ( a );
625  Sequence< PropertyValue > aArgs2{ comphelper::makePropertyValue("LineCap", a) };
626  mxControl->dispatchLineStyleCommand(".uno:LineCap", aArgs2);
627  }
628  }
629  break;
630  }
631 
632  XLineStyleItem aLineStyleItem( eXLS );
633  Any a;
634  aLineStyleItem.QueryValue ( a );
635  Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("XLineStyle", a) };
636  mxControl->dispatchLineStyleCommand(".uno:XLineStyle", aArgs);
637 
638  mxControl->EndPopupMode();
639 }
640 
642 {
644  if (pSh)
645  {
646  const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST );
647  if (pItem)
648  Fill(pItem->GetDashList());
649  }
650 }
651 
652 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~SvxLineBox() override
Definition: linectrl.cxx:534
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
bool Erase(const Color &rFillColor)
sal_Int32 nIndex
LineStyleSelectFunction m_aLineStyleSelectFunction
Definition: linectrl.hxx:43
ToolBoxItemBits GetItemBits(ToolBoxItemId nItemId) const
virtual OUString SAL_CALL getImplementationName() override=0
virtual VclPtr< vcl::Window > createVclPopupWindow(vcl::Window *pParent)
const SfxPoolItem * GetItem(const SwTextAttr &rAttr, sal_uInt16 nWhich)
long Long
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
static const AllSettings & GetSettings()
std::unique_ptr< ToolbarPopupContainer > mxPopoverContainer
sal_Int16 nId
static SfxObjectShell * Current()
WinBits const WB_VSCROLL
void Fill(const XDashListRef &pList)
Definition: linectrl.cxx:540
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: linectrl.cxx:215
void FillControl()
Definition: linectrl.cxx:641
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 &)
Definition: linectrl.cxx:507
Value
constexpr tools::Long Width() const
weld::Window * GetFrameWeld() const
void setLineStyleIsNoneFunction(const LineStyleIsNoneFunction &aLineStyleIsNoneFunction)
Definition: linectrl.cxx:182
IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet *, void)
Definition: linectrl.cxx:306
sal_Int64 WinBits
std::function< void(bool)> LineStyleIsNoneFunction
Definition: linectrl.hxx:35
#define WB_ITEMBORDER
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)
void SetItemBits(ToolBoxItemId nItemId, ToolBoxItemBits nBits)
int nCount
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
virtual void statusChanged(const css::frame::FeatureStateEvent &Event)
css::drawing::DashStyle GetDashStyle() const
Definition: xdash.hxx:54
const XDash & GetDash() const
Definition: xtable.hxx:80
std::unique_ptr< svx::ToolboxButtonLineStyleUpdater > m_xBtnUpdater
Definition: linectrl.hxx:41
std::unique_ptr< ValueSet > mxLineStyleSet
Definition: itemwin.hxx:34
const OUString & GetName() const
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
bool IsEmpty() const
void setLineStyleSelectFunction(const LineStyleSelectFunction &aLineStyleSelectFunction)
Definition: linectrl.cxx:177
SvxLineStyleToolBoxControl(const css::uno::Reference< css::uno::XComponentContext > &rContext)
Definition: linectrl.cxx:62
const XDashListRef & GetDashList() const
Definition: drawitem.hxx:171
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
Definition: linectrl.cxx:157
constexpr OStringLiteral HID_POPUP_LINEEND
Definition: helpids.h:39
#define DBG_ASSERT(sCon, aError)
int i
uno_Any a
#define MAX_LINES
Definition: linectrl.cxx:60
void SetItemImage(ToolBoxItemId nItemId, const Image &rImage)
virtual std::unique_ptr< WeldToolbarPopup > weldPopupWindow()=0
LineStyleIsNoneFunction m_aLineStyleIsNoneFunction
Definition: linectrl.hxx:44
std::function< bool(const OUString &, const css::uno::Any &)> LineStyleSelectFunction
Definition: linectrl.hxx:32
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:386
SvxLineBox(SvxLineStyleToolBoxControl *pControl, weld::Widget *pParent, int nInitialIndex)
Definition: linectrl.cxx:514
VclPtr< InterimToolbarPopup > mxInterimPopover
virtual VclPtr< vcl::Window > createVclPopupWindow(vcl::Window *pParent) override
Definition: linectrl.cxx:200
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &rEvent) override
Definition: linectrl.cxx:72
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr2.cxx:281
void EnableItem(ToolBoxItemId nItemId, bool bEnable=true)
WinBits const WB_3DLOOK
const basegfx::B2DPolyPolygon & GetLineEnd() const
Definition: xtable.hxx:65
constexpr sal_uInt16 gnCols
Definition: linectrl.cxx:275
virtual std::unique_ptr< WeldToolbarPopup > weldPopupWindow() override
Definition: linectrl.cxx:195
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 &)
Definition: linectrl.cxx:221
#define WB_NO_DIRECTSELECT
virtual void GrabFocus() override
Definition: linectrl.cxx:529
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override=0
constexpr tools::Long Height() const
tools::Long AdjustWidth(tools::Long n)
static VclPtr< reference_type > Create(Arg &&...arg)
virtual void SAL_CALL execute(sal_Int16 nKeyModifier) override
Definition: linectrl.cxx:142
const char * name
void dispatchLineStyleCommand(const OUString &rCommand, const css::uno::Sequence< css::beans::PropertyValue > &rArgs)
Definition: linectrl.cxx:187
tools::Long AdjustHeight(tools::Long n)
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
virtual OUString SAL_CALL getImplementationName() override
Definition: linectrl.cxx:210
#define WB_FLATVALUESET
const Size & GetSizePixel() const
virtual void GrabFocus()=0
sal_uInt16 nPos
constexpr OStringLiteral HID_POPUP_LINEEND_CTRL
Definition: helpids.h:40
OUString sId
OUString aId
virtual ~SvxLineStyleToolBoxControl() override
Definition: linectrl.cxx:68