[ooo-build-commit] .: patches/dev300

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Thu Apr 29 01:01:53 PDT 2010


 patches/dev300/docx-fixes02.diff |  125 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 111 insertions(+), 14 deletions(-)

New commits:
commit e4741df5d9fd9871bfec26fdac26e2f0b9e6528e
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Thu Apr 29 09:58:38 2010 +0200

    Misc docx export fixes
    
    * patches/dev300/docx-fixes02.diff:
        * Fixes char spacing, character style association
        * Implement document grid export

diff --git a/patches/dev300/docx-fixes02.diff b/patches/dev300/docx-fixes02.diff
index 49edf38..f576724 100644
--- a/patches/dev300/docx-fixes02.diff
+++ b/patches/dev300/docx-fixes02.diff
@@ -94,19 +94,21 @@ index fe986f1..d66d83c 100644
  
      void writeFastAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs );
 diff --git sw/source/filter/ww8/docxattributeoutput.cxx sw/source/filter/ww8/docxattributeoutput.cxx
-index d82f2c8..57d2969 100644
+index d82f2c8..66d189b 100644
 --- sw/source/filter/ww8/docxattributeoutput.cxx
 +++ sw/source/filter/ww8/docxattributeoutput.cxx
-@@ -34,6 +34,8 @@
+@@ -34,6 +34,10 @@
  #include "writerwordglue.hxx"
  #include "wrtww8.hxx"
  #include "ww8par.hxx"
 +#include "fmtcntnt.hxx"
 +#include "fmtsrnd.hxx"
++#include "fchrfmt.hxx"
++#include "tgrditem.hxx"
  
  #include <oox/core/tokens.hxx>
  #include <oox/export/drawingml.hxx>
-@@ -216,6 +218,25 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
+@@ -216,6 +220,25 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
      FinishTableRowCell( pTextNodeInfoInner );
  
      m_bParagraphOpened = false;
@@ -132,7 +134,7 @@ index d82f2c8..57d2969 100644
  }
  
  void DocxAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointer_t pInner, bool bForceEmptyParagraph )
-@@ -295,6 +316,14 @@ void DocxAttributeOutput::InitCollectedParagraphProperties()
+@@ -295,6 +318,14 @@ void DocxAttributeOutput::InitCollectedParagraphProperties()
  
  void DocxAttributeOutput::WriteCollectedParagraphProperties()
  {
@@ -147,7 +149,7 @@ index d82f2c8..57d2969 100644
      if ( m_pSpacingAttrList )
      {
          XFastAttributeListRef xAttrList( m_pSpacingAttrList );
-@@ -1813,6 +1842,12 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
+@@ -1813,6 +1844,12 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
                      WriteOLE2Obj( pSdrObj, rFrame.GetLayoutSize() );
              }
              break;
@@ -160,7 +162,7 @@ index d82f2c8..57d2969 100644
          default:
  #if OSL_DEBUG_LEVEL > 0
              fprintf( stderr, "TODO DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Point& rNdTopLeft ) - frame type '%s'\n",
-@@ -2367,11 +2402,43 @@ void DocxAttributeOutput::CharCrossedOut( const SvxCrossedOutItem& rCrossedOut )
+@@ -2367,11 +2404,43 @@ void DocxAttributeOutput::CharCrossedOut( const SvxCrossedOutItem& rCrossedOut )
      }
  }
  
@@ -209,7 +211,33 @@ index d82f2c8..57d2969 100644
  }
  
  void DocxAttributeOutput::CharFont( const SvxFontItem& rFont)
-@@ -3074,9 +3141,22 @@ void DocxAttributeOutput::FormatFrameSize( const SwFmtFrmSize& rSize )
+@@ -2403,7 +2472,7 @@ void DocxAttributeOutput::CharFontSize( const SvxFontHeightItem& rFontSize)
+ void DocxAttributeOutput::CharKerning( const SvxKerningItem& rKerning )
+ {
+     OString aKerning = OString::valueOf( ( sal_Int32 ) rKerning.GetValue() );
+-    m_pSerializer->singleElementNS( XML_w, XML_kern, FSNS(XML_w, XML_val), aKerning.getStr(), FSEND );
++    m_pSerializer->singleElementNS( XML_w, XML_spacing, FSNS(XML_w, XML_val), aKerning.getStr(), FSEND );
+ }
+ 
+ void DocxAttributeOutput::CharLanguage( const SvxLanguageItem& rLanguage )
+@@ -2656,11 +2725,12 @@ void DocxAttributeOutput::TextINetFormat( const SwFmtINetFmt& rLink )
+     m_pSerializer->singleElementNS( XML_w, XML_rStyle, FSNS( XML_w, XML_val ), aStyleId.getStr(), FSEND );
+ }
+ 
+-void DocxAttributeOutput::TextCharFormat( const SwFmtCharFmt& )
++void DocxAttributeOutput::TextCharFormat( const SwFmtCharFmt& rCharFmt )
+ {
+-#if OSL_DEBUG_LEVEL > 0
+-    fprintf( stderr, "TODO DocxAttributeOutput::TextCharFormat()\n" );
+-#endif
++    OString aStyleId( "style" );
++    aStyleId += OString::valueOf( sal_Int32( m_rExport.GetId( *rCharFmt.GetCharFmt() ) ) );
++
++    m_pSerializer->singleElementNS( XML_w, XML_rStyle, FSNS( XML_w, XML_val ), aStyleId.getStr(), FSEND );
+ }
+ 
+ void DocxAttributeOutput::RefField( const SwField&  rFld, const String& rRef )
+@@ -3074,9 +3144,22 @@ void DocxAttributeOutput::FormatFrameSize( const SwFmtFrmSize& rSize )
  {
      if ( m_rExport.bOutFlyFrmAttrs )
      {
@@ -235,7 +263,7 @@ index d82f2c8..57d2969 100644
      }
      else if ( m_rExport.bOutPageDescs ) 
      {
-@@ -3106,9 +3186,12 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
+@@ -3106,9 +3189,12 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
  {
      if ( m_rExport.bOutFlyFrmAttrs )
      {
@@ -251,7 +279,7 @@ index d82f2c8..57d2969 100644
      }
      else if ( m_rExport.bOutPageDescs ) 
      {
-@@ -3149,11 +3232,17 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
+@@ -3149,11 +3235,17 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
  
  void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace )
  {
@@ -270,7 +298,7 @@ index d82f2c8..57d2969 100644
      } 
      else if (m_rExport.bOutPageDescs )
      {
-@@ -3195,32 +3284,150 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace )
+@@ -3195,32 +3287,150 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace )
      }
  }
  
@@ -436,7 +464,7 @@ index d82f2c8..57d2969 100644
  }
  
  void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
-@@ -3232,10 +3439,6 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
+@@ -3232,10 +3442,6 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
                  FSNS( XML_w, XML_fill ), sColor.getStr( ),
                  FSEND );
      }
@@ -447,7 +475,64 @@ index d82f2c8..57d2969 100644
  }
  
  void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
-@@ -3380,6 +3583,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
+@@ -3318,11 +3524,52 @@ void DocxAttributeOutput::FormatKeep( const SvxFmtKeepItem& )
+     m_pSerializer->singleElementNS( XML_w, XML_keepNext, FSEND );
+ }
+ 
+-void DocxAttributeOutput::FormatTextGrid( const SwTextGridItem& )
++void DocxAttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid )
+ {
+-#if OSL_DEBUG_LEVEL > 0
+-    fprintf( stderr, "TODO DocxAttributeOutput::FormatTextGrid()\n" );
+-#endif
++    FastAttributeList *pGridAttrList = m_pSerializer->createAttrList();
++
++    OString sGridType;
++    switch ( rGrid.GetGridType( ) )
++    {
++        default:
++        case GRID_NONE:
++            sGridType = OString( "default" );
++            break;
++        case GRID_LINES_ONLY:
++            sGridType = OString( "lines" );
++            break;
++        case GRID_LINES_CHARS:
++            if ( rGrid.IsSnapToChars( ) )
++                sGridType = OString( "snapToChars" );
++            else
++                sGridType = OString( "linesAndChars" );
++            break;
++    }
++    pGridAttrList->add( FSNS( XML_w, XML_type ), sGridType.getStr( ) );
++        
++    UINT16 nHeight = rGrid.GetBaseHeight() + rGrid.GetRubyHeight();
++    pGridAttrList->add( FSNS( XML_w, XML_linePitch ), 
++            OString::valueOf( sal_Int32( nHeight ) ).getStr( ) );
++        
++    MSWordStyles * pStyles = m_rExport.pStyles;
++    SwFmt * pSwFmt = pStyles->GetSwFmt();
++
++    sal_uInt32 nPageCharSize = 0;
++
++    if (pSwFmt != NULL)
++    {
++        nPageCharSize = ItemGet<SvxFontHeightItem>
++        (*pSwFmt, RES_CHRATR_CJK_FONTSIZE).GetHeight();
++    }
++
++    sal_uInt16 nPitch = rGrid.IsSquaredMode() ? rGrid.GetBaseHeight() : 
++        rGrid.GetBaseWidth( );
++    INT32 nCharSpace = ( nPitch - nPageCharSize ) * 4096 / 20;
++
++    pGridAttrList->add( FSNS( XML_w, XML_charSpace ),
++            OString::valueOf( sal_Int32( nCharSpace ) ).getStr( ) );
++
++    m_pSerializer->singleElementNS( XML_w, XML_docGrid, pGridAttrList );
+ }
+ 
+ void DocxAttributeOutput::FormatLineNumbering( const SwFmtLineNumber& rNumbering )
+@@ -3380,6 +3627,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
        m_pCharLangAttrList( NULL ),
        m_pSpacingAttrList( NULL ),
        m_pHyperlinkAttrList( NULL ),
@@ -455,7 +540,7 @@ index d82f2c8..57d2969 100644
        m_pFootnotesList( new ::docx::FootnotesList() ),
        m_pEndnotesList( new ::docx::FootnotesList() ),
        m_pSectionInfo( NULL ),
-@@ -3392,7 +3596,8 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
+@@ -3392,7 +3640,8 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
        m_bTableCellOpen( false ),
        m_nTableDepth( 0 ),
        m_bParagraphOpened( false ),
@@ -465,7 +550,7 @@ index d82f2c8..57d2969 100644
  {
  }
  
-@@ -3403,11 +3608,13 @@ DocxAttributeOutput::~DocxAttributeOutput()
+@@ -3403,11 +3652,13 @@ DocxAttributeOutput::~DocxAttributeOutput()
      delete m_pCharLangAttrList, m_pCharLangAttrList = NULL;
      delete m_pSpacingAttrList, m_pSpacingAttrList = NULL;
      delete m_pHyperlinkAttrList, m_pHyperlinkAttrList = NULL;
@@ -500,6 +585,18 @@ index ee19058..c64c7f1 100644
  public:
      DocxAttributeOutput( DocxExport &rExport, ::sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML );
  
+diff --git sw/source/filter/ww8/makefile.mk sw/source/filter/ww8/makefile.mk
+index c5613f9..28c8b45 100644
+--- sw/source/filter/ww8/makefile.mk
++++ sw/source/filter/ww8/makefile.mk
+@@ -62,6 +62,7 @@ EXCEPTIONSFILES = \
+         $(SLO)$/wrtw8num.obj \
+         $(SLO)$/wrtw8sty.obj \
+         $(SLO)$/wrtww8.obj \
++        $(SLO)$/docxattributeoutput.obj \
+         $(SLO)$/docxexportfilter.obj \
+         $(SLO)$/ww8atr.obj \
+         $(SLO)$/ww8par.obj \
 diff --git sw/source/filter/ww8/ww8atr.cxx sw/source/filter/ww8/ww8atr.cxx
 index 075a79e..a9b6f8d 100644
 --- sw/source/filter/ww8/ww8atr.cxx


More information about the ooo-build-commit mailing list