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

Caolán McNamara caolanm at redhat.com
Wed Dec 10 08:38:33 PST 2014


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   29 +++-------------------
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    2 -
 2 files changed, 4 insertions(+), 27 deletions(-)

New commits:
commit a645c8289454763568fbb5ba7ac99823778c7d3e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Dec 10 16:36:26 2014 +0000

    revert writer won't allow us to enter multiple CrossRefBookmark
    
    i.e.
    
    commit af64f430181088460d5c574683dd1fdfd377ebcd
    Date:   Mon Dec 8 16:11:41 2014 +0000
    
        writer won't allow us to enter multiple CrossRefBookmarks on the same node
    
        e.g. fdo63164-1.docx and loads more like that, and the .docx genuinely has
        multiple bookmarks at the same place, so just allow the first one and discard
        the following ones
    
    in favour of
    
    commit 7a12360e1f2c0a5bc0927131a750740d35cfd1ab
    Date:   Wed Dec 10 14:56:27 2014 +0100
    
        sw: don't assert when SwXBookmark creates duplicate CrossRef*Bookmark
    
        The bugdoc of fdo#87110 has a couple such duplicates.  Check for it and
        let SwXBookmark throw an IllegalArgumentException.
    
    but leave test doc in place
    
    Change-Id: Ib0bfc991684b2c9c4f1959a17c49bf1c0179be79

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0a7f268..7de9fb5 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -55,7 +55,6 @@
 #include <com/sun/star/text/XParagraphCursor.hpp>
 #include <com/sun/star/text/XRedline.hpp>
 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
-#include <com/sun/star/text/XTextRangeCompare.hpp>
 #include <com/sun/star/style/DropCapFormat.hpp>
 #include <com/sun/star/util/NumberFormatter.hpp>
 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
@@ -4416,31 +4415,11 @@ void DomainMapper_Impl::StartOrEndBookmark( const OUString& rId )
                 {
                     xCursor->goLeft( 1, false );
                 }
-
                 uno::Reference< container::XNamed > xBkmNamed( xBookmark, uno::UNO_QUERY_THROW );
-
-                bool bAllowInsert = true;
-                uno::Reference<text::XTextRange> xRange(xCursor, uno::UNO_QUERY_THROW);
-                if (m_xPrevBookmark.is())
-                {
-                    uno::Reference<text::XTextRangeCompare> xTextRangeCompare(xRange->getText(), uno::UNO_QUERY_THROW);
-                    if (xTextRangeCompare->compareRegionStarts(m_xPrevBookmark, xRange) == 0 &&
-                        xTextRangeCompare->compareRegionEnds(m_xPrevBookmark, xRange) == 0)
-                    {
-                        SAL_WARN("writerfilter", "Cannot insert bookmark " << aBookmarkIter->second.m_sBookmarkName
-                                                 << " because another one is already inserted at this point");
-                        bAllowInsert = false;
-                    }
-                }
-
-                if (bAllowInsert)
-                {
-                    assert(!aBookmarkIter->second.m_sBookmarkName.isEmpty());
-                    //todo: make sure the name is not used already!
-                    xBkmNamed->setName( aBookmarkIter->second.m_sBookmarkName );
-                    xTextAppend->insertTextContent(xRange, xBookmark, !xCursor->isCollapsed());
-                    m_xPrevBookmark = xRange;
-                }
+                assert(!aBookmarkIter->second.m_sBookmarkName.isEmpty());
+                //todo: make sure the name is not used already!
+                xBkmNamed->setName( aBookmarkIter->second.m_sBookmarkName );
+                xTextAppend->insertTextContent( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW), xBookmark, !xCursor->isCollapsed() );
             }
             m_aBookmarkMap.erase( aBookmarkIter );
             m_sCurrentBkmkId.clear();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index c218f53..11e58cd 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -349,8 +349,6 @@ private:
     LineNumberSettings                                                              m_aLineNumberSettings;
 
     BookmarkMap_t                                                                   m_aBookmarkMap;
-    /// Detect attempt to insert multiple bookmarks at the same position
-    css::uno::Reference<css::text::XTextRange>                                      m_xPrevBookmark;
     OUString                                                                        m_sCurrentBkmkId;
     OUString                                                                        m_sCurrentBkmkName;
 


More information about the Libreoffice-commits mailing list