LibreOffice Module svx (master)  1
fontworkgallery.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 
21 #include <com/sun/star/text/WritingMode.hpp>
22 
23 #include <vcl/toolbox.hxx>
24 #include <vcl/settings.hxx>
25 #include <vcl/virdev.hxx>
26 
27 #include <svl/itempool.hxx>
28 
29 #include <svtools/toolbarmenu.hxx>
32 
33 #include <sfx2/app.hxx>
34 #include <sfx2/dispatch.hxx>
35 
36 #include <editeng/eeitem.hxx>
37 #include <editeng/frmdiritem.hxx>
38 
39 #include <svx/fmmodel.hxx>
40 #include <svx/svxids.hrc>
41 #include <svx/dialmgr.hxx>
42 #include <svx/strings.hrc>
43 #include <svx/svdpage.hxx>
44 #include <svx/svdobj.hxx>
45 #include <svx/svdview.hxx>
46 #include <svx/svdoutl.hxx>
47 
48 #include <svx/gallery.hxx>
49 #include <svx/dlgutil.hxx>
50 #include <svx/fontworkgallery.hxx>
51 
52 #include <algorithm>
53 #include <memory>
54 
55 #include <bitmaps.hlst>
56 
57 using ::svtools::ToolbarMenu;
58 
59 using namespace ::com::sun::star::uno;
60 using namespace ::com::sun::star::lang;
61 using namespace ::com::sun::star::beans;
62 
63 namespace svx
64 {
65 
66 const int nColCount = 4;
67 const int nLineCount = 4;
68 
70  : GenericDialogController(pParent, "svx/ui/fontworkgallerydialog.ui", "FontworkGalleryDialog")
71  , mnThemeId(0xffff)
72  , mrSdrView(rSdrView)
73  , mppSdrObject(nullptr)
74  , mpDestModel(nullptr)
75  , maCtlFavorites(m_xBuilder->weld_scrolled_window("ctlFavoriteswin"))
76  , mxCtlFavorites(new weld::CustomWeld(*m_xBuilder, "ctlFavorites", maCtlFavorites))
77  , mxOKButton(m_xBuilder->weld_button("ok"))
78 {
79  Size aSize(maCtlFavorites.GetDrawingArea()->get_ref_device().LogicToPixel(Size(200, 200), MapMode(MapUnit::MapAppFont)));
80  mxCtlFavorites->set_size_request(aSize.Width(), aSize.Height());
81 
82  maCtlFavorites.SetDoubleClickHdl( LINK( this, FontWorkGalleryDialog, DoubleClickFavoriteHdl ) );
83  mxOKButton->connect_clicked(LINK(this, FontWorkGalleryDialog, ClickOKHdl));
84 
85  maCtlFavorites.SetColCount( nColCount );
86  maCtlFavorites.SetLineCount( nLineCount );
88 
91 }
92 
94 {
95 }
96 
97 void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId)
98 {
99  // the favorites are read via the gallery
100  sal_uInt32 nFavCount = GalleryExplorer::GetSdrObjCount( nThemeId );
101 
102  // lock gallery theme
104 
105  sal_uInt32 nModelPos;
106  FmFormModel *pModel = nullptr;
107 
108  for( nModelPos = 0; nModelPos < nFavCount; nModelPos++ )
109  {
110  BitmapEx aThumb;
111 
112  if (GalleryExplorer::GetSdrObj(nThemeId, nModelPos, pModel, &aThumb) && !!aThumb)
113  {
115  const Point aNull(0, 0);
116 
117  if (pVDev->GetDPIScaleFactor() > 1)
118  aThumb.Scale(pVDev->GetDPIScaleFactor(), pVDev->GetDPIScaleFactor());
119 
120  const Size aSize(aThumb.GetSizePixel());
121 
122  pVDev->SetOutputSizePixel(aSize);
123 
124  static const sal_uInt32 nLen(8);
125  static const Color aW(COL_WHITE);
126  static const Color aG(0xef, 0xef, 0xef);
127 
128  pVDev->DrawCheckered(aNull, aSize, nLen, aW, aG);
129 
130  pVDev->DrawBitmapEx(aNull, aThumb);
131  maFavoritesHorizontal.emplace_back(pVDev->GetBitmapEx(aNull, aSize));
132  }
133  }
134 
135  // release gallery theme
136  GalleryExplorer::EndLocking(nThemeId);
137 }
138 
139 void FontWorkGalleryDialog::fillFavorites(sal_uInt16 nThemeId)
140 {
141  mnThemeId = nThemeId;
142 
143  Size aThumbSize(maCtlFavorites.GetOutputSizePixel());
144  aThumbSize.setWidth( aThumbSize.Width() / nColCount );
145  aThumbSize.setHeight( aThumbSize.Height() / nLineCount );
146  aThumbSize.AdjustWidth( -12 );
147  aThumbSize.AdjustHeight( -12 );
148 
149  auto nFavCount = maFavoritesHorizontal.size();
150 
151  // ValueSet favorites
152  if( nFavCount > (nColCount * nLineCount) )
153  {
154  WinBits nWinBits = maCtlFavorites.GetStyle();
155  nWinBits |= WB_VSCROLL;
156  maCtlFavorites.SetStyle( nWinBits );
157  }
158 
160 
161  for( size_t nFavorite = 1; nFavorite <= nFavCount; nFavorite++ )
162  {
163  OUString aStr = SvxResId(RID_SVXFLOAT3D_FAVORITE) + " " + OUString::number(nFavorite);
164  Image aThumbImage( maFavoritesHorizontal[nFavorite-1] );
165  maCtlFavorites.InsertItem( static_cast<sal_uInt16>(nFavorite), aThumbImage, aStr );
166  }
167 
170 }
171 
173 {
174  mppSdrObject = ppSdrObject;
175  mpDestModel = pModel;
176 }
177 
179 {
180  sal_uInt16 nItemId = maCtlFavorites.GetSelectedItemId();
181 
182  if( nItemId > 0 )
183  {
184  std::unique_ptr<FmFormModel> pModel(new FmFormModel());
185  pModel->GetItemPool().FreezeIdRanges();
186 
187  if( GalleryExplorer::GetSdrObj( mnThemeId, nItemId-1, pModel.get() ) )
188  {
189  SdrPage* pPage = pModel->GetPage(0);
190  if( pPage && pPage->GetObjCount() )
191  {
192  // tdf#116993 Calc uses a 'special' mode for this dialog in being the
193  // only caller of ::SetSdrObjectRef. Only in that case mpDestModel seems
194  // to be the correct target SdrModel.
195  // If this is not used, the correct SdrModel seems to be the one from
196  // the mrSdrView that is used to insert (InsertObjectAtView below) the
197  // cloned SdrObject.
198  const bool bUseSpecialCalcMode(nullptr != mppSdrObject && nullptr != mpDestModel);
199 
200  // center shape on current view
202 
203  if (pOutDev)
204  {
205  // Clone directly to target SdrModel (may be different due to user/caller (!))
206  SdrObject* pNewObject(
207  pPage->GetObj(0)->CloneSdrObject(
208  bUseSpecialCalcMode ? *mpDestModel : mrSdrView.getSdrModelFromSdrView()));
209 
210  // tdf#117629
211  // Since the 'old' ::CloneSdrObject also copies the SdrPage* the
212  // SdrObject::getUnoShape() *will* create the wrong UNO API object
213  // early. This IS one of the reasons I do change these things - this
214  // error does not happen with my next change I am working on already
215  // ARGH! For now, reset the SdrPage* to nullptr.
216  // What sense does it have to copy the SdrPage* of the original SdrObject ?!?
217  // TTTT: This also *might* be the hidden reason for the strange code at the
218  // end of SdrObject::SetPage that tries to delete the SvxShape under some
219  // circumstances...
220  // pNewObject->SetPage(nullptr);
221 
222  tools::Rectangle aObjRect( pNewObject->GetLogicRect() );
223  tools::Rectangle aVisArea = pOutDev->PixelToLogic(tools::Rectangle(Point(0,0), pOutDev->GetOutputSizePixel()));
224  Point aPagePos = aVisArea.Center();
225  aPagePos.AdjustX( -(aObjRect.GetWidth() / 2) );
226  aPagePos.AdjustY( -(aObjRect.GetHeight() / 2) );
227  tools::Rectangle aNewObjectRectangle(aPagePos, aObjRect.GetSize());
228  pNewObject->SetLogicRect(aNewObjectRectangle);
229 
230  if (bUseSpecialCalcMode)
231  {
232  *mppSdrObject = pNewObject;
233  }
234  else
235  {
237 
238  if (nullptr != pPV)
239  {
240  mrSdrView.InsertObjectAtView( pNewObject, *pPV );
241  }
242  else
243  {
244  // tdf#116993 no target -> delete clone
245  SdrObject::Free(pNewObject);
246  }
247  }
248  }
249  }
250  }
251  }
252 }
253 
255 {
256  insertSelectedFontwork();
257  m_xDialog->response(RET_OK);
258 }
259 
260 IMPL_LINK_NOARG(FontWorkGalleryDialog, DoubleClickFavoriteHdl, SvtValueSet*, void)
261 {
262  insertSelectedFontwork();
263  m_xDialog->response(RET_OK);
264 }
265 
266 namespace {
267 
268 class FontworkAlignmentWindow : public ToolbarMenu
269 {
270 public:
271  FontworkAlignmentWindow( svt::ToolboxController& rController, vcl::Window* pParentWindow );
272 
273  virtual void statusChanged( const css::frame::FeatureStateEvent& Event ) override;
274 
275 private:
277 
278  DECL_LINK( SelectHdl, ToolbarMenu*, void );
279 
280  void implSetAlignment( int nAlignmentMode, bool bEnabled );
281 };
282 
283 }
284 
285 static const OUStringLiteral gsFontworkAlignment(".uno:FontworkAlignment");
286 
287 FontworkAlignmentWindow::FontworkAlignmentWindow(svt::ToolboxController& rController, vcl::Window* pParentWindow)
288  : ToolbarMenu(rController.getFrameInterface(), pParentWindow, WB_STDPOPUP)
289  , mrController(rController)
290 {
291  SetSelectHdl( LINK( this, FontworkAlignmentWindow, SelectHdl ) );
292 
293  Image aImgAlgin1(StockImage::Yes, RID_SVXBMP_FONTWORK_ALIGN_LEFT);
294  Image aImgAlgin2(StockImage::Yes, RID_SVXBMP_FONTWORK_ALIGN_CENTER);
295  Image aImgAlgin3(StockImage::Yes, RID_SVXBMP_FONTWORK_ALIGN_RIGHT);
296  Image aImgAlgin4(StockImage::Yes, RID_SVXBMP_FONTWORK_ALIGN_WORD);
297  Image aImgAlgin5(StockImage::Yes, RID_SVXBMP_FONTWORK_ALIGN_STRETCH);
298 
299  appendEntry(0, SvxResId(RID_SVXSTR_ALIGN_LEFT), aImgAlgin1);
300  appendEntry(1, SvxResId(RID_SVXSTR_ALIGN_CENTER), aImgAlgin2);
301  appendEntry(2, SvxResId(RID_SVXSTR_ALIGN_RIGHT), aImgAlgin3);
302  appendEntry(3, SvxResId(RID_SVXSTR_ALIGN_WORD), aImgAlgin4);
303  appendEntry(4, SvxResId(RID_SVXSTR_ALIGN_STRETCH), aImgAlgin5);
304 
305  SetOutputSizePixel( getMenuSize() );
306 
307  AddStatusListener( gsFontworkAlignment );
308 }
309 
310 void FontworkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled )
311 {
312  int i;
313  for( i = 0; i < 5; i++ )
314  {
315  checkEntry( i, (i == nSurface) && bEnabled );
316  enableEntry( i, bEnabled );
317  }
318 }
319 
320 void FontworkAlignmentWindow::statusChanged( const css::frame::FeatureStateEvent& Event )
321 {
322  if( Event.FeatureURL.Main == gsFontworkAlignment )
323  {
324  if( !Event.IsEnabled )
325  {
326  implSetAlignment( 0, false );
327  }
328  else
329  {
330  sal_Int32 nValue = 0;
331  if( Event.State >>= nValue )
332  implSetAlignment( nValue, true );
333  }
334  }
335 }
336 
337 IMPL_LINK_NOARG(FontworkAlignmentWindow, SelectHdl, ToolbarMenu*, void)
338 {
339  if ( IsInPopupMode() )
340  EndPopupMode();
341 
342  sal_Int32 nAlignment = getSelectedEntryId();
343  if( nAlignment >= 0 )
344  {
345  Sequence< PropertyValue > aArgs( 1 );
346  aArgs[0].Name = OUString(gsFontworkAlignment).copy(5);
347  aArgs[0].Value <<= nAlignment;
348 
349  mrController.dispatchCommand( gsFontworkAlignment, aArgs );
350 
351  implSetAlignment( nAlignment, true );
352  }
353 }
354 
355 namespace {
356 
357 class FontworkAlignmentControl : public svt::PopupWindowController
358 {
359 public:
360  explicit FontworkAlignmentControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
361 
362  virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override;
363 
364  // XInitialization
365  virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
366 
367  // XServiceInfo
368  virtual OUString SAL_CALL getImplementationName() override;
369  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
370 
372 };
373 
374 }
375 
376 FontworkAlignmentControl::FontworkAlignmentControl( const Reference< XComponentContext >& rxContext )
377 : svt::PopupWindowController( rxContext, Reference< css::frame::XFrame >(), ".uno:FontworkAlignment" )
378 {
379 }
380 
381 
382 VclPtr<vcl::Window> FontworkAlignmentControl::createPopupWindow( vcl::Window* pParent )
383 {
384  return VclPtr<FontworkAlignmentWindow>::Create( *this, pParent );
385 }
386 
387 // XInitialization
388 void SAL_CALL FontworkAlignmentControl::initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
389 {
390  svt::PopupWindowController::initialize( aArguments );
391 
392  ToolBox* pToolBox = nullptr;
393  sal_uInt16 nId = 0;
394  if ( getToolboxId( nId, &pToolBox ) )
395  pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY );
396 }
397 
398 // XServiceInfo
399 
400 
401 OUString FontworkAlignmentControl::getImplementationName()
402 {
403  return "com.sun.star.comp.svx.FontworkAlignmentController";
404 }
405 
406 
407 Sequence< OUString > FontworkAlignmentControl::getSupportedServiceNames()
408 {
409  Sequence<OUString> aSNS { "com.sun.star.frame.ToolbarController" };
410  return aSNS;
411 }
412 
413 
414 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
416  css::uno::XComponentContext* xContext,
417  css::uno::Sequence<css::uno::Any> const &)
418 {
419  return cppu::acquire(new FontworkAlignmentControl(xContext));
420 }
421 
422 namespace {
423 
424 class FontworkCharacterSpacingWindow : public ToolbarMenu
425 {
426 public:
427  FontworkCharacterSpacingWindow( svt::ToolboxController& rController, vcl::Window* pParentWindow );
428 
429  virtual void statusChanged( const css::frame::FeatureStateEvent& Event ) override;
430 private:
432 
433  DECL_LINK( SelectHdl, ToolbarMenu*, void );
434 
435  void implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled );
436  void implSetKernCharacterPairs( bool bEnabled );
437 
438 };
439 
440 }
441 
442 static const OUStringLiteral gsFontworkCharacterSpacing(".uno:FontworkCharacterSpacing");
443 static const OUStringLiteral gsFontworkKernCharacterPairs(".uno:FontworkKernCharacterPairs");
444 
445 FontworkCharacterSpacingWindow::FontworkCharacterSpacingWindow(svt::ToolboxController& rController, vcl::Window* pParentWindow)
446  : ToolbarMenu(rController.getFrameInterface(), pParentWindow, WB_STDPOPUP)
447  , mrController(rController)
448 {
449  SetSelectHdl( LINK( this, FontworkCharacterSpacingWindow, SelectHdl ) );
450 
451  appendEntry(0, SvxResId(RID_SVXSTR_CHARS_SPACING_VERY_TIGHT), MenuItemBits::RADIOCHECK);
452  appendEntry(1, SvxResId(RID_SVXSTR_CHARS_SPACING_TIGHT), MenuItemBits::RADIOCHECK);
453  appendEntry(2, SvxResId(RID_SVXSTR_CHARS_SPACING_NORMAL), MenuItemBits::RADIOCHECK);
454  appendEntry(3, SvxResId(RID_SVXSTR_CHARS_SPACING_LOOSE), MenuItemBits::RADIOCHECK);
455  appendEntry(4, SvxResId(RID_SVXSTR_CHARS_SPACING_VERY_LOOSE), MenuItemBits::RADIOCHECK);
456  appendEntry(5, SvxResId(RID_SVXSTR_CHARS_SPACING_CUSTOM), MenuItemBits::RADIOCHECK);
457  appendSeparator();
458  appendEntry(6, SvxResId(RID_SVXSTR_CHARS_SPACING_KERN_PAIRS), MenuItemBits::CHECKABLE);
459 
460  SetOutputSizePixel( getMenuSize() );
461 
462  AddStatusListener( gsFontworkCharacterSpacing );
463  AddStatusListener( gsFontworkKernCharacterPairs );
464 }
465 
466 void FontworkCharacterSpacingWindow::implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled )
467 {
468  sal_Int32 i;
469  for ( i = 0; i < 6; i++ )
470  {
471  checkEntry( i, false );
472  enableEntry( i, bEnabled );
473  }
474  if ( nCharacterSpacing != -1 )
475  {
476  sal_Int32 nEntry;
477  switch( nCharacterSpacing )
478  {
479  case 80 : nEntry = 0; break;
480  case 90 : nEntry = 1; break;
481  case 100 : nEntry = 2; break;
482  case 120 : nEntry = 3; break;
483  case 150 : nEntry = 4; break;
484  default : nEntry = 5; break;
485  }
486  checkEntry( nEntry, bEnabled );
487  }
488 }
489 
490 
491 void FontworkCharacterSpacingWindow::implSetKernCharacterPairs( bool bEnabled )
492 {
493  enableEntry( 6, bEnabled );
494  checkEntry( 6, bEnabled );
495 }
496 
497 
498 void FontworkCharacterSpacingWindow::statusChanged( const css::frame::FeatureStateEvent& Event )
499 {
500  if( Event.FeatureURL.Main == gsFontworkCharacterSpacing )
501  {
502  if( !Event.IsEnabled )
503  {
504  implSetCharacterSpacing( 0, false );
505  }
506  else
507  {
508  sal_Int32 nValue = 0;
509  if( Event.State >>= nValue )
510  implSetCharacterSpacing( nValue, true );
511  }
512  }
513  else if( Event.FeatureURL.Main == gsFontworkKernCharacterPairs )
514  {
515  if( !Event.IsEnabled )
516  {
517  implSetKernCharacterPairs( false );
518  }
519  else
520  {
521  bool bValue = false;
522  if( Event.State >>= bValue )
523  implSetKernCharacterPairs( true );
524  }
525  }
526 }
527 
528 
529 IMPL_LINK_NOARG(FontworkCharacterSpacingWindow, SelectHdl,ToolbarMenu*, void)
530 {
531  if ( IsInPopupMode() )
532  EndPopupMode();
533 
534  sal_Int32 nSelection = getSelectedEntryId();
535  sal_Int32 nCharacterSpacing;
536  switch( nSelection )
537  {
538  case 0 : nCharacterSpacing = 80; break;
539  case 1 : nCharacterSpacing = 90; break;
540  case 2 : nCharacterSpacing = 100; break;
541  case 3 : nCharacterSpacing = 120; break;
542  case 4 : nCharacterSpacing = 150; break;
543  default : nCharacterSpacing = 100; break;
544  }
545  if ( nSelection == 5 ) // custom spacing
546  {
547  Sequence< PropertyValue > aArgs( 1 );
548  aArgs[0].Name = OUString(gsFontworkCharacterSpacing).copy(5);
549  aArgs[0].Value <<= nCharacterSpacing;
550 
551  mrController.dispatchCommand( ".uno:FontworkCharacterSpacingDialog", aArgs );
552  }
553  else if ( nSelection == 6 ) // KernCharacterPairs
554  {
555  Sequence< PropertyValue > aArgs( 1 );
556  aArgs[0].Name = OUString(gsFontworkKernCharacterPairs).copy(5);
557  aArgs[0].Value <<= true;
558 
559  mrController.dispatchCommand( gsFontworkKernCharacterPairs, aArgs );
560 
561  implSetKernCharacterPairs( true );
562  }
563  else if( nSelection >= 0 )
564  {
565  Sequence< PropertyValue > aArgs( 1 );
566  aArgs[0].Name = OUString(gsFontworkCharacterSpacing).copy(5);
567  aArgs[0].Value <<= nCharacterSpacing;
568 
569  mrController.dispatchCommand( gsFontworkCharacterSpacing, aArgs );
570 
571  implSetCharacterSpacing( nCharacterSpacing, true );
572  }
573 }
574 
575 namespace {
576 
577 class FontworkCharacterSpacingControl : public svt::PopupWindowController
578 {
579 public:
580  explicit FontworkCharacterSpacingControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
581 
582  virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override;
583 
584  // XInitialization
585  virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
586 
587  // XServiceInfo
588  virtual OUString SAL_CALL getImplementationName() override;
589  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
590 
592 };
593 
594 }
595 
596 FontworkCharacterSpacingControl::FontworkCharacterSpacingControl( const Reference< XComponentContext >& rxContext )
597 : svt::PopupWindowController( rxContext, Reference< css::frame::XFrame >(), ".uno:FontworkCharacterSpacingFloater" )
598 {
599 }
600 
601 
602 VclPtr<vcl::Window> FontworkCharacterSpacingControl::createPopupWindow( vcl::Window* pParent )
603 {
604  return VclPtr<FontworkCharacterSpacingWindow>::Create( *this, pParent );
605 }
606 
607 // XInitialization
608 void SAL_CALL FontworkCharacterSpacingControl::initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
609 {
610  svt::PopupWindowController::initialize( aArguments );
611 
612  ToolBox* pToolBox = nullptr;
613  sal_uInt16 nId = 0;
614  if ( getToolboxId( nId, &pToolBox ) )
615  pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY );
616 }
617 
618 // XServiceInfo
619 
620 
621 OUString FontworkCharacterSpacingControl::getImplementationName()
622 {
623  return "com.sun.star.comp.svx.FontworkCharacterSpacingController";
624 }
625 
626 
627 Sequence< OUString > FontworkCharacterSpacingControl::getSupportedServiceNames()
628 {
629  Sequence<OUString> aSNS { "com.sun.star.frame.ToolbarController" };
630  return aSNS;
631 }
632 
633 
634 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
636  css::uno::XComponentContext* xContext,
637  css::uno::Sequence<css::uno::Any> const &)
638 {
639  return cppu::acquire(new FontworkCharacterSpacingControl(xContext));
640 }
641 
642 FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog(weld::Window* pParent, sal_Int32 nScale)
643  : GenericDialogController(pParent, "svx/ui/fontworkspacingdialog.ui", "FontworkSpacingDialog")
644  , m_xMtrScale(m_xBuilder->weld_metric_spin_button("entry", FieldUnit::PERCENT))
645 {
646  m_xMtrScale->set_value(nScale, FieldUnit::PERCENT);
647 }
648 
650 {
651 }
652 
654 {
655  return static_cast<sal_Int32>(m_xMtrScale->get_value(FieldUnit::PERCENT));
656 }
657 
658 }
659 
660 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const int nColCount
FieldUnit
void SetSdrObjectRef(SdrObject **, SdrModel *pModel)
IMPL_LINK_NOARG(SuggestionDisplay, SelectSuggestionValueSetHdl, SvtValueSet *, void)
static sal_uInt32 GetSdrObjCount(const OUString &rThemeName)
Definition: galexpl.cxx:167
long AdjustX(long nHorzMove)
virtual OUString SAL_CALL getImplementationName() override=0
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
ToolBoxItemBits GetItemBits(sal_uInt16 nItemId) const
SlideSorterController & mrController
IMPL_LINK_NOARG(FontworkCharacterSpacingWindow, SelectHdl, ToolbarMenu *, void)
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:773
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override=0
size_t GetObjCount() const
Definition: svdpage.cxx:767
std::unique_ptr< weld::MetricSpinButton > m_xMtrScale
Reference
sal_Int16 nId
static bool BeginLocking(const OUString &rThemeName)
Definition: galexpl.cxx:238
WinBits const WB_VSCROLL
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:423
static bool EndLocking(const OUString &rThemeName)
Definition: galexpl.cxx:263
std::unique_ptr< weld::CustomWeld > mxCtlFavorites
static bool GetSdrObj(const OUString &rThemeName, sal_uInt32 nSdrModelPos, SdrModel *pModel, BitmapEx *pThumb=nullptr)
Definition: galexpl.cxx:196
bool InsertObjectAtView(SdrObject *pObj, SdrPageView &rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE)
Definition: svdedtv.cxx:959
WinBits GetStyle() const
sal_Int64 WinBits
void SetDoubleClickHdl(const Link< SvtValueSet *, void > &rLink)
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
sal_uInt16 GetSelectedItemId() const
sal_Int16 const nValue
Definition: fmsrccfg.cxx:82
void Clear()
OutputDevice * GetFirstOutputDevice() const
Definition: svdpntv.cxx:93
WinBits const WB_STDPOPUP
std::vector< BitmapEx > maFavoritesHorizontal
FontWorkGalleryDialog(weld::Window *pParent, SdrView &rView)
void SetStyle(WinBits nStyle)
void initFavorites(sal_uInt16 nThemeId)
long AdjustY(long nVertMove)
static const OUStringLiteral gsFontworkKernCharacterPairs(".uno:FontworkKernCharacterPairs")
int i
void SetItemBits(sal_uInt16 nItemId, ToolBoxItemBits nBits)
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override
virtual ~FontworkCharacterSpacingDialog() override
virtual void SetLogicRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1658
Abstract DrawObject.
Definition: svdobj.hxx:312
void fillFavorites(sal_uInt16 nThemeId)
void SetExtraSpacing(sal_uInt16 nNewSpacing)
void SetLineCount(sal_uInt16 nNewLines=0)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_FontworkCharacterSpacingControl_get_implementation(css::uno::XComponentContext *xContext, css::uno::Sequence< css::uno::Any > const &)
virtual ~FontWorkGalleryDialog() override
RET_OK
static VclPtr< reference_type > Create(Arg &&...arg)
virtual SdrObject * CloneSdrObject(SdrModel &rTargetModel) const
Definition: svdobj.cxx:1001
Reference< XExecutableDialog > m_xDialog
const OUString PERCENT("Percent")
std::unique_ptr< weld::Button > mxOKButton
constexpr::Color COL_WHITE(0xFF, 0xFF, 0xFF)
SdrPageView * GetSdrPageView() const
Definition: svdpntv.hxx:310
void SelectItem(sal_uInt16 nItemId)
void SetColCount(sal_uInt16 nNewCols=1)
SdrModel & getSdrModelFromSdrView() const
Definition: svdpntv.hxx:268
void InsertItem(sal_uInt16 nItemId, const Image &rImage)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_FontworkAlignmentControl_get_implementation(css::uno::XComponentContext *xContext, css::uno::Sequence< css::uno::Any > const &)
virtual const tools::Rectangle & GetLogicRect() const
Definition: svdobj.cxx:1634
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:366
const Size & GetSizePixel() const
const int nLineCount
void setWidth(long nWidth)
aStr
static const OUStringLiteral gsFontworkCharacterSpacing(".uno:FontworkCharacterSpacing")
size_t GetItemCount() const
static const OUStringLiteral gsFontworkAlignment(".uno:FontworkAlignment")