Kaydet (Commit) 5351188c authored tarafından Akshay Deep's avatar Akshay Deep Kaydeden (comit) Samuel Mehrbrodt

tdf#87812 - SIDEBAR: More animation information in list control

Modified Custom Animation ListBox entry to include multiple lines.
Added Effect names in Custom Animation List Control.

Change-Id: Ic974ffc9fca6803ff76135620df1fbe9edcde565
Reviewed-on: https://gerrit.libreoffice.org/22403Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst 57d0caac
...@@ -215,29 +215,43 @@ public: ...@@ -215,29 +215,43 @@ public:
private: private:
VclPtr<CustomAnimationList> mpParent; VclPtr<CustomAnimationList> mpParent;
OUString maDescription; OUString maDescription;
OUString effectName;
CustomAnimationEffectPtr mpEffect; CustomAnimationEffectPtr mpEffect;
const CustomAnimationPresets* mpCustomAnimationPresets;
const long nIconWidth = 19;
const long nItemMinHeight = 38;
}; };
CustomAnimationListEntryItem::CustomAnimationListEntryItem( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& aDescription, CustomAnimationEffectPtr pEffect, CustomAnimationList* pParent ) CustomAnimationListEntryItem::CustomAnimationListEntryItem( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& aDescription, CustomAnimationEffectPtr pEffect, CustomAnimationList* pParent )
: SvLBoxString( pEntry, nFlags, aDescription ) : SvLBoxString( pEntry, nFlags, aDescription )
, mpParent( pParent ) , mpParent( pParent )
, maDescription( aDescription ) , maDescription( aDescription )
, effectName( OUString() )
, mpEffect(pEffect) , mpEffect(pEffect)
, mpCustomAnimationPresets(&CustomAnimationPresets::getCustomAnimationPresets())
{ {
effectName = mpCustomAnimationPresets->getUINameForPresetId(mpEffect->getPresetId());
} }
CustomAnimationListEntryItem::~CustomAnimationListEntryItem() CustomAnimationListEntryItem::~CustomAnimationListEntryItem()
{ {
} }
void CustomAnimationListEntryItem::InitViewData( SvTreeListBox* pView, SvTreeListEntry* pEntry, SvViewDataItem* pViewData ) void CustomAnimationListEntryItem::InitViewData( SvTreeListBox* pView, SvTreeListEntry* pEntry, SvViewDataItem* pViewData )
{ {
if( !pViewData ) if( !pViewData )
pViewData = pView->GetViewDataItem( pEntry, this ); pViewData = pView->GetViewDataItem( pEntry, this );
Size aSize(pView->GetTextWidth( maDescription ) + 2 * 19, pView->GetTextHeight() ); long width = pView->GetTextWidth( maDescription ) + nIconWidth;
if( aSize.Height() < 19 ) if( width < (pView->GetTextWidth( effectName ) + 2*nIconWidth))
aSize.Height() = 19; width = pView->GetTextWidth( effectName ) + 2*nIconWidth;
Size aSize( width, pView->GetTextHeight() );
if( aSize.Height() < nItemMinHeight )
aSize.Height() = nItemMinHeight;
pViewData->maSize = aSize; pViewData->maSize = aSize;
} }
...@@ -259,8 +273,17 @@ void CustomAnimationListEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev, ...@@ -259,8 +273,17 @@ void CustomAnimationListEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev,
{ {
rRenderContext.DrawImage(aPos, mpParent->getImage(IMG_CUSTOMANIMATION_AFTER_PREVIOUS)); rRenderContext.DrawImage(aPos, mpParent->getImage(IMG_CUSTOMANIMATION_AFTER_PREVIOUS));
} }
else if (nNodeType == EffectNodeType::WITH_PREVIOUS)
{
//FIXME With previous image not defined in CustomAnimation.src
}
aPos.X() += 19; aPos.X() += nIconWidth;
rRenderContext.DrawText(aPos, rRenderContext.GetEllipsisString(maDescription, rDev.GetOutputSizePixel().Width() - aPos.X()));
aPos.Y() += nIconWidth;
sal_uInt16 nImage; sal_uInt16 nImage;
switch (mpEffect->getPresetClass()) switch (mpEffect->getPresetClass())
...@@ -295,14 +318,14 @@ void CustomAnimationListEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev, ...@@ -295,14 +318,14 @@ void CustomAnimationListEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev,
{ {
const Image& rImage = mpParent->getImage(nImage); const Image& rImage = mpParent->getImage(nImage);
Point aImagePos(aPos); Point aImagePos(aPos);
aImagePos.Y() += (aSize.Height() - rImage.GetSizePixel().Height()) >> 1; aImagePos.Y() += (aSize.Height()/2 - rImage.GetSizePixel().Height()) >> 1;
rRenderContext.DrawImage(aImagePos, rImage); rRenderContext.DrawImage(aImagePos, rImage);
} }
aPos.X() += 19; aPos.X() += nIconWidth;
aPos.Y() += (aSize.Height() - rDev.GetTextHeight()) >> 1; aPos.Y() += (aSize.Height()/2 - rDev.GetTextHeight()) >> 1;
rRenderContext.DrawText(aPos, rRenderContext.GetEllipsisString(maDescription, rDev.GetOutputSizePixel().Width() - aPos.X())); rRenderContext.DrawText(aPos, rRenderContext.GetEllipsisString(effectName, rDev.GetOutputSizePixel().Width() - aPos.X()));
} }
SvLBoxItem* CustomAnimationListEntryItem::Create() const SvLBoxItem* CustomAnimationListEntryItem::Create() const
...@@ -353,6 +376,7 @@ public: ...@@ -353,6 +376,7 @@ public:
private: private:
OUString maDescription; OUString maDescription;
const long nIconWidth = 19;
}; };
CustomAnimationTriggerEntryItem::CustomAnimationTriggerEntryItem( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& aDescription ) CustomAnimationTriggerEntryItem::CustomAnimationTriggerEntryItem( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& aDescription )
...@@ -369,9 +393,9 @@ void CustomAnimationTriggerEntryItem::InitViewData( SvTreeListBox* pView, SvTree ...@@ -369,9 +393,9 @@ void CustomAnimationTriggerEntryItem::InitViewData( SvTreeListBox* pView, SvTree
if( !pViewData ) if( !pViewData )
pViewData = pView->GetViewDataItem( pEntry, this ); pViewData = pView->GetViewDataItem( pEntry, this );
Size aSize(pView->GetTextWidth( maDescription ) + 2 * 19, pView->GetTextHeight() ); Size aSize(pView->GetTextWidth( maDescription ) + 2 * nIconWidth, pView->GetTextHeight() );
if( aSize.Height() < 19 ) if( aSize.Height() < nIconWidth )
aSize.Height() = 19; aSize.Height() = nIconWidth;
pViewData->maSize = aSize; pViewData->maSize = aSize;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment