From a4f747e9cd70bc25994040e7812680c2c8356c08 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 30 Mar 2020 10:10:08 +0100 Subject: remove newly unused stuff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Idce9955294372817c0dd1f40ebd38f16fc90eab5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91007 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sd/inc/pch/precompiled_sd.hxx | 6 +- sd/inc/pch/precompiled_sdui.hxx | 3 +- sd/source/ui/animations/CustomAnimationDialog.cxx | 1111 +-------------------- sd/source/ui/animations/CustomAnimationDialog.hxx | 41 - 4 files changed, 41 insertions(+), 1120 deletions(-) (limited to 'sd') diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx index 739759515976..a5c508dc8ac4 100644 --- a/sd/inc/pch/precompiled_sd.hxx +++ b/sd/inc/pch/precompiled_sd.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-02-25 20:28:15 using: + Generated on 2020-03-27 20:49:46 using: ./bin/update_pch sd sd --cutoff=4 --exclude:system --exclude:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -73,10 +74,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -91,7 +90,6 @@ #include #include #include -#include #include #include #include diff --git a/sd/inc/pch/precompiled_sdui.hxx b/sd/inc/pch/precompiled_sdui.hxx index 0dad26f2c9dc..49ac3467fc2d 100644 --- a/sd/inc/pch/precompiled_sdui.hxx +++ b/sd/inc/pch/precompiled_sdui.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-02-25 20:28:19 using: + Generated on 2020-03-27 20:49:49 using: ./bin/update_pch sd sdui --cutoff=4 --exclude:system --include:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -174,6 +174,7 @@ #include #include #include +#include #include #include #include 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 #include -#include #include -#include -#include #include #include -#include #include -#include #include #include @@ -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& 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 mpControl; - DECL_LINK(OnSelect, ListBox&, void); - Link maModifyLink; -}; - -} - -PresetPropertyBox::PresetPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const OUString& aPresetId, const Link& rModifyHdl ) -: PropertySubControl( nControlType ), maModifyLink(rModifyHdl) -{ - mpControl = VclPtr::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 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& rModifyHdl ); - virtual ~ColorPropertyBox() override; - - virtual Any getValue() override; - virtual void setValue( const Any& rValue, const OUString& rPresetId ) override; - virtual Control* getControl() override; - -private: - VclPtr mpControl; - DECL_LINK(OnSelect, SvxColorListBox&, void); - Link maModifyLink; -}; - -} - -ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl ) -: PropertySubControl( nControlType ), maModifyLink(rModifyHdl) -{ - mpControl = VclPtr::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& 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& rModifyHdl ); - virtual ~FontPropertyBox() override; - - virtual Any getValue() override; - virtual void setValue( const Any& rValue, const OUString& rPresetId ) override; - - virtual Control* getControl() override; - -private: - VclPtr mpControl; - Link maModifyHdl; - DECL_LINK(ControlSelectHdl, ComboBox&, void); -}; - -} - -FontPropertyBox::FontPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl ) -: PropertySubControl( nControlType ), maModifyHdl(rModifyHdl) -{ - mpControl = VclPtr::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(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& rLink ) { mpDropdownButton->SetSelectHdl( rLink ); } - -private: - VclPtr mpSubControl; - VclPtr mpDropdownButton; - VclPtr 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::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& 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 mpControl; - VclPtr mpMenu; - VclPtr mpMetric; - Link maModifyHdl; -}; - -} - -CharHeightPropertyBox::CharHeightPropertyBox(sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl) - : PropertySubControl(nControlType) - , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/fontsizemenu.ui", "") - , maModifyHdl(rModifyHdl) -{ - mpMetric.set( VclPtr::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::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(fValue * 100.0) ); - } -} - -Any CharHeightPropertyBox::getValue() -{ - return makeAny( static_cast(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& 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 mpControl; - VclPtr mpMenu; - VclPtr mpMetric; - Link maModifyHdl; -}; - -} - -TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl ) -: PropertySubControl( nControlType ) -, maModifyHdl( rModifyHdl ) -{ - mpMetric.set( VclPtr::Create( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) ); - mpMetric->SetUnit( FieldUnit::PERCENT ); - mpMetric->SetMin( 0 ); - mpMetric->SetMax( 100 ); - - mpMenu = VclPtr::Create(); - for( sal_Int32 i = 25; i < 101; i += 25 ) - { - OUString aStr(unicode::formatPercent(i, - Application::GetSettings().GetUILanguageTag())); - mpMenu->InsertItem( i, aStr ); - } - - mpControl = VclPtr::Create( pParent, mpMetric, mpMenu ); - mpControl->SetMenuSelectHdl( LINK( this, TransparencyPropertyBox, implMenuSelectHdl )); - mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_TRANSPARENCYPROPERTYBOX ); - - Link 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(fValue * 100); - mpMetric->SetValue( nValue ); - updateMenu(); - } -} - -Any TransparencyPropertyBox::getValue() -{ - return makeAny( static_cast(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& 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 mpControl; - VclPtr mpMenu; - VclPtr mpMetric; - Link maModifyHdl; -}; - -} - -RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl ) - : PropertySubControl(nControlType) - , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/rotatemenu.ui", "") - , maModifyHdl(rModifyHdl) -{ - mpMetric.set( VclPtr::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::Create( pParent, mpMetric, mpMenu ); - mpControl->SetMenuSelectHdl( LINK( this, RotationPropertyBox, implMenuSelectHdl )); - mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX ); - - Link 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(fValue); - mpMetric->SetValue( nValue ); - updateMenu(); - } -} - -Any RotationPropertyBox::getValue() -{ - return makeAny( static_cast(mpMetric->GetValue()) ); -} - -Control* RotationPropertyBox::getControl() -{ - return mpControl; -} - -namespace { - class SdRotationPropertyBox : public SdPropertySubControl { public: @@ -1146,250 +511,68 @@ SdRotationPropertyBox::SdRotationPropertyBox(weld::Label* pLabel, weld::Containe mxControl->set_help_id(HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX); mxControl->show(); - setValue(rValue, OUString()); -} - -void SdRotationPropertyBox::updateMenu() -{ - sal_Int64 nValue = mxMetric->get_value(FieldUnit::DEGREE); - bool bDirection = nValue >= 0; - nValue = (nValue < 0 ? -nValue : nValue); - - mxControl->set_item_active("90", nValue == 90); - mxControl->set_item_active("180", nValue == 180); - mxControl->set_item_active("360", nValue == 360); - mxControl->set_item_active("720", nValue == 720); - - mxControl->set_item_active("closewise", bDirection); - mxControl->set_item_active("counterclock", !bDirection); -} - -IMPL_LINK_NOARG(SdRotationPropertyBox, implModifyHdl, weld::MetricSpinButton&, void) -{ - updateMenu(); - maModifyHdl.Call(nullptr); -} - -IMPL_LINK(SdRotationPropertyBox, implMenuSelectHdl, const OString&, rIdent, void) -{ - auto nValue = mxMetric->get_value(FieldUnit::DEGREE); - bool bDirection = nValue >= 0; - nValue = (nValue < 0 ? -nValue : nValue); - - if (rIdent == "clockwise") - bDirection = true; - else if (rIdent == "counterclock") - bDirection = false; - else - nValue = rIdent.toInt32(); - - if( !bDirection ) - nValue = -nValue; - - if (nValue != mxMetric->get_value(FieldUnit::DEGREE)) - { - mxMetric->set_value(nValue, FieldUnit::DEGREE); - implModifyHdl(*mxMetric); - } -} - -void SdRotationPropertyBox::setValue( const Any& rValue, const OUString& ) -{ - if (mxMetric) - { - double fValue = 0.0; - rValue >>= fValue; - long nValue = static_cast(fValue); - mxMetric->set_value(nValue, FieldUnit::DEGREE); - updateMenu(); - } -} - -Any SdRotationPropertyBox::getValue() -{ - return makeAny(static_cast(mxMetric->get_value(FieldUnit::DEGREE))); -} - -namespace { - -class ScalePropertyBox : public PropertySubControl -{ -public: - ScalePropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& 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 mpControl; - VclPtr mpMenu; - VclPtr mpMetric; - Link maModifyHdl; - int mnDirection; -}; - -} - -ScalePropertyBox::ScalePropertyBox(sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl) - : PropertySubControl( nControlType ) - , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/scalemenu.ui", "") - , maModifyHdl( rModifyHdl ) -{ - mpMetric.set( VclPtr::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::Create( pParent, mpMetric, mpMenu ); - mpControl->SetMenuSelectHdl( LINK( this, ScalePropertyBox, implMenuSelectHdl )); - mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX ); - - Link aLink( LINK( this, ScalePropertyBox, implModifyHdl ) ); - mpControl->SetModifyHdl( aLink ); - - setValue( rValue, OUString() ); -} - -ScalePropertyBox::~ScalePropertyBox() -{ - maBuilder.disposeBuilder(); - mpControl.disposeAndClear(); + setValue(rValue, OUString()); } -void ScalePropertyBox::updateMenu() +void SdRotationPropertyBox::updateMenu() { - sal_Int64 nValue = mpMetric->GetValue(); + sal_Int64 nValue = mxMetric->get_value(FieldUnit::DEGREE); + bool bDirection = nValue >= 0; + nValue = (nValue < 0 ? -nValue : nValue); - mpMenu->CheckItem("25", nValue == 25); - mpMenu->CheckItem("50", nValue == 50); - mpMenu->CheckItem("150", nValue == 150); - mpMenu->CheckItem("400", nValue == 400); + mxControl->set_item_active("90", nValue == 90); + mxControl->set_item_active("180", nValue == 180); + mxControl->set_item_active("360", nValue == 360); + mxControl->set_item_active("720", nValue == 720); - mpMenu->CheckItem("hori", mnDirection == 1); - mpMenu->CheckItem("vert", mnDirection == 2); - mpMenu->CheckItem("both", mnDirection == 3); + mxControl->set_item_active("closewise", bDirection); + mxControl->set_item_active("counterclock", !bDirection); } -IMPL_LINK_NOARG(ScalePropertyBox, implModifyHdl, Edit&, void) +IMPL_LINK_NOARG(SdRotationPropertyBox, implModifyHdl, weld::MetricSpinButton&, void) { updateMenu(); maModifyHdl.Call(nullptr); } -IMPL_LINK( ScalePropertyBox, implMenuSelectHdl, MenuButton*, pPb, void ) +IMPL_LINK(SdRotationPropertyBox, implMenuSelectHdl, const OString&, rIdent, void) { - sal_Int64 nValue = mpMetric->GetValue(); - - int nDirection = mnDirection; + auto nValue = mxMetric->get_value(FieldUnit::DEGREE); + bool bDirection = nValue >= 0; + nValue = (nValue < 0 ? -nValue : nValue); - OString sIdent(pPb->GetCurItemIdent()); - if (sIdent == "hori") - nDirection = 1; - else if (sIdent == "veri") - nDirection = 2; - else if (sIdent == "both") - nDirection = 3; + if (rIdent == "clockwise") + bDirection = true; + else if (rIdent == "counterclock") + bDirection = false; else - nValue = sIdent.toInt32(); - - bool bModified = false; + nValue = rIdent.toInt32(); - if( nDirection != mnDirection ) - { - mnDirection = nDirection; - bModified = true; - } + if( !bDirection ) + nValue = -nValue; - if( nValue != mpMetric->GetValue() ) + if (nValue != mxMetric->get_value(FieldUnit::DEGREE)) { - mpMetric->SetValue( nValue ); - bModified = true; + mxMetric->set_value(nValue, FieldUnit::DEGREE); + implModifyHdl(*mxMetric); } +} - if( bModified ) +void SdRotationPropertyBox::setValue( const Any& rValue, const OUString& ) +{ + if (mxMetric) { - mpMetric->Modify(); + double fValue = 0.0; + rValue >>= fValue; + long nValue = static_cast(fValue); + mxMetric->set_value(nValue, FieldUnit::DEGREE); 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(fValue1 * 100.0); - else - nValue = static_cast(fValue2 * 100.0); - mpMetric->SetValue( nValue ); - updateMenu(); -} - -Any ScalePropertyBox::getValue() -{ - double fValue1 = static_cast(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() +Any SdRotationPropertyBox::getValue() { - return mpControl; + return makeAny(static_cast(mxMetric->get_value(FieldUnit::DEGREE))); } namespace { @@ -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& 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 mpControl; - VclPtr mpMenu; - VclPtr mpEdit; - Link maModifyHdl; - - float mfFontWeight; - awt::FontSlant meFontSlant; - sal_Int16 mnFontUnderline; -}; - -} - -FontStylePropertyBox::FontStylePropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl ) - : PropertySubControl(nControlType) - , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/fontstylemenu.ui", "") - , maModifyHdl( rModifyHdl ) -{ - mpEdit.set( VclPtr::Create( pParent, WB_TABSTOP|WB_IGNORETAB|WB_NOBORDER|WB_READONLY) ); - mpEdit->SetText( SdResId(STR_CUSTOMANIMATION_SAMPLE) ); - - mpMenu = maBuilder.get_menu("menu"); - mpControl = VclPtr::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 aValues; - rValue >>= aValues; - - aValues[0] >>= mfFontWeight; - aValues[1] >>= meFontSlant; - aValues[2] >>= mnFontUnderline; - - update(); -} - -Any FontStylePropertyBox::getValue() -{ - Sequence 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 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 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::create( sal_Int32 nType, vcl::Window* pParent, const Any& rValue, const OUString& rPresetId, const Link& rModifyHdl ) -{ - std::unique_ptr 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::create(sal_Int32 nType, weld::Label* pLabel, weld::Container* pParent, weld::Window* pTopLevel, const Any& rValue, const OUString& rPresetId, const Link& rModifyHdl) { std::unique_ptr 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 -#include #include 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 - create( sal_Int32 nType, - vcl::Window* pParent, - const css::uno::Any& rValue, - const OUString& rPresetId, - const Link& 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 pSubControl ); - PropertySubControl* getSubControl() const { return mpSubControl.get(); } - - virtual void Resize() override; - -private: - std::unique_ptr mpSubControl; -}; - class CustomAnimationDurationTabPage; class CustomAnimationEffectTabPage; class CustomAnimationTextAnimTabPage; -- cgit