diff options
Diffstat (limited to 'tools/inc/tools/multisel.hxx')
-rw-r--r-- | tools/inc/tools/multisel.hxx | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/tools/inc/tools/multisel.hxx b/tools/inc/tools/multisel.hxx index dd8a751db5f7..de5f55487459 100644 --- a/tools/inc/tools/multisel.hxx +++ b/tools/inc/tools/multisel.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,7 +44,7 @@ DECLARE_LIST( ImpSelList, Range* ) #define ImpSelList List #endif -#define SFX_ENDOFSELECTION CONTAINER_ENTRY_NOTFOUND +#define SFX_ENDOFSELECTION CONTAINER_ENTRY_NOTFOUND //------------------------------------------------------------------ @@ -55,21 +55,21 @@ DECLARE_LIST( ImpSelList, Range* ) class TOOLS_DLLPUBLIC MultiSelection { private: - ImpSelList aSels; // array of SV-selections - Range aTotRange; // total range of indexes - ULONG nCurSubSel; // index in aSels of current selected index - long nCurIndex; // current selected entry - ULONG nSelCount; // number of selected indexes - BOOL bInverseCur;// inverse cursor - BOOL bCurValid; // are nCurIndex and nCurSubSel valid - BOOL bSelectNew; // auto-select newly inserted indexes + ImpSelList aSels; // array of SV-selections + Range aTotRange; // total range of indexes + ULONG nCurSubSel; // index in aSels of current selected index + long nCurIndex; // current selected entry + ULONG nSelCount; // number of selected indexes + BOOL bInverseCur;// inverse cursor + BOOL bCurValid; // are nCurIndex and nCurSubSel valid + BOOL bSelectNew; // auto-select newly inserted indexes #ifdef _SV_MULTISEL_CXX - TOOLS_DLLPRIVATE void ImplClear(); - TOOLS_DLLPRIVATE ULONG ImplFindSubSelection( long nIndex ) const; - TOOLS_DLLPRIVATE BOOL ImplMergeSubSelections( ULONG nPos1, ULONG nPos2 ); - TOOLS_DLLPRIVATE long ImplFwdUnselected(); - TOOLS_DLLPRIVATE long ImplBwdUnselected(); + TOOLS_DLLPRIVATE void ImplClear(); + TOOLS_DLLPRIVATE ULONG ImplFindSubSelection( long nIndex ) const; + TOOLS_DLLPRIVATE BOOL ImplMergeSubSelections( ULONG nPos1, ULONG nPos2 ); + TOOLS_DLLPRIVATE long ImplFwdUnselected(); + TOOLS_DLLPRIVATE long ImplBwdUnselected(); #endif public: @@ -82,35 +82,35 @@ public: ~MultiSelection(); MultiSelection& operator= ( const MultiSelection& rOrig ); - BOOL operator== ( MultiSelection& rOrig ); - BOOL operator!= ( MultiSelection& rOrig ) + BOOL operator== ( MultiSelection& rOrig ); + BOOL operator!= ( MultiSelection& rOrig ) { return !operator==( rOrig ); } - BOOL operator !() const + BOOL operator !() const { return nSelCount == 0; } - void SelectAll( BOOL bSelect = TRUE ); - BOOL Select( long nIndex, BOOL bSelect = TRUE ); - void Select( const Range& rIndexRange, BOOL bSelect = TRUE ); - BOOL IsSelected( long nIndex ) const; - BOOL IsAllSelected() const + void SelectAll( BOOL bSelect = TRUE ); + BOOL Select( long nIndex, BOOL bSelect = TRUE ); + void Select( const Range& rIndexRange, BOOL bSelect = TRUE ); + BOOL IsSelected( long nIndex ) const; + BOOL IsAllSelected() const { return nSelCount == ULONG(aTotRange.Len()); } - long GetSelectCount() const { return nSelCount; } - - void SetTotalRange( const Range& rTotRange ); - void Insert( long nIndex, long nCount = 1 ); - void Remove( long nIndex ); - void Append( long nCount = 1 ); - - const Range& GetTotalRange() const { return aTotRange; } - BOOL IsCurValid() const { return bCurValid; } - long GetCurSelected() const { return nCurIndex; } - long FirstSelected( BOOL bInverse = FALSE ); - long LastSelected(); - long NextSelected(); - long PrevSelected(); - - ULONG GetRangeCount() const { return aSels.Count(); } - const Range& GetRange( ULONG nRange ) const { return *(const Range*)aSels.GetObject(nRange); } + long GetSelectCount() const { return nSelCount; } + + void SetTotalRange( const Range& rTotRange ); + void Insert( long nIndex, long nCount = 1 ); + void Remove( long nIndex ); + void Append( long nCount = 1 ); + + const Range& GetTotalRange() const { return aTotRange; } + BOOL IsCurValid() const { return bCurValid; } + long GetCurSelected() const { return nCurIndex; } + long FirstSelected( BOOL bInverse = FALSE ); + long LastSelected(); + long NextSelected(); + long PrevSelected(); + + ULONG GetRangeCount() const { return aSels.Count(); } + const Range& GetRange( ULONG nRange ) const { return *(const Range*)aSels.GetObject(nRange); } }; class TOOLS_DLLPUBLIC StringRangeEnumerator @@ -119,7 +119,7 @@ class TOOLS_DLLPUBLIC StringRangeEnumerator { sal_Int32 nFirst; sal_Int32 nLast; - + Range() : nFirst( -1 ), nLast( -1 ) {} Range( sal_Int32 i_nFirst, sal_Int32 i_nLast ) : nFirst( i_nFirst ), nLast( i_nLast ) {} }; @@ -128,7 +128,7 @@ class TOOLS_DLLPUBLIC StringRangeEnumerator sal_Int32 mnMin; sal_Int32 mnMax; sal_Int32 mnOffset; - + bool insertRange( sal_Int32 nFirst, sal_Int32 nLast, bool bSequence, bool bMayAdjust ); bool checkValue( sal_Int32, const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const; public: @@ -138,7 +138,7 @@ public: const std::set< sal_Int32 >* pPossibleValues; sal_Int32 nRangeIndex; sal_Int32 nCurrent; - + friend class StringRangeEnumerator; Iterator( const StringRangeEnumerator* i_pEnum, const std::set< sal_Int32 >* i_pPossibleValues, @@ -156,29 +156,29 @@ public: }; friend class StringRangeEnumerator::Iterator; - + StringRangeEnumerator() : mnCount( 0 ), mnMin( -1 ), mnMax( -1 ), mnOffset( -1 ) {} StringRangeEnumerator( const rtl::OUString& i_rInput, sal_Int32 i_nMinNumber = -1, sal_Int32 i_nMaxNumber = -1, sal_Int32 i_nLogicalOffset = -1 ); - + size_t size() const { return size_t(mnCount); } Iterator begin( const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const; Iterator end( const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const; - + sal_Int32 getMin() const { return mnMin; } void setMin( sal_Int32 i_nMinValue ) { mnMin = i_nMinValue; } sal_Int32 getMax() const { return mnMax; } void setMax( sal_Int32 i_nMaxValue ) { mnMax = i_nMaxValue; } sal_Int32 getLogicalOffset() const { return mnOffset; } void setLogicalOffset( sal_Int32 i_nOffset ) { mnOffset = i_nOffset; } - + bool setRange( const rtl::OUString& i_rNewRange, bool i_bStrict = false ); bool hasValue( sal_Int32 nValue, const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const; - - + + /** i_rPageRange: the string to be changed into a sequence of numbers valid format example "5-3,9,9,7-8" ; instead of ',' ';' or ' ' are allowed as well @@ -189,10 +189,10 @@ public: so the logical offset would be -1 i_nMinNumber: the minimum allowed number, a negative number means no minimum check i_nMaxNumber: the maximum allowed number, a negative number means no maximum check - + @returns: true if the input string was valid, o_rPageVector will contain the resulting sequence false if the input string was invalid, o_rPageVector will be unchanged - + behavior: - only non-negative sequence numbers are allowed - only non-negative values in the input string are allowed @@ -214,6 +214,6 @@ public: ); }; -#endif // _SV_MULTISEL_HXX +#endif // _SV_MULTISEL_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |