summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-07-28 18:36:05 +0200
committerJan Holesovsky <kendy@suse.cz>2011-07-28 18:36:05 +0200
commit8a1e355e1fb1f64ca5b2763d975fcfd9cdfcd374 (patch)
tree593b5e2c1ecd8383134c8ebfcbe62d373dd5f573
parent49707cf4fb3993b13f9fe001a5f19e33fb8155e5 (diff)
parent2489ca4fb15ddb62bd62eb7b53d39581cbaef24f (diff)
Merge commit 'libreoffice-3.4.2.3'
Conflicts: sw/qa/core/data/ww8/pass/CVE-2008-4841-1.doc sw/source/core/docnode/ndcopy.cxx sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.hxx sw/source/filter/ww8/ww8scan.cxx sw/source/filter/ww8/ww8scan.hxx
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx14
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx3
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx17
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx47
4 files changed, 47 insertions, 34 deletions
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 47a734ad00..640b0efffb 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 1562a759d8..4b08cbfa13 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 0ae06f08b0..b978394fb4 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 0ea9201d02..10871a831d 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 ) );
}
}