[Libreoffice-commits] .: writerfilter/source

Lubos Lunak llunak at kemper.freedesktop.org
Tue Feb 8 07:06:55 PST 2011


 writerfilter/source/dmapper/CellColorHandler.cxx |    9 +++++----
 writerfilter/source/dmapper/CellColorHandler.hxx |    7 ++++---
 writerfilter/source/dmapper/DomainMapper.cxx     |   15 +++++++++++++--
 3 files changed, 22 insertions(+), 9 deletions(-)

New commits:
commit 82e070c5930a7894077d8aa7d18d4e6daa795527
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue Feb 8 16:04:29 2011 +0100

    apply color properly to form, paragraph or character (bnc#654875)

diff --git a/writerfilter/source/dmapper/CellColorHandler.cxx b/writerfilter/source/dmapper/CellColorHandler.cxx
index fb28ded..6f9c376 100644
--- a/writerfilter/source/dmapper/CellColorHandler.cxx
+++ b/writerfilter/source/dmapper/CellColorHandler.cxx
@@ -45,7 +45,7 @@ CellColorHandler::CellColorHandler() :
     m_nShadowType( 0 ),
     m_nColor( 0xffffffff ),
     m_nFillColor( 0xffffffff ),
-    m_bParagraph( false )
+    m_OutputFormat( Form )
 {
 }
 
@@ -199,9 +199,10 @@ TablePropertyMapPtr  CellColorHandler::getProperties()
 
         nApplyColor = ( (nRed/1000) << 0x10 ) + ((nGreen/1000) << 8) + nBlue/1000;
     }
-        
-    pPropertyMap->Insert( m_bParagraph ? PROP_PARA_BACK_COLOR : PROP_BACK_COLOR, false,
-                            uno::makeAny( nApplyColor ));
+
+    pPropertyMap->Insert( m_OutputFormat == Form ? PROP_BACK_COLOR
+                        : m_OutputFormat == Paragraph ? PROP_PARA_BACK_COLOR
+                        : PROP_CHAR_BACK_COLOR, false, uno::makeAny( nApplyColor ));
     return pPropertyMap;
 }
 } //namespace dmapper
diff --git a/writerfilter/source/dmapper/CellColorHandler.hxx b/writerfilter/source/dmapper/CellColorHandler.hxx
index 5670803..eb98c56 100644
--- a/writerfilter/source/dmapper/CellColorHandler.hxx
+++ b/writerfilter/source/dmapper/CellColorHandler.hxx
@@ -39,11 +39,12 @@ class TablePropertyMap;
 class WRITERFILTER_DLLPRIVATE CellColorHandler : public Properties
 {
 public:
+    enum OutputFormat { Form, Paragraph, Character }; // for what part of the document
+private:
     sal_Int32 m_nShadowType;
     sal_Int32 m_nColor;
     sal_Int32 m_nFillColor;
-    bool      m_bParagraph;
-private:
+    OutputFormat m_OutputFormat;
 
 public:
     CellColorHandler( );
@@ -55,7 +56,7 @@ public:
 
     ::boost::shared_ptr<TablePropertyMap>            getProperties();
 
-    void setParagraph() { m_bParagraph = true; }
+    void setOutputFormat( OutputFormat format ) { m_OutputFormat = format; }
 };
 typedef boost::shared_ptr< CellColorHandler >          CellColorHandlerPtr;
 }}
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 394e06a..8584268 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1739,7 +1739,7 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
         if( pProperties.get())
         {
             CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
-            pCellColorHandler->setParagraph();
+            pCellColorHandler->setOutputFormat( CellColorHandler::Paragraph );
             pProperties->resolve(*pCellColorHandler);
             rContext->insert( pCellColorHandler->getProperties(), true );
         }
@@ -2189,7 +2189,18 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
     case NS_sprm::LN_CBrc:
         break;  // sprmCBrc
     case NS_sprm::LN_CShd:
-        break;  // sprmCShd
+        {
+            //contains fore color, back color and shadow percentage, results in a brush
+            writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
+            if( pProperties.get())
+            {
+                CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
+                pCellColorHandler->setOutputFormat( CellColorHandler::Character );
+                pProperties->resolve(*pCellColorHandler);
+                rContext->insert( pCellColorHandler->getProperties(), true );
+            }
+            break;
+        }
     case NS_sprm::LN_CIdslRMarkDel:
         break;  // sprmCIdslRMarkDel
     case NS_sprm::LN_CFUsePgsuSettings:


More information about the Libreoffice-commits mailing list