svgstylenode.cxx (4374d266) svgstylenode.cxx (9d01bcde)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 87 unchanged lines hidden (view full) ---

96
97 if(nLen)
98 {
99 sal_Int32 nPos(0);
100 rtl::OUStringBuffer aTokenValue;
101
102 while(nPos < nLen)
103 {
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 87 unchanged lines hidden (view full) ---

96
97 if(nLen)
98 {
99 sal_Int32 nPos(0);
100 rtl::OUStringBuffer aTokenValue;
101
102 while(nPos < nLen)
103 {
104 // read the full style node names (may be multiple) and put to aStyleName
104 const sal_Int32 nInitPos(nPos);
105 const sal_Int32 nInitPos(nPos);
105 skip_char(aContent, sal_Unicode(' '), sal_Unicode('#'), nPos, nLen);
106 skip_char(aContent, sal_Unicode(' '), nPos, nLen);
106 copyToLimiter(aContent, sal_Unicode('{'), nPos, aTokenValue, nLen);
107 copyToLimiter(aContent, sal_Unicode('{'), nPos, aTokenValue, nLen);
107 const rtl::OUString aStyleName = aTokenValue.makeStringAndClear().trim();
108 skip_char(aContent, sal_Unicode(' '), sal_Unicode('{'), nPos, nLen);
108
109
109 if(aStyleName.getLength() && nPos < nLen)
110 const rtl::OUString aStyleName(aTokenValue.makeStringAndClear().trim());
111 const sal_Int32 nLen2(aStyleName.getLength());
112 std::vector< rtl::OUString > aStyleNames;
113
114 if(nLen2)
110 {
115 {
111 skip_char(aContent, sal_Unicode(' '), sal_Unicode('{'), nPos, nLen);
116 // extract names
117 sal_Int32 nPos2(0);
118 rtl::OUStringBuffer aSingleName;
119
120 while(nPos2 < nLen2)
121 {
122 skip_char(aStyleName, sal_Unicode('#'), nPos2, nLen2);
123 copyToLimiter(aStyleName, sal_Unicode(' '), nPos2, aSingleName, nLen2);
124 skip_char(aStyleName, sal_Unicode(' '), nPos2, nLen2);
125
126 const rtl::OUString aOUSingleName(aSingleName.makeStringAndClear().trim());
127
128 if(aOUSingleName.getLength())
129 {
130 aStyleNames.push_back(aOUSingleName);
131 }
132 }
133 }
134
135 if(aStyleNames.size() && nPos < nLen)
136 {
112 copyToLimiter(aContent, sal_Unicode('}'), nPos, aTokenValue, nLen);
113 skip_char(aContent, sal_Unicode(' '), sal_Unicode('}'), nPos, nLen);
137 copyToLimiter(aContent, sal_Unicode('}'), nPos, aTokenValue, nLen);
138 skip_char(aContent, sal_Unicode(' '), sal_Unicode('}'), nPos, nLen);
114 const rtl::OUString aStyleContent = aTokenValue.makeStringAndClear().trim();
139 const rtl::OUString aStyleContent(aTokenValue.makeStringAndClear().trim());
115
116 if(aStyleContent.getLength())
117 {
118 // create new style
119 SvgStyleAttributes* pNewStyle = new SvgStyleAttributes(*this);
120 maSvgStyleAttributes.push_back(pNewStyle);
121
122 // fill with content
123 pNewStyle->readStyle(aStyleContent);
124
140
141 if(aStyleContent.getLength())
142 {
143 // create new style
144 SvgStyleAttributes* pNewStyle = new SvgStyleAttributes(*this);
145 maSvgStyleAttributes.push_back(pNewStyle);
146
147 // fill with content
148 pNewStyle->readStyle(aStyleContent);
149
125 // register new style at document
126 const_cast< SvgDocument& >(getDocument()).addSvgStyleAttributesToMapper(aStyleName, *pNewStyle);
150 // concatenate combined style name
151 rtl::OUString aConcatenatedStyleName;
152
153 for(sal_uInt32 a(0); a < aStyleNames.size(); a++)
154 {
155 aConcatenatedStyleName += aStyleNames[a];
156 }
157
158 // register new style at document for (evtl. concatenated) stylename
159 const_cast< SvgDocument& >(getDocument()).addSvgStyleAttributesToMapper(aConcatenatedStyleName, *pNewStyle);
127 }
128 }
129
130 if(nInitPos == nPos)
131 {
132 OSL_ENSURE(false, "Could not interpret on current position (!)");
133 nPos++;
134 }
135 }
136 }
137 }
138
139 } // end of namespace svgreader
140} // end of namespace svgio
141
142//////////////////////////////////////////////////////////////////////////////
143// eof
160 }
161 }
162
163 if(nInitPos == nPos)
164 {
165 OSL_ENSURE(false, "Could not interpret on current position (!)");
166 nPos++;
167 }
168 }
169 }
170 }
171
172 } // end of namespace svgreader
173} // end of namespace svgio
174
175//////////////////////////////////////////////////////////////////////////////
176// eof