[Libreoffice-commits] core.git: 2 commits - svx/source sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 18 08:47:01 UTC 2018


 svx/source/sdr/properties/properties.cxx |   13 +++++++++++--
 sw/source/core/inc/scriptinfo.hxx        |    7 ++++---
 sw/source/core/text/porlay.cxx           |   25 ++++++-------------------
 3 files changed, 21 insertions(+), 24 deletions(-)

New commits:
commit 7d2668517b68f9a7f056a993e53b4dd80838a4f9
Author:     Armin Le Grand <Armin.Le.Grand at cib.de>
AuthorDate: Tue Jul 17 18:39:23 2018 +0200
Commit:     Armin Le Grand <Armin.Le.Grand at cib.de>
CommitDate: Wed Jul 18 10:46:43 2018 +0200

    tdf#118139 Set Default StyleSheet only when available
    
    Change-Id: Id8643895add3181c41737249326bb49e1a2c2493
    Reviewed-on: https://gerrit.libreoffice.org/57582
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>

diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx
index bdeeeeaaec8d..61929a9b498a 100644
--- a/svx/source/sdr/properties/properties.cxx
+++ b/svx/source/sdr/properties/properties.cxx
@@ -43,8 +43,17 @@ namespace sdr
 
         void BaseProperties::applyDefaultStyleSheetFromSdrModel()
         {
-            // do not delete hard attributes when setting dsefault Style
-            SetStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet(), true);
+            SfxStyleSheet* pDefaultStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet());
+
+            // tdf#118139 Only do this when StyleSheet really differs. It may e.g.
+            // be the case that nullptr == pDefaultStyleSheet and there is none set yet,
+            // so indeed no need to set it (needed for some strange old MSWord2003
+            // documents with CustomShape-'Group' and added Text-Frames, see task description)
+            if(pDefaultStyleSheet != GetStyleSheet())
+            {
+                // do not delete hard attributes when setting dsefault Style
+                SetStyleSheet(pDefaultStyleSheet, true);
+            }
         }
 
         const SdrObject& BaseProperties::GetSdrObject() const
commit f3df554636b32160cab6d9e6e42cd32550a6a0c7
Author:     Takeshi Abe <tabe at fixedpoint.jp>
AuthorDate: Wed Jul 18 15:46:47 2018 +0900
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 18 10:46:37 2018 +0200

    sw: Change m_KashidaInvalid to std::unordered_set
    
    ... for clarifying what is supposed to do, and doing it more
    efficiently.
    Actually this assumes that m_KashidaInvalid has no duplicate
    entries, which I think is humble and sane.
    
    Change-Id: I010d3d9788378b369b5b52a37a3824c8e415c2aa
    Reviewed-on: https://gerrit.libreoffice.org/57611
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index e3b532783439..7f81a8d0e99f 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -22,6 +22,7 @@
 
 #include <vector>
 #include <deque>
+#include <unordered_set>
 #include <swscanner.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <osl/diagnose.h>
@@ -63,7 +64,7 @@ private:
     std::vector<DirectionChangeInfo> m_DirectionChanges;
     std::deque<TextFrameIndex> m_Kashida;
     /// indexes into m_Kashida
-    std::deque<size_t> m_KashidaInvalid;
+    std::unordered_set<size_t> m_KashidaInvalid;
     std::deque<TextFrameIndex> m_NoKashidaLine;
     std::deque<TextFrameIndex> m_NoKashidaLineEnd;
     std::deque<TextFrameIndex> m_HiddenChg;
@@ -84,9 +85,9 @@ private:
     sal_uInt8 m_nDefaultDir;
 
     void UpdateBidiInfo( const OUString& rText );
-
     bool IsKashidaValid(size_t nKashPos) const;
-    void MarkKashidaInvalid(size_t nKashPos);
+    // returns true if nKashPos is newly marked invalid
+    bool MarkKashidaInvalid(size_t nKashPos);
     void ClearKashidaInvalid(size_t nKashPos);
     bool MarkOrClearKashidaInvalid(TextFrameIndex nStt, TextFrameIndex nLen,
             bool bMark, sal_Int32 nMarkCount);
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index a5391aa817a6..e6b2ea0ee5a1 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1795,7 +1795,7 @@ long SwScriptInfo::Compress(long* pKernArray, TextFrameIndex nIdx, TextFrameInde
 // Note on calling KashidaJustify():
 // Kashida positions may be marked as invalid. Therefore KashidaJustify may return the clean
 // total number of kashida positions, or the number of kashida positions after some positions
-// have been dropped, depending on the state of the m_KashidaInvalid array.
+// have been dropped, depending on the state of the m_KashidaInvalid set.
 
 sal_Int32 SwScriptInfo::KashidaJustify( long* pKernArray,
                                         long* pScrArray,
@@ -1921,24 +1921,12 @@ bool SwScriptInfo::IsArabicText(const OUString& rText,
 
 bool SwScriptInfo::IsKashidaValid(size_t const nKashPos) const
 {
-    for (size_t i : m_KashidaInvalid)
-    {
-        if ( i == nKashPos )
-            return false;
-    }
-    return true;
+    return m_KashidaInvalid.find(nKashPos) == m_KashidaInvalid.end();
 }
 
 void SwScriptInfo::ClearKashidaInvalid(size_t const nKashPos)
 {
-    for (size_t i = 0; i < m_KashidaInvalid.size(); ++i)
-    {
-        if (m_KashidaInvalid [ i ] == nKashPos)
-        {
-            m_KashidaInvalid.erase(m_KashidaInvalid.begin() + i);
-            return;
-        }
-    }
+    m_KashidaInvalid.erase(nKashPos);
 }
 
 // bMark == true:
@@ -1965,9 +1953,8 @@ bool SwScriptInfo::MarkOrClearKashidaInvalid(
             break;
         if(bMark)
         {
-            if ( IsKashidaValid ( nCntKash ) )
+            if ( MarkKashidaInvalid ( nCntKash ) )
             {
-                MarkKashidaInvalid ( nCntKash );
                 --nMarkCount;
                 if (!nMarkCount)
                     return true;
@@ -1982,9 +1969,9 @@ bool SwScriptInfo::MarkOrClearKashidaInvalid(
     return false;
 }
 
-void SwScriptInfo::MarkKashidaInvalid(size_t const nKashPos)
+bool SwScriptInfo::MarkKashidaInvalid(size_t const nKashPos)
 {
-    m_KashidaInvalid.push_back(nKashPos);
+    return m_KashidaInvalid.insert(nKashPos).second;
 }
 
 // retrieve the kashida positions in the given text range


More information about the Libreoffice-commits mailing list