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

Vinaya Mandke vinaya.mandke at synerzip.com
Thu Jun 26 00:42:12 PDT 2014


 sw/qa/core/data/ooxml/pass/fdo79940.docx          |binary
 writerfilter/source/dmapper/DomainMapper.cxx      |    2 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    8 ++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    3 +++
 4 files changed, 13 insertions(+)

New commits:
commit 9fbdb02c9a1da28b4dd51b053d39cb254631e535
Author: Vinaya Mandke <vinaya.mandke at synerzip.com>
Date:   Tue Jun 24 14:59:30 2014 +0530

    fdo#79940 LO crashes on opening; tries to remove a para with bookmarks
    
    LO crashes while opening the issue file as, DomainMapper_Impl::RemoveLastParagraph
    tries to dispose a paragraph which has bookmarks attached.
    
    If A para finishes and a new para has not been started as yet,
    which means the current cursor position is outside a paragraph.  In such a case move the
    Bookmark-End to the earlier paragraph.
    Added the issue file in sw/qa/core/data/ooxml/pass/
    
    Change-Id: I62cf94718add943d042d770ab5337a0dae70d9e8
    Reviewed-on: https://gerrit.libreoffice.org/9764
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/core/data/ooxml/pass/fdo79940.docx b/sw/qa/core/data/ooxml/pass/fdo79940.docx
new file mode 100644
index 0000000..8d17489
Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/fdo79940.docx differ
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index a103474..ea66861 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2561,6 +2561,7 @@ void DomainMapper::lcl_startParagraphGroup()
             m_pImpl->GetTopContext()->Insert( PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE) );
     }
     m_pImpl->SetIsFirstRun(true);
+    m_pImpl->SetIsOutsideAParagraph(false);
     m_pImpl->clearDeferredBreaks();
 }
 
@@ -2570,6 +2571,7 @@ void DomainMapper::lcl_endParagraphGroup()
     m_pImpl->getTableManager().endParagraphGroup();
     //frame conversion has to be executed after table conversion
     m_pImpl->ExecuteFrameConversion();
+    m_pImpl->SetIsOutsideAParagraph(true);
 }
 
 void DomainMapper::markLastParagraphInSection( )
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e0de4db..89edfc4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -189,6 +189,7 @@ DomainMapper_Impl::DomainMapper_Impl(
         m_bUsingEnhancedFields( false ),
         m_bSdt(false),
         m_bIsFirstRun(false),
+        m_bIsOutsideAParagraph(true),
         m_bIsTableHasDirectFormatting(false),
         m_xAnnotationField(),
         m_nAnnotationId( -1 ),
@@ -1132,6 +1133,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
         pParaContext->ResetFrameProperties();
     }
 
+    SetIsOutsideAParagraph(true);
 #ifdef DEBUG_DOMAINMAPPER
     dmapper_logger->endElement();
 #endif
@@ -4196,6 +4198,12 @@ void DomainMapper_Impl::AddBookmark( const OUString& rBookmarkName, const OUStri
                 }
 
                 xCursor->gotoRange( xTextAppend->getEnd(), true );
+                // A Paragraph was recently finished, and a new Paragraph has not been started as yet
+                // then  move the bookmark-End to the earlier paragraph
+                if (IsOutsideAParagraph())
+                {
+                    xCursor->goLeft( 1, false );
+                }
                 uno::Reference< container::XNamed > xBkmNamed( xBookmark, uno::UNO_QUERY_THROW );
                 //todo: make sure the name is not used already!
                 if ( !aBookmarkIter->second.m_sBookmarkName.isEmpty() )
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 99eabb5..97b2e1e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -388,6 +388,7 @@ private:
     /// If the current paragraph is inside a structured document element.
     bool                            m_bSdt;
     bool                            m_bIsFirstRun;
+    bool                            m_bIsOutsideAParagraph;
     bool                            m_bIsTableHasDirectFormatting;
 
     css::uno::Reference< css::text::XTextCursor > xTOCMarkerCursor;
@@ -714,6 +715,8 @@ public:
     void SetCurrentRedlineInitials( const OUString& sInitials );
     bool IsFirstRun() { return m_bIsFirstRun;}
     void SetIsFirstRun(bool bval) { m_bIsFirstRun = bval;}
+    bool IsOutsideAParagraph() { return m_bIsOutsideAParagraph;}
+    void SetIsOutsideAParagraph(bool bval) { m_bIsOutsideAParagraph = bval;}
 
     void ApplySettingsTable();
     SectionPropertyMap * GetSectionContext();


More information about the Libreoffice-commits mailing list