23#include <osl/diagnose.h>
58 if(!aContent.isEmpty())
78 if(aSelectors.empty())
81 std::vector< OUString > aSelectorParts;
82 const sal_Int32 nLen(aSelectors.size());
84 OUStringBuffer aToken;
89 const sal_Int32 nInitPos(
nPos);
92 const OUString aSelectorPart(
o3tl::trim(aToken));
95 if(!aSelectorPart.isEmpty())
97 aSelectorParts.push_back(aSelectorPart);
102 OSL_ENSURE(
false,
"Could not interpret on current position (!)");
107 if(aSelectorParts.empty())
110 OUStringBuffer aConcatenatedSelector;
113 for(
const auto &
a : aSelectorParts)
115 aConcatenatedSelector.append(
a);
134 const_cast< SvgDocument&
>(
getDocument()).addSvgStyleAttributesToMapper(aConcatenatedSelector.makeStringAndClear(), rNewStyle);
141 if(aSelectors.empty() || aContent.empty())
145 const sal_Int32 nLen(aSelectors.size());
147 OUStringBuffer aToken;
151 const sal_Int32 nInitPos(
nPos);
155 const OUString aSingleName(
o3tl::trim(aToken));
164 aIterator->second = std::make_unique<SvgStyleAttributes>(*
this);
166 const std::unique_ptr<SvgStyleAttributes>& pCurrentStyle = aIterator->second;
169 pCurrentStyle->readCssStyle(aContent);
171 if(aSingleName.getLength())
178 OSL_ENSURE(
false,
"Could not interpret on current position (!)");
186 const sal_Int32 nLen(aSelectorsAndContent.size());
192 OUStringBuffer aToken;
197 const sal_Int32 nInitPos(
nPos);
202 const OUString aSelectors(
o3tl::trim(aToken));
206 if(!aSelectors.isEmpty() &&
nPos < nLen)
216 if(!aSelectors.isEmpty() && !aContent.isEmpty())
223 OSL_ENSURE(
false,
"Could not interpret on current position (!)");
virtual bool supportsParentStyle() const
#i125258# tell if this node is allowed to have a parent style (e.g. defs do not)
virtual void parseAttribute(const OUString &rTokenName, SVGToken aSVGToken, const OUString &aContent)
const SvgDocument & getDocument() const
void setTextCss(bool bNew)
SvgStyleNode(SvgDocument &rDocument, SvgNode *pParent)
virtual bool supportsParentStyle() const override
#i125258# tell if this node is allowed to have a parent style (e.g. defs do not)
virtual void parseAttribute(const OUString &rTokenName, SVGToken aSVGToken, const OUString &aContent) override
std::unordered_map< OUString, std::unique_ptr< SvgStyleAttributes > > maSvgStyleAttributes
use styles
void addCssStyleSheet(std::u16string_view aSelectors, const SvgStyleAttributes &rNewStyle)
CssStyleSheet add helpers.
bool isTextCss() const
textCss access
std::basic_string_view< charT, traits > trim(std::basic_string_view< charT, traits > str)
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
void skip_char(std::u16string_view rCandidate, sal_Unicode nChar, sal_Int32 &nPos, const sal_Int32 nLen)
void copyToLimiter(std::u16string_view rCandidate, sal_Unicode nLimiter, sal_Int32 &nPos, OUStringBuffer &rTarget, const sal_Int32 nLen)