diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-21 17:09:42 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-22 20:28:23 +0200 |
commit | 32eac27a2c22aae63941479482ef21e8d75a5122 (patch) | |
tree | 64e7e5dff4ac0fbd7c117b398e365a0728fdde1e /include | |
parent | 47f84e024344d9a50e44dda4f947945e8fc643b5 (diff) |
weld AlignmentTabPage
Change-Id: I253a01b053efe836b0657f9a711cecd060b6782b
Reviewed-on: https://gerrit.libreoffice.org/60883
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/controlwrapper.hxx | 70 | ||||
-rw-r--r-- | include/sfx2/itemconnect.hxx | 83 | ||||
-rw-r--r-- | include/svtools/valueset.hxx | 12 | ||||
-rw-r--r-- | include/svx/dialcontrol.hxx | 26 | ||||
-rw-r--r-- | include/svx/frmdirlbox.hxx | 22 | ||||
-rw-r--r-- | include/svx/orienthelper.hxx | 19 | ||||
-rw-r--r-- | include/vcl/customweld.hxx | 1 |
7 files changed, 26 insertions, 207 deletions
diff --git a/include/sfx2/controlwrapper.hxx b/include/sfx2/controlwrapper.hxx index 1758d708c455..549c21573219 100644 --- a/include/sfx2/controlwrapper.hxx +++ b/include/sfx2/controlwrapper.hxx @@ -122,12 +122,8 @@ private: | | +- [ValueType]MetricFieldWrapper [1] [2] | | | +- ListBoxWrapper< ValueT > [1] - | | | - | | +- [ValueType]ListBoxWrapper [1] [2] - | | - | +- ValueSetWrapper< ValueT > [1] | | - | +- [ValueType]ValueSetWrapper [1] [2] + | +- [ValueType]ListBoxWrapper [1] [2] | +- MultiControlWrapperHelper | @@ -226,21 +222,6 @@ public: }; -/** A wrapper for the VCL CheckBox. */ -class SFX2_DLLPUBLIC CheckBoxWrapper: - public SingleControlWrapper< CheckBox, bool > -{ -public: - explicit CheckBoxWrapper( CheckBox& rCheckBox ); - - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool bSet ) override; - - virtual bool GetControlValue() const override; - virtual void SetControlValue( bool bValue ) override; -}; - - /** A wrapper for the VCL MetricField. Adds support for field units during accessing the control value. The @@ -298,39 +279,6 @@ public: }; -#define WRAPPER_VALUESET_ITEM_NOTFOUND 0xFFFF /* XXX was value of VALUESET_ITEM_NOTFOUND */ - -/** A wrapper for the SVTOOLS ValueSet. - - If a position<->value map is passed to the constructor, it MUST be - terminated with an entry containing WRAPPER_VALUESET_ITEM_NOTFOUND as list - position. See documentation of the PosValueMapper template for details. - */ -template< typename ValueT > -class ValueSetWrapper : - public SingleControlWrapper< ValueSet, ValueT >, - public PosValueMapper< ValueSetPosType, ValueT > -{ - typedef PosValueMapper< ValueSetPosType, ValueT > MapperType; - -public: - typedef typename MapperType::MapEntryType MapEntryType; - - /** @param pMap Optional position <-> value map. - See PosValueMapper documentation for details. */ - explicit ValueSetWrapper( ValueSet& rValueSet, const MapEntryType* pMap ) : - SingleControlWrapper< ValueSet, ValueT >( rValueSet ), MapperType( WRAPPER_VALUESET_ITEM_NOTFOUND, pMap ) {} - - virtual bool IsControlDontKnow() const override - { return this->GetControl().IsNoSelection(); } - virtual void SetControlDontKnow( bool bSet ) override - { if( bSet ) this->GetControl().SetNoSelection(); } - - virtual ValueT GetControlValue() const override; - virtual void SetControlValue( ValueT nValue ) override; -}; - - // *** Implementation of template functions *** @@ -424,22 +372,6 @@ void ListBoxWrapper< ValueT >::SetControlValue( ValueT nValue ) this->GetControl().SelectEntryPos( nPos ); } - -template< typename ValueT > -ValueT ValueSetWrapper< ValueT >::GetControlValue() const -{ - return this->GetValueFromPos( this->GetControl().GetSelectedItemId() ); -} - -template< typename ValueT > -void ValueSetWrapper< ValueT >::SetControlValue( ValueT nValue ) -{ - sal_uInt16 nPos = this->GetPosFromValue( nValue ); - if( nPos != this->GetNotFoundPos() ) - this->GetControl().SelectItem( nPos ); -} - - } // namespace sfx #endif diff --git a/include/sfx2/itemconnect.hxx b/include/sfx2/itemconnect.hxx index a4a122cddaac..622114e0a2d5 100644 --- a/include/sfx2/itemconnect.hxx +++ b/include/sfx2/itemconnect.hxx @@ -143,23 +143,13 @@ namespace sfx { | +- ItemControlConnection< ItemWrpT, ControlWrpT > | | - | +- CheckBoxConnection [1] - | | | +- NumericConnection< ItemWrpT > [1] | | | | | +- [ValueType]NumericConnection [1] [2] | | - | +- MetricConnection< ItemWrpT > [1] - | | | - | | +- [ValueType]MetricConnection [1] [2] - | | | +- ListBoxConnection< ItemWrpT > [1] - | | | - | | +- [ValueType]ListBoxConnection [1] [2] - | | - | +- ValueSetConnection< ItemWrpT > [1] | | - | +- [ValueType]ValueSetConnection [1] [2] + | +- [ValueType]ListBoxConnection [1] [2] | +- ItemConnectionArray [1] @@ -273,34 +263,6 @@ private: sal_uInt16 mnSlot; }; - -/** Connection between an SfxBoolItem and a VCL CheckBox. */ -typedef ItemControlConnection< BoolItemWrapper, CheckBoxWrapper > CheckBoxConnection; - - -/** Connection between an item and the VCL MetricField. - - Adds support of different field units during control value <-> item value - conversion. The field unit passed to the constructor applies for the item - values, while the field unit used in the control has to be set at the - control itself. - */ -template< typename ItemWrpT > -class MetricConnection : public ItemControlConnection< ItemWrpT, - MetricFieldWrapper< typename ItemWrpT::ItemValueType > > -{ - typedef ItemControlConnection< ItemWrpT, - MetricFieldWrapper< typename ItemWrpT::ItemValueType > > - ItemControlConnectionType; - -public: - typedef typename ItemControlConnectionType::ControlWrapperType MetricFieldWrapperType; - - explicit MetricConnection( sal_uInt16 nSlot, MetricField& rField, - FieldUnit eItemUnit, ItemConnFlags nFlags = ItemConnFlags::NONE ); -}; - - /** Connection between an item and a VCL ListBox. Optionally a map can be passed that maps list box positions to item values. @@ -326,31 +288,6 @@ public: }; -/** Connection between an item and an SVTOOLS ValueSet. - - Optionally a map can be passed that maps value set identifiers to item - values. This map MUST be terminated with an entry containing - WRAPPER_VALUESET_ITEM_NOTFOUND as value set identifier. The item value - contained in this last entry is used as default item value in case of an - error. - */ -template< typename ItemWrpT > -class ValueSetConnection : public ItemControlConnection< ItemWrpT, - ValueSetWrapper< typename ItemWrpT::ItemValueType > > -{ - typedef ItemControlConnection< ItemWrpT, - ValueSetWrapper< typename ItemWrpT::ItemValueType > > - ItemControlConnectionType; - -public: - typedef typename ItemControlConnectionType::ControlWrapperType ValueSetWrapperType; - typedef typename ValueSetWrapperType::MapEntryType MapEntryType; - - explicit ValueSetConnection( sal_uInt16 nSlot, ValueSet& rValueSet, - const MapEntryType* pMap, ItemConnFlags nFlags = ItemConnFlags::NONE ); -}; - - // Array of connections @@ -462,15 +399,6 @@ bool ItemControlConnection< ItemWrpT, ControlWrpT >::FillItemSet( // Standard connections - -template< typename ItemWrpT > -MetricConnection< ItemWrpT >::MetricConnection( - sal_uInt16 nSlot, MetricField& rField, FieldUnit eItemUnit, ItemConnFlags nFlags ) : - ItemControlConnectionType( nSlot, new MetricFieldWrapperType( rField, eItemUnit ), nFlags ) -{ -} - - template< typename ItemWrpT > ListBoxConnection< ItemWrpT >::ListBoxConnection( sal_uInt16 nSlot, ListBox& rListBox, const MapEntryType* pMap, ItemConnFlags nFlags ) : @@ -478,15 +406,6 @@ ListBoxConnection< ItemWrpT >::ListBoxConnection( { } - -template< typename ItemWrpT > -ValueSetConnection< ItemWrpT >::ValueSetConnection( - sal_uInt16 nSlot, ValueSet& rValueSet, const MapEntryType* pMap, ItemConnFlags nFlags ) : - ItemControlConnectionType( nSlot, new ValueSetWrapperType( rValueSet, pMap ), nFlags ) -{ -} - - } // namespace sfx #endif diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 6804a9622c90..7bd827eca220 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -421,6 +421,7 @@ private: long mnUserItemWidth; long mnUserItemHeight; sal_uInt16 mnSelItemId; + int mnSavedItemId; sal_uInt16 mnHighItemId; sal_uInt16 mnCols; sal_uInt16 mnCurCol; @@ -581,6 +582,17 @@ public: return mbEdgeBlending; } void SetEdgeBlending(bool bNew); + + void SaveValue() + { + mnSavedItemId = IsNoSelection() ? -1 : GetSelectedItemId(); + } + + bool IsValueChangedFromSaved() const + { + int nItemId = IsNoSelection() ? -1 : GetSelectedItemId(); + return mnSavedItemId != nItemId; + } }; diff --git a/include/svx/dialcontrol.hxx b/include/svx/dialcontrol.hxx index 085cb0ce4c1c..44a8291d7435 100644 --- a/include/svx/dialcontrol.hxx +++ b/include/svx/dialcontrol.hxx @@ -22,6 +22,7 @@ #include <memory> #include <vcl/ctrl.hxx> +#include <vcl/customweld.hxx> #include <vcl/weld.hxx> #include <sfx2/itemconnect.hxx> #include <svx/svxdllapi.h> @@ -179,6 +180,8 @@ public: sal_Int32 GetRotation() const; /** Sets the rotation to the passed value (in 1/100 degrees). */ void SetRotation( sal_Int32 nAngle ); + /** Sets the control to "don't care" state. */ + void SetNoRotation(); /** Links the passed numeric edit field to the control (bi-directional). * nDecimalPlaces: @@ -194,12 +197,16 @@ public: /** Compare value with the saved value */ bool IsValueModified(); + const OUString& GetText() const { return mpImpl->maText; } + void SetText(const OUString& rText) { mpImpl->maText = rText; } + protected: struct DialControl_Impl { ScopedVclPtr<DialControlBmp> mxBmpEnabled; ScopedVclPtr<DialControlBmp> mxBmpDisabled; ScopedVclPtr<DialControlBmp> mxBmpBuffered; + OUString maText; weld::SpinButton* mpLinkField; sal_Int32 mnLinkedFieldValueMultiplyer; Size maWinSize; @@ -209,6 +216,7 @@ protected: sal_Int32 mnOldAngle; long mnCenterX; long mnCenterY; + bool mbNoRot; explicit DialControl_Impl(OutputDevice& rReference); void Init( const Size& rWinSize, const vcl::Font& rWinFont ); @@ -225,26 +233,10 @@ protected: private: void InvalidateControl(); - DECL_LINK( LinkedFieldModifyHdl, weld::SpinButton&, void ); + DECL_LINK(LinkedFieldModifyHdl, weld::Entry&, void); void LinkedFieldModifyHdl(); }; -/** Wrapper for usage of a DialControl in item connections. */ -class SAL_WARN_UNUSED SVX_DLLPUBLIC DialControlWrapper : public sfx::SingleControlWrapper< DialControl, sal_Int32 > -{ -public: - explicit DialControlWrapper( DialControl& rDial ); - - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool bSet ) override; - - virtual sal_Int32 GetControlValue() const override; - virtual void SetControlValue( sal_Int32 nValue ) override; -}; - -/** An item<->control connection for a DialControl. */ -typedef sfx::ItemControlConnection< sfx::Int32ItemWrapper, DialControlWrapper > DialControlConnection; - } #endif diff --git a/include/svx/frmdirlbox.hxx b/include/svx/frmdirlbox.hxx index 62d374e06a13..72455bef1770 100644 --- a/include/svx/frmdirlbox.hxx +++ b/include/svx/frmdirlbox.hxx @@ -69,6 +69,8 @@ public: SvxFrameDirection get_active_id() const { return static_cast<SvxFrameDirection>(m_xControl->get_active_id().toUInt32()); } void set_active_id(SvxFrameDirection eDir) { m_xControl->set_active_id(OUString::number(static_cast<sal_uInt32>(eDir))); } void remove_id(SvxFrameDirection eDir) { m_xControl->remove_id(OUString::number(static_cast<sal_uInt32>(eDir))); } + void set_active(int pos) { m_xControl->set_active(pos); } + void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); } void hide() { m_xControl->hide(); } void show(bool bShow = true) { m_xControl->show(bShow); } int get_count() const { return m_xControl->get_count(); } @@ -80,26 +82,6 @@ public: void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); } }; -/** Wrapper for usage of a FrameDirectionListBox in item connections. */ -class SAL_WARN_UNUSED SVX_DLLPUBLIC FrameDirectionListBoxWrapper : public sfx::SingleControlWrapper< FrameDirectionListBox, SvxFrameDirection > -{ -public: - explicit FrameDirectionListBoxWrapper( FrameDirectionListBox& rListBox ); - - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool bSet ) override; - - virtual SvxFrameDirection GetControlValue() const override; - virtual void SetControlValue( SvxFrameDirection eValue ) override; -}; - -/** Wrapper for usage of a SvxFrameDirectionItem in item connections. */ -typedef sfx::ValueItemWrapper< SvxFrameDirectionItem, SvxFrameDirection > FrameDirItemWrapper; - -/** An item<->control connection for a FrameDirectionListBox. */ -typedef sfx::ItemControlConnection< FrameDirItemWrapper, FrameDirectionListBoxWrapper > FrameDirectionListBoxConnection; - - } #endif diff --git a/include/svx/orienthelper.hxx b/include/svx/orienthelper.hxx index f3d16bc9d614..8140398589a0 100644 --- a/include/svx/orienthelper.hxx +++ b/include/svx/orienthelper.hxx @@ -89,25 +89,6 @@ private: std::unique_ptr< OrientationHelper_Impl > mpImpl; }; - -/** Wrapper for usage of the stacked attribute of an OrientationHelper in item connections. */ -class SVX_DLLPUBLIC OrientStackedWrapper : public sfx::SingleControlWrapper< OrientationHelper, bool > -{ -public: - explicit OrientStackedWrapper( OrientationHelper& rOrientHlp ); - - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool bSet ) override; - - virtual bool GetControlValue() const override; - virtual void SetControlValue( bool bValue ) override; -}; - - -/** An item<->control connection for the stacked attribute of an OrientationHelper. */ -typedef sfx::ItemControlConnection< sfx::BoolItemWrapper, OrientStackedWrapper > OrientStackedConnection; - - } // namespace #endif diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx index 5739ab11dada..5399d6c79c41 100644 --- a/include/vcl/customweld.hxx +++ b/include/vcl/customweld.hxx @@ -123,6 +123,7 @@ public: void set_margin_bottom(int nMargin) { m_xDrawingArea->set_margin_bottom(nMargin); } void set_sensitive(bool bSensitive) { m_xDrawingArea->set_sensitive(bSensitive); } bool get_sensitive() const { return m_xDrawingArea->get_sensitive(); } + bool get_visible() const { return m_xDrawingArea->get_visible(); } }; } #endif |