| 1 |
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 |
/* |
| 3 |
* This file is part of the libepubgen project. |
| 4 |
* |
| 5 |
* This Source Code Form is subject to the terms of the Mozilla Public |
| 6 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 7 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 8 |
*/ |
| 9 |
|
| 10 |
#include "EPUBBodyStyleManager.h" |
| 11 |
|
| 12 |
namespace libepubgen |
| 13 |
{ |
| 14 |
|
| 15 |
using librevenge::RVNGPropertyList; |
| 16 |
|
| 17 |
void EPUBBodyStyleManager::extractProperties(RVNGPropertyList const &pList, EPUBCSSProperties &cssProps) const |
| 18 |
{ |
| 19 |
if (pList["style:writing-mode"]) |
| 20 |
{ |
| 21 |
std::string mode = pList["style:writing-mode"]->getStr().cstr(); |
| 22 |
if (mode == "tb-rl" || mode == "tb") |
| 23 |
mode = "vertical-rl"; |
| 24 |
else if (mode == "tb-lr") |
| 25 |
mode = "vertical-lr"; |
| 26 |
else // For the rest: lr, lr-tb, rl, rl-tb |
| 27 |
{ |
| 28 |
mode = "horizontal-tb"; |
| 29 |
cssProps["direction"] = (mode == "rl-tb" || mode == "rl")?"rtl":"ltr"; |
| 30 |
} |
| 31 |
|
| 32 |
cssProps["-epub-writing-mode"] = mode; |
| 33 |
cssProps["-webkit-writing-mode"] = mode; |
| 34 |
cssProps["writing-mode"] = mode; |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
} |
| 39 |
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |