Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2101

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/01/2101/1

fdo#59573 position after fieldmark and before annotation anchor is read-only

Also revert "SwTxtPaintInfo::_DrawBackBrush: draw dark border around
comment highlight" (commit 57c8c34fcdc2d594d2da3593eb9d86d0daf4e18c), as
it draws confusing vertical lines inside the comment when it has
multiple runs.

(cherry picked from commit bd505fdb9f669f365ff39b0ef46f0742c638e333)

Conflicts:
        sw/qa/core/swdoc-test.cxx

Change-Id: If0f60e4a28878c2b31327ae3c04ae11470bc1f52
---
M sw/qa/core/swdoc-test.cxx
M sw/source/core/crsr/pam.cxx
M sw/source/core/text/inftxt.cxx
3 files changed, 44 insertions(+), 5 deletions(-)



diff --git a/sw/qa/core/swdoc-test.cxx b/sw/qa/core/swdoc-test.cxx
index 03ddd14..a6756a4 100644
--- a/sw/qa/core/swdoc-test.cxx
+++ b/sw/qa/core/swdoc-test.cxx
@@ -45,6 +45,8 @@
 #include <sfx2/docfile.hxx>
 #include <sfx2/sfxmodelfactory.hxx>
 
+#include <xmloff/odffields.hxx>
+
 #include "breakit.hxx"
 #include "doc.hxx"
 #include "docsh.hxx"
@@ -88,6 +90,7 @@
     void testSwScanner();
     void testUserPerceivedCharCount();
     void testGraphicAnchorDeletion();
+    void testFdo59573();
 
     CPPUNIT_TEST_SUITE(SwDocTest);
     CPPUNIT_TEST(randomTest);
@@ -98,6 +101,7 @@
     CPPUNIT_TEST(testSwScanner);
     CPPUNIT_TEST(testUserPerceivedCharCount);
     CPPUNIT_TEST(testGraphicAnchorDeletion);
+    CPPUNIT_TEST(testFdo59573);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -878,6 +882,26 @@
     }
 }
 
+void SwDocTest::testFdo59573()
+{
+    SwNodeIndex aIdx(m_pDoc->GetNodes().GetEndOfContent(), -1);
+    SwPaM aPaM(aIdx);
+
+    // Insert "abc" and create a fieldmark around "b".
+    OUString aTest("abc");
+    m_pDoc->InsertString(aPaM, aTest);
+    aPaM.SetMark();
+    aPaM.GetPoint()->nContent = 1;
+    aPaM.GetMark()->nContent = 2;
+    IDocumentMarkAccess* pMarksAccess = m_pDoc->getIDocumentMarkAccess();
+    pMarksAccess->makeFieldBookmark(aPaM, "", ODF_COMMENTRANGE);
+    aPaM.GetPoint()->nContent = 4;
+    aPaM.GetMark()->nContent = 4;
+    // The problem was that the position after the fieldmark end and before the
+    // annotation anchor wasn't read-only.
+    CPPUNIT_ASSERT_EQUAL(sal_True, aPaM.HasReadonlySel(false));
+}
+
 void SwDocTest::setUp()
 {
     BootstrapFixture::setUp();
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index e122212..e745e80 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -686,9 +686,9 @@
     sw::mark::IMark* pB = NULL;
     bool bUnhandledMark = false;
     bool bCommentrangeMark = false;
+    const IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess();
     if ( pDoc )
     {
-        const IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess( );
         pA = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : NULL;
         pB = GetMark( ) ? pMarksAccess->getFieldmarkFor( *GetMark( ) ) : pA;
 
@@ -729,6 +729,24 @@
     {
         bRet = !( pA == pB && pA != NULL );
     }
+
+    // Don't allow inserting characters between the 'field mark end' and
+    // the 'comment anchor'.
+    if (!bRet)
+    {
+        if (!pA && GetPoint() && GetPoint()->nNode.GetNode().IsTxtNode() && 
GetPoint()->nContent.GetIndex() > 0)
+        {
+            // getFieldmarkFor() searches for >= start and < end, so check for
+            // the previous character, to also get the fieldmark, if we're
+            // exactly at the end.
+            SwPosition aPrevChar(*GetPoint());
+            aPrevChar.nContent--;
+            sw::mark::IFieldmark* pFieldmark = pMarksAccess->getFieldmarkFor(aPrevChar);
+            if (pFieldmark && pFieldmark->GetMarkEnd() == *GetPoint())
+                bRet = true;
+        }
+    }
+
     return bRet;
 }
 
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index c5bac95..2785e92 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1117,15 +1117,12 @@
                         const OUString& rAuthor = rPostItField.GetFld()->GetPar1();
                         sal_uInt16 nIndex = pNd->GetDoc()->InsertRedlineAuthor(rAuthor);
                         pOutDev->SetFillColor( SwPostItMgr::GetColorLight(nIndex) );
-                        pOutDev->SetLineColor( SwPostItMgr::GetColorAnchor(nIndex) );
                         bFilled = true;
                     }
                 }
                 if (!bFilled)
-                {
                     pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
-                    pOutDev->SetLineColor( );
-                }
+                pOutDev->SetLineColor( );
                 pOutDev->DrawRect( aIntersect.SVRect() );
                 pOutDev->Pop();
             }

-- 
To view, visit https://gerrit.libreoffice.org/2101
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If0f60e4a28878c2b31327ae3c04ae11470bc1f52
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Miklos Vajna <vmiklos@suse.cz>

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.