diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-08-15 17:06:57 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-08-15 17:09:11 +0200 |
commit | 66b4bfe302e248fc1503c5c74b83f4fb5fee4026 (patch) | |
tree | 3928503e3cefd23c6315380bbca1280f55534b1a /writerfilter/source/dmapper/DomainMapperTableHandler.cxx | |
parent | 26d9efd36a16d2095d8fb885290c6816082ec814 (diff) |
DOCX import: handle custom left cell margin for float table position
Change-Id: I5bc51b739c663d3e123c9d7fb4c2a70f01f8c841
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapperTableHandler.cxx')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 72d7c744946d..3d99fa25050e 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -38,6 +38,8 @@ namespace dmapper { using namespace ::com::sun::star; using namespace ::std; +#define DEF_BORDER_DIST 190 //0,19cm + #ifdef DEBUG_DMAPPER_TABLE_HANDLER static void lcl_printProperties( PropertyMapPtr pProps ) { @@ -306,6 +308,22 @@ bool lcl_extractTableBorderProperty(PropertyMapPtr pTableProperties, const Prope } +void lcl_DecrementHoriOrientPosition(uno::Sequence<beans::PropertyValue>& rFrameProperties, sal_Int32 nAmount) +{ + // Shifts the frame left by the given value. + for (sal_Int32 i = 0; i < rFrameProperties.getLength(); ++i) + { + beans::PropertyValue& rPropertyValue = rFrameProperties[i]; + if (rPropertyValue.Name == "HoriOrientPosition") + { + sal_Int32 nValue = rPropertyValue.Value.get<sal_Int32>(); + nValue -= nAmount; + rPropertyValue.Value <<= nValue; + return; + } + } +} + TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo & rInfo, uno::Sequence<beans::PropertyValue>& rFrameProperties) { // will receive the table style if any @@ -401,8 +419,10 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo m_aTableProperties->Insert( PROP_TABLE_BORDER_DISTANCES, uno::makeAny( aDistances ) ); + if (rFrameProperties.hasElements()) + lcl_DecrementHoriOrientPosition(rFrameProperties, rInfo.nLeftBorderDistance); + // Set table above/bottom spacing to 0. - // TODO: handle 'Around' text wrapping mode m_aTableProperties->Insert( PROP_TOP_MARGIN, uno::makeAny( sal_Int32( 0 ) ) ); m_aTableProperties->Insert( PROP_BOTTOM_MARGIN, uno::makeAny( sal_Int32( 0 ) ) ); @@ -430,20 +450,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo if (!rFrameProperties.hasElements()) rInfo.nLeftBorderDistance += aLeftBorder.LineWidth * 0.5; else - { - // If this is a floating table, then the position of the frame should be adjusted, instead. - for (sal_Int32 i = 0; i < rFrameProperties.getLength(); ++i) - { - beans::PropertyValue& rPropertyValue = rFrameProperties[i]; - if (rPropertyValue.Name == "HoriOrientPosition") - { - sal_Int32 nValue = rPropertyValue.Value.get<sal_Int32>(); - nValue -= aLeftBorder.LineWidth * 0.5; - rPropertyValue.Value <<= nValue; - break; - } - } - } + lcl_DecrementHoriOrientPosition(rFrameProperties, aLeftBorder.LineWidth * 0.5); } } if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_RIGHT_BORDER, rInfo, aBorderLine)) |