diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-28 09:58:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-28 13:31:49 +0200 |
commit | 2fbb97367ac93eb11429382f31fa6417eec76f8d (patch) | |
tree | 91b03fca5308c5fbe19bb309192bb75591e1f810 /include | |
parent | d664a01f3be81572526d1136c261d86c12f5af90 (diff) |
loplugin:unusedmethods
Change-Id: I5f9ef043d76c55f2c761fd08a2bc1dae66b675c8
Reviewed-on: https://gerrit.libreoffice.org/61073
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/controlwrapper.hxx | 62 | ||||
-rw-r--r-- | include/sfx2/itemconnect.hxx | 217 | ||||
-rw-r--r-- | include/sfx2/itemwrapper.hxx | 111 | ||||
-rw-r--r-- | include/svx/orienthelper.hxx | 3 | ||||
-rw-r--r-- | include/svx/svdundo.hxx | 21 |
5 files changed, 0 insertions, 414 deletions
diff --git a/include/sfx2/controlwrapper.hxx b/include/sfx2/controlwrapper.hxx index 549c21573219..c678922dbbab 100644 --- a/include/sfx2/controlwrapper.hxx +++ b/include/sfx2/controlwrapper.hxx @@ -146,11 +146,6 @@ public: @descr Will do nothing, if the corresponding parameter is TRISTATE_INDET. */ virtual void ModifyControl( TriState eShow ) = 0; - /** Derived classes return true if the control is in "don't know" state. */ - virtual bool IsControlDontKnow() const = 0; - /** Derived classes set the control to "don't know" state. */ - virtual void SetControlDontKnow( bool bSet ) = 0; - private: ControlWrapperBase( const ControlWrapperBase& ) = delete; ControlWrapperBase& operator=( const ControlWrapperBase& ) = delete; @@ -214,38 +209,11 @@ class SFX2_DLLPUBLIC DummyWindowWrapper: public: explicit DummyWindowWrapper( vcl::Window& rWindow ); - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool ) override; - virtual void* GetControlValue() const override; virtual void SetControlValue( void* ) override; }; -/** A wrapper for the VCL MetricField. - - Adds support for field units during accessing the control value. The - wrapper respects the field unit set at the control itself and converts it - from/to the field unit passed to the constructor. - */ -template< typename ValueT > -class MetricFieldWrapper : public SingleControlWrapper< MetricField, ValueT > -{ -public: - explicit MetricFieldWrapper( MetricField& rField, FieldUnit eUnit ) : - SingleControlWrapper< MetricField, ValueT >( rField ), meUnit( eUnit ) {} - - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool bSet ) override; - - virtual ValueT GetControlValue() const override; - virtual void SetControlValue( ValueT nValue ) override; - -private: - FieldUnit meUnit; -}; - - #define WRAPPER_LISTBOX_ENTRY_NOTFOUND 0xFFFF /* XXX was value of LISTBOX_ENTRY_NOTFOUND */ /** A wrapper for the VCL ListBox. @@ -269,11 +237,6 @@ public: explicit ListBoxWrapper( ListBox& rListBox, const MapEntryType* pMap ) : SingleControlWrapper< ListBox, ValueT >( rListBox ), MapperType( WRAPPER_LISTBOX_ENTRY_NOTFOUND, pMap ) {} - virtual bool IsControlDontKnow() const override - { return this->GetControl().GetSelectedEntryCount() == 0; } - virtual void SetControlDontKnow( bool bSet ) override - { if( bSet ) this->GetControl().SetNoSelection(); } - virtual ValueT GetControlValue() const override; virtual void SetControlValue( ValueT nValue ) override; }; @@ -334,31 +297,6 @@ inline void SingleControlWrapper< ControlT, ValueT >::ModifyControl( TriState eS template< typename ValueT > -bool MetricFieldWrapper< ValueT >::IsControlDontKnow() const -{ - return this->GetControl().GetText().isEmpty(); -} - -template< typename ValueT > -void MetricFieldWrapper< ValueT >::SetControlDontKnow( bool bSet ) -{ - if( bSet ) - this->GetControl().SetText( OUString() ); -} - -template< typename ValueT > -ValueT MetricFieldWrapper< ValueT >::GetControlValue() const -{ - return static_cast< ValueT >( this->GetControl().Denormalize( this->GetControl().GetValue( meUnit ) ) ); -} - -template< typename ValueT > -void MetricFieldWrapper< ValueT >::SetControlValue( ValueT nValue ) -{ - this->GetControl().SetValue( this->GetControl().Normalize( static_cast< sal_Int64 >( nValue ) ), meUnit ); -} - -template< typename ValueT > ValueT ListBoxWrapper< ValueT >::GetControlValue() const { return this->GetValueFromPos( this->GetControl().GetSelectedEntryPos() ); diff --git a/include/sfx2/itemconnect.hxx b/include/sfx2/itemconnect.hxx index 622114e0a2d5..377a60eb7bd6 100644 --- a/include/sfx2/itemconnect.hxx +++ b/include/sfx2/itemconnect.hxx @@ -189,223 +189,6 @@ private: ItemConnFlags mnFlags; /// Flags for additional options. }; - -/** Base class template for single item <-> single control connection objects. - - This template uses functions provided by the SingleItemWrapper and the - SingleControlWrapper template classes. The virtual functions ApplyFlags(), - Reset(), and FillItemSet() are implemented here in a generic way using the - virtual functions of the wrapper classes. Derived classes only have to - create or otherwise provide appropriate wrappers. - */ -template< typename ItemWrpT, typename ControlWrpT > -class ItemControlConnection : public ItemConnectionBase -{ -public: - typedef ItemWrpT ItemWrapperType; - typedef ControlWrpT ControlWrapperType; - typedef ItemControlConnection< ItemWrpT, ControlWrpT > ItemControlConnectionType; - typedef typename ItemWrpT::ItemType ItemType; - typedef typename ItemWrpT::ItemValueType ItemValueType; - typedef typename ControlWrpT::ControlType ControlType; - typedef typename ControlWrpT::ControlValueType ControlValueType; - - /** Receives pointer to a newly created control wrapper. - @descr Takes ownership of the control wrapper. */ - explicit ItemControlConnection( sal_uInt16 nSlot, ControlWrpT* pNewCtrlWrp, - ItemConnFlags nFlags ); - - /** Convenience constructor. Receives reference to a control directly. - @descr May only be used, if ControlWrpT::ControlWrpT( ControlType& ) - constructor exists. */ - explicit ItemControlConnection( sal_uInt16 nSlot, ControlType& rControl, - ItemConnFlags nFlags = ItemConnFlags::NONE ); - - virtual ~ItemControlConnection() override; - -protected: - /** Actions according to current flags for the control. */ - virtual void ApplyFlags( const SfxItemSet* pItemSet ) override; - /** Resets the control according to the item contents. */ - virtual void Reset( const SfxItemSet* pItemSet ) override; - /** Fills the item set according to the control's state. */ - virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ) override; - - ItemWrapperType maItemWrp; - std::unique_ptr<ControlWrpT> mxCtrlWrp; - bool mbModified; -}; - - -// Standard connections - - -/** This is a helper class to enable/disable/show/hide a control only. - - This class does nothing special in the Reset() and FillItemSet() functions. - It can be used to control the visibility of i.e. fixed lines or fixed texts - related to the availability of an item by passing the appropriate flags to - the constructor of this connection. - */ -class SFX2_DLLPUBLIC DummyItemConnection: - public ItemConnectionBase, public DummyWindowWrapper -{ -public: - explicit DummyItemConnection( sal_uInt16 nSlot, vcl::Window& rWindow, - ItemConnFlags nFlags ); - -protected: - virtual void ApplyFlags( const SfxItemSet* pItemSet ) override; - virtual void Reset( const SfxItemSet* pItemSet ) override; - virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ) override; - -private: - sal_uInt16 mnSlot; -}; - -/** Connection between an item and a VCL ListBox. - - Optionally a map can be passed that maps list box positions to item values. - This map MUST be terminated with an entry containing - WRAPPER_LISTBOX_ENTRY_NOTFOUND as list box position. The item value - contained in this last entry is used as default item value in case of an - error. - */ -template< typename ItemWrpT > -class ListBoxConnection : public ItemControlConnection< ItemWrpT, - ListBoxWrapper< typename ItemWrpT::ItemValueType > > -{ - typedef ItemControlConnection< ItemWrpT, - ListBoxWrapper< typename ItemWrpT::ItemValueType > > - ItemControlConnectionType; - -public: - typedef typename ItemControlConnectionType::ControlWrapperType ListBoxWrapperType; - typedef typename ListBoxWrapperType::MapEntryType MapEntryType; - - explicit ListBoxConnection( sal_uInt16 nSlot, ListBox& rListBox, - const MapEntryType* pMap, ItemConnFlags nFlags = ItemConnFlags::NONE ); -}; - - -// Array of connections - - -class ItemConnectionArrayImpl; - -/** A container of connection objects. - - This is a connection with the only purpose to contain other connection - objects. This way it is possible to create a tree structure of connections - for a convenient connection management. This class is used by the class - SfxTabPage to store all connections. - */ -class ItemConnectionArray : public ItemConnectionBase -{ -public: - explicit ItemConnectionArray(); - virtual ~ItemConnectionArray() override; - - /** Adds a new connection to the list. - @descr Takes ownership of the connection! */ - void AddConnection( ItemConnectionBase* pConnection ); - -protected: - virtual void ApplyFlags( const SfxItemSet* pItemSet ) override; - virtual void Reset( const SfxItemSet* pItemSet ) override; - virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ) override; - -private: - std::unique_ptr< ItemConnectionArrayImpl > mxImpl; -}; - - -// *** Implementation of template functions *** - - -// Base connection classes - - -template< typename ItemWrpT, typename ControlWrpT > -ItemControlConnection< ItemWrpT, ControlWrpT >::ItemControlConnection( - sal_uInt16 nSlot, ControlWrpT* pNewCtrlWrp, ItemConnFlags nFlags ) : - ItemConnectionBase( nFlags ), - maItemWrp( nSlot ), - mxCtrlWrp( pNewCtrlWrp ), - mbModified( false ) -{ -} - -template< typename ItemWrpT, typename ControlWrpT > -ItemControlConnection< ItemWrpT, ControlWrpT >::ItemControlConnection( - sal_uInt16 nSlot, ControlType& rControl, ItemConnFlags nFlags ) : - ItemConnectionBase( nFlags ), - maItemWrp( nSlot ), - mxCtrlWrp( new ControlWrpT( rControl ) ), - mbModified( false ) -{ -} - -template< typename ItemWrpT, typename ControlWrpT > -ItemControlConnection< ItemWrpT, ControlWrpT >::~ItemControlConnection() -{ -} - -template< typename ItemWrpT, typename ControlWrpT > -void ItemControlConnection< ItemWrpT, ControlWrpT >::ApplyFlags( const SfxItemSet* pItemSet ) -{ - bool bKnown = ItemWrapperHelper::IsKnownItem( *pItemSet, maItemWrp.GetSlotId() ); - mxCtrlWrp->ModifyControl( GetShowState( bKnown ) ); -} - -template< typename ItemWrpT, typename ControlWrpT > -void ItemControlConnection< ItemWrpT, ControlWrpT >::Reset( const SfxItemSet* pItemSet ) -{ - const ItemType* pItem = maItemWrp.GetUniqueItem( *pItemSet ); - mxCtrlWrp->SetControlDontKnow( pItem == nullptr ); - if( pItem ) - mxCtrlWrp->SetControlValue( maItemWrp.GetItemValue( *pItem ) ); - mbModified = false; -} - -template< typename ItemWrpT, typename ControlWrpT > -bool ItemControlConnection< ItemWrpT, ControlWrpT >::FillItemSet( - SfxItemSet& rDestSet, const SfxItemSet& rOldSet ) -{ - const ItemType* pOldItem = maItemWrp.GetUniqueItem( rOldSet ); - if( !mxCtrlWrp->IsControlDontKnow() ) - { - // first store the control value in a local variable - ControlValueType aCtrlValue( mxCtrlWrp->GetControlValue() ); - // convert to item value type -> possible to convert i.e. from 'T' to 'const T&' - ItemValueType aNewValue( aCtrlValue ); - // do not rely on existence of ItemValueType::operator!= - if( mbModified || !pOldItem || !(maItemWrp.GetItemValue( *pOldItem ) == aNewValue) ) - { - sal_uInt16 nWhich = ItemWrapperHelper::GetWhichId( rDestSet, maItemWrp.GetSlotId() ); - std::unique_ptr< ItemType > xItem( - static_cast< ItemType* >( maItemWrp.GetDefaultItem( rDestSet ).Clone() ) ); - xItem->SetWhich( nWhich ); - maItemWrp.SetItemValue( *xItem, aNewValue ); - rDestSet.Put( *xItem ); - mbModified = true; - } - } - if( !mbModified ) - ItemWrapperHelper::RemoveDefaultItem( rDestSet, rOldSet, maItemWrp.GetSlotId() ); - return mbModified; -} - - -// Standard connections - -template< typename ItemWrpT > -ListBoxConnection< ItemWrpT >::ListBoxConnection( - sal_uInt16 nSlot, ListBox& rListBox, const MapEntryType* pMap, ItemConnFlags nFlags ) : - ItemControlConnectionType( nSlot, new ListBoxWrapperType( rListBox, pMap ), nFlags ) -{ -} - } // namespace sfx #endif diff --git a/include/sfx2/itemwrapper.hxx b/include/sfx2/itemwrapper.hxx index 7907da7ad6af..193cd012e550 100644 --- a/include/sfx2/itemwrapper.hxx +++ b/include/sfx2/itemwrapper.hxx @@ -53,117 +53,6 @@ public: static void RemoveDefaultItem( SfxItemSet& rDestSet, const SfxItemSet& rOldSet, sal_uInt16 nSlot ); }; - -// Item wrappers - - -/** Base class wrapping a single item. - - Objects of this class store the SID of an item. Exchanging data with the - item is done with the virtual functions GetItemValue() and SetItemValue(). - Derived classes implement these functions according to the item type they - work on. - - The current tree of base classes/templates and standard item wrappers: - - SingleItemWrapper< ItemT, ValueT > - | - +- ValueItemWrapper< ItemT, ValueT > [1] - | | - | +- BoolItemWrapper [1] - | +- UInt16ItemWrapper [1] - | +- Int32ItemWrapper [1] - | - +- IdentItemWrapper< ItemT > [1] - - Notes: - [1] Standard wrappers ready to use. - - See documentation of class ItemConnectionBase for more details. - */ -template< typename ItemT, typename ValueT > -class SingleItemWrapper -{ -public: - typedef ItemT ItemType; - typedef ValueT ItemValueType; - typedef SingleItemWrapper< ItemT, ValueT > SingleItemWrapperType; - - explicit SingleItemWrapper( sal_uInt16 nSlot ) : mnSlot( nSlot ) {} - - virtual ~SingleItemWrapper() {} - - /** Returns the SID this wrapper works on. */ - sal_uInt16 GetSlotId() const { return mnSlot; } - - /** Returns the item from an item set, if it is not in "don't know" state. - @descr Similar to ItemWrapperHelper::GetUniqueItem(), but works always - with the own SID and returns the correct item type. - @return Pointer to item, or 0 if it has "don't know" state. */ - const ItemT* GetUniqueItem( const SfxItemSet& rItemSet ) const; - /** Returns the default item from the pool of the passed item set. - @descr Similar to ItemWrapperHelper::GetDefaultItem(), but works - always with the own SID and returns the correct item type. */ - const ItemT& GetDefaultItem( const SfxItemSet& rItemSet ) const; - - /** Derived classes return the value of the passed item. */ - virtual ValueT GetItemValue( const ItemT& rItem ) const = 0; - /** Derived classes set the value at the passed item. */ - virtual void SetItemValue( ItemT& rItem, ValueT aValue ) const = 0; - -private: - sal_uInt16 mnSlot; /// The SID of this item wrapper. -}; - - -/** An item wrapper usable for most types of items. - - The item type must support the following functions: - - ValueT ItemT::GetValue() const - - void ItemT::SetValue( ValueT ) - - The template parameter InternalValueT can be used to specify the internal - value type of the item, if it differs from ValueT. This parameter has to be - used to prevent compiler warnings. - */ -template< typename ItemT, typename ValueT, typename InternalValueT = ValueT > -class ValueItemWrapper : public SingleItemWrapper< ItemT, ValueT > -{ -public: - explicit ValueItemWrapper( sal_uInt16 nSlot ) : - SingleItemWrapper< ItemT, ValueT >( nSlot ) {} - - virtual ValueT GetItemValue( const ItemT& rItem ) const override - { return static_cast< ValueT >( rItem.GetValue() ); } - virtual void SetItemValue( ItemT& rItem, ValueT aValue ) const override - { rItem.SetValue( static_cast< InternalValueT >( aValue ) ); } -}; - - -typedef ValueItemWrapper< SfxBoolItem, sal_Bool > BoolItemWrapper; -typedef ValueItemWrapper< SfxUInt16Item, sal_uInt16 > UInt16ItemWrapper; -typedef ValueItemWrapper< SfxInt32Item, sal_Int32 > Int32ItemWrapper; - - -// *** Implementation of template functions *** - - -// Item wrappers - - -template< typename ItemT, typename ValueT > -const ItemT* SingleItemWrapper< ItemT, ValueT >::GetUniqueItem( const SfxItemSet& rItemSet ) const -{ - return static_cast< const ItemT* >( ItemWrapperHelper::GetUniqueItem( rItemSet, mnSlot ) ); -} - -template< typename ItemT, typename ValueT > -const ItemT& SingleItemWrapper< ItemT, ValueT >::GetDefaultItem( const SfxItemSet& rItemSet ) const -{ - return static_cast< const ItemT& >( ItemWrapperHelper::GetDefaultItem( rItemSet, mnSlot ) ); -} - - } // namespace sfx #endif diff --git a/include/svx/orienthelper.hxx b/include/svx/orienthelper.hxx index 8140398589a0..c5cf59892b93 100644 --- a/include/svx/orienthelper.hxx +++ b/include/svx/orienthelper.hxx @@ -82,9 +82,6 @@ public: /** Returns the state of the "stacked" check box. */ TriState GetStackedState() const; - /** Enables/disables the "don't know" state of the "Stacked text" check box. */ - void EnableStackedTriState( bool bEnable ); - private: std::unique_ptr< OrientationHelper_Impl > mpImpl; }; diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx index 9e969ebbbb4f..67d02218ef36 100644 --- a/include/svx/svdundo.hxx +++ b/include/svx/svdundo.hxx @@ -187,7 +187,6 @@ class SVX_DLLPUBLIC SdrUndoMoveObj final : public SdrUndoObj Size aDistance; // Distance by which we move public: - SdrUndoMoveObj(SdrObject& rNewObj): SdrUndoObj(rNewObj) {} SdrUndoMoveObj(SdrObject& rNewObj, const Size& rDist): SdrUndoObj(rNewObj),aDistance(rDist) {} virtual ~SdrUndoMoveObj() override; @@ -512,26 +511,6 @@ public: virtual OUString GetComment() const override; }; -/** - * Moving a Layer. - * Create Action before the Move. - */ - -class SdrUndoMoveLayer : public SdrUndoLayer -{ - sal_uInt16 nNewPos; - -public: - SdrUndoMoveLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel, sal_uInt16 nNewPos1) - : SdrUndoLayer(nLayerNum,rNewLayerAdmin,rNewModel), nNewPos(nNewPos1) {} - - virtual void Undo() override; - virtual void Redo() override; - - virtual OUString GetComment() const override; -}; - - /* * Pages */ |