[Libreoffice-commits] .: writerfilter/source

Lubos Lunak llunak at kemper.freedesktop.org
Mon Aug 1 08:23:08 PDT 2011


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 17d137a657999dfc0124ff1d23ee47064d10c6ea
Author: Troy Rollo <libreoffice at troy.rollo.name>
Date:   Fri Jul 22 23:59:48 2011 +1000

    Import of xrefs to numbered paragraphs from docx
    
    The first part of this patch adds importing of cross-references to numbered
    paragraphs from docx file.
    
    The second part provides a fix to imports of bookmarks from docx, which in
    the test files I have end up importing with an empty bookmark name. The
    problem is that for each bookmark, DomainMapper_Impl::AddBookmark is called
    twice - once with an empty string for rBookmarkName, and once for the
    string that is in the file. The fix I have used is to ensure the passed in
    name is used if the bookmark has presiously been added, and the old one has
    an empty string as the name. This works, but I am not sure it is correct -
    I have not investigated why it is called with an empty string in the first
    place.
    
    Signed-off-by: Luboš Luňák <l.lunak at suse.cz>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 04058c2..693b3dd 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2682,6 +2682,21 @@ void DomainMapper_Impl::CloseFieldCommand()
                             //above-below
                             nFieldPart = text::ReferenceFieldPart::UP_DOWN;
                         }
+                        else if( lcl_FindInCommand( pContext->GetCommand(), 'r', sValue ))
+                        {
+                            //number
+                            nFieldPart = text::ReferenceFieldPart::NUMBER;
+                        }
+                        else if( lcl_FindInCommand( pContext->GetCommand(), 'n', sValue ))
+                        {
+                            //number-no-context
+                            nFieldPart = text::ReferenceFieldPart::NUMBER_NO_CONTEXT;
+                        }
+                        else if( lcl_FindInCommand( pContext->GetCommand(), 'w', sValue ))
+                        {
+                            //number-full-context
+                            nFieldPart = text::ReferenceFieldPart::NUMBER_FULL_CONTEXT;
+                        }
                         xFieldProperties->setPropertyValue(
                                 rPropNameSupplier.GetName( PROP_REFERENCE_FIELD_PART ), uno::makeAny( nFieldPart ));
                     }
@@ -2982,7 +2997,10 @@ void DomainMapper_Impl::AddBookmark( const ::rtl::OUString& rBookmarkName, const
             xCursor->gotoRange( xTextAppend->getEnd(), true );
             uno::Reference< container::XNamed > xBkmNamed( xBookmark, uno::UNO_QUERY_THROW );
             //todo: make sure the name is not used already!
-            xBkmNamed->setName( aBookmarkIter->second.m_sBookmarkName );
+            if ( aBookmarkIter->second.m_sBookmarkName.getLength() > 0 )
+                xBkmNamed->setName( aBookmarkIter->second.m_sBookmarkName );
+            else
+                xBkmNamed->setName( rBookmarkName );
             xTextAppend->insertTextContent( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW), xBookmark, !xCursor->isCollapsed() );
             m_aBookmarkMap.erase( aBookmarkIter );
         }


More information about the Libreoffice-commits mailing list