13 #include <kjs/kjsarguments.h>
14 #include <kjs/kjsobject.h>
15 #include <kjs/kjsprototype.h>
17 #include <qapplication.h>
22 #include "../document_p.h"
25 using namespace Okular;
32 static const struct FakePluginInfo {
38 {
"Annots",
true,
true,
"" },
39 {
"EFS",
true,
true,
"" },
40 {
"EScript",
true,
true,
"" },
41 {
"Forms",
true,
true,
"" },
42 {
"ReadOutLoud",
true,
true,
"" },
43 {
"WebLink",
true,
true,
"" }
59 KLocale::splitLocale( KGlobal::locale()->language(),
60 lang, country, dummy, dummy );
61 QString acroLang = QString::fromLatin1(
"ENU" );
62 if ( lang == QLatin1String(
"da" ) )
63 acroLang = QString::fromLatin1(
"DAN" );
64 else if ( lang == QLatin1String(
"de" ) )
65 acroLang = QString::fromLatin1(
"DEU" );
66 else if ( lang == QLatin1String(
"en" ) )
67 acroLang = QString::fromLatin1(
"ENU" );
68 else if ( lang == QLatin1String(
"es" ) )
69 acroLang = QString::fromLatin1(
"ESP" );
70 else if ( lang == QLatin1String(
"fr" ) )
71 acroLang = QString::fromLatin1(
"FRA" );
72 else if ( lang == QLatin1String(
"it" ) )
73 acroLang = QString::fromLatin1(
"ITA" );
74 else if ( lang == QLatin1String(
"ko" ) )
75 acroLang = QString::fromLatin1(
"KOR" );
76 else if ( lang == QLatin1String(
"ja" ) )
77 acroLang = QString::fromLatin1(
"JPN" );
78 else if ( lang == QLatin1String(
"nl" ) )
79 acroLang = QString::fromLatin1(
"NLD" );
80 else if ( lang == QLatin1String(
"pt" ) && country == QLatin1String(
"BR" ) )
81 acroLang = QString::fromLatin1(
"PTB" );
82 else if ( lang == QLatin1String(
"fi" ) )
83 acroLang = QString::fromLatin1(
"SUO" );
84 else if ( lang == QLatin1String(
"sv" ) )
85 acroLang = QString::fromLatin1(
"SVE" );
86 else if ( lang == QLatin1String(
"zh" ) && country == QLatin1String(
"CN" ) )
87 acroLang = QString::fromLatin1(
"CHS" );
88 else if ( lang == QLatin1String(
"zh" ) && country == QLatin1String(
"TW" ) )
89 acroLang = QString::fromLatin1(
"CHT" );
90 return KJSString( acroLang );
100 #if defined(Q_OS_WIN)
101 return KJSString( QString::fromLatin1(
"WIN" ) );
102 #elif defined(Q_OS_MAC)
103 return KJSString( QString::fromLatin1(
"MAC" ) );
105 return KJSString( QString::fromLatin1(
"UNIX" ) );
116 plugin.setProperty( context,
"certified", info.certified );
117 plugin.setProperty( context,
"loaded", info.loaded );
118 plugin.setProperty( context,
"name", info.name );
119 plugin.setProperty( context,
"path", info.path );
121 plugins.setProperty( context, QString::number( i ), plugin );
128 return KJSArray( context, 0 );
133 return KJSArray( context, 0 );
139 return KJSString( QString::fromLatin1(
"Reader" ) );
145 return KJSString( QString::fromLatin1(
"Reader" ) );
154 static KJSObject
appBeep( KJSContext *context,
void *,
155 const KJSArguments &arguments )
157 if ( arguments.count() < 1 )
159 return context->throwException(
"Missing beep type" );
161 QApplication::beep();
162 return KJSUndefined();
166 const KJSArguments &arguments )
168 if ( arguments.count() < 1 )
170 return context->throwException(
"Missing plugin index" );
172 const int nIndex = arguments.at( 0 ).toInt32( context );
175 return context->throwException(
"PlugIn index out of bounds" );
178 return KJSString( info.name );
182 const KJSArguments & )
186 return KJSUndefined();
189 return KJSUndefined();
193 const KJSArguments & )
197 return KJSUndefined();
200 return KJSUndefined();
205 static bool initialized =
false;
231 return g_appProto->constructObject( ctx, doc );
static const int s_num_fake_plugins
static KJSObject object(KJSContext *ctx, DocumentPrivate *doc)
static KJSObject appGetPlatform(KJSContext *, void *)
static const struct FakePluginInfo s_fake_plugins[]
static KJSObject appGetViewerType(KJSContext *, void *)
static KJSObject appGetPrintColorProfiles(KJSContext *context, void *)
static KJSObject appGetPlugIns(KJSContext *context, void *)
static KJSObject appBeep(KJSContext *context, void *, const KJSArguments &arguments)
static const double fake_acroversion
static KJSPrototype * g_appProto
void setNextViewport()
Sets the current document viewport to the previous viewport in the viewport history.
static KJSObject appGetNthPlugInName(KJSContext *context, void *, const KJSArguments &arguments)
static KJSObject appGoForward(KJSContext *, void *object, const KJSArguments &)
static KJSObject appGetFormsVersion(KJSContext *, void *)
static KJSObject appGetViewerVersion(KJSContext *, void *)
void setPrevViewport()
Sets the current document viewport to the next viewport in the viewport history.
bool historyAtBegin() const
Returns whether the document history is at the begin.
static void initType(KJSContext *ctx)
bool historyAtEnd() const
Returns whether the document history is at the end.
static KJSObject appGetViewerVariation(KJSContext *, void *)
static KJSObject appGetPrinterNames(KJSContext *context, void *)
static KJSObject appGetLanguage(KJSContext *, void *)
static KJSObject appGetNumPlugins(KJSContext *, void *)
static KJSObject appGoBack(KJSContext *, void *object, const KJSArguments &)