From 590751d98e10867609c45fff93edae53dfaef3a8 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 13 Aug 2013 15:09:12 +0200 Subject: DOCX import of paragraph border drop shadow Change-Id: I566c491d65b65def65b78afb583624d8272027e0 --- writerfilter/source/dmapper/DomainMapper.cxx | 6 ++++++ writerfilter/source/dmapper/PropertyIds.cxx | 1 + writerfilter/source/dmapper/PropertyIds.hxx | 1 + writerfilter/source/dmapper/PropertyMap.cxx | 22 ++++++++++++++-------- writerfilter/source/dmapper/PropertyMap.hxx | 2 ++ 5 files changed, 24 insertions(+), 8 deletions(-) (limited to 'writerfilter') diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index ee863fab347d..51f43c75c067 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -1797,6 +1798,11 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType rContext->Insert( eBorderId, uno::makeAny( pBorderHandler->getBorderLine()) , true); if(eBorderDistId) rContext->Insert(eBorderDistId, uno::makeAny( pBorderHandler->getLineDistance()), true); + if (nSprmId == NS_sprm::LN_PBrcRight && pBorderHandler->getShadow()) + { + table::ShadowFormat aFormat = rContext->getShadowFromBorder(pBorderHandler->getBorderLine()); + rContext->Insert(PROP_PARA_SHADOW_FORMAT, uno::makeAny(aFormat)); + } } } else diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index cee68ea5e7e1..34a00174513e 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -330,6 +330,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_FIRST_IS_SHARED : sName = "FirstIsShared"; break; case PROP_MIRROR_INDENTS : sName = "MirrorIndents"; break; case PROP_SURROUND_TEXT_WRAP_SMALL: sName = "SurroundTextWrapSmall"; break; + case PROP_PARA_SHADOW_FORMAT: sName = "ParaShadowFormat"; break; } ::std::pair aInsertIt = m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index 2a6b76480e6b..de53e7d70160 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -301,6 +301,7 @@ enum PropertyIds ,PROP_FIRST_IS_SHARED ,PROP_MIRROR_INDENTS ,PROP_SURROUND_TEXT_WRAP_SMALL + ,PROP_PARA_SHADOW_FORMAT }; struct PropertyNameSupplier_Impl; class PropertyNameSupplier diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 257ec94d9e51..ccb0506c0d15 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -533,14 +533,7 @@ void SectionPropertyMap::ApplyBorderToPageStyles( if (m_bBorderShadows[BORDER_RIGHT]) { - // In Word UI, shadow is a boolean property, in OOXML, it's a boolean - // property of each 4 border type, finally in Writer the border is a - // property of the page style, with shadow location, distance and - // color. See SwWW8ImplReader::SetShadow(). - table::ShadowFormat aFormat; - aFormat.Color = COL_BLACK; - aFormat.Location = table::ShadowLocation_BOTTOM_RIGHT; - aFormat.ShadowWidth = m_pBorderLines[BORDER_RIGHT]->LineWidth; + table::ShadowFormat aFormat = getShadowFromBorder(*m_pBorderLines[BORDER_RIGHT]); if (xFirst.is()) xFirst->setPropertyValue(rPropNameSupplier.GetName(PROP_SHADOW_FORMAT), uno::makeAny(aFormat)); if (xSecond.is()) @@ -548,6 +541,19 @@ void SectionPropertyMap::ApplyBorderToPageStyles( } } +table::ShadowFormat PropertyMap::getShadowFromBorder(table::BorderLine2 aBorder) +{ + // In Word UI, shadow is a boolean property, in OOXML, it's a boolean + // property of each 4 border type, finally in Writer the border is a + // property of the page style, with shadow location, distance and + // color. See SwWW8ImplReader::SetShadow(). + table::ShadowFormat aFormat; + aFormat.Color = COL_BLACK; + aFormat.Location = table::ShadowLocation_BOTTOM_RIGHT; + aFormat.ShadowWidth = aBorder.LineWidth; + return aFormat; +} + void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet > xStyle, PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom, sal_uInt32 nLineWidth ) { diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index ed0f6cb47485..da597287dbd3 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -48,6 +48,7 @@ namespace com{namespace sun{namespace star{ } namespace table{ struct BorderLine2; + struct ShadowFormat; } }}} @@ -123,6 +124,7 @@ public: #if OSL_DEBUG_LEVEL > 1 virtual void dumpXml( const TagLogger::Pointer_t pLogger ) const; #endif + static com::sun::star::table::ShadowFormat getShadowFromBorder(com::sun::star::table::BorderLine2 aBorder); }; typedef boost::shared_ptr PropertyMapPtr; -- cgit