Kaydet (Commit) 03f0cbd3 authored tarafından Miklos Vajna's avatar Miklos Vajna

fdo#53556 RTF import of fFilled shape property for drwainglayer shapes

The real change is in RTFSdrImport::applyProperty(), the rest is just
refactoring to be able to read the "is textframe" property from that
method.

With this, the transparent big rectangle in the bugdoc no longer hides
the text on the first page.

Change-Id: I04cca3ade93a63edf608df047bef3bdccf8d3605
üst b3d898c2
......@@ -14,6 +14,7 @@
#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
......@@ -44,7 +45,8 @@ namespace rtftok {
RTFSdrImport::RTFSdrImport(RTFDocumentImpl& rDocument,
uno::Reference<lang::XComponent> const& xDstDoc)
: m_rImport(rDocument)
: m_rImport(rDocument),
m_bTextFrame(false)
{
uno::Reference<drawing::XDrawPageSupplier> xDrawings(xDstDoc, uno::UNO_QUERY);
if (xDrawings.is())
......@@ -193,7 +195,12 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, OUStrin
xPropertySet->setPropertyValue("FrameIsAutomaticHeight", uno::makeAny(*obFitShapeToText));
}
if (!bFilled)
xPropertySet->setPropertyValue("BackColorTransparency", uno::makeAny(sal_Int32(100)));
{
if (m_bTextFrame)
xPropertySet->setPropertyValue("BackColorTransparency", uno::makeAny(sal_Int32(100)));
else
xPropertySet->setPropertyValue("FillStyle", uno::makeAny(drawing::FillStyle_NONE));
}
}
void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
......@@ -201,7 +208,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
int nType = -1;
bool bPib = false;
bool bCustom = false;
bool bTextFrame = false;
m_bTextFrame = false;
uno::Reference<drawing::XShape> xShape;
uno::Reference<beans::XPropertySet> xPropertySet;
......@@ -241,7 +248,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
if (!bClose && m_aParents.size() == 1)
{
createShape("com.sun.star.text.TextFrame", xShape, xPropertySet);
bTextFrame = true;
m_bTextFrame = true;
std::vector<beans::PropertyValue> aDefaults = getTextFrameDefaults(true);
for (size_t j = 0; j < aDefaults.size(); ++j)
xPropertySet->setPropertyValue(aDefaults[j].Name, aDefaults[j].Value);
......@@ -256,12 +263,12 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
// Defaults
aAny <<= (sal_uInt32)0xffffff; // White in Word, kind of blue in Writer.
if (xPropertySet.is() && !bTextFrame)
if (xPropertySet.is() && !m_bTextFrame)
xPropertySet->setPropertyValue("FillColor", aAny);
}
else if ( i->first == "wzName" )
{
if (bTextFrame)
if (m_bTextFrame)
{
uno::Reference<container::XNamed> xNamed(xShape, uno::UNO_QUERY);
xNamed->setName(i->second);
......@@ -279,7 +286,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
else if (i->first == "fillColor" && xPropertySet.is())
{
aAny <<= msfilter::util::BGRToRGB(i->second.toInt32());
if (bTextFrame)
if (m_bTextFrame)
xPropertySet->setPropertyValue("BackColor", aAny);
else
xPropertySet->setPropertyValue("FillColor", aAny);
......@@ -524,7 +531,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
if (xPropertySet.is())
{
if (!bTextFrame)
if (!m_bTextFrame)
{
xPropertySet->setPropertyValue("LineColor", aLineColor);
xPropertySet->setPropertyValue("LineWidth", aLineWidth);
......@@ -544,7 +551,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
}
if (rShape.oZ)
resolveDhgt(xPropertySet, *rShape.oZ);
if (bTextFrame)
if (m_bTextFrame)
// Writer textframes implement text::WritingMode2, which is a different data type.
xPropertySet->setPropertyValue("WritingMode", uno::makeAny(sal_Int16(eWritingMode)));
else
......@@ -558,7 +565,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
return;
}
if (m_aParents.size() && m_aParents.top().is() && !bTextFrame)
if (m_aParents.size() && m_aParents.top().is() && !m_bTextFrame)
m_aParents.top()->add(xShape);
if (bCustom && xShape.is())
{
......@@ -616,7 +623,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
nTop = static_cast< sal_Int32 >( rShape.nTop + fHeightRatio * (*oRelTop - *oGroupTop) );
}
if (bTextFrame)
if (m_bTextFrame)
{
xPropertySet->setPropertyValue("HoriOrientPosition", uno::makeAny(nLeft));
xPropertySet->setPropertyValue("VertOrientPosition", uno::makeAny(nTop));
......
......@@ -45,6 +45,8 @@ namespace writerfilter {
RTFDocumentImpl& m_rImport;
std::stack< uno::Reference<drawing::XShapes> > m_aParents;
uno::Reference<drawing::XShape> m_xShape;
/// If m_xShape is imported as a Writer text frame (instead of a drawinglayer rectangle).
bool m_bTextFrame;
};
} // namespace rtftok
} // namespace writerfilter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment