1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 18:29:23 +02:00

CSS processing (in progress, alignment style setting works)

This commit is contained in:
Nikolay Pultsin 2012-05-08 13:53:17 +01:00
parent fce4306ea0
commit 094afe8652
22 changed files with 230 additions and 51 deletions

View file

@ -511,7 +511,7 @@ bool XHTMLReader::readFile(const ZLFile &file, const std::string &referenceName)
void XHTMLReader::addStyleEntry(const std::string tag, const std::string aClass) {
shared_ptr<ZLTextStyleEntry> entry = myStyleSheetTable.control(tag, aClass);
if (!entry.isNull()) {
myModelReader.addControl(*entry);
myModelReader.addStyleEntry(*entry);
myStyleEntryStack.push_back(entry);
}
}
@ -546,7 +546,7 @@ void XHTMLReader::startElementHandler(const char *tag, const char **attributes)
if (style != 0) {
ZLLogger::Instance().println("CSS", std::string("parsing style attribute: ") + style);
shared_ptr<ZLTextStyleEntry> entry = myStyleParser.parseString(style);
myModelReader.addControl(*entry);
myModelReader.addStyleEntry(*entry);
myStyleEntryStack.push_back(entry);
}
myCSSStack.push_back(myStyleEntryStack.size() - sizeBefore);
@ -554,7 +554,7 @@ void XHTMLReader::startElementHandler(const char *tag, const char **attributes)
void XHTMLReader::endElementHandler(const char *tag) {
for (int i = myCSSStack.back(); i > 0; --i) {
myModelReader.addControl(REGULAR, false);
myModelReader.addStyleCloseEntry();
}
myStylesToRemove = myCSSStack.back();
myCSSStack.pop_back();
@ -580,7 +580,7 @@ void XHTMLReader::beginParagraph() {
myModelReader.beginParagraph();
bool doBlockSpaceBefore = false;
for (std::vector<shared_ptr<ZLTextStyleEntry> >::const_iterator it = myStyleEntryStack.begin(); it != myStyleEntryStack.end(); ++it) {
myModelReader.addControl(**it);
myModelReader.addStyleEntry(**it);
doBlockSpaceBefore =
doBlockSpaceBefore ||
(*it)->isFeatureSupported(ZLTextStyleEntry::LENGTH_SPACE_BEFORE);
@ -593,7 +593,7 @@ void XHTMLReader::beginParagraph() {
0,
ZLTextStyleEntry::SIZE_UNIT_PIXEL
);
myModelReader.addControl(blockingEntry);
myModelReader.addStyleEntry(blockingEntry);
}
}
@ -611,10 +611,10 @@ void XHTMLReader::endParagraph() {
0,
ZLTextStyleEntry::SIZE_UNIT_PIXEL
);
myModelReader.addControl(blockingEntry);
myModelReader.addStyleEntry(blockingEntry);
}
for (; myStylesToRemove > 0; --myStylesToRemove) {
myModelReader.addControl(*myStyleEntryStack.back());
myModelReader.addStyleEntry(*myStyleEntryStack.back());
myStyleEntryStack.pop_back();
}
myModelReader.endParagraph();