summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-08-13 15:09:12 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-08-13 17:35:15 +0200
commit590751d98e10867609c45fff93edae53dfaef3a8 (patch)
treed656495aa5ab34749c24d75b3432d86206e4b4f8 /writerfilter
parent12a9b47ec2a892a9c5606a16396992fb6553d7eb (diff)
DOCX import of paragraph border drop shadow
Change-Id: I566c491d65b65def65b78afb583624d8272027e0
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx6
-rw-r--r--writerfilter/source/dmapper/PropertyIds.cxx1
-rw-r--r--writerfilter/source/dmapper/PropertyIds.hxx1
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx22
-rw-r--r--writerfilter/source/dmapper/PropertyMap.hxx2
5 files changed, 24 insertions, 8 deletions
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 <ooxml/OOXMLFastTokens.hxx>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
+#include <com/sun/star/table/ShadowFormat.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
@@ -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<PropertyNameMap_t::iterator,bool> 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<PropertyMap> PropertyMapPtr;