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>
50 
51 using namespace ::com::sun::star::uno;
52 using namespace ::com::sun::star::beans;
53 using namespace ::com::sun::star::util;
54 using namespace ::com::sun::star::frame;
55 using namespace ::com::sun::star::lang;
56 using namespace ::com::sun::star;
57 
58 // For End Line Controller
59 #define MAX_LINES 12
60 
61 SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext )
62  : svt::PopupWindowController( rContext, nullptr, OUString() )
63 {
64  addStatusListener(".uno:LineDash");
65 }
66 
68 {
69 }
70 
71 void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( const frame::FeatureStateEvent& rEvent )
72 {
73  ToolBox* pToolBox = nullptr;
75  if (!getToolboxId(nId, &pToolBox) && !m_pToolbar)
76  return;
77 
78  OString sId(m_aCommandURL.toUtf8());
79 
80  if ( rEvent.FeatureURL.Complete == m_aCommandURL )
81  {
82  if (m_pToolbar)
83  m_pToolbar->set_item_sensitive(sId, rEvent.IsEnabled);
84  else
85  pToolBox->EnableItem( nId, rEvent.IsEnabled );
86  }
87 
88  m_xBtnUpdater->Update(rEvent);
89 
91  if (!pSh)
92  return;
93 
94  const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST );
95  if (!pItem)
96  return;
97 
98  XDashListRef xList = pItem->GetDashList();
99  int nIndex = m_xBtnUpdater->GetStyleIndex();
100  bool bNoneLineStyle = false;
101  switch (nIndex)
102  {
103  case -1:
104  case 0:
105  {
106  BitmapEx aEmpty(xList->GetBitmapForUISolidLine());
107  aEmpty.Erase(Application::GetSettings().GetStyleSettings().GetFieldColor());
108  if (m_pToolbar)
109  {
110  Graphic aGraf(aEmpty);
111  m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
112  }
113  else
114  pToolBox->SetItemImage(nId, Image(aEmpty));
115  bNoneLineStyle = true;
116  break;
117  }
118  case 1:
119  if (m_pToolbar)
120  {
121  Graphic aGraf(xList->GetBitmapForUISolidLine());
122  m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
123  }
124  else
125  pToolBox->SetItemImage(nId, Image(xList->GetBitmapForUISolidLine()));
126  break;
127  default:
128  if (m_pToolbar)
129  {
130  Graphic aGraf(xList->GetUiBitmap(nIndex - 2));
131  m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
132  }
133  else
134  pToolBox->SetItemImage(nId, Image(xList->GetUiBitmap(nIndex - 2)));
135  break;
136  }
138  m_aLineStyleIsNoneFunction(bNoneLineStyle);
139 }
140 
141 void SAL_CALL SvxLineStyleToolBoxControl::execute(sal_Int16 /*KeyModifier*/)
142 {
143  if (m_pToolbar)
144  {
145  // Toggle the popup also when toolbutton is activated
146  const OString aId(m_aCommandURL.toUtf8());
147  m_pToolbar->set_menu_item_active(aId, !m_pToolbar->get_menu_item_active(aId));
148  }
149  else
150  {
151  // Open the popup also when Enter key is pressed.
153  }
154 }
155 
156 void SvxLineStyleToolBoxControl::initialize( const css::uno::Sequence<css::uno::Any>& rArguments )
157 {
158  svt::PopupWindowController::initialize( rArguments );
159 
160  if (m_pToolbar)
161  {
162  mxPopoverContainer.reset(new ToolbarPopupContainer(m_pToolbar));
163  m_pToolbar->set_item_popover(m_aCommandURL.toUtf8(), mxPopoverContainer->getTopLevel());
164  }
165 
166  ToolBox* pToolBox = nullptr;
168  if ( getToolboxId( nId, &pToolBox ) )
169  {
170  pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY );
171  }
172 
174 }
175 
177 {
178  m_aLineStyleSelectFunction = rLineStyleSelectFunction;
179 }
180 
182 {
183  m_aLineStyleIsNoneFunction = rLineStyleIsNoneFunction;
184 }
185 
186 void SvxLineStyleToolBoxControl::dispatchLineStyleCommand(const OUString& rCommand, const Sequence<PropertyValue>& rArgs)
187 {
189  return;
190 
191  dispatchCommand(rCommand, rArgs);
192 }
193 
194 std::unique_ptr<WeldToolbarPopup> SvxLineStyleToolBoxControl::weldPopupWindow()
195 {
196  return std::make_unique<SvxLineBox>(this, m_pToolbar, m_xBtnUpdater->GetStyleIndex());
197 }
198 
200 {
201  mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent,
202  std::make_unique<SvxLineBox>(this, pParent->GetFrameWeld(), m_xBtnUpdater->GetStyleIndex()));
203 
204  mxInterimPopover->Show();
205 
206  return mxInterimPopover;
207 }
208 
210 {
211  return "com.sun.star.comp.svx.LineStyleToolBoxControl";
212 }
213 
215 {
216  return { "com.sun.star.frame.ToolbarController" };
217 }
218 
219 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
221  css::uno::XComponentContext* rContext,
222  css::uno::Sequence<css::uno::Any> const & )
223 {
224  return cppu::acquire( new SvxLineStyleToolBoxControl( rContext ) );
225 }
226 
227 namespace {
228 
229 class SvxLineEndToolBoxControl final : public svt::PopupWindowController
230 {
231 public:
232  explicit SvxLineEndToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
233 
234  // XInitialization
235  virtual void SAL_CALL initialize( const css::uno::Sequence<css::uno::Any>& rArguments ) override;
236 
237  // XServiceInfo
238  virtual OUString SAL_CALL getImplementationName() override;
239  virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
240 
241  virtual void SAL_CALL execute(sal_Int16 nKeyModifier) override;
242 
243 private:
244  virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override;
245  virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override;
246 };
247 
248 class SvxLineEndWindow final : public WeldToolbarPopup
249 {
250 private:
251  XLineEndListRef mpLineEndList;
253  std::unique_ptr<ValueSet> mxLineEndSet;
254  std::unique_ptr<weld::CustomWeld> mxLineEndSetWin;
255  sal_uInt16 mnLines;
256  Size maBmpSize;
257 
258  DECL_LINK( SelectHdl, ValueSet*, void );
259  void FillValueSet();
260  void SetSize();
261 
262  virtual void GrabFocus() override
263  {
264  mxLineEndSet->GrabFocus();
265  }
266 
267 public:
268  SvxLineEndWindow(SvxLineEndToolBoxControl* pControl, weld::Widget* pParent);
269  virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
270 };
271 
272 }
273 
274 constexpr sal_uInt16 gnCols = 2;
275 
276 SvxLineEndWindow::SvxLineEndWindow(SvxLineEndToolBoxControl* pControl, weld::Widget* pParent)
277  : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "svx/ui/floatinglineend.ui", "FloatingLineEnd")
278  , mxControl(pControl)
279  , mxLineEndSet(new ValueSet(m_xBuilder->weld_scrolled_window("valuesetwin", true)))
280  , mxLineEndSetWin(new weld::CustomWeld(*m_xBuilder, "valueset", *mxLineEndSet))
281  , mnLines(12)
282 {
283  mxLineEndSet->SetStyle(mxLineEndSet->GetStyle() | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT);
284  mxLineEndSet->SetHelpId(HID_POPUP_LINEEND_CTRL);
285  m_xTopLevel->set_help_id(HID_POPUP_LINEEND);
286 
288  if ( pDocSh )
289  {
290  const SfxPoolItem* pItem = pDocSh->GetItem( SID_LINEEND_LIST );
291  if( pItem )
292  mpLineEndList = static_cast<const SvxLineEndListItem*>( pItem )->GetLineEndList();
293  }
294  DBG_ASSERT( mpLineEndList.is(), "LineEndList not found" );
295 
296  mxLineEndSet->SetSelectHdl( LINK( this, SvxLineEndWindow, SelectHdl ) );
297  mxLineEndSet->SetColCount( gnCols );
298 
299  // ValueSet fill with entries of LineEndList
300  FillValueSet();
301 
302  AddStatusListener( ".uno:LineEndListState");
303 }
304 
305 IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, void)
306 {
307  std::unique_ptr<XLineEndItem> pLineEndItem;
308  std::unique_ptr<XLineStartItem> pLineStartItem;
309  sal_uInt16 nId = mxLineEndSet->GetSelectedItemId();
310 
311  if( nId == 1 )
312  {
313  pLineStartItem.reset(new XLineStartItem());
314  }
315  else if( nId == 2 )
316  {
317  pLineEndItem.reset(new XLineEndItem());
318  }
319  else if( nId % 2 ) // beginning of line
320  {
321  const XLineEndEntry* pEntry = mpLineEndList->GetLineEnd( (nId - 1) / 2 - 1 );
322  pLineStartItem.reset(new XLineStartItem(pEntry->GetName(), pEntry->GetLineEnd()));
323  }
324  else // end of line
325  {
326  const XLineEndEntry* pEntry = mpLineEndList->GetLineEnd( nId / 2 - 2 );
327  pLineEndItem.reset(new XLineEndItem(pEntry->GetName(), pEntry->GetLineEnd()));
328  }
329 
330  Sequence< PropertyValue > aArgs( 1 );
331  Any a;
332 
333  if ( pLineStartItem )
334  {
335  aArgs[0].Name = "LineStart";
336  pLineStartItem->QueryValue( a );
337  aArgs[0].Value = a;
338  }
339  else
340  {
341  aArgs[0].Name = "LineEnd";
342  pLineEndItem->QueryValue( a );
343  aArgs[0].Value = a;
344  }
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  Sequence< PropertyValue > aArgs( 1 );
615  aArgs[0].Name = "LineDash";
616  aLineDashItem.QueryValue ( a );
617  aArgs[0].Value = a;
618  mxControl->dispatchLineStyleCommand(".uno:LineDash", aArgs);
619 
620  // set also cap style using the toolbar line style selection popup
621  css::drawing::DashStyle eStyle = pEntry->GetDash().GetDashStyle();
622  XLineCapItem aLineCapItem(
623  eStyle == drawing::DashStyle_RECT || eStyle == drawing::DashStyle_RECTRELATIVE
624  ? css::drawing::LineCap_BUTT
625  : css::drawing::LineCap_ROUND );
626  Sequence< PropertyValue > aArgs2( 1 );
627  aArgs2[0].Name = "LineCap";
628  aLineCapItem.QueryValue ( a );
629  aArgs2[0].Value = a;
630  mxControl->dispatchLineStyleCommand(".uno:LineCap", aArgs2);
631  }
632  }
633  break;
634  }
635 
636  XLineStyleItem aLineStyleItem( eXLS );
637  Any a;
638  Sequence< PropertyValue > aArgs( 1 );
639  aArgs[0].Name = "XLineStyle";
640  aLineStyleItem.QueryValue ( a );
641  aArgs[0].Value = a;
642  mxControl->dispatchLineStyleCommand(".uno:XLineStyle", aArgs);
643 
644  mxControl->EndPopupMode();
645 }
646 
648 {
650  if (pSh)
651  {
652  const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST );
653  if (pItem)
654  Fill(pItem->GetDashList());
655  }
656 }
657 
658 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~SvxLineBox() override
Definition: linectrl.cxx:534
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
const SfxPoolItem * GetItem(const SwTextAttr &rAttr, sal_uInt16 nWhich)
long Long
static const AllSettings & GetSettings()
std::unique_ptr< ToolbarPopupContainer > mxPopoverContainer
sal_Int16 nId
OUString aId
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:214
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
void FillControl()
Definition: linectrl.cxx:647
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:181
IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet *, void)
Definition: linectrl.cxx:305
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
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
#define HID_POPUP_LINEEND
Definition: helpids.h:37
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
bool IsEmpty() const
void setLineStyleSelectFunction(const LineStyleSelectFunction &aLineStyleSelectFunction)
Definition: linectrl.cxx:176
SvxLineStyleToolBoxControl(const css::uno::Reference< css::uno::XComponentContext > &rContext)
Definition: linectrl.cxx:61
const XDashListRef & GetDashList() const
Definition: drawitem.hxx:171
OUString SvxResId(std::string_view aId)
Definition: dialmgr.cxx:25
virtual std::unique_ptr< WeldToolbarPopup > weldPopupWindow()
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
Definition: linectrl.cxx:156
#define DBG_ASSERT(sCon, aError)
int i
uno_Any a
#define MAX_LINES
Definition: linectrl.cxx:59
void SetItemImage(ToolBoxItemId nItemId, const Image &rImage)
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 VclPtr< vcl::Window > createVclPopupWindow(vcl::Window *pParent)=0
DECL_LINK(FocusHdl, weld::Widget &, void)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:375
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:199
#define HID_POPUP_LINEEND_CTRL
Definition: helpids.h:38
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &rEvent) override
Definition: linectrl.cxx:71
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:274
virtual std::unique_ptr< WeldToolbarPopup > weldPopupWindow() override
Definition: linectrl.cxx:194
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:220
#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:141
void dispatchLineStyleCommand(const OUString &rCommand, const css::uno::Sequence< css::beans::PropertyValue > &rArgs)
Definition: linectrl.cxx:186
tools::Long AdjustHeight(tools::Long n)
OUString sId
virtual OUString SAL_CALL getImplementationName() override
Definition: linectrl.cxx:209
#define WB_FLATVALUESET
const Size & GetSizePixel() const
virtual void GrabFocus()=0
sal_uInt16 nPos
virtual ~SvxLineStyleToolBoxControl() override
Definition: linectrl.cxx:67