[Libreoffice-commits] core.git: 2 commits - comphelper/source reportdesign/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Apr 25 06:28:17 UTC 2018


 comphelper/source/misc/random.cxx                 |    9 ++++++
 reportdesign/source/core/inc/FixedText.hxx        |   16 +++++++++++
 reportdesign/source/core/inc/FormatCondition.hxx  |   30 +++++++++++++++++++---
 reportdesign/source/core/inc/FormattedField.hxx   |   16 +++++++++++
 reportdesign/source/core/inc/ReportHelperImpl.hxx |    2 -
 reportdesign/source/core/inc/Shape.hxx            |   30 +++++++++++++++++++---
 6 files changed, 94 insertions(+), 9 deletions(-)

New commits:
commit b4ba8dc9ef1635c75b363838b6016d3851387020
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Apr 24 16:27:17 2018 +0200

    tdf#117161 ReportBuilder horizontal align wrong when editing
    
    regression from
            commit 5d0e485e827057eee9fb2c997685690b710e7f34
            use actual UNO enums in reportdesign..svtools
    
    Also make some of the "template<> set" property helpers only fire on
    actual property change
    
    Change-Id: I930fd255d287c3c7e5b064823fd1e8d4b665eae0
    Reviewed-on: https://gerrit.libreoffice.org/53412
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/reportdesign/source/core/inc/FixedText.hxx b/reportdesign/source/core/inc/FixedText.hxx
index b08efa10b759..03126ab30e5f 100644
--- a/reportdesign/source/core/inc/FixedText.hxx
+++ b/reportdesign/source/core/inc/FixedText.hxx
@@ -51,6 +51,22 @@ namespace reportdesign
         OFixedText(const OFixedText&) = delete;
         OFixedText& operator=(const OFixedText&) = delete;
 
+        // internally, we store PROPERTY_PARAADJUST as css::style::ParagraphAdjust, but externally the property is visible as a sal_Int16
+        void set(  const OUString& _sProperty
+                  ,sal_Int16 Value
+                  ,css::style::ParagraphAdjust& _member)
+        {
+            BoundListeners l;
+            {
+                ::osl::MutexGuard aGuard(m_aMutex);
+                if ( static_cast<sal_Int16>(_member) != Value )
+                {
+                    prepareSet(_sProperty, css::uno::makeAny(static_cast<sal_Int16>(_member)), css::uno::makeAny(Value), &l);
+                    _member = static_cast<css::style::ParagraphAdjust>(Value);
+                }
+            }
+            l.notify();
+        }
         template <typename T> void set(  const OUString& _sProperty
                                         ,const T& Value
                                         ,T& _member)
diff --git a/reportdesign/source/core/inc/FormatCondition.hxx b/reportdesign/source/core/inc/FormatCondition.hxx
index a457f7dada59..409b1198f7ef 100644
--- a/reportdesign/source/core/inc/FormatCondition.hxx
+++ b/reportdesign/source/core/inc/FormatCondition.hxx
@@ -49,6 +49,22 @@ namespace reportdesign
         OFormatCondition(const OFormatCondition&) = delete;
         OFormatCondition& operator=(const OFormatCondition&) = delete;
 
+        // internally, we store PROPERTY_PARAADJUST as css::style::ParagraphAdjust, but externally the property is visible as a sal_Int16
+        void set(  const OUString& _sProperty
+                   ,sal_Int16 Value
+                   ,css::style::ParagraphAdjust& _member)
+        {
+            BoundListeners l;
+            {
+                ::osl::MutexGuard aGuard(m_aMutex);
+                if ( static_cast<sal_Int16>(_member) != Value )
+                {
+                    prepareSet(_sProperty, css::uno::makeAny(static_cast<sal_Int16>(_member)), css::uno::makeAny(Value), &l);
+                    _member = static_cast<css::style::ParagraphAdjust>(Value);
+                }
+            }
+            l.notify();
+        }
         template <typename T> void set(  const OUString& _sProperty
                                         ,const T& Value
                                         ,T& _member)
@@ -56,8 +72,11 @@ namespace reportdesign
             BoundListeners l;
             {
                 ::osl::MutexGuard aGuard(m_aMutex);
-                prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
-                _member = Value;
+                if ( _member != Value )
+                {
+                    prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
+                    _member = Value;
+                }
             }
             l.notify();
         }
@@ -68,8 +87,11 @@ namespace reportdesign
             BoundListeners l;
             {
                 ::osl::MutexGuard aGuard(m_aMutex);
-                prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
-                _member = Value;
+                if ( _member != Value )
+                {
+                    prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
+                    _member = Value;
+                }
             }
             l.notify();
         }
diff --git a/reportdesign/source/core/inc/FormattedField.hxx b/reportdesign/source/core/inc/FormattedField.hxx
index e7860983bff5..040b6af2dfbb 100644
--- a/reportdesign/source/core/inc/FormattedField.hxx
+++ b/reportdesign/source/core/inc/FormattedField.hxx
@@ -54,6 +54,22 @@ namespace reportdesign
         OFormattedField(const OFormattedField&) = delete;
         OFormattedField& operator=(const OFormattedField&) = delete;
 
+        // internally, we store PROPERTY_PARAADJUST as css::style::ParagraphAdjust, but externally the property is visible as a sal_Int16
+        void set(  const OUString& _sProperty
+                   ,sal_Int16 Value
+                   ,css::style::ParagraphAdjust& _member)
+        {
+            BoundListeners l;
+            {
+                ::osl::MutexGuard aGuard(m_aMutex);
+                if ( static_cast<sal_Int16>(_member) != Value )
+                {
+                    prepareSet(_sProperty, css::uno::makeAny(static_cast<sal_Int16>(_member)), css::uno::makeAny(Value), &l);
+                    _member = static_cast<css::style::ParagraphAdjust>(Value);
+                }
+            }
+            l.notify();
+        }
         template <typename T> void set(  const OUString& _sProperty
                                         ,const T& Value
                                         ,T& _member)
diff --git a/reportdesign/source/core/inc/ReportHelperImpl.hxx b/reportdesign/source/core/inc/ReportHelperImpl.hxx
index 6e581347856f..47acf133a5f2 100644
--- a/reportdesign/source/core/inc/ReportHelperImpl.hxx
+++ b/reportdesign/source/core/inc/ReportHelperImpl.hxx
@@ -231,7 +231,7 @@ sal_Int16 SAL_CALL clazz::getParaAdjust() \
  \
 void SAL_CALL clazz::setParaAdjust( sal_Int16 _align ) \
 { \
-    set(PROPERTY_PARAADJUST,static_cast<css::style::ParagraphAdjust>(_align),varName.nAlign); \
+    set(PROPERTY_PARAADJUST,_align,varName.nAlign); \
 } \
  \
 awt::FontDescriptor SAL_CALL clazz::getFontDescriptor() \
diff --git a/reportdesign/source/core/inc/Shape.hxx b/reportdesign/source/core/inc/Shape.hxx
index 7d56822fc64f..b7c9e6d882f9 100644
--- a/reportdesign/source/core/inc/Shape.hxx
+++ b/reportdesign/source/core/inc/Shape.hxx
@@ -59,6 +59,22 @@ namespace reportdesign
         OShape(const OShape&) = delete;
         OShape& operator=(const OShape&) = delete;
 
+        // internally, we store PROPERTY_PARAADJUST as css::style::ParagraphAdjust, but externally the property is visible as a sal_Int16
+        void set(  const OUString& _sProperty
+                   ,sal_Int16 Value
+                   ,css::style::ParagraphAdjust& _member)
+        {
+            BoundListeners l;
+            {
+                ::osl::MutexGuard aGuard(m_aMutex);
+                if ( static_cast<sal_Int16>(_member) != Value )
+                {
+                    prepareSet(_sProperty, css::uno::makeAny(static_cast<sal_Int16>(_member)), css::uno::makeAny(Value), &l);
+                    _member = static_cast<css::style::ParagraphAdjust>(Value);
+                }
+            }
+            l.notify();
+        }
         template <typename T> void set(  const OUString& _sProperty
                                         ,const T& Value
                                         ,T& _member)
@@ -66,8 +82,11 @@ namespace reportdesign
             BoundListeners l;
             {
                 ::osl::MutexGuard aGuard(m_aMutex);
-                prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
-                _member = Value;
+                if ( _member != Value )
+                {
+                    prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
+                    _member = Value;
+                }
             }
             l.notify();
         }
@@ -78,8 +97,11 @@ namespace reportdesign
             BoundListeners l;
             {
                 ::osl::MutexGuard aGuard(m_aMutex);
-                prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
-                _member = Value;
+                if ( _member != Value )
+                {
+                    prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
+                    _member = Value;
+                }
             }
             l.notify();
         }
commit 64a0f135a08d7d25fc3a796e604336f64bbd3ddb
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Apr 24 11:37:03 2018 +0200

    turn off randomness when running under valgrind
    
    Change-Id: Ic9853c967cdc36b1bf919a4914b04bf6752f0834
    Reviewed-on: https://gerrit.libreoffice.org/53374
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/comphelper/source/misc/random.cxx b/comphelper/source/misc/random.cxx
index 280e6e20fd00..bfb4de15aee5 100644
--- a/comphelper/source/misc/random.cxx
+++ b/comphelper/source/misc/random.cxx
@@ -17,6 +17,9 @@
 #include <time.h>
 #include <random>
 #include <stdexcept>
+#if defined HAVE_VALGRIND_HEADERS
+#include <valgrind/memcheck.h>
+#endif
 
 // this is nothing but a simple wrapper around
 // the std::random generators
@@ -40,6 +43,12 @@ struct RandomNumberGenerator
     RandomNumberGenerator()
     {
         bool bRepeatable = (getenv("SAL_RAND_REPEATABLE") != nullptr);
+        // valgrind on some platforms (e.g.Ubuntu16.04) does not support the new Intel RDRAND instructions,
+        // which leads to "Illegal Opcode" errors, so just turn off randomness.
+#if defined HAVE_VALGRIND_HEADERS
+        if (RUNNING_ON_VALGRIND)
+            bRepeatable = true;
+#endif
         if (bRepeatable)
         {
             global_rng.seed(42);


More information about the Libreoffice-commits mailing list