コード例 #1
0
OleMainStream::Style OleMainStream::getStyleFromStylesheet(unsigned int styleId, const StyleSheet &stylesheet) {
	//TODO optimize it: StyleSheet can be map structure with styleId key
	Style style;
	if (styleId != Style::STYLE_INVALID && styleId != Style::STYLE_NIL && styleId != Style::STYLE_USER) {
		for (std::size_t index = 0; index < stylesheet.size(); ++index) {
			if (stylesheet.at(index).StyleIdCurrent == styleId) {
				return stylesheet.at(index);
			}
		}
	}
	style.StyleIdCurrent = styleId;
	return style;
}
コード例 #2
0
int OleMainStream::getStyleIndex(unsigned int styleId, const std::vector<bool> &isFilled, const StyleSheet &stylesheet) {
	//TODO optimize it: StyleSheet can be map structure with styleId key
	//in that case, this method will be excess
	if (styleId == Style::STYLE_INVALID) {
		return -1;
	}
	for (int index = 0; index < (int)stylesheet.size(); ++index) {
		if (isFilled.at(index) && stylesheet.at(index).StyleIdCurrent == styleId) {
			return index;
		}
	}
	return -1;
}