[Libreoffice-commits] core.git: chart2/source forms/source sc/inc sc/source starmath/source sw/source writerfilter/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 4 06:02:34 UTC 2019


 chart2/source/controller/inc/ChartController.hxx           |    4 ++--
 chart2/source/controller/inc/CommandDispatchContainer.hxx  |    6 +++---
 chart2/source/controller/main/ChartController.cxx          |    4 ++--
 chart2/source/controller/main/CommandDispatchContainer.cxx |    2 +-
 forms/source/component/Columns.cxx                         |    8 ++++----
 sc/inc/calcconfig.hxx                                      |    4 ++--
 sc/source/core/tool/calcconfig.cxx                         |    8 ++++----
 starmath/source/rect.cxx                                   |    4 ++--
 sw/source/filter/ww8/docxattributeoutput.cxx               |    2 +-
 writerfilter/source/dmapper/StyleSheetTable.cxx            |    7 ++++---
 10 files changed, 25 insertions(+), 24 deletions(-)

New commits:
commit 8d84a0dc8d83cc7dbe77dec0bb4e2f6b9768e1d9
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 3 12:07:15 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 4 07:01:53 2019 +0100

    some std::set->o3tl::sorted_vector
    
    which is much better cache-wise
    
    Change-Id: Iacec0df48f043bcdd761ed30c1b1513850a00152
    Reviewed-on: https://gerrit.libreoffice.org/84311
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index 6b4d7782be89..adf4a3ad20be 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -27,6 +27,7 @@
 #include <vcl/timer.hxx>
 
 #include <cppuhelper/implbase.hxx>
+#include <o3tl/sorted_vector.hxx>
 #include <salhelper/simplereferenceobject.hxx>
 
 #include <com/sun/star/frame/XDispatchProvider.hpp>
@@ -40,7 +41,6 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 
 #include <memory>
-#include <set>
 
 namespace com { namespace sun { namespace star { namespace accessibility { class XAccessible; } } } }
 namespace com { namespace sun { namespace star { namespace accessibility { class XAccessibleContext; } } } }
@@ -533,7 +533,7 @@ private:
         const OUString & rCID, eMoveOrResizeType eType, double fAmountLogicX, double fAmountLogicY );
     bool impl_DragDataPoint( const OUString & rCID, double fOffset );
 
-    static const std::set< OUString >& impl_getAvailableCommands();
+    static const o3tl::sorted_vector< OUString >& impl_getAvailableCommands();
 
     /** Creates a helper accessibility class that must be initialized via XInitialization.  For
         parameters see
diff --git a/chart2/source/controller/inc/CommandDispatchContainer.hxx b/chart2/source/controller/inc/CommandDispatchContainer.hxx
index 9d6cd7e2e97b..bcc79758b545 100644
--- a/chart2/source/controller/inc/CommandDispatchContainer.hxx
+++ b/chart2/source/controller/inc/CommandDispatchContainer.hxx
@@ -20,8 +20,8 @@
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_COMMANDDISPATCHCONTAINER_HXX
 
 #include <cppuhelper/weakref.hxx>
+#include <o3tl/sorted_vector.hxx>
 
-#include <set>
 #include <map>
 #include <vector>
 
@@ -81,7 +81,7 @@ public:
      */
     void setChartDispatch(
         const css::uno::Reference< css::frame::XDispatch >& rChartDispatch,
-        const std::set< OUString > & rChartCommands );
+        const o3tl::sorted_vector< OUString > & rChartCommands );
 
     /** Returns the dispatch that is able to do the command given in rURL, if
         implemented here.  If the URL is not implemented here, it should be
@@ -126,7 +126,7 @@ private:
     css::uno::WeakReference< css::frame::XModel >         m_xModel;
 
     css::uno::Reference< css::frame::XDispatch >          m_xChartDispatcher;
-    std::set< OUString >                                m_aChartCommands;
+    o3tl::sorted_vector< OUString >                       m_aChartCommands;
 
     DrawCommandDispatch* m_pDrawCommandDispatch;
     ShapeController* m_pShapeController;
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 96ec317defa6..8511ad1bfcb6 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -1574,9 +1574,9 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn
     }
 }
 
-const std::set< OUString >& ChartController::impl_getAvailableCommands()
+const o3tl::sorted_vector< OUString >& ChartController::impl_getAvailableCommands()
 {
-    static std::set< OUString > s_AvailableCommands {
+    static const o3tl::sorted_vector< OUString > s_AvailableCommands {
         // commands for container forward
         "AddDirect",           "NewDoc",                "Open",
         "Save",                "SaveAs",                "SendMail",
diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx
index 5bc093282b4b..8056dfccecb9 100644
--- a/chart2/source/controller/main/CommandDispatchContainer.cxx
+++ b/chart2/source/controller/main/CommandDispatchContainer.cxx
@@ -58,7 +58,7 @@ void CommandDispatchContainer::setModel(
 
 void CommandDispatchContainer::setChartDispatch(
     const Reference< frame::XDispatch >& rChartDispatch,
-    const std::set< OUString > & rChartCommands )
+    const o3tl::sorted_vector< OUString > & rChartCommands )
 {
     OSL_ENSURE(rChartDispatch.is(),"Invalid fall back dispatcher!");
     m_xChartDispatcher.set( rChartDispatch );
diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx
index a911e3ff2f86..23674e1fafe5 100644
--- a/forms/source/component/Columns.cxx
+++ b/forms/source/component/Columns.cxx
@@ -39,6 +39,7 @@
 #include <services.hxx>
 #include <strings.hrc>
 #include <tools/debug.hxx>
+#include <o3tl/sorted_vector.hxx>
 
 
 namespace frm
@@ -292,7 +293,7 @@ void OGridColumn::disposing()
 void OGridColumn::clearAggregateProperties( Sequence< Property >& _rProps, bool bAllowDropDown )
 {
     // some properties are not to be exposed to the outer world
-    ::std::set< OUString > aForbiddenProperties {
+    static const o3tl::sorted_vector< OUString > aForbiddenProperties {
       PROPERTY_ALIGN,
       PROPERTY_AUTOCOMPLETE,
       PROPERTY_BACKGROUNDCOLOR,
@@ -331,8 +332,6 @@ void OGridColumn::clearAggregateProperties( Sequence< Property >& _rProps, bool
       PROPERTY_IMAGE_POSITION,
       PROPERTY_ENABLEVISIBLE
     };
-    if ( !bAllowDropDown )
-        aForbiddenProperties.insert( PROPERTY_DROPDOWN );
 
     Sequence< Property > aNewProps( _rProps.getLength() );
     Property* pNewProps = aNewProps.getArray();
@@ -341,7 +340,8 @@ void OGridColumn::clearAggregateProperties( Sequence< Property >& _rProps, bool
     const Property* pPropsEnd = pProps + _rProps.getLength();
     for ( ; pProps != pPropsEnd; ++pProps )
     {
-        if ( aForbiddenProperties.find( pProps->Name ) == aForbiddenProperties.end() )
+        if ( aForbiddenProperties.find( pProps->Name ) == aForbiddenProperties.end()
+            && (bAllowDropDown || pProps->Name != PROPERTY_DROPDOWN))
             *pNewProps++ = *pProps;
     }
 
diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx
index 646238051e73..29d926c459c4 100644
--- a/sc/inc/calcconfig.hxx
+++ b/sc/inc/calcconfig.hxx
@@ -13,8 +13,8 @@
 #include "scdllapi.h"
 
 #include <memory>
-#include <set>
 
+#include <o3tl/sorted_vector.hxx>
 #include <formula/grammar.hxx>
 #include <formula/opcode.hxx>
 #include <rtl/ustring.hxx>
@@ -64,7 +64,7 @@ struct SC_DLLPUBLIC ScCalcConfig
     OUString maOpenCLDevice;
     sal_Int32 mnOpenCLMinimumFormulaGroupSize;
 
-    typedef std::shared_ptr<std::set<OpCode>> OpCodeSet;
+    typedef std::shared_ptr<o3tl::sorted_vector<OpCode>> OpCodeSet;
 
     OpCodeSet mpOpenCLSubsetOpCodes;
 
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index 9f9bf35bacc0..72f86052c0ca 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -108,7 +108,7 @@ void ScCalcConfig::setOpenCLConfigToDefault()
 {
     // Keep in order of opcode value, is that clearest? (Random order,
     // at least, would make no sense at all.)
-    static OpCodeSet pDefaultOpenCLSubsetOpCodes(new std::set<OpCode>({
+    static const OpCodeSet pDefaultOpenCLSubsetOpCodes(new o3tl::sorted_vector<OpCode>({
         ocAdd,
         ocSub,
         ocNegSub,
@@ -197,9 +197,9 @@ OUString ScOpCodeSetToSymbolicString(const ScCalcConfig::OpCodeSet& rOpCodes)
     formula::FormulaCompiler aCompiler;
     formula::FormulaCompiler::OpCodeMapPtr pOpCodeMap(aCompiler.GetOpCodeMap(css::sheet::FormulaLanguage::ENGLISH));
 
-    for (auto i = rOpCodes->cbegin(); i != rOpCodes->cend(); ++i)
+    for (auto i = rOpCodes->begin(); i != rOpCodes->end(); ++i)
     {
-        if (i != rOpCodes->cbegin())
+        if (i != rOpCodes->begin())
             result.append(';');
         result.append(pOpCodeMap->getSymbol(*i));
     }
@@ -209,7 +209,7 @@ OUString ScOpCodeSetToSymbolicString(const ScCalcConfig::OpCodeSet& rOpCodes)
 
 ScCalcConfig::OpCodeSet ScStringToOpCodeSet(const OUString& rOpCodes)
 {
-    ScCalcConfig::OpCodeSet result(new std::set< OpCode >);
+    ScCalcConfig::OpCodeSet result(new o3tl::sorted_vector< OpCode >);
     formula::FormulaCompiler aCompiler;
     formula::FormulaCompiler::OpCodeMapPtr pOpCodeMap(aCompiler.GetOpCodeMap(css::sheet::FormulaLanguage::ENGLISH));
 
diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx
index 19ba9d1d3007..d49daf7474e4 100644
--- a/starmath/source/rect.cxx
+++ b/starmath/source/rect.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <osl/diagnose.h>
+#include <o3tl/sorted_vector.hxx>
 #include <vcl/metric.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/virdev.hxx>
@@ -29,7 +30,6 @@
 #include <smmod.hxx>
 
 #include <cassert>
-#include <unordered_set>
 
 namespace {
 
@@ -116,7 +116,7 @@ bool SmIsMathAlpha(const OUString &rText)
     // Set of symbols, which should be treated as letters in StarMath Font
     // (to get a normal (non-clipped) SmRect in contrast to the other operators
     // and symbols).
-    static std::unordered_set<sal_Unicode> const aMathAlpha({
+    static o3tl::sorted_vector<sal_Unicode> const aMathAlpha({
         MS_ALEPH,               MS_IM,                  MS_RE,
         MS_WP,                  u'\xE070',              MS_EMPTYSET,
         u'\x2113',              u'\xE0D6',              u'\x2107',
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c9b1835ab792..1a38df57c15f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5782,7 +5782,7 @@ static bool lcl_guessQFormat(const OUString& rName, sal_uInt16 nWwId)
             nWwId == ww::stiEmphasis )
         return true;
 
-    static std::set<OUString, OUStringIgnoreCase> const aWhitelist
+    static o3tl::sorted_vector<OUString, OUStringIgnoreCase> const aWhitelist
     {
         "No Spacing",
         "List Paragraph",
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 7c47732a6667..1da4f85808c5 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -44,6 +44,7 @@
 #include <comphelper/string.hxx>
 #include <comphelper/sequence.hxx>
 #include <tools/diagnose_ex.h>
+#include <o3tl/sorted_vector.hxx>
 
 using namespace ::com::sun::star;
 
@@ -1422,15 +1423,15 @@ OUString StyleSheetTable::ConvertStyleName( const OUString& rWWName, bool bExten
     else
     {
         // Style names which should not be used without a " (user)" suffix
-        static const std::set<OUString> ReservedStyleNames = [] {
-            std::set<OUString> set;
+        static const o3tl::sorted_vector<OUString> ReservedStyleNames = [] {
+            o3tl::sorted_vector<OUString> set;
             for (const auto& pair : StyleNameMap)
                 set.insert(pair.second);
             return set;
         }();
         // SwStyleNameMapper doc says: If the UI style name equals a
         // programmatic name, then it must append " (user)" to the end.
-        if (ReservedStyleNames.count(sRet) > 0)
+        if (ReservedStyleNames.find(sRet) != ReservedStyleNames.end())
             sRet += " (user)";
     }
 


More information about the Libreoffice-commits mailing list