diff options
-rw-r--r-- | sw/source/filter/rtf/swparrtf.cxx | 14 | ||||
-rw-r--r-- | sw/source/filter/ww8/attributeoutputbase.hxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 17 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 47 |
4 files changed, 47 insertions, 34 deletions
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index bb44aa0a9226..129044b4126d 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -1172,7 +1172,7 @@ void SwRTFParser::ReadShpTxt(String& s) } /* - * Very basic support for the "Buchhalternase". + * Very basic support for the Z-line. */ void SwRTFParser::ReadDrawingObject() { @@ -1184,6 +1184,9 @@ void SwRTFParser::ReadDrawingObject() ::basegfx::B2DPoint aPoint; bool bPolygonActive(false); + SwFmtHoriOrient aHori( 0, text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME ); + SwFmtVertOrient aVert( 0, text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME ); + while (level>0 && IsParserWorking()) { nToken = GetNextToken(); @@ -1195,6 +1198,12 @@ void SwRTFParser::ReadDrawingObject() case '{': level++; break; + case RTF_DOBXMARGIN: + aHori.SetRelationOrient( text::RelOrientation::PAGE_PRINT_AREA ); + break; + case RTF_DOBYMARGIN: + aVert.SetRelationOrient( text::RelOrientation::PAGE_PRINT_AREA ); + break; case RTF_DPX: aRect.setX(nTokenValue); break; @@ -1207,6 +1216,7 @@ void SwRTFParser::ReadDrawingObject() case RTF_DPYSIZE: aRect.setHeight(nTokenValue); break; + case RTF_DPLINE: case RTF_DPPOLYCOUNT: bPolygonActive = true; break; @@ -1243,9 +1253,7 @@ void SwRTFParser::ReadDrawingObject() aAnchor.SetAnchor( pPam->GetPoint() ); aFlySet.Put( aAnchor ); - SwFmtHoriOrient aHori( 0, text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME ); aFlySet.Put( aHori ); - SwFmtVertOrient aVert( 0, text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME ); aFlySet.Put( aVert ); pDoc->GetOrCreateDrawModel(); diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index 1562a759d8a2..4b08cbfa13c6 100644 --- a/sw/source/filter/ww8/attributeoutputbase.hxx +++ b/sw/source/filter/ww8/attributeoutputbase.hxx @@ -545,6 +545,9 @@ protected: /// Sfx item RES_KEEP virtual void FormatKeep( const SvxFmtKeepItem& ) = 0; + /// Compute the grid character pitch + sal_uInt32 GridCharacterPitch( const SwTextGridItem& rGrid ) const; + /// Sfx item RES_TEXTGRID virtual void FormatTextGrid( const SwTextGridItem& ) = 0; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 8f4e0a202932..45aab31dfb41 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4215,23 +4215,8 @@ void DocxAttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid ) 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_FONTSIZE).GetHeight(); - } - - sal_uInt16 nPitch = rGrid.IsSquaredMode() ? rGrid.GetBaseHeight() : - rGrid.GetBaseWidth( ); - sal_Int32 nCharSpace = ( nPitch - nPageCharSize ) * 4096 / 20; - pGridAttrList->add( FSNS( XML_w, XML_charSpace ), - OString::valueOf( sal_Int32( nCharSpace ) ).getStr( ) ); + OString::valueOf( sal_Int32( GridCharacterPitch( rGrid ) ) ).getStr( ) ); m_pSerializer->singleElementNS( XML_w, XML_docGrid, pGridAttrList ); } diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 0ea9201d02dc..10871a831d81 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -3638,6 +3638,37 @@ void WW8AttributeOutput::SectionBreak( sal_uInt8 nC, const WW8_SepInfo* /*pSecti m_rWW8Export.ReplaceCr( nC ); } +sal_uInt32 AttributeOutputBase::GridCharacterPitch( const SwTextGridItem& rGrid ) const +{ + MSWordStyles * pStyles = GetExport().pStyles; + SwFmt * pSwFmt = pStyles->GetSwFmt(); + + sal_uInt32 nPageCharSize = 0; + + if (pSwFmt != NULL) + { + nPageCharSize = ItemGet<SvxFontHeightItem> + (*pSwFmt, RES_CHRATR_FONTSIZE).GetHeight(); + } + sal_uInt16 nPitch = rGrid.IsSquaredMode() ? rGrid.GetBaseHeight() : + rGrid.GetBaseWidth( ); + + sal_Int32 nCharWidth = nPitch - nPageCharSize; + sal_Int32 nFraction = nCharWidth % 20; + if ( nCharWidth < 0 ) + nFraction = 20 + nFraction; + nFraction = ( nFraction * 0xFFF ) / 20; + nFraction = ( nFraction & 0x00000FFF ); + + sal_Int32 nMain = nCharWidth / 20; + if ( nCharWidth < 0 ) + nMain -= 1; + nMain = nMain * 0x1000; + nMain = ( nMain & 0xFFFFF000 ); + + return sal_uInt32( nFraction + nMain ); +} + void WW8AttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid ) { if ( m_rWW8Export.bOutPageDescs && m_rWW8Export.bWrtWW8 ) @@ -3667,22 +3698,8 @@ void WW8AttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid ) m_rWW8Export.InsUInt16( NS_sprm::LN_SDyaLinePitch ); m_rWW8Export.InsUInt16( nHeight ); - MSWordStyles * pStyles = m_rWW8Export.pStyles; - SwFmt * pSwFmt = pStyles->GetSwFmt(); - - sal_uInt32 nPageCharSize = 0; - - if (pSwFmt != NULL) - { - nPageCharSize = ItemGet<SvxFontHeightItem> - (*pSwFmt, RES_CHRATR_FONTSIZE).GetHeight(); - } - sal_uInt16 nPitch = rGrid.IsSquaredMode() ? rGrid.GetBaseHeight() : - rGrid.GetBaseWidth( ); - sal_Int32 nCharSpace = ( nPitch - nPageCharSize ) * 4096 / 20; - m_rWW8Export.InsUInt16( NS_sprm::LN_SDxtCharSpace ); - m_rWW8Export.InsUInt32( nCharSpace ); + m_rWW8Export.InsUInt32( GridCharacterPitch( rGrid ) ); } } |