summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-10-21 12:31:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-10-21 14:58:51 +0200
commit29489b33b435683021b72cb2bce27aba8cb7a430 (patch)
tree8e4e1c59d56d5ed0d0ca4d088419067041e4553a /oox
parenta4244c0f05b95ded277a3a7ed217bf0451daa996 (diff)
loplugin:flatten
Change-Id: I3b4226a9d089ec9aedab95d96e50a068f57a76c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123991 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx36
-rw-r--r--oox/source/vml/vmlshapecontext.cxx74
2 files changed, 55 insertions, 55 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 6b05b15546cc..d9dd073fbaf7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2965,27 +2965,27 @@ void DrawingML::WriteLstStyles(const css::uno::Reference<css::text::XTextContent
Reference<XTextRange> rRun;
- if (xEnumeration->hasMoreElements())
+ if (!xEnumeration->hasMoreElements())
+ return;
+
+ Any aAny(xEnumeration->nextElement());
+ if (aAny >>= rRun)
{
- Any aAny(xEnumeration->nextElement());
- if (aAny >>= rRun)
- {
- float fFirstCharHeight = rnCharHeight / 1000.;
- Reference<XPropertySet> xFirstRunPropSet(rRun, UNO_QUERY);
- Reference<XPropertySetInfo> xFirstRunPropSetInfo
- = xFirstRunPropSet->getPropertySetInfo();
+ float fFirstCharHeight = rnCharHeight / 1000.;
+ Reference<XPropertySet> xFirstRunPropSet(rRun, UNO_QUERY);
+ Reference<XPropertySetInfo> xFirstRunPropSetInfo
+ = xFirstRunPropSet->getPropertySetInfo();
- if (xFirstRunPropSetInfo->hasPropertyByName("CharHeight"))
- fFirstCharHeight = xFirstRunPropSet->getPropertyValue("CharHeight").get<float>();
+ if (xFirstRunPropSetInfo->hasPropertyByName("CharHeight"))
+ fFirstCharHeight = xFirstRunPropSet->getPropertyValue("CharHeight").get<float>();
- mpFS->startElementNS(XML_a, XML_lstStyle);
- if( !WriteParagraphProperties(rParagraph, fFirstCharHeight, XML_lvl1pPr) )
- mpFS->startElementNS(XML_a, XML_lvl1pPr);
- WriteRunProperties(xFirstRunPropSet, false, XML_defRPr, true, rbOverridingCharHeight,
- rnCharHeight, GetScriptType(rRun->getString()), rXShapePropSet);
- mpFS->endElementNS(XML_a, XML_lvl1pPr);
- mpFS->endElementNS(XML_a, XML_lstStyle);
- }
+ mpFS->startElementNS(XML_a, XML_lstStyle);
+ if( !WriteParagraphProperties(rParagraph, fFirstCharHeight, XML_lvl1pPr) )
+ mpFS->startElementNS(XML_a, XML_lvl1pPr);
+ WriteRunProperties(xFirstRunPropSet, false, XML_defRPr, true, rbOverridingCharHeight,
+ rnCharHeight, GetScriptType(rRun->getString()), rXShapePropSet);
+ mpFS->endElementNS(XML_a, XML_lvl1pPr);
+ mpFS->endElementNS(XML_a, XML_lstStyle);
}
}
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index d6051356ff14..e9284747774b 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -579,46 +579,46 @@ void ShapeContext::setPoints(const OUString& rPoints)
}
// VML polyline has no size in its style attribute. Word writes the size to attribute
// coordsize with values in twip but without unit. For others we get size from points.
- if (mrShape.getTypeModel().maWidth.isEmpty() && mrShape.getTypeModel().maHeight.isEmpty())
+ if (!mrShape.getTypeModel().maWidth.isEmpty() || !mrShape.getTypeModel().maHeight.isEmpty())
+ return;
+
+ if (mrShape.getTypeModel().moCoordSize.has())
{
- if (mrShape.getTypeModel().moCoordSize.has())
- {
- double fWidth = mrShape.getTypeModel().moCoordSize.get().first;
- fWidth = o3tl::convert(fWidth, o3tl::Length::twip, o3tl::Length::pt);
- double fHeight = mrShape.getTypeModel().moCoordSize.get().second;
- fHeight = o3tl::convert(fHeight, o3tl::Length::twip, o3tl::Length::pt);
- mrShape.getTypeModel().maWidth = OUString::number(fWidth) + "pt";
- mrShape.getTypeModel().maHeight = OUString::number(fHeight) + "pt";
- }
- else if (mrShapeModel.maPoints.size())
+ double fWidth = mrShape.getTypeModel().moCoordSize.get().first;
+ fWidth = o3tl::convert(fWidth, o3tl::Length::twip, o3tl::Length::pt);
+ double fHeight = mrShape.getTypeModel().moCoordSize.get().second;
+ fHeight = o3tl::convert(fHeight, o3tl::Length::twip, o3tl::Length::pt);
+ mrShape.getTypeModel().maWidth = OUString::number(fWidth) + "pt";
+ mrShape.getTypeModel().maHeight = OUString::number(fHeight) + "pt";
+ }
+ else if (mrShapeModel.maPoints.size())
+ {
+ double fMinX = mrShapeModel.maPoints[0].X;
+ double fMaxX = mrShapeModel.maPoints[0].X;
+ double fMinY = mrShapeModel.maPoints[0].Y;
+ double fMaxY = mrShapeModel.maPoints[0].Y;
+ for (const auto& rPoint : mrShapeModel.maPoints)
{
- double fMinX = mrShapeModel.maPoints[0].X;
- double fMaxX = mrShapeModel.maPoints[0].X;
- double fMinY = mrShapeModel.maPoints[0].Y;
- double fMaxY = mrShapeModel.maPoints[0].Y;
- for (const auto& rPoint : mrShapeModel.maPoints)
- {
- if (rPoint.X < fMinX)
- fMinX = rPoint.X;
- else if (rPoint.X > fMaxX)
- fMaxX = rPoint.X;
- if (rPoint.Y < fMinY)
- fMinY = rPoint.Y;
- else if (rPoint.Y > fMaxY)
- fMaxY = rPoint.Y;
- }
- mrShape.getTypeModel().maWidth
- = OUString::number(
- o3tl::convert(fMaxX - fMinX, o3tl::Length::twip, o3tl::Length::pt))
- + "pt";
- mrShape.getTypeModel().maHeight
- = OUString::number(
- o3tl::convert(fMaxY - fMinY, o3tl::Length::twip, o3tl::Length::pt))
- + "pt";
- // Set moCoordSize, otherwise default (1000,1000) is used.
- mrShape.getTypeModel().moCoordSize.set(
- Int32Pair(basegfx::fround(fMaxX - fMinX), basegfx::fround(fMaxY - fMinY)));
+ if (rPoint.X < fMinX)
+ fMinX = rPoint.X;
+ else if (rPoint.X > fMaxX)
+ fMaxX = rPoint.X;
+ if (rPoint.Y < fMinY)
+ fMinY = rPoint.Y;
+ else if (rPoint.Y > fMaxY)
+ fMaxY = rPoint.Y;
}
+ mrShape.getTypeModel().maWidth
+ = OUString::number(
+ o3tl::convert(fMaxX - fMinX, o3tl::Length::twip, o3tl::Length::pt))
+ + "pt";
+ mrShape.getTypeModel().maHeight
+ = OUString::number(
+ o3tl::convert(fMaxY - fMinY, o3tl::Length::twip, o3tl::Length::pt))
+ + "pt";
+ // Set moCoordSize, otherwise default (1000,1000) is used.
+ mrShape.getTypeModel().moCoordSize.set(
+ Int32Pair(basegfx::fround(fMaxX - fMinX), basegfx::fround(fMaxY - fMinY)));
}
}