summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 09:00:29 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 10:27:49 +0200
commit5633b217a6b5f6e1bb673d468fa8cb7ac66ceb54 (patch)
tree37ab8cb1fb3a9d1afebbb64cf92911b65274fe10 /xmloff
parent04336ca32ea08f0c0c78125ea3b07689ee51acf2 (diff)
loplugin:flatten in xmloff/style
Change-Id: I8a9f939e799f8aeb119a56e33d5291177135b3ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100196 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/style/DashStyle.cxx138
-rw-r--r--xmloff/source/style/FillStyleContext.cxx34
-rw-r--r--xmloff/source/style/GradientStyle.cxx140
-rw-r--r--xmloff/source/style/HatchStyle.cxx88
-rw-r--r--xmloff/source/style/ImageStyle.cxx56
-rw-r--r--xmloff/source/style/MarkerStyle.cxx72
-rw-r--r--xmloff/source/style/PageMasterExportPropMapper.cxx34
-rw-r--r--xmloff/source/style/TransGradientStyle.cxx132
-rw-r--r--xmloff/source/style/XMLPageExport.cxx90
-rw-r--r--xmloff/source/style/prstylei.cxx98
-rw-r--r--xmloff/source/style/styleexp.cxx72
-rw-r--r--xmloff/source/style/xmlaustp.cxx36
-rw-r--r--xmloff/source/style/xmlnume.cxx154
-rw-r--r--xmloff/source/style/xmlnumfe.cxx146
-rw-r--r--xmloff/source/style/xmlnumfi.cxx220
-rw-r--r--xmloff/source/style/xmlprmap.cxx36
16 files changed, 773 insertions, 773 deletions
diff --git a/xmloff/source/style/DashStyle.cxx b/xmloff/source/style/DashStyle.cxx
index e963ece6a513..d88e18fa0550 100644
--- a/xmloff/source/style/DashStyle.cxx
+++ b/xmloff/source/style/DashStyle.cxx
@@ -223,92 +223,92 @@ void XMLDashStyleExport::exportXML(
drawing::LineDash aLineDash;
- if( !rStrName.isEmpty() )
+ if( rStrName.isEmpty() )
+ return;
+
+ if( !(rValue >>= aLineDash) )
+ return;
+
+ bool bIsRel = aLineDash.Style == drawing::DashStyle_RECTRELATIVE || aLineDash.Style == drawing::DashStyle_ROUNDRELATIVE;
+
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ // Name
+ bool bEncoded = false;
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
+ rExport.EncodeStyleName( rStrName,
+ &bEncoded ) );
+ if( bEncoded )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
+ rStrName );
+
+ // Style
+ SvXMLUnitConverter::convertEnum( aOut, aLineDash.Style, pXML_DashStyle_Enum );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE, aStrValue );
+
+ // dots
+ if( aLineDash.Dots )
{
- if( rValue >>= aLineDash )
- {
- bool bIsRel = aLineDash.Style == drawing::DashStyle_RECTRELATIVE || aLineDash.Style == drawing::DashStyle_ROUNDRELATIVE;
-
- OUString aStrValue;
- OUStringBuffer aOut;
-
- // Name
- bool bEncoded = false;
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
- rExport.EncodeStyleName( rStrName,
- &bEncoded ) );
- if( bEncoded )
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
- rStrName );
-
- // Style
- SvXMLUnitConverter::convertEnum( aOut, aLineDash.Style, pXML_DashStyle_Enum );
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE, aStrValue );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS1, OUString::number( aLineDash.Dots ) );
- // dots
- if( aLineDash.Dots )
+ if( aLineDash.DotLen )
+ {
+ // dashes length
+ if( bIsRel )
{
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS1, OUString::number( aLineDash.Dots ) );
-
- if( aLineDash.DotLen )
- {
- // dashes length
- if( bIsRel )
- {
- ::sax::Converter::convertPercent(aOut, aLineDash.DotLen);
- }
- else
- {
- rUnitConverter.convertMeasureToXML( aOut,
- aLineDash.DotLen );
- }
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS1_LENGTH, aStrValue );
- }
+ ::sax::Converter::convertPercent(aOut, aLineDash.DotLen);
}
-
- // dashes
- if( aLineDash.Dashes )
+ else
{
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS2, OUString::number( aLineDash.Dashes ) );
-
- if( aLineDash.DashLen )
- {
- // dashes length
- if( bIsRel )
- {
- ::sax::Converter::convertPercent(aOut, aLineDash.DashLen);
- }
- else
- {
- rUnitConverter.convertMeasureToXML( aOut,
- aLineDash.DashLen );
- }
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS2_LENGTH, aStrValue );
- }
+ rUnitConverter.convertMeasureToXML( aOut,
+ aLineDash.DotLen );
}
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS1_LENGTH, aStrValue );
+ }
+ }
+
+ // dashes
+ if( aLineDash.Dashes )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS2, OUString::number( aLineDash.Dashes ) );
- // distance
+ if( aLineDash.DashLen )
+ {
+ // dashes length
if( bIsRel )
{
- ::sax::Converter::convertPercent( aOut, aLineDash.Distance );
+ ::sax::Converter::convertPercent(aOut, aLineDash.DashLen);
}
else
{
rUnitConverter.convertMeasureToXML( aOut,
- aLineDash.Distance );
+ aLineDash.DashLen );
}
aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISTANCE, aStrValue );
-
- // do Write
- SvXMLElementExport rElem( rExport,
- XML_NAMESPACE_DRAW, XML_STROKE_DASH,
- true, false );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS2_LENGTH, aStrValue );
}
}
+
+ // distance
+ if( bIsRel )
+ {
+ ::sax::Converter::convertPercent( aOut, aLineDash.Distance );
+ }
+ else
+ {
+ rUnitConverter.convertMeasureToXML( aOut,
+ aLineDash.Distance );
+ }
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISTANCE, aStrValue );
+
+ // do Write
+ SvXMLElementExport rElem( rExport,
+ XML_NAMESPACE_DRAW, XML_STROKE_DASH,
+ true, false );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/FillStyleContext.cxx b/xmloff/source/style/FillStyleContext.cxx
index 1bec46869b39..e4f93a6b2a20 100644
--- a/xmloff/source/style/FillStyleContext.cxx
+++ b/xmloff/source/style/FillStyleContext.cxx
@@ -164,30 +164,30 @@ void XMLBitmapStyleContext::EndElement()
}
}
- if (maAny.has<uno::Reference<graphic::XGraphic>>())
- {
- uno::Reference<container::XNameContainer> xBitmapContainer(GetImport().GetBitmapHelper());
+ if (!maAny.has<uno::Reference<graphic::XGraphic>>())
+ return;
+
+ uno::Reference<container::XNameContainer> xBitmapContainer(GetImport().GetBitmapHelper());
- uno::Reference<graphic::XGraphic> xGraphic = maAny.get<uno::Reference<graphic::XGraphic>>();
- uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+ uno::Reference<graphic::XGraphic> xGraphic = maAny.get<uno::Reference<graphic::XGraphic>>();
+ uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
- try
+ try
+ {
+ if (xBitmapContainer.is())
{
- if (xBitmapContainer.is())
+ if (xBitmapContainer->hasByName(maStrName))
{
- if (xBitmapContainer->hasByName(maStrName))
- {
- xBitmapContainer->replaceByName(maStrName, uno::Any(xBitmap));
- }
- else
- {
- xBitmapContainer->insertByName(maStrName, uno::Any(xBitmap));
- }
+ xBitmapContainer->replaceByName(maStrName, uno::Any(xBitmap));
+ }
+ else
+ {
+ xBitmapContainer->insertByName(maStrName, uno::Any(xBitmap));
}
}
- catch (container::ElementExistException&)
- {}
}
+ catch (container::ElementExistException&)
+ {}
}
bool XMLBitmapStyleContext::IsTransient() const
diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx
index 3a8a5bedc444..1bf437178378 100644
--- a/xmloff/source/style/GradientStyle.cxx
+++ b/xmloff/source/style/GradientStyle.cxx
@@ -210,79 +210,79 @@ void XMLGradientStyleExport::exportXML(
{
awt::Gradient aGradient;
- if( !rStrName.isEmpty() )
+ if( rStrName.isEmpty() )
+ return;
+
+ if( !(rValue >>= aGradient) )
+ return;
+
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ // Style
+ if( !SvXMLUnitConverter::convertEnum( aOut, aGradient.Style, pXML_GradientStyle_Enum ) )
+ return;
+
+ // Name
+ bool bEncoded = false;
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
+ rExport.EncodeStyleName( rStrName,
+ &bEncoded ) );
+ if( bEncoded )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
+ rStrName );
+
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE, aStrValue );
+
+ // Center x/y
+ if( aGradient.Style != awt::GradientStyle_LINEAR &&
+ aGradient.Style != awt::GradientStyle_AXIAL )
{
- if( rValue >>= aGradient )
- {
- OUString aStrValue;
- OUStringBuffer aOut;
+ ::sax::Converter::convertPercent(aOut, aGradient.XOffset);
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CX, aStrValue );
+ ::sax::Converter::convertPercent(aOut, aGradient.YOffset);
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CY, aStrValue );
+ }
- // Style
- if( SvXMLUnitConverter::convertEnum( aOut, aGradient.Style, pXML_GradientStyle_Enum ) )
- {
- // Name
- bool bEncoded = false;
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
- rExport.EncodeStyleName( rStrName,
- &bEncoded ) );
- if( bEncoded )
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
- rStrName );
-
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE, aStrValue );
-
- // Center x/y
- if( aGradient.Style != awt::GradientStyle_LINEAR &&
- aGradient.Style != awt::GradientStyle_AXIAL )
- {
- ::sax::Converter::convertPercent(aOut, aGradient.XOffset);
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CX, aStrValue );
- ::sax::Converter::convertPercent(aOut, aGradient.YOffset);
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CY, aStrValue );
- }
-
- // Color start
- ::sax::Converter::convertColor(aOut, aGradient.StartColor);
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START_COLOR, aStrValue );
-
- // Color end
- ::sax::Converter::convertColor(aOut, aGradient.EndColor);
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_END_COLOR, aStrValue );
-
- // Intensity start
- ::sax::Converter::convertPercent(aOut, aGradient.StartIntensity);
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START_INTENSITY, aStrValue );
-
- // Intensity end
- ::sax::Converter::convertPercent(aOut, aGradient.EndIntensity);
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_END_INTENSITY, aStrValue );
-
- // Angle
- if( aGradient.Style != awt::GradientStyle_RADIAL )
- {
- ::sax::Converter::convertAngle(aOut, aGradient.Angle, rExport.getSaneDefaultVersion());
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, aStrValue );
- }
-
- // Border
- ::sax::Converter::convertPercent( aOut, aGradient.Border );
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_BORDER, aStrValue );
-
- // Do Write
- SvXMLElementExport aElem( rExport, XML_NAMESPACE_DRAW, XML_GRADIENT,
- true, false );
- }
- }
+ // Color start
+ ::sax::Converter::convertColor(aOut, aGradient.StartColor);
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START_COLOR, aStrValue );
+
+ // Color end
+ ::sax::Converter::convertColor(aOut, aGradient.EndColor);
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_END_COLOR, aStrValue );
+
+ // Intensity start
+ ::sax::Converter::convertPercent(aOut, aGradient.StartIntensity);
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START_INTENSITY, aStrValue );
+
+ // Intensity end
+ ::sax::Converter::convertPercent(aOut, aGradient.EndIntensity);
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_END_INTENSITY, aStrValue );
+
+ // Angle
+ if( aGradient.Style != awt::GradientStyle_RADIAL )
+ {
+ ::sax::Converter::convertAngle(aOut, aGradient.Angle, rExport.getSaneDefaultVersion());
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, aStrValue );
}
+
+ // Border
+ ::sax::Converter::convertPercent( aOut, aGradient.Border );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_BORDER, aStrValue );
+
+ // Do Write
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_DRAW, XML_GRADIENT,
+ true, false );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/HatchStyle.cxx b/xmloff/source/style/HatchStyle.cxx
index 1e0bd56d59e0..274105c1a666 100644
--- a/xmloff/source/style/HatchStyle.cxx
+++ b/xmloff/source/style/HatchStyle.cxx
@@ -165,50 +165,50 @@ void XMLHatchStyleExport::exportXML(
{
drawing::Hatch aHatch;
- if( !rStrName.isEmpty() )
- {
- if( rValue >>= aHatch )
- {
- OUString aStrValue;
- OUStringBuffer aOut;
-
- SvXMLUnitConverter& rUnitConverter =
- rExport.GetMM100UnitConverter();
-
- // Style
- if( SvXMLUnitConverter::convertEnum( aOut, aHatch.Style, pXML_HatchStyle_Enum ) )
- {
- // Name
- bool bEncoded = false;
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
- rExport.EncodeStyleName( rStrName,
- &bEncoded ) );
- if( bEncoded )
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
- rStrName );
-
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE, aStrValue );
-
- // Color
- ::sax::Converter::convertColor(aOut, aHatch.Color);
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_COLOR, aStrValue );
-
- // Distance
- rUnitConverter.convertMeasureToXML( aOut, aHatch.Distance );
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISTANCE, aStrValue );
-
- // Angle
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ROTATION, OUString::number(aHatch.Angle) );
-
- // Do Write
- SvXMLElementExport rElem( rExport, XML_NAMESPACE_DRAW, XML_HATCH,
- true, false );
- }
- }
- }
+ if( rStrName.isEmpty() )
+ return;
+
+ if( !(rValue >>= aHatch) )
+ return;
+
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ SvXMLUnitConverter& rUnitConverter =
+ rExport.GetMM100UnitConverter();
+
+ // Style
+ if( !SvXMLUnitConverter::convertEnum( aOut, aHatch.Style, pXML_HatchStyle_Enum ) )
+ return;
+
+ // Name
+ bool bEncoded = false;
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
+ rExport.EncodeStyleName( rStrName,
+ &bEncoded ) );
+ if( bEncoded )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
+ rStrName );
+
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE, aStrValue );
+
+ // Color
+ ::sax::Converter::convertColor(aOut, aHatch.Color);
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_COLOR, aStrValue );
+
+ // Distance
+ rUnitConverter.convertMeasureToXML( aOut, aHatch.Distance );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISTANCE, aStrValue );
+
+ // Angle
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ROTATION, OUString::number(aHatch.Angle) );
+
+ // Do Write
+ SvXMLElementExport rElem( rExport, XML_NAMESPACE_DRAW, XML_HATCH,
+ true, false );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/ImageStyle.cxx b/xmloff/source/style/ImageStyle.cxx
index c2b76463e6d6..640d0cc043db 100644
--- a/xmloff/source/style/ImageStyle.cxx
+++ b/xmloff/source/style/ImageStyle.cxx
@@ -51,40 +51,40 @@ void XMLImageStyle::exportXML(OUString const & rStrName, uno::Any const & rValue
if (rStrName.isEmpty())
return;
- if (rValue.has<uno::Reference<awt::XBitmap>>())
+ if (!rValue.has<uno::Reference<awt::XBitmap>>())
+ return;
+
+ // Name
+ bool bEncoded = false;
+ rExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NAME,
+ rExport.EncodeStyleName(rStrName, &bEncoded));
+ if (bEncoded)
{
- // Name
- bool bEncoded = false;
- rExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NAME,
- rExport.EncodeStyleName(rStrName, &bEncoded));
- if (bEncoded)
- {
- rExport.AddAttribute(XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, rStrName);
- }
+ rExport.AddAttribute(XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, rStrName);
+ }
- auto xBitmap = rValue.get<uno::Reference<awt::XBitmap>>();
- uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
+ auto xBitmap = rValue.get<uno::Reference<awt::XBitmap>>();
+ uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
- OUString aMimeType;
- const OUString aStr = rExport.AddEmbeddedXGraphic(xGraphic, aMimeType);
+ OUString aMimeType;
+ const OUString aStr = rExport.AddEmbeddedXGraphic(xGraphic, aMimeType);
- // uri
- if (!aStr.isEmpty())
- {
- rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStr );
- rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
- rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
- rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
- }
+ // uri
+ if (!aStr.isEmpty())
+ {
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStr );
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
- // Do Write
- SvXMLElementExport aElem(rExport, XML_NAMESPACE_DRAW, XML_FILL_IMAGE, true, true);
+ // Do Write
+ SvXMLElementExport aElem(rExport, XML_NAMESPACE_DRAW, XML_FILL_IMAGE, true, true);
- if (xBitmap.is() && xGraphic.is())
- {
- // optional office:binary-data
- rExport.AddEmbeddedXGraphicAsBase64(xGraphic);
- }
+ if (xBitmap.is() && xGraphic.is())
+ {
+ // optional office:binary-data
+ rExport.AddEmbeddedXGraphicAsBase64(xGraphic);
}
}
diff --git a/xmloff/source/style/MarkerStyle.cxx b/xmloff/source/style/MarkerStyle.cxx
index d9c323a224f2..4046db8edbb9 100644
--- a/xmloff/source/style/MarkerStyle.cxx
+++ b/xmloff/source/style/MarkerStyle.cxx
@@ -154,52 +154,52 @@ void XMLMarkerStyleExport::exportXML(
const OUString& rStrName,
const uno::Any& rValue )
{
- if(!rStrName.isEmpty())
- {
- drawing::PolyPolygonBezierCoords aBezier;
+ if(rStrName.isEmpty())
+ return;
- if(rValue >>= aBezier)
- {
- // Name
- bool bEncoded(false);
+ drawing::PolyPolygonBezierCoords aBezier;
- rExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, rExport.EncodeStyleName( rStrName, &bEncoded ) );
+ if(!(rValue >>= aBezier))
+ return;
- if( bEncoded )
- {
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, rStrName );
- }
+ // Name
+ bool bEncoded(false);
- const basegfx::B2DPolyPolygon aPolyPolygon(
- basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
- aBezier));
- const basegfx::B2DRange aPolyPolygonRange(aPolyPolygon.getB2DRange());
+ rExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, rExport.EncodeStyleName( rStrName, &bEncoded ) );
+ if( bEncoded )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, rStrName );
+ }
- // Viewbox (viewBox="0 0 1500 1000")
+ const basegfx::B2DPolyPolygon aPolyPolygon(
+ basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
+ aBezier));
+ const basegfx::B2DRange aPolyPolygonRange(aPolyPolygon.getB2DRange());
- SdXMLImExViewBox aViewBox(
- aPolyPolygonRange.getMinX(),
- aPolyPolygonRange.getMinY(),
- aPolyPolygonRange.getWidth(),
- aPolyPolygonRange.getHeight());
- rExport.AddAttribute( XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString() );
- // Pathdata
- const OUString aPolygonString(
- basegfx::utils::exportToSvgD(
- aPolyPolygon,
- true, // bUseRelativeCoordinates
- false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
- true)); // bHandleRelativeNextPointCompatible
+ // Viewbox (viewBox="0 0 1500 1000")
- // write point array
- rExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
+ SdXMLImExViewBox aViewBox(
+ aPolyPolygonRange.getMinX(),
+ aPolyPolygonRange.getMinY(),
+ aPolyPolygonRange.getWidth(),
+ aPolyPolygonRange.getHeight());
+ rExport.AddAttribute( XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString() );
- // Do Write
- SvXMLElementExport rElem( rExport, XML_NAMESPACE_DRAW, XML_MARKER, true, false );
- }
- }
+ // Pathdata
+ const OUString aPolygonString(
+ basegfx::utils::exportToSvgD(
+ aPolyPolygon,
+ true, // bUseRelativeCoordinates
+ false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
+ true)); // bHandleRelativeNextPointCompatible
+
+ // write point array
+ rExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
+
+ // Do Write
+ SvXMLElementExport rElem( rExport, XML_NAMESPACE_DRAW, XML_MARKER, true, false );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx
index 5eb32ead6812..965cdf650c86 100644
--- a/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -177,30 +177,30 @@ void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& )
lcl_RemoveState( pPMBorderWidthAll );
}
- if( pPMPaddingAll )
+ if( !pPMPaddingAll )
+ return;
+
+ if( pPMPaddingTop && pPMPaddingBottom && pPMPaddingLeft && pPMPaddingRight )
{
- if( pPMPaddingTop && pPMPaddingBottom && pPMPaddingLeft && pPMPaddingRight )
- {
- sal_Int32 nTop = 0, nBottom = 0, nLeft = 0, nRight = 0;
+ sal_Int32 nTop = 0, nBottom = 0, nLeft = 0, nRight = 0;
- pPMPaddingTop->maValue >>= nTop;
- pPMPaddingBottom->maValue >>= nBottom;
- pPMPaddingLeft->maValue >>= nLeft;
- pPMPaddingRight->maValue >>= nRight;
+ pPMPaddingTop->maValue >>= nTop;
+ pPMPaddingBottom->maValue >>= nBottom;
+ pPMPaddingLeft->maValue >>= nLeft;
+ pPMPaddingRight->maValue >>= nRight;
- if( (nTop == nBottom) && (nBottom == nLeft) && (nLeft == nRight) )
- {
- lcl_RemoveState( pPMPaddingTop );
- lcl_RemoveState( pPMPaddingBottom );
- lcl_RemoveState( pPMPaddingLeft );
- lcl_RemoveState( pPMPaddingRight );
- }
- else
- lcl_RemoveState( pPMPaddingAll );
+ if( (nTop == nBottom) && (nBottom == nLeft) && (nLeft == nRight) )
+ {
+ lcl_RemoveState( pPMPaddingTop );
+ lcl_RemoveState( pPMPaddingBottom );
+ lcl_RemoveState( pPMPaddingLeft );
+ lcl_RemoveState( pPMPaddingRight );
}
else
lcl_RemoveState( pPMPaddingAll );
}
+ else
+ lcl_RemoveState( pPMPaddingAll );
}
XMLPageMasterExportPropMapper::XMLPageMasterExportPropMapper(
diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx
index 536ba39d26b3..a997a76c9bff 100644
--- a/xmloff/source/style/TransGradientStyle.cxx
+++ b/xmloff/source/style/TransGradientStyle.cxx
@@ -220,75 +220,75 @@ void XMLTransGradientStyleExport::exportXML(
{
awt::Gradient aGradient;
- if( !rStrName.isEmpty() )
+ if( rStrName.isEmpty() )
+ return;
+
+ if( !(rValue >>= aGradient) )
+ return;
+
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ // Style
+ if( !SvXMLUnitConverter::convertEnum( aOut, aGradient.Style, pXML_GradientStyle_Enum ) )
+ return;
+
+ // Name
+ bool bEncoded = false;
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
+ rExport.EncodeStyleName( rStrName,
+ &bEncoded ) );
+ if( bEncoded )
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
+ rStrName );
+
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE, aStrValue );
+
+ // Center x/y
+ if( aGradient.Style != awt::GradientStyle_LINEAR &&
+ aGradient.Style != awt::GradientStyle_AXIAL )
{
- if( rValue >>= aGradient )
- {
- OUString aStrValue;
- OUStringBuffer aOut;
+ ::sax::Converter::convertPercent(aOut, aGradient.XOffset);
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CX, aStrValue );
- // Style
- if( SvXMLUnitConverter::convertEnum( aOut, aGradient.Style, pXML_GradientStyle_Enum ) )
- {
- // Name
- bool bEncoded = false;
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
- rExport.EncodeStyleName( rStrName,
- &bEncoded ) );
- if( bEncoded )
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISPLAY_NAME,
- rStrName );
-
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE, aStrValue );
-
- // Center x/y
- if( aGradient.Style != awt::GradientStyle_LINEAR &&
- aGradient.Style != awt::GradientStyle_AXIAL )
- {
- ::sax::Converter::convertPercent(aOut, aGradient.XOffset);
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CX, aStrValue );
-
- ::sax::Converter::convertPercent(aOut, aGradient.YOffset);
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CY, aStrValue );
- }
-
- // Transparency start
- Color aColor(aGradient.StartColor);
- sal_Int32 aStartValue = 100 - static_cast<sal_Int32>(((aColor.GetRed() + 1) * 100) / 255);
- ::sax::Converter::convertPercent( aOut, aStartValue );
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START, aStrValue );
-
- // Transparency end
- aColor = Color(aGradient.EndColor);
- sal_Int32 aEndValue = 100 - static_cast<sal_Int32>(((aColor.GetRed() + 1) * 100) / 255);
- ::sax::Converter::convertPercent( aOut, aEndValue );
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_END, aStrValue );
-
- // Angle
- if( aGradient.Style != awt::GradientStyle_RADIAL )
- {
- ::sax::Converter::convertAngle(aOut, aGradient.Angle, rExport.getSaneDefaultVersion());
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, aStrValue );
- }
-
- // Border
- ::sax::Converter::convertPercent( aOut, aGradient.Border );
- aStrValue = aOut.makeStringAndClear();
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_BORDER, aStrValue );
-
- // Do Write
- SvXMLElementExport rElem( rExport,
- XML_NAMESPACE_DRAW, XML_OPACITY,
- true, false );
- }
- }
+ ::sax::Converter::convertPercent(aOut, aGradient.YOffset);
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CY, aStrValue );
}
+
+ // Transparency start
+ Color aColor(aGradient.StartColor);
+ sal_Int32 aStartValue = 100 - static_cast<sal_Int32>(((aColor.GetRed() + 1) * 100) / 255);
+ ::sax::Converter::convertPercent( aOut, aStartValue );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START, aStrValue );
+
+ // Transparency end
+ aColor = Color(aGradient.EndColor);
+ sal_Int32 aEndValue = 100 - static_cast<sal_Int32>(((aColor.GetRed() + 1) * 100) / 255);
+ ::sax::Converter::convertPercent( aOut, aEndValue );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_END, aStrValue );
+
+ // Angle
+ if( aGradient.Style != awt::GradientStyle_RADIAL )
+ {
+ ::sax::Converter::convertAngle(aOut, aGradient.Angle, rExport.getSaneDefaultVersion());
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, aStrValue );
+ }
+
+ // Border
+ ::sax::Converter::convertPercent( aOut, aGradient.Border );
+ aStrValue = aOut.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_BORDER, aStrValue );
+
+ // Do Write
+ SvXMLElementExport rElem( rExport,
+ XML_NAMESPACE_DRAW, XML_OPACITY,
+ true, false );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx
index 6b3ddecb8b08..550e9f956351 100644
--- a/xmloff/source/style/XMLPageExport.cxx
+++ b/xmloff/source/style/XMLPageExport.cxx
@@ -207,22 +207,22 @@ XMLPageExport::XMLPageExport(SvXMLExport & rExp)
UNO_QUERY );
SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff",
"No XStyleFamiliesSupplier from XModel for export!" );
- if( xFamiliesSupp.is() )
+ if( !xFamiliesSupp.is() )
+ return;
+
+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
+ SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff",
+ "getStyleFamilies() from XModel failed for export!" );
+ if( xFamilies.is() )
{
- Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
- SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff",
- "getStyleFamilies() from XModel failed for export!" );
- if( xFamilies.is() )
- {
- const OUString aPageStyleName("PageStyles");
+ const OUString aPageStyleName("PageStyles");
- if( xFamilies->hasByName( aPageStyleName ) )
- {
- xPageStyles.set(xFamilies->getByName( aPageStyleName ),uno::UNO_QUERY);
+ if( xFamilies->hasByName( aPageStyleName ) )
+ {
+ xPageStyles.set(xFamilies->getByName( aPageStyleName ),uno::UNO_QUERY);
- SAL_WARN_IF( !xPageStyles.is(), "xmloff",
- "Page Styles not found for export!" );
- }
+ SAL_WARN_IF( !xPageStyles.is(), "xmloff",
+ "Page Styles not found for export!" );
}
}
}
@@ -256,44 +256,44 @@ void XMLPageExport::exportAutoStyles()
void XMLPageExport::exportDefaultStyle()
{
Reference < lang::XMultiServiceFactory > xFactory (GetExport().GetModel(), UNO_QUERY);
- if (xFactory.is())
- {
- Reference < XPropertySet > xPropSet (xFactory->createInstance ( "com.sun.star.text.Defaults" ), UNO_QUERY);
- if (xPropSet.is())
- {
- // <style:default-style ...>
- GetExport().CheckAttrList();
+ if (!xFactory.is())
+ return;
- ::std::vector< XMLPropertyState > aPropStates =
- xPageMasterExportPropMapper->FilterDefaults( xPropSet );
+ Reference < XPropertySet > xPropSet (xFactory->createInstance ( "com.sun.star.text.Defaults" ), UNO_QUERY);
+ if (!xPropSet.is())
+ return;
- bool bExport = false;
- rtl::Reference < XMLPropertySetMapper > aPropMapper(xPageMasterExportPropMapper->getPropertySetMapper());
- for( const auto& rProp : aPropStates )
- {
- sal_Int16 nContextId = aPropMapper->GetEntryContextId( rProp.mnIndex );
- if( nContextId == CTF_PM_STANDARD_MODE )
- {
- bExport = true;
- break;
- }
- }
+ // <style:default-style ...>
+ GetExport().CheckAttrList();
- if( bExport )
- {
- assert(GetExport().getSaneDefaultVersion()
- >= SvtSaveOptions::ODFSVER_012);
-
- //<style:default-page-layout>
- SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
- XML_DEFAULT_PAGE_LAYOUT,
- true, true );
+ ::std::vector< XMLPropertyState > aPropStates =
+ xPageMasterExportPropMapper->FilterDefaults( xPropSet );
- xPageMasterExportPropMapper->exportXML( GetExport(), aPropStates,
- SvXmlExportFlags::IGN_WS );
- }
+ bool bExport = false;
+ rtl::Reference < XMLPropertySetMapper > aPropMapper(xPageMasterExportPropMapper->getPropertySetMapper());
+ for( const auto& rProp : aPropStates )
+ {
+ sal_Int16 nContextId = aPropMapper->GetEntryContextId( rProp.mnIndex );
+ if( nContextId == CTF_PM_STANDARD_MODE )
+ {
+ bExport = true;
+ break;
}
}
+
+ if( !bExport )
+ return;
+
+ assert(GetExport().getSaneDefaultVersion()
+ >= SvtSaveOptions::ODFSVER_012);
+
+ //<style:default-page-layout>
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
+ XML_DEFAULT_PAGE_LAYOUT,
+ true, true );
+
+ xPageMasterExportPropMapper->exportXML( GetExport(), aPropStates,
+ SvXmlExportFlags::IGN_WS );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index 708ae6675e57..931be4fce799 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -577,24 +577,24 @@ bool XMLPropStyleContext::doNewDrawingLayerFillStyleDefinitionsExist(
void XMLPropStyleContext::deactivateOldFillStyleDefinitions(
const OldFillStyleDefinitionSet& rHashSetOfTags)
{
- if(!rHashSetOfTags.empty() && !maProperties.empty())
- {
- const rtl::Reference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
+ if(rHashSetOfTags.empty() || maProperties.empty())
+ return;
- if(rMapper.is())
+ const rtl::Reference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
+
+ if(!rMapper.is())
+ return;
+
+ for(auto& a : maProperties)
+ {
+ if(a.mnIndex != -1)
{
- for(auto& a : maProperties)
- {
- if(a.mnIndex != -1)
- {
- const OUString& rPropName = rMapper->GetEntryAPIName(a.mnIndex);
+ const OUString& rPropName = rMapper->GetEntryAPIName(a.mnIndex);
- if(rHashSetOfTags.find(rPropName) != rHashSetOfTags.end())
- {
- // mark entry as inactive
- a.mnIndex = -1;
- }
- }
+ if(rHashSetOfTags.find(rPropName) != rHashSetOfTags.end())
+ {
+ // mark entry as inactive
+ a.mnIndex = -1;
}
}
}
@@ -602,46 +602,46 @@ void XMLPropStyleContext::deactivateOldFillStyleDefinitions(
void XMLPropStyleContext::translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames()
{
- if(!maProperties.empty())
- {
- const rtl::Reference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
+ if(maProperties.empty())
+ return;
- if(rMapper.is())
+ const rtl::Reference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
+
+ if(!rMapper.is())
+ return;
+
+ static OUString s_FillGradientName("FillGradientName");
+ static OUString s_FillHatchName("FillHatchName");
+ static OUString s_FillBitmapName("FillBitmapName");
+ static OUString s_FillTransparenceGradientName("FillTransparenceGradientName");
+
+ for(auto& a : maProperties)
+ {
+ if(a.mnIndex != -1)
{
- static OUString s_FillGradientName("FillGradientName");
- static OUString s_FillHatchName("FillHatchName");
- static OUString s_FillBitmapName("FillBitmapName");
- static OUString s_FillTransparenceGradientName("FillTransparenceGradientName");
+ const OUString& rPropName = rMapper->GetEntryAPIName(a.mnIndex);
+ XmlStyleFamily aStyleFamily(XmlStyleFamily::DATA_STYLE);
- for(auto& a : maProperties)
+ if(rPropName == s_FillGradientName || rPropName == s_FillTransparenceGradientName)
{
- if(a.mnIndex != -1)
- {
- const OUString& rPropName = rMapper->GetEntryAPIName(a.mnIndex);
- XmlStyleFamily aStyleFamily(XmlStyleFamily::DATA_STYLE);
-
- if(rPropName == s_FillGradientName || rPropName == s_FillTransparenceGradientName)
- {
- aStyleFamily = XmlStyleFamily::SD_GRADIENT_ID;
- }
- else if(rPropName == s_FillHatchName)
- {
- aStyleFamily = XmlStyleFamily::SD_HATCH_ID;
- }
- else if(rPropName == s_FillBitmapName)
- {
- aStyleFamily = XmlStyleFamily::SD_FILL_IMAGE_ID;
- }
+ aStyleFamily = XmlStyleFamily::SD_GRADIENT_ID;
+ }
+ else if(rPropName == s_FillHatchName)
+ {
+ aStyleFamily = XmlStyleFamily::SD_HATCH_ID;
+ }
+ else if(rPropName == s_FillBitmapName)
+ {
+ aStyleFamily = XmlStyleFamily::SD_FILL_IMAGE_ID;
+ }
- if(aStyleFamily != XmlStyleFamily::DATA_STYLE)
- {
- OUString sStyleName;
+ if(aStyleFamily != XmlStyleFamily::DATA_STYLE)
+ {
+ OUString sStyleName;
- a.maValue >>= sStyleName;
- sStyleName = GetImport().GetStyleDisplayName( aStyleFamily, sStyleName );
- a.maValue <<= sStyleName;
- }
- }
+ a.maValue >>= sStyleName;
+ sStyleName = GetImport().GetStyleDisplayName( aStyleFamily, sStyleName );
+ a.maValue <<= sStyleName;
}
}
}
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
index 05d89b199eff..2845698cea09 100644
--- a/xmloff/source/style/styleexp.cxx
+++ b/xmloff/source/style/styleexp.cxx
@@ -492,50 +492,50 @@ void XMLStyleExport::exportStyleFamily(
pAutoStylePool->RegisterName( nFamily, xStyle->getName() );
}
- if( pExportedStyles )
- {
- // if next styles are supported, export all next styles that are
- // unused and that for, haven't been exported in the first loop.
- for(const auto& rName : aSeq)
- {
- Reference< XStyle > xStyle;
- xStyleCont->getByName( rName ) >>= xStyle;
+ if( !pExportedStyles )
+ return;
- assert(xStyle.is());
+ // if next styles are supported, export all next styles that are
+ // unused and that for, haven't been exported in the first loop.
+ for(const auto& rName : aSeq)
+ {
+ Reference< XStyle > xStyle;
+ xStyleCont->getByName( rName ) >>= xStyle;
- Reference< XPropertySet > xPropSet( xStyle, UNO_QUERY );
- Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+ assert(xStyle.is());
- // styles that aren't existing really are ignored.
- if (xPropSetInfo->hasPropertyByName( gsIsPhysical ))
- {
- Any aAny( xPropSet->getPropertyValue( gsIsPhysical ) );
- if (!*o3tl::doAccess<bool>(aAny))
- continue;
- }
+ Reference< XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
- if (!xStyle->isInUse())
+ // styles that aren't existing really are ignored.
+ if (xPropSetInfo->hasPropertyByName( gsIsPhysical ))
+ {
+ Any aAny( xPropSet->getPropertyValue( gsIsPhysical ) );
+ if (!*o3tl::doAccess<bool>(aAny))
continue;
+ }
- if (!xPropSetInfo->hasPropertyByName( gsFollowStyle ))
- {
- continue;
- }
+ if (!xStyle->isInUse())
+ continue;
- OUString sNextName;
- xPropSet->getPropertyValue( gsFollowStyle ) >>= sNextName;
- OUString sTmp( sNextName );
- // if the next style hasn't been exported by now, export it now
- // and remember its name.
- if (xStyle->getName() != sNextName &&
- 0 == pExportedStyles->count( sTmp ))
- {
- xStyleCont->getByName( sNextName ) >>= xStyle;
- assert(xStyle.is());
+ if (!xPropSetInfo->hasPropertyByName( gsFollowStyle ))
+ {
+ continue;
+ }
- if (exportStyle(xStyle, rXMLFamily, rPropMapper, xStyleCont, pPrefix))
- pExportedStyles->insert( sTmp );
- }
+ OUString sNextName;
+ xPropSet->getPropertyValue( gsFollowStyle ) >>= sNextName;
+ OUString sTmp( sNextName );
+ // if the next style hasn't been exported by now, export it now
+ // and remember its name.
+ if (xStyle->getName() != sNextName &&
+ 0 == pExportedStyles->count( sTmp ))
+ {
+ xStyleCont->getByName( sNextName ) >>= xStyle;
+ assert(xStyle.is());
+
+ if (exportStyle(xStyle, rXMLFamily, rPropMapper, xStyleCont, pPrefix))
+ pExportedStyles->insert( sTmp );
}
}
}
diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx
index 09dd224168bd..c8b4c75a6a40 100644
--- a/xmloff/source/style/xmlaustp.cxx
+++ b/xmloff/source/style/xmlaustp.cxx
@@ -137,31 +137,31 @@ void SvXMLAutoStylePoolP::exportStyleAttributes(
}
}
- if( nFamily == XmlStyleFamily::PAGE_MASTER )
+ if( nFamily != XmlStyleFamily::PAGE_MASTER )
+ return;
+
+ for( const auto& rProp : rProperties )
{
- for( const auto& rProp : rProperties )
+ if (rProp.mnIndex > -1)
{
- if (rProp.mnIndex > -1)
+ const rtl::Reference< XMLPropertySetMapper >& aPropMapper = rPropExp.getPropertySetMapper();
+ sal_Int32 nIndex = rProp.mnIndex;
+ sal_Int16 nContextID = aPropMapper->GetEntryContextId( nIndex );
+ switch( nContextID )
{
- const rtl::Reference< XMLPropertySetMapper >& aPropMapper = rPropExp.getPropertySetMapper();
- sal_Int32 nIndex = rProp.mnIndex;
- sal_Int16 nContextID = aPropMapper->GetEntryContextId( nIndex );
- switch( nContextID )
+ case CTF_PM_PAGEUSAGE:
{
- case CTF_PM_PAGEUSAGE:
+ OUString sValue;
+ const XMLPropertyHandler* pPropHdl = aPropMapper->GetPropertyHandler( nIndex );
+ if( pPropHdl &&
+ pPropHdl->exportXML( sValue, rProp.maValue,
+ GetExport().GetMM100UnitConverter() ) &&
+ ( ! IsXMLToken( sValue, XML_ALL ) ) )
{
- OUString sValue;
- const XMLPropertyHandler* pPropHdl = aPropMapper->GetPropertyHandler( nIndex );
- if( pPropHdl &&
- pPropHdl->exportXML( sValue, rProp.maValue,
- GetExport().GetMM100UnitConverter() ) &&
- ( ! IsXMLToken( sValue, XML_ALL ) ) )
- {
- GetExport().AddAttribute( aPropMapper->GetEntryNameSpace( nIndex ), aPropMapper->GetEntryXMLName( nIndex ), sValue );
- }
+ GetExport().AddAttribute( aPropMapper->GetEntryNameSpace( nIndex ), aPropMapper->GetEntryXMLName( nIndex ), sValue );
}
- break;
}
+ break;
}
}
}
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
index 882b27971dd7..3c9e25fb643b 100644
--- a/xmloff/source/style/xmlnume.cxx
+++ b/xmloff/source/style/xmlnume.cxx
@@ -720,57 +720,57 @@ void SvxXMLNumRuleExport::exportOutline()
UNO_QUERY );
SAL_WARN_IF( !xCNSupplier.is(), "xmloff", "no chapter numbering supplier" );
- if( xCNSupplier.is() )
- {
- Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() );
- SAL_WARN_IF( !xNumRule.is(), "xmloff", "no chapter numbering rules" );
+ if( !xCNSupplier.is() )
+ return;
+
+ Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() );
+ SAL_WARN_IF( !xNumRule.is(), "xmloff", "no chapter numbering rules" );
+
+ if( !xNumRule.is() )
+ return;
- if( xNumRule.is() )
+ /* Outline style has property style:name since ODF 1.2
+ Thus, export this property and adjust fix for issue #i69627# (#i90780#)
+ */
+ OUString sOutlineStyleName;
+ {
+ Reference<XPropertySet> xNumRulePropSet(
+ xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
+ if (xNumRulePropSet.is())
{
- /* Outline style has property style:name since ODF 1.2
- Thus, export this property and adjust fix for issue #i69627# (#i90780#)
- */
- OUString sOutlineStyleName;
- {
- Reference<XPropertySet> xNumRulePropSet(
- xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
- if (xNumRulePropSet.is())
- {
- xNumRulePropSet->getPropertyValue( "Name" ) >>= sOutlineStyleName;
- }
- }
- const SvtSaveOptions::ODFSaneDefaultVersion nODFVersion =
- GetExport().getSaneDefaultVersion();
- if ((nODFVersion == SvtSaveOptions::ODFSVER_010 ||
- nODFVersion == SvtSaveOptions::ODFSVER_011)
- && GetExport().writeOutlineStyleAsNormalListStyle())
- {
- exportNumberingRule( sOutlineStyleName, false, xNumRule );
- }
- else
- {
- if (nODFVersion != SvtSaveOptions::ODFSVER_010 &&
- nODFVersion != SvtSaveOptions::ODFSVER_011)
- {
- // style:name="..."
- GetExport().CheckAttrList();
- if ( !sOutlineStyleName.isEmpty() )
- {
- bool bEncoded = false;
- GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME,
- GetExport().EncodeStyleName( sOutlineStyleName,
- &bEncoded ) );
- if( bEncoded )
- GetExport().AddAttribute( XML_NAMESPACE_STYLE,
- XML_DISPLAY_NAME,
- sOutlineStyleName );
- }
- }
- SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
- XML_OUTLINE_STYLE, true, true );
- exportLevelStyles( xNumRule, true );
+ xNumRulePropSet->getPropertyValue( "Name" ) >>= sOutlineStyleName;
+ }
+ }
+ const SvtSaveOptions::ODFSaneDefaultVersion nODFVersion =
+ GetExport().getSaneDefaultVersion();
+ if ((nODFVersion == SvtSaveOptions::ODFSVER_010 ||
+ nODFVersion == SvtSaveOptions::ODFSVER_011)
+ && GetExport().writeOutlineStyleAsNormalListStyle())
+ {
+ exportNumberingRule( sOutlineStyleName, false, xNumRule );
+ }
+ else
+ {
+ if (nODFVersion != SvtSaveOptions::ODFSVER_010 &&
+ nODFVersion != SvtSaveOptions::ODFSVER_011)
+ {
+ // style:name="..."
+ GetExport().CheckAttrList();
+ if ( !sOutlineStyleName.isEmpty() )
+ {
+ bool bEncoded = false;
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME,
+ GetExport().EncodeStyleName( sOutlineStyleName,
+ &bEncoded ) );
+ if( bEncoded )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_DISPLAY_NAME,
+ sOutlineStyleName );
}
}
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
+ XML_OUTLINE_STYLE, true, true );
+ exportLevelStyles( xNumRule, true );
}
}
@@ -783,40 +783,40 @@ void SvxXMLNumRuleExport::exportStyles( bool bUsed,
Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY );
SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "No XStyleFamiliesSupplier from XModel for export!" );
- if( xFamiliesSupp.is() )
- {
- Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
- SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "getStyleFamilies() from XModel failed for export!" );
+ if( !xFamiliesSupp.is() )
+ return;
- if( xFamilies.is() )
- {
- const OUString aNumberStyleName( "NumberingStyles" );
+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
+ SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "getStyleFamilies() from XModel failed for export!" );
- Reference< XIndexAccess > xStyles;
- if( xFamilies->hasByName( aNumberStyleName ) )
- {
- xFamilies->getByName( aNumberStyleName ) >>= xStyles;
+ if( !xFamilies.is() )
+ return;
- SAL_WARN_IF( !xStyles.is(), "xmloff", "Style not found for export!" );
+ const OUString aNumberStyleName( "NumberingStyles" );
- if( xStyles.is() )
- {
- const sal_Int32 nStyles = xStyles->getCount();
-
- for( sal_Int32 i=0; i < nStyles; i++ )
- {
- Reference< XStyle > xStyle;
- xStyles->getByIndex( i ) >>= xStyle;
-
- if( !bUsed || xStyle->isInUse() )
- {
- exportStyle( xStyle );
- if( pPool )
- pPool->RegisterName( xStyle->getName() );
- }
- }
- }
- }
+ Reference< XIndexAccess > xStyles;
+ if( !xFamilies->hasByName( aNumberStyleName ) )
+ return;
+
+ xFamilies->getByName( aNumberStyleName ) >>= xStyles;
+
+ SAL_WARN_IF( !xStyles.is(), "xmloff", "Style not found for export!" );
+
+ if( !xStyles.is() )
+ return;
+
+ const sal_Int32 nStyles = xStyles->getCount();
+
+ for( sal_Int32 i=0; i < nStyles; i++ )
+ {
+ Reference< XStyle > xStyle;
+ xStyles->getByIndex( i ) >>= xStyle;
+
+ if( !bUsed || xStyle->isInUse() )
+ {
+ exportStyle( xStyle );
+ if( pPool )
+ pPool->RegisterName( xStyle->getName() );
}
}
}
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 9b844eda3a24..6b0de888d0b5 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -801,37 +801,37 @@ void SvXMLNumFmtExport::WriteMapElement_Impl( sal_Int32 nOp, double fLimit,
{
FinishTextElement_Impl();
- if ( nOp != NUMBERFORMAT_OP_NO )
- {
- // style namespace
+ if ( nOp == NUMBERFORMAT_OP_NO )
+ return;
- OUStringBuffer aCondStr(20);
- aCondStr.append( "value()" ); //! define constant
- switch ( nOp )
- {
- case NUMBERFORMAT_OP_EQ: aCondStr.append( '=' ); break;
- case NUMBERFORMAT_OP_NE: aCondStr.append( "!=" ); break;
- case NUMBERFORMAT_OP_LT: aCondStr.append( '<' ); break;
- case NUMBERFORMAT_OP_LE: aCondStr.append( "<=" ); break;
- case NUMBERFORMAT_OP_GT: aCondStr.append( '>' ); break;
- case NUMBERFORMAT_OP_GE: aCondStr.append( ">=" ); break;
- default:
- OSL_FAIL("unknown operator");
- }
- ::rtl::math::doubleToUStringBuffer( aCondStr, fLimit,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true );
+ // style namespace
- rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_CONDITION,
- aCondStr.makeStringAndClear() );
+ OUStringBuffer aCondStr(20);
+ aCondStr.append( "value()" ); //! define constant
+ switch ( nOp )
+ {
+ case NUMBERFORMAT_OP_EQ: aCondStr.append( '=' ); break;
+ case NUMBERFORMAT_OP_NE: aCondStr.append( "!=" ); break;
+ case NUMBERFORMAT_OP_LT: aCondStr.append( '<' ); break;
+ case NUMBERFORMAT_OP_LE: aCondStr.append( "<=" ); break;
+ case NUMBERFORMAT_OP_GT: aCondStr.append( '>' ); break;
+ case NUMBERFORMAT_OP_GE: aCondStr.append( ">=" ); break;
+ default:
+ OSL_FAIL("unknown operator");
+ }
+ ::rtl::math::doubleToUStringBuffer( aCondStr, fLimit,
+ rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+ '.', true );
- rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME,
- rExport.EncodeStyleName( lcl_CreateStyleName( nKey, nPart, false,
- sPrefix ) ) );
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_CONDITION,
+ aCondStr.makeStringAndClear() );
- SvXMLElementExport aElem( rExport, XML_NAMESPACE_STYLE, XML_MAP,
- true, false );
- }
+ rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME,
+ rExport.EncodeStyleName( lcl_CreateStyleName( nKey, nPart, false,
+ sPrefix ) ) );
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_STYLE, XML_MAP,
+ true, false );
}
// for old (automatic) currency formats: parse currency symbol from text
@@ -1725,58 +1725,58 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
// mapping (conditions) must be last elements
- if (bDefPart)
- {
- SvNumberformatLimitOps eOp1, eOp2;
- double fLimit1, fLimit2;
- rFormat.GetConditions( eOp1, fLimit1, eOp2, fLimit2 );
+ if (!bDefPart)
+ return;
+
+ SvNumberformatLimitOps eOp1, eOp2;
+ double fLimit1, fLimit2;
+ rFormat.GetConditions( eOp1, fLimit1, eOp2, fLimit2 );
- WriteMapElement_Impl( eOp1, fLimit1, nKey, 0 );
- WriteMapElement_Impl( eOp2, fLimit2, nKey, 1 );
+ WriteMapElement_Impl( eOp1, fLimit1, nKey, 0 );
+ WriteMapElement_Impl( eOp2, fLimit2, nKey, 1 );
- if ( rFormat.HasTextFormat() )
- {
- // 4th part is for text -> make an "all other numbers" condition for the 3rd part
- // by reversing the 2nd condition.
- // For a trailing text format like 0;@ that has no conditions
- // use a "less or equal than biggest" condition for the number
- // part, ODF can't store subformats (style maps) without
- // conditions.
-
- SvNumberformatLimitOps eOp3 = NUMBERFORMAT_OP_NO;
- double fLimit3 = fLimit2;
- sal_uInt16 nLastPart = 2;
- SvNumberformatLimitOps eOpLast = eOp2;
- if (eOp2 == NUMBERFORMAT_OP_NO)
- {
- eOpLast = eOp1;
- fLimit3 = fLimit1;
- nLastPart = (eOp1 == NUMBERFORMAT_OP_NO) ? 0 : 1;
- }
- switch ( eOpLast )
- {
- case NUMBERFORMAT_OP_EQ: eOp3 = NUMBERFORMAT_OP_NE; break;
- case NUMBERFORMAT_OP_NE: eOp3 = NUMBERFORMAT_OP_EQ; break;
- case NUMBERFORMAT_OP_LT: eOp3 = NUMBERFORMAT_OP_GE; break;
- case NUMBERFORMAT_OP_LE: eOp3 = NUMBERFORMAT_OP_GT; break;
- case NUMBERFORMAT_OP_GT: eOp3 = NUMBERFORMAT_OP_LE; break;
- case NUMBERFORMAT_OP_GE: eOp3 = NUMBERFORMAT_OP_LT; break;
- case NUMBERFORMAT_OP_NO: eOp3 = NUMBERFORMAT_OP_LE; fLimit3 = DBL_MAX; break;
- }
+ if ( !rFormat.HasTextFormat() )
+ return;
- if ( fLimit1 == fLimit2 &&
- ( ( eOp1 == NUMBERFORMAT_OP_LT && eOp2 == NUMBERFORMAT_OP_GT ) ||
- ( eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_LT ) ) )
- {
- // For <x and >x, add =x as last condition
- // (just for readability, <=x would be valid, too)
+ // 4th part is for text -> make an "all other numbers" condition for the 3rd part
+ // by reversing the 2nd condition.
+ // For a trailing text format like 0;@ that has no conditions
+ // use a "less or equal than biggest" condition for the number
+ // part, ODF can't store subformats (style maps) without
+ // conditions.
- eOp3 = NUMBERFORMAT_OP_EQ;
- }
+ SvNumberformatLimitOps eOp3 = NUMBERFORMAT_OP_NO;
+ double fLimit3 = fLimit2;
+ sal_uInt16 nLastPart = 2;
+ SvNumberformatLimitOps eOpLast = eOp2;
+ if (eOp2 == NUMBERFORMAT_OP_NO)
+ {
+ eOpLast = eOp1;
+ fLimit3 = fLimit1;
+ nLastPart = (eOp1 == NUMBERFORMAT_OP_NO) ? 0 : 1;
+ }
+ switch ( eOpLast )
+ {
+ case NUMBERFORMAT_OP_EQ: eOp3 = NUMBERFORMAT_OP_NE; break;
+ case NUMBERFORMAT_OP_NE: eOp3 = NUMBERFORMAT_OP_EQ; break;
+ case NUMBERFORMAT_OP_LT: eOp3 = NUMBERFORMAT_OP_GE; break;
+ case NUMBERFORMAT_OP_LE: eOp3 = NUMBERFORMAT_OP_GT; break;
+ case NUMBERFORMAT_OP_GT: eOp3 = NUMBERFORMAT_OP_LE; break;
+ case NUMBERFORMAT_OP_GE: eOp3 = NUMBERFORMAT_OP_LT; break;
+ case NUMBERFORMAT_OP_NO: eOp3 = NUMBERFORMAT_OP_LE; fLimit3 = DBL_MAX; break;
+ }
- WriteMapElement_Impl( eOp3, fLimit3, nKey, nLastPart );
- }
+ if ( fLimit1 == fLimit2 &&
+ ( ( eOp1 == NUMBERFORMAT_OP_LT && eOp2 == NUMBERFORMAT_OP_GT ) ||
+ ( eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_LT ) ) )
+ {
+ // For <x and >x, add =x as last condition
+ // (just for readability, <=x would be valid, too)
+
+ eOp3 = NUMBERFORMAT_OP_EQ;
}
+
+ WriteMapElement_Impl( eOp3, fLimit3, nKey, nLastPart );
}
// export one format
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index be1e193d228e..5914d9d04ca2 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -805,50 +805,50 @@ static void lcl_EnquoteIfNecessary( OUStringBuffer& rContent, const SvXMLNumForm
// else: normal quoting (below)
}
- if ( bQuote )
+ if ( !bQuote )
+ return;
+
+ // #i55469# quotes in the string itself have to be escaped
+ bool bEscape = ( rContent.indexOf( '"' ) >= 0 );
+ if ( bEscape )
{
- // #i55469# quotes in the string itself have to be escaped
- bool bEscape = ( rContent.indexOf( '"' ) >= 0 );
- if ( bEscape )
- {
- // A quote is turned into "\"" - a quote to end quoted text, an escaped quote,
- // and a quote to resume quoting.
- OUString aInsert( "\"\\\"" );
+ // A quote is turned into "\"" - a quote to end quoted text, an escaped quote,
+ // and a quote to resume quoting.
+ OUString aInsert( "\"\\\"" );
- sal_Int32 nPos = 0;
- while ( nPos < rContent.getLength() )
+ sal_Int32 nPos = 0;
+ while ( nPos < rContent.getLength() )
+ {
+ if ( rContent[nPos] == '"' )
{
- if ( rContent[nPos] == '"' )
- {
- rContent.insert( nPos, aInsert );
- nPos += aInsert.getLength();
- }
- ++nPos;
+ rContent.insert( nPos, aInsert );
+ nPos += aInsert.getLength();
}
+ ++nPos;
}
+ }
- // quote string literals
- rContent.insert( 0, '"' );
- rContent.append( '"' );
+ // quote string literals
+ rContent.insert( 0, '"' );
+ rContent.append( '"' );
- // remove redundant double quotes at start or end
- if ( bEscape )
- {
- if ( rContent.getLength() > 2 &&
- rContent[0] == '"' &&
- rContent[1] == '"' )
- {
- rContent.remove(0, 2);
- }
+ // remove redundant double quotes at start or end
+ if ( !bEscape )
+ return;
- sal_Int32 nLen = rContent.getLength();
- if ( nLen > 2 &&
- rContent[nLen - 1] == '"' &&
- rContent[nLen - 2] == '"' )
- {
- rContent.truncate(nLen - 2);
- }
- }
+ if ( rContent.getLength() > 2 &&
+ rContent[0] == '"' &&
+ rContent[1] == '"' )
+ {
+ rContent.remove(0, 2);
+ }
+
+ sal_Int32 nLen = rContent.getLength();
+ if ( nLen > 2 &&
+ rContent[nLen - 1] == '"' &&
+ rContent[nLen - 2] == '"' )
+ {
+ rContent.truncate(nLen - 2);
}
}
@@ -1434,37 +1434,37 @@ SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport,
nFormatLang = LANGUAGE_SYSTEM; //! error handling for unknown locales?
}
- if ( !aNatNumAttr.Format.isEmpty() || !aSpellout.isEmpty() )
+ if (aNatNumAttr.Format.isEmpty() && aSpellout.isEmpty())
+ return;
+
+ LanguageTag aLanguageTag( OUString(), aNatNumAttr.Locale.Language,
+ OUString(), aNatNumAttr.Locale.Country);
+ aNatNumAttr.Locale = aLanguageTag.getLocale( false);
+
+ // NatNum12 spell out formula (cardinal, ordinal, ordinal-feminine etc.)
+ if ( !aSpellout.isEmpty() )
{
- LanguageTag aLanguageTag( OUString(), aNatNumAttr.Locale.Language,
- OUString(), aNatNumAttr.Locale.Country);
- aNatNumAttr.Locale = aLanguageTag.getLocale( false);
+ aFormatCode.append( "[NatNum12 " );
+ aFormatCode.append( aSpellout );
+ } else {
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ if ( !pFormatter ) return;
- // NatNum12 spell out formula (cardinal, ordinal, ordinal-feminine etc.)
- if ( !aSpellout.isEmpty() )
- {
- aFormatCode.append( "[NatNum12 " );
- aFormatCode.append( aSpellout );
- } else {
- SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
- if ( !pFormatter ) return;
-
- sal_Int32 nNatNum = pFormatter->GetNatNum()->convertFromXmlAttributes( aNatNumAttr );
- aFormatCode.append( "[NatNum" );
- aFormatCode.append( nNatNum );
- }
+ sal_Int32 nNatNum = pFormatter->GetNatNum()->convertFromXmlAttributes( aNatNumAttr );
+ aFormatCode.append( "[NatNum" );
+ aFormatCode.append( nNatNum );
+ }
- LanguageType eLang = aLanguageTag.getLanguageType( false );
- if ( eLang == LANGUAGE_DONTKNOW )
- eLang = LANGUAGE_SYSTEM; //! error handling for unknown locales?
- if ( eLang != nFormatLang && eLang != LANGUAGE_SYSTEM )
- {
- aFormatCode.append( "][$-" );
- // language code in upper hex:
- aFormatCode.append(OUString::number(static_cast<sal_uInt16>(eLang), 16).toAsciiUpperCase());
- }
- aFormatCode.append( ']' );
+ LanguageType eLang = aLanguageTag.getLanguageType( false );
+ if ( eLang == LANGUAGE_DONTKNOW )
+ eLang = LANGUAGE_SYSTEM; //! error handling for unknown locales?
+ if ( eLang != nFormatLang && eLang != LANGUAGE_SYSTEM )
+ {
+ aFormatCode.append( "][$-" );
+ // language code in upper hex:
+ aFormatCode.append(OUString::number(static_cast<sal_uInt16>(eLang), 16).toAsciiUpperCase());
}
+ aFormatCode.append( ']' );
}
SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport,
@@ -1945,18 +1945,18 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
// add extra thousands separators for display factor
- if ( rInfo.fDisplayFactor != 1.0 && rInfo.fDisplayFactor > 0.0 )
- {
- // test for 1.0 is just for optimization - nSepCount would be 0
+ if (rInfo.fDisplayFactor == 1.0 || rInfo.fDisplayFactor <= 0.0)
+ return;
- // one separator for each factor of 1000
- sal_Int32 nSepCount = static_cast<sal_Int32>(::rtl::math::round( log10(rInfo.fDisplayFactor) / 3.0 ));
- if ( nSepCount > 0 )
- {
- OUString aSep = pData->GetLocaleData( nFormatLang ).getNumThousandSep();
- for ( sal_Int32 i=0; i<nSepCount; i++ )
- aFormatCode.append( aSep );
- }
+ // test for 1.0 is just for optimization - nSepCount would be 0
+
+ // one separator for each factor of 1000
+ sal_Int32 nSepCount = static_cast<sal_Int32>(::rtl::math::round( log10(rInfo.fDisplayFactor) / 3.0 ));
+ if ( nSepCount > 0 )
+ {
+ OUString aSep = pData->GetLocaleData( nFormatLang ).getNumThousandSep();
+ for ( sal_Int32 i=0; i<nSepCount; i++ )
+ aFormatCode.append( aSep );
}
}
@@ -2137,54 +2137,54 @@ void SvXMLNumFormatContext::AddCondition( const sal_Int32 nIndex )
sal_uInt32 l_nKey = pData->GetKeyForName( rApplyName );
OUString sRealCond;
- if ( pFormatter && l_nKey != NUMBERFORMAT_ENTRY_NOT_FOUND &&
- rCondition.startsWith("value()", &sRealCond) )
- {
- //! test for valid conditions
- //! test for default conditions
+ if ( !(pFormatter && l_nKey != NUMBERFORMAT_ENTRY_NOT_FOUND &&
+ rCondition.startsWith("value()", &sRealCond)) )
+ return;
+
+ //! test for valid conditions
+ //! test for default conditions
- bool bDefaultCond = false;
+ bool bDefaultCond = false;
- //! collect all conditions first and adjust default to >=0, >0 or <0 depending on count
- //! allow blanks in conditions
- if ( aConditions.isEmpty() && aMyConditions.size() == 1 && sRealCond == ">=0" )
- bDefaultCond = true;
+ //! collect all conditions first and adjust default to >=0, >0 or <0 depending on count
+ //! allow blanks in conditions
+ if ( aConditions.isEmpty() && aMyConditions.size() == 1 && sRealCond == ">=0" )
+ bDefaultCond = true;
- if ( nType == XML_TOK_STYLES_TEXT_STYLE && static_cast<size_t>(nIndex) == aMyConditions.size() - 1 )
+ if ( nType == XML_TOK_STYLES_TEXT_STYLE && static_cast<size_t>(nIndex) == aMyConditions.size() - 1 )
+ {
+ // The last condition in a number format with a text part can only
+ // be "all other numbers", the condition string must be empty.
+ bDefaultCond = true;
+ }
+
+ if (!bDefaultCond)
+ {
+ // Convert != to <>
+ sal_Int32 nPos = sRealCond.indexOf( "!=" );
+ if ( nPos >= 0 )
{
- // The last condition in a number format with a text part can only
- // be "all other numbers", the condition string must be empty.
- bDefaultCond = true;
+ sRealCond = sRealCond.replaceAt( nPos, 2, "<>" );
}
- if (!bDefaultCond)
+ nPos = sRealCond.indexOf( '.' );
+ if ( nPos >= 0 )
{
- // Convert != to <>
- sal_Int32 nPos = sRealCond.indexOf( "!=" );
- if ( nPos >= 0 )
- {
- sRealCond = sRealCond.replaceAt( nPos, 2, "<>" );
- }
-
- nPos = sRealCond.indexOf( '.' );
- if ( nPos >= 0 )
+ // #i8026# #103991# localize decimal separator
+ const OUString& rDecSep = GetLocaleData().getNumDecimalSep();
+ if ( rDecSep.getLength() > 1 || rDecSep[0] != '.' )
{
- // #i8026# #103991# localize decimal separator
- const OUString& rDecSep = GetLocaleData().getNumDecimalSep();
- if ( rDecSep.getLength() > 1 || rDecSep[0] != '.' )
- {
- sRealCond = sRealCond.replaceAt( nPos, 1, rDecSep );
- }
+ sRealCond = sRealCond.replaceAt( nPos, 1, rDecSep );
}
- aConditions.append("[").append(sRealCond).append("]");
}
+ aConditions.append("[").append(sRealCond).append("]");
+ }
- const SvNumberformat* pFormat = pFormatter->GetEntry(l_nKey);
- if ( pFormat )
- aConditions.append( pFormat->GetFormatstring() );
+ const SvNumberformat* pFormat = pFormatter->GetEntry(l_nKey);
+ if ( pFormat )
+ aConditions.append( pFormat->GetFormatstring() );
- aConditions.append( ';' );
- }
+ aConditions.append( ';' );
}
void SvXMLNumFormatContext::AddCondition( const OUString& rCondition, const OUString& rApplyName )
diff --git a/xmloff/source/style/xmlprmap.cxx b/xmloff/source/style/xmlprmap.cxx
index b3111441ef6a..b00529bc2f21 100644
--- a/xmloff/source/style/xmlprmap.cxx
+++ b/xmloff/source/style/xmlprmap.cxx
@@ -103,30 +103,30 @@ XMLPropertySetMapper::XMLPropertySetMapper(
mpImpl(new Impl(bForExport))
{
mpImpl->maHdlFactories.push_back(rFactory);
- if( pEntries )
- {
- const XMLPropertyMapEntry* pIter = pEntries;
+ if( !pEntries )
+ return;
- if (mpImpl->mbOnlyExportMappings)
- {
- while( pIter->msApiName )
- {
- if (!pIter->mbImportOnly)
- {
- XMLPropertySetMapperEntry_Impl aEntry( *pIter, rFactory );
- mpImpl->maMapEntries.push_back( aEntry );
- }
- ++pIter;
- }
- }
- else
+ const XMLPropertyMapEntry* pIter = pEntries;
+
+ if (mpImpl->mbOnlyExportMappings)
+ {
+ while( pIter->msApiName )
{
- while( pIter->msApiName )
+ if (!pIter->mbImportOnly)
{
XMLPropertySetMapperEntry_Impl aEntry( *pIter, rFactory );
mpImpl->maMapEntries.push_back( aEntry );
- ++pIter;
}
+ ++pIter;
+ }
+ }
+ else
+ {
+ while( pIter->msApiName )
+ {
+ XMLPropertySetMapperEntry_Impl aEntry( *pIter, rFactory );
+ mpImpl->maMapEntries.push_back( aEntry );
+ ++pIter;
}
}
}