writerfilter: fix indentation in rtfsdrimport

Change-Id: Ibecedba7a8a6e6b3218f64aefdd05897a6612a71
This commit is contained in:
Miklos Vajna
2014-04-21 11:47:05 +02:00
parent 164c89b5f4
commit fdb9807a10
2 changed files with 158 additions and 153 deletions

View File

@@ -40,8 +40,10 @@
#include <oox/drawingml/shapepropertymap.hxx>
#include <oox/helper/propertyset.hxx>
namespace writerfilter {
namespace rtftok {
namespace writerfilter
{
namespace rtftok
{
RTFSdrImport::RTFSdrImport(RTFDocumentImpl& rDocument,
uno::Reference<lang::XComponent> const& xDstDoc)
@@ -255,7 +257,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
for (std::vector< std::pair<OUString, OUString> >::iterator i = rShape.aProperties.begin();
i != rShape.aProperties.end(); ++i)
{
if ( i->first == "shapeType" )
if (i->first == "shapeType")
{
nType = i->second.toInt32();
switch (nType)
@@ -287,7 +289,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
if (xPropertySet.is() && !m_bTextFrame)
xPropertySet->setPropertyValue("FillColor", aAny);
}
else if ( i->first == "wzName" )
else if (i->first == "wzName")
{
if (m_bTextFrame)
{
@@ -297,9 +299,9 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
else
xPropertySet->setPropertyValue("Name", uno::makeAny(i->second));
}
else if ( i->first == "wzDescription" )
else if (i->first == "wzDescription")
xPropertySet->setPropertyValue("Description", uno::makeAny(i->second));
else if ( i->first == "pib" )
else if (i->first == "pib")
{
m_rImport.setDestinationText(i->second);
bPib = true;
@@ -315,12 +317,12 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
// fillType will decide, possible it'll be the start color of a gradient.
aFillModel.moColor.set(OUString("#") + OStringToOUString(msfilter::util::ConvertColor(aAny.get<sal_Int32>()), RTL_TEXTENCODING_UTF8));
}
else if ( i->first == "fillBackColor" )
else if (i->first == "fillBackColor")
// fillType will decide, possible it'll be the end color of a gradient.
aFillModel.moColor2.set(OUString("#") + OStringToOUString(msfilter::util::ConvertColor(msfilter::util::BGRToRGB(i->second.toInt32())), RTL_TEXTENCODING_UTF8));
else if (i->first == "lineColor")
aLineColor <<= msfilter::util::BGRToRGB(i->second.toInt32());
else if ( i->first == "lineBackColor" )
else if (i->first == "lineBackColor")
; // Ignore: complementer of lineColor
else if (i->first == "txflTextFlow" && xPropertySet.is())
{
@@ -337,7 +339,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
}
else if (i->first == "lineWidth")
aLineWidth <<= i->second.toInt32()/360;
else if ( i->first == "pVerticies" )
else if (i->first == "pVerticies")
{
uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aCoordinates;
sal_Int32 nSize = 0; // Size of a token (its value is hardwired in the exporter)
@@ -380,7 +382,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
aPropertyValue.Value <<= aCoordinates;
aPathPropVec.push_back(aPropertyValue);
}
else if ( i->first == "pSegmentInfo" )
else if (i->first == "pSegmentInfo")
{
uno::Sequence<drawing::EnhancedCustomShapeSegment> aSegments;
sal_Int32 nSize = 0;
@@ -446,15 +448,15 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
aPropertyValue.Value <<= aSegments;
aPathPropVec.push_back(aPropertyValue);
}
else if ( i->first == "geoLeft" )
else if (i->first == "geoLeft")
aViewBox.X = i->second.toInt32();
else if ( i->first == "geoTop" )
else if (i->first == "geoTop")
aViewBox.Y = i->second.toInt32();
else if ( i->first == "geoRight" )
else if (i->first == "geoRight")
aViewBox.Width = i->second.toInt32();
else if ( i->first == "geoBottom" )
else if (i->first == "geoBottom")
aViewBox.Height = i->second.toInt32();
else if ( i->first == "dhgt" )
else if (i->first == "dhgt")
{
// dhgt is Word 2007, \shpz is Word 97-2003, the later has priority.
if (!rShape.oZ)
@@ -599,7 +601,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
}
else
{
static const OUString aBorders[] = {
static const OUString aBorders[] =
{
OUString("TopBorder"), OUString("LeftBorder"), OUString("BottomBorder"), OUString("RightBorder")
};
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i)
@@ -678,10 +681,10 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
sal_Int32 nShapeHeight = rShape.nBottom - rShape.nTop;
sal_Int32 nCoordSysWidth = *oGroupRight - *oGroupLeft;
sal_Int32 nCoordSysHeight = *oGroupBottom - *oGroupTop;
double fWidthRatio = static_cast< double >( nShapeWidth ) / nCoordSysWidth;
double fHeightRatio = static_cast< double >( nShapeHeight ) / nCoordSysHeight;
nLeft = static_cast< sal_Int32 >( rShape.nLeft + fWidthRatio * (*oRelLeft - *oGroupLeft) );
nTop = static_cast< sal_Int32 >( rShape.nTop + fHeightRatio * (*oRelTop - *oGroupTop) );
double fWidthRatio = static_cast< double >(nShapeWidth) / nCoordSysWidth;
double fHeightRatio = static_cast< double >(nShapeHeight) / nCoordSysHeight;
nLeft = static_cast< sal_Int32 >(rShape.nLeft + fWidthRatio * (*oRelLeft - *oGroupLeft));
nTop = static_cast< sal_Int32 >(rShape.nTop + fHeightRatio * (*oRelTop - *oGroupTop));
}
if (m_bTextFrame)

View File

@@ -14,12 +14,14 @@
#include <rtfdocumentimpl.hxx>
namespace writerfilter {
namespace rtftok {
/// Handles the import of drawings using RTF markup.
class RTFSdrImport
{
public:
namespace writerfilter
{
namespace rtftok
{
/// Handles the import of drawings using RTF markup.
class RTFSdrImport
{
public:
RTFSdrImport(RTFDocumentImpl& rImport, uno::Reference<lang::XComponent> const& xDstDoc);
virtual ~RTFSdrImport();
@@ -40,7 +42,7 @@ namespace writerfilter {
void pushParent(uno::Reference<drawing::XShapes> xParent);
/// Pop the current group shape from the parent stack.
void popParent();
private:
private:
void createShape(const OUString& aService, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet);
void applyProperty(uno::Reference<drawing::XShape> xShape, const OUString& aKey, const OUString& aValue);
@@ -49,8 +51,8 @@ namespace writerfilter {
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 rtftok
} // namespace writerfilter
#endif // _RTFSDRIPORT_HXX_