[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source

Fridrich Strba fridrich at kemper.freedesktop.org
Mon Jun 18 02:05:35 PDT 2012


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   11 ++++++++++-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    1 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx    |   20 ++++++++++++++++++--
 writerfilter/source/rtftok/rtfdocumentimpl.hxx    |    2 +-
 4 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit c7f809a0f4737dd39fc27405e550e3e2d9f2e53f
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue May 29 15:31:11 2012 +0200

    fdo#50665 fdo#37063 rtftok: don't ignore character properties of text fields
    
    Also fixes: n#760764
    
    (Cherry-picked from commits 9486851 and b9508dd.)
    
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 5461a99..0a3ccb8 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -193,6 +193,7 @@ DomainMapper_Impl::DomainMapper_Impl(
         m_bIsInShape( false ),
         m_bRemovedLastAnchored( false ),
         m_pLastSectionContext( ),
+        m_pLastCharacterContext(),
         m_nCurrentTabStopIndex( 0 ),
         m_sCurrentParaStyleId(),
         m_bInStyleSheetImport( false ),
@@ -358,6 +359,8 @@ void    DomainMapper_Impl::PopProperties(ContextType eId)
     {
         m_pLastSectionContext = m_aPropertyStacks[eId].top( );
     }
+    else if (eId == CONTEXT_CHARACTER)
+        m_pLastCharacterContext = m_aPropertyStacks[eId].top();
 
     m_aPropertyStacks[eId].pop();
     m_aContextStack.pop();
@@ -3163,7 +3166,13 @@ void DomainMapper_Impl::PopFieldContext()
                     if( xToInsert.is() )
                     {
                         uno::Reference< text::XTextAppendAndConvert > xTextAppendAndConvert( xTextAppend, uno::UNO_QUERY_THROW );
-                        xTextAppendAndConvert->appendTextContent( xToInsert, uno::Sequence< beans::PropertyValue >() );
+                        uno::Sequence<beans::PropertyValue> aValues;
+                        // Character properties of the field show up here the
+                        // last (always empty) run. Inherit character
+                        // properties from there.
+                        if (m_pLastCharacterContext.get())
+                            aValues = m_pLastCharacterContext->GetPropertyValues();
+                        xTextAppendAndConvert->appendTextContent(xToInsert, aValues);
                     }
                     else
                     {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index c4899cb..289b3c0 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -321,6 +321,7 @@ private:
 
     PropertyMapPtr                  m_pTopContext;
     PropertyMapPtr           m_pLastSectionContext;
+    PropertyMapPtr           m_pLastCharacterContext;
 
     ::std::vector<DeletableTabStop> m_aCurrentTabStops;
     sal_uInt32                      m_nCurrentTabStopIndex;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index f76e1e2..314acc4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -887,12 +887,28 @@ bool RTFFrame::inFrame()
         || nY > 0;
 }
 
-void RTFDocumentImpl::singleChar(sal_uInt8 nValue)
+void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps)
 {
     sal_uInt8 sValue[] = { nValue };
     if (!m_pCurrentBuffer)
     {
         Mapper().startCharacterGroup();
+        // Should we send run properties?
+        if (bRunProps)
+        {
+            if (!m_pCurrentBuffer)
+            {
+                writerfilter::Reference<Properties>::Pointer_t const pProperties(
+                        new RTFReferenceProperties(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms)
+                        );
+                Mapper().props(pProperties);
+            }
+            else
+            {
+                RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms));
+                m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue));
+            }
+        }
         Mapper().text(sValue, 1);
         Mapper().endCharacterGroup();
     }
@@ -1616,7 +1632,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
                 OUString aStr(RTL_CONSTASCII_USTRINGPARAM("PAGE"));
                 singleChar(0x13);
                 text(aStr);
-                singleChar(0x14);
+                singleChar(0x14, true);
                 singleChar(0x15);
             }
             break;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index fa21c81..9d097bc 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -400,7 +400,7 @@ namespace writerfilter {
 
                 void text(rtl::OUString& rString);
                 // Sends a single character to dmapper, taking care of buffering.
-                void singleChar(sal_uInt8 nValue);
+                void singleChar(sal_uInt8 nValue, bool bRunProps = false);
                 void parBreak();
                 void tableBreak();
                 void checkNeedPap();


More information about the Libreoffice-commits mailing list