LibreOffice Module svx (master)  1
fontworkbar.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 <svx/svdundo.hxx>
21 #include <sfx2/request.hxx>
22 #include <sfx2/objface.hxx>
23 #include <sfx2/viewsh.hxx>
24 #include <svx/unoapi.hxx>
25 #include <com/sun/star/drawing/XShape.hpp>
26 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
27 #include <sal/log.hxx>
28 #include <svx/dialmgr.hxx>
29 #include <svx/svdoashp.hxx>
30 #include <svx/strings.hrc>
31 #include <svx/svdpage.hxx>
32 #include <svx/svdview.hxx>
33 #include <svx/sdasitm.hxx>
34 #include <svx/gallery.hxx>
35 #include <svx/fmmodel.hxx>
36 #include <svx/sdtfsitm.hxx>
37 #include <svl/itempool.hxx>
38 #include <svl/stritem.hxx>
39 #include <sfx2/bindings.hxx>
40 #include <editeng/eeitem.hxx>
42 #include <editeng/kernitem.hxx>
43 
44 #include <svx/svxids.hrc>
45 #include <svx/fontworkbar.hxx>
46 #include <svx/fontworkgallery.hxx>
47 
48 
49 using namespace ::svx;
50 using namespace ::cppu;
51 using namespace ::com::sun::star;
52 using namespace ::com::sun::star::beans;
53 using namespace ::com::sun::star::uno;
54 
55 static void SetAlignmentState( SdrView const * pSdrView, SfxItemSet& rSet )
56 {
57  const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
58  const size_t nCount = rMarkList.GetMarkCount();
59 
60  sal_Int32 nAlignment = -1;
61  for( size_t i = 0; i < nCount; ++i )
62  {
63  SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
64  if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
65  {
66  sal_Int32 nOldAlignment = nAlignment;
67  const SdrTextHorzAdjustItem& rTextHorzAdjustItem = pObj->GetMergedItem( SDRATTR_TEXT_HORZADJUST );
68  const SdrTextFitToSizeTypeItem& rTextFitToSizeTypeItem = pObj->GetMergedItem( SDRATTR_TEXT_FITTOSIZE );
69  switch ( rTextHorzAdjustItem.GetValue() )
70  {
71  case SDRTEXTHORZADJUST_LEFT : nAlignment = 0; break;
72  case SDRTEXTHORZADJUST_CENTER : nAlignment = 1; break;
73  case SDRTEXTHORZADJUST_RIGHT : nAlignment = 2; break;
75  {
76  auto const fit(rTextFitToSizeTypeItem.GetValue());
77  if (fit == drawing::TextFitToSizeType_NONE)
78  {
79  nAlignment = 3;
80  }
81  else if (fit == drawing::TextFitToSizeType_ALLLINES ||
82  fit == drawing::TextFitToSizeType_PROPORTIONAL)
83  {
84  nAlignment = 4;
85  }
86  }
87  }
88  if ( ( nOldAlignment != -1 ) && ( nOldAlignment != nAlignment ) )
89  {
90  nAlignment = -1;
91  break;
92  }
93  }
94  }
95  rSet.Put( SfxInt32Item( SID_FONTWORK_ALIGNMENT, nAlignment ) );
96 }
97 
98 static void SetCharacterSpacingState( SdrView const * pSdrView, SfxItemSet& rSet )
99 {
100  const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
101  const size_t nCount = rMarkList.GetMarkCount();
102 
103  sal_Int32 nCharacterSpacing = -1;
104  for( size_t i = 0; i < nCount; ++i )
105  {
106  SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
107  if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
108  {
109  sal_Int32 nOldCharacterSpacing = nCharacterSpacing;
110  const SvxCharScaleWidthItem& rCharScaleWidthItem = pObj->GetMergedItem( EE_CHAR_FONTWIDTH );
111  nCharacterSpacing = rCharScaleWidthItem.GetValue();
112  if ( ( nOldCharacterSpacing != -1 ) && ( nOldCharacterSpacing != nCharacterSpacing ) )
113  {
114  nCharacterSpacing = -1;
115  break;
116  }
117  }
118  }
119  rSet.Put( SfxInt32Item( SID_FONTWORK_CHARACTER_SPACING, nCharacterSpacing ) );
120 }
121 
122 
123 static void SetKernCharacterPairsState( SdrView const * pSdrView, SfxItemSet& rSet )
124 {
125  const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
126  const size_t nCount = rMarkList.GetMarkCount();
127 
128  bool bChecked = false;
129  for( size_t i = 0; i < nCount; ++i )
130  {
131  SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
132  if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
133  {
134  const SvxKerningItem& rKerningItem = pObj->GetMergedItem( EE_CHAR_KERNING );
135  if ( rKerningItem.GetValue() )
136  bChecked = true;
137  }
138  }
139  rSet.Put( SfxBoolItem( SID_FONTWORK_KERN_CHARACTER_PAIRS, bChecked ) );
140 }
141 
142 static void SetFontWorkShapeTypeState( SdrView const * pSdrView, SfxItemSet& rSet )
143 {
144  const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
145  const size_t nCount = rMarkList.GetMarkCount();
146 
147  OUString aFontWorkShapeType;
148 
149  for( size_t i = 0; i < nCount; ++i )
150  {
151  SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
152  if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
153  {
155  const Any* pAny = aGeometryItem.GetPropertyValueByName( "Type" );
156  if( pAny )
157  {
158  OUString aType;
159  if ( *pAny >>= aType )
160  {
161  if ( !aFontWorkShapeType.isEmpty() )
162  {
163  if ( aFontWorkShapeType != aType ) // different FontWorkShapeTypes selected ?
164  {
165  aFontWorkShapeType.clear();
166  break;
167  }
168  }
169  aFontWorkShapeType = aType;
170  }
171  }
172  }
173  }
174  rSet.Put( SfxStringItem( SID_FONTWORK_SHAPE_TYPE, aFontWorkShapeType ) );
175 }
176 
177 // Declare the default interface. (The slotmap must not be empty, so
178 // we enter something which never occurs here (hopefully).)
180 {
181  { 0, SfxGroupId::NONE, SfxSlotMode::NONE, 0, 0, nullptr, nullptr, nullptr, nullptr, nullptr, 0, SfxDisableFlags::NONE, nullptr }
182 };
183 
184 SFX_IMPL_INTERFACE(FontworkBar, SfxShell)
185 
186 void FontworkBar::InitInterface_Impl()
187 {
188  GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Svx_Fontwork_Bar);
189 }
190 
191 
192 FontworkBar::FontworkBar(SfxViewShell* pViewShell )
193 : SfxShell(pViewShell)
194 {
195  DBG_ASSERT( pViewShell, "svx::FontworkBar::FontworkBar(), I need a viewshell!" );
196  if( pViewShell )
197  SetPool(&pViewShell->GetPool());
198 
199  SetName( SvxResId( RID_SVX_FONTWORK_BAR ));
200 }
201 
203 {
204  SetRepeatTarget(nullptr);
205 }
206 
207 namespace svx {
208 bool checkForSelectedFontWork( SdrView const * pSdrView, sal_uInt32& nCheckStatus )
209 {
210  if ( nCheckStatus & 2 )
211  return ( nCheckStatus & 1 ) != 0;
212 
213  static const char sTextPath[] = "TextPath";
214 
215  const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
216  const size_t nCount = rMarkList.GetMarkCount();
217  bool bFound = false;
218  for(size_t i=0; (i<nCount) && !bFound ; ++i)
219  {
220  SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
221  if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
222  {
224  const Any* pAny = aGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
225  if( pAny )
226  *pAny >>= bFound;
227  }
228  }
229  if ( bFound )
230  nCheckStatus |= 1;
231  nCheckStatus |= 2;
232  return bFound;
233 }
234 }
235 
236 static void impl_execute( SfxRequest const & rReq, SdrCustomShapeGeometryItem& rGeometryItem, SdrObject* pObj )
237 {
238  sal_uInt16 nSID = rReq.GetSlot();
239  switch( nSID )
240  {
241  case SID_FONTWORK_SAME_LETTER_HEIGHTS:
242  {
243  css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "SameLetterHeights" );
244  if( pAny )
245  {
246  bool bOn = false;
247  (*pAny) >>= bOn;
248  bOn = !bOn;
249  (*pAny) <<= bOn;
250  }
251  }
252  break;
253 
254  case SID_FONTWORK_ALIGNMENT:
255  {
256  if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_FONTWORK_ALIGNMENT ) == SfxItemState::SET )
257  {
258  sal_Int32 nValue = rReq.GetArgs()->GetItem<SfxInt32Item>(SID_FONTWORK_ALIGNMENT)->GetValue();
259  if ( ( nValue >= 0 ) && ( nValue < 5 ) )
260  {
261  drawing::TextFitToSizeType eFTS = drawing::TextFitToSizeType_NONE;
262  SdrTextHorzAdjust eHorzAdjust;
263  switch ( nValue )
264  {
265  case 4 : eFTS = drawing::TextFitToSizeType_ALLLINES; [[fallthrough]];
266  case 3 : eHorzAdjust = SDRTEXTHORZADJUST_BLOCK; break;
267  default: eHorzAdjust = SDRTEXTHORZADJUST_LEFT; break;
268  case 1 : eHorzAdjust = SDRTEXTHORZADJUST_CENTER; break;
269  case 2 : eHorzAdjust = SDRTEXTHORZADJUST_RIGHT; break;
270  }
271  pObj->SetMergedItem( SdrTextHorzAdjustItem( eHorzAdjust ) );
272  pObj->SetMergedItem( SdrTextFitToSizeTypeItem( eFTS ) );
273  pObj->BroadcastObjectChange();
274  }
275  }
276  }
277  break;
278 
279  case SID_FONTWORK_CHARACTER_SPACING:
280  {
281  if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SfxItemState::SET ) )
282  {
283  sal_Int32 nCharSpacing = rReq.GetArgs()->GetItem<SfxInt32Item>(SID_FONTWORK_CHARACTER_SPACING)->GetValue();
284  pObj->SetMergedItem( SvxCharScaleWidthItem( static_cast<sal_uInt16>(nCharSpacing), EE_CHAR_FONTWIDTH ) );
285  pObj->BroadcastObjectChange();
286  }
287  }
288  break;
289 
290  case SID_FONTWORK_KERN_CHARACTER_PAIRS:
291  {
292  if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_KERN_CHARACTER_PAIRS ) == SfxItemState::SET ) )
293  {
294  // sal_Bool bKernCharacterPairs = ((const SfxBoolItem*)rReq.GetArgs()->GetItem(SID_FONTWORK_KERN_CHARACTER_PAIRS))->GetValue();
295 //TODO: pObj->SetMergedItem( SvxCharScaleWidthItem( (sal_uInt16)nCharSpacing, EE_CHAR_FONTWIDTH ) );
296  pObj->BroadcastObjectChange();
297  }
298  }
299  break;
300  }
301 }
302 
303 static void GetGeometryForCustomShape( SdrCustomShapeGeometryItem& rGeometryItem, const OUString& rCustomShape )
304 {
305  const OUString sType( "Type" );
306 
307  css::beans::PropertyValue aPropVal;
308  aPropVal.Name = sType;
309  aPropVal.Value <<= rCustomShape;
310  rGeometryItem.SetPropertyValue( aPropVal );
311 
312  const OUString sAdjustmentValues( "AdjustmentValues" );
313  const OUString sCoordinateOrigin( "CoordinateOrigin" );
314  const OUString sCoordinateSize( "CoordinateSize" );
315  const OUString sEquations( "Equations" );
316  const OUString sHandles( "Handles" );
317  const OUString sPath( "Path" );
318  rGeometryItem.ClearPropertyValue( sAdjustmentValues );
319  rGeometryItem.ClearPropertyValue( sCoordinateOrigin );
320  rGeometryItem.ClearPropertyValue( sCoordinateSize );
321  rGeometryItem.ClearPropertyValue( sEquations );
322  rGeometryItem.ClearPropertyValue( sHandles );
323  rGeometryItem.ClearPropertyValue( sPath );
324 
325  /* SJ: CustomShapes that are available in the gallery are having the highest
326  priority, so we will take a look there before taking the internal default */
327 
329  return;
330 
331  std::vector< OUString > aObjList;
333  return;
334 
335  for ( std::vector<OUString>::size_type i = 0; i < aObjList.size(); i++ )
336  {
337  if ( aObjList[ i ].equalsIgnoreAsciiCase( rCustomShape ) )
338  {
339  FmFormModel aFormModel;
340  SfxItemPool& rPool(aFormModel.GetItemPool());
341  rPool.FreezeIdRanges();
342 
344  {
345  const SdrObject* pSourceObj = nullptr;
346  if (aFormModel.GetPageCount() > 0)
347  pSourceObj = aFormModel.GetPage( 0 )->GetObj( 0 );
348  SAL_WARN_IF(!pSourceObj, "svx.form", "No content in gallery custom shape '" << rCustomShape << "'" );
349  if( pSourceObj )
350  {
351  PropertyValue aPropVal_;
352  const SdrCustomShapeGeometryItem& rSourceGeometry = pSourceObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
353  const css::uno::Any* pAny = rSourceGeometry.GetPropertyValueByName( sType );
354  if ( pAny )
355  {
356  aPropVal_.Name = sType;
357  aPropVal_.Value = *pAny;
358  rGeometryItem.SetPropertyValue( aPropVal_ );
359  }
360  pAny = rSourceGeometry.GetPropertyValueByName( sAdjustmentValues );
361  if ( pAny )
362  {
363  aPropVal_.Name = sAdjustmentValues;
364  aPropVal_.Value = *pAny;
365  rGeometryItem.SetPropertyValue( aPropVal_ );
366  }
367  pAny = rSourceGeometry.GetPropertyValueByName( sCoordinateOrigin );
368  if ( pAny )
369  {
370  aPropVal_.Name = sCoordinateOrigin;
371  aPropVal_.Value = *pAny;
372  rGeometryItem.SetPropertyValue( aPropVal_ );
373  }
374  pAny = rSourceGeometry.GetPropertyValueByName( sCoordinateSize );
375  if ( pAny )
376  {
377  aPropVal_.Name = sCoordinateSize;
378  aPropVal_.Value = *pAny;
379  rGeometryItem.SetPropertyValue( aPropVal_ );
380  }
381  pAny = rSourceGeometry.GetPropertyValueByName( sEquations );
382  if ( pAny )
383  {
384  aPropVal_.Name = sEquations;
385  aPropVal_.Value = *pAny;
386  rGeometryItem.SetPropertyValue( aPropVal_ );
387  }
388  pAny = rSourceGeometry.GetPropertyValueByName( sHandles );
389  if ( pAny )
390  {
391  aPropVal_.Name = sHandles;
392  aPropVal_.Value = *pAny;
393  rGeometryItem.SetPropertyValue( aPropVal_ );
394  }
395  pAny = rSourceGeometry.GetPropertyValueByName( sPath );
396  if ( pAny )
397  {
398  aPropVal_.Name = sPath;
399  aPropVal_.Value = *pAny;
400  rGeometryItem.SetPropertyValue( aPropVal_ );
401  }
402  }
403  }
404  }
405  }
406 }
407 
408 
409 void FontworkBar::execute( SdrView& rSdrView, SfxRequest const & rReq, SfxBindings& rBindings )
410 {
411  const char* pStrResId = nullptr;
412 
413  sal_uInt16 nSID = rReq.GetSlot();
414  switch( nSID )
415  {
416  case SID_FONTWORK_GALLERY_FLOATER:
417  {
418  FontWorkGalleryDialog aDlg(rReq.GetFrameWeld(), rSdrView);
419  aDlg.run();
420  }
421  break;
422 
423  case SID_FONTWORK_SHAPE_TYPE:
424  {
425  OUString aCustomShape;
426  const SfxItemSet* pArgs = rReq.GetArgs();
427  if ( pArgs )
428  {
429  const SfxStringItem& rItm = static_cast<const SfxStringItem&>(pArgs->Get( rReq.GetSlot() ));
430  aCustomShape = rItm.GetValue();
431  }
432  if ( !aCustomShape.isEmpty() )
433  {
434  const SdrMarkList& rMarkList = rSdrView.GetMarkedObjectList();
435  const size_t nCount = rMarkList.GetMarkCount();
436  for( size_t i = 0; i < nCount; ++i )
437  {
438  SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
439  if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
440  {
441  const bool bUndo = rSdrView.IsUndoEnabled();
442 
443  if( bUndo )
444  {
445  OUString aStr( SvxResId( RID_SVXSTR_UNDO_APPLY_FONTWORK_SHAPE ) );
446  rSdrView.BegUndo(aStr);
447  rSdrView.AddUndo(rSdrView.GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
448  }
450  GetGeometryForCustomShape( aGeometryItem, aCustomShape );
451  pObj->SetMergedItem( aGeometryItem );
452 
453  Reference< drawing::XShape > aXShape = GetXShapeForSdrObject( static_cast<SdrObjCustomShape*>(pObj) );
454  if ( aXShape.is() )
455  {
456  Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( aXShape, UNO_QUERY );
457  if( xDefaulter.is() )
458  xDefaulter->createCustomShapeDefaults( aCustomShape );
459  }
460 
461  pObj->BroadcastObjectChange();
462  if (bUndo)
463  rSdrView.EndUndo();
464  rSdrView.AdjustMarkHdl(); //HMH sal_True );
465  rBindings.Invalidate( SID_FONTWORK_SHAPE_TYPE );
466  }
467  }
468  }
469  }
470  break;
471 
472  case SID_FONTWORK_CHARACTER_SPACING_DIALOG :
473  {
474  if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SfxItemState::SET ) )
475  {
476  sal_Int32 nCharSpacing = rReq.GetArgs()->GetItem<SfxInt32Item>(SID_FONTWORK_CHARACTER_SPACING)->GetValue();
477  FontworkCharacterSpacingDialog aDlg(rReq.GetFrameWeld(), nCharSpacing);
478  sal_uInt16 nRet = aDlg.run();
479  if (nRet != RET_CANCEL)
480  {
481  SfxInt32Item aItem(SID_FONTWORK_CHARACTER_SPACING, aDlg.getScale());
482  SfxPoolItem* aItems[] = { &aItem, nullptr };
483  rBindings.Execute( SID_FONTWORK_CHARACTER_SPACING, const_cast<const SfxPoolItem**>(aItems) );
484  }
485  }
486  }
487  break;
488 
489  case SID_FONTWORK_SHAPE:
490  case SID_FONTWORK_ALIGNMENT:
491  {
492  if ( !pStrResId )
493  pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_ALIGNMENT;
494  [[fallthrough]];
495  }
496  case SID_FONTWORK_CHARACTER_SPACING:
497  {
498  if ( !pStrResId )
499  pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING;
500  [[fallthrough]];
501  }
502  case SID_FONTWORK_KERN_CHARACTER_PAIRS:
503  {
504  if ( !pStrResId )
505  pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING;
506  [[fallthrough]];
507  }
508  case SID_FONTWORK_SAME_LETTER_HEIGHTS:
509  {
510  if ( !pStrResId )
511  pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_SAME_LETTER_HEIGHT;
512 
513  const SdrMarkList& rMarkList = rSdrView.GetMarkedObjectList();
514  const size_t nCount = rMarkList.GetMarkCount();
515  for( size_t i = 0; i < nCount; ++i )
516  {
517  SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
518  if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
519  {
520  const bool bUndo = rSdrView.IsUndoEnabled();
521  if( bUndo )
522  {
523  OUString aStr( SvxResId( pStrResId ) );
524  rSdrView.BegUndo(aStr);
525  rSdrView.AddUndo(rSdrView.GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
526  }
528  impl_execute( rReq, aGeometryItem, pObj );
529  pObj->SetMergedItem( aGeometryItem );
530  pObj->BroadcastObjectChange();
531  if (bUndo)
532  rSdrView.EndUndo();
533  }
534  }
535  }
536  break;
537  }
538 }
539 
540 void FontworkBar::getState( SdrView const * pSdrView, SfxItemSet& rSet )
541 {
542  sal_uInt32 nCheckStatus = 0;
543 
544  if ( rSet.GetItemState( SID_FONTWORK_ALIGNMENT_FLOATER ) != SfxItemState::UNKNOWN )
545  {
546  if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
547  rSet.DisableItem( SID_FONTWORK_ALIGNMENT_FLOATER );
548  }
549  if ( rSet.GetItemState( SID_FONTWORK_ALIGNMENT ) != SfxItemState::UNKNOWN )
550  {
551  if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
552  rSet.DisableItem( SID_FONTWORK_ALIGNMENT );
553  else
554  SetAlignmentState( pSdrView, rSet );
555  }
556  if ( rSet.GetItemState( SID_FONTWORK_CHARACTER_SPACING_FLOATER ) != SfxItemState::UNKNOWN )
557  {
558  if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
559  rSet.DisableItem( SID_FONTWORK_CHARACTER_SPACING_FLOATER );
560  }
561  if ( rSet.GetItemState( SID_FONTWORK_CHARACTER_SPACING ) != SfxItemState::UNKNOWN )
562  {
563  if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
564  rSet.DisableItem( SID_FONTWORK_CHARACTER_SPACING );
565  else
566  SetCharacterSpacingState( pSdrView, rSet );
567  }
568  if ( rSet.GetItemState( SID_FONTWORK_KERN_CHARACTER_PAIRS ) != SfxItemState::UNKNOWN )
569  {
570  if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
571  rSet.DisableItem( SID_FONTWORK_KERN_CHARACTER_PAIRS );
572  else
573  SetKernCharacterPairsState( pSdrView, rSet );
574  }
575  if ( rSet.GetItemState( SID_FONTWORK_SAME_LETTER_HEIGHTS ) != SfxItemState::UNKNOWN )
576  {
577  if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
578  rSet.DisableItem( SID_FONTWORK_SAME_LETTER_HEIGHTS );
579  }
580  if ( rSet.GetItemState( SID_FONTWORK_SHAPE_TYPE ) != SfxItemState::UNKNOWN )
581  {
582  if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
583  rSet.DisableItem( SID_FONTWORK_SHAPE_TYPE );
584  else
585  SetFontWorkShapeTypeState( pSdrView, rSet );
586  }
587 }
588 
589 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetPropertyValue(const css::beans::PropertyValue &rPropVal)
static void execute(SdrView &rSdrView, SfxRequest const &rReq, SfxBindings &rBindings)
constexpr TypedWhichId< SdrTextHorzAdjustItem > SDRATTR_TEXT_HORZADJUST(SDRATTR_MISC_FIRST+13)
uno::Reference< drawing::XShape > GetXShapeForSdrObject(SdrObject *pObj)
returns a StarOffice API wrapper for the given SdrObject
Definition: unoshape.cxx:3926
size_t GetMarkCount() const
Definition: svdmark.hxx:180
constexpr TypedWhichId< SvxKerningItem > EE_CHAR_KERNING(EE_CHAR_START+12)
static sal_uInt32 GetSdrObjCount(const OUString &rThemeName)
Definition: galexpl.cxx:165
#define SFX_IMPL_INTERFACE(Class, SuperClass)
std::string GetValue
SdrTextHorzAdjust
Definition: sdtaitm.hxx:53
bool IsUndoEnabled() const
Definition: svdedtv.cxx:1027
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:758
void BegUndo()
Definition: svdedtv.hxx:179
bool checkForSelectedFontWork(SdrView const *pSdrView, sal_uInt32 &nCheckStatus)
SdrMark * GetMark(size_t nNum) const
Definition: svdmark.cxx:229
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
RET_CANCEL
static bool GetSdrObj(const OUString &rThemeName, sal_uInt32 nSdrModelPos, SdrModel *pModel, BitmapEx *pThumb=nullptr)
Definition: galexpl.cxx:194
std::deque< AttachedObject_Impl > aObjList
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
int nCount
static void SetFontWorkShapeTypeState(SdrView const *pSdrView, SfxItemSet &rSet)
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
void EndUndo()
Definition: svdedtv.cxx:275
static void SetKernCharacterPairsState(SdrView const *pSdrView, SfxItemSet &rSet)
SfxItemPool & GetPool() const
SdrObject * GetMarkedSdrObj() const
Definition: svdmark.hxx:68
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svdedtv.hxx:183
constexpr TypedWhichId< SdrTextFitToSizeTypeItem > SDRATTR_TEXT_FITTOSIZE(SDRATTR_MISC_FIRST+3)
OptionalString sType
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
void SetRepeatTarget(SfxRepeatTarget *pTarget)
constexpr TypedWhichId< SdrCustomShapeGeometryItem > SDRATTR_CUSTOMSHAPE_GEOMETRY(SDRATTR_CUSTOMSHAPE_FIRST+2)
int i
constexpr TypedWhichId< SvxCharScaleWidthItem > EE_CHAR_FONTWIDTH(EE_CHAR_START+3)
void BroadcastObjectChange() const
Definition: svdobj.cxx:905
const OUString & GetValue() const
const SdrMarkList & GetMarkedObjectList() const
Definition: svdmrkv.hxx:252
const SdrPage * GetPage(sal_uInt16 nPgNum) const
Definition: svdmodel.cxx:1904
void SetPool(SfxItemPool *pNewPool)
static void getState(SdrView const *pSdrView, SfxItemSet &rSet)
virtual ~FontworkBar() override
void SetMergedItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1900
void SetName(const OUString &rName)
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:1925
Abstract DrawObject.
Definition: svdobj.hxx:312
static bool FillObjListTitle(const sal_uInt32 nThemeId, std::vector< OUString > &rList)
Definition: galexpl.cxx:82
SdrUndoFactory & GetSdrUndoFactory() const
returns the models undo factory.
Definition: svdmodel.cxx:1961
#define SFX_OBJECTBAR_OBJECT
weld::Window * GetFrameWeld() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
void DisableItem(sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define SAL_WARN_IF(condition, area, stream)
static void GetGeometryForCustomShape(SdrCustomShapeGeometryItem &rGeometryItem, const OUString &rCustomShape)
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
Definition: svdmrkv.cxx:2390
static void SetAlignmentState(SdrView const *pSdrView, SfxItemSet &rSet)
Definition: fontworkbar.cxx:55
virtual short run()
static void SetCharacterSpacingState(SdrView const *pSdrView, SfxItemSet &rSet)
Definition: fontworkbar.cxx:98
css::uno::Any * GetPropertyValueByName(const OUString &rPropName)
const SfxItemPool & GetItemPool() const
Definition: svdmodel.hxx:314
virtual std::unique_ptr< SdrUndoAction > CreateUndoAttrObject(SdrObject &rObject, bool bStyleSheet1=false, bool bSaveText=false)
Definition: svdundo.cxx:1649
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
void ClearPropertyValue(const OUString &rPropertyName)
SdrModel * GetModel() const
Definition: svdpntv.hxx:265
aStr
sal_uInt16 GetPageCount() const
Definition: svdmodel.cxx:1916
static SfxSlot aFontworkBarSlots_Impl[]
sal_Int16 nValue
Definition: fmsrccfg.cxx:81
static void impl_execute(SfxRequest const &rReq, SdrCustomShapeGeometryItem &rGeometryItem, SdrObject *pObj)
EnumT GetValue() const