[Libreoffice-commits] core.git: include/tools sw/inc sw/source tools/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 28 06:58:29 UTC 2020


 include/tools/multisel.hxx         |   15 ++++++++-------
 sw/inc/printdata.hxx               |    8 ++++----
 sw/source/core/doc/doc.cxx         |    8 ++++----
 tools/source/memtools/multisel.cxx |   10 +++++-----
 4 files changed, 21 insertions(+), 20 deletions(-)

New commits:
commit 371b84dcb653f241d40265fba9f0d00f7c7e8150
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue Oct 27 20:57:04 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Oct 28 07:57:50 2020 +0100

    std::set->o3tl::sorted_vector in MultiSelection
    
    Change-Id: I88a77f4b07e5aaccc42e6fb6e5bd0366f57381a8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104899
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/tools/multisel.hxx b/include/tools/multisel.hxx
index 3e06a3dce239..176bd9984b53 100644
--- a/include/tools/multisel.hxx
+++ b/include/tools/multisel.hxx
@@ -25,6 +25,7 @@
 
 #include <vector>
 #include <set>
+#include <o3tl/sorted_vector.hxx>
 
 #define SFX_ENDOFSELECTION      (-1)
 
@@ -92,18 +93,18 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC StringRangeEnumerator
     bool setRange( const OUString& i_rNewRange );
     bool insertRange( sal_Int32 nFirst, sal_Int32 nLast, bool bSequence );
     void insertJoinedRanges( const std::vector< sal_Int32 >& rNumbers );
-    bool checkValue( sal_Int32, const std::set< sal_Int32 >* i_pPossibleValues = nullptr ) const;
+    bool checkValue( sal_Int32, const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues = nullptr ) const;
 public:
     class TOOLS_DLLPUBLIC Iterator
     {
         const StringRangeEnumerator*      pEnumerator;
-        const std::set< sal_Int32 >*      pPossibleValues;
+        const o3tl::sorted_vector< sal_Int32 >* pPossibleValues;
         sal_Int32                         nRangeIndex;
         sal_Int32                         nCurrent;
 
         friend class StringRangeEnumerator;
         Iterator( const StringRangeEnumerator* i_pEnum,
-                  const std::set< sal_Int32 >* i_pPossibleValues,
+                  const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues,
                   sal_Int32 i_nRange,
                   sal_Int32 i_nCurrent )
         : pEnumerator( i_pEnum ), pPossibleValues( i_pPossibleValues )
@@ -126,10 +127,10 @@ public:
                            );
 
     sal_Int32 size() const { return mnCount; }
-    Iterator begin( const std::set< sal_Int32 >* i_pPossibleValues = nullptr ) const;
-    Iterator end( const std::set< sal_Int32 >* i_pPossibleValues = nullptr ) const;
+    Iterator begin( const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues = nullptr ) const;
+    Iterator end( const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues = nullptr ) const;
 
-    bool hasValue( sal_Int32 nValue, const std::set< sal_Int32 >* i_pPossibleValues = nullptr ) const;
+    bool hasValue( sal_Int32 nValue, const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues = nullptr ) const;
 
     /**
     i_rPageRange:     the string to be changed into a sequence of numbers
@@ -160,7 +161,7 @@ public:
                                      sal_Int32 i_nMinNumber,
                                      sal_Int32 i_nMaxNumber,
                                      sal_Int32 i_nLogicalOffset = -1,
-                                     std::set< sal_Int32 > const * i_pPossibleValues = nullptr
+                                     o3tl::sorted_vector< sal_Int32 > const * i_pPossibleValues = nullptr
                                     );
 };
 
diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx
index 60778a13eb2c..35f0aa72505c 100644
--- a/sw/inc/printdata.hxx
+++ b/sw/inc/printdata.hxx
@@ -24,7 +24,7 @@
 #include <vcl/print.hxx>
 #include <sfx2/objsh.hxx>
 
-#include <set>
+#include <o3tl/sorted_vector.hxx>
 #include <map>
 #include <vector>
 #include <utility>
@@ -204,7 +204,7 @@ class SwRenderData
 {
     /** pages valid for printing (according to the current settings)
      This set of pages does NOT depend on the 'PageRange' that is used as a printing option! */
-    std::set< sal_Int32 >                       m_aValidPages;          ///< the set of possible pages (see StringRangeEnumerator::getRangesFromString )
+    o3tl::sorted_vector< sal_Int32 >            m_aValidPages;          ///< the set of possible pages (see StringRangeEnumerator::getRangesFromString )
 
     /// printer paper tray to use for each of the m_aValidPages above
     std::map< sal_Int32, sal_Int32 >            m_aPrinterPaperTrays;
@@ -262,8 +262,8 @@ public:
 
     typedef std::vector< std::pair< sal_Int32, sal_Int32 > >    PagePairsVec_t;
 
-    std::set< sal_Int32 > &             GetValidPagesSet()          { return m_aValidPages; }
-    const std::set< sal_Int32 > &       GetValidPagesSet() const    { return m_aValidPages; }
+    o3tl::sorted_vector< sal_Int32 > &       GetValidPagesSet()          { return m_aValidPages; }
+    const o3tl::sorted_vector< sal_Int32 > & GetValidPagesSet() const    { return m_aValidPages; }
 
     /** a map for printer paper tray numbers to use for each document page
        a value of -1 for the tray means that there is no specific tray defined */
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 7fda1705f0f0..c971d32f4ac9 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -470,7 +470,7 @@ struct PostItField_ : public SetGetExpField
         : SetGetExpField( rNdIdx, pField, nullptr ) {}
 
     sal_uInt16 GetPageNo( const StringRangeEnumerator &rRangeEnum,
-            const std::set< sal_Int32 > &rPossiblePages,
+            const o3tl::sorted_vector< sal_Int32 > &rPossiblePages,
             sal_uInt16& rVirtPgNo, sal_uInt16& rLineNo );
 
     const SwPostItField* GetPostIt() const
@@ -483,7 +483,7 @@ struct PostItField_ : public SetGetExpField
 
 sal_uInt16 PostItField_::GetPageNo(
     const StringRangeEnumerator &rRangeEnum,
-    const std::set< sal_Int32 > &rPossiblePages,
+    const o3tl::sorted_vector< sal_Int32 > &rPossiblePages,
     /* out */ sal_uInt16& rVirtPgNo, /* out */ sal_uInt16& rLineNo )
 {
     //Problem: If a PostItField is contained in a Node that is represented
@@ -680,7 +680,7 @@ void SwDoc::CalculatePagesForPrinting(
     bool bPrintEmptyPages   = !bPrintSelection && rOptions.IsPrintEmptyPages( bIsPDFExport );
 
     std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays();
-    std::set< sal_Int32 > &rValidPages = rData.GetValidPagesSet();
+    o3tl::sorted_vector< sal_Int32 > &rValidPages = rData.GetValidPagesSet();
     // Map page numbers from user input (possibly ignoring blanks) to physical page numbers
     std::map< sal_Int32, sal_Int32 > aUIPages2PhyPagesMap;
     rValidPages.clear();
@@ -902,7 +902,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
     sal_Int32 nDocPageCount )
 {
     std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays();
-    std::set< sal_Int32 > &rValidPagesSet = rData.GetValidPagesSet();
+    o3tl::sorted_vector< sal_Int32 > &rValidPagesSet = rData.GetValidPagesSet();
     std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rData.GetPagePairsForProspectPrinting();
     std::map< sal_Int32, const SwPageFrame * > validStartFrames;
 
diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx
index 7a8df48d0049..4f915da258a4 100644
--- a/tools/source/memtools/multisel.cxx
+++ b/tools/source/memtools/multisel.cxx
@@ -486,7 +486,7 @@ StringRangeEnumerator::StringRangeEnumerator( const OUString& i_rInput,
         mbValidInput = setRange( i_rInput );
 }
 
-bool StringRangeEnumerator::checkValue( sal_Int32 i_nValue, const std::set< sal_Int32 >* i_pPossibleValues ) const
+bool StringRangeEnumerator::checkValue( sal_Int32 i_nValue, const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues ) const
 {
     if( i_nValue < 0 || i_nValue < mnMin || i_nValue > mnMax )
         return false;
@@ -626,7 +626,7 @@ bool StringRangeEnumerator::setRange( const OUString& i_rNewRange )
     return true;
 }
 
-bool StringRangeEnumerator::hasValue( sal_Int32 i_nValue, const std::set< sal_Int32 >* i_pPossibleValues ) const
+bool StringRangeEnumerator::hasValue( sal_Int32 i_nValue, const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues ) const
 {
     if( i_pPossibleValues && i_pPossibleValues->find( i_nValue ) == i_pPossibleValues->end() )
         return false;
@@ -696,7 +696,7 @@ bool StringRangeEnumerator::Iterator::operator==( const Iterator& i_rCompare ) c
     return i_rCompare.pEnumerator == pEnumerator && i_rCompare.nRangeIndex == nRangeIndex && i_rCompare.nCurrent == nCurrent;
 }
 
-StringRangeEnumerator::Iterator StringRangeEnumerator::begin( const std::set< sal_Int32 >* i_pPossibleValues ) const
+StringRangeEnumerator::Iterator StringRangeEnumerator::begin( const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues ) const
 {
     StringRangeEnumerator::Iterator it( this,
                                         i_pPossibleValues,
@@ -707,7 +707,7 @@ StringRangeEnumerator::Iterator StringRangeEnumerator::begin( const std::set< sa
     return it;
 }
 
-StringRangeEnumerator::Iterator StringRangeEnumerator::end( const std::set< sal_Int32 >* i_pPossibleValues ) const
+StringRangeEnumerator::Iterator StringRangeEnumerator::end( const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues ) const
 {
     return StringRangeEnumerator::Iterator( this, i_pPossibleValues, -1, -1 );
 }
@@ -717,7 +717,7 @@ bool StringRangeEnumerator::getRangesFromString( const OUString& i_rPageRange,
                                                  sal_Int32 i_nMinNumber,
                                                  sal_Int32 i_nMaxNumber,
                                                  sal_Int32 i_nLogicalOffset,
-                                                 std::set< sal_Int32 > const * i_pPossibleValues
+                                                 o3tl::sorted_vector< sal_Int32 > const * i_pPossibleValues
                                                )
 {
     o_rPageVector.clear();


More information about the Libreoffice-commits mailing list