1 /***************************************************************************
2 * Copyright (C) 2004-2005 by Enrico Ros <eros.kde@email.it> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 ***************************************************************************/
17 #include "sourcereference_p.h"
20 using namespace Okular
;
22 class Okular::ActionPrivate
29 virtual ~ActionPrivate()
34 Action::Action( ActionPrivate
&dd
)
44 QString
Action::actionTip() const
51 class Okular::GotoActionPrivate
: public Okular::ActionPrivate
54 GotoActionPrivate( const QString
&fileName
, const DocumentViewport
&viewport
)
55 : ActionPrivate(), m_extFileName( fileName
), m_vp( viewport
)
59 QString m_extFileName
;
60 DocumentViewport m_vp
;
63 GotoAction::GotoAction( const QString
& fileName
, const DocumentViewport
& viewport
)
64 : Action( *new GotoActionPrivate( fileName
, viewport
) )
68 GotoAction::~GotoAction()
72 Action::ActionType
GotoAction::actionType() const
77 QString
GotoAction::actionTip() const
79 Q_D( const GotoAction
);
80 return d
->m_extFileName
.isEmpty() ? ( d
->m_vp
.isValid() ? i18n( "Go to page %1", d
->m_vp
.pageNumber
+ 1 ) : "" ) :
81 i18n("Open external file");
84 bool GotoAction::isExternal() const
86 Q_D( const GotoAction
);
87 return !d
->m_extFileName
.isEmpty();
90 QString
GotoAction::fileName() const
92 Q_D( const GotoAction
);
93 return d
->m_extFileName
;
96 DocumentViewport
GotoAction::destViewport() const
98 Q_D( const GotoAction
);
104 class Okular::ExecuteActionPrivate
: public Okular::ActionPrivate
107 ExecuteActionPrivate( const QString
&file
, const QString
& parameters
)
108 : ActionPrivate(), m_fileName( file
), m_parameters( parameters
)
113 QString m_parameters
;
116 ExecuteAction::ExecuteAction( const QString
&file
, const QString
& parameters
)
117 : Action( *new ExecuteActionPrivate( file
, parameters
) )
121 ExecuteAction::~ExecuteAction()
125 Action::ActionType
ExecuteAction::actionType() const
130 QString
ExecuteAction::actionTip() const
132 Q_D( const Okular::ExecuteAction
);
133 return i18n( "Execute '%1'...", d
->m_fileName
);
136 QString
ExecuteAction::fileName() const
138 Q_D( const Okular::ExecuteAction
);
139 return d
->m_fileName
;
142 QString
ExecuteAction::parameters() const
144 Q_D( const Okular::ExecuteAction
);
145 return d
->m_parameters
;
150 class Okular::BrowseActionPrivate
: public Okular::ActionPrivate
153 BrowseActionPrivate( const QString
&url
)
154 : ActionPrivate(), m_url( url
)
161 BrowseAction::BrowseAction( const QString
&url
)
162 : Action( *new BrowseActionPrivate( url
) )
166 BrowseAction::~BrowseAction()
170 Action::ActionType
BrowseAction::actionType() const
175 QString
BrowseAction::actionTip() const
177 Q_D( const Okular::BrowseAction
);
179 int row
= 0, col
= 0;
180 if ( extractLilyPondSourceReference( d
->m_url
, &source
, &row
, &col
) )
182 return sourceReferenceToolTip( source
, row
, col
);
187 QString
BrowseAction::url() const
189 Q_D( const Okular::BrowseAction
);
195 class Okular::DocumentActionPrivate
: public Okular::ActionPrivate
198 DocumentActionPrivate( enum DocumentAction::DocumentActionType documentActionType
)
199 : ActionPrivate(), m_type( documentActionType
)
203 DocumentAction::DocumentActionType m_type
;
206 DocumentAction::DocumentAction( enum DocumentActionType documentActionType
)
207 : Action( *new DocumentActionPrivate( documentActionType
) )
211 DocumentAction::~DocumentAction()
215 DocumentAction::DocumentActionType
DocumentAction::documentActionType() const
217 Q_D( const Okular::DocumentAction
);
221 Action::ActionType
DocumentAction::actionType() const
226 QString
DocumentAction::actionTip() const
228 Q_D( const Okular::DocumentAction
);
232 return i18n( "First Page" );
234 return i18n( "Previous Page" );
236 return i18n( "Next Page" );
238 return i18n( "Last Page" );
240 return i18n( "Back" );
242 return i18n( "Forward" );
244 return i18n( "Quit" );
246 return i18n( "Start Presentation" );
247 case EndPresentation
:
248 return i18n( "End Presentation" );
250 return i18n( "Find..." );
252 return i18n( "Go To Page..." );
262 class Okular::SoundActionPrivate
: public Okular::ActionPrivate
265 SoundActionPrivate( double volume
, bool sync
, bool repeat
, bool mix
, Okular::Sound
*sound
)
266 : ActionPrivate(), m_volume( volume
), m_sync( sync
),
267 m_repeat( repeat
), m_mix( mix
), m_sound( sound
)
271 ~SoundActionPrivate()
280 Okular::Sound
*m_sound
;
283 SoundAction::SoundAction( double volume
, bool sync
, bool repeat
, bool mix
, Okular::Sound
*sound
)
284 : Action( *new SoundActionPrivate( volume
, sync
, repeat
, mix
, sound
) )
288 SoundAction::~SoundAction()
292 Action::ActionType
SoundAction::actionType() const
297 QString
SoundAction::actionTip() const
299 return i18n( "Play sound..." );
302 double SoundAction::volume() const
304 Q_D( const Okular::SoundAction
);
308 bool SoundAction::synchronous() const
310 Q_D( const Okular::SoundAction
);
314 bool SoundAction::repeat() const
316 Q_D( const Okular::SoundAction
);
320 bool SoundAction::mix() const
322 Q_D( const Okular::SoundAction
);
326 Okular::Sound
*SoundAction::sound() const
328 Q_D( const Okular::SoundAction
);
334 class Okular::ScriptActionPrivate
: public Okular::ActionPrivate
337 ScriptActionPrivate( enum ScriptType type
, const QString
&script
)
338 : ActionPrivate(), m_scriptType( type
), m_script( script
)
342 ScriptType m_scriptType
;
346 ScriptAction::ScriptAction( enum ScriptType type
, const QString
&script
)
347 : Action( *new ScriptActionPrivate( type
, script
) )
351 ScriptAction::~ScriptAction()
355 Action::ActionType
ScriptAction::actionType() const
360 QString
ScriptAction::actionTip() const
362 Q_D( const Okular::ScriptAction
);
363 switch ( d
->m_scriptType
)
366 return i18n( "JavaScript Script" );
372 ScriptType
ScriptAction::scriptType() const
374 Q_D( const Okular::ScriptAction
);
375 return d
->m_scriptType
;
378 QString
ScriptAction::script() const
380 Q_D( const Okular::ScriptAction
);
387 class Okular::MovieActionPrivate
: public Okular::ActionPrivate
396 MovieAction::MovieAction()
397 : Action( *new MovieActionPrivate() )
401 MovieAction::~MovieAction()
405 Action::ActionType
MovieAction::actionType() const
410 QString
MovieAction::actionTip() const
412 return i18n( "Play movie..." );