From 5351188c8ea2426e9545543646a40dc6d6df1a14 Mon Sep 17 00:00:00 2001 From: Akshay Deep Date: Wed, 17 Feb 2016 00:09:30 +0530 Subject: 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/22403 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt --- sd/source/ui/animations/CustomAnimationList.cxx | 46 +++++++++++++++++++------ 1 file changed, 35 insertions(+), 11 deletions(-) (limited to 'sd/source/ui/animations/CustomAnimationList.cxx') diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index a8cc25ec919a..2ef0644e395c 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -215,29 +215,43 @@ public: private: VclPtr mpParent; OUString maDescription; + OUString effectName; 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 ) : SvLBoxString( pEntry, nFlags, aDescription ) , mpParent( pParent ) , maDescription( aDescription ) +, effectName( OUString() ) , mpEffect(pEffect) +, mpCustomAnimationPresets(&CustomAnimationPresets::getCustomAnimationPresets()) { + effectName = mpCustomAnimationPresets->getUINameForPresetId(mpEffect->getPresetId()); } + + CustomAnimationListEntryItem::~CustomAnimationListEntryItem() { } + void CustomAnimationListEntryItem::InitViewData( SvTreeListBox* pView, SvTreeListEntry* pEntry, SvViewDataItem* pViewData ) { if( !pViewData ) pViewData = pView->GetViewDataItem( pEntry, this ); - Size aSize(pView->GetTextWidth( maDescription ) + 2 * 19, pView->GetTextHeight() ); - if( aSize.Height() < 19 ) - aSize.Height() = 19; + long width = pView->GetTextWidth( maDescription ) + nIconWidth; + if( width < (pView->GetTextWidth( effectName ) + 2*nIconWidth)) + width = pView->GetTextWidth( effectName ) + 2*nIconWidth; + + Size aSize( width, pView->GetTextHeight() ); + if( aSize.Height() < nItemMinHeight ) + aSize.Height() = nItemMinHeight; pViewData->maSize = aSize; } @@ -259,8 +273,17 @@ void CustomAnimationListEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev, { 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; switch (mpEffect->getPresetClass()) @@ -295,14 +318,14 @@ void CustomAnimationListEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev, { const Image& rImage = mpParent->getImage(nImage); Point aImagePos(aPos); - aImagePos.Y() += (aSize.Height() - rImage.GetSizePixel().Height()) >> 1; + aImagePos.Y() += (aSize.Height()/2 - rImage.GetSizePixel().Height()) >> 1; rRenderContext.DrawImage(aImagePos, rImage); } - aPos.X() += 19; - aPos.Y() += (aSize.Height() - rDev.GetTextHeight()) >> 1; + aPos.X() += nIconWidth; + 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 @@ -353,6 +376,7 @@ public: private: OUString maDescription; + const long nIconWidth = 19; }; CustomAnimationTriggerEntryItem::CustomAnimationTriggerEntryItem( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& aDescription ) @@ -369,9 +393,9 @@ void CustomAnimationTriggerEntryItem::InitViewData( SvTreeListBox* pView, SvTree if( !pViewData ) pViewData = pView->GetViewDataItem( pEntry, this ); - Size aSize(pView->GetTextWidth( maDescription ) + 2 * 19, pView->GetTextHeight() ); - if( aSize.Height() < 19 ) - aSize.Height() = 19; + Size aSize(pView->GetTextWidth( maDescription ) + 2 * nIconWidth, pView->GetTextHeight() ); + if( aSize.Height() < nIconWidth ) + aSize.Height() = nIconWidth; pViewData->maSize = aSize; } -- cgit