%
% anyremote configuration file for LibreOffice/OpenOffice Impress management (Server-mode)
%

% STATUS stable
% XTEST yes
% SOUND no
% ENV no
% FBROWSER v.4i
% DEF_PRESENTATION   
% ALL_IN_ONE 
% MEDIACENTER presentation

GuiAppName=Open Office Impress
GuiAppBinary=ooimpress
GuiAppRun=echo 'LO=`which libreoffice 2> /dev/null`; EXEC=`if [ "x$LO" = "x" ]; then echo simpress.bin; else echo "soffice.bin --impress"; fi`;A=`ps -ef|grep "$EXEC"|grep -v grep|grep -v edit`; if [ "x$A" = "x" ]; then echo NOK; else echo OK; fi'|sh -s
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=Impress is a truly outstanding tool for creating effective multimedia presentations. Your presentations can be enhanced with 2D and 3D clip art, special effects and transition styles, animations, and high-impact drawing tools.

[Protocol]=Server

(Init)=\
	Include($(CfgDir)/Utils/aliases-server.cfg);\
	Include($(CfgDir)/Utils/aliases-server-fbrowser-v4i.cfg);\
	Macro(FBROWSER_IC_INIT);\
	Include($(CfgDir)/Utils/aliases-server-presentation.cfg);\
	Make(var,open_file,by_value,);\
	Make(var,app_name,by_value,Impress);\
	Make(var,app_manage_mode,by_value,impress_manage);

(Exit)=\
	Macro(FBROWSER_IC_EXIT);

(Connect)=\
	Make(mode,impress);

[Mode]=impress : default_presentation_init

APP_IS_RUN=\
	Make(var,impress_isrun,LO=`which libreoffice 2> /dev/null`; if [ "x$LO" = "x" ]; then echo simpress.bin; else echo "soffice.bin --impress"; fi);\
	Make(var,app_run,ps -fu `id -u`|grep '$(impress_isrun)'|grep -v grep|grep -v edit|head -1|wc -l);

[ModeEnd]

[Mode]=impress_manage : default_presentation

SETUP_DEFAULT_PRESENTATION=\
	Set(layout,default);\
 	Set(icons,$(app_name),\
		1,none,2,none,3,none,\
		4,rewind,5,fullscreen,6,forward,\
		7,prev,8,none,9,next,\
		*,question,0,none,#,no);\
	Set(status,$(app_name));\
	Set(title,$(open_file));

* *=Set(text,replace,Help,1\n2\n3\n4 Previous Page\n5 Fullscreen\n6 Next Page\n7 First Page\n8\n9 Last Page\n ** Help\n0\n# Quit $(app_name)\n);

APP_MENU=\
	Set(menu,replace,File Browser,Press Enter,PowerMgmt);\
	Macro(ALLIN1MENU);\
	Macro(MEDIACENTER_MENU);

APP_SETUP=\
	Macro(SETUP_APP_EXEC);\
 	Make(var,impress_fs,by_value,F5);\
 
% Search for Libre Office or for Open Office	
SETUP_APP_EXEC=\
	Make(var,impress_exec,LO=`which libreoffice 2> /dev/null`; if [ "x$LO" = "x" ]; then echo simpress.bin; else echo "libreoffice --impress"; fi);\
	Make(var,impress_isrun,LO=`which libreoffice 2> /dev/null`; if [ "x$LO" = "x" ]; then echo simpress.bin; else echo "soffice.bin --impress"; fi);\
	Make(var,impress_switch,LO=`which libreoffice 2> /dev/null`; if [ "x$LO" = "x" ]; then echo simpress.bin; else echo soffice.bin; fi);

APP_START_IF=\
	Make(var,app_run,ps -fu `id -u`|grep '$(impress_isrun)'|grep -v grep|grep -v edit|head -1|wc -l);\
	Exec(if [ "x$(app_run)" = "x0" ]; then cd "$(fbrowser_dir)";$(impress_exec) $(open_file)& fi 2> /dev/null);

APP_RAISE=\
	Exec($(CfgDir)/Utils/run-or-switch-to.sh -switch $(impress_switch));

APP_QUIT=\
	Set(title, );\
	Set(status, );\
	Emulate(key,Escape);\
	Emulate(keydown,Control_L,key,q,keyup,Control_L);\
	Exec(sleep 3;pkill -fu `id -u` "$(impress_isrun)");

PRES_PREV_PAGE=\
	Emulate(key,Page_Up);
	
PRES_NEXT_PAGE=\
	Emulate(key,Page_Down);
	
PRES_ZOOM_IN=\
	Make(none);
	
PRES_ZOOM_OUT=\
	Make(none);

PRES_FIRST_PAGE=\
	Emulate(key,Home);
	
PRES_LAST_PAGE=\
	Emulate(key,End);
	
PRES_TOGGLE_FULLSCREEN=\
	Emulate(key,$(impress_fs));\
	Make(var,impress_fs,if [ "x$(impress_fs)" = "xF5" ]; then echo Escape; else echo F5; fi);
	
PRES_REFRESH=\
	Make(none);
	
Press Enter=\
	Emulate(key,Enter);

[ModeEnd]

[End]
