25 #include <com/sun/star/drawing/XShape.hpp>
26 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
30 #include <svx/strings.hrc>
44 #include <svx/svxids.hrc>
49 using namespace ::
svx;
50 using namespace ::
cppu;
60 sal_Int32 nAlignment = -1;
61 for(
size_t i = 0;
i < nCount; ++
i )
64 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
66 sal_Int32 nOldAlignment = nAlignment;
69 switch ( rTextHorzAdjustItem.
GetValue() )
76 auto const fit(rTextFitToSizeTypeItem.
GetValue());
77 if (fit == drawing::TextFitToSizeType_NONE)
81 else if (fit == drawing::TextFitToSizeType_ALLLINES ||
82 fit == drawing::TextFitToSizeType_PROPORTIONAL)
88 if ( ( nOldAlignment != -1 ) && ( nOldAlignment != nAlignment ) )
103 sal_Int32 nCharacterSpacing = -1;
104 for(
size_t i = 0;
i < nCount; ++
i )
107 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
109 sal_Int32 nOldCharacterSpacing = nCharacterSpacing;
111 nCharacterSpacing = rCharScaleWidthItem.GetValue();
112 if ( ( nOldCharacterSpacing != -1 ) && ( nOldCharacterSpacing != nCharacterSpacing ) )
114 nCharacterSpacing = -1;
119 rSet.
Put(
SfxInt32Item( SID_FONTWORK_CHARACTER_SPACING, nCharacterSpacing ) );
128 bool bChecked =
false;
129 for(
size_t i = 0;
i < nCount; ++
i )
132 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
135 if ( rKerningItem.GetValue() )
139 rSet.
Put(
SfxBoolItem( SID_FONTWORK_KERN_CHARACTER_PAIRS, bChecked ) );
147 OUString aFontWorkShapeType;
149 for(
size_t i = 0;
i < nCount; ++
i )
152 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
155 const Any* pAny = rGeometryItem.GetPropertyValueByName(
"Type" );
159 if ( *pAny >>= aType )
161 if ( !aFontWorkShapeType.isEmpty() )
163 if ( aFontWorkShapeType != aType )
165 aFontWorkShapeType.clear();
169 aFontWorkShapeType = aType;
181 { 0, SfxGroupId::NONE, SfxSlotMode::NONE, 0, 0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, 0, SfxDisableFlags::NONE,
nullptr }
188 GetStaticInterface()->RegisterObjectBar(
SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Svx_Fontwork_Bar);
195 DBG_ASSERT( pViewShell,
"svx::FontworkBar::FontworkBar(), I need a viewshell!" );
210 static constexpr OUStringLiteral sTextPath =
u"TextPath";
213 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
216 const Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
229 for(
size_t i=0; (
i<nCount) && !bFound ; ++
i)
239 sal_uInt16 nSID = rReq.
GetSlot();
242 case SID_FONTWORK_SAME_LETTER_HEIGHTS:
250 css::beans::PropertyValue aPropValue;
251 aPropValue.Name =
"SameLetterHeights";
252 aPropValue.Value <<= bOn;
258 case SID_FONTWORK_ALIGNMENT:
263 if ( ( nValue >= 0 ) && ( nValue < 5 ) )
265 drawing::TextFitToSizeType eFTS = drawing::TextFitToSizeType_NONE;
269 case 4 : eFTS = drawing::TextFitToSizeType_ALLLINES; [[fallthrough]];
283 case SID_FONTWORK_CHARACTER_SPACING:
294 case SID_FONTWORK_KERN_CHARACTER_PAIRS:
309 static const OUStringLiteral
sType(
u"Type" );
311 css::beans::PropertyValue aPropVal;
312 aPropVal.Name = sType;
313 aPropVal.Value <<= rCustomShape;
316 static const OUStringLiteral sAdjustmentValues(
u"AdjustmentValues" );
317 static const OUStringLiteral sCoordinateOrigin(
u"CoordinateOrigin" );
318 static const OUStringLiteral sCoordinateSize(
u"CoordinateSize" );
319 static const OUStringLiteral sEquations(
u"Equations" );
320 static const OUStringLiteral sHandles(
u"Handles" );
321 static const OUStringLiteral sPath(
u"Path" );
339 for ( std::vector<OUString>::size_type
i = 0;
i < aObjList.size();
i++ )
345 rPool.FreezeIdRanges();
352 SAL_WARN_IF(!pSourceObj,
"svx.form",
"No content in gallery custom shape '" << rCustomShape <<
"'" );
355 PropertyValue aPropVal_;
360 aPropVal_.Name = sType;
361 aPropVal_.Value = *pAny;
367 aPropVal_.Name = sAdjustmentValues;
368 aPropVal_.Value = *pAny;
374 aPropVal_.Name = sCoordinateOrigin;
375 aPropVal_.Value = *pAny;
381 aPropVal_.Name = sCoordinateSize;
382 aPropVal_.Value = *pAny;
388 aPropVal_.Name = sEquations;
389 aPropVal_.Value = *pAny;
395 aPropVal_.Name = sHandles;
396 aPropVal_.Value = *pAny;
402 aPropVal_.Name = sPath;
403 aPropVal_.Value = *pAny;
417 sal_uInt16 nSID = rReq.
GetSlot();
420 case SID_FONTWORK_GALLERY_FLOATER:
422 std::shared_ptr<FontWorkGalleryDialog> pDlg = std::make_shared<FontWorkGalleryDialog>(rReq.
GetFrameWeld(), rSdrView);
427 case SID_FONTWORK_SHAPE_TYPE:
429 OUString aCustomShape;
436 if ( !aCustomShape.isEmpty() )
440 for(
size_t i = 0;
i < nCount; ++
i )
443 if(
auto pCustomShape = dynamic_cast<SdrObjCustomShape*>( pObj) )
449 OUString
aStr(
SvxResId( RID_SVXSTR_UNDO_APPLY_FONTWORK_SHAPE ) );
460 Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( aXShape, UNO_QUERY );
461 if( xDefaulter.is() )
462 xDefaulter->createCustomShapeDefaults( aCustomShape );
469 rBindings.
Invalidate( SID_FONTWORK_SHAPE_TYPE );
476 case SID_FONTWORK_CHARACTER_SPACING_DIALOG :
482 sal_uInt16 nRet = aDlg.
run();
485 SfxInt32Item aItem(SID_FONTWORK_CHARACTER_SPACING, aDlg.getScale());
487 rBindings.
Execute( SID_FONTWORK_CHARACTER_SPACING, const_cast<const SfxPoolItem**>(aItems) );
493 case SID_FONTWORK_SHAPE:
494 case SID_FONTWORK_ALIGNMENT:
497 pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_ALIGNMENT;
500 case SID_FONTWORK_CHARACTER_SPACING:
503 pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING;
506 case SID_FONTWORK_KERN_CHARACTER_PAIRS:
509 pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING;
512 case SID_FONTWORK_SAME_LETTER_HEIGHTS:
515 pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_SAME_LETTER_HEIGHT;
519 for(
size_t i = 0;
i < nCount; ++
i )
522 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
555 rSet.
DisableItem( SID_FONTWORK_ALIGNMENT_FLOATER );
557 rSet.
DisableItem( SID_FONTWORK_CHARACTER_SPACING_FLOATER );
558 rSet.
DisableItem( SID_FONTWORK_CHARACTER_SPACING );
559 rSet.
DisableItem( SID_FONTWORK_KERN_CHARACTER_PAIRS );
560 rSet.
DisableItem( SID_FONTWORK_SAME_LETTER_HEIGHTS );
#define GALLERY_THEME_POWERPOINT
void SetPropertyValue(const css::beans::PropertyValue &rPropVal)
uno::Reference< drawing::XShape > GetXShapeForSdrObject(SdrObject *pObj) noexcept
returns a StarOffice API wrapper for the given SdrObject
constexpr TypedWhichId< SdrTextHorzAdjustItem > SDRATTR_TEXT_HORZADJUST(SDRATTR_MISC_FIRST+13)
size_t GetMarkCount() const
constexpr TypedWhichId< SvxKerningItem > EE_CHAR_KERNING(EE_CHAR_START+12)
#define SFX_IMPL_INTERFACE(Class, SuperClass)
static void GetGeometryForCustomShape(SdrCustomShapeGeometryItem &rGeometryItem, const OUString &rCustomShape)
bool IsUndoEnabled() const
SdrObject * GetObj(size_t nNum) const
SdrMark * GetMark(size_t nNum) const
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
std::deque< AttachedObject_Impl > aObjList
OUString SvxResId(TranslateId aId)
bool checkForSelectedFontWork(SdrView const *pSdrView)
static void SetFontWorkShapeTypeState(SdrView const *pSdrView, SfxItemSet &rSet)
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
static void SetKernCharacterPairsState(SdrView const *pSdrView, SfxItemSet &rSet)
SfxItemPool & GetPool() const
bool checkForFontWork(const SdrObject *pObj)
SdrObject * GetMarkedSdrObj() const
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
constexpr TypedWhichId< SdrTextFitToSizeTypeItem > SDRATTR_TEXT_FITTOSIZE(SDRATTR_MISC_FIRST+3)
static void getState(SdrView const *pSdrView, SfxItemSet &rSet)
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)
constexpr TypedWhichId< SvxCharScaleWidthItem > EE_CHAR_FONTWIDTH(EE_CHAR_START+3)
static void execute(SdrView &rSdrView, SfxRequest const &rReq, SfxBindings &rBindings)
void BroadcastObjectChange() const
const OUString & GetValue() const
const SdrMarkList & GetMarkedObjectList() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
void SetPool(SfxItemPool *pNewPool)
virtual ~FontworkBar() override
void SetMergedItem(const SfxPoolItem &rItem)
void SetName(const OUString &rName)
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
static void impl_execute(SfxRequest const &rReq, SdrCustomShapeGeometryItem &rGeometryItem, SdrObject *pObj)
static bool FillObjListTitle(const sal_uInt32 nThemeId, std::vector< OUString > &rList)
SdrUndoFactory & GetSdrUndoFactory() const
returns the models undo factory.
#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)
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define SAL_WARN_IF(condition, area, stream)
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
static void SetAlignmentState(SdrView const *pSdrView, SfxItemSet &rSet)
static void SetCharacterSpacingState(SdrView const *pSdrView, SfxItemSet &rSet)
css::uno::Any * GetPropertyValueByName(const OUString &rPropName)
const SfxItemPool & GetItemPool() const
static bool GetSdrObj(std::u16string_view rThemeName, sal_uInt32 nSdrModelPos, SdrModel *pModel, BitmapEx *pThumb=nullptr)
virtual std::unique_ptr< SdrUndoAction > CreateUndoAttrObject(SdrObject &rObject, bool bStyleSheet1=false, bool bSaveText=false)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
void ClearPropertyValue(const OUString &rPropertyName)
SdrModel * GetModel() const
sal_uInt16 GetPageCount() const
static SfxSlot aFontworkBarSlots_Impl[]
static sal_uInt32 GetSdrObjCount(std::u16string_view rThemeName)