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>
50using namespace ::
cppu;
60 sal_Int32 nAlignment = -1;
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;
109 sal_Int32 nOldCharacterSpacing = nCharacterSpacing;
111 nCharacterSpacing = rCharScaleWidthItem.GetValue();
112 if ( ( nOldCharacterSpacing != -1 ) && ( nOldCharacterSpacing != nCharacterSpacing ) )
114 nCharacterSpacing = -1;
128 bool bChecked =
false;
135 if ( rKerningItem.GetValue() )
147 OUString aFontWorkShapeType;
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,
"" }
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";
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;
257 case SID_FONTWORK_ALIGNMENT:
264 drawing::TextFitToSizeType eFTS = drawing::TextFitToSizeType_NONE;
268 case 4 : eFTS = drawing::TextFitToSizeType_ALLLINES; [[fallthrough]];
282 case SID_FONTWORK_CHARACTER_SPACING:
293 case SID_FONTWORK_KERN_CHARACTER_PAIRS:
308 static constexpr OUStringLiteral
sType(
u"Type" );
310 css::beans::PropertyValue aPropVal;
311 aPropVal.Name =
sType;
312 aPropVal.Value <<= rCustomShape;
315 static constexpr OUStringLiteral sAdjustmentValues(
u"AdjustmentValues" );
316 static constexpr OUStringLiteral sCoordinateOrigin(
u"CoordinateOrigin" );
317 static constexpr OUStringLiteral sCoordinateSize(
u"CoordinateSize" );
318 static constexpr OUStringLiteral sEquations(
u"Equations" );
319 static constexpr OUStringLiteral sHandles(
u"Handles" );
320 static constexpr OUStringLiteral sPath(
u"Path" );
338 for ( std::vector<OUString>::size_type
i = 0;
i <
aObjList.size();
i++ )
351 SAL_WARN_IF(!pSourceObj,
"svx.form",
"No content in gallery custom shape '" << rCustomShape <<
"'" );
354 PropertyValue aPropVal_;
359 aPropVal_.Name =
sType;
360 aPropVal_.Value = *pAny;
366 aPropVal_.Name = sAdjustmentValues;
367 aPropVal_.Value = *pAny;
373 aPropVal_.Name = sCoordinateOrigin;
374 aPropVal_.Value = *pAny;
380 aPropVal_.Name = sCoordinateSize;
381 aPropVal_.Value = *pAny;
387 aPropVal_.Name = sEquations;
388 aPropVal_.Value = *pAny;
394 aPropVal_.Name = sHandles;
395 aPropVal_.Value = *pAny;
401 aPropVal_.Name = sPath;
402 aPropVal_.Value = *pAny;
416 sal_uInt16 nSID = rReq.
GetSlot();
419 case SID_FONTWORK_GALLERY_FLOATER:
421 std::shared_ptr<FontWorkGalleryDialog> pDlg = std::make_shared<FontWorkGalleryDialog>(rReq.
GetFrameWeld(), rSdrView);
426 case SID_FONTWORK_SHAPE_TYPE:
428 OUString aCustomShape;
435 if ( !aCustomShape.isEmpty() )
448 OUString
aStr(
SvxResId( RID_SVXSTR_UNDO_APPLY_FONTWORK_SHAPE ) );
459 Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( aXShape, UNO_QUERY );
460 if( xDefaulter.is() )
461 xDefaulter->createCustomShapeDefaults( aCustomShape );
468 rBindings.
Invalidate( SID_FONTWORK_SHAPE_TYPE );
475 case SID_FONTWORK_CHARACTER_SPACING_DIALOG :
481 sal_uInt16 nRet = aDlg.
run();
486 rBindings.
Execute( SID_FONTWORK_CHARACTER_SPACING,
const_cast<const SfxPoolItem**
>(aItems) );
492 case SID_FONTWORK_SHAPE:
493 case SID_FONTWORK_ALIGNMENT:
496 pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_ALIGNMENT;
499 case SID_FONTWORK_CHARACTER_SPACING:
502 pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING;
505 case SID_FONTWORK_KERN_CHARACTER_PAIRS:
508 pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING;
511 case SID_FONTWORK_SAME_LETTER_HEIGHTS:
514 pStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_SAME_LETTER_HEIGHT;
const OUString & GetValue() const
static sal_uInt32 GetSdrObjCount(std::u16string_view rThemeName)
static bool FillObjListTitle(const sal_uInt32 nThemeId, std::vector< OUString > &rList)
static bool GetSdrObj(std::u16string_view rThemeName, sal_uInt32 nSdrModelPos, SdrModel *pModel, BitmapEx *pThumb=nullptr)
void SetPropertyValue(const css::beans::PropertyValue &rPropVal)
css::uno::Any * GetPropertyValueByName(const OUString &rPropName)
void ClearPropertyValue(const OUString &rPropertyName)
bool IsUndoEnabled() const
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
SdrObject * GetMarkedSdrObj() const
const SfxItemPool & GetItemPool() const
SdrUndoFactory & GetSdrUndoFactory() const
returns the models undo factory.
const SdrPage * GetPage(sal_uInt16 nPgNum) const
sal_uInt16 GetPageCount() const
SdrObject * GetObj(size_t nNum) const
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
void BroadcastObjectChange() const
void SetMergedItem(const SfxPoolItem &rItem)
SdrModel & GetModel() const
virtual std::unique_ptr< SdrUndoAction > CreateUndoAttrObject(SdrObject &rObject, bool bStyleSheet1=false, bool bSaveText=false)
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
void Invalidate(sal_uInt16 nId)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void DisableItem(sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
weld::Window * GetFrameWeld() const
SfxItemPool & GetPool() const
void SetRepeatTarget(SfxRepeatTarget *pTarget)
void SetPool(SfxItemPool *pNewPool)
void SetName(const OUString &rName)
virtual ~FontworkBar() override
static void getState(SdrView const *pSdrView, SfxItemSet &rSet)
static void execute(SdrView &rSdrView, SfxRequest const &rReq, SfxBindings &rBindings)
sal_Int32 getScale() const
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
#define DBG_ASSERT(sCon, aError)
OUString SvxResId(TranslateId aId)
constexpr TypedWhichId< SvxKerningItem > EE_CHAR_KERNING(EE_CHAR_START+12)
constexpr TypedWhichId< SvxCharScaleWidthItem > EE_CHAR_FONTWIDTH(EE_CHAR_START+3)
std::deque< AttachedObject_Impl > aObjList
static void SetAlignmentState(SdrView const *pSdrView, SfxItemSet &rSet)
static void SetCharacterSpacingState(SdrView const *pSdrView, SfxItemSet &rSet)
static void SetFontWorkShapeTypeState(SdrView const *pSdrView, SfxItemSet &rSet)
static SfxSlot aFontworkBarSlots_Impl[]
static void SetKernCharacterPairsState(SdrView const *pSdrView, SfxItemSet &rSet)
#define GALLERY_THEME_POWERPOINT
#define SAL_WARN_IF(condition, area, stream)
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
static void GetGeometryForCustomShape(SdrCustomShapeGeometryItem &rGeometryItem, const OUString &rCustomShape)
bool checkForFontWork(const SdrObject *pObj)
static void impl_execute(SfxRequest const &rReq, SdrCustomShapeGeometryItem &rGeometryItem, SdrObject *pObj)
bool checkForSelectedFontWork(SdrView const *pSdrView)
#define SFX_OBJECTBAR_OBJECT
@ SDRTEXTHORZADJUST_BLOCK
@ SDRTEXTHORZADJUST_CENTER
@ SDRTEXTHORZADJUST_RIGHT
#define SFX_IMPL_INTERFACE(Class, SuperClass)
constexpr TypedWhichId< SdrTextFitToSizeTypeItem > SDRATTR_TEXT_FITTOSIZE(SDRATTR_MISC_FIRST+3)
constexpr TypedWhichId< SdrTextHorzAdjustItem > SDRATTR_TEXT_HORZADJUST(SDRATTR_MISC_FIRST+13)
constexpr TypedWhichId< SdrCustomShapeGeometryItem > SDRATTR_CUSTOMSHAPE_GEOMETRY(SDRATTR_CUSTOMSHAPE_FIRST+2)
uno::Reference< drawing::XShape > GetXShapeForSdrObject(SdrObject *pObj) noexcept
returns a StarOffice API wrapper for the given SdrObject