25#include <com/sun/star/frame/CommandGroup.hpp>
31#include <svx/strings.hrc>
50using ::com::sun::star::uno::Reference;
51using ::com::sun::star::uno::Sequence;
60 ,m_pChartController( pController )
71 OUString aBaseCommand;
72 OUString aCustomShapeType;
73 return parseCommandURL( rCommandURL, &nFeatureId, &aBaseCommand, &aCustomShapeType );
80 if ( pLineEndList.is() )
104 if ( !(pDrawModelWrapper && pDrawViewWrapper && pDrawViewWrapper->
GetCurrentObjIdentifier() == SdrObjKind::CustomShape) )
107 bool bAttributesAppliedFromGallery =
false;
142 aDest.Set( rSource );
147 bAttributesAppliedFromGallery =
true;
155 if ( !bAttributesAppliedFromGallery )
161 o3tl::unsafe_downcast< SdrObjCustomShape* >( pObj )->MergeDefaultAttributes( &
m_aCustomShapeType );
172 if ( !(pDrawModelWrapper && pDrawViewWrapper) )
176 if ( !aArrow.
count() )
183 aArrow.
append( aNewArrow );
220 OUString aBaseCommand;
221 OUString aCustomShapeType;
222 if (
parseCommandURL( rCommand, &nFeatureId, &aBaseCommand, &aCustomShapeType ) )
224 switch ( nFeatureId )
263 OUString aBaseCommand;
264 OUString aCustomShapeType;
265 if ( !
parseCommandURL( rCommand, &nFeatureId, &aBaseCommand, &aCustomShapeType ) )
268 bool bCreate =
false;
272 switch ( nFeatureId )
277 eKind = SdrObjKind::NONE;
284 eKind = SdrObjKind::Line;
290 eKind = SdrObjKind::Rectangle;
296 eKind = SdrObjKind::CircleOrEllipse;
302 eKind = SdrObjKind::FreehandLine;
308 eKind = SdrObjKind::Text;
315 eKind = SdrObjKind::Caption;
326 eKind = SdrObjKind::CustomShape;
332 eKind = SdrObjKind::NONE;
341 if ( !pDrawViewWrapper )
352 const beans::PropertyValue* pIter = rArgs.getConstArray();
353 const beans::PropertyValue* pEnd = pIter + rArgs.getLength();
354 const beans::PropertyValue* pKeyModifier = std::find_if(pIter, pEnd,
355 [](
const beans::PropertyValue& lhs)
356 {
return lhs.Name ==
"KeyModifier";} );
357 sal_Int16 nKeyModifier = 0;
358 if ( !(pKeyModifier != pEnd && ( pKeyModifier->Value >>= nKeyModifier ) && nKeyModifier ==
KEY_MOD1) )
398 if ( pDrawViewWrapper )
410 if ( pDrawViewWrapper && pDrawModelWrapper )
425 Size aObjectSize( 4000, 2500 );
437 if (
auto const pathObj =
dynamic_cast<SdrPathObj*
>( pObj.get()) )
441 sal_Int32 nYMiddle( ( aRect.
Top() + aRect.
Bottom() ) / 2 );
448 pObj->SetMergedItemSet( aSet );
454 if (
auto const pathObj =
dynamic_cast<SdrPathObj*
>( pObj.get()) )
467 aPoly.
append( aInnerPoly );
468 pathObj->SetPathPoly(aPoly);
477 pTextObj->SetLogicRect( aRect );
479 pTextObj->SetVerticalWriting( bVertical );
487 pTextObj->SetMergedItemSet( aSet );
498 pCaptionObj->SetVerticalWriting( bIsVertical );
504 pObj->SetMergedItemSet( aSet );
506 pCaptionObj->SetLogicRect( aRect );
507 pCaptionObj->SetTailPos(
514 pObj->SetLogicRect( aRect );
517 pObj->SetMergedItemSet( aSet );
529 OUString* pBaseCommand, OUString* pCustomShapeType )
533 OUString aBaseCommand;
536 sal_Int32
nIndex = std::min(sal_Int32(1), rCommandURL.getLength());
538 if (
nIndex == -1 || aToken.empty() )
540 aBaseCommand = rCommandURL;
544 nFeatureId = aIter->second.nFeatureId;
546 switch ( nFeatureId )
560 aType =
"left-right-arrow";
565 aType =
"flowchart-internal-storage";
570 aType =
"round-rectangular-callout";
591 aBaseCommand = rCommandURL.copy( 0,
nIndex - 1 );
595 nFeatureId = aIter->second.nFeatureId;
596 aType = rCommandURL.getToken( 0,
'.',
nIndex );
604 *pnFeatureId = nFeatureId;
605 *pBaseCommand = aBaseCommand;
606 *pCustomShapeType = aType;
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)
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
SdrInventor GetCurrentObjInventor() const
SdrObjKind GetCurrentObjIdentifier() const
void SetCreateMode(bool bOn=true)
void SetCurrentObj(SdrObjKind nIdent, SdrInventor nInvent=SdrInventor::Default)
bool InsertObjectAtView(SdrObject *pObj, SdrPageView &rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE)
XLineEndListRef GetLineEndList() const
const SfxItemPool & GetItemPool() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
static rtl::Reference< SdrObject > MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
SdrObject * GetObj(size_t nNum) const
virtual Degree100 GetRotateAngle() const
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
SdrModel & getSdrModelFromSdrObject() const
virtual const tools::Rectangle & GetSnapRect() const
const SfxItemSet & GetMergedItemSet() const
void SetMergedItem(const SfxPoolItem &rItem)
virtual void NbcRotate(const Point &rRef, Degree100 nAngle, double sn, double cs)=0
SdrPageView * GetSdrPageView() const
SdrModel & GetModel() const
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr=false) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const basegfx::B2DPolyPolygon & GetLineEnd() const
const OUString & GetName() const
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void setClosed(bool bNew)
void appendBezierSegment(const basegfx::B2DPoint &rNextControlPoint, const basegfx::B2DPoint &rPrevControlPoint, const basegfx::B2DPoint &rPoint)
DrawViewWrapper * GetDrawViewWrapper()
void StartTextEdit(const Point *pMousePixel=nullptr)
void setDrawMode(ChartDrawMode eMode)
DrawModelWrapper * GetDrawModelWrapper()
void SetAndApplySelection(const css::uno::Reference< css::drawing::XShape > &rxShape)
virtual ~DrawCommandDispatch() override
virtual FeatureState getState(const OUString &rCommand) override
rtl::Reference< SdrObject > createDefaultObject(const ChartCommandID nID)
virtual void disposing(std::unique_lock< std::mutex > &rGuard) override
is called when this is disposed
DrawCommandDispatch(const css::uno::Reference< css::uno::XComponentContext > &rxContext, ChartController *pController)
void setLineEnds(SfxItemSet &rAttr)
ChartController * m_pChartController
void setAttributes(SdrObject *pObj)
void setInsertObj(SdrObjKind eObj)
virtual void describeSupportedFeatures() override
bool parseCommandURL(const OUString &rCommandURL, ChartCommandID *pnFeatureId, OUString *pBaseCommand, OUString *pCustomShapeType)
OUString m_aCustomShapeType
virtual void execute(const OUString &rCommand, const css::uno::Sequence< css::beans::PropertyValue > &rArgs) override
virtual bool isFeatureSupported(const OUString &rCommandURL) override
SfxItemPool & GetItemPool()
const rtl::Reference< SvxDrawPage > & getMainDrawPage()
This is a base class for CommandDispatch implementations with feature support.
ChartCommandID m_nFeatureId
SupportedFeatures m_aSupportedFeatures
void implDescribeSupportedFeature(const char *pAsciiCommandURL, ChartCommandID nId, sal_Int16 nGroup)
describes a feature supported by the controller
SVXCORE_DLLPUBLIC OUString SvxResId(TranslateId aId)
constexpr sal_uInt16 EE_ITEMS_END(EE_FEATURE_END)
constexpr sal_uInt16 EE_ITEMS_START(OWN_ATTR_VALUE_END+1)
std::deque< AttachedObject_Impl > aObjList
#define GALLERY_THEME_POWERPOINT
constexpr sal_uInt16 KEY_MOD1
::basegfx::B2DPolyPolygon getPolygon(TranslateId pResId, const SdrModel &rModel)
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
constexpr sal_uInt16 SDRATTR_START(XATTR_START)
constexpr sal_uInt16 SDRATTR_CUSTOMSHAPE_LAST(SDRATTR_CUSTOMSHAPE_GEOMETRY)
constexpr sal_uInt16 SDRATTR_MISC_LAST(SDRATTR_TEXT_CLIPVERTOVERFLOW)
constexpr sal_uInt16 SDRATTR_MISC_FIRST(SDRATTR_CAPTION_LAST+1)
constexpr sal_uInt16 SDRATTR_GRAF_FIRST(SDRATTR_NOTPERSIST_LAST+1)
constexpr sal_uInt16 SDRATTR_SHADOW_LAST(SDRATTR_SHADOWALIGNMENT)
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
SVXCORE_DLLPUBLIC SdrPage * GetSdrPageFromXDrawPage(const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage) noexcept
constexpr TypedWhichId< XLineWidthItem > XATTR_LINEWIDTH(XATTR_LINE_FIRST+2)