Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 19103 → Rev 19104

/trunk/Scribus/AUTHORS
14,6 → 14,7
Jain Basil Aliyas jainbasil@gmail.com
Paul Smedley paul@smedley.info
 
 
Contributions from:
 
Craig Ringer craig@postnewspapers.com.au
32,7 → 33,7
Jean-Jacques Sarton jj.sarton@t-online.de
Christian Töpp mr-ct@gmx.de
Eirik Øverby ltning@anduin.net
Gora Mohanty gora@srijan.in
Gora Mohanty gora@srijan.in
Kevin Young k.young@youngscomputing.com
Elvis Stansvik elvstone@gmail.com
Michael Doubez michael.doubez@free.fr
50,6 → 51,7
Marcus Holland-Moritz
Christian Hitz christian@klarinett.li
 
 
Mac OS® X Aqua Port:
 
Craig Bradney cbradney@zip.com.au
64,6 → 66,7
 
Jean Ghali jghali@libertysurf.fr
 
 
Haiku Port:
 
Giovanni Mugnai musical777@gmail.com
79,6 → 82,7
Gregory Pittman gpittman@iglou.com
Alessandro Levati 8av10s@tiscali.it
 
 
Other Documentation:
 
Yves Ceccone yves@yeccoe.org
/trunk/Scribus/BUILDING
10,7 → 10,7
 
Note that while a QMake project file (Scribus.pro) is provided in the Scribus
source distribution, it is not possible to build Scribus with this project
file. It is only used for generating the translation template files.
file. It is only used for generating the translation template files.
 
REQUIREMENTS AND BUILDING - Microsoft Windows
=============================================
47,7 → 47,7
pkgconfig (to assist finding other libraries)
apspell for the spell checker
podofo - 0.5.0+ for enhanced Illustrator AI/EPS import, svn versions
boost and boost-devel
boost and boost-devel
GraphicksMagick++
 
 
135,7 → 135,7
there's anything there for your OS / distro.
 
Next, ensure you definitely have the library installed, as well as any
additional development packages that may be required to use it. On Linux, make
additional development packages that may be required to use it. On Linux, make
sure to install the "-dev" or "-devel" package for the missing library. After
doing this, re-run configure.
 
168,7 → 168,7
--version'. if you're using gcc.
- If you're having problems with a particular library, what version
of the library you have installed and where you got it from. eg:
"freetype 2.0.1 from sunfreeware,"
"freetype 2.0.1 from sunfreeware",
"LittleCMS 1.1.4, compiled myself and installed in /usr/local",
"freetype 2.1.3 from backports.org",
"fontconfig 2.2.0 (stock Fedora Core 3 devel package)"
232,7 → 232,7
libpng-devel
libjpeg-devel
 
You can install these packages with 'yum install packagename' as root.
You can install these packages with 'yum install packagename' as root.
 
 
More info can be found in the README.
251,21 → 251,21
libpng-devel
libjpeg-devel
cups-devel
openssl-devel (required if CUPS support is needed)
openssl-devel (required if CUPS support is needed)
update-desktop-files
python-devel
tk
python-imaging
aspell-devel
boost-devel
libGraphicsMagick++-devel
libOpenSceneGraph-devel *Optional- but available from the Packman repo
boost-devel
libGraphicsMagick++-devel
libOpenSceneGraph-devel *Optional- but available from the Packman repo
 
You can install these packages using YaST. You may find it difficult to compile
Scribus 1.3.5+ on anything older than Suse 11.1.
Scribus 1.3.5+ on anything older than Suse 11.1.
 
Please note we do provide frequently updated packages including debuginfo rpms
on the Suse Build Server. at http//software.opensuse.org .
on the Suse Build Server at http//software.opensuse.org .
 
Mac OS X
========
/trunk/Scribus/BUILDING_win32_msvc.txt
4,7 → 4,7
HOW TO DO THE BUILD
===================
 
This documentation is minimal and assume you have a decent knowledge of
This documentation is minimal and assume you have a decent knowledge of
Microsoft Visual Studio. No help regarding use of Visual Studio and
related tools will be provided.
 
29,7 → 29,7
 
Some more details can be found below in the section entitled GETTING DEPENDENCIES.
 
After having installed all dependencies, open Scribus-build-props.vsprops files located
After having installed all dependencies, open Scribus-build-props.vsprops files located
in Scribus\win32\vc9 and update the dependency paths to match your system.
 
If you have Visual Studio 2010, open the Visual Studio solution located in Scribus\win32\vc10 and start building.
36,10 → 36,10
If you have Visual Studio 2012, open the Visual Studio solution located in Scribus\win32\vc11 and start building.
 
After building completed, you will find executables in a Scribus-builds\scribus-$(Configuration)-$(Platform)-*
directory located in same directory as Scribus sources. Those executables will not function yet.
directory located in same directory as Scribus sources. Those executables will not function yet.
Scribus resources must be copied from source directory to install directory first.
 
In order to do that, create a batch script and copy/paste following lines :
In order to do that, create a batch script and copy/paste following lines:
 
set SCRIBUS_SRC_PATH=.\Scribus
set SCRIBUS_BUILD_ROOT=.\Scribus-builds
69,12 → 69,12
 
Adjust SCRIBUS_SRC_PATH, SCRIBUS_BUILD_ROOT and SCRIBUS_INSTALL_PATH as needed and run batch script.
 
Download poppler data package on poppler.freedesktop.org. Copy content of archive
Download poppler data package on poppler.freedesktop.org. Copy content of archive
in %SCRIBUS_INSTALL_PATH%\share\poppler.
 
Now copy the DLLs from the zlib, libpng, qt, lcms, freetype, libtiff, libjpeg,
libxml, and podofo directories into the Scribus install directory (where
scribus.exe is). Copy also the Dlls, lib and tcl directories from your python
scribus.exe is). Copy also the Dlls, lib and tcl directories from your python
install to scribus install path. Finally copy python27.dll. Scribus should now run.
 
Crash problems at runtime? Verify that Qt, freetype, lcms, and Scribus all use
88,7 → 88,7
====================
 
This is a quick and dirty set of notes that will be filled out once everything's
verified as correct and working. It asssumes that you'll be building all your
verified as correct and working. It assumes that you'll be building all your
dependencies at a single root, like C:\Developer. The root *MUST* not have spaces
in its path.
 
113,7 → 113,7
anything as Scribus only use functionnalities embedded in C++ templates.
 
----
Zlib and LibPNG :
Zlib and LibPNG:
 
Zlib and LibPNG are both embedded in the QtCore library with symbols exported
for public use . If you're using a Qt binary redist you may still need to
123,25 → 123,25
all.
 
---
Cairo and Pixman
Cairo and Pixman:
 
Cairo and pixman sources can be downloaded from cairographics.org at following address :
Cairo and pixman sources can be downloaded from cairographics.org at following address:
 
http://cairographics.org/releases/
 
Follow instructions in sources packages to build pixman, then cairo.
 
You will however probably find easier to directly download packages with Visual Studio 2008
solutions ready to build. You can find required file at following address :
You will however probably find easier to directly download packages with Visual Studio 2008
solutions ready to build. You can find required file at following address:
 
https://sourceforge.net/projects/scribus/files/scribus-libs/win32-msvc2008/
 
Download the both scribus-pixman-* and scribus-cairo-* zip files. Unpack them.
 
Build pixman first : open the pixman-win32 solution located in pixman-whatever\win32
Build pixman first: open the pixman-win32 solution located in pixman-whatever\win32
directory and build Debug and Release configurations.
 
Build cairo afterwards : open the cairo-win32 solution located in cairo-whatever\win32
Build cairo afterwards: open the cairo-win32 solution located in cairo-whatever\win32
directory and build Debug and Release configurations.
 
----
150,7 → 150,7
Unpack freetype
 
Open include\freetype\config\ftoption.h and replace the DLL export compilation section
by following lines :
by following lines:
 
#ifndef __GNUC__
# define __DLL_IMPORT__ __declspec(dllimport)
183,7 → 183,7
Build "Release Multithreaded" and "Debug Multithreaded"
 
At the end of the process you must have those files in your freetype lib
directory :
directory:
- freetype.dll
- freetype.lib
- freetypeD.dll
190,30 → 190,30
- freetypeD.lib
 
----
Libhunspell :
Libhunspell:
 
You will probably find easier to directly download packages with Visual
Studio 2008 solutions ready to build. You can find required file at
following address :
You will probably find easier to directly download packages with Visual
Studio 2008 solutions ready to build. You can find required file at
following address:
 
https://sourceforge.net/projects/scribus/files/scribus-libs/win32-msvc2008/
 
Download the scribus-hunspell-*.zip archive. Unpack it.
 
Open the visual studio solution located in hunspell-whatever/src/win-api directory and build
Open the visual studio solution located in hunspell-whatever/src/win-api directory and build
Debug and Release configurations of Libhunspell project.
 
----
Libjpeg :
Libjpeg:
 
While Qt also bundles libjpeg, it's not linked to the main DLL but rather a plugin.
As such, we need to link to it directly.
 
Get jpeg libraries from GnuWin32 project on Sourceforge :
Get jpeg libraries from GnuWin32 project on Sourceforge:
 
http://sourceforge.net/projects/gnuwin32/files/jpeg/6b-3/jpeg-6b-3-lib.zip/download
 
Unpack in C:\Developer. After unpacking you directory layout must be as following :
Unpack in C:\Developer. After unpacking you directory layout must be as following:
 
C:\Developer
|- libjpeg-6b-3
222,7 → 222,7
|- manifest
 
----
LittleCMS :
LittleCMS:
 
Get lcms sources (>= 2.1). Although it is possible to build Scribus with lcms 1,
you can only do so without modifying lcms sources with lcms >= 2.1.
232,21 → 232,21
as to make them use the multithreaded dll runtim libraries.
Build the static libraries in debug and release configurations.
 
After building you must have a lcms2_static.lib and lcms2_staticd.lib in
After building you must have a lcms2_static.lib and lcms2_staticd.lib in
your lcms source directory. If this is not the case modify projects as necessary.
 
----
Libtiff
Libtiff:
 
While Qt also bundles libtiff, it's not linked to the main DLL but rather a plugin.
As such, we need to link to it directly.
 
Download libtiff libraries, binaries and dependency packages from GnuWin32 project
on sourceforge :
Download libtiff libraries, binaries and dependency packages from GnuWin32 project
on sourceforge:
 
http://sourceforge.net/projects/gnuwin32/files/tiff/3.8.2/
 
Unpack them in C:\Developer. After unpacking you directory layout must be as following :
Unpack them in C:\Developer. After unpacking you directory layout must be as following:
 
C:\Developer
|- libtiff-3.8.2
258,9 → 258,9
|- manifest
 
----
Libxml2 / iconv :
Libxml2 / iconv:
 
Download libxml2 and icon win32 binaries from following address :
Download libxml2 and icon win32 binaries from following address:
 
ftp://ftp.zlatkovic.com/libxml/
 
275,39 → 275,39
into the libxml tree.
 
---
Podofo :
Podofo:
 
Podofo sources can be downloaded from podofo.sourceforge.net. At the moment
those instructions are written, the recommended version to build Scribus on
Podofo sources can be downloaded from podofo.sourceforge.net. At the moment
those instructions are written, the recommended version to build Scribus on
Windows is one of the 0.8.x series.
 
Follow instructions in sources packages to build Podofo.
 
You will however probably find easier to directly download packages with a
Visual Studio 2008 solution ready to build. You can find required file at
following address :
You will however probably find easier to directly download packages with a
Visual Studio 2008 solution ready to build. You can find required file at
following address:
 
https://sourceforge.net/projects/scribus/files/scribus-libs/win32-msvc2008/
 
Download the scribus-podofo-*.zip archive. Unpack it.
 
If present, open the PoDoFoLib-build.vsprops file located in podofo-whatever
directory and set all build variables according to your system. Then open the
podofo solution located in same directory and build Debug and Release configurations
If present, open the PoDoFoLib-build.vsprops file located in podofo-whatever
directory and set all build variables according to your system. Then open the
podofo solution located in same directory and build Debug and Release configurations
of PoDoFoLib project.
 
Note : freetype, libtiff and libjpeg must have been installed and if
Note: freetype, libtiff and libjpeg must have been installed and if
necessary compiled before attempting to build podofo.
 
---
Poppler :
Poppler:
 
Poppler sources can be downloaded http://poppler.freedesktop.org. At the moment
those instruction are written, the only version known to work with scribus is 0.17.1.
 
As Poppler is a bit tricky to build on Windows, you will however probably find easier
to directly download a ready to build package for Visual Studio 2008. You can find
required file at following address :
As Poppler is a bit tricky to build on Windows, you will however probably find easier
to directly download a ready to build package for Visual Studio 2008. You can find
required file at following address:
 
https://sourceforge.net/projects/scribus/files/scribus-libs/win32-msvc2008/
 
314,14 → 314,14
Download the scribus-poppler-*.zip archive. Unpack it.
 
Open the poppler-build.vsprops file located in poppler-whatever\win32 directory and set
all build variables according to your system. Then open the poppler.sln solution and
all build variables according to your system. Then open the poppler.sln solution and
buid Debug-static and Release-static configurations.
 
Note : freetype, libtiff and libjpeg must have been installed and if
Note: freetype, libtiff and libjpeg must have been installed and if
necessary compiled before attempting to build poppler.
 
---
Python :
Python:
 
Download latest Python 2.7 binaries (and only 2.7, 3.x will not work).
Unpack or install.
329,13 → 329,13
 
Open pyconfig.h in python include directory
 
Replace those lines :
Replace those lines:
 
#ifdef _DEBUG
# define Py_DEBUG
#endif
 
by :
by:
 
#ifdef _DEBUG
# //define Py_DEBUG
/trunk/Scribus/scribus/colormgmt/sccolormgmtstructs.h
63,29 → 63,29
typedef enum
{
ColorSpace_Unknown,
ColorSpace_XYZ,
ColorSpace_Lab,
ColorSpace_Luv,
ColorSpace_YCbCr,
ColorSpace_Yxy,
ColorSpace_Rgb,
ColorSpace_Gray,
ColorSpace_Hsv,
ColorSpace_Hls,
ColorSpace_Cmyk,
ColorSpace_Cmy
ColorSpace_XYZ,
ColorSpace_Lab,
ColorSpace_Luv,
ColorSpace_YCbCr,
ColorSpace_Yxy,
ColorSpace_Rgb,
ColorSpace_Gray,
ColorSpace_Hsv,
ColorSpace_Hls,
ColorSpace_Cmyk,
ColorSpace_Cmy
} eColorSpaceType;
 
typedef enum
{
Class_Unknown,
Class_Input,
Class_Display,
Class_Output,
Class_Link,
Class_Abstract,
Class_ColorSpace,
Class_NamedColor
Class_Input,
Class_Display,
Class_Output,
Class_Link,
Class_Abstract,
Class_ColorSpace,
Class_NamedColor
} eProfileClass;
 
class ScColorMgmtStrategy
93,7 → 93,7
public:
bool useBlackPointCompensation;
bool useBlackPreservation;
 
ScColorMgmtStrategy ()
{
useBlackPointCompensation = true;
/trunk/Scribus/scribus/colormgmt/sccolorprofilecache.h
19,7 → 19,7
void addProfile(const ScColorProfile& profile);
void removeProfile(const QString& profilePath);
void removeProfile(const ScColorProfile& profile);
 
bool contains(const QString& profilePath);
ScColorProfile profile(const QString& profilePath);
 
/trunk/Scribus/scribus/colormgmt/sccolorspacedata.h
19,7 → 19,7
protected:
eColorFormat m_colorFormat;
ScColorProfile m_profile;
 
public:
 
eColorType type() const { return colorFormatType(m_colorFormat); }
/trunk/Scribus/scribus/colormgmt/sccolortransform.h
20,7 → 20,7
ScColorTransform();
ScColorTransform(ScColorTransformData* data);
ScColorTransform(const QSharedPointer<ScColorTransformData>& data);
 
ScColorMgmtEngine& engine() { return m_data->engine(); }
const ScColorMgmtEngine& engine() const { return m_data->engine(); }
 
28,7 → 28,7
inline operator bool () const { return !isNull(); }
 
const ScColorTransformInfo& transformInfo() const { return m_data->transformInfo(); }
 
bool apply(void* input, void* output, uint numElem);
bool apply(QByteArray& input, QByteArray& output, uint numElem);
 
/trunk/Scribus/scribus/colormgmt/sccolortransformdata.h
22,7 → 22,7
public:
inline const ScColorTransformInfo& transformInfo() const { return m_transformInfo; }
inline void setTransformInfo(const ScColorTransformInfo& info) { m_transformInfo = info; }
 
virtual bool isNull() const = 0;
 
virtual bool apply(void* input, void* output, uint numElem) = 0;
/trunk/Scribus/scribus/colormgmt/sclcmscolormgmtengineimpl.cpp
556,27 → 556,27
eColorSpaceType ScLcmsColorMgmtEngineImpl::translateLcmsColorSpaceType(icColorSpaceSignature signature)
{
eColorSpaceType colorSpaceType = ColorSpace_Unknown;
if (signature == icSigXYZData)
if (signature == icSigXYZData)
colorSpaceType = ColorSpace_XYZ;
if (signature == icSigLabData)
if (signature == icSigLabData)
colorSpaceType = ColorSpace_Lab;
if (signature == icSigLuvData)
if (signature == icSigLuvData)
colorSpaceType = ColorSpace_Luv;
if (signature == icSigYCbCrData)
if (signature == icSigYCbCrData)
colorSpaceType = ColorSpace_YCbCr;
if (signature == icSigYxyData)
if (signature == icSigYxyData)
colorSpaceType = ColorSpace_Yxy;
if (signature == icSigRgbData)
if (signature == icSigRgbData)
colorSpaceType = ColorSpace_Rgb;
if (signature == icSigGrayData)
if (signature == icSigGrayData)
colorSpaceType = ColorSpace_Gray;
if (signature == icSigHsvData)
if (signature == icSigHsvData)
colorSpaceType = ColorSpace_Hsv;
if (signature == icSigHlsData)
if (signature == icSigHlsData)
colorSpaceType = ColorSpace_Hls;
if (signature == icSigCmykData)
if (signature == icSigCmykData)
colorSpaceType = ColorSpace_Cmyk;
if (signature == icSigCmyData)
if (signature == icSigCmyData)
colorSpaceType = ColorSpace_Cmy;
return colorSpaceType;
}
586,17 → 586,17
eProfileClass profileClass = Class_Unknown;
if (signature == icSigInputClass)
profileClass = Class_Input;
if (signature == icSigDisplayClass)
if (signature == icSigDisplayClass)
profileClass = Class_Display;
if (signature == icSigOutputClass)
if (signature == icSigOutputClass)
profileClass = Class_Output;
if (signature == icSigLinkClass)
if (signature == icSigLinkClass)
profileClass = Class_Link;
if (signature == icSigAbstractClass)
if (signature == icSigAbstractClass)
profileClass = Class_Abstract;
if (signature == icSigColorSpaceClass)
if (signature == icSigColorSpaceClass)
profileClass = Class_ColorSpace;
if (signature == icSigNamedColorClass)
if (signature == icSigNamedColorClass)
profileClass = Class_NamedColor;
return profileClass;
}
/trunk/Scribus/scribus/colormgmt/sclcmscolormgmtengineimpl.h
27,15 → 27,15
 
// function for getting available profile in a directory
virtual QList<ScColorProfileInfo> getAvailableProfileInfo(const QString& directory, bool recursive);
 
// functions for opening icc profiles
virtual ScColorProfile openProfileFromFile(ScColorMgmtEngine& engine, const QString& filePath);
virtual ScColorProfile openProfileFromMem (ScColorMgmtEngine& engine, const QByteArray& array);
 
// functions for creating profiles
virtual ScColorProfile createProfile_sRGB(ScColorMgmtEngine& engine);
virtual ScColorProfile createProfile_Lab (ScColorMgmtEngine& engine);
 
// functions for creating transforms
virtual ScColorTransform createTransform(ScColorMgmtEngine& colorManagementEngine,
const ScColorProfile& inputProfile , eColorFormat inputFormat,
/trunk/Scribus/scribus/desaxe/automata.h
32,7 → 32,7
const STATE start() const;
const OUTPUT deflt() const;
const OUTPUT next(STATE from, INPUT input) const;
 
void addState(STATE newState);
void addInput(INPUT newInput);
void setTransition(STATE from, INPUT input, OUTPUT to);
136,10 → 136,10
DFA<NSTATE,INPUT>* result = new DFA<NSTATE,INPUT>(nstart, deflt);
result->addState(deflt);
 
std::deque<std::set<STATE> > todo;
todo.push_back(startSet);
 
while (todo.size() > 0)
{
const std::set<STATE> from = todo.front();
192,7 → 192,7
{
// clean up
}
 
template<class STATE, class INPUT, class OUTPUT>
const typename FA_base<STATE,INPUT,OUTPUT>::Transitions& FA_base<STATE,INPUT,OUTPUT>::transitions(STATE s) const
{
233,8 → 233,8
Transitions& trans(transitions_[from]);
trans[input] = to;
}
 
 
template<class STATE, class INPUT>
void NFA<STATE, INPUT>::addTransition(STATE from, INPUT input, STATE to)
{
/trunk/Scribus/scribus/desaxe/desaxe_test.cpp
71,7 → 71,7
void dummyDoc(desaxe::Digester& dig)
{
dig.reset();
 
Xml_attr attr;
dig.begin("doc", attr);
attr["level"] = "1";
90,9 → 90,9
attr["test"] = "bingo";
dig.begin("elem", attr);
dig.chars("delta ");
attr["level"] = "3";
dig.begin("elem", attr);
dig.chars("echo ");
attr["level"] = "3";
dig.begin("elem", attr);
dig.chars("echo ");
dig.end("elem");
dig.chars("foxtrott ");
dig.end("elem");
109,7 → 109,7
dig.end("elem");
dig.chars("kilo ");
dig.end("doc");
}
}
 
bool loadRawText(const QString & filename, QByteArray & buf)
{
137,7 → 137,7
int main(int argc, char** argv)
{
using namespace desaxe;
 
Digester dig;
Action fac = FactoryWithName<ELEM>();
Action s_attr = SetAttributes<ELEM>( & ELEM::setAttribute );
144,13 → 144,13
Action res = Result<ELEM>();
Action set = SetterP<ELEM, ELEM>( & ELEM::addElem );
Action txt = AddText<ELEM>( & ELEM::addText );
 
dig.addRule("*",fac);
dig.addRule("*",s_attr);
dig.addRule("*",txt);
dig.addRule("/*",res);
dig.addRule("*/*", set);
 
if (argc < 2) {
dummyDoc(dig);
dig.result<ELEM>()->print();
/trunk/Scribus/scribus/desaxe/digester.cpp
20,9 → 20,9
#include "actions.h"
 
namespace desaxe {
 
typedef std::pair<Xml_string, Action> rule_t;
 
typedef unsigned short token_t;
typedef std::vector<token_t> path_t;
enum special_token { EMPTY = 0, START = 1, ANY = 2, REPEAT = 3 } ;
33,7 → 33,7
{
unsigned int ID;
std::vector<rule_t> rules;
 
DFA_State() : rules() {}
};
 
68,7 → 68,7
private:
/// user sets these rules
std::vector<rule_t> rules;
 
/// rule patterns get broken into tokens:
std::map<Xml_string, token_t> tokens;
/// lists the accepting (NFA) states for each rule (same sequence as rules)
81,7 → 81,7
/// assigns a unique token to each string
token_t createToken(const Xml_string& tok);
void makeTokens();
 
/// creates a nondeterministic automaton as base for the DFA
automata::NFA<nfa_state_t, token_t>* createNFA();
 
352,12 → 352,12
prefix[0] = EMPTY;
nfa_states[prefix] = EMPTY;
 
std::set<nfa_state_t> deflt;
deflt.insert(EMPTY);
 
NFA<nfa_state_t, token_t> *nfa = new NFA<nfa_state_t, token_t>(START, deflt);
 
nfa->addState(EMPTY);
nfa->addInput(ANY);
nfa->addTransition(EMPTY, ANY, EMPTY);
368,7 → 368,7
const unsigned int len = currPattern.length();
int pos;
nfa_state_t lastState;
 
// determine if this is a start pattern
prefix.resize(1);
if (currPattern[0] == '/') {
381,7 → 381,7
pos = 0;
lastState = EMPTY;
}
 
// std::cerr << "looking at pattern: " << currPattern << "\n";
// for all prefixes
do {
388,7 → 388,7
std::string::size_type pos2 = currPattern.find('/', pos);
if (pos2 == std::string::npos)
pos2 = len;
 
std::string diff(currPattern.substr(pos, pos2-pos));
token_t tok = createToken(fromSTLString(diff));
// std::cerr << pos << "-" << pos2 << "\t: " << diff << " = " << tok << "\n";
400,7 → 400,7
pos = pos2 + 1;
continue;
}
 
prefix.push_back(tok);
// create new state if necessary
nfa_state_t nstate;
433,7 → 433,7
for (st = tr->second.begin(); st != tr->second.end(); ++st)
nfa->addTransition(*it, tr->first, *st);
}
 
// ANY transitions
const std::set<token_t>& inputs(nfa->inputs());
std::set<token_t>::const_iterator tok;
/trunk/Scribus/scribus/desaxe/digester.h
26,13 → 26,13
//#define DESAXE_DEBUG 1
 
namespace desaxe {
 
class Action;
class RuleState;
 
 
namespace PRIVATE {
 
class VarPtr
{
public:
40,7 → 40,7
std::string type;
};
 
 
template<class ObjType>
inline
VarPtr mkcell(ObjType* obj)
50,8 → 50,8
result.type = typeid(obj).name();
return result;
}
 
 
template<class ObjType>
inline
void chkcell(const VarPtr& cell, std::vector<VarPtr>* stack = NULL)
72,15 → 72,15
assert (false);
}
}
 
 
 
class Patch {
public:
// internal linked list
Patch* next;
Patch(Patch* nxt) : next(nxt) {}
 
virtual void run(VarPtr lnk) = 0;
virtual ~Patch() {}
};
97,7 → 97,7
attributes, or call methods. Actions operate on intermediate objects which
are hold on a stack maintained by Digester.
*/
class Digester : public SaxHandler {
class Digester : public SaxHandler {
public:
Digester();
Digester& operator=(const Digester& other);
104,15 → 104,15
virtual ~Digester();
void reset();
void addRule(const Xml_string& pattern, Action action);
 
void parseFile(const Xml_string& filename);
void parseMemory(const char* data, unsigned int length);
 
template<class ObjType>
ObjType* result();
int nrOfErrors() const;
const Xml_string getError(int i) const;
 
// called by SAX parser:
void beginDoc();
void endDoc();
119,38 → 119,38
void begin(const Xml_string& tag, Xml_attr attr);
void end(const Xml_string& tag);
void chars(const Xml_string& text);
 
// used by actions:
void fail();
void error(const Xml_string& msg);
 
template<class ObjType>
ObjType* top(unsigned int offset = 0);
 
template<class ObjType>
ObjType* bottom(unsigned int offset = 0);
 
template<class ObjType>
void setResult( ObjType* res );
 
void pop();
void popn(unsigned int number);
 
template<class ObjType>
void push(ObjType* obj);
 
// used to resolve idrefs and for general storage
template<class ObjType>
ObjType* lookup(const Xml_string& idref);
template<class ObjType>
void store(const Xml_string& idref, ObjType* res );
 
// used to resolve idrefs if use is before definition
template<class LinkType>
void patchCall(const Xml_string& idref, void (*fun)(LinkType*) );
template<class ObjType, class LinkType>
void patchInvoke(const Xml_string& idref, ObjType* obj, void (ObjType::*fun)(LinkType*) );
 
// used to insert "/" where necessary
static Xml_string concat(const Xml_string& pattern1, const Xml_string& pattern2);
 
157,19 → 157,19
private:
RuleState*
state;
 
std::vector<PRIVATE::VarPtr>
objects;
 
std::map<Xml_string, PRIVATE::VarPtr>
storage;
 
std::map<Xml_string, PRIVATE::Patch*>
patches;
 
PRIVATE::VarPtr
result_;
 
std::vector<Xml_string>
errors;
};
269,9 → 269,9
{
typedef void (*FunType1)(LinkType*);
FunType1 fun;
 
Patch1(FunType1 fn, Patch* nxt = NULL) : Patch(nxt), fun(fn) {}
 
void run(VarPtr link)
{
fun( static_cast<LinkType*>(link.ptr) );
278,7 → 278,7
}
};
 
template <class ObjType, class LinkType>
struct Patch2 : public Patch
{
293,8 → 293,8
(obj->*fun)( static_cast<LinkType*>(link.ptr) );
}
};
 
 
inline
void runPatches(Patch*& list, VarPtr link)
{
306,7 → 306,7
list = nxt;
}
}
 
inline
void deletePatches(std::map<Xml_string, Patch*>& patches)
{
324,7 → 324,7
patches.clear();
}
 
 
// template<> class Patch1<void>;
// template<> class Patch2<VarPtr,void>;
376,7 → 376,7
void Digester::patchCall(const Xml_string& idref, void (*fun)(LinkType*) )
{
using namespace PRIVATE;
 
std::map<Xml_string, VarPtr>::iterator cell = storage.find(idref);
if (cell == storage.end())
{
393,7 → 393,7
void Digester::patchInvoke(const Xml_string& idref, ObjType* obj, void (ObjType::*fun)(LinkType*) )
{
using namespace PRIVATE;
 
std::map<Xml_string, VarPtr>::iterator cell = storage.find(idref);
if (cell == storage.end())
{
/trunk/Scribus/scribus/desaxe/digester_parse.cpp
25,8 → 25,8
dig->beginDoc();
return true;
}
bool startElement( const QString& nsURI, const QString& locName, const QString& qName,
const QXmlAttributes& qattr)
bool startElement( const QString& nsURI, const QString& locName, const QString& qName,
const QXmlAttributes& qattr)
{
Xml_attr attr;
for (int i=0; i < qattr.count(); ++i)
35,7 → 35,7
return true;
}
 
bool endElement( const QString& nsURI, const QString& locName, const QString& qName)
bool endElement( const QString& nsURI, const QString& locName, const QString& qName)
{
dig->end(qName);
return true;
/trunk/Scribus/scribus/desaxe/saxXML.h
21,7 → 21,7
SaxXML(std::ostream& file, bool pretty=false);
SaxXML(const char* filename, bool pretty=false);
~SaxXML();
 
void beginDoc();
void endDoc();
void begin(const Xml_string& tag, Xml_attr attr);
/trunk/Scribus/scribus/desaxe/saxfilter.h
48,7 → 48,7
virtual void end(const Xml_string& tag);
Xml_string openTag();
private:
int m_level;
int m_level;
Xml_string m_tag;
};
 
64,7 → 64,7
virtual void begin(const Xml_string& tag, Xml_attr attr);
virtual void end(const Xml_string& tag);
private:
int m_level;
int m_level;
Xml_string m_old;
Xml_string m_new;
};
/trunk/Scribus/scribus/desaxe/simple_actions.h
44,7 → 44,7
namespace desaxe {
 
using namespace desaxe;
 
/**
* Pushes a new object of type Obj_Type onto the stack.
* Obj_Type needs a default constructor
54,19 → 54,19
{
public:
typedef Obj_Type* (*FunType)();
 
Factory_body()
: create_(NULL)
{}
{}
 
Factory_body(FunType create)
: create_(create)
{}
{}
 
void begin(const Xml_string&, Xml_attr)
{
{
this->dig->push(create_? create_() : new Obj_Type());
}
}
private:
Obj_Type* (*create_)();
};
93,12 → 93,12
FactoryWithArgs_body(FunType create)
: create_(create)
{}
{}
void begin(const Xml_string& name, Xml_attr attr)
{
{
this->dig->push(create_(name, attr));
}
}
private:
Obj_Type* (*create_)(const Xml_string&, Xml_attr);
};
120,19 → 120,19
{
public:
typedef Obj_Type* (*FunType)(const Xml_string&);
 
FactoryWithName_body()
: create_(NULL)
{}
 
FactoryWithName_body(FunType create)
: create_(create)
{}
 
void begin(const Xml_string& tag, Xml_attr)
{
this->dig->push(create_? create_(tag) : new Obj_Type(tag));
}
}
private:
FunType create_;
};
158,12 → 158,12
Prototype_body(const Obj_Type& proto)
: proto_(new Obj_Type(proto))
{}
 
~Prototype_body()
{
delete proto_;
}
 
void begin(const Xml_string&, Xml_attr)
{
this->dig->push(new Obj_Type(proto_));
192,7 → 192,7
Top_body(unsigned int n)
: distance(n)
{}
 
void begin(const Xml_string&, Xml_attr)
{
this->dig->push(this->dig->template top<Obj_Type>(distance));
222,11 → 222,11
{
public:
typedef const Data_Type& (Obj_Type::*FunType)();
 
Getter_body(FunType get)
: get_(get)
{}
 
void begin(const Xml_string&, Xml_attr)
{
Obj_Type* obj = this->dig->template top<Obj_Type>(1);
234,7 → 234,7
this->dig->push(data);
}
private:
FunType get_;
FunType get_;
};
 
 
254,11 → 254,11
{
public:
typedef void (Obj_Type::*FunType)(Data_Type*);
 
SetterP_body(FunType set)
: set_(set)
{}
 
void end(const Xml_string&)
{
Store_Type* data = this->dig->template top<Store_Type>();
267,7 → 267,7
std::cerr << "setter(ptr): " << obj << " .= " << data << "\n";
#endif
(obj->*set_)( data );
}
}
private:
FunType set_;
};
289,11 → 289,11
{
public:
typedef void (Obj_Type::*FunType)(Data_Type);
 
Setter_body(FunType set)
: set_(set)
{}
 
void end(const Xml_string&)
{
Data_Type* data = this->dig->template top<Data_Type>();
302,7 → 302,7
std::cerr << "setter: " << obj << " .= *(" << data << ")\n";
#endif
(obj->*set_)( *data );
}
}
private:
FunType set_;
};
317,7 → 317,7
 
 
/**
* Writes the topmost object to the topmost object but one on the stack.
* Writes the topmost object to the topmost object but one on the stack.
*/
template<class Obj_Type, class Data_Type, class Store_Type>
class SetterWithConversion_body : public Action_body
325,11 → 325,11
public:
typedef void (Obj_Type::*FunType)(Data_Type);
typedef Data_Type (*ConvType)(Store_Type);
 
SetterWithConversion_body(FunType set, ConvType conv)
: set_(set), conv_(conv)
{}
 
void end(const Xml_string&)
{
Store_Type* data = this->dig->template top<Store_Type>();
341,7 → 341,7
(obj->*set_)( conv_(*data) );
else
(obj->*set_)( static_cast<Data_Type>(*data) );
}
}
private:
FunType set_;
ConvType conv_;
370,7 → 370,7
SetAttributes_body(FunType set) : set_(set)
{}
 
void begin(const Xml_string&, Xml_attr attr)
{
Obj_Type* obj = this->dig->template top<Obj_Type>();
377,7 → 377,7
Xml_attr::iterator it;
for(it=attr.begin(); it != attr.end(); ++it)
(obj->*set_)( Xml_key(it), Xml_data(it) );
}
}
private:
FunType set_;
};
401,15 → 401,15
{
public:
typedef void (Obj_Type::*FunType)(Data_Type) ;
 
SetAttribute_body(FunType set, const Xml_string& name)
: set_(set), name_(name), default_(), hasDefault_(false)
{}
 
SetAttribute_body(FunType set, const Xml_string& name, Data_Type deflt)
: set_(set), name_(name), default_(deflt), hasDefault_(true)
{}
 
void begin(const Xml_string&, Xml_attr attr)
{
Obj_Type* obj = this->dig->template top<Obj_Type>();
418,7 → 418,7
(obj->*set_)( Data_Type(Xml_data(it)) );
else if (hasDefault_)
(obj->*set_)( default_ );
}
}
private:
FunType set_;
Xml_string name_;
440,7 → 440,7
 
 
/**
* Stores named attribute to the topmost object on the stack if attribute present,
* Stores named attribute to the topmost object on the stack if attribute present,
* or stores default if present.
*/
template<class Obj_Type, class Data_Type>
449,15 → 449,15
public:
typedef void (Obj_Type::*FunType)(Data_Type) ;
typedef Data_Type (*ConvType)(const Xml_string&);
 
SetAttributeWithConversion_body(FunType set, const Xml_string& name, ConvType conv)
: set_(set), name_(name), conv_(conv), default_(), hasDefault_(false)
{}
 
SetAttributeWithConversion_body(FunType set, const Xml_string& name, ConvType conv, Data_Type deflt)
: set_(set), name_(name), conv_(conv), default_(deflt), hasDefault_(true)
{}
 
void begin(const Xml_string&, Xml_attr attr)
{
Obj_Type* obj = this->dig->template top<Obj_Type>();
465,8 → 465,8
if (it != attr.end() && conv_)
(obj->*set_)( conv_(Xml_data(it)) );
else if (hasDefault_)
(obj->*set_)( default_ );
}
(obj->*set_)( default_ );
}
private:
FunType set_;
Xml_string name_;
478,12 → 478,12
 
template <class Type, class Data>
struct SetAttributeWithConversion : public MakeAction<SetAttributeWithConversion_body<Type,Data>, typename SetAttributeWithConversion_body<Type,Data>::FunType, const Xml_string&, typename SetAttributeWithConversion_body<Type,Data>::ConvType, Data>
{
{
typedef SetAttributeWithConversion_body<Type,Data> BodyType;
 
SetAttributeWithConversion(typename BodyType::FunType set, const Xml_string& name, typename BodyType::ConvType conv)
: MakeAction<BodyType, typename BodyType::FunType, const Xml_string&, typename BodyType::ConvType, Data>(set,name,conv) {}
 
SetAttributeWithConversion(typename BodyType::FunType set, const Xml_string& name, typename BodyType::ConvType conv, Data deflt)
: MakeAction<BodyType, typename BodyType::FunType, const Xml_string&, typename BodyType::ConvType, Data>(set,name,conv,deflt) {}
};
499,15 → 499,15
{
public:
typedef void (Obj_Type::*FunType)(const Xml_string&);
 
AddText_body(FunType add) : addT(add)
{}
 
void chars(const Xml_string& txt)
{
Obj_Type* obj = this->dig->template top<Obj_Type>();
(obj->*addT)( txt );
}
}
private:
FunType addT;
};
535,26 → 535,26
{
public:
typedef void (Obj_Type::*FunType)(const Xml_string&);
 
SetText_body(FunType set) : setT(set)
{}
 
void begin(const Xml_string&, Xml_attr)
{
txt = "";
}
 
void chars(const Xml_string& chunk)
{
txt += chunk;
}
 
void end(const Xml_string& tag)
{
Obj_Type* obj = this->dig->template top<Obj_Type>();
(obj->*setT)( txt );
}
}
 
private:
FunType setT;
Xml_string txt;
578,7 → 578,7
{
public:
Store_body(const Xml_string& name) : m_name(name) {}
 
void begin(const Xml_string& tag, Xml_attr attr)
{
Obj_Type* obj = this->dig->template top<Obj_Type>();
600,22 → 600,22
 
 
/**
* This applies "id" and "idref" attributes to the object on top of the stack.
* In case of an "id" attribute, if there is no entry with this ID in
* the digester's storage, the topmost object is stored there. Otherwise the
* topmost object is replaced with the stored object.
* In case of an "idref" attribute, if there is no entry with this ID in
* the digester's storage, the topmost object is also stored there. Then the
* trigger "WithinIdRef" is set during begin() and the processing continues
* normally. When end() is called, the topmost object is replaced by the
* stored one (this will be a no-op if there wasnt an entry in storage before)
*/
* This applies "id" and "idref" attributes to the object on top of the stack.
* In case of an "id" attribute, if there is no entry with this ID in
* the digester's storage, the topmost object is stored there. Otherwise the
* topmost object is replaced with the stored object.
* In case of an "idref" attribute, if there is no entry with this ID in
* the digester's storage, the topmost object is also stored there. Then the
* trigger "WithinIdRef" is set during begin() and the processing continues
* normally. When end() is called, the topmost object is replaced by the
* stored one (this will be a no-op if there wasnt an entry in storage before)
*/
template<class Obj_Type>
class IdRef_body : public Action_body
{
public:
IdRef_body() : stack() {}
 
void begin(const Xml_string&, Xml_attr attr)
{
Obj_Type* obj = this->dig->template top<Obj_Type>();
657,7 → 657,7
}
}
stack.push_back(mode);
 
}
void end(const Xml_string&)
{
694,7 → 694,7
Lookup_body(const Xml_string& ID)
: ID_(ID)
{}
 
void begin(const Xml_string&, Xml_attr)
{
Data_Type* data = this->dig->template lookup<Data_Type>(ID_);
701,7 → 701,7
this->dig->push(data);
}
private:
Xml_string ID_;
Xml_string ID_;
};
 
 
715,7 → 715,7
 
 
/**
* Transforms the topmost object to the topmost object but one on the stack. // FIXME: this should just be a getter...
* Transforms the topmost object to the topmost object but one on the stack. // FIXME: this should just be a getter...
*/
template<class Obj_Type, class Arg_Type>
class Transform_body : public Action_body
722,11 → 722,11
{
public:
typedef Obj_Type (*FunType)(const Arg_Type&);
 
Transform_body(FunType fun)
: fun_(fun), stack()
{}
 
void begin(const Xml_string&, Xml_attr)
{
Cell cell;
738,7 → 738,7
stack.push_back(cell);
this->dig->pop();
this->dig->push(&cell.obj);
}
}
 
void end(const Xml_string&)
{
769,11 → 769,11
{
public:
typedef void (Obj_Type::*FunType)(Data_Type*) ;
 
PatchIdRefAttribute_body(FunType set, const Xml_string& name)
: set_(set), name_(name)
{}
 
void begin(const Xml_string&, Xml_attr attr)
{
Xml_attr::iterator it = attr.find(name_);
782,7 → 782,7
Obj_Type* obj = this->dig->template top<Obj_Type>();
this->dig->template patchInvoke<Obj_Type,Data_Type>(Xml_data(it), obj, set_);
}
}
}
private:
FunType set_;
Xml_string name_;
/trunk/Scribus/scribus/fonts/ftface.cpp
87,10 → 87,10
return;
}
}
 
const_cast<FtFace*>(this)->isStroked = false;
m_encoding = 0;
 
m_uniEM = static_cast<qreal>(m_face->units_per_EM);
 
m_descent = m_face->descender / m_uniEM;
128,7 → 128,7
int goodGlyph = 0;
int invalidGlyph = 0;
bool error;
 
while ( gindex != 0 )
{
error = FT_Load_Glyph( m_face, gindex, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP );
139,10 → 139,10
charcode = FT_Get_Next_Char( m_face, charcode, &gindex );
continue;
}
 
if (gindex > maxGlyph)
const_cast<FtFace*>(this)->maxGlyph = gindex;
 
++goodGlyph;
if (m_face->glyph->format == FT_GLYPH_FORMAT_PLOTTER)
const_cast<FtFace*>(this)->isStroked = true;
178,7 → 178,7
{
if (m_glyphWidth.contains(gl))
return;
 
ScFace::GlyphData GRec;
FT_Face face = ftFace();
if (FT_Load_Glyph( face, gl, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP ))
272,37 → 272,37
/// copied from Freetype's FT_Stream_ReadAt()
FT_Error ftIOFunc( FT_Stream stream, unsigned long pos, unsigned char* buffer, unsigned long count)
{
FT_Error error = FT_Err_Ok;
FT_ULong read_bytes;
if ( pos >= stream->size )
{
FT_Error error = FT_Err_Ok;
FT_ULong read_bytes;
 
if ( pos >= stream->size )
{
qDebug( "ftIOFunc: invalid i/o; pos = 0x%lx, size = 0x%lx\n", pos, stream->size );
 
return FT_Err_Invalid_Stream_Operation;
}
if ( stream->read )
}
 
if ( stream->read )
read_bytes = stream->read( stream, pos, buffer, count );
else
{
else
{
read_bytes = stream->size - pos;
if ( read_bytes > count )
read_bytes = count;
 
memcpy( buffer, stream->base + pos, read_bytes );
}
stream->pos = pos + read_bytes;
if ( read_bytes < count )
{
}
 
stream->pos = pos + read_bytes;
 
if ( read_bytes < count )
{
qDebug( "ftIOFunc: invalid read; expected %lu bytes, got %lu\n", count, read_bytes );
 
error = FT_Err_Invalid_Stream_Operation;
}
return error;
}
 
return error;
}
 
 
/trunk/Scribus/scribus/fonts/ftface.h
55,11 → 55,11
 
FtFace(QString fam, QString sty, QString variant, QString scname,
QString psname, QString path, int face);
 
FT_Face ftFace() const;
 
virtual ~FtFace();
 
// font metrics
qreal ascent(qreal sz=1.0) const { return m_ascent * sz; }
qreal descent(qreal sz=1.0) const { return m_descent * sz; }
75,10 → 75,10
QString pdfCapHeightAsString() const { return m_pdfCapHeight; }
QString pdfFontBBoxAsString() const { return m_pdfFontBBox; }
QString ItalicAngleAsString() const { return m_italicAngle; }
 
 
//FIXME QMap<QString,QString> fontDictionary(qreal sz=1.0) const;
 
uint char2CMap(QChar ch) const;
 
qreal glyphKerning (uint gl1, uint gl2, qreal sz) const;
92,7 → 92,7
 
protected:
mutable FT_Face m_face;
 
static FT_Library library;
 
mutable QString m_pdfAscent;
104,7 → 104,7
QString FontEnc;
 
mutable int m_encoding;
 
mutable qreal m_uniEM;
mutable qreal m_ascent;
mutable qreal m_descent;
115,7 → 115,7
mutable qreal m_underlinePos;
mutable qreal m_strikeoutPos;
mutable qreal m_strokeWidth;
 
};
 
#endif
/trunk/Scribus/scribus/fonts/scface.cpp
59,7 → 59,7
}
else if (! m_glyphWidth.contains(gl)) {
loadGlyph(gl);
}
}
const struct GlyphData & data(m_glyphOutline[gl]);
res.width = data.bbox_width * sz;
res.ascent = data.bbox_ascent * sz;
76,7 → 76,7
return size;
else if (! m_glyphWidth.contains(gl)) {
loadGlyph(gl);
}
}
return m_glyphWidth[gl] * size;
}
 
96,7 → 96,7
}
else if (! m_glyphWidth.contains(gl)) {
loadGlyph(gl);
}
}
FPointArray res = m_glyphOutline[gl].Outlines.copy();
if (sz != 1.0)
res.scale(sz, sz);
110,7 → 110,7
return FPoint(0,0);
else if (! m_glyphWidth.contains(gl)) {
loadGlyph(gl);
}
}
const struct GlyphData & res(m_glyphOutline[gl]);
return FPoint(res.x, res.y) * sz;
}
364,7 → 364,7
return emulateGlyph(ch);
 
uint gl = m->char2CMap(ch);
 
if (gl == 0)
return emulateGlyph(ch);
else
/trunk/Scribus/scribus/fonts/scface.h
80,7 → 80,7
SFNT, TTCF, UNKNOWN_FORMAT };
 
static const uint CONTROL_GLYPHS = 2000000000; // 2 billion
 
struct GlyphData {
FPointArray Outlines;
qreal x;
91,8 → 91,8
bool broken;
GlyphData() : Outlines(), x(0), y(0), bbox_width(1), bbox_ascent(1), bbox_descent(0), broken(true) {}
};
 
 
/// see accessors for ScFace for docs
class ScFaceData {
public:
100,7 → 100,7
mutable int refs;
/// controls load()
mutable int usage;
 
QString scName;
QString fontFile;
int faceIndex;
114,11 → 114,11
mutable ScFace::Status status;
ScFace::FontType typeCode;
ScFace::FontFormat formatCode;
 
bool usable;
bool embedPs;
bool subset;
 
bool isStroked;
bool isFixedPitch;
bool hasNames;
127,17 → 127,17
ScFaceData();
virtual ~ScFaceData() { };
protected:
 
friend class ScFace;
Status cachedStatus;
 
// caches
mutable QHash<uint, qreal> m_glyphWidth;
mutable QHash<uint, GlyphData> m_glyphOutline;
mutable QHash<uint, uint> m_cMap;
 
// fill caches & members
 
virtual void load() const
{
m_glyphWidth.clear();
146,7 → 146,7
 
status = qMax(cachedStatus, ScFace::LOADED);
}
 
virtual void unload() const
{
m_glyphWidth.clear();
155,7 → 155,7
 
status = ScFace::UNKNOWN;
}
 
virtual void loadGlyph(uint /*gl*/) const {}
 
// dummy implementations
185,11 → 185,11
virtual qreal glyphWidth(uint gl, qreal sz) const;
virtual FPointArray glyphOutline(uint gl, qreal sz) const;
virtual FPoint glyphOrigin (uint gl, qreal sz) const;
 
};
 
 
 
ScFace();
ScFace(const ScFace& other);
~ScFace();
199,7 → 199,7
 
/// test for null object
bool isNone() const { return m->status == NULLFACE; }
 
ScFace& operator=(const ScFace& other);
/** two ScFaces are equal if they either are both NULLFACEs or they
agree on family, style, variant and fontpath
206,33 → 206,33
*/
bool operator==(const ScFace& other) const ;
bool operator!=(const ScFace& other) const { return ! (*this == other); }
 
 
bool EmbedFont(QString &str);
void RawData(QByteArray & bb);
bool glyphNames(QMap<uint, std::pair<QChar, QString> >& gList);
 
/// prevent unloading of face data
void increaseUsage() const;
 
/// unload face data if not used any more
void decreaseUsage() const;
 
/// unload face data. It will be reloaded on need
void unload() const;
 
/// the name Scribus uses for this font
QString scName() const { return replacedName.isEmpty() ? m->scName : replacedName; }
 
/// the name of the font which was used for replacement
QString replacementName() const { return m->scName; }
 
/// the name of the font which was used for replacement
QString replacementForDoc() const { return replacedInDoc; }
 
/// check if this is a replacement font
bool isReplacement() const { return !replacedName.isEmpty(); }
 
/// makes a repalcement font for font "name" using this fonts data
ScFace mkReplacementFor(QString name, QString doc) {
ScFace result(m);
247,41 → 247,41
replacedName = oldName;
replacedInDoc = doc;
}
 
/// the name PostScript uses for this font
QString psName() const { return m->psName; }
 
/// the physical location of the fontfile
QString fontPath() const { return m->faceIndex >= 0 ? QString("%1(%2)").arg(m->fontFile).arg(m->faceIndex+1) : m->fontFile; }
 
/// the file path of the fontfile
QString fontFilePath() const { return m->fontFile; }
 
/// if the fontfile contains more than one face, the index, else -1
int faceIndex() const { return m->faceIndex; }
 
/// path name of the document this face is local to
QString localForDocument() const { return m->forDocument; }
 
/// font type, eg. Type1 or TTF
FontType type() const { return m->typeCode; }
 
/// font format, which might be a little more complicated
FontFormat format()const { return m->formatCode; }
 
/// test if this face can be used in documents
bool usable() const { return m->usable && !isNone(); }
 
/// test if this face can be embedded in PS/PDF
bool embedPs() const { return m->embedPs && m->status < BROKENGLYPHS; }
 
/// test if this face can be embedded as outlines in PS/PDF
bool subset() const { return m->subset && m->status < BROKEN; }
 
void usable(bool flag) { m->usable = flag; }
void embedPs(bool flag) { m->embedPs = flag; }
void subset(bool flag) { m->subset = flag; }
 
/// deprecated? tells if the face has PS names
bool hasNames() const { return m->hasNames; }
 
290,22 → 290,22
 
/// tells if this font is a fixed pitch font
bool isFixedPitch()const { return m->isFixedPitch; }
 
/// tells if this is an OTF/CFF font
bool isOTF() const { return m->typeCode == OTF; }
 
/// returns the highest glyph index in this face
uint maxGlyph() const { return m->maxGlyph; }
 
/// returns the font family as seen by Scribus
QString family() const { return m->family; }
 
/// returns the font style as seen by Scribus (eg. bold, Italic)
QString style() const { return m->style; }
 
/// returns an additional discriminating String for this face
QString variant() const { return m->variant; }
 
// font metrics
QString pdfAscentAsString() const;
QString pdfDescentAsString() const;
321,20 → 321,20
qreal underlinePos(qreal sz=1.0) const;
qreal strokeWidth(qreal sz=1.0) const;
qreal maxAdvanceWidth(qreal sz=1.0) const;
 
/// deprecated
QString stemV(qreal sz=1.0) const { return fontDictionary(sz)["/StemV"]; }
 
/// deprecated
QString italicAngle(qreal sz=1.0) const { return fontDictionary(sz)["/ItalicAngle"]; }
 
/// deprecated
QString fontBBox(qreal sz=1.0) const { return fontDictionary(sz)["/FontBBox"]; }
 
/// returns a map of values used for font dictionaries in PS/PDF
QMap<QString,QString> fontDictionary(qreal sz=1.0) const { return m->fontDictionary(sz); }
QMap<QString,QString> fontDictionary(qreal sz=1.0) const { return m->fontDictionary(sz); }
// glyph interface
 
/// returns the glyphs normal advance width at size 'sz'
qreal glyphWidth(uint gl, qreal sz=1.0) const { return m->glyphWidth(gl, sz); }
 
349,7 → 349,7
 
/// returns the glyph's origin FIXME: what's that exactly?
FPoint glyphOrigin(uint gl, qreal sz=1.0) const { return m->glyphOrigin(gl, sz); }
 
// char interface
 
/// test if the face can render this char
360,28 → 360,28
 
/// returns the combined glyph width and kerning for 'ch' if followed by 'ch2'
qreal charWidth(QChar ch, qreal sz=1.0, QChar ch2 = QChar(0)) const;
 
/// deprecated, see glyphBBox()
qreal realCharWidth(QChar ch, qreal sz=1.0) const { return glyphBBox(char2CMap(ch),sz).width; }
 
/// deprecated, see glyphBBox()
qreal realCharHeight(QChar ch, qreal sz=1.0) const { GlyphMetrics gm=glyphBBox(char2CMap(ch),sz); return gm.ascent + gm.descent; }
 
/// deprecated, see glyphBBox()
qreal realCharAscent(QChar ch, qreal sz=1.0) const { return glyphBBox(char2CMap(ch),sz).ascent; }
 
/// deprecated, see glyphBBox()
qreal realCharDescent(QChar ch, qreal sz=1.0) const { return glyphBBox(char2CMap(ch),sz).descent; }
 
private:
 
friend class SCFonts;
 
ScFace(ScFaceData* md);
ScFaceData* m;
QString replacedName;
QString replacedInDoc;
 
void initFaceData();
void checkAllGlyphs();
uint emulateGlyph(QChar c) const;
/trunk/Scribus/scribus/fonts/scface_ttf.cpp
565,7 → 565,7
while ((pos & 3) != 0)
bb.data()[pos++] = '\0';
}
}
}
else if (formatCode == ScFace::TYPE42) {
FtFace::RawData(bb);
}
/trunk/Scribus/scribus/fonts/scfontmetrics.cpp
355,7 → 355,7
GList.insert(gindex, std::make_pair(QChar(static_cast<uint>(charcode)), adobeGlyphName(charcode)));
else
GList.insert(gindex, std::make_pair(QChar(static_cast<uint>(charcode)), QString(reinterpret_cast<char*>(buf))));
 
charcode = FT_Get_Next_Char(face, charcode, &gindex );
}
 
387,7 → 387,7
// qDebug() << "\tmore: " << gindex << " '" << charcode << "' --> '" << buf << "'";
GList.insert(gindex, std::make_pair(QChar(static_cast<uint>(charcode)), glyphname));
}
 
return true;
}
 
/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
417,7 → 417,7
// setup only preview
if (fileName != tmpFile)
return retval;
if (gs == 0)
if (gs == 0)
{
ui.sampleLabel->setPixmap(QPixmap(fileName));
ui.okButton->setEnabled(true);
/trunk/Scribus/scribus/plugins/export/pixmapexport/dialog.cpp
32,7 → 32,7
QDirModel * dirModel = new QDirModel(this);
dirModel->setFilter(QDir::AllDirs);
outputDirectory->setCompleter(new QCompleter(dirModel, this));
 
outputDirectory->setText( QDir::toNativeSeparators(prefs->get("wdir", QDir::currentPath())) );
QList<QByteArray> imgs = QImageWriter::supportedImageFormats();
for (int a = 0; a < imgs.count(); a++)
42,11 → 42,11
setCurrentComboItem(bitmapType, type.toLower());
qualityBox->setValue(quality);
qualityBox->setWrapping(true);
 
DPIBox->setValue(size);
enlargementBox->setValue(size);
onePageRadio->setChecked( true );
pageNrButton->setIcon(loadIcon("ellipsis.png"));
pageNrButton->setIcon(loadIcon("ellipsis.png"));
rangeVal->setEnabled(false);
pageNrButton->setEnabled(false);
 
53,7 → 53,7
languageChange();
readConfig();
computeSize();
 
connect(outputDirectoryButton, SIGNAL(clicked()), this, SLOT(OutputDirectoryButton_pressed()));
connect(intervalPagesRadio, SIGNAL(clicked()), this, SLOT(IntervalPagesRadio_stateChanged()));
connect(allPagesRadio, SIGNAL(clicked()), this, SLOT(AllPagesRadio_stateChanged()));
/trunk/Scribus/scribus/plugins/export/pixmapexport/dialog.h
31,7 → 31,7
PrefsContext* prefs;
ScribusDoc* m_doc;
int m_PageCount;
 
protected slots:
virtual void createPageNumberRange();
virtual void languageChange();
/trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp
147,7 → 147,7
exportBack->setToolTip( tr("Adds the Page itself as background to the SVG."));
exportBack->setChecked(false);
openDia->addWidgets(exportBack);
 
if (!openDia->exec())
return true;
fileName = openDia->selectedFile();
1639,11 → 1639,11
QDomElement SVGExPlug::processInlineItem(double xpos, double ypos, QTransform &finalMat, PageItem* embItem, const CharStyle & charStyle, bool pathT, QString trans)
{
QList<PageItem*> emG;
if (embItem->isGroup())
emG = embItem->getItemList();
else
emG.append(embItem);
if (embItem->isGroup())
emG = embItem->getItemList();
else
emG.append(embItem);
 
QDomElement layerGroup = docu.createElement("g");
if (pathT)
layerGroup.setAttribute("transform", MatrixToStr(finalMat));
/trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp
886,18 → 886,18
for (int a = ls.firstItem; a <= ls.lastItem; ++a)
{
//ScText *hl = Item->itemText.item_p(a);
QChar chr = Item->itemText.text(a);
QChar chr = Item->itemText.text(a);
CharStyle charStyle = Item->itemText.charStyle(a);
GlyphLayout* glyphs = Item->itemText.getGlyphs(a);
LayoutFlags flags = Item->itemText.flags(a);
LayoutFlags flags = Item->itemText.flags(a);
const ScFace* font = &charStyle.font();
txtRunItem txItem;
txItem.chr = chr;
txItem.chr = chr;
txItem.glyphs = glyphs;
txItem.style = charStyle;
txItem.index = a;
txItem.CurX = CurX;
txItem.embItem = Item->itemText.hasObject(a)? Item->itemText.object(a) : NULL;
txItem.embItem = Item->itemText.hasObject(a)? Item->itemText.object(a) : NULL;
if (!((font->type() == ScFace::TTF) || (font->type() == ScFace::OTF)))
{
specialText.append(txItem);
1031,11 → 1031,11
mm.scale(1, txItem.style.scaleV() / 1000.0);
obO.setAttribute("RenderTransform", MatrixToStr(mm));
QList<PageItem*> emG;
if (txItem.embItem->isGroup())
emG = txItem.embItem->getItemList();
else
emG.append(txItem.embItem);
for (int em = 0; em < emG.count(); ++em)
if (txItem.embItem->isGroup())
emG = txItem.embItem->getItemList();
else
emG.append(txItem.embItem);
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embed = emG.at(em);
writeItemOnPage(embed->gXpos, embed->gYpos, embed, obO, rel_root);
1268,9 → 1268,9
const CharStyle& charStyle(Item->asPathText()->itemRenderText.charStyle(a));
const PathData* pdata = &(Item->asPathText()->textLayout.point(a));
const GlyphLayout* glyphs = Item->asPathText()->itemRenderText.getGlyphs(a);
PageItem* embItem = Item->asPathText()->itemRenderText.hasObject(a)?
Item->asPathText()->itemRenderText.object(a) : NULL;
PageItem* embItem = Item->asPathText()->itemRenderText.hasObject(a)?
Item->asPathText()->itemRenderText.object(a) : NULL;
chstr = Item->asPathText()->itemRenderText.text(a,1);
if ((chstr == QChar(13)) || (chstr == QChar(29)))
continue;
1327,11 → 1327,11
mm.scale(1, charStyle.scaleV() / 1000.0);
obO.setAttribute("RenderTransform", MatrixToStr(mm));
QList<PageItem*> emG;
if (embItem->isGroup())
emG = embItem->getItemList();
else
emG.append(embItem);
for (int em = 0; em < emG.count(); ++em)
if (embItem->isGroup())
emG = embItem->getItemList();
else
emG.append(embItem);
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embed = emG.at(em);
writeItemOnPage(embed->gXpos, embed->gYpos, embed, obO, rel_root);
/trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.h
119,12 → 119,12
QMap<QString, QString> xps_fontMap;
struct txtRunItem
{
QChar chr;
GlyphLayout* glyphs;
QChar chr;
GlyphLayout* glyphs;
CharStyle style;
int index;
double CurX;
PageItem* embItem;
PageItem* embItem;
};
double m_dpi;
};
/trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
1229,13 → 1229,13
}
if(pdfF.tagName() == "Effekte")
{
struct PDFPresentationData ef;
ef.pageEffectDuration = pdfF.attribute("pageEffectDuration").toInt();
ef.pageViewDuration = pdfF.attribute("pageViewDuration").toInt();
ef.effectType = pdfF.attribute("effectType").toInt();
ef.Dm = pdfF.attribute("Dm").toInt();
ef.M = pdfF.attribute("M").toInt();
ef.Di = pdfF.attribute("Di").toInt();
struct PDFPresentationData ef;
ef.pageEffectDuration = pdfF.attribute("pageEffectDuration").toInt();
ef.pageViewDuration = pdfF.attribute("pageViewDuration").toInt();
ef.effectType = pdfF.attribute("effectType").toInt();
ef.Dm = pdfF.attribute("Dm").toInt();
ef.M = pdfF.attribute("M").toInt();
ef.Di = pdfF.attribute("Di").toInt();
EffVal.append(ef);
}
PFO = PFO.nextSibling();
2042,11 → 2042,11
}
delete last;
 
// if (obj.attribute("NEXTPAGE").toInt() == pageNumber)
// {
// if (obj.attribute("NEXTPAGE").toInt() == pageNumber)
// {
// Neu->NextIt = baseobj + obj.attribute("NEXTITEM").toInt();
// nextPg[Neu->ItemNr] = a; // obj.attribute("NEXTPAGE").toInt();
// }
// nextPg[Neu->ItemNr] = a; // obj.attribute("NEXTPAGE").toInt();
// }
// else
// Neu->NextIt = -1;
if (Neu->isTableItem)
2160,7 → 2160,7
}
allItems.clear();
}
 
if (!Mpage)
m_View->reformPages();
PAGE=DOC.firstChild();
/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
745,7 → 745,7
if (m_mwProgressBar!=0)
m_mwProgressBar->setValue(reader.characterOffset());
return true;
// return false;
// return false;
}
 
// Low level plugin API
2349,7 → 2349,7
 
for (int cxx=0; cxx<tmp2.length(); ++cxx)
{
QChar ch = tmp2.at(cxx);
QChar ch = tmp2.at(cxx);
{ // Legacy mode
if (ch == QChar(5))
ch = SpecialChars::PARSEP;
2356,7 → 2356,7
if (ch == QChar(4))
ch = SpecialChars::TAB;
}
 
int pos = obj->itemText.length();
if (ch == SpecialChars::OBJECT)
{
2374,16 → 2374,16
else if (ch == SpecialChars::SHYPHEN && pos > 0)
{
// qDebug() << QString("scribus134format: SHYPHEN at %1").arg(pos);
// double SHY means user provided SHY, single SHY is automatic one
// double SHY means user provided SHY, single SHY is automatic one
if (obj->itemText.hasFlag(pos-1, ScLayout_HyphenationPossible))
{
{
obj->itemText.clearFlag(pos-1, ScLayout_HyphenationPossible);
obj->itemText.insertChars(pos, QString(ch));
}
else
{
obj->itemText.insertChars(pos, QString(ch));
}
else
{
obj->itemText.setFlag(pos-1, ScLayout_HyphenationPossible);
}
}
}
else {
obj->itemText.insertChars(pos, QString(ch));
3371,7 → 3371,7
ta->BottomLink = 0;
}
}
 
// reestablish textframe links
if (itemNext.count() != 0 && !Mpage)
{
3415,7 → 3415,7
}
}
}
 
// reestablish first/lastAuto
m_Doc->FirstAuto = m_Doc->LastAuto;
if (m_Doc->LastAuto)
/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
116,11 → 116,11
bool readTableOfContents(ScribusDoc* doc, ScXmlStreamReader& reader);
 
PageItem* pasteItem(ScribusDoc *doc, ScXmlStreamAttributes& attrs, const QString& baseDir, int pagenr = -2 /* currentPage*/);
 
QMap<QString, QString> parStyleMap;
QMap<uint, QString> legacyStyleMap;
uint legacyStyleCount;
 
QMap<int, int> groupRemap;
QMap<int, int> itemRemap;
QMap<int, int> itemNext;
/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
1085,7 → 1085,7
m_Doc->Pages->at(pdoE)->PresentVals = EffVal[pdoE];
}
}
 
// reestablish textframe links
if (itemNext.count() != 0)
{
1234,7 → 1234,7
 
if (it->hasAttribute("CSIZE"))
newStyle.setFontSize(qRound(ScCLocale::toDoubleC(it->attribute("CSIZE")) * 10));
 
if (it->hasAttribute("CCOLOR"))
newStyle.setFillColor(it->attribute("CCOLOR"));
 
1246,7 → 1246,7
handleOldColorShade(doc, fColor, fShade);
newStyle.setFillColor(fColor);
newStyle.setFillShade(fShade);
 
if (it->hasAttribute("CEXTRA"))
{
double cv = ScCLocale::toDoubleC(it->attribute("CEXTRA"));
1255,13 → 1255,13
}
else if (it->hasAttribute("CKERN"))
newStyle.setTracking(it->attribute("CKERN").toInt());
 
if (it->hasAttribute("CSTYLE"))
newStyle.setFeatures(static_cast<StyleFlag>(it->attribute("CSTYLE").toInt()).featureList());
 
QString pstylename = it->attribute("PSTYLE", "");
int calign = it->attribute("CALIGN", "-1").toInt();
int calign = it->attribute("CALIGN", "-1").toInt();
 
int ab = it->attribute("CAB", "-1").toInt();
if (ab >= 5) {
pstylename = DoVorl[ab];
1271,10 → 1271,10
pstylename = "";
calign = ab;
}
 
if (it->hasAttribute("CSTROKE"))
newStyle.setStrokeColor(it->attribute("CSTROKE", CommonStrings::None));
 
if (it->hasAttribute("CSHADE2"))
newStyle.setStrokeShade(it->attribute("CSHADE2", "100").toInt());
 
1283,13 → 1283,13
handleOldColorShade(doc, sColor, sShade);
newStyle.setStrokeColor(sColor);
newStyle.setStrokeShade(sShade);
 
if (it->hasAttribute("CSCALE"))
newStyle.setScaleH(qMin(qMax(qRound(ScCLocale::toDoubleC(it->attribute("CSCALE"), 100.0) * 10), 100), 4000));
 
if (it->hasAttribute("CSCALEV"))
newStyle.setScaleV(qMin(qMax(qRound(ScCLocale::toDoubleC(it->attribute("CSCALEV"), 100.0) * 10), 100), 4000));
 
if (it->hasAttribute("CBASE"))
newStyle.setBaselineOffset(qRound(ScCLocale::toDoubleC(it->attribute("CBASE"), 0.0) * 10));
 
1298,7 → 1298,7
 
if (it->hasAttribute("CSHY"))
newStyle.setShadowYOffset(qRound(ScCLocale::toDoubleC(it->attribute("CSHY"), -5.0) * 10));
 
if (it->hasAttribute("COUT"))
newStyle.setOutlineWidth(qRound(ScCLocale::toDoubleC(it->attribute("COUT"), 1.0) * 10));
 
1311,7 → 1311,7
if (it->hasAttribute("CSTP"))
newStyle.setStrikethruOffset(qRound(ScCLocale::toDoubleC(it->attribute("CSTP"), -0.1) * 10));
 
if (it->hasAttribute("CSTW"))
newStyle.setStrikethruWidth(qRound(ScCLocale::toDoubleC(it->attribute("CSTW"), -0.1) * 10));
 
1318,7 → 1318,7
int iobj = it->attribute("COBJ", "-1").toInt();
for (int cxx=0; cxx<tmp2.length(); ++cxx)
{
QChar ch = tmp2.at(cxx);
QChar ch = tmp2.at(cxx);
{ // Legacy mode
if (ch == QChar(5))
ch = SpecialChars::PARSEP;
1441,7 → 1441,7
else
{
QList<ParagraphStyle::TabRecord> tbs;
vg.setTabValues(tbs);
vg.setTabValues(tbs);
QDomNode IT = pg.firstChild();
while(!IT.isNull())
{
2414,7 → 2414,7
}
}
}
 
// reestablish first/lastAuto
m_Doc->FirstAuto = m_Doc->LastAuto;
if (m_Doc->LastAuto)
/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
704,7 → 704,7
QStack< QList<PageItem*> > groupStackM;
QStack< QList<PageItem*> > groupStackP;
QStack<int> groupStack2;
 
QByteArray docBytes("");
loadRawText(fileName, docBytes);
QString f = QString::fromUtf8(docBytes);
714,13 → 714,13
return false;
}
QString fileDir = QFileInfo(fileName).absolutePath();
 
if (m_mwProgressBar!=0)
{
m_mwProgressBar->setMaximum(f.length());
m_mwProgressBar->setValue(0);
}
 
itemRemap.clear();
itemNext.clear();
itemCount = 0;
1907,7 → 1907,7
}
//update names to pointers
updateNames2Ptr();
 
// reestablish first/lastAuto
m_Doc->FirstAuto = m_Doc->LastAuto;
if (m_Doc->LastAuto)
1922,7 → 1922,7
if (m_Doc->autoSave() && ScCore->usingGUI())
m_Doc->restartAutoSaveTimer();
// m_Doc->autoSaveTimer->start(m_Doc->autoSaveTime());
 
if (m_mwProgressBar!=0)
m_mwProgressBar->setValue(reader.characterOffset());
return true;
1951,7 → 1951,7
 
namespace {
const int NOVALUE = -16000;
 
void fixLegacyCharStyle(CharStyle& cstyle)
{
if (! cstyle.font().usable())
1991,7 → 1991,7
if (cstyle.tracking() <= -16000 / 10)
cstyle.resetTracking();
}
 
void fixLegacyParStyle(ParagraphStyle& pstyle)
{
if (pstyle.lineSpacing() <= -16000)
2014,7 → 2014,7
pstyle.resetParEffectOffset();
fixLegacyCharStyle(pstyle.charStyle());
}
 
}// namespace
 
void Scribus150Format::readDocAttributes(ScribusDoc* doc, ScXmlStreamAttributes& attrs)
2067,13 → 2067,13
m_Doc->setHyphAutomatic(attrs.valueAsBool("AUTOMATIC", true));
m_Doc->setHyphAutoCheck(attrs.valueAsBool("AUTOCHECK", false));
m_Doc->GuideLock = attrs.valueAsBool("GUIDELOCK", false);
 
m_Doc->rulerXoffset = attrs.valueAsDouble("rulerXoffset", 0.0);
m_Doc->rulerYoffset = attrs.valueAsDouble("rulerYoffset", 0.0);
m_Doc->SnapGuides = attrs.valueAsBool("SnapToGuides", false);
m_Doc->SnapElement = attrs.valueAsBool("SnapToElement", false);
m_Doc->SnapGrid = attrs.valueAsBool("SnapToGrid", false);
 
m_Doc->setAutoSave(attrs.valueAsBool("AutoSave", false));
m_Doc->setAutoSaveTime(attrs.valueAsInt("AutoSaveTime", 600000));
double leftScratch;
2087,11 → 2087,11
attrs.valueAsDouble("ScratchBottom", 20.0),attrs.valueAsDouble("ScratchRight", 100.0));
m_Doc->setPageGapHorizontal(attrs.valueAsDouble("GapHorizontal", -1.0));
m_Doc->setPageGapVertical(attrs.valueAsDouble("GapVertical", -1.0));
 
if (attrs.hasAttribute("PAGEC"))
m_Doc->setPaperColor(QColor(attrs.valueAsString("PAGEC")));
//->Prefs m_Doc->papColor = QColor(attrs.valueAsString("PAGEC"));
 
m_Doc->setMarginColored(attrs.valueAsBool("RANDF", false));
 
readCMSSettings(doc, attrs);
2415,75 → 2415,75
static const QString FONT("FONT");
if (attrs.hasAttribute(FONT))
newStyle.setFont(m_AvailableFonts->findFont(attrs.valueAsString(FONT), doc));
 
static const QString FONTSIZE("FONTSIZE");
if (attrs.hasAttribute(FONTSIZE))
newStyle.setFontSize(qRound(attrs.valueAsDouble(FONTSIZE) * 10));
 
static const QString FCOLOR("FCOLOR");
if (attrs.hasAttribute(FCOLOR))
newStyle.setFillColor(attrs.valueAsString(FCOLOR));
 
static const QString KERN("KERN");
if (attrs.hasAttribute(KERN))
newStyle.setTracking(qRound(attrs.valueAsDouble(KERN) * 10));
 
static const QString FSHADE("FSHADE");
if (attrs.hasAttribute(FSHADE))
newStyle.setFillShade(attrs.valueAsInt(FSHADE));
 
static const QString EFFECTS("EFFECTS");
if (attrs.hasAttribute(EFFECTS))
newStyle.setFeatures(static_cast<StyleFlag>(attrs.valueAsInt(EFFECTS)).featureList());
 
static const QString EFFECT("EFFECT");
if (attrs.hasAttribute(EFFECT))
newStyle.setFeatures(static_cast<StyleFlag>(attrs.valueAsInt(EFFECT)).featureList());
 
static const QString FEATURES("FEATURES");
if (attrs.hasAttribute(FEATURES))
newStyle.setFeatures(attrs.valueAsString(FEATURES).split( " ", QString::SkipEmptyParts));
 
static const QString SCOLOR("SCOLOR");
if (attrs.hasAttribute(SCOLOR))
newStyle.setStrokeColor(attrs.valueAsString(SCOLOR, CommonStrings::None));
 
static const QString SSHADE("SSHADE");
if (attrs.hasAttribute(SSHADE))
newStyle.setStrokeShade(attrs.valueAsInt(SSHADE));
 
static const QString SCALEH("SCALEH");
if (attrs.hasAttribute(SCALEH))
newStyle.setScaleH(qRound(attrs.valueAsDouble(SCALEH) * 10));
 
static const QString SCALEV("SCALEV");
if (attrs.hasAttribute(SCALEV))
newStyle.setScaleV(qRound(attrs.valueAsDouble(SCALEV) * 10));
 
static const QString BASEO("BASEO");
if (attrs.hasAttribute(BASEO))
newStyle.setBaselineOffset(qRound(attrs.valueAsDouble(BASEO) * 10));
 
static const QString TXTSHX("TXTSHX");
if (attrs.hasAttribute(TXTSHX))
newStyle.setShadowXOffset(qRound(attrs.valueAsDouble(TXTSHX) * 10));
 
static const QString TXTSHY("TXTSHY");
if (attrs.hasAttribute(TXTSHY))
newStyle.setShadowYOffset(qRound(attrs.valueAsDouble(TXTSHY) * 10));
 
static const QString TXTOUT("TXTOUT");
if (attrs.hasAttribute(TXTOUT))
newStyle.setOutlineWidth(qRound(attrs.valueAsDouble(TXTOUT) * 10));
 
static const QString TXTULP("TXTULP");
if (attrs.hasAttribute(TXTULP))
newStyle.setUnderlineOffset(qRound(attrs.valueAsDouble(TXTULP) * 10));
 
static const QString TXTULW("TXTULW");
if (attrs.hasAttribute(TXTULW))
newStyle.setUnderlineWidth(qRound(attrs.valueAsDouble(TXTULW) * 10));
 
static const QString TXTSTP("TXTSTP");
if (attrs.hasAttribute(TXTSTP))
newStyle.setStrikethruOffset(qRound(attrs.valueAsDouble(TXTSTP) * 10));
2553,7 → 2553,7
newStyle.setDefaultStyle(true);
else
newStyle.setDefaultStyle(false);
 
QString parentStyle = attrs.valueAsString("PARENT", "");
if (!parentStyle.isEmpty() && (parentStyle != newStyle.name()))
{
2676,7 → 2676,7
static const QString PSHORTCUT("PSHORTCUT");
if (attrs.hasAttribute(PSHORTCUT))
newStyle.setShortcut(attrs.valueAsString(PSHORTCUT));
 
static const QString OpticalMargins("OpticalMargins");
if (attrs.hasAttribute(OpticalMargins))
newStyle.setOpticalMargins(attrs.valueAsInt(OpticalMargins));
2700,7 → 2700,7
static const QString MaxGlyphExtend("MaxGlyphExtend");
if (attrs.hasAttribute(MaxGlyphExtend))
newStyle.setMaxGlyphExtension(attrs.valueAsDouble(MaxGlyphExtend));
 
static const QString KeepLinesStart("KeepLinesStart");
if (attrs.hasAttribute(KeepLinesStart))
newStyle.setKeepLinesStart(attrs.valueAsInt(KeepLinesStart));
4098,7 → 4098,7
pat.scaleY = attrs.valueAsDouble("scaleY", 0.0);
pat.xoffset = attrs.valueAsDouble("xoffset", 0.0);
pat.yoffset = attrs.valueAsDouble("yoffset", 0.0);
 
uint itemCount1 = m_Doc->Items->count();
bool savedAlignGrid = m_Doc->SnapGrid;
bool savedAlignGuides = m_Doc->SnapGuides;
4509,7 → 4509,7
tmp2.replace(QRegExp("\n"), QChar(13));
tmp2.replace(QRegExp("\t"), QChar(9));
}
 
// more legacy stuff:
QString pstylename = attrs.valueAsString("PSTYLE", "");
 
4516,7 → 4516,7
fixLegacyCharStyle(newStyle);
last->ParaStyle = pstylename;
// end of legacy stuff
 
int iobj = attrs.valueAsInt("COBJ", -1);
 
for (int cxx=0; cxx<tmp2.length(); ++cxx)
5838,7 → 5838,7
notesMasterMarks.clear();
notesNSets.clear();
 
QScopedPointer<QIODevice> ioDevice(slaReader(fileName));
QScopedPointer<QIODevice> ioDevice(slaReader(fileName));
if (ioDevice.isNull())
{
setFileReadError();
6369,7 → 6369,7
gItem->groupItemList = gpL;
}
}
 
// reestablish first/lastAuto
m_Doc->FirstAuto = m_Doc->LastAuto;
if (m_Doc->LastAuto)
/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
413,10 → 413,10
writeSections(docu);
writePatterns(docu, fileDir);
writeContent (docu, fileDir);
 
docu.writeEndElement();
docu.writeEndDocument();
 
bool writeSucceed = false;
const QFile* qFile = dynamic_cast<QFile*>(outputFile.get());
if (qFile)
645,7 → 645,7
docu.writeAttribute("PARENT", style.parent());
if ( style.isDefaultStyle())
docu.writeAttribute("DefaultStyle", style.isDefaultStyle());
 
if ( ! style.isInhAlignment())
docu.writeAttribute("ALIGN", style.alignment());
if ( ! style.isInhLineSpacingMode())
1549,7 → 1549,7
{
const CharStyle& style1(item->itemText.charStyle(k));
const QChar ch = item->itemText.text(k);
 
if (ch == SpecialChars::OBJECT ||
ch == SpecialChars::TAB ||
ch == SpecialChars::PARSEP ||
1587,9 → 1587,9
docu.writeAttribute("Unicode", tmpnum);
docu.writeAttribute("COBJ", item->itemText.object(k)->inlineCharID);
}
else if (ch == SpecialChars::OBJECT && item->itemText.hasMark(k))
else if (ch == SpecialChars::OBJECT && item->itemText.hasMark(k))
{
Mark* mark = item->itemText.mark(k);
Mark* mark = item->itemText.mark(k);
if (!mark->isType(MARKBullNumType))
{ //dont save marks for bullets and numbering
docu.writeEmptyElement("MARK");
2108,7 → 2108,7
}
}
}
 
if (item->asLatexFrame())
{
docu.writeStartElement("LATEX");
2486,7 → 2486,7
docu.writeAttribute("spiralEndAngle", arcitem->spiralEndAngle);
docu.writeAttribute("spiralFactor", arcitem->spiralFactor);
}
if(item->isAnnotation())
if (item->isAnnotation())
{
docu.writeAttribute("ANNOTATION",1);
docu.writeAttribute("ANTYPE", item->annotation().Type());
/trunk/Scribus/scribus/plugins/fontpreview/fontpreview.h
63,7 → 63,7
 
/*! \brief Create a pixmap sample with font preview.
With GUI oprions. */
void paintSample();
void paintSample();
 
/*! \brief Check if is there any item in list to prevent crashes.
It allows not to paint the sample if there could be memory leak.
/trunk/Scribus/scribus/plugins/gettext/csvim/csvim.cpp
150,7 → 150,7
}
return; // line done
}
 
int vdIndexStart = line.indexOf(valueDelimiter);
int vdIndexEnd = line.indexOf(valueDelimiter, vdIndexStart + 1);
if (vdIndexEnd < 0)
161,10 → 161,10
data += "\t" + line;
return; // error in line, no closing valuedelimiter could be found
}
 
int fdIndex = line.indexOf(fieldDelimiter, vdIndexEnd + 1);
QString tmpCol = "";
 
if (fdIndex < 0)
{
if (vdIndexEnd < 0)
185,7 → 185,7
++colIndex;
return; // no more field delimiters left
}
 
if (fdIndex < vdIndexStart)
{
tmpCol = line.mid(0, fdIndex);
/trunk/Scribus/scribus/plugins/gettext/docim/docim.cpp
49,7 → 49,7
QString FileFormatName()
{
if (hasAntiword())
return QObject::tr("Word Documents");
return QObject::tr("Word Documents");
else
return QString::null;
}
57,7 → 57,7
QStringList FileExtensions()
{
if (hasAntiword())
return QStringList("doc");
return QStringList("doc");
else
return QStringList();
}
/trunk/Scribus/scribus/plugins/gettext/odtim/contentreader.cpp
21,7 → 21,7
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
 
#include <QGlobalStatic>
/trunk/Scribus/scribus/plugins/gettext/odtim/stylereader.cpp
21,7 → 21,7
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "stylereader.h"
40,45 → 40,45
StyleReader::StyleReader(QString documentName, gtWriter *w,
bool textOnly, bool prefix, bool combineStyles)
{
sreader = this;
docname = documentName;
readProperties = false;
writer = w;
importTextOnly = textOnly;
usePrefix = prefix;
sreader = this;
docname = documentName;
readProperties = false;
writer = w;
importTextOnly = textOnly;
usePrefix = prefix;
packStyles = combineStyles;
currentStyle = 0;
currentStyle = 0;
currentListStyle = 0;
parentStyle = 0;
inList = false;
currentList = "";
parentStyle = 0;
inList = false;
currentList = "";
defaultStyleCreated = false;
}
 
bool StyleReader::startElement(const QString&, const QString&, const QString &name, const QXmlAttributes &attrs)
{
if (name == "style:default-style")
defaultStyle(attrs);
else if (name == "style:paragraph-properties" ||
name == "style:text-properties" ||
name == "style:list-level-properties")
styleProperties(attrs);
else if (name == "style:style")
styleStyle(attrs);
else if (name == "style:tab-stop")
tabStop(attrs);
else if (name == "text:list-style")
{
for (int i = 0; i < attrs.count(); ++i)
if (attrs.localName(i) == "style:name")
currentList = attrs.value(i);
bool StyleReader::startElement(const QString&, const QString&, const QString &name, const QXmlAttributes &attrs)
{
if (name == "style:default-style")
defaultStyle(attrs);
else if (name == "style:paragraph-properties" ||
name == "style:text-properties" ||
name == "style:list-level-properties")
styleProperties(attrs);
else if (name == "style:style")
styleStyle(attrs);
else if (name == "style:tab-stop")
tabStop(attrs);
else if (name == "text:list-style")
{
for (int i = 0; i < attrs.count(); ++i)
if (attrs.localName(i) == "style:name")
currentList = attrs.value(i);
currentListStyle = new ListStyle(currentList);
inList = true;
}
else if (((name == "text:list-level-style-bullet") ||
(name == "text:list-level-style-number") ||
(name == "text:list-level-style-image")) && (inList))
{
inList = true;
}
else if (((name == "text:list-level-style-bullet") ||
(name == "text:list-level-style-number") ||
(name == "text:list-level-style-image")) && (inList))
{
BulletType bstyle = Bullet;
QString prefix = "";
QString suffix = "";
86,28 → 86,28
uint ulevel = 0;
uint displayLevels = 1;
uint startAt = 0;
QString level = "";
for (int i = 0; i < attrs.count(); ++i)
{
if (attrs.localName(i) == "text:level")
{
QString level = "";
for (int i = 0; i < attrs.count(); ++i)
{
if (attrs.localName(i) == "text:level")
{
ulevel = QString(attrs.value(i)).toUInt();
gtStyle *plist;
if (attrs.value(i) == "1")
{
plist = listParents[currentList];
}
else
{
int level = (attrs.value(i)).toInt();
--level;
plist = styles[QString(currentList + "_%1").arg(level)];
}
gtParagraphStyle *pstyle;
if (plist == NULL)
gtStyle *plist;
if (attrs.value(i) == "1")
{
plist = listParents[currentList];
}
else
{
int level = (attrs.value(i)).toInt();
--level;
plist = styles[QString(currentList + "_%1").arg(level)];
}
gtParagraphStyle *pstyle;
if (plist == NULL)
{
if (styles.contains("default-style"))
plist = new gtStyle(*(styles["default-style"]));
plist = new gtStyle(*(styles["default-style"]));
else
{
gtParagraphStyle* pstyle = new gtParagraphStyle(*(writer->getDefaultStyle()));
115,21 → 115,21
plist = dynamic_cast<gtStyle*>(pstyle);
}
}
if (plist->target() == "paragraph")
{
pstyle = dynamic_cast<gtParagraphStyle*>(plist);
 
if (plist->target() == "paragraph")
{
pstyle = dynamic_cast<gtParagraphStyle*>(plist);
assert(pstyle != NULL);
gtParagraphStyle* tmp = new gtParagraphStyle(*pstyle);
currentStyle = tmp;
}
else
{
gtParagraphStyle* tmp = new gtParagraphStyle(*plist);
currentStyle = tmp;
}
currentStyle->setName(currentList + "_" + attrs.value(i));
}
gtParagraphStyle* tmp = new gtParagraphStyle(*pstyle);
currentStyle = tmp;
}
else
{
gtParagraphStyle* tmp = new gtParagraphStyle(*plist);
currentStyle = tmp;
}
currentStyle->setName(currentList + "_" + attrs.value(i));
}
else if (attrs.localName(i) == "style:num-prefix")
prefix = attrs.value(i);
else if (attrs.localName(i) == "style:num-suffix")
159,7 → 159,7
if (displayLevels == 0)
displayLevels = 1;
}
}
}
if (bstyle == Bullet) {
prefix = "";
suffix = "";
166,7 → 166,7
}
ListLevel *llevel = new ListLevel(ulevel, bstyle, prefix, suffix, bullet, displayLevels, startAt);
currentListStyle->addLevel(ulevel, llevel);
readProperties = true;
readProperties = true;
 
gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle);
assert(s != NULL);
179,200 → 179,200
Q_ASSERT(((int) bstyle > 0) && ((int) bstyle < 6));
s->setNum(true, (int) bstyle -1, ulevel, startAt+1, prefix, suffix);
}
}
else if ((name == "style:drop-cap") && (readProperties))
{
if (currentStyle->target() == "paragraph")
{
for (int i = 0; i < attrs.count(); ++i)
{
if (attrs.localName(i) == "style:lines")
{
bool ok = false;
QString sd = attrs.value(i);
int dh = sd.toInt(&ok);
if (ok)
{
gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle);
}
else if ((name == "style:drop-cap") && (readProperties))
{
if (currentStyle->target() == "paragraph")
{
for (int i = 0; i < attrs.count(); ++i)
{
if (attrs.localName(i) == "style:lines")
{
bool ok = false;
QString sd = attrs.value(i);
int dh = sd.toInt(&ok);
if (ok)
{
gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle);
assert(s != NULL);
s->setDropCapHeight(dh);
s->setDropCap(true);
}
}
}
}
}
else if (name == "style:font-face")
{
QString key = "";
QString family = "";
QString style = "";
for (int i = 0; i < attrs.count(); ++i)
{
if (attrs.localName(i) == "style:name")
key = attrs.value(i);
else if (attrs.localName(i) == "svg:font-family")
{
family = attrs.value(i);
family = family.remove("'");
}
else if (attrs.localName(i) == "style:font-style-name")
style += attrs.value(i) + " ";
}
QString name = family + " " + style;
s->setDropCapHeight(dh);
s->setDropCap(true);
}
}
}
}
}
else if (name == "style:font-face")
{
QString key = "";
QString family = "";
QString style = "";
for (int i = 0; i < attrs.count(); ++i)
{
if (attrs.localName(i) == "style:name")
key = attrs.value(i);
else if (attrs.localName(i) == "svg:font-family")
{
family = attrs.value(i);
family = family.remove("'");
}
else if (attrs.localName(i) == "style:font-style-name")
style += attrs.value(i) + " ";
}
QString name = family + " " + style;
name = name.simplified();
fonts[key] = name;
}
return true;
}
fonts[key] = name;
}
return true;
}
void StyleReader::defaultStyle(const QXmlAttributes& attrs)
{
currentStyle = NULL;
for (int i = 0; i < attrs.count(); ++i)
if (attrs.localName(i) == "style:family")
if (attrs.value(i) == "paragraph")
{
void StyleReader::defaultStyle(const QXmlAttributes& attrs)
{
currentStyle = NULL;
for (int i = 0; i < attrs.count(); ++i)
if (attrs.localName(i) == "style:family")
if (attrs.value(i) == "paragraph")
{
gtParagraphStyle* pstyle = new gtParagraphStyle(*(writer->getDefaultStyle()));
pstyle->setDefaultStyle(true);
currentStyle = dynamic_cast<gtStyle*>(pstyle);
currentStyle->setName("default-style");
readProperties = true;
readProperties = true;
defaultStyleCreated = true;
}
}
}
}
void StyleReader::styleProperties(const QXmlAttributes& attrs)
{
if ((currentStyle == NULL) || (!readProperties))
return;
gtParagraphStyle* pstyle = NULL;
if (currentStyle->target() == "paragraph")
pstyle = dynamic_cast<gtParagraphStyle*>(currentStyle);
else
pstyle = NULL;
QString align = NULL;
QString force = NULL;
bool hasColorTag = false;
for (int i = 0; i < attrs.count(); ++i)
{
if ((attrs.localName(i) == "style:font-name") && (!inList))
currentStyle->getFont()->setName(getFont(attrs.value(i)));
else if (attrs.localName(i) == "fo:font-size")
{
double size = 0;
double psize = 0;
if (parentStyle != NULL)
psize = static_cast<double>(parentStyle->getFont()->getSize());
else if (styles.contains("default-style"))
psize = static_cast<double>(styles["default-style"]->getFont()->getSize());
psize = psize / 10;
size = getSize(attrs.value(i), psize);
int nsize = static_cast<int>(size * 10);
currentStyle->getFont()->setSize(nsize);
if (pstyle)
pstyle->setLineSpacing(writer->getPreferredLineSpacing(nsize));
}
else if ((attrs.localName(i) == "fo:line-height") && (parentStyle != NULL))
{
gtParagraphStyle* ppstyle;
if (parentStyle->target() == "paragraph")
{
ppstyle = dynamic_cast<gtParagraphStyle*>(parentStyle);
void StyleReader::styleProperties(const QXmlAttributes& attrs)
{
if ((currentStyle == NULL) || (!readProperties))
return;
gtParagraphStyle* pstyle = NULL;
if (currentStyle->target() == "paragraph")
pstyle = dynamic_cast<gtParagraphStyle*>(currentStyle);
else
pstyle = NULL;
QString align = NULL;
QString force = NULL;
bool hasColorTag = false;
for (int i = 0; i < attrs.count(); ++i)
{
if ((attrs.localName(i) == "style:font-name") && (!inList))
currentStyle->getFont()->setName(getFont(attrs.value(i)));
else if (attrs.localName(i) == "fo:font-size")
{
double size = 0;
double psize = 0;
if (parentStyle != NULL)
psize = static_cast<double>(parentStyle->getFont()->getSize());
else if (styles.contains("default-style"))
psize = static_cast<double>(styles["default-style"]->getFont()->getSize());
 
psize = psize / 10;
size = getSize(attrs.value(i), psize);
int nsize = static_cast<int>(size * 10);
currentStyle->getFont()->setSize(nsize);
if (pstyle)
pstyle->setLineSpacing(writer->getPreferredLineSpacing(nsize));
}
else if ((attrs.localName(i) == "fo:line-height") && (parentStyle != NULL))
{
gtParagraphStyle* ppstyle;
if (parentStyle->target() == "paragraph")
{
ppstyle = dynamic_cast<gtParagraphStyle*>(parentStyle);
assert(ppstyle != NULL);
ppstyle->setLineSpacing(getSize(attrs.value(i), writer->getPreferredLineSpacing(currentStyle->getFont()->getSize())));
}
}
else if (attrs.localName(i) == "fo:color")
{
currentStyle->getFont()->setColor(attrs.value(i));
hasColorTag = true;
}
else if ((attrs.localName(i) == "style:use-window-font-color") && (attrs.value(i) == "true"))
{
currentStyle->getFont()->setColor("Black");
hasColorTag = true;
}
else if ((attrs.localName(i) == "fo:font-weight") && (attrs.value(i) == "bold"))
currentStyle->getFont()->setWeight(BOLD);
else if ((attrs.localName(i) == "fo:font-style") && (attrs.value(i) == "italic"))
currentStyle->getFont()->setSlant(ITALIC);
else if ((attrs.localName(i) == "style:text-underline-style") && (attrs.value(i) != "none"))
currentStyle->getFont()->toggleEffect(UNDERLINE);
else if ((attrs.localName(i) == "style:text-crossing-out") && (attrs.value(i) != "none"))
currentStyle->getFont()->toggleEffect(STRIKETHROUGH);
else if ((attrs.localName(i) == "fo:font-variant") && (attrs.value(i) == "small-caps"))
currentStyle->getFont()->toggleEffect(SMALL_CAPS);
else if ((attrs.localName(i) == "style:text-outline") && (attrs.value(i) == "true"))
{
currentStyle->getFont()->toggleEffect(OUTLINE);
currentStyle->getFont()->setStrokeColor("Black");
currentStyle->getFont()->setColor("White");
}
else if (attrs.localName(i) == "fo:letter-spacing")
currentStyle->getFont()->setKerning(static_cast<int>(getSize(attrs.value(i), -1.0)));
else if (attrs.localName(i) == "style:text-scale")
currentStyle->getFont()->setHscale(static_cast<int>(getSize(attrs.value(i), -1.0)));
else if ((attrs.localName(i) == "style:text-position") &&
(((attrs.value(i)).indexOf("sub") != -1) ||
(((attrs.value(i)).left(1) == "-") && ((attrs.value(i)).left(1) != "0"))))
currentStyle->getFont()->toggleEffect(SUBSCRIPT);
else if ((attrs.localName(i) == "style:text-position") &&
ppstyle->setLineSpacing(getSize(attrs.value(i), writer->getPreferredLineSpacing(currentStyle->getFont()->getSize())));
}
}
else if (attrs.localName(i) == "fo:color")
{
currentStyle->getFont()->setColor(attrs.value(i));
hasColorTag = true;
}
else if ((attrs.localName(i) == "style:use-window-font-color") && (attrs.value(i) == "true"))
{
currentStyle->getFont()->setColor("Black");
hasColorTag = true;
}
else if ((attrs.localName(i) == "fo:font-weight") && (attrs.value(i) == "bold"))
currentStyle->getFont()->setWeight(BOLD);
else if ((attrs.localName(i) == "fo:font-style") && (attrs.value(i) == "italic"))
currentStyle->getFont()->setSlant(ITALIC);
else if ((attrs.localName(i) == "style:text-underline-style") && (attrs.value(i) != "none"))
currentStyle->getFont()->toggleEffect(UNDERLINE);
else if ((attrs.localName(i) == "style:text-crossing-out") && (attrs.value(i) != "none"))
currentStyle->getFont()->toggleEffect(STRIKETHROUGH);
else if ((attrs.localName(i) == "fo:font-variant") && (attrs.value(i) == "small-caps"))
currentStyle->getFont()->toggleEffect(SMALL_CAPS);
else if ((attrs.localName(i) == "style:text-outline") && (attrs.value(i) == "true"))
{
currentStyle->getFont()->toggleEffect(OUTLINE);
currentStyle->getFont()->setStrokeColor("Black");
currentStyle->getFont()->setColor("White");
}
else if (attrs.localName(i) == "fo:letter-spacing")
currentStyle->getFont()->setKerning(static_cast<int>(getSize(attrs.value(i), -1.0)));
else if (attrs.localName(i) == "style:text-scale")
currentStyle->getFont()->setHscale(static_cast<int>(getSize(attrs.value(i), -1.0)));
else if ((attrs.localName(i) == "style:text-position") &&
(((attrs.value(i)).indexOf("sub") != -1) ||
(((attrs.value(i)).left(1) == "-") && ((attrs.value(i)).left(1) != "0"))))
currentStyle->getFont()->toggleEffect(SUBSCRIPT);
else if ((attrs.localName(i) == "style:text-position") &&
(((attrs.value(i)).indexOf("super") != -1) ||
(((attrs.value(i)).left(1) != "-") && ((attrs.value(i)).left(1) != "0"))))
currentStyle->getFont()->toggleEffect(SUPERSCRIPT);
else if ((attrs.localName(i) == "fo:margin-top") && (pstyle != NULL))
pstyle->setSpaceAbove(getSize(attrs.value(i)));
else if ((attrs.localName(i) == "fo:margin-bottom") && (pstyle != NULL))
pstyle->setSpaceBelow(getSize(attrs.value(i)));
else if ((attrs.localName(i) == "fo:margin-left") && (pstyle != NULL))
{
if (inList)
pstyle->setIndent(pstyle->getIndent() + getSize(attrs.value(i)));
else
pstyle->setIndent(getSize(attrs.value(i)));
}
else if ((attrs.localName(i) == "text:space-before") && (pstyle != NULL))
{
/*if (inList)
pstyle->setIndent(pstyle->getIndent() + getSize(attrs.value(i)));
else*/
pstyle->setIndent(getSize(attrs.value(i)));
}
else if ((attrs.localName(i) == "fo:text-indent") && (pstyle != NULL))
pstyle->setFirstLineIndent(getSize(attrs.value(i)));
else if ((attrs.localName(i) == "fo:text-align") && (pstyle != NULL))
align = attrs.value(i);
else if ((attrs.localName(i) == "style:justify-single-word") && (pstyle != NULL))
force = attrs.value(i);
}
(((attrs.value(i)).left(1) != "-") && ((attrs.value(i)).left(1) != "0"))))
currentStyle->getFont()->toggleEffect(SUPERSCRIPT);
else if ((attrs.localName(i) == "fo:margin-top") && (pstyle != NULL))
pstyle->setSpaceAbove(getSize(attrs.value(i)));
else if ((attrs.localName(i) == "fo:margin-bottom") && (pstyle != NULL))
pstyle->setSpaceBelow(getSize(attrs.value(i)));
else if ((attrs.localName(i) == "fo:margin-left") && (pstyle != NULL))
{
if (inList)
pstyle->setIndent(pstyle->getIndent() + getSize(attrs.value(i)));
else
pstyle->setIndent(getSize(attrs.value(i)));
}
else if ((attrs.localName(i) == "text:space-before") && (pstyle != NULL))
{
/*if (inList)
pstyle->setIndent(pstyle->getIndent() + getSize(attrs.value(i)));
else*/
pstyle->setIndent(getSize(attrs.value(i)));
}
else if ((attrs.localName(i) == "fo:text-indent") && (pstyle != NULL))
pstyle->setFirstLineIndent(getSize(attrs.value(i)));
else if ((attrs.localName(i) == "fo:text-align") && (pstyle != NULL))
align = attrs.value(i);
else if ((attrs.localName(i) == "style:justify-single-word") && (pstyle != NULL))
force = attrs.value(i);
}
// Qt4 NULL -> isNull()
if (!align.isNull())
{
if (align == "end")
pstyle->setAlignment(RIGHT);
else if (align == "center")
pstyle->setAlignment(CENTER);
else if (align == "justify")
{
if (force == "false")
pstyle->setAlignment(BLOCK);
else
pstyle->setAlignment(FORCED);
}
}
if (!align.isNull())
{
if (align == "end")
pstyle->setAlignment(RIGHT);
else if (align == "center")
pstyle->setAlignment(CENTER);
else if (align == "justify")
{
if (force == "false")
pstyle->setAlignment(BLOCK);
else
pstyle->setAlignment(FORCED);
}
}
if (!hasColorTag)
currentStyle->getFont()->setColor("Black");
}
}
void StyleReader::styleStyle(const QXmlAttributes& attrs)
{
QString name = "";
QString listName = NULL;
void StyleReader::styleStyle(const QXmlAttributes& attrs)
{
QString name = "";
QString listName = NULL;
bool setDefaultStyle = false;
bool isParaStyle = false;
bool create = true;
bool isParaStyle = false;
bool create = true;
 
if (!defaultStyleCreated)
{
385,73 → 385,73
parentStyle = currentStyle;
}
 
for (int i = 0; i < attrs.count(); ++i)
{
if (attrs.localName(i) == "style:family")
{
if (attrs.value(i) == "paragraph")
{
isParaStyle = true;
readProperties = true;
}
else if (attrs.value(i) == "text")
{
isParaStyle = false;
readProperties = true;
}
else
{
readProperties = false;
return;
}
}
else if (attrs.localName(i) == "style:name")
name = attrs.value(i);
else if (attrs.localName(i) == "style:parent-style-name")
{
if (styles.contains(attrs.value(i)))
parentStyle = styles[attrs.value(i)];
else
parentStyle = NULL;
}
else if (attrs.localName(i) == "style:list-style-name")
listName = attrs.value(i);
}
if ((parentStyle == NULL) && (styles.contains("default-style")))
parentStyle = styles["default-style"];
if (create)
{
if (parentStyle == NULL)
{
parentStyle = new gtStyle("tmp-parent");
}
if (isParaStyle)
{
gtParagraphStyle *tmpP;
if (parentStyle->target() == "paragraph")
{
tmpP = dynamic_cast<gtParagraphStyle*>(parentStyle);
for (int i = 0; i < attrs.count(); ++i)
{
if (attrs.localName(i) == "style:family")
{
if (attrs.value(i) == "paragraph")
{
isParaStyle = true;
readProperties = true;
}
else if (attrs.value(i) == "text")
{
isParaStyle = false;
readProperties = true;
}
else
{
readProperties = false;
return;
}
}
else if (attrs.localName(i) == "style:name")
name = attrs.value(i);
else if (attrs.localName(i) == "style:parent-style-name")
{
if (styles.contains(attrs.value(i)))
parentStyle = styles[attrs.value(i)];
else
parentStyle = NULL;
}
else if (attrs.localName(i) == "style:list-style-name")
listName = attrs.value(i);
}
if ((parentStyle == NULL) && (styles.contains("default-style")))
parentStyle = styles["default-style"];
 
if (create)
{
if (parentStyle == NULL)
{
parentStyle = new gtStyle("tmp-parent");
}
if (isParaStyle)
{
gtParagraphStyle *tmpP;
if (parentStyle->target() == "paragraph")
{
tmpP = dynamic_cast<gtParagraphStyle*>(parentStyle);
assert(tmpP != NULL);
gtParagraphStyle* tmp = new gtParagraphStyle(*tmpP);
// tmp->setAutoLineSpacing(true);
currentStyle = tmp;
}
else
{
gtParagraphStyle* tmp = new gtParagraphStyle(*parentStyle);
// tmp->setAutoLineSpacing(true);
currentStyle = tmp;
}
if (!listName.isNull())
{
listParents[listName] = currentStyle;
}
}
else
currentStyle = new gtStyle(*parentStyle);
currentStyle->setName(name);
gtParagraphStyle* tmp = new gtParagraphStyle(*tmpP);
// tmp->setAutoLineSpacing(true);
currentStyle = tmp;
}
else
{
gtParagraphStyle* tmp = new gtParagraphStyle(*parentStyle);
// tmp->setAutoLineSpacing(true);
currentStyle = tmp;
}
if (!listName.isNull())
{
listParents[listName] = currentStyle;
}
}
else
currentStyle = new gtStyle(*parentStyle);
 
currentStyle->setName(name);
if (setDefaultStyle)
{
gtParagraphStyle* tmp = dynamic_cast<gtParagraphStyle*>(currentStyle);
458,58 → 458,58
if (tmp)
tmp->setDefaultStyle(true);
}
}
else
currentStyle = NULL;
}
}
else
currentStyle = NULL;
}
void StyleReader::tabStop(const QXmlAttributes& attrs)
{
if (currentStyle->target() == "paragraph")
{
gtParagraphStyle* pstyle = dynamic_cast<gtParagraphStyle*>(currentStyle);
void StyleReader::tabStop(const QXmlAttributes& attrs)
{
if (currentStyle->target() == "paragraph")
{
gtParagraphStyle* pstyle = dynamic_cast<gtParagraphStyle*>(currentStyle);
assert(pstyle != NULL);
QString pos = NULL;
QString type = NULL;
for (int i = 0; i < attrs.count(); ++i)
{
if (attrs.localName(i) == "style:position")
pos = attrs.value(i);
else if (attrs.localName(i) == "style:type")
type = attrs.value(i);
}
if (!pos.isNull())
{
if (type.isNull())
type = "left";
double posd = getSize(pos);
if (type == "left")
pstyle->setTabValue(posd, LEFT_T);
else if (type == "right")
pstyle->setTabValue(posd, RIGHT_T);
else if (type == "center")
pstyle->setTabValue(posd, CENTER_T);
else
pstyle->setTabValue(posd, CENTER_T);
}
}
}
QString pos = NULL;
QString type = NULL;
for (int i = 0; i < attrs.count(); ++i)
{
if (attrs.localName(i) == "style:position")
pos = attrs.value(i);
else if (attrs.localName(i) == "style:type")
type = attrs.value(i);
}
if (!pos.isNull())
{
if (type.isNull())
type = "left";
double posd = getSize(pos);
if (type == "left")
pstyle->setTabValue(posd, LEFT_T);
else if (type == "right")
pstyle->setTabValue(posd, RIGHT_T);
else if (type == "center")
pstyle->setTabValue(posd, CENTER_T);
else
pstyle->setTabValue(posd, CENTER_T);
}
}
}
bool StyleReader::endElement(const QString&, const QString&, const QString &name)
{
if ((name == "style:default-style") && (currentStyle != NULL) && (readProperties))
{
setStyle(currentStyle->getName(), currentStyle);
currentStyle = NULL;
parentStyle = NULL;
readProperties = false;
}
else if (((name == "style:style") ||
(name == "text:list-level-style-bullet") ||
(name == "text:list-level-style-number") ||
bool StyleReader::endElement(const QString&, const QString&, const QString &name)
{
if ((name == "style:default-style") && (currentStyle != NULL) && (readProperties))
{
setStyle(currentStyle->getName(), currentStyle);
currentStyle = NULL;
parentStyle = NULL;
readProperties = false;
}
else if (((name == "style:style") ||
(name == "text:list-level-style-bullet") ||
(name == "text:list-level-style-number") ||
(name == "text:list-level-style-image")) && (currentStyle != NULL))
{
{
if ((name == "text:list-level-style-bullet"))
{
gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle);
522,25 → 522,25
if (s)
s->setNum(true);
}
setStyle(currentStyle->getName(), currentStyle);
currentStyle = NULL;
parentStyle = NULL;
readProperties = false;
}
else if (name == "text:list-style")
{
setStyle(currentStyle->getName(), currentStyle);
currentStyle = NULL;
parentStyle = NULL;
readProperties = false;
}
else if (name == "text:list-style")
{
if (currentListStyle) {
lists[currentListStyle->name()] = currentListStyle;
currentListStyle = 0;
}
inList = false;
}
inList = false;
}
 
return true;
}
return true;
}
void StyleReader::parse(QString fileName)
{
void StyleReader::parse(QString fileName)
{
#if defined(_WIN32)
QString fname = QDir::toNativeSeparators(fileName);
QByteArray fn = (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) ? fname.toUtf8() : fname.toLocal8Bit();
547,55 → 547,55
#else
QByteArray fn(fileName.toLocal8Bit());
#endif
xmlSAXParseFile(sSAXHandler, fn.data(), 1);
}
xmlSAXParseFile(sSAXHandler, fn.data(), 1);
}
 
gtStyle* StyleReader::getDefaultStyle(void)
{
gtStyle* defStyle = writer->getDefaultStyle();
StyleMap::Iterator it, itEnd = styles.end();
for (it = styles.begin(); it != itEnd; ++it)
{
gtParagraphStyle *pStyle = dynamic_cast<gtParagraphStyle*> (it.value());
if (pStyle && pStyle->isDefaultStyle())
{
defStyle = pStyle;
break;
}
}
return defStyle;
}
gtStyle* StyleReader::getDefaultStyle(void)
{
gtStyle* defStyle = writer->getDefaultStyle();
StyleMap::Iterator it, itEnd = styles.end();
for (it = styles.begin(); it != itEnd; ++it)
{
gtParagraphStyle *pStyle = dynamic_cast<gtParagraphStyle*> (it.value());
if (pStyle && pStyle->isDefaultStyle())
{
defStyle = pStyle;
break;
}
}
return defStyle;
}
gtStyle* StyleReader::getStyle(const QString& name)
{
if (styles.contains(name))
{
gtStyle* tmp = styles[name];
QString tname = tmp->getName();
gtStyle* StyleReader::getStyle(const QString& name)
{
if (styles.contains(name))
{
gtStyle* tmp = styles[name];
QString tname = tmp->getName();
if ((tname.indexOf(docname) == -1) && (usePrefix))
tmp->setName(docname + "_" + tname);
return tmp;
}
else
tmp->setName(docname + "_" + tname);
 
return tmp;
}
else
return getDefaultStyle();
}
}
void StyleReader::setStyle(const QString& name, gtStyle* style)
{
gtParagraphStyle *s;
QString tname = style->getName();
if ((style->target() == "paragraph") && (packStyles))
{
s = dynamic_cast<gtParagraphStyle*>(style);
void StyleReader::setStyle(const QString& name, gtStyle* style)
{
gtParagraphStyle *s;
QString tname = style->getName();
if ((style->target() == "paragraph") && (packStyles))
{
s = dynamic_cast<gtParagraphStyle*>(style);
assert(s != NULL);
QString nameByAttrs = QString("%1-").arg(s->getSpaceAbove());
nameByAttrs += QString("%1-").arg(s->getSpaceBelow());
nameByAttrs += QString("%1-").arg(s->getLineSpacing());
nameByAttrs += QString("%1-").arg(s->getIndent());
nameByAttrs += QString("%1-").arg(s->getFirstLineIndent());
nameByAttrs += QString("%1-").arg(s->getAlignment());
nameByAttrs += QString("%1-").arg(s->hasDropCap());
QString nameByAttrs = QString("%1-").arg(s->getSpaceAbove());
nameByAttrs += QString("%1-").arg(s->getSpaceBelow());
nameByAttrs += QString("%1-").arg(s->getLineSpacing());
nameByAttrs += QString("%1-").arg(s->getIndent());
nameByAttrs += QString("%1-").arg(s->getFirstLineIndent());
nameByAttrs += QString("%1-").arg(s->getAlignment());
nameByAttrs += QString("%1-").arg(s->hasDropCap());
nameByAttrs += QString("%1-").arg(s->hasBullet());
nameByAttrs += QString("%1-").arg(s->getBullet());
nameByAttrs += QString("%1-").arg(s->hasNum());
604,72 → 604,72
nameByAttrs += QString("%1-").arg(s->getNumPrefix());
nameByAttrs += QString("%1-").arg(s->getNumStart());
nameByAttrs += QString("%1-").arg(s->getNumSuffix());
nameByAttrs += QString("%1-").arg(s->getFont()->getColor());
nameByAttrs += QString("%1-").arg(s->getFont()->getStrokeColor());
// TODO is this important ??
/* QValueList<double>* tmp = s->getTabValues();
for (uint i = 0; i < tmp->count(); ++i)
{
double td = (*tmp)[i];
nameByAttrs += QString("%1-").arg(td);
} */
if (attrsStyles.contains(nameByAttrs))
{
tname = attrsStyles[nameByAttrs]->getName();
++pstyleCounts[nameByAttrs];
style->setName(tname);
}
else
{
attrsStyles[nameByAttrs] = style;
pstyleCounts[nameByAttrs] = 1;
tname = style->getName();
}
}
else if (!packStyles)
{
attrsStyles[name] = style;
pstyleCounts[name] = 1;
tname = style->getName();
}
if (!styles.contains(name))
{
nameByAttrs += QString("%1-").arg(s->getFont()->getColor());
nameByAttrs += QString("%1-").arg(s->getFont()->getStrokeColor());
// TODO is this important ??
/* QValueList<double>* tmp = s->getTabValues();
for (uint i = 0; i < tmp->count(); ++i)
{
double td = (*tmp)[i];
nameByAttrs += QString("%1-").arg(td);
} */
if (attrsStyles.contains(nameByAttrs))
{
tname = attrsStyles[nameByAttrs]->getName();
++pstyleCounts[nameByAttrs];
style->setName(tname);
}
else
{
attrsStyles[nameByAttrs] = style;
pstyleCounts[nameByAttrs] = 1;
tname = style->getName();
}
}
else if (!packStyles)
{
attrsStyles[name] = style;
pstyleCounts[name] = 1;
tname = style->getName();
}
if (!styles.contains(name))
{
if ((tname.indexOf(docname) == -1) && (usePrefix))
style->setName(docname + "_" + tname);
styles[name] = style;
}
}
style->setName(docname + "_" + tname);
styles[name] = style;
}
}
QString StyleReader::getFont(const QString& key)
{
if (fonts.contains(key))
return fonts[key];
else
return key;
}
QString StyleReader::getFont(const QString& key)
{
if (fonts.contains(key))
return fonts[key];
else
return key;
}
void StyleReader::setupFrameStyle()
{
QString fstyleName = "";
int count = 0;
CounterMap::Iterator it;
for (it = pstyleCounts.begin(); it != pstyleCounts.end(); ++it)
{
if (it.value() > count)
{
count = it.value();
fstyleName = it.key();
}
}
gtFrameStyle* fstyle;
gtParagraphStyle* pstyle = dynamic_cast<gtParagraphStyle*>(attrsStyles[fstyleName]);
fstyle = new gtFrameStyle(*pstyle);
void StyleReader::setupFrameStyle()
{
QString fstyleName = "";
int count = 0;
CounterMap::Iterator it;
for (it = pstyleCounts.begin(); it != pstyleCounts.end(); ++it)
{
if (it.value() > count)
{
count = it.value();
fstyleName = it.key();
}
}
gtFrameStyle* fstyle;
gtParagraphStyle* pstyle = dynamic_cast<gtParagraphStyle*>(attrsStyles[fstyleName]);
fstyle = new gtFrameStyle(*pstyle);
 
if (!importTextOnly)
writer->setFrameStyle(fstyle);
delete fstyle;
}
if (!importTextOnly)
writer->setFrameStyle(fstyle);
delete fstyle;
}
ListStyle* StyleReader::getList(const QString &name)
{
ListStyle *tmp = 0;
678,245 → 678,245
return tmp;
}
 
bool StyleReader::updateStyle(gtStyle* style, gtStyle* parent2Style, const QString& key, const QString& value)
{
gtParagraphStyle* pstyle = NULL;
if (style->target() == "paragraph")
pstyle = dynamic_cast<gtParagraphStyle*>(style);
else
pstyle = NULL;
QString align = NULL;
QString force = NULL;
if (key == "style:font-name")
style->getFont()->setName(getFont(value));
else if (key == "fo:font-size")
{
double size = 0;
double psize = 0;
if (parent2Style != NULL)
psize = static_cast<double>(parent2Style->getFont()->getSize());
else if (styles.contains("default-style"))
psize = static_cast<double>(styles["default-style"]->getFont()->getSize());
psize = psize / 10;
size = getSize(value, psize);
int nsize = static_cast<int>(size * 10);
style->getFont()->setSize(nsize);
if (pstyle)
pstyle->setLineSpacing(writer->getPreferredLineSpacing(nsize));
}
else if ((key == "fo:line-height") && (parent2Style != NULL))
{
gtParagraphStyle* ppstyle;
if (parent2Style->target() == "paragraph")
{
ppstyle = dynamic_cast<gtParagraphStyle*>(parent2Style);
bool StyleReader::updateStyle(gtStyle* style, gtStyle* parent2Style, const QString& key, const QString& value)
{
gtParagraphStyle* pstyle = NULL;
if (style->target() == "paragraph")
pstyle = dynamic_cast<gtParagraphStyle*>(style);
else
pstyle = NULL;
QString align = NULL;
QString force = NULL;
 
if (key == "style:font-name")
style->getFont()->setName(getFont(value));
else if (key == "fo:font-size")
{
double size = 0;
double psize = 0;
if (parent2Style != NULL)
psize = static_cast<double>(parent2Style->getFont()->getSize());
else if (styles.contains("default-style"))
psize = static_cast<double>(styles["default-style"]->getFont()->getSize());
psize = psize / 10;
size = getSize(value, psize);
int nsize = static_cast<int>(size * 10);
style->getFont()->setSize(nsize);
if (pstyle)
pstyle->setLineSpacing(writer->getPreferredLineSpacing(nsize));
}
else if ((key == "fo:line-height") && (parent2Style != NULL))
{
gtParagraphStyle* ppstyle;
if (parent2Style->target() == "paragraph")
{
ppstyle = dynamic_cast<gtParagraphStyle*>(parent2Style);
assert(ppstyle != NULL);
ppstyle->setLineSpacing(getSize(value, writer->getPreferredLineSpacing(style->getFont()->getSize())));
}
}
else if (key == "fo:color")
ppstyle->setLineSpacing(getSize(value, writer->getPreferredLineSpacing(style->getFont()->getSize())));
}
}
else if (key == "fo:color")
style->getFont()->setColor(value);
else if ((key == "style:use-window-font-color") && (value == "true"))
style->getFont()->setColor("Black");
else if ((key == "fo:font-weight") && (value == "bold"))
style->getFont()->setWeight(BOLD);
else if ((key == "fo:font-style") && (value == "italic"))
style->getFont()->setSlant(ITALIC);
else if ((key == "style:text-underline-style") && (value != "none"))
style->getFont()->toggleEffect(UNDERLINE);
else if ((key == "style:text-crossing-out") && (value != "none"))
style->getFont()->toggleEffect(STRIKETHROUGH);
else if ((key == "fo:font-variant") && (value == "small-caps"))
style->getFont()->toggleEffect(SMALL_CAPS);
else if ((key == "style:text-outline") && (value == "true"))
{
style->getFont()->toggleEffect(OUTLINE);
style->getFont()->setStrokeColor("Black");
style->getFont()->setColor("White");
}
else if (key == "fo:letter-spacing")
style->getFont()->setKerning(static_cast<int>(getSize(value, -1.0)));
else if (key == "style:text-scale")
style->getFont()->setHscale(static_cast<int>(getSize(value, -1.0)));
else if ((key == "style:text-position") &&
style->getFont()->setColor("Black");
else if ((key == "fo:font-weight") && (value == "bold"))
style->getFont()->setWeight(BOLD);
else if ((key == "fo:font-style") && (value == "italic"))
style->getFont()->setSlant(ITALIC);
else if ((key == "style:text-underline-style") && (value != "none"))
style->getFont()->toggleEffect(UNDERLINE);
else if ((key == "style:text-crossing-out") && (value != "none"))
style->getFont()->toggleEffect(STRIKETHROUGH);
else if ((key == "fo:font-variant") && (value == "small-caps"))
style->getFont()->toggleEffect(SMALL_CAPS);
else if ((key == "style:text-outline") && (value == "true"))
{
style->getFont()->toggleEffect(OUTLINE);
style->getFont()->setStrokeColor("Black");
style->getFont()->setColor("White");
}
else if (key == "fo:letter-spacing")
style->getFont()->setKerning(static_cast<int>(getSize(value, -1.0)));
else if (key == "style:text-scale")
style->getFont()->setHscale(static_cast<int>(getSize(value, -1.0)));
else if ((key == "style:text-position") &&
(((value).indexOf("sub") != -1) ||
(((value).left(1) == "-") && ((value).left(1) != "0"))))
style->getFont()->toggleEffect(SUBSCRIPT);
else if ((key == "style:text-position") &&
(((value).left(1) == "-") && ((value).left(1) != "0"))))
style->getFont()->toggleEffect(SUBSCRIPT);
else if ((key == "style:text-position") &&
(((value).indexOf("super") != -1) ||
(((value).left(1) != "-") && ((value).left(1) != "0"))))
style->getFont()->toggleEffect(SUPERSCRIPT);
else if ((key == "fo:margin-top") && (pstyle != NULL))
pstyle->setSpaceAbove(getSize(value));
else if ((key == "fo:margin-bottom") && (pstyle != NULL))
pstyle->setSpaceBelow(getSize(value));
else if ((key == "fo:margin-left") && (pstyle != NULL))
{
if (inList)
pstyle->setIndent(pstyle->getIndent() + getSize(value));
else
pstyle->setIndent(getSize(value));
}
else if ((key == "text:space-before") && (pstyle != NULL))
{
if (inList)
pstyle->setIndent(pstyle->getIndent() + getSize(value));
else
pstyle->setIndent(getSize(value));
}
else if ((key == "fo:text-indent") && (pstyle != NULL))
pstyle->setFirstLineIndent(getSize(value));
else if ((key == "fo:text-align") && (pstyle != NULL))
align = value;
else if ((key == "style:justify-single-word") && (pstyle != NULL))
force = value;
if (!align.isNull())
{
(((value).left(1) != "-") && ((value).left(1) != "0"))))
style->getFont()->toggleEffect(SUPERSCRIPT);
else if ((key == "fo:margin-top") && (pstyle != NULL))
pstyle->setSpaceAbove(getSize(value));
else if ((key == "fo:margin-bottom") && (pstyle != NULL))
pstyle->setSpaceBelow(getSize(value));
else if ((key == "fo:margin-left") && (pstyle != NULL))
{
if (inList)
pstyle->setIndent(pstyle->getIndent() + getSize(value));
else
pstyle->setIndent(getSize(value));
}
else if ((key == "text:space-before") && (pstyle != NULL))
{
if (inList)
pstyle->setIndent(pstyle->getIndent() + getSize(value));
else
pstyle->setIndent(getSize(value));
}
else if ((key == "fo:text-indent") && (pstyle != NULL))
pstyle->setFirstLineIndent(getSize(value));
else if ((key == "fo:text-align") && (pstyle != NULL))
align = value;
else if ((key == "style:justify-single-word") && (pstyle != NULL))
force = value;
 
if (!align.isNull())
{
assert(pstyle);
if (align == "end")
pstyle->setAlignment(RIGHT);
else if (align == "center")
pstyle->setAlignment(CENTER);
else if (align == "justify")
{
if (force != "false")
pstyle->setAlignment(FORCED);
else
pstyle->setAlignment(BLOCK);
}
}
return true;
}
if (align == "end")
pstyle->setAlignment(RIGHT);
else if (align == "center")
pstyle->setAlignment(CENTER);
else if (align == "justify")
{
if (force != "false")
pstyle->setAlignment(FORCED);
else
pstyle->setAlignment(BLOCK);
}
}
 
return true;
}
double StyleReader::getSize(QString s, double parentSize)
{
QString dbl = "0.0";
QString lowerValue = s.toLower();
double ret = 0.0;
if (lowerValue.indexOf("pt") != -1)
{
dbl = lowerValue.remove("pt");
ret = gtMeasure::d2d(dbl.toDouble(), SC_PT);
}
double StyleReader::getSize(QString s, double parentSize)
{
QString dbl = "0.0";
QString lowerValue = s.toLower();
double ret = 0.0;
if (lowerValue.indexOf("pt") != -1)
{
dbl = lowerValue.remove("pt");
ret = gtMeasure::d2d(dbl.toDouble(), SC_PT);
}
else if (lowerValue.indexOf("mm") != -1)
{
dbl = lowerValue.remove("mm");
ret = gtMeasure::d2d(dbl.toDouble(), SC_MM);
}
{
dbl = lowerValue.remove("mm");
ret = gtMeasure::d2d(dbl.toDouble(), SC_MM);
}
else if (lowerValue.indexOf("cm") != -1)
{
dbl = lowerValue.remove("cm");
ret = gtMeasure::d2d(dbl.toDouble() * 10, SC_MM);
}
{
dbl = lowerValue.remove("cm");
ret = gtMeasure::d2d(dbl.toDouble() * 10, SC_MM);
}
else if (lowerValue.indexOf("in") != -1)
{
dbl = lowerValue.remove("inch");
dbl = lowerValue.remove("in");
ret = gtMeasure::d2d(dbl.toDouble(), SC_IN);
}
{
dbl = lowerValue.remove("inch");
dbl = lowerValue.remove("in");
ret = gtMeasure::d2d(dbl.toDouble(), SC_IN);
}
else if (lowerValue.indexOf("pi") != -1)
{
dbl = lowerValue.remove("pica");
dbl = lowerValue.remove("pi");
ret = gtMeasure::d2d(dbl.toDouble(), SC_P);
}
{
dbl = lowerValue.remove("pica");
dbl = lowerValue.remove("pi");
ret = gtMeasure::d2d(dbl.toDouble(), SC_P);
}
else if (lowerValue.indexOf("c") != -1)
{
dbl = lowerValue.remove("cicero");
dbl = lowerValue.remove("c");
ret = gtMeasure::d2d(dbl.toDouble(), SC_C);
}
{
dbl = lowerValue.remove("cicero");
dbl = lowerValue.remove("c");
ret = gtMeasure::d2d(dbl.toDouble(), SC_C);
}
else if (lowerValue.indexOf("%") != -1)
{
dbl = lowerValue.remove("%");
double factor = dbl.toDouble();
if (parentSize != -1.0)
{
factor = factor / 100;
ret = factor * parentSize;
}
else
ret = factor;
}
return ret;
}
{
dbl = lowerValue.remove("%");
double factor = dbl.toDouble();
if (parentSize != -1.0)
{
factor = factor / 100;
ret = factor * parentSize;
}
else
ret = factor;
}
return ret;
}
StyleReader::~StyleReader()
{
sreader = NULL;
StyleMap::Iterator it;
for (it = styles.begin(); it != styles.end(); ++it)
{
if (it.value())
{
delete it.value();
it.value() = NULL;
}
}
}
StyleReader::~StyleReader()
{
sreader = NULL;
StyleMap::Iterator it;
for (it = styles.begin(); it != styles.end(); ++it)
{
if (it.value())
{
delete it.value();
it.value() = NULL;
}
}
}
xmlSAXHandler sSAXHandlerStruct = {
NULL, // internalSubset,
NULL, // isStandalone,
NULL, // hasInternalSubset,
NULL, // hasExternalSubset,
NULL, // resolveEntity,
NULL, // getEntity,
NULL, // entityDecl,
NULL, // notationDecl,
NULL, // attributeDecl,
NULL, // elementDecl,
NULL, // unparsedEntityDecl,
NULL, // setDocumentLocator,
NULL, // startDocument,
NULL, // endDocument,
StyleReader::startElement,
StyleReader::endElement,
NULL, // reference,
NULL, // characters
NULL, // ignorableWhitespace,
NULL, // processingInstruction,
NULL, // comment,
NULL, // warning,
NULL, // error,
NULL, // fatalError,
NULL, // getParameterEntity,
NULL, // cdata,
NULL,
1
#ifdef HAVE_XML26
,
NULL,
NULL,
NULL,
NULL
#endif
};
xmlSAXHandler sSAXHandlerStruct = {
NULL, // internalSubset,
NULL, // isStandalone,
NULL, // hasInternalSubset,
NULL, // hasExternalSubset,
NULL, // resolveEntity,
NULL, // getEntity,
NULL, // entityDecl,
NULL, // notationDecl,
NULL, // attributeDecl,
NULL, // elementDecl,
NULL, // unparsedEntityDecl,
NULL, // setDocumentLocator,
NULL, // startDocument,
NULL, // endDocument,
StyleReader::startElement,
StyleReader::endElement,
NULL, // reference,
NULL, // characters
NULL, // ignorableWhitespace,
NULL, // processingInstruction,
NULL, // comment,
NULL, // warning,
NULL, // error,
NULL, // fatalError,
NULL, // getParameterEntity,
NULL, // cdata,
NULL,
1
#ifdef HAVE_XML26
,
NULL,
NULL,
NULL,
NULL
#endif
};
xmlSAXHandlerPtr sSAXHandler = &sSAXHandlerStruct;
xmlSAXHandlerPtr sSAXHandler = &sSAXHandlerStruct;
 
void StyleReader::startElement(void*, const xmlChar * fullname, const xmlChar ** atts)
{
QString* name = new QString((const char*) fullname);
name = new QString(name->toLower());
QXmlAttributes* attrs = new QXmlAttributes();
if (atts)
{
for(const xmlChar** cur = atts; cur && *cur; cur += 2)
attrs->append(QString((char*)*cur), NULL, QString((char*)*cur), QString((char*)*(cur + 1)));
}
sreader->startElement(NULL, NULL, *name, *attrs);
}
void StyleReader::startElement(void*, const xmlChar * fullname, const xmlChar ** atts)
{
QString* name = new QString((const char*) fullname);
name = new QString(name->toLower());
QXmlAttributes* attrs = new QXmlAttributes();
if (atts)
{
for(const xmlChar** cur = atts; cur && *cur; cur += 2)
attrs->append(QString((char*)*cur), NULL, QString((char*)*cur), QString((char*)*(cur + 1)));
}
sreader->startElement(NULL, NULL, *name, *attrs);
}
void StyleReader::endElement(void*, const xmlChar * name)
{
QString *nname = new QString((const char*) name);
nname = new QString(nname->toLower());
sreader->endElement(NULL, NULL, *nname);
}
void StyleReader::endElement(void*, const xmlChar * name)
{
QString *nname = new QString((const char*) name);
nname = new QString(nname->toLower());
sreader->endElement(NULL, NULL, *nname);
}
 
/*** ListLevel *****************************************************************************************/
 
/trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
211,7 → 211,7
{
int di, n;
unsigned int temp_c = c;
// c--> temp_c //tomy 2001.11.13
// c--> temp_c //tomy 2001.11.13
temp_c = (temp_c << 8) ;
temp_c = temp_c + m_buf->buf[ i++ ];
di = (temp_c & 0x3FFF) >> COUNT_BITS;