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

Miklos Vajna vmiklos at collabora.co.uk
Thu Jul 30 00:17:44 PDT 2015


 sw/qa/extras/uiwriter/data/tdf89720.odt     |binary
 sw/qa/extras/uiwriter/uiwriter.cxx          |   19 +++++++++++++++++++
 sw/source/uibase/docvw/SidebarWin.cxx       |    3 ++-
 writerfilter/source/dmapper/PropertyMap.cxx |   18 +++++++-----------
 writerfilter/source/dmapper/PropertyMap.hxx |    3 ++-
 5 files changed, 30 insertions(+), 13 deletions(-)

New commits:
commit 0af2e9fa64bc686f1c4f84b63faccc854bc1bd54
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jul 30 09:15:03 2015 +0200

    writerfilter: manual memory management -> boost::optional in PropertyMap
    
    Change-Id: Ie8f7ce11ab03d47835cfe224c775324dd79a5e7a

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 25bd9c1..57b0c88 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -432,7 +432,6 @@ SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
 {
     static sal_Int32 nNumber = 0;
     nSectionNumber = nNumber++;
-    memset(&m_pBorderLines, 0x00, sizeof(m_pBorderLines));
     for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder )
     {
         m_nBorderDistances[ nBorder ] = -1;
@@ -471,8 +470,6 @@ SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
 
 SectionPropertyMap::~SectionPropertyMap()
 {
-    for( sal_Int16 ePos = BORDER_LEFT; ePos <= BORDER_BOTTOM; ++ePos)
-        delete m_pBorderLines[ePos];
 }
 
 
@@ -564,8 +561,7 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle(
 
 void SectionPropertyMap::SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const table::BorderLine2& rBorderLine, bool bShadow )
 {
-    delete m_pBorderLines[ePos];
-    m_pBorderLines[ePos] = new table::BorderLine2( rBorderLine );
+    m_oBorderLines[ePos] = rBorderLine;
     m_nBorderDistances[ePos] = nLineDistance;
     m_bBorderShadows[ePos] = bShadow;
 }
@@ -639,19 +635,19 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
 
     for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder)
     {
-        if( m_pBorderLines[nBorder] )
+        if( m_oBorderLines[nBorder] )
         {
             const OUString sBorderName = getPropertyName( aBorderIds[nBorder] );
             if (xFirst.is())
-                xFirst->setPropertyValue( sBorderName, uno::makeAny( *m_pBorderLines[nBorder] ));
+                xFirst->setPropertyValue( sBorderName, uno::makeAny( *m_oBorderLines[nBorder] ));
             if(xSecond.is())
-                xSecond->setPropertyValue( sBorderName, uno::makeAny( *m_pBorderLines[nBorder] ));
+                xSecond->setPropertyValue( sBorderName, uno::makeAny( *m_oBorderLines[nBorder] ));
         }
         if( m_nBorderDistances[nBorder] >= 0 )
         {
             sal_uInt32 nLineWidth = 0;
-            if (m_pBorderLines[nBorder])
-                nLineWidth = m_pBorderLines[nBorder]->LineWidth;
+            if (m_oBorderLines[nBorder])
+                nLineWidth = m_oBorderLines[nBorder]->LineWidth;
             if(xFirst.is())
                 SetBorderDistance( xFirst, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
                   m_nBorderDistances[nBorder], nOffsetFrom, nLineWidth );
@@ -663,7 +659,7 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
 
     if (m_bBorderShadows[BORDER_RIGHT])
     {
-        table::ShadowFormat aFormat = getShadowFromBorder(*m_pBorderLines[BORDER_RIGHT]);
+        table::ShadowFormat aFormat = getShadowFromBorder(*m_oBorderLines[BORDER_RIGHT]);
         if (xFirst.is())
             xFirst->setPropertyValue(getPropertyName(PROP_SHADOW_FORMAT), uno::makeAny(aFormat));
         if (xSecond.is())
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index ffb0b1c..6aa53af 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
 #include <com/sun/star/uno/Any.h>
 #include "PropertyIds.hxx"
 #include <memory>
@@ -190,7 +191,7 @@ class SectionPropertyMap : public PropertyMap
     css::uno::Reference<css::beans::XPropertySet> m_aFirstPageStyle;
     css::uno::Reference<css::beans::XPropertySet> m_aFollowPageStyle;
 
-    css::table::BorderLine2* m_pBorderLines[4];
+    boost::optional<css::table::BorderLine2> m_oBorderLines[4];
     sal_Int32                               m_nBorderDistances[4];
     sal_Int32                               m_nBorderParams;
     bool                                    m_bBorderShadows[4];
commit 780dd8c1cf5302ca503cf7b55357dace4d69beb9
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jul 30 09:11:35 2015 +0200

    tdf#89720 sw: do not create text range overlay for reply annotations
    
    Regression from commit 0761f81643a6890457e9ef7d913ab5c88c2593a4 (123792:
    complete annotations on text ranges feature, 2013-12-19), the problem
    was that in case a comment had a reply, then both comments produced its
    range overlay, and this repeated semi-transparent overlay resulted in
    dark color.
    
    Go back to the old behavior of just painting the overlay for the
    non-reply comment; for real, partly overlapping comments showing the
    exact boundaries of the overlapping overlays still makes sense.
    
    Change-Id: Ic2673a1a41146ff547262ba681b34a63f41aa8ff

diff --git a/sw/qa/extras/uiwriter/data/tdf89720.odt b/sw/qa/extras/uiwriter/data/tdf89720.odt
new file mode 100644
index 0000000..0b86ec5
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf89720.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 8c06b0d..7a8d399 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -37,6 +37,9 @@
 #include <unocrsrhelper.hxx>
 #include <unotbl.hxx>
 #include <pagedesc.hxx>
+#include <postithelper.hxx>
+#include <PostItMgr.hxx>
+#include <SidebarWin.hxx>
 #include "com/sun/star/text/XDefaultNumberingProvider.hpp"
 #include "com/sun/star/awt/FontUnderline.hpp"
 
@@ -138,6 +141,7 @@ public:
     void testShapeAnchorUndo();
     void testDde();
     void testTdf89954();
+    void testTdf89720();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -200,6 +204,7 @@ public:
     CPPUNIT_TEST(testShapeAnchorUndo);
     CPPUNIT_TEST(testDde);
     CPPUNIT_TEST(testTdf89954);
+    CPPUNIT_TEST(testTdf89720);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2063,6 +2068,20 @@ void SwUiWriterTest::testTdf89954()
     CPPUNIT_ASSERT_EQUAL(aExpected, aNodeIndex.GetNode().GetTextNode()->GetText());
 }
 
+void SwUiWriterTest::testTdf89720()
+{
+    SwDoc* pDoc = createDoc("tdf89720.odt");
+    SwView* pView = pDoc->GetDocShell()->GetView();
+    SwPostItMgr* pPostItMgr = pView->GetPostItMgr();
+    for (SwSidebarItem* pItem : *pPostItMgr)
+    {
+        if (pItem->pPostIt->IsFollow())
+            // This was non-0: reply comments had a text range overlay,
+            // resulting in unexpected dark color.
+            CPPUNIT_ASSERT(!pItem->pPostIt->TextRange());
+    }
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index e101799..4157947 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -703,8 +703,9 @@ void SwSidebarWin::SetPosAndSize()
                 mpTextRangeOverlay->HideSolidBorder();
             }
         }
-        else
+        else if (!IsFollow())
         {
+            // This window is not a reply, then draw its range overlay.
             mpTextRangeOverlay =
                 sw::overlay::OverlayRanges::CreateOverlayRange(
                     DocView(),


More information about the Libreoffice-commits mailing list