[Libreoffice-commits] core.git: sw/qa writerfilter/source
Mark Hung
marklh9 at gmail.com
Mon Apr 24 13:54:04 UTC 2017
sw/qa/extras/ooxmlexport/data/tdf107359-char-pitch.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 21 ++++++++++++++++
writerfilter/source/dmapper/PropertyIds.cxx | 1
writerfilter/source/dmapper/PropertyIds.hxx | 1
writerfilter/source/dmapper/PropertyMap.cxx | 12 +++------
5 files changed, 28 insertions(+), 7 deletions(-)
New commits:
commit 6030e8f5a42d48a43076bf1e2ddc88b20242e6da
Author: Mark Hung <marklh9 at gmail.com>
Date: Sun Apr 23 13:41:32 2017 +0800
tdf107359: imporve line pitch and char pitch importing of writerfilter.
1. Use converted style name to assure the default style is found.
2. Switch off squared-page mode before setting the base text width and height.
3. Ruby text height is not effective per ODF spec.
Change-Id: I0f2901a453a9f7b344cac6989780688cc2d6c7b4
Reviewed-on: https://gerrit.libreoffice.org/36828
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Mark Hung <marklh9 at gmail.com>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf107359-char-pitch.docx b/sw/qa/extras/ooxmlexport/data/tdf107359-char-pitch.docx
new file mode 100644
index 000000000000..970d722d3190
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf107359-char-pitch.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index d751899dee8e..f6a0dc3efa57 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -2172,6 +2172,27 @@ DECLARE_OOXMLEXPORT_TEST( testTablePosition15, "table-position-15.docx" )
}
}
+DECLARE_OOXMLEXPORT_TEST( testTdf107359, "tdf107359-char-pitch.docx" )
+{
+ uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
+
+ bool bGridSnapToChars;
+ xPropertySet->getPropertyValue("GridSnapToChars") >>= bGridSnapToChars;
+ CPPUNIT_ASSERT_EQUAL( false, bGridSnapToChars );
+
+ sal_Int32 nRubyHeight;
+ xPropertySet->getPropertyValue("GridRubyHeight") >>= nRubyHeight;
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(0), nRubyHeight );
+
+ sal_Int32 nBaseHeight;
+ xPropertySet->getPropertyValue("GridBaseHeight") >>= nBaseHeight;
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(convertTwipToMm100(18 * 20)), nBaseHeight );
+
+ sal_Int32 nBaseWidth;
+ xPropertySet->getPropertyValue("GridBaseWidth") >>= nBaseWidth;
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(convertTwipToMm100(24 * 20)), nBaseWidth );
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 9182ac48b3f9..e109ca15d0c6 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -196,6 +196,7 @@ OUString getPropertyName( PropertyIds eId )
case PROP_GRID_PRINT : sName = "GridPrint"; break;
case PROP_GRID_LINES : sName = "GridLines"; break;
case PROP_GRID_BASE_HEIGHT : sName = "GridBaseHeight"; break;
+ case PROP_GRID_BASE_WIDTH : sName = "GridBaseWidth"; break;
case PROP_GRID_RUBY_HEIGHT : sName = "GridRubyHeight"; break;
case PROP_GRID_STANDARD_MODE : sName = "StandardPageMode"; break;
case PROP_IS_ON : sName = "IsOn"; break;
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index 4bf8bf84c6ce..911667e9dd09 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -134,6 +134,7 @@ enum PropertyIds
,PROP_GRAPHIC
,PROP_GRAPHIC_COLOR_MODE
,PROP_GRID_BASE_HEIGHT
+ ,PROP_GRID_BASE_WIDTH
,PROP_GRID_DISPLAY
,PROP_GRID_LINES
,PROP_GRID_MODE
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 6dd001acc3bb..8c81f7fb0ecb 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1258,8 +1258,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
}
sal_Int32 nCharWidth = 423; //240 twip/ 12 pt
- //todo: is '0' the right index here?
- const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD( OUString::number( 0, 16 ) );
+ const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( "Standard" );
if ( pEntry.get() )
{
boost::optional< PropertyMap::Property > pPropHeight = pEntry->pProperties->getProperty( PROP_CHAR_HEIGHT_ASIAN );
@@ -1284,11 +1283,6 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
nFraction = (nFraction * 20) / 0xFFF;
nCharWidth += ConversionHelper::convertTwipToMM100( nFraction );
}
- Insert( PROP_GRID_BASE_HEIGHT, uno::makeAny( nCharWidth ) );
- sal_Int32 nRubyHeight = nGridLinePitch - nCharWidth;
- if ( nRubyHeight < 0 )
- nRubyHeight = 0;
- Insert( PROP_GRID_RUBY_HEIGHT, uno::makeAny( nRubyHeight ) );
if ( m_nPageNumberType >= 0 )
Insert( PROP_NUMBERING_TYPE, uno::makeAny( m_nPageNumberType ) );
@@ -1309,6 +1303,10 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
(void)rEx;
}
+ Insert( PROP_GRID_BASE_HEIGHT, uno::makeAny( nGridLinePitch ) );
+ Insert( PROP_GRID_BASE_WIDTH, uno::makeAny( nCharWidth ) );
+ Insert( PROP_GRID_RUBY_HEIGHT, uno::makeAny( sal_Int32( 0 ) ) );
+
if ( rDM_Impl.IsNewDoc() )
ApplyProperties_( xFollowPageStyle );
More information about the Libreoffice-commits
mailing list