Kaydet (Commit) f8d1dcc6 authored tarafından Chr. Rossmanith's avatar Chr. Rossmanith Kaydeden (comit) Noel Power

fdo#43460: Use isEmpty() instead of getLength() in svgio

Change-Id: I31298a08408a14e1ae0d43b474681e6336b08003
Reviewed-on: https://gerrit.libreoffice.org/4340Reviewed-by: 's avatarNoel Power <noel.power@suse.com>
Tested-by: 's avatarNoel Power <noel.power@suse.com>
üst 0b67caf4
...@@ -50,7 +50,7 @@ namespace svgio ...@@ -50,7 +50,7 @@ namespace svgio
{ {
case SVGTokenX: case SVGTokenX:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
SvgNumberVector aVector; SvgNumberVector aVector;
...@@ -63,7 +63,7 @@ namespace svgio ...@@ -63,7 +63,7 @@ namespace svgio
} }
case SVGTokenY: case SVGTokenY:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
SvgNumberVector aVector; SvgNumberVector aVector;
...@@ -76,7 +76,7 @@ namespace svgio ...@@ -76,7 +76,7 @@ namespace svgio
} }
case SVGTokenDx: case SVGTokenDx:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
SvgNumberVector aVector; SvgNumberVector aVector;
...@@ -89,7 +89,7 @@ namespace svgio ...@@ -89,7 +89,7 @@ namespace svgio
} }
case SVGTokenDy: case SVGTokenDy:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
SvgNumberVector aVector; SvgNumberVector aVector;
...@@ -102,7 +102,7 @@ namespace svgio ...@@ -102,7 +102,7 @@ namespace svgio
} }
case SVGTokenRotate: case SVGTokenRotate:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
SvgNumberVector aVector; SvgNumberVector aVector;
...@@ -128,7 +128,7 @@ namespace svgio ...@@ -128,7 +128,7 @@ namespace svgio
} }
case SVGTokenLengthAdjust: case SVGTokenLengthAdjust:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrSpacing(OUString::createFromAscii("spacing")); static OUString aStrSpacing(OUString::createFromAscii("spacing"));
static OUString aStrSpacingAndGlyphs(OUString::createFromAscii("spacingAndGlyphs")); static OUString aStrSpacingAndGlyphs(OUString::createFromAscii("spacingAndGlyphs"));
...@@ -572,7 +572,7 @@ namespace svgio ...@@ -572,7 +572,7 @@ namespace svgio
void SvgCharacterNode::decomposeText(drawinglayer::primitive2d::Primitive2DSequence& rTarget, SvgTextPosition& rSvgTextPosition) const void SvgCharacterNode::decomposeText(drawinglayer::primitive2d::Primitive2DSequence& rTarget, SvgTextPosition& rSvgTextPosition) const
{ {
if(getText().getLength()) if(!getText().isEmpty())
{ {
const SvgStyleAttributes* pSvgStyleAttributes = getSvgStyleAttributes(); const SvgStyleAttributes* pSvgStyleAttributes = getSvgStyleAttributes();
......
...@@ -79,7 +79,7 @@ namespace svgio ...@@ -79,7 +79,7 @@ namespace svgio
} }
case SVGTokenClipPathUnits: case SVGTokenClipPathUnits:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0)) if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0))
{ {
......
...@@ -51,7 +51,7 @@ namespace svgio ...@@ -51,7 +51,7 @@ namespace svgio
void SvgDocument::addSvgNodeToMapper(const OUString& rStr, const SvgNode& rNode) void SvgDocument::addSvgNodeToMapper(const OUString& rStr, const SvgNode& rNode)
{ {
if(rStr.getLength()) if(!rStr.isEmpty())
{ {
maIdTokenMapperList.insert(IdTokenValueType(rStr, &rNode)); maIdTokenMapperList.insert(IdTokenValueType(rStr, &rNode));
} }
...@@ -59,7 +59,7 @@ namespace svgio ...@@ -59,7 +59,7 @@ namespace svgio
void SvgDocument::removeSvgNodeFromMapper(const OUString& rStr) void SvgDocument::removeSvgNodeFromMapper(const OUString& rStr)
{ {
if(rStr.getLength()) if(!rStr.isEmpty())
{ {
maIdTokenMapperList.erase(rStr); maIdTokenMapperList.erase(rStr);
} }
...@@ -81,7 +81,7 @@ namespace svgio ...@@ -81,7 +81,7 @@ namespace svgio
void SvgDocument::addSvgStyleAttributesToMapper(const OUString& rStr, const SvgStyleAttributes& rSvgStyleAttributes) void SvgDocument::addSvgStyleAttributesToMapper(const OUString& rStr, const SvgStyleAttributes& rSvgStyleAttributes)
{ {
if(rStr.getLength()) if(!rStr.isEmpty())
{ {
maIdStyleTokenMapperList.insert(IdStyleTokenValueType(rStr, &rSvgStyleAttributes)); maIdStyleTokenMapperList.insert(IdStyleTokenValueType(rStr, &rSvgStyleAttributes));
} }
......
...@@ -76,7 +76,7 @@ namespace ...@@ -76,7 +76,7 @@ namespace
// pCharNode may have lost all text. If that's the case, ignore // pCharNode may have lost all text. If that's the case, ignore
// as invalid character node // as invalid character node
if(pCharNode->getText().getLength()) if(!pCharNode->getText().isEmpty())
{ {
if(pLast) if(pLast)
{ {
...@@ -171,7 +171,7 @@ namespace svgio ...@@ -171,7 +171,7 @@ namespace svgio
void SvgDocHdl::startElement( const OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs ) throw (xml::sax::SAXException, uno::RuntimeException) void SvgDocHdl::startElement( const OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs ) throw (xml::sax::SAXException, uno::RuntimeException)
{ {
if(aName.getLength()) if(!aName.isEmpty())
{ {
const SVGToken aSVGToken(StrToSVGToken(aName)); const SVGToken aSVGToken(StrToSVGToken(aName));
...@@ -385,7 +385,7 @@ namespace svgio ...@@ -385,7 +385,7 @@ namespace svgio
void SvgDocHdl::endElement( const OUString& aName ) throw (xml::sax::SAXException, uno::RuntimeException) void SvgDocHdl::endElement( const OUString& aName ) throw (xml::sax::SAXException, uno::RuntimeException)
{ {
if(aName.getLength()) if(!aName.isEmpty())
{ {
const SVGToken aSVGToken(StrToSVGToken(aName)); const SVGToken aSVGToken(StrToSVGToken(aName));
SvgNode* pWhitespaceCheck(SVGTokenText == aSVGToken ? mpTarget : 0); SvgNode* pWhitespaceCheck(SVGTokenText == aSVGToken ? mpTarget : 0);
...@@ -471,7 +471,7 @@ namespace svgio ...@@ -471,7 +471,7 @@ namespace svgio
{ {
const OUString aText(pSvgTitleDescNode->getText()); const OUString aText(pSvgTitleDescNode->getText());
if(aText.getLength()) if(!aText.isEmpty())
{ {
if(SVGTokenTitle == aSVGToken) if(SVGTokenTitle == aSVGToken)
{ {
...@@ -551,7 +551,7 @@ namespace svgio ...@@ -551,7 +551,7 @@ namespace svgio
{ {
const OUString aTrimmedChars(aChars.trim()); const OUString aTrimmedChars(aChars.trim());
if(aTrimmedChars.getLength()) if(!aTrimmedChars.isEmpty())
{ {
std::vector< OUString >::iterator aString(maCssContents.end() - 1); std::vector< OUString >::iterator aString(maCssContents.end() - 1);
(*aString) += aTrimmedChars; (*aString) += aTrimmedChars;
......
...@@ -29,7 +29,7 @@ namespace svgio ...@@ -29,7 +29,7 @@ namespace svgio
{ {
void SvgGradientNode::tryToFindLink() void SvgGradientNode::tryToFindLink()
{ {
if(!mpXLink && maXLink.getLength()) if(!mpXLink && !maXLink.isEmpty())
{ {
mpXLink = dynamic_cast< const SvgGradientNode* >(getDocument().findSvgNodeById(maXLink)); mpXLink = dynamic_cast< const SvgGradientNode* >(getDocument().findSvgNodeById(maXLink));
} }
...@@ -180,7 +180,7 @@ namespace svgio ...@@ -180,7 +180,7 @@ namespace svgio
} }
case SVGTokenGradientUnits: case SVGTokenGradientUnits:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0)) if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0))
{ {
...@@ -195,7 +195,7 @@ namespace svgio ...@@ -195,7 +195,7 @@ namespace svgio
} }
case SVGTokenSpreadMethod: case SVGTokenSpreadMethod:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrPad(OUString::createFromAscii("pad")); static OUString aStrPad(OUString::createFromAscii("pad"));
static OUString aStrReflect(OUString::createFromAscii("reflect")); static OUString aStrReflect(OUString::createFromAscii("reflect"));
......
...@@ -212,7 +212,7 @@ namespace svgio ...@@ -212,7 +212,7 @@ namespace svgio
const basegfx::B2DRange aTarget(fX, fY, fX + fWidth, fY + fHeight); const basegfx::B2DRange aTarget(fX, fY, fX + fWidth, fY + fHeight);
basegfx::B2DRange aViewBox(aTarget); basegfx::B2DRange aViewBox(aTarget);
if(maMimeType.getLength() && maData.getLength()) if(!maMimeType.isEmpty() && !maData.isEmpty())
{ {
// use embedded base64 encoded data // use embedded base64 encoded data
::com::sun::star::uno::Sequence< sal_Int8 > aPass; ::com::sun::star::uno::Sequence< sal_Int8 > aPass;
...@@ -232,12 +232,12 @@ namespace svgio ...@@ -232,12 +232,12 @@ namespace svgio
} }
} }
} }
else if(maUrl.getLength()) else if(!maUrl.isEmpty())
{ {
const OUString& rPath = getDocument().getAbsolutePath(); const OUString& rPath = getDocument().getAbsolutePath();
const OUString aAbsUrl(rtl::Uri::convertRelToAbs(rPath, maUrl)); const OUString aAbsUrl(rtl::Uri::convertRelToAbs(rPath, maUrl));
if(aAbsUrl.getLength()) if(!aAbsUrl.isEmpty())
{ {
SvFileStream aStream(aAbsUrl, STREAM_STD_READ); SvFileStream aStream(aAbsUrl, STREAM_STD_READ);
Graphic aGraphic; Graphic aGraphic;
...@@ -251,7 +251,7 @@ namespace svgio ...@@ -251,7 +251,7 @@ namespace svgio
} }
} }
} }
else if(maXLink.getLength()) else if(!maXLink.isEmpty())
{ {
const SvgNode* mpXLink = getDocument().findSvgNodeById(maXLink); const SvgNode* mpXLink = getDocument().findSvgNodeById(maXLink);
......
...@@ -107,7 +107,7 @@ namespace svgio ...@@ -107,7 +107,7 @@ namespace svgio
} }
case SVGTokenMarkerUnits: case SVGTokenMarkerUnits:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrStrokeWidth(OUString::createFromAscii("strokeWidth")); static OUString aStrStrokeWidth(OUString::createFromAscii("strokeWidth"));
......
...@@ -132,7 +132,7 @@ namespace svgio ...@@ -132,7 +132,7 @@ namespace svgio
} }
case SVGTokenMaskUnits: case SVGTokenMaskUnits:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0)) if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0))
{ {
...@@ -147,7 +147,7 @@ namespace svgio ...@@ -147,7 +147,7 @@ namespace svgio
} }
case SVGTokenMaskContentUnits: case SVGTokenMaskContentUnits:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0)) if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0))
{ {
......
...@@ -67,7 +67,7 @@ namespace svgio ...@@ -67,7 +67,7 @@ namespace svgio
aId = aId + aOUTokenValue; aId = aId + aOUTokenValue;
pNew = rDocument.findSvgStyleAttributesById(aId); pNew = rDocument.findSvgStyleAttributesById(aId);
if(!pNew && rClassStr.getLength()) if(!pNew && !rClassStr.isEmpty())
{ {
// look for CSS style common to class.token // look for CSS style common to class.token
aId = rClassStr + aId; aId = rClassStr + aId;
...@@ -93,7 +93,7 @@ namespace svgio ...@@ -93,7 +93,7 @@ namespace svgio
} }
} }
if(maCssStyleVector.empty() && rClassStr.getLength()) if(maCssStyleVector.empty() && !rClassStr.isEmpty())
{ {
// if none found, search for CSS style equal to class type // if none found, search for CSS style equal to class type
const SvgStyleAttributes* pNew = rDocument.findSvgStyleAttributesById(rClassStr); const SvgStyleAttributes* pNew = rDocument.findSvgStyleAttributesById(rClassStr);
...@@ -326,7 +326,7 @@ namespace svgio ...@@ -326,7 +326,7 @@ namespace svgio
{ {
case SVGTokenId: case SVGTokenId:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
setId(&aContent); setId(&aContent);
} }
...@@ -334,7 +334,7 @@ namespace svgio ...@@ -334,7 +334,7 @@ namespace svgio
} }
case SVGTokenClass: case SVGTokenClass:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
setClass(&aContent); setClass(&aContent);
} }
...@@ -342,7 +342,7 @@ namespace svgio ...@@ -342,7 +342,7 @@ namespace svgio
} }
case SVGTokenXmlSpace: case SVGTokenXmlSpace:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrDefault(OUString::createFromAscii("default")); static OUString aStrDefault(OUString::createFromAscii("default"));
static OUString aStrPreserve(OUString::createFromAscii("preserve")); static OUString aStrPreserve(OUString::createFromAscii("preserve"));
...@@ -443,7 +443,7 @@ namespace svgio ...@@ -443,7 +443,7 @@ namespace svgio
const OUString& rTitle = pStyles->getTitle(); const OUString& rTitle = pStyles->getTitle();
const OUString& rDesc = pStyles->getDesc(); const OUString& rDesc = pStyles->getDesc();
if(rTitle.getLength() || rDesc.getLength()) if(!rTitle.isEmpty() || !rDesc.isEmpty())
{ {
// default object name is empty // default object name is empty
OUString aObjectName; OUString aObjectName;
...@@ -453,7 +453,7 @@ namespace svgio ...@@ -453,7 +453,7 @@ namespace svgio
{ {
aObjectName = getDocument().getAbsolutePath(); aObjectName = getDocument().getAbsolutePath();
if(aObjectName.getLength()) if(!aObjectName.isEmpty())
{ {
INetURLObject aURL(aObjectName); INetURLObject aURL(aObjectName);
......
...@@ -28,7 +28,7 @@ namespace svgio ...@@ -28,7 +28,7 @@ namespace svgio
{ {
void SvgPatternNode::tryToFindLink() void SvgPatternNode::tryToFindLink()
{ {
if(!mpXLink && maXLink.getLength()) if(!mpXLink && !maXLink.isEmpty())
{ {
mpXLink = dynamic_cast< const SvgPatternNode* >(getDocument().findSvgNodeById(maXLink)); mpXLink = dynamic_cast< const SvgPatternNode* >(getDocument().findSvgNodeById(maXLink));
} }
...@@ -147,7 +147,7 @@ namespace svgio ...@@ -147,7 +147,7 @@ namespace svgio
} }
case SVGTokenPatternUnits: case SVGTokenPatternUnits:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0)) if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0))
{ {
...@@ -162,7 +162,7 @@ namespace svgio ...@@ -162,7 +162,7 @@ namespace svgio
} }
case SVGTokenPatternContentUnits: case SVGTokenPatternContentUnits:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0)) if(aContent.match(commonStrings::aStrUserSpaceOnUse, 0))
{ {
...@@ -274,7 +274,7 @@ namespace svgio ...@@ -274,7 +274,7 @@ namespace svgio
decomposeSvgNode(const_cast< SvgPatternNode* >(this)->aPrimitives, true); decomposeSvgNode(const_cast< SvgPatternNode* >(this)->aPrimitives, true);
} }
if(!aPrimitives.hasElements() && maXLink.getLength()) if(!aPrimitives.hasElements() && !maXLink.isEmpty())
{ {
const_cast< SvgPatternNode* >(this)->tryToFindLink(); const_cast< SvgPatternNode* >(this)->tryToFindLink();
......
...@@ -183,7 +183,7 @@ namespace svgio ...@@ -183,7 +183,7 @@ namespace svgio
OUStringBuffer aTokenName; OUStringBuffer aTokenName;
copyString(rCandidate, nPos, aTokenName, nLen); copyString(rCandidate, nPos, aTokenName, nLen);
if(aTokenName.getLength()) if(!aTokenName.isEmpty())
{ {
skip_char(rCandidate, sal_Unicode(' '), sal_Unicode(':'), nPos, nLen); skip_char(rCandidate, sal_Unicode(' '), sal_Unicode(':'), nPos, nLen);
OUStringBuffer aTokenValue; OUStringBuffer aTokenValue;
...@@ -1085,7 +1085,7 @@ namespace svgio ...@@ -1085,7 +1085,7 @@ namespace svgio
aSource = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1); aSource = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1);
} }
if(getClipPathXLink().getLength()) if(!getClipPathXLink().isEmpty())
{ {
// try to access linked ClipPath // try to access linked ClipPath
const SvgClipPathNode* mpClip = dynamic_cast< const SvgClipPathNode* >(mrOwner.getDocument().findSvgNodeById(getClipPathXLink())); const SvgClipPathNode* mpClip = dynamic_cast< const SvgClipPathNode* >(mrOwner.getDocument().findSvgNodeById(getClipPathXLink()));
...@@ -1098,7 +1098,7 @@ namespace svgio ...@@ -1098,7 +1098,7 @@ namespace svgio
if(aSource.hasElements()) // test again, applied clipPath may have lead to empty geometry if(aSource.hasElements()) // test again, applied clipPath may have lead to empty geometry
{ {
if(getMaskXLink().getLength()) if(!getMaskXLink().isEmpty())
{ {
// try to access linked Mask // try to access linked Mask
const SvgMaskNode* mpMask = dynamic_cast< const SvgMaskNode* >(mrOwner.getDocument().findSvgNodeById(getMaskXLink())); const SvgMaskNode* mpMask = dynamic_cast< const SvgMaskNode* >(mrOwner.getDocument().findSvgNodeById(getMaskXLink()));
...@@ -1193,7 +1193,7 @@ namespace svgio ...@@ -1193,7 +1193,7 @@ namespace svgio
{ {
setFill(aSvgPaint); setFill(aSvgPaint);
} }
else if(aURL.getLength()) else if(!aURL.isEmpty())
{ {
const SvgNode* pNode = mrOwner.getDocument().findSvgNodeById(aURL); const SvgNode* pNode = mrOwner.getDocument().findSvgNodeById(aURL);
...@@ -1226,7 +1226,7 @@ namespace svgio ...@@ -1226,7 +1226,7 @@ namespace svgio
} }
case SVGTokenFillRule: case SVGTokenFillRule:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
if(aContent.match(commonStrings::aStrNonzero)) if(aContent.match(commonStrings::aStrNonzero))
{ {
...@@ -1248,7 +1248,7 @@ namespace svgio ...@@ -1248,7 +1248,7 @@ namespace svgio
{ {
setStroke(aSvgPaint); setStroke(aSvgPaint);
} }
else if(aURL.getLength()) else if(!aURL.isEmpty())
{ {
const SvgNode* pNode = mrOwner.getDocument().findSvgNodeById(aURL); const SvgNode* pNode = mrOwner.getDocument().findSvgNodeById(aURL);
...@@ -1268,7 +1268,7 @@ namespace svgio ...@@ -1268,7 +1268,7 @@ namespace svgio
} }
case SVGTokenStrokeDasharray: case SVGTokenStrokeDasharray:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static rtl::OUString aStrNone(rtl::OUString::createFromAscii("none")); static rtl::OUString aStrNone(rtl::OUString::createFromAscii("none"));
SvgNumberVector aVector; SvgNumberVector aVector;
...@@ -1303,7 +1303,7 @@ namespace svgio ...@@ -1303,7 +1303,7 @@ namespace svgio
} }
case SVGTokenStrokeLinecap: case SVGTokenStrokeLinecap:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrButt(OUString::createFromAscii("butt")); static OUString aStrButt(OUString::createFromAscii("butt"));
static OUString aStrRound(OUString::createFromAscii("round")); static OUString aStrRound(OUString::createFromAscii("round"));
...@@ -1326,7 +1326,7 @@ namespace svgio ...@@ -1326,7 +1326,7 @@ namespace svgio
} }
case SVGTokenStrokeLinejoin: case SVGTokenStrokeLinejoin:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrMiter(OUString::createFromAscii("miter")); static OUString aStrMiter(OUString::createFromAscii("miter"));
static OUString aStrRound(OUString::createFromAscii("round")); static OUString aStrRound(OUString::createFromAscii("round"));
...@@ -1440,7 +1440,7 @@ namespace svgio ...@@ -1440,7 +1440,7 @@ namespace svgio
} }
case SVGTokenFontStretch: case SVGTokenFontStretch:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrNormal(OUString::createFromAscii("normal")); static OUString aStrNormal(OUString::createFromAscii("normal"));
static OUString aStrWider(OUString::createFromAscii("wider")); static OUString aStrWider(OUString::createFromAscii("wider"));
...@@ -1503,7 +1503,7 @@ namespace svgio ...@@ -1503,7 +1503,7 @@ namespace svgio
} }
case SVGTokenFontStyle: case SVGTokenFontStyle:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrNormal(OUString::createFromAscii("normal")); static OUString aStrNormal(OUString::createFromAscii("normal"));
static OUString aStrItalic(OUString::createFromAscii("italic")); static OUString aStrItalic(OUString::createFromAscii("italic"));
...@@ -1526,7 +1526,7 @@ namespace svgio ...@@ -1526,7 +1526,7 @@ namespace svgio
} }
case SVGTokenFontVariant: case SVGTokenFontVariant:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrNormal(OUString::createFromAscii("normal")); static OUString aStrNormal(OUString::createFromAscii("normal"));
static OUString aStrSmallCaps(OUString::createFromAscii("small-caps")); static OUString aStrSmallCaps(OUString::createFromAscii("small-caps"));
...@@ -1544,7 +1544,7 @@ namespace svgio ...@@ -1544,7 +1544,7 @@ namespace svgio
} }
case SVGTokenFontWeight: case SVGTokenFontWeight:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrNormal(OUString::createFromAscii("normal")); static OUString aStrNormal(OUString::createFromAscii("normal"));
static OUString aStrBold(OUString::createFromAscii("bold")); static OUString aStrBold(OUString::createFromAscii("bold"));
...@@ -1617,7 +1617,7 @@ namespace svgio ...@@ -1617,7 +1617,7 @@ namespace svgio
} }
case SVGTokenTextDecoration: case SVGTokenTextDecoration:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrNone(OUString::createFromAscii("none")); static OUString aStrNone(OUString::createFromAscii("none"));
static OUString aStrUnderline(OUString::createFromAscii("underline")); static OUString aStrUnderline(OUString::createFromAscii("underline"));
...@@ -1658,7 +1658,7 @@ namespace svgio ...@@ -1658,7 +1658,7 @@ namespace svgio
} }
case SVGTokenTextAnchor: case SVGTokenTextAnchor:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrStart(OUString::createFromAscii("start")); static OUString aStrStart(OUString::createFromAscii("start"));
static OUString aStrMiddle(OUString::createFromAscii("middle")); static OUString aStrMiddle(OUString::createFromAscii("middle"));
...@@ -1681,7 +1681,7 @@ namespace svgio ...@@ -1681,7 +1681,7 @@ namespace svgio
} }
case SVGTokenTextAlign: case SVGTokenTextAlign:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrLeft(OUString::createFromAscii("left")); static OUString aStrLeft(OUString::createFromAscii("left"));
static OUString aStrRight(OUString::createFromAscii("right")); static OUString aStrRight(OUString::createFromAscii("right"));
...@@ -1750,7 +1750,7 @@ namespace svgio ...@@ -1750,7 +1750,7 @@ namespace svgio
} }
case SVGTokenClipRule: case SVGTokenClipRule:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
if(aContent.match(commonStrings::aStrNonzero)) if(aContent.match(commonStrings::aStrNonzero))
{ {
...@@ -2426,7 +2426,7 @@ namespace svgio ...@@ -2426,7 +2426,7 @@ namespace svgio
OUString SvgStyleAttributes::getMarkerStartXLink() const OUString SvgStyleAttributes::getMarkerStartXLink() const
{ {
if(maMarkerStartXLink.getLength()) if(!maMarkerStartXLink.isEmpty())
{ {
return maMarkerStartXLink; return maMarkerStartXLink;
} }
...@@ -2447,7 +2447,7 @@ namespace svgio ...@@ -2447,7 +2447,7 @@ namespace svgio
{ {
const OUString aMarker(getMarkerStartXLink()); const OUString aMarker(getMarkerStartXLink());
if(aMarker.getLength()) if(!aMarker.isEmpty())
{ {
const_cast< SvgStyleAttributes* >(this)->mpMarkerStartXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerStartXLink())); const_cast< SvgStyleAttributes* >(this)->mpMarkerStartXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerStartXLink()));
} }
...@@ -2458,7 +2458,7 @@ namespace svgio ...@@ -2458,7 +2458,7 @@ namespace svgio
OUString SvgStyleAttributes::getMarkerMidXLink() const OUString SvgStyleAttributes::getMarkerMidXLink() const
{ {
if(maMarkerMidXLink.getLength()) if(!maMarkerMidXLink.isEmpty())
{ {
return maMarkerMidXLink; return maMarkerMidXLink;
} }
...@@ -2479,7 +2479,7 @@ namespace svgio ...@@ -2479,7 +2479,7 @@ namespace svgio
{ {
const OUString aMarker(getMarkerMidXLink()); const OUString aMarker(getMarkerMidXLink());
if(aMarker.getLength()) if(!aMarker.isEmpty())
{ {
const_cast< SvgStyleAttributes* >(this)->mpMarkerMidXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerMidXLink())); const_cast< SvgStyleAttributes* >(this)->mpMarkerMidXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerMidXLink()));
} }
...@@ -2490,7 +2490,7 @@ namespace svgio ...@@ -2490,7 +2490,7 @@ namespace svgio
OUString SvgStyleAttributes::getMarkerEndXLink() const OUString SvgStyleAttributes::getMarkerEndXLink() const
{ {
if(maMarkerEndXLink.getLength()) if(!maMarkerEndXLink.isEmpty())
{ {
return maMarkerEndXLink; return maMarkerEndXLink;
} }
...@@ -2511,7 +2511,7 @@ namespace svgio ...@@ -2511,7 +2511,7 @@ namespace svgio
{ {
const OUString aMarker(getMarkerEndXLink()); const OUString aMarker(getMarkerEndXLink());
if(aMarker.getLength()) if(!aMarker.isEmpty())
{ {
const_cast< SvgStyleAttributes* >(this)->mpMarkerEndXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerEndXLink())); const_cast< SvgStyleAttributes* >(this)->mpMarkerEndXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerEndXLink()));
} }
......
...@@ -54,7 +54,7 @@ namespace svgio ...@@ -54,7 +54,7 @@ namespace svgio
{ {
case SVGTokenType: case SVGTokenType:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrTextCss(OUString::createFromAscii("text/css")); static OUString aStrTextCss(OUString::createFromAscii("text/css"));
...@@ -88,14 +88,14 @@ namespace svgio ...@@ -88,14 +88,14 @@ namespace svgio
copyToLimiter(aContent, sal_Unicode('{'), nPos, aTokenValue, nLen); copyToLimiter(aContent, sal_Unicode('{'), nPos, aTokenValue, nLen);
const OUString aStyleName = aTokenValue.makeStringAndClear().trim(); const OUString aStyleName = aTokenValue.makeStringAndClear().trim();
if(aStyleName.getLength() && nPos < nLen) if(!aStyleName.isEmpty() && nPos < nLen)
{ {
skip_char(aContent, sal_Unicode(' '), sal_Unicode('{'), nPos, nLen); skip_char(aContent, sal_Unicode(' '), sal_Unicode('{'), nPos, nLen);
copyToLimiter(aContent, sal_Unicode('}'), nPos, aTokenValue, nLen); copyToLimiter(aContent, sal_Unicode('}'), nPos, aTokenValue, nLen);
skip_char(aContent, sal_Unicode(' '), sal_Unicode('}'), nPos, nLen); skip_char(aContent, sal_Unicode(' '), sal_Unicode('}'), nPos, nLen);
const OUString aStyleContent = aTokenValue.makeStringAndClear().trim(); const OUString aStyleContent = aTokenValue.makeStringAndClear().trim();
if(aStyleContent.getLength()) if(!aStyleContent.isEmpty())
{ {
// create new style // create new style
SvgStyleAttributes* pNewStyle = new SvgStyleAttributes(*this); SvgStyleAttributes* pNewStyle = new SvgStyleAttributes(*this);
......
...@@ -159,7 +159,7 @@ namespace svgio ...@@ -159,7 +159,7 @@ namespace svgio
const OUString aTrimmedChars(aText.copy(nIndex, nLength).trim()); const OUString aTrimmedChars(aText.copy(nIndex, nLength).trim());
const double fEndPos(mfPosition + fSnippetWidth); const double fEndPos(mfPosition + fSnippetWidth);
if(aTrimmedChars.getLength() && (mfPosition < mfBasegfxPathLength || fEndPos > 0.0)) if(!aTrimmedChars.isEmpty() && (mfPosition < mfBasegfxPathLength || fEndPos > 0.0))
{ {
const double fHalfSnippetWidth(fSnippetWidth * 0.5); const double fHalfSnippetWidth(fSnippetWidth * 0.5);
...@@ -300,7 +300,7 @@ namespace svgio ...@@ -300,7 +300,7 @@ namespace svgio
} }
case SVGTokenMethod: case SVGTokenMethod:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrAlign(OUString::createFromAscii("align")); static OUString aStrAlign(OUString::createFromAscii("align"));
static OUString aStrStretch(OUString::createFromAscii("stretch")); static OUString aStrStretch(OUString::createFromAscii("stretch"));
...@@ -318,7 +318,7 @@ namespace svgio ...@@ -318,7 +318,7 @@ namespace svgio
} }
case SVGTokenSpacing: case SVGTokenSpacing:
{ {
if(aContent.getLength()) if(!aContent.isEmpty())
{ {
static OUString aStrAuto(OUString::createFromAscii("auto")); static OUString aStrAuto(OUString::createFromAscii("auto"));
static OUString aStrExact(OUString::createFromAscii("exact")); static OUString aStrExact(OUString::createFromAscii("exact"));
......
...@@ -384,7 +384,7 @@ namespace svgio ...@@ -384,7 +384,7 @@ namespace svgio
} }
} }
if(aNum.getLength()) if(!aNum.isEmpty())
{ {
rtl_math_ConversionStatus eStatus; rtl_math_ConversionStatus eStatus;
...@@ -1248,7 +1248,7 @@ namespace svgio ...@@ -1248,7 +1248,7 @@ namespace svgio
OUStringBuffer aTokenName; OUStringBuffer aTokenName;
copyString(rCandidate, nPos, aTokenName, nLen); copyString(rCandidate, nPos, aTokenName, nLen);
if(aTokenName.getLength()) if(!aTokenName.isEmpty())
{ {
switch(StrToSVGToken(aTokenName.makeStringAndClear())) switch(StrToSVGToken(aTokenName.makeStringAndClear()))
{ {
...@@ -1370,7 +1370,7 @@ namespace svgio ...@@ -1370,7 +1370,7 @@ namespace svgio
skip_char(rCandidate, sal_Unicode(','), sal_Unicode(' '), nPos, nLen); skip_char(rCandidate, sal_Unicode(','), sal_Unicode(' '), nPos, nLen);
const OUString aString = aTokenValue.makeStringAndClear(); const OUString aString = aTokenValue.makeStringAndClear();
if(aString.getLength()) if(!aString.isEmpty())
{ {
rSvgStringVector.push_back(aString); rSvgStringVector.push_back(aString);
} }
...@@ -1406,7 +1406,7 @@ namespace svgio ...@@ -1406,7 +1406,7 @@ namespace svgio
skip_char(rCandidate, sal_Unicode(' '), sal_Unicode(';'), nPos, nLen); skip_char(rCandidate, sal_Unicode(' '), sal_Unicode(';'), nPos, nLen);
rMimeType = aBuffer.makeStringAndClear(); rMimeType = aBuffer.makeStringAndClear();
if(rMimeType.getLength() && nPos < nLen) if(!rMimeType.isEmpty() && nPos < nLen)
{ {
static OUString aStrImage(OUString::createFromAscii("image")); static OUString aStrImage(OUString::createFromAscii("image"));
......
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