summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-05-11 09:05:12 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-05-11 12:17:37 +0200
commitec1a96e79e3e6225706151cb72eb3df763b0598d (patch)
tree7910fca409b9769452ff98e4d6c49e8acac58e21 /writerfilter
parente8ef62f68ba0bf6a4908a9d63472b14d25e7623e (diff)
tdf#91074 RTF import: handle \dplineco* for text frames
RTFSdrImport::resolve() already had the logic to use the relevant API depending on if the shape is a text frame or not -- extract that to a separate member function and use it from RTFDocumentImpl::popState(), too. Change-Id: I663b372244f09f002447ece62587143b2a575795
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx6
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.cxx45
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.hxx2
3 files changed, 33 insertions, 20 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 2077d5dc6920..72fc1fc8ff1a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -5480,7 +5480,11 @@ RTFError RTFDocumentImpl::popState()
xShape->setSize(awt::Size(rDrawing.nRight, rDrawing.nBottom));
if (rDrawing.bHasLineColor)
- xPropertySet->setPropertyValue("LineColor", uno::makeAny(sal_uInt32((rDrawing.nLineColorR<<16) + (rDrawing.nLineColorG<<8) + rDrawing.nLineColorB)));
+ {
+ uno::Any aLineColor = uno::makeAny(sal_uInt32((rDrawing.nLineColorR<<16) + (rDrawing.nLineColorG<<8) + rDrawing.nLineColorB));
+ uno::Any aLineWidth;
+ RTFSdrImport::resolveLineColorAndWidth(bTextFrame, xPropertySet, aLineColor, aLineWidth);
+ }
if (rDrawing.bHasFillColor)
xPropertySet->setPropertyValue("FillColor", uno::makeAny(sal_uInt32((rDrawing.nFillColorR<<16) + (rDrawing.nFillColorG<<8) + rDrawing.nFillColorB)));
else if (!bTextFrame)
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 400a26b017dc..fcc20d4ee421 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -125,6 +125,31 @@ void RTFSdrImport::resolveDhgt(uno::Reference<beans::XPropertySet> const& xPrope
m_aGraphicZOrderHelper.addItem(xPropertySet, nZOrder);
}
+void RTFSdrImport::resolveLineColorAndWidth(bool bTextFrame, const uno::Reference<beans::XPropertySet>& xPropertySet, uno::Any& rLineColor, uno::Any& rLineWidth)
+{
+ if (!bTextFrame)
+ {
+ xPropertySet->setPropertyValue("LineColor", rLineColor);
+ xPropertySet->setPropertyValue("LineWidth", rLineWidth);
+ }
+ else
+ {
+ static const char* aBorders[] =
+ {
+ "TopBorder", "LeftBorder", "BottomBorder", "RightBorder"
+ };
+ for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i)
+ {
+ table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(OUString::createFromAscii(aBorders[i])).get<table::BorderLine2>();
+ if (rLineColor.hasValue())
+ aBorderLine.Color = rLineColor.get<sal_Int32>();
+ if (rLineWidth.hasValue())
+ aBorderLine.LineWidth = rLineWidth.get<sal_Int32>();
+ xPropertySet->setPropertyValue(OUString::createFromAscii(aBorders[i]), uno::makeAny(aBorderLine));
+ }
+ }
+}
+
void RTFSdrImport::resolveFLine(uno::Reference<beans::XPropertySet> const& xPropertySet,
sal_Int32 const nFLine)
{
@@ -759,25 +784,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
if (xPropertySet.is())
{
- if (!m_bTextFrame)
- {
- xPropertySet->setPropertyValue("LineColor", aLineColor);
- xPropertySet->setPropertyValue("LineWidth", aLineWidth);
- }
- else
- {
- static const char* aBorders[] =
- {
- "TopBorder", "LeftBorder", "BottomBorder", "RightBorder"
- };
- for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i)
- {
- table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(OUString::createFromAscii(aBorders[i])).get<table::BorderLine2>();
- aBorderLine.Color = aLineColor.get<sal_Int32>();
- aBorderLine.LineWidth = aLineWidth.get<sal_Int32>();
- xPropertySet->setPropertyValue(OUString::createFromAscii(aBorders[i]), uno::makeAny(aBorderLine));
- }
- }
+ resolveLineColorAndWidth(m_bTextFrame, xPropertySet, aLineColor, aLineWidth);
if (rShape.oZ)
resolveDhgt(xPropertySet, *rShape.oZ, /*bOldStyle=*/false);
if (m_bTextFrame)
diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx
index 96058537ddfb..afbbe4270b95 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.hxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.hxx
@@ -35,6 +35,8 @@ public:
/// Append property on the current parent.
void appendGroupProperty(const OUString& aKey, const OUString& aValue);
void resolveDhgt(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, sal_Int32 nZOrder, bool bOldStyle);
+ /// Set line color and line width on the shape, using the relevant API depending on if the shape is a text frame or not.
+ static void resolveLineColorAndWidth(bool bTextFrame, const css::uno::Reference<css::beans::XPropertySet>& xPropertySet, css::uno::Any& rLineColor, css::uno::Any& rLineWidth);
static void resolveFLine(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, sal_Int32 nFLine);
/**
* These are the default in Word, but not in Writer.