diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-03-30 10:10:08 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-04-06 21:24:55 +0200 |
commit | a4f747e9cd70bc25994040e7812680c2c8356c08 (patch) | |
tree | 37417145ce76cb3586fb035519e5dbf70c4cb816 /sd/source/ui/animations | |
parent | 21e8ce9ab9a522d25e95773af59b7ccccaee4e54 (diff) |
remove newly unused stuff
Change-Id: Idce9955294372817c0dd1f40ebd38f16fc90eab5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91007
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd/source/ui/animations')
-rw-r--r-- | sd/source/ui/animations/CustomAnimationDialog.cxx | 1039 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationDialog.hxx | 41 |
2 files changed, 1 insertions, 1079 deletions
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index c62a7381f3bf..2c0df3768793 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -36,15 +36,10 @@ #include <memory> #include <i18nutil/unicode.hxx> -#include <vcl/menubtn.hxx> #include <vcl/svapp.hxx> -#include <vcl/field.hxx> -#include <vcl/lstbox.hxx> #include <vcl/stdtext.hxx> #include <vcl/weld.hxx> -#include <vcl/menu.hxx> #include <vcl/settings.hxx> -#include <vcl/builderfactory.hxx> #include <svtools/ctrlbox.hxx> #include <svtools/ctrltool.hxx> @@ -87,82 +82,6 @@ using ::com::sun::star::beans::XPropertySet; namespace sd { -namespace { - -class PresetPropertyBox : public PropertySubControl -{ -public: - PresetPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const OUString& aPresetId, const Link<LinkParamNone*,void>& rModifyHdl ); - virtual ~PresetPropertyBox() override; - - virtual Any getValue() override; - virtual void setValue( const Any& rValue, const OUString& rPresetId ) override; - virtual Control* getControl() override; - -private: - std::map< sal_uInt16, OUString > maPropertyValues; - VclPtr<ListBox> mpControl; - DECL_LINK(OnSelect, ListBox&, void); - Link<LinkParamNone*,void> maModifyLink; -}; - -} - -PresetPropertyBox::PresetPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const OUString& aPresetId, const Link<LinkParamNone*,void>& rModifyHdl ) -: PropertySubControl( nControlType ), maModifyLink(rModifyHdl) -{ - mpControl = VclPtr<ListBox>::Create( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); - mpControl->set_hexpand(true); - mpControl->SetDropDownLineCount( 10 ); - mpControl->SetSelectHdl( LINK(this, PresetPropertyBox, OnSelect) ); - mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_PRESETPROPERTYBOX ); - - setValue( rValue, aPresetId ); -} - -IMPL_LINK_NOARG(PresetPropertyBox, OnSelect, ListBox&, void) -{ - maModifyLink.Call(nullptr); -} - -void PresetPropertyBox::setValue( const Any& rValue, const OUString& rPresetId ) -{ - if( !mpControl ) - return; - - mpControl->Clear(); - - const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets(); - CustomAnimationPresetPtr pDescriptor = rPresets.getEffectDescriptor( rPresetId ); - if( pDescriptor.get() ) - { - - OUString aPropertyValue; - rValue >>= aPropertyValue; - - std::vector<OUString> aSubTypes( pDescriptor->getSubTypes() ); - - mpControl->Enable( !aSubTypes.empty() ); - - for( const auto& aSubType : aSubTypes ) - { - sal_Int32 nPos = mpControl->InsertEntry( rPresets.getUINameForProperty( aSubType ) ); - if( aSubType == aPropertyValue ) - mpControl->SelectEntryPos( nPos ); - maPropertyValues[nPos] = aSubType; - } - } - else - { - mpControl->Enable( false ); - } -} - -PresetPropertyBox::~PresetPropertyBox() -{ - mpControl.disposeAndClear(); -} - SdPropertySubControl::SdPropertySubControl(weld::Container* pParent) : mxBuilder(Application::CreateBuilder(pParent, "modules/simpress/ui/customanimationfragment.ui")) , mxContainer(mxBuilder->weld_container("EffectFragment")) @@ -170,16 +89,6 @@ SdPropertySubControl::SdPropertySubControl(weld::Container* pParent) { } -Any PresetPropertyBox::getValue() -{ - return makeAny( maPropertyValues[mpControl->GetSelectedEntryPos()] ); -} - -Control* PresetPropertyBox::getControl() -{ - return mpControl; -} - SdPropertySubControl::~SdPropertySubControl() { mpParent->move(mxContainer.get(), nullptr); @@ -271,72 +180,7 @@ Any SdPresetPropertyBox::getValue() namespace { -class ColorPropertyBox : public PropertySubControl -{ -public: - ColorPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ); - virtual ~ColorPropertyBox() override; - - virtual Any getValue() override; - virtual void setValue( const Any& rValue, const OUString& rPresetId ) override; - virtual Control* getControl() override; - -private: - VclPtr<SvxColorListBox> mpControl; - DECL_LINK(OnSelect, SvxColorListBox&, void); - Link<LinkParamNone*,void> maModifyLink; -}; - -} - -ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ) -: PropertySubControl( nControlType ), maModifyLink(rModifyHdl) -{ - mpControl = VclPtr<SvxColorListBox>::Create(pParent); - mpControl->set_hexpand(true); - mpControl->SetSelectHdl( LINK(this, ColorPropertyBox, OnSelect) ); - mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX ); - - sal_Int32 nColor = 0; - rValue >>= nColor; - mpControl->SelectEntry(Color(nColor)); -} - -IMPL_LINK_NOARG(ColorPropertyBox, OnSelect, SvxColorListBox&, void) -{ - maModifyLink.Call(nullptr); -} - -ColorPropertyBox::~ColorPropertyBox() -{ - mpControl.disposeAndClear(); -} - -void ColorPropertyBox::setValue( const Any& rValue, const OUString& ) -{ - if( mpControl ) - { - sal_Int32 nColor = 0; - rValue >>= nColor; - - mpControl->SetNoSelection(); - mpControl->SelectEntry(Color(nColor)); - } -} - -Any ColorPropertyBox::getValue() -{ - return makeAny( sal_Int32(mpControl->GetSelectEntryColor().GetRGBColor()) ); -} - -Control* ColorPropertyBox::getControl() -{ - return mpControl; -} - -namespace { - -class SdColorPropertyBox : public SdPropertySubControl +class SdColorPropertyBox : public SdPropertySubControl { public: SdColorPropertyBox(weld::Label* pLabel, weld::Container* pParent, weld::Window* pTopLevel, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl); @@ -392,90 +236,6 @@ Any SdColorPropertyBox::getValue() namespace { -class FontPropertyBox : public PropertySubControl -{ -public: - FontPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ); - virtual ~FontPropertyBox() override; - - virtual Any getValue() override; - virtual void setValue( const Any& rValue, const OUString& rPresetId ) override; - - virtual Control* getControl() override; - -private: - VclPtr<FontNameBox> mpControl; - Link<LinkParamNone*,void> maModifyHdl; - DECL_LINK(ControlSelectHdl, ComboBox&, void); -}; - -} - -FontPropertyBox::FontPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ) -: PropertySubControl( nControlType ), maModifyHdl(rModifyHdl) -{ - mpControl = VclPtr<FontNameBox>::Create( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); - mpControl->set_hexpand(true); - mpControl->SetDropDownLineCount( 10 ); - mpControl->SetSelectHdl( LINK(this, FontPropertyBox, ControlSelectHdl) ); - mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_FONTPROPERTYBOX ); - - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - const SfxPoolItem* pItem; - - const FontList* pFontList = nullptr; - bool bMustDelete = false; - - if ( pDocSh && ( (pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ) ) != nullptr) ) - pFontList = static_cast<const SvxFontListItem*>(pItem)->GetFontList(); - - if(!pFontList) - { - pFontList = new FontList(Application::GetDefaultDevice(), nullptr); - bMustDelete = true; - } - - mpControl->Fill( pFontList ); - - if( bMustDelete ) - delete pFontList; - - setValue( rValue, OUString() ); -} - -IMPL_LINK_NOARG(FontPropertyBox, ControlSelectHdl, ComboBox&, void) -{ - maModifyHdl.Call(nullptr); -} - -void FontPropertyBox::setValue( const Any& rValue, const OUString& ) -{ - if( mpControl ) - { - OUString aFontName; - rValue >>= aFontName; - mpControl->SetText( aFontName ); - } -} - -FontPropertyBox::~FontPropertyBox() -{ - mpControl.disposeAndClear(); -} - -Any FontPropertyBox::getValue() -{ - OUString aFontName( mpControl->GetText() ); - return makeAny( aFontName ); -} - -Control* FontPropertyBox::getControl() -{ - return mpControl; -} - -namespace { - class SdFontPropertyBox : public SdPropertySubControl { public: @@ -558,175 +318,6 @@ Any SdFontPropertyBox::getValue() namespace { -class DropdownMenuBox : public Edit -{ -public: - DropdownMenuBox( vcl::Window* pParent, Edit* pSubControl, PopupMenu* pMenu ); - virtual ~DropdownMenuBox() override; - virtual void dispose() override; - - void Resize() override; - bool PreNotify( NotifyEvent& rNEvt ) override; - - void SetMenuSelectHdl( const Link<MenuButton *, void>& rLink ) { mpDropdownButton->SetSelectHdl( rLink ); } - -private: - VclPtr<Edit> mpSubControl; - VclPtr<MenuButton> mpDropdownButton; - VclPtr<PopupMenu> mpMenu; -}; - -} - -DropdownMenuBox::DropdownMenuBox( vcl::Window* pParent, Edit* pSubControl, PopupMenu* pMenu ) -: Edit( pParent, WB_BORDER|WB_TABSTOP| WB_DIALOGCONTROL ), - mpSubControl(pSubControl),mpDropdownButton(nullptr),mpMenu(pMenu) -{ - mpDropdownButton = VclPtr<MenuButton>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE | WB_NOTABSTOP); - mpDropdownButton->SetSymbol(SymbolType::SPIN_DOWN); - mpDropdownButton->Show(); - mpDropdownButton->SetPopupMenu( pMenu ); - - SetSubEdit( mpSubControl ); - set_hexpand(true); - mpSubControl->SetParent( this ); - mpSubControl->Show(); -} - -DropdownMenuBox::~DropdownMenuBox() -{ - disposeOnce(); -} - -void DropdownMenuBox::dispose() -{ - SetSubEdit(nullptr); - mpDropdownButton.disposeAndClear(); - mpMenu.disposeAndClear(); - mpSubControl.disposeAndClear(); - Edit::dispose(); -} - -void DropdownMenuBox::Resize() -{ - Size aOutSz = GetOutputSizePixel(); - - long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize(); - nSBWidth = CalcZoom( nSBWidth ); - mpSubControl->setPosSizePixel( 0, 1, aOutSz.Width() - nSBWidth, aOutSz.Height()-2 ); - mpDropdownButton->setPosSizePixel( aOutSz.Width() - nSBWidth, 0, nSBWidth, aOutSz.Height() ); -} - -bool DropdownMenuBox::PreNotify( NotifyEvent& rNEvt ) -{ - bool bResult = true; - - MouseNotifyEvent nSwitch=rNEvt.GetType(); - if (nSwitch==MouseNotifyEvent::KEYINPUT) - { - const vcl::KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode(); - sal_uInt16 nKey=aKeyCode.GetCode(); - - if (nKey==KEY_DOWN && aKeyCode.IsMod2()) - { - mpDropdownButton->KeyInput( *rNEvt.GetKeyEvent() ); - } - else - { - bResult=Edit::PreNotify(rNEvt); - } - } - else - bResult=Edit::PreNotify(rNEvt); - - return bResult; -} - -namespace { - -class CharHeightPropertyBox : public PropertySubControl -{ -public: - CharHeightPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ); - virtual ~CharHeightPropertyBox() override; - - virtual Any getValue() override; - virtual void setValue( const Any& rValue, const OUString& ) override; - - virtual Control* getControl() override; - - DECL_LINK( implMenuSelectHdl, MenuButton*, void ); - -private: - DECL_LINK( EditModifyHdl, Edit&, void ); - VclBuilder maBuilder; - VclPtr<DropdownMenuBox> mpControl; - VclPtr<PopupMenu> mpMenu; - VclPtr<MetricField> mpMetric; - Link<LinkParamNone*,void> maModifyHdl; -}; - -} - -CharHeightPropertyBox::CharHeightPropertyBox(sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl) - : PropertySubControl(nControlType) - , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/fontsizemenu.ui", "") - , maModifyHdl(rModifyHdl) -{ - mpMetric.set( VclPtr<MetricField>::Create( pParent, WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) ); - mpMetric->SetUnit( FieldUnit::PERCENT ); - mpMetric->SetMin( 0 ); - mpMetric->SetMax( 1000 ); - - mpMenu = maBuilder.get_menu("menu"); - mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu ); - mpControl->SetMenuSelectHdl( LINK( this, CharHeightPropertyBox, implMenuSelectHdl )); - mpControl->SetModifyHdl( LINK( this, CharHeightPropertyBox, EditModifyHdl ) ); - mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_CHARHEIGHTPROPERTYBOX ); - - setValue( rValue, OUString() ); -} - -CharHeightPropertyBox::~CharHeightPropertyBox() -{ - maBuilder.disposeBuilder(); - mpControl.disposeAndClear(); -} - -IMPL_LINK_NOARG( CharHeightPropertyBox, EditModifyHdl, Edit&, void ) -{ - maModifyHdl.Call(nullptr); -} - -IMPL_LINK( CharHeightPropertyBox, implMenuSelectHdl, MenuButton*, pPb, void ) -{ - sal_Int32 nValue = pPb->GetCurItemIdent().toInt32(); - mpMetric->SetValue(nValue); - mpMetric->Modify(); -} - -void CharHeightPropertyBox::setValue( const Any& rValue, const OUString& ) -{ - if( mpMetric.get() ) - { - double fValue = 0.0; - rValue >>= fValue; - mpMetric->SetValue( static_cast<long>(fValue * 100.0) ); - } -} - -Any CharHeightPropertyBox::getValue() -{ - return makeAny( static_cast<double>(mpMetric->GetValue()) / 100.0 ); -} - -Control* CharHeightPropertyBox::getControl() -{ - return mpControl; -} - -namespace { - class SdCharHeightPropertyBox : public SdPropertySubControl { public: @@ -794,109 +385,6 @@ Any SdCharHeightPropertyBox::getValue() namespace { -class TransparencyPropertyBox : public PropertySubControl -{ -public: - TransparencyPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ); - virtual ~TransparencyPropertyBox() override; - - virtual Any getValue() override; - virtual void setValue( const Any& rValue, const OUString& rPresetId ) override; - - virtual Control* getControl() override; - - DECL_LINK( implMenuSelectHdl, MenuButton*, void ); - DECL_LINK( implModifyHdl, Edit&, void ); - - void updateMenu(); - -private: - VclPtr<DropdownMenuBox> mpControl; - VclPtr<PopupMenu> mpMenu; - VclPtr<MetricField> mpMetric; - Link<LinkParamNone*,void> maModifyHdl; -}; - -} - -TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ) -: PropertySubControl( nControlType ) -, maModifyHdl( rModifyHdl ) -{ - mpMetric.set( VclPtr<MetricField>::Create( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) ); - mpMetric->SetUnit( FieldUnit::PERCENT ); - mpMetric->SetMin( 0 ); - mpMetric->SetMax( 100 ); - - mpMenu = VclPtr<PopupMenu>::Create(); - for( sal_Int32 i = 25; i < 101; i += 25 ) - { - OUString aStr(unicode::formatPercent(i, - Application::GetSettings().GetUILanguageTag())); - mpMenu->InsertItem( i, aStr ); - } - - mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu ); - mpControl->SetMenuSelectHdl( LINK( this, TransparencyPropertyBox, implMenuSelectHdl )); - mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_TRANSPARENCYPROPERTYBOX ); - - Link<Edit&,void> aLink( LINK( this, TransparencyPropertyBox, implModifyHdl ) ); - mpControl->SetModifyHdl( aLink ); - - setValue( rValue, OUString() ); -} - -TransparencyPropertyBox::~TransparencyPropertyBox() -{ - mpControl.disposeAndClear(); -} - -void TransparencyPropertyBox::updateMenu() -{ - sal_Int64 nValue = mpMetric->GetValue(); - for( sal_uInt16 i = 25; i < 101; i += 25 ) - mpMenu->CheckItem( i, nValue == i ); -} - -IMPL_LINK_NOARG(TransparencyPropertyBox, implModifyHdl, Edit&, void) -{ - updateMenu(); - maModifyHdl.Call(nullptr); -} - -IMPL_LINK( TransparencyPropertyBox, implMenuSelectHdl, MenuButton*, pPb, void ) -{ - if( pPb->GetCurItemId() != mpMetric->GetValue() ) - { - mpMetric->SetValue( pPb->GetCurItemId() ); - mpMetric->Modify(); - } -} - -void TransparencyPropertyBox::setValue( const Any& rValue, const OUString& ) -{ - if( mpMetric.get() ) - { - double fValue = 0.0; - rValue >>= fValue; - long nValue = static_cast<long>(fValue * 100); - mpMetric->SetValue( nValue ); - updateMenu(); - } -} - -Any TransparencyPropertyBox::getValue() -{ - return makeAny( static_cast<double>(mpMetric->GetValue()) / 100.0 ); -} - -Control* TransparencyPropertyBox::getControl() -{ - return mpControl; -} - -namespace { - class SdTransparencyPropertyBox : public SdPropertySubControl { public: @@ -986,129 +474,6 @@ Any SdTransparencyPropertyBox::getValue() namespace { -class RotationPropertyBox : public PropertySubControl -{ -public: - RotationPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ); - virtual ~RotationPropertyBox() override; - - virtual Any getValue() override; - virtual void setValue( const Any& rValue, const OUString& ) override; - - virtual Control* getControl() override; - - DECL_LINK( implMenuSelectHdl, MenuButton*, void ); - DECL_LINK( implModifyHdl, Edit&, void ); - - void updateMenu(); - -private: - VclBuilder maBuilder; - VclPtr<DropdownMenuBox> mpControl; - VclPtr<PopupMenu> mpMenu; - VclPtr<MetricField> mpMetric; - Link<LinkParamNone*,void> maModifyHdl; -}; - -} - -RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ) - : PropertySubControl(nControlType) - , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/rotatemenu.ui", "") - , maModifyHdl(rModifyHdl) -{ - mpMetric.set( VclPtr<MetricField>::Create( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) ); - mpMetric->SetUnit( FieldUnit::CUSTOM ); - mpMetric->SetCustomUnitText( OUString( u'\x00b0') ); // degree sign - mpMetric->SetMin( -10000 ); - mpMetric->SetMax( 10000 ); - - mpMenu = maBuilder.get_menu("menu"); - mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu ); - mpControl->SetMenuSelectHdl( LINK( this, RotationPropertyBox, implMenuSelectHdl )); - mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX ); - - Link<Edit&,void> aLink( LINK( this, RotationPropertyBox, implModifyHdl ) ); - mpControl->SetModifyHdl( aLink ); - - setValue( rValue, OUString() ); -} - -RotationPropertyBox::~RotationPropertyBox() -{ - maBuilder.disposeBuilder(); - mpControl.disposeAndClear(); -} - -void RotationPropertyBox::updateMenu() -{ - sal_Int64 nValue = mpMetric->GetValue(); - bool bDirection = nValue >= 0; - nValue = (nValue < 0 ? -nValue : nValue); - - mpMenu->CheckItem("90", nValue == 90); - mpMenu->CheckItem("180", nValue == 180); - mpMenu->CheckItem("360", nValue == 360); - mpMenu->CheckItem("720", nValue == 720); - - mpMenu->CheckItem("closewise", bDirection); - mpMenu->CheckItem("counterclock", !bDirection); -} - -IMPL_LINK_NOARG(RotationPropertyBox, implModifyHdl, Edit&, void) -{ - updateMenu(); - maModifyHdl.Call(nullptr); -} - -IMPL_LINK( RotationPropertyBox, implMenuSelectHdl, MenuButton*, pPb, void ) -{ - sal_Int64 nValue = mpMetric->GetValue(); - bool bDirection = nValue >= 0; - nValue = (nValue < 0 ? -nValue : nValue); - - OString sIdent = pPb->GetCurItemIdent(); - if (sIdent == "clockwise") - bDirection = true; - else if (sIdent == "counterclock") - bDirection = false; - else - nValue = sIdent.toInt32(); - - if( !bDirection ) - nValue = -nValue; - - if( nValue != mpMetric->GetValue() ) - { - mpMetric->SetValue( nValue ); - mpMetric->Modify(); - } -} - -void RotationPropertyBox::setValue( const Any& rValue, const OUString& ) -{ - if( mpMetric.get() ) - { - double fValue = 0.0; - rValue >>= fValue; - long nValue = static_cast<long>(fValue); - mpMetric->SetValue( nValue ); - updateMenu(); - } -} - -Any RotationPropertyBox::getValue() -{ - return makeAny( static_cast<double>(mpMetric->GetValue()) ); -} - -Control* RotationPropertyBox::getControl() -{ - return mpControl; -} - -namespace { - class SdRotationPropertyBox : public SdPropertySubControl { public: @@ -1212,188 +577,6 @@ Any SdRotationPropertyBox::getValue() namespace { -class ScalePropertyBox : public PropertySubControl -{ -public: - ScalePropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ); - virtual ~ScalePropertyBox() override; - - virtual Any getValue() override; - virtual void setValue( const Any& rValue, const OUString& ) override; - - virtual Control* getControl() override; - - DECL_LINK( implMenuSelectHdl, MenuButton*, void ); - DECL_LINK( implModifyHdl, Edit&, void ); - - void updateMenu(); - -private: - VclBuilder maBuilder; - VclPtr<DropdownMenuBox> mpControl; - VclPtr<PopupMenu> mpMenu; - VclPtr<MetricField> mpMetric; - Link<LinkParamNone*,void> maModifyHdl; - int mnDirection; -}; - -} - -ScalePropertyBox::ScalePropertyBox(sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl) - : PropertySubControl( nControlType ) - , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/scalemenu.ui", "") - , maModifyHdl( rModifyHdl ) -{ - mpMetric.set( VclPtr<MetricField>::Create( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) ); - mpMetric->SetUnit( FieldUnit::PERCENT ); - mpMetric->SetMin( 0 ); - mpMetric->SetMax( 10000 ); - - mpMenu = maBuilder.get_menu("menu"); - mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu ); - mpControl->SetMenuSelectHdl( LINK( this, ScalePropertyBox, implMenuSelectHdl )); - mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX ); - - Link<Edit&,void> aLink( LINK( this, ScalePropertyBox, implModifyHdl ) ); - mpControl->SetModifyHdl( aLink ); - - setValue( rValue, OUString() ); -} - -ScalePropertyBox::~ScalePropertyBox() -{ - maBuilder.disposeBuilder(); - mpControl.disposeAndClear(); -} - -void ScalePropertyBox::updateMenu() -{ - sal_Int64 nValue = mpMetric->GetValue(); - - mpMenu->CheckItem("25", nValue == 25); - mpMenu->CheckItem("50", nValue == 50); - mpMenu->CheckItem("150", nValue == 150); - mpMenu->CheckItem("400", nValue == 400); - - mpMenu->CheckItem("hori", mnDirection == 1); - mpMenu->CheckItem("vert", mnDirection == 2); - mpMenu->CheckItem("both", mnDirection == 3); -} - -IMPL_LINK_NOARG(ScalePropertyBox, implModifyHdl, Edit&, void) -{ - updateMenu(); - maModifyHdl.Call(nullptr); -} - -IMPL_LINK( ScalePropertyBox, implMenuSelectHdl, MenuButton*, pPb, void ) -{ - sal_Int64 nValue = mpMetric->GetValue(); - - int nDirection = mnDirection; - - OString sIdent(pPb->GetCurItemIdent()); - if (sIdent == "hori") - nDirection = 1; - else if (sIdent == "veri") - nDirection = 2; - else if (sIdent == "both") - nDirection = 3; - else - nValue = sIdent.toInt32(); - - bool bModified = false; - - if( nDirection != mnDirection ) - { - mnDirection = nDirection; - bModified = true; - } - - if( nValue != mpMetric->GetValue() ) - { - mpMetric->SetValue( nValue ); - bModified = true; - } - - if( bModified ) - { - mpMetric->Modify(); - updateMenu(); - } -} - -void ScalePropertyBox::setValue( const Any& rValue, const OUString& ) -{ - if( !mpMetric.get() ) - return; - - ValuePair aValues; - rValue >>= aValues; - - double fValue1 = 0.0; - double fValue2 = 0.0; - - aValues.First >>= fValue1; - aValues.Second >>= fValue2; - - if( fValue2 == 0.0 ) - mnDirection = 1; - else if( fValue1 == 0.0 ) - mnDirection = 2; - else - mnDirection = 3; - - // Shrink animation is represented by negative value - // Shrink factor is calculated as (1 + $fValue) - // e.g 1 + (-0.75) = 0.25 => shrink to 25% of the size - // 0.25 = -0.75 + 1 - if ( fValue1 < 0.0 ) - fValue1 += 1; - if ( fValue2 < 0.0 ) - fValue2 += 1; - - long nValue; - if( fValue1 ) - nValue = static_cast<long>(fValue1 * 100.0); - else - nValue = static_cast<long>(fValue2 * 100.0); - mpMetric->SetValue( nValue ); - updateMenu(); -} - -Any ScalePropertyBox::getValue() -{ - double fValue1 = static_cast<double>(mpMetric->GetValue()) / 100.0; - - // Shrink animation is represented by value < 1 (< 100%) - // Shrink factor is calculated as (1 + $fValue) - // e.g shrink to 25% of the size: 0.25 = 1 + $fValue => - // $fValue = -0.75; -0.75 = 0.25 -1 - if ( fValue1 < 1.0 ) - fValue1 -= 1; - - double fValue2 = fValue1; - - if( mnDirection == 1 ) - fValue2 = 0.0; - else if( mnDirection == 2 ) - fValue1 = 0.0; - - ValuePair aValues; - aValues.First <<= fValue1; - aValues.Second <<= fValue2; - - return makeAny( aValues ); -} - -Control* ScalePropertyBox::getControl() -{ - return mpControl; -} - -namespace { - class SdScalePropertyBox : public SdPropertySubControl { public: @@ -1557,130 +740,6 @@ Any SdScalePropertyBox::getValue() namespace { -class FontStylePropertyBox : public PropertySubControl -{ -public: - FontStylePropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ); - virtual ~FontStylePropertyBox() override; - - virtual Any getValue() override; - virtual void setValue( const Any& rValue, const OUString& ) override; - - virtual Control* getControl() override; - - DECL_LINK( implMenuSelectHdl, MenuButton*, void ); - - void update(); - -private: - VclBuilder maBuilder; - VclPtr<DropdownMenuBox> mpControl; - VclPtr<PopupMenu> mpMenu; - VclPtr<Edit> mpEdit; - Link<LinkParamNone*,void> maModifyHdl; - - float mfFontWeight; - awt::FontSlant meFontSlant; - sal_Int16 mnFontUnderline; -}; - -} - -FontStylePropertyBox::FontStylePropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ) - : PropertySubControl(nControlType) - , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/fontstylemenu.ui", "") - , maModifyHdl( rModifyHdl ) -{ - mpEdit.set( VclPtr<Edit>::Create( pParent, WB_TABSTOP|WB_IGNORETAB|WB_NOBORDER|WB_READONLY) ); - mpEdit->SetText( SdResId(STR_CUSTOMANIMATION_SAMPLE) ); - - mpMenu = maBuilder.get_menu("menu"); - mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpEdit, mpMenu ); - mpControl->SetMenuSelectHdl( LINK( this, FontStylePropertyBox, implMenuSelectHdl )); - mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_FONTSTYLEPROPERTYBOX ); - - setValue( rValue, OUString() ); -} - -FontStylePropertyBox::~FontStylePropertyBox() -{ - maBuilder.disposeBuilder(); - mpControl.disposeAndClear(); -} - -void FontStylePropertyBox::update() -{ - // update menu - mpMenu->CheckItem("bold", mfFontWeight == awt::FontWeight::BOLD); - mpMenu->CheckItem("italic", meFontSlant == awt::FontSlant_ITALIC); - mpMenu->CheckItem("underline", mnFontUnderline != awt::FontUnderline::NONE ); - - // update sample edit - vcl::Font aFont( mpEdit->GetFont() ); - aFont.SetWeight( mfFontWeight == awt::FontWeight::BOLD ? WEIGHT_BOLD : WEIGHT_NORMAL ); - aFont.SetItalic( meFontSlant == awt::FontSlant_ITALIC ? ITALIC_NORMAL : ITALIC_NONE ); - aFont.SetUnderline( mnFontUnderline == awt::FontUnderline::NONE ? LINESTYLE_NONE : LINESTYLE_SINGLE ); - mpEdit->SetFont( aFont ); - mpEdit->Invalidate(); -} - -IMPL_LINK( FontStylePropertyBox, implMenuSelectHdl, MenuButton*, pPb, void ) -{ - OString sIdent = pPb->GetCurItemIdent(); - if (sIdent == "bold") - { - if( mfFontWeight == awt::FontWeight::BOLD ) - mfFontWeight = awt::FontWeight::NORMAL; - else - mfFontWeight = awt::FontWeight::BOLD; - } - else if (sIdent == "italic") - { - if( meFontSlant == awt::FontSlant_ITALIC ) - meFontSlant = awt::FontSlant_NONE; - else - meFontSlant = awt::FontSlant_ITALIC; - } - else if (sIdent == "underline") - { - if( mnFontUnderline == awt::FontUnderline::SINGLE ) - mnFontUnderline = awt::FontUnderline::NONE; - else - mnFontUnderline = awt::FontUnderline::SINGLE; - } - - update(); - maModifyHdl.Call(nullptr); -} - -void FontStylePropertyBox::setValue( const Any& rValue, const OUString& ) -{ - Sequence<Any> aValues; - rValue >>= aValues; - - aValues[0] >>= mfFontWeight; - aValues[1] >>= meFontSlant; - aValues[2] >>= mnFontUnderline; - - update(); -} - -Any FontStylePropertyBox::getValue() -{ - Sequence<Any> aValues(3); - aValues[0] <<= mfFontWeight; - aValues[1] <<= meFontSlant; - aValues[2] <<= mnFontUnderline; - return makeAny( aValues ); -} - -Control* FontStylePropertyBox::getControl() -{ - return mpControl; -} - -namespace { - class SdFontStylePropertyBox : public SdPropertySubControl { public: @@ -2967,102 +2026,6 @@ std::unique_ptr<STLPropertySet> CustomAnimationDialog::createDefaultSet() return pSet; } -PropertyControl::PropertyControl( vcl::Window* pParent ) -: ListBox( pParent, WB_TABSTOP | WB_BORDER | WB_DROPDOWN ) -{ -} - -VCL_BUILDER_FACTORY(PropertyControl) - -PropertyControl::~PropertyControl() -{ - disposeOnce(); -} - -void PropertyControl::dispose() -{ - mpSubControl.reset(); - ListBox::dispose(); -} - -void PropertyControl::setSubControl( std::unique_ptr<PropertySubControl> pSubControl ) -{ - mpSubControl = std::move(pSubControl); - - Control* pControl = mpSubControl ? mpSubControl->getControl() : nullptr; - - if( pControl ) - { - pControl->SetPosSizePixel( GetPosPixel(), GetSizePixel() ); - pControl->SetZOrder( this, ZOrderFlags::Before ); - pControl->Show(); - Hide(); - } - else - { - Show(); - } -} - -void PropertyControl::Resize() -{ - Control* pControl = mpSubControl ? mpSubControl->getControl() : nullptr; - if( pControl ) - pControl->SetPosSizePixel( GetPosPixel(), GetSizePixel() ); - ListBox::Resize(); -} - -PropertySubControl::~PropertySubControl() -{ -} - -std::unique_ptr<PropertySubControl> PropertySubControl::create( sal_Int32 nType, vcl::Window* pParent, const Any& rValue, const OUString& rPresetId, const Link<LinkParamNone*,void>& rModifyHdl ) -{ - std::unique_ptr<PropertySubControl> pSubControl; - switch( nType ) - { - case nPropertyTypeDirection: - case nPropertyTypeSpokes: - case nPropertyTypeZoom: - pSubControl.reset( new PresetPropertyBox( nType, pParent, rValue, rPresetId, rModifyHdl ) ); - break; - - case nPropertyTypeColor: - case nPropertyTypeFillColor: - case nPropertyTypeFirstColor: - case nPropertyTypeCharColor: - case nPropertyTypeLineColor: - pSubControl.reset( new ColorPropertyBox( nType, pParent, rValue, rModifyHdl ) ); - break; - - case nPropertyTypeFont: - pSubControl.reset( new FontPropertyBox( nType, pParent, rValue, rModifyHdl ) ); - break; - - case nPropertyTypeCharHeight: - pSubControl.reset( new CharHeightPropertyBox( nType, pParent, rValue, rModifyHdl ) ); - break; - - case nPropertyTypeRotate: - pSubControl.reset( new RotationPropertyBox( nType, pParent, rValue, rModifyHdl ) ); - break; - - case nPropertyTypeTransparency: - pSubControl.reset( new TransparencyPropertyBox( nType, pParent, rValue, rModifyHdl ) ); - break; - - case nPropertyTypeScale: - pSubControl.reset( new ScalePropertyBox( nType, pParent, rValue, rModifyHdl ) ); - break; - - case nPropertyTypeCharDecoration: - pSubControl.reset( new FontStylePropertyBox( nType, pParent, rValue, rModifyHdl ) ); - break; - } - - return pSubControl; -} - std::unique_ptr<SdPropertySubControl> SdPropertySubControl::create(sal_Int32 nType, weld::Label* pLabel, weld::Container* pParent, weld::Window* pTopLevel, const Any& rValue, const OUString& rPresetId, const Link<LinkParamNone*,void>& rModifyHdl) { std::unique_ptr<SdPropertySubControl> pSubControl; diff --git a/sd/source/ui/animations/CustomAnimationDialog.hxx b/sd/source/ui/animations/CustomAnimationDialog.hxx index 1ed6972e76e4..64272633505d 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.hxx +++ b/sd/source/ui/animations/CustomAnimationDialog.hxx @@ -21,7 +21,6 @@ #define INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONDIALOG_HXX #include <vcl/svapp.hxx> -#include <vcl/lstbox.hxx> #include <vcl/weld.hxx> namespace sd { @@ -89,30 +88,6 @@ const sal_Int32 nPropertyTypeTransparency = 19; const sal_Int32 nPropertyTypeFontStyle = 20; const sal_Int32 nPropertyTypeScale = 21; -class PropertySubControl -{ -public: - explicit PropertySubControl( sal_Int32 nType ) : mnType( nType ) {} - virtual ~PropertySubControl(); - - virtual css::uno::Any getValue() = 0; - virtual void setValue( const css::uno::Any& rValue, const OUString& rPresetId ) = 0; - - virtual Control* getControl() = 0; - - static std::unique_ptr<PropertySubControl> - create( sal_Int32 nType, - vcl::Window* pParent, - const css::uno::Any& rValue, - const OUString& rPresetId, - const Link<LinkParamNone*,void>& rModifyHdl ); - - sal_Int32 getControlType() const { return mnType; } - -private: - sal_Int32 mnType; -}; - class SdPropertySubControl { public: @@ -137,22 +112,6 @@ protected: weld::Container* mpParent; }; -class PropertyControl : public ListBox -{ -public: - explicit PropertyControl( vcl::Window* pParent ); - virtual ~PropertyControl() override; - virtual void dispose() override; - - void setSubControl( std::unique_ptr<PropertySubControl> pSubControl ); - PropertySubControl* getSubControl() const { return mpSubControl.get(); } - - virtual void Resize() override; - -private: - std::unique_ptr<PropertySubControl> mpSubControl; -}; - class CustomAnimationDurationTabPage; class CustomAnimationEffectTabPage; class CustomAnimationTextAnimTabPage; |