summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-10-23 17:09:25 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-10-25 09:34:42 +0200
commit01a32b7d074511bed24044dc94e1159aea62722b (patch)
tree9c19c385ae7cdd4877dacc286c2b3766c7326208 /writerfilter
parenta2b5ead0dc86516edd5008d5aaca862eaf611667 (diff)
fdo#85179 RTF filter: import image border
Also adjust CppunitTest_sw_htmlexport that implicitly tested that there is no color around the image. Change-Id: I8e14dfa7e7be80c4f8c492999071decae6a492e8
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx31
-rw-r--r--writerfilter/source/dmapper/GraphicImport.hxx2
2 files changed, 25 insertions, 8 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 995a7a401069..0b58ddcc16ab 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -179,6 +179,11 @@ struct GraphicBorderLine
,bHasShadow(false)
{}
+ bool isEmpty()
+ {
+ return nLineWidth == 0 && nLineColor == 0 && bHasShadow == false;
+ }
+
};
class GraphicImport_Impl
@@ -704,7 +709,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
// fdo#70457: transform XShape into a SwXTextGraphicObject only if there's no rotation
if ( nRotation == 0 && !bContainsEffects )
- m_xGraphicObject = createGraphicObject( aMediaProperties );
+ m_xGraphicObject = createGraphicObject( aMediaProperties, xShapeProps );
bUseShape = !m_xGraphicObject.is( );
@@ -1131,7 +1136,7 @@ void GraphicImport::lcl_entry(int /*pos*/, writerfilter::Reference<Properties>::
{
}
-uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const beans::PropertyValues& aMediaProperties )
+uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const beans::PropertyValues& aMediaProperties, const uno::Reference<beans::XPropertySet>& xShapeProps )
{
uno::Reference< text::XTextContent > xGraphicObject;
try
@@ -1160,10 +1165,21 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
if( m_pImpl->eGraphicImportType == IMPORT_AS_GRAPHIC || !nBorder )
{
GraphicBorderLine& rBorderLine = m_pImpl->aBorders[m_pImpl->eGraphicImportType == IMPORT_AS_SHAPE ? BORDER_TOP : static_cast<BorderPosition>(nBorder)];
- aBorderLine.Color = rBorderLine.nLineColor;
- aBorderLine.InnerLineWidth = 0;
- aBorderLine.OuterLineWidth = (sal_Int16)rBorderLine.nLineWidth;
- aBorderLine.LineDistance = 0;
+ if (rBorderLine.isEmpty() && xShapeProps.is())
+ {
+ // In case we got no border tokens and we have the
+ // original shape, then use its line properties as the
+ // border.
+ aBorderLine.Color = xShapeProps->getPropertyValue("LineColor").get<sal_Int32>();
+ aBorderLine.LineWidth = xShapeProps->getPropertyValue("LineWidth").get<sal_Int32>();
+ }
+ else
+ {
+ aBorderLine.Color = rBorderLine.nLineColor;
+ aBorderLine.InnerLineWidth = 0;
+ aBorderLine.OuterLineWidth = (sal_Int16)rBorderLine.nLineWidth;
+ aBorderLine.LineDistance = 0;
+ }
}
PropertyIds aBorderProps[4] =
{
@@ -1371,7 +1387,8 @@ void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Referen
uno::Reference< io::XInputStream > xIStream = new XInputStreamHelper( buf, len, m_pImpl->bIsBitmap );
aMediaProperties[0].Value <<= xIStream;
- m_xGraphicObject = createGraphicObject( aMediaProperties );
+ uno::Reference<beans::XPropertySet> xPropertySet;
+ m_xGraphicObject = createGraphicObject( aMediaProperties, xPropertySet );
}
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx b/writerfilter/source/dmapper/GraphicImport.hxx
index 160e41794f52..5b8e10177c33 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -76,7 +76,7 @@ class GraphicImport : public LoggedProperties, public LoggedTable
css::uno::Reference<css::drawing::XShape> m_xShape;
void ProcessShapeOptions(Value & val);
- css::uno::Reference<css::text::XTextContent > createGraphicObject(const css::beans::PropertyValues& aMediaProperties );
+ css::uno::Reference<css::text::XTextContent > createGraphicObject(const css::beans::PropertyValues& aMediaProperties, const css::uno::Reference<css::beans::XPropertySet>& xShapeProps);
void putPropertyToFrameGrabBag( const OUString& sPropertyName, const css::uno::Any& aPropertyValue );