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

new options: "apply/ignore CSS defined values"

This commit is contained in:
Nikolay Pultsin 2012-10-21 07:29:11 +04:00
parent ed74b9acf9
commit f117b0a3fb
39 changed files with 309 additions and 49 deletions

View file

@ -1,6 +1,7 @@
===== 1.6.3 (Oct ??, 2012) ===== ===== 1.6.3 (Oct ??, 2012) =====
* FBReader stores text position after setPageStart API method (useful for TTS plugin, code by Greg Kochaniak) * FBReader stores text position after setPageStart API method (useful for TTS plugin, code by Greg Kochaniak)
* MSWord doc plugin synchronized with the main branch * MSWord doc plugin synchronized with the main branch
* New options: apply/ignore values defined in CSS
===== 1.6.2 (Oct 13, 2012) ===== ===== 1.6.2 (Oct 13, 2012) =====
* Optimized animation speed * Optimized animation speed

View file

@ -507,6 +507,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Barvy a pozadí"> <node name="colors" value="Barvy a pozadí">
<node name="summary" value="Nastavení barev"/> <node name="summary" value="Nastavení barev"/>
<node name="background" value="Pozadí"> <node name="background" value="Pozadí">

View file

@ -501,6 +501,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Farben &amp; Hintergründe"> <node name="colors" value="Farben &amp; Hintergründe">
<node name="summary" value="Farben festlegen."/> <node name="summary" value="Farben festlegen."/>
<node name="background" value="Hintergrund"> <node name="background" value="Hintergrund">

View file

@ -507,6 +507,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS">
<node name="summary" value="Apply/ignore values defined in CSS"/>
<node name="fontSize" value="Font size">
<node name="summaryOn" value="Apply font size defined in CSS"/>
<node name="summaryOff" value="Ignore font size defined in CSS"/>
</node>
<node name="textAlignment" value="Text alignment">
<node name="summaryOn" value="Apply text alignment defined in CSS"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS"/>
</node>
</node>
<node name="colors" value="Colors &amp; wallpapers"> <node name="colors" value="Colors &amp; wallpapers">
<node name="summary" value="Color settings"/> <node name="summary" value="Color settings"/>
<node name="background" value="Background"> <node name="background" value="Background">

View file

@ -500,6 +500,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Colores y fondos de pantalla"> <node name="colors" value="Colores y fondos de pantalla">
<node name="summary" value="Preferencias de color"/> <node name="summary" value="Preferencias de color"/>
<node name="background" value="Fondo"> <node name="background" value="Fondo">

View file

@ -500,6 +500,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Couleurs &amp; fonds d'écran"> <node name="colors" value="Couleurs &amp; fonds d'écran">
<node name="summary" value="Paramètres des couleurs"/> <node name="summary" value="Paramètres des couleurs"/>
<node name="background" value="Arrière-plan"> <node name="background" value="Arrière-plan">

View file

@ -497,6 +497,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Cores e fondos de pantalla"> <node name="colors" value="Cores e fondos de pantalla">
<node name="summary" value="Preferencias de cor"/> <node name="summary" value="Preferencias de cor"/>
<node name="background" value="Fondo"> <node name="background" value="Fondo">

View file

@ -497,6 +497,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Színek és háttérképek"> <node name="colors" value="Színek és háttérképek">
<node name="summary" value="Színbeállítások"/> <node name="summary" value="Színbeállítások"/>
<node name="background" value="Háttér"> <node name="background" value="Háttér">

View file

@ -498,6 +498,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Colori &amp; sfondi"> <node name="colors" value="Colori &amp; sfondi">
<node name="summary" value="Impostazioni dei colori"/> <node name="summary" value="Impostazioni dei colori"/>
<node name="background" value="Sfondo"> <node name="background" value="Sfondo">

View file

@ -507,6 +507,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Farger og bakgrunnsbilder"> <node name="colors" value="Farger og bakgrunnsbilder">
<node name="summary" value="Fargeinnstillinger"/> <node name="summary" value="Fargeinnstillinger"/>
<node name="background" value="Bakgrunn"> <node name="background" value="Bakgrunn">

View file

@ -497,6 +497,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Kleuren"> <node name="colors" value="Kleuren">
<node name="summary" value="Kleurinstellingen"/> <node name="summary" value="Kleurinstellingen"/>
<node name="background" value="Achtergrond"> <node name="background" value="Achtergrond">

View file

@ -497,6 +497,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Kolory i tapety"> <node name="colors" value="Kolory i tapety">
<node name="summary" value="Ustawienia kolorów"/> <node name="summary" value="Ustawienia kolorów"/>
<node name="background" value="Tło"> <node name="background" value="Tło">

View file

@ -509,6 +509,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Cores &amp; papéis de parede"> <node name="colors" value="Cores &amp; papéis de parede">
<node name="summary" value="Configurações de cor"/> <node name="summary" value="Configurações de cor"/>
<node name="background" value="Fundo"> <node name="background" value="Fundo">

View file

@ -497,6 +497,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Culori si imagini de fundal"> <node name="colors" value="Culori si imagini de fundal">
<node name="summary" value="Setarile de culoare"/> <node name="summary" value="Setarile de culoare"/>
<node name="background" value="Fundal"> <node name="background" value="Fundal">

View file

@ -512,6 +512,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Цвета и обои"> <node name="colors" value="Цвета и обои">
<node name="summary" value="Настройки цвета"/> <node name="summary" value="Настройки цвета"/>
<node name="background" value="Фон"> <node name="background" value="Фон">

View file

@ -507,6 +507,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Боје и позадине"> <node name="colors" value="Боје и позадине">
<node name="summary" value="Подешавања боја."/> <node name="summary" value="Подешавања боја."/>
<node name="background" value="Позадина"> <node name="background" value="Позадина">

View file

@ -497,6 +497,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="สี &amp; วอลล์เปเปอร์"> <node name="colors" value="สี &amp; วอลล์เปเปอร์">
<node name="summary" value="การตั้งค่าสี"/> <node name="summary" value="การตั้งค่าสี"/>
<node name="background" value="พื้นหลัง"> <node name="background" value="พื้นหลัง">

View file

@ -507,6 +507,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Renkler &amp; duvarkağıtları"> <node name="colors" value="Renkler &amp; duvarkağıtları">
<node name="summary" value="Renk ayarları"/> <node name="summary" value="Renk ayarları"/>
<node name="background" value="Arkaplan"> <node name="background" value="Arkaplan">

View file

@ -497,6 +497,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Кольори &amp; шпалери"> <node name="colors" value="Кольори &amp; шпалери">
<node name="summary" value="Налаштування кольору"/> <node name="summary" value="Налаштування кольору"/>
<node name="background" value="Фон"> <node name="background" value="Фон">

View file

@ -497,6 +497,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="Colors &amp; wallpapers" toBeTranslated="true"> <node name="colors" value="Colors &amp; wallpapers" toBeTranslated="true">
<node name="summary" value="Color settings"/> <node name="summary" value="Color settings"/>
<node name="background" value="Nền"> <node name="background" value="Nền">

View file

@ -497,6 +497,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="颜色 &amp; 墙纸"> <node name="colors" value="颜色 &amp; 墙纸">
<node name="summary" value="设置颜色"/> <node name="summary" value="设置颜色"/>
<node name="background" value="背景色"> <node name="background" value="背景色">

View file

@ -502,6 +502,17 @@
</node> </node>
</node> </node>
</node> </node>
<node name="css" value="CSS" toBeTranslated="true">
<node name="summary" value="Apply/ignore values defined in CSS" toBeTranslated="true"/>
<node name="fontSize" value="Font size" toBeTranslated="true">
<node name="summaryOn" value="Apply font size defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore font size defined in CSS" toBeTranslated="true"/>
</node>
<node name="textAlignment" value="Text alignment" toBeTranslated="true">
<node name="summaryOn" value="Apply text alignment defined in CSS" toBeTranslated="true"/>
<node name="summaryOff" value="Ignore text alignment defined in CSS" toBeTranslated="true"/>
</node>
</node>
<node name="colors" value="顏色及壁紙"> <node name="colors" value="顏色及壁紙">
<node name="summary" value="顏色設定"/> <node name="summary" value="顏色設定"/>
<node name="background" value="背景"> <node name="background" value="背景">

View file

@ -148,7 +148,7 @@ const std::vector<std::string> &StyleSheetTable::values(const AttributeMap &map,
} }
shared_ptr<ZLTextStyleEntry> StyleSheetTable::createControl(const AttributeMap &styles) { shared_ptr<ZLTextStyleEntry> StyleSheetTable::createControl(const AttributeMap &styles) {
shared_ptr<ZLTextStyleEntry> entry = new ZLTextStyleEntry(); shared_ptr<ZLTextStyleEntry> entry = new ZLTextStyleEntry(ZLTextStyleEntry::STYLE_CSS_ENTRY);
const std::vector<std::string> &alignment = values(styles, "text-align"); const std::vector<std::string> &alignment = values(styles, "text-align");
if (!alignment.empty()) { if (!alignment.empty()) {

View file

@ -274,7 +274,7 @@ void DocBookReader::handleParagraphStyle(const OleMainStream::Style &styleInfo)
if (styleInfo.HasPageBreakBefore) { if (styleInfo.HasPageBreakBefore) {
handlePageBreak(); handlePageBreak();
} }
shared_ptr<ZLTextStyleEntry> entry = new ZLTextStyleEntry(); shared_ptr<ZLTextStyleEntry> entry = new ZLTextStyleEntry(ZLTextStyleEntry::STYLE_OTHER_ENTRY);
switch (styleInfo.Alignment) { switch (styleInfo.Alignment) {
default: // in that case, use default alignment type default: // in that case, use default alignment type

View file

@ -224,7 +224,7 @@ void RtfBookReader::setEncoding(int) {
} }
void RtfBookReader::setAlignment() { void RtfBookReader::setAlignment() {
ZLTextStyleEntry entry; ZLTextStyleEntry entry(ZLTextStyleEntry::STYLE_OTHER_ENTRY);
entry.setAlignmentType(myState.Alignment); entry.setAlignmentType(myState.Alignment);
myBookReader.addStyleEntry(entry); myBookReader.addStyleEntry(entry);
// TODO: call addStyleCloseEntry somewhere (?) // TODO: call addStyleCloseEntry somewhere (?)

View file

@ -598,7 +598,7 @@ void XHTMLReader::beginParagraph() {
} }
if (doBlockSpaceBefore) { if (doBlockSpaceBefore) {
ZLTextStyleEntry blockingEntry; ZLTextStyleEntry blockingEntry(ZLTextStyleEntry::STYLE_CSS_ENTRY);
blockingEntry.setLength( blockingEntry.setLength(
ZLTextStyleEntry::LENGTH_SPACE_BEFORE, ZLTextStyleEntry::LENGTH_SPACE_BEFORE,
0, 0,
@ -616,7 +616,7 @@ void XHTMLReader::endParagraph() {
(*it)->isFeatureSupported(ZLTextStyleEntry::LENGTH_SPACE_AFTER); (*it)->isFeatureSupported(ZLTextStyleEntry::LENGTH_SPACE_AFTER);
} }
if (doBlockSpaceAfter) { if (doBlockSpaceAfter) {
ZLTextStyleEntry blockingEntry; ZLTextStyleEntry blockingEntry(ZLTextStyleEntry::STYLE_CSS_ENTRY);
blockingEntry.setLength( blockingEntry.setLength(
ZLTextStyleEntry::LENGTH_SPACE_AFTER, ZLTextStyleEntry::LENGTH_SPACE_AFTER,
0, 0,

View file

@ -270,7 +270,7 @@ void ZLTextModel::addStyleEntry(const ZLTextStyleEntry &entry) {
myLastEntryStart = myAllocator->allocate(len); myLastEntryStart = myAllocator->allocate(len);
char *address = myLastEntryStart; char *address = myLastEntryStart;
*address++ = ZLTextParagraphEntry::STYLE_ENTRY; *address++ = entry.entryKind();
*address++ = 0; *address++ = 0;
address = ZLCachedMemoryAllocator::writeUInt16(address, entry.myFeatureMask); address = ZLCachedMemoryAllocator::writeUInt16(address, entry.myFeatureMask);

View file

@ -41,10 +41,11 @@ public:
IMAGE_ENTRY = 2, IMAGE_ENTRY = 2,
CONTROL_ENTRY = 3, CONTROL_ENTRY = 3,
HYPERLINK_CONTROL_ENTRY = 4, HYPERLINK_CONTROL_ENTRY = 4,
STYLE_ENTRY = 5, STYLE_CSS_ENTRY = 5,
STYLE_CLOSE_ENTRY = 6, STYLE_OTHER_ENTRY = 6,
FIXED_HSPACE_ENTRY = 7, STYLE_CLOSE_ENTRY = 7,
RESET_BIDI_ENTRY = 8, FIXED_HSPACE_ENTRY = 8,
RESET_BIDI_ENTRY = 9,
}; };
protected: protected:

View file

@ -77,10 +77,12 @@ private:
}; };
public: public:
ZLTextStyleEntry(); ZLTextStyleEntry(unsigned char entryKind);
//ZLTextStyleEntry(char *address); //ZLTextStyleEntry(char *address);
~ZLTextStyleEntry(); ~ZLTextStyleEntry();
unsigned char entryKind() const;
bool isEmpty() const; bool isEmpty() const;
bool isFeatureSupported(Feature featureId) const; bool isFeatureSupported(Feature featureId) const;
@ -97,6 +99,7 @@ public:
void setFontFamily(const std::string &fontFamily); void setFontFamily(const std::string &fontFamily);
private: private:
unsigned char myEntryKind;
unsigned short myFeatureMask; unsigned short myFeatureMask;
LengthType myLengths[NUMBER_OF_LENGTHS]; LengthType myLengths[NUMBER_OF_LENGTHS];
@ -108,9 +111,11 @@ private:
friend class ZLTextModel; friend class ZLTextModel;
}; };
inline ZLTextStyleEntry::ZLTextStyleEntry() : myFeatureMask(0), myAlignmentType(ALIGN_UNDEFINED), mySupportedFontModifier(0), myFontModifier(0) {} inline ZLTextStyleEntry::ZLTextStyleEntry(unsigned char entryKind) : myEntryKind(entryKind), myFeatureMask(0), myAlignmentType(ALIGN_UNDEFINED), mySupportedFontModifier(0), myFontModifier(0) {}
inline ZLTextStyleEntry::~ZLTextStyleEntry() {} inline ZLTextStyleEntry::~ZLTextStyleEntry() {}
inline unsigned char ZLTextStyleEntry::entryKind() const { return myEntryKind; }
inline ZLTextStyleEntry::Metrics::Metrics(int fontSize, int fontXHeight, int fullWidth, int fullHeight) : FontSize(fontSize), FontXHeight(fontXHeight), FullWidth(fullWidth), FullHeight(fullHeight) {} inline ZLTextStyleEntry::Metrics::Metrics(int fontSize, int fontXHeight, int fullWidth, int fullHeight) : FontSize(fontSize), FontXHeight(fontXHeight), FullWidth(fullWidth), FullHeight(fullHeight) {}
inline bool ZLTextStyleEntry::isEmpty() const { return myFeatureMask == 0; } inline bool ZLTextStyleEntry::isEmpty() const { return myFeatureMask == 0; }

View file

@ -253,6 +253,10 @@ public class PreferenceActivity extends ZLPreferenceActivity {
final ZLPreferenceSet footerPreferences = new ZLPreferenceSet(); final ZLPreferenceSet footerPreferences = new ZLPreferenceSet();
final ZLPreferenceSet bgPreferences = new ZLPreferenceSet(); final ZLPreferenceSet bgPreferences = new ZLPreferenceSet();
final Screen cssScreen = createPreferenceScreen("css");
cssScreen.addOption(collection.UseCSSFontSizeOption, "fontSize");
cssScreen.addOption(collection.UseCSSTextAlignmentOption, "textAlignment");
final Screen colorsScreen = createPreferenceScreen("colors"); final Screen colorsScreen = createPreferenceScreen("colors");
colorsScreen.addPreference(new WallpaperPreference( colorsScreen.addPreference(new WallpaperPreference(
this, profile, colorsScreen.Resource, "background" this, profile, colorsScreen.Resource, "background"

View file

@ -32,7 +32,7 @@ class ChangeFontSizeAction extends FBAction {
@Override @Override
protected void run(Object ... params) { protected void run(Object ... params) {
ZLIntegerRangeOption option = final ZLIntegerRangeOption option =
ZLTextStyleCollection.Instance().getBaseStyle().FontSizeOption; ZLTextStyleCollection.Instance().getBaseStyle().FontSizeOption;
option.setValue(option.getValue() + myDelta); option.setValue(option.getValue() + myDelta);
Reader.clearTextCaches(); Reader.clearTextCaches();

View file

@ -25,10 +25,11 @@ public interface ZLTextParagraph {
byte IMAGE = 2; byte IMAGE = 2;
byte CONTROL = 3; byte CONTROL = 3;
byte HYPERLINK_CONTROL = 4; byte HYPERLINK_CONTROL = 4;
byte STYLE = 5; byte STYLE_CSS = 5;
byte STYLE_CLOSE = 6; byte STYLE_OTHER = 6;
byte FIXED_HSPACE = 7; byte STYLE_CLOSE = 7;
byte RESET_BIDI = 8; byte FIXED_HSPACE = 8;
byte RESET_BIDI = 9;
} }
interface EntryIterator { interface EntryIterator {

View file

@ -188,9 +188,13 @@ public class ZLTextPlainModel implements ZLTextModel, ZLTextStyleEntry.Feature {
case ZLTextParagraph.Entry.FIXED_HSPACE: case ZLTextParagraph.Entry.FIXED_HSPACE:
myFixedHSpaceLength = (short)data[dataOffset++]; myFixedHSpaceLength = (short)data[dataOffset++];
break; break;
case ZLTextParagraph.Entry.STYLE: case ZLTextParagraph.Entry.STYLE_CSS:
case ZLTextParagraph.Entry.STYLE_OTHER:
{ {
final ZLTextStyleEntry entry = new ZLTextStyleEntry(); final ZLTextStyleEntry entry =
type == ZLTextParagraph.Entry.STYLE_CSS
? new ZLTextCSSStyleEntry()
: new ZLTextOtherStyleEntry();
final short mask = (short)data[dataOffset++]; final short mask = (short)data[dataOffset++];
for (int i = 0; i < NUMBER_OF_LENGTHS; ++i) { for (int i = 0; i < NUMBER_OF_LENGTHS; ++i) {

View file

@ -21,7 +21,7 @@ package org.geometerplus.zlibrary.text.model;
import org.geometerplus.zlibrary.core.util.ZLBoolean3; import org.geometerplus.zlibrary.core.util.ZLBoolean3;
public final class ZLTextStyleEntry { public abstract class ZLTextStyleEntry {
public interface Feature { public interface Feature {
int LENGTH_LEFT_INDENT = 0; int LENGTH_LEFT_INDENT = 0;
int LENGTH_RIGHT_INDENT = 1; int LENGTH_RIGHT_INDENT = 1;
@ -76,14 +76,14 @@ public final class ZLTextStyleEntry {
return (mask & (1 << featureId)) != 0; return (mask & (1 << featureId)) != 0;
} }
public boolean isFeatureSupported(int featureId) { protected ZLTextStyleEntry() {
}
public final boolean isFeatureSupported(int featureId) {
return isFeatureSupported(myFeatureMask, featureId); return isFeatureSupported(myFeatureMask, featureId);
} }
public ZLTextStyleEntry() { final void setLength(int featureId, short size, byte unit) {
}
void setLength(int featureId, short size, byte unit) {
myFeatureMask |= 1 << featureId; myFeatureMask |= 1 << featureId;
myLengths[featureId] = new Length(size, unit); myLengths[featureId] = new Length(size, unit);
} }
@ -103,7 +103,7 @@ public final class ZLTextStyleEntry {
} }
} }
public int getLength(int featureId, ZLTextMetrics metrics) { public final int getLength(int featureId, ZLTextMetrics metrics) {
switch (myLengths[featureId].Unit) { switch (myLengths[featureId].Unit) {
default: default:
case SizeUnit.PIXEL: case SizeUnit.PIXEL:
@ -122,31 +122,31 @@ public final class ZLTextStyleEntry {
} }
} }
void setAlignmentType(byte alignmentType) { final void setAlignmentType(byte alignmentType) {
myFeatureMask |= 1 << Feature.ALIGNMENT_TYPE; myFeatureMask |= 1 << Feature.ALIGNMENT_TYPE;
myAlignmentType = alignmentType; myAlignmentType = alignmentType;
} }
public byte getAlignmentType() { public final byte getAlignmentType() {
return myAlignmentType; return myAlignmentType;
} }
void setFontFamily(String fontFamily) { final void setFontFamily(String fontFamily) {
myFeatureMask |= 1 << Feature.FONT_FAMILY; myFeatureMask |= 1 << Feature.FONT_FAMILY;
myFontFamily = fontFamily; myFontFamily = fontFamily;
} }
public String getFontFamily() { public final String getFontFamily() {
return myFontFamily; return myFontFamily;
} }
void setFontModifiers(byte supported, byte values) { final void setFontModifiers(byte supported, byte values) {
myFeatureMask |= 1 << Feature.FONT_STYLE_MODIFIER; myFeatureMask |= 1 << Feature.FONT_STYLE_MODIFIER;
mySupportedFontModifiers = supported; mySupportedFontModifiers = supported;
myFontModifiers = values; myFontModifiers = values;
} }
void setFontModifier(byte modifier, boolean on) { final void setFontModifier(byte modifier, boolean on) {
myFeatureMask |= 1 << Feature.FONT_STYLE_MODIFIER; myFeatureMask |= 1 << Feature.FONT_STYLE_MODIFIER;
mySupportedFontModifiers |= modifier; mySupportedFontModifiers |= modifier;
if (on) { if (on) {
@ -156,7 +156,7 @@ public final class ZLTextStyleEntry {
} }
} }
public ZLBoolean3 getFontModifier(byte modifier) { public final ZLBoolean3 getFontModifier(byte modifier) {
if ((mySupportedFontModifiers & modifier) == 0) { if ((mySupportedFontModifiers & modifier) == 0) {
return ZLBoolean3.B3_UNDEFINED; return ZLBoolean3.B3_UNDEFINED;
} }

View file

@ -140,7 +140,7 @@ public final class ZLTextWritablePlainModel extends ZLTextPlainModel implements
} }
final char[] block = getDataBlock(len); final char[] block = getDataBlock(len);
++myParagraphLengths[myParagraphsNumber - 1]; ++myParagraphLengths[myParagraphsNumber - 1];
block[myBlockOffset++] = (char)ZLTextParagraph.Entry.STYLE; block[myBlockOffset++] = (char)ZLTextParagraph.Entry.STYLE; // CSS or OTHER
block[myBlockOffset++] = (char)entry.getMask(); block[myBlockOffset++] = (char)entry.getMask();
if (entry.isLeftIndentSupported()) { if (entry.isLeftIndentSupported()) {
block[myBlockOffset++] = (char)entry.getLeftIndent(); block[myBlockOffset++] = (char)entry.getLeftIndent();

View file

@ -100,7 +100,8 @@ public final class ZLTextParagraphCursor {
} }
} }
break; break;
case ZLTextParagraph.Entry.STYLE: case ZLTextParagraph.Entry.STYLE_CSS:
case ZLTextParagraph.Entry.STYLE_OTHER:
elements.add(new ZLTextStyleElement(it.getStyleEntry())); elements.add(new ZLTextStyleElement(it.getStyleEntry()));
break; break;
case ZLTextParagraph.Entry.STYLE_CLOSE: case ZLTextParagraph.Entry.STYLE_CLOSE:

View file

@ -54,7 +54,7 @@ public class ZLTextBaseStyle extends ZLTextStyle {
super(null, ZLTextHyperlink.NO_LINK); super(null, ZLTextHyperlink.NO_LINK);
FontFamilyOption = new ZLStringOption(GROUP, "Base:fontFamily", fontFamily); FontFamilyOption = new ZLStringOption(GROUP, "Base:fontFamily", fontFamily);
fontSize = fontSize * ZLibrary.Instance().getDisplayDPI() / 320 * 2; fontSize = fontSize * ZLibrary.Instance().getDisplayDPI() / 320 * 2;
FontSizeOption = new ZLIntegerRangeOption(GROUP, "Base:fontSize", 5, 72, fontSize); FontSizeOption = new ZLIntegerRangeOption(GROUP, "Base:fontSize", 5, Math.max(72, fontSize * 2), fontSize);
} }
@Override @Override

View file

@ -21,9 +21,7 @@ package org.geometerplus.zlibrary.text.view.style;
import org.geometerplus.zlibrary.core.util.ZLBoolean3; import org.geometerplus.zlibrary.core.util.ZLBoolean3;
import org.geometerplus.zlibrary.text.model.ZLTextMetrics; import org.geometerplus.zlibrary.text.model.*;
import org.geometerplus.zlibrary.text.model.ZLTextStyleEntry;
import org.geometerplus.zlibrary.text.view.ZLTextStyle; import org.geometerplus.zlibrary.text.view.ZLTextStyle;
public class ZLTextExplicitlyDecoratedStyle extends ZLTextDecoratedStyle implements ZLTextStyleEntry.Feature, ZLTextStyleEntry.FontModifier { public class ZLTextExplicitlyDecoratedStyle extends ZLTextDecoratedStyle implements ZLTextStyleEntry.Feature, ZLTextStyleEntry.FontModifier {
@ -43,6 +41,10 @@ public class ZLTextExplicitlyDecoratedStyle extends ZLTextDecoratedStyle impleme
} }
@Override @Override
protected int getFontSizeInternal(ZLTextMetrics metrics) { protected int getFontSizeInternal(ZLTextMetrics metrics) {
if (myEntry instanceof ZLTextCSSStyleEntry &&
!ZLTextStyleCollection.Instance().UseCSSFontSizeOption.getValue()) {
return Base.getFontSize(metrics);
}
if (myEntry.isFeatureSupported(FONT_STYLE_MODIFIER)) { if (myEntry.isFeatureSupported(FONT_STYLE_MODIFIER)) {
if (myEntry.getFontModifier(FONT_MODIFIER_INHERIT) == ZLBoolean3.B3_TRUE) { if (myEntry.getFontModifier(FONT_MODIFIER_INHERIT) == ZLBoolean3.B3_TRUE) {
return Base.Base.getFontSize(metrics); return Base.Base.getFontSize(metrics);
@ -135,6 +137,10 @@ public class ZLTextExplicitlyDecoratedStyle extends ZLTextDecoratedStyle impleme
return Base.getSpaceAfter(); return Base.getSpaceAfter();
} }
public byte getAlignment() { public byte getAlignment() {
if (myEntry instanceof ZLTextCSSStyleEntry &&
!ZLTextStyleCollection.Instance().UseCSSTextAlignmentOption.getValue()) {
return Base.getAlignment();
}
return return
myEntry.isFeatureSupported(ALIGNMENT_TYPE) myEntry.isFeatureSupported(ALIGNMENT_TYPE)
? myEntry.getAlignmentType() ? myEntry.getAlignmentType()

View file

@ -19,23 +19,16 @@
package org.geometerplus.zlibrary.text.view.style; package org.geometerplus.zlibrary.text.view.style;
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
import org.geometerplus.zlibrary.core.library.ZLibrary; import org.geometerplus.zlibrary.core.library.ZLibrary;
import org.geometerplus.zlibrary.core.options.ZLBooleanOption;
import org.geometerplus.zlibrary.core.util.ZLBoolean3; import org.geometerplus.zlibrary.core.util.ZLBoolean3;
import org.geometerplus.zlibrary.core.xml.*; import org.geometerplus.zlibrary.core.xml.*;
import org.geometerplus.zlibrary.text.model.ZLTextAlignmentType; import org.geometerplus.zlibrary.text.model.ZLTextAlignmentType;
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
public class ZLTextStyleCollection { public class ZLTextStyleCollection {
private static ZLTextStyleCollection ourInstance = null; private static ZLTextStyleCollection ourInstance = null;
private int myDefaultFontSize;
private ZLTextBaseStyle myBaseStyle;
private final ZLTextStyleDecoration[] myDecorationMap = new ZLTextStyleDecoration[256];
private ZLTextStyleCollection() {
new TextStyleReader(this).readQuietly(ZLResourceFile.createResourceFile("default/styles.xml"));
}
public static ZLTextStyleCollection Instance() { public static ZLTextStyleCollection Instance() {
if (ourInstance == null) { if (ourInstance == null) {
ourInstance = new ZLTextStyleCollection(); ourInstance = new ZLTextStyleCollection();
@ -47,6 +40,19 @@ public class ZLTextStyleCollection {
ourInstance = null; ourInstance = null;
} }
private int myDefaultFontSize;
private ZLTextBaseStyle myBaseStyle;
private final ZLTextStyleDecoration[] myDecorationMap = new ZLTextStyleDecoration[256];
public final ZLBooleanOption UseCSSTextAlignmentOption =
new ZLBooleanOption("Style", "css:textAlignment", true);
public final ZLBooleanOption UseCSSFontSizeOption =
new ZLBooleanOption("Style", "css:fontSize", true);
private ZLTextStyleCollection() {
new TextStyleReader(this).readQuietly(ZLResourceFile.createResourceFile("default/styles.xml"));
}
public int getDefaultFontSize() { public int getDefaultFontSize() {
return myDefaultFontSize; return myDefaultFontSize;
} }