2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 10:42:50 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 10:42:50 +00:00
|
|
|
* $RCSfile: svapp.cxx,v $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2007-04-26 08:26:32 +00:00
|
|
|
* $Revision: 1.75 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2007-04-26 08:26:32 +00:00
|
|
|
* last change: $Author: rt $ $Date: 2007-04-26 09:26:32 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 10:42:50 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 10:42:50 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 10:42:50 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 10:42:50 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 10:42:50 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 10:49:38 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_vcl.hxx"
|
|
|
|
|
2000-10-23 05:44:59 +00:00
|
|
|
#include <stdio.h>
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _SV_SVSYS_HXX
|
|
|
|
#include <svsys.h>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_SALINST_HXX
|
|
|
|
#include <salinst.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_SALFRAME_HXX
|
|
|
|
#include <salframe.hxx>
|
|
|
|
#endif
|
2006-07-26 08:11:18 +00:00
|
|
|
#ifndef _SV_SALSYS_HXX
|
|
|
|
#include <salsys.hxx>
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _VOS_PROCESS_HXX
|
|
|
|
#include <vos/process.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _VOS_MUTEX_HXX
|
|
|
|
#include <vos/mutex.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _TOOLS_H
|
|
|
|
#include <tools/tools.h>
|
|
|
|
#endif
|
|
|
|
#ifndef _DEBUG_HXX
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#endif
|
2006-04-07 14:29:41 +00:00
|
|
|
#ifndef _TOOLS_TIME_HXX
|
|
|
|
#include <tools/time.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef INCLUDED_I18NPOOL_MSLANGID_HXX
|
|
|
|
#include <i18npool/mslangid.hxx>
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _SV_SVDATA_HXX
|
|
|
|
#include <svdata.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_SETTINGS_HXX
|
|
|
|
#include <settings.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _ACCMGR_HXX
|
|
|
|
#include <accmgr.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_KEYCOD_HXX
|
|
|
|
#include <keycod.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_EVENT_HXX
|
|
|
|
#include <event.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_VIRDEV_HXX
|
|
|
|
#include <virdev.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_WINDATA_HXX
|
|
|
|
#include <windata.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_WINDOW_H
|
|
|
|
#include <window.h>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_WRKWIN_HXX
|
|
|
|
#include <wrkwin.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_IDLEMGR_HXX
|
|
|
|
#include <idlemgr.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_SVAPP_HXX
|
|
|
|
#include <svapp.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_CVTGRF_HXX
|
|
|
|
#include <cvtgrf.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _VCL_UNOWRAP_HXX
|
|
|
|
#include <unowrap.hxx>
|
|
|
|
#endif
|
2001-02-01 13:08:06 +00:00
|
|
|
#ifndef _VCL_XCONNECTION_HXX
|
|
|
|
#include <xconnection.hxx>
|
|
|
|
#endif
|
2002-10-25 10:43:13 +00:00
|
|
|
#ifndef _SV_SVIDS_HRC
|
|
|
|
#include <svids.hrc>
|
|
|
|
#endif
|
2006-06-19 18:14:25 +00:00
|
|
|
#ifndef _SV_TIMER_HXX
|
|
|
|
#include <timer.hxx>
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-15 10:33:48 +00:00
|
|
|
#include <unohelp.hxx>
|
|
|
|
|
2000-10-23 05:44:59 +00:00
|
|
|
#include <com/sun/star/uno/Reference.h>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <com/sun/star/awt/XToolkit.hpp>
|
2000-10-26 05:32:57 +00:00
|
|
|
#include <com/sun/star/uno/XNamingService.hpp>
|
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-10-23 05:44:59 +00:00
|
|
|
#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
|
|
|
|
#include <comphelper/processfactory.hxx>
|
|
|
|
#endif
|
|
|
|
|
2001-03-15 10:33:48 +00:00
|
|
|
#include <osl/module.h>
|
2001-09-07 12:47:30 +00:00
|
|
|
#include <osl/file.hxx>
|
2001-03-15 10:33:48 +00:00
|
|
|
|
2002-11-26 14:37:09 +00:00
|
|
|
#include "osl/thread.h"
|
|
|
|
#include "rtl/tencinfo.h"
|
|
|
|
|
2004-06-25 16:08:44 +00:00
|
|
|
#ifndef INCLUDED_RTL_INSTANCE_HXX
|
|
|
|
#include <rtl/instance.hxx>
|
|
|
|
#endif
|
|
|
|
|
2003-11-18 13:31:58 +00:00
|
|
|
#ifndef _SV_SALIMESTATUS_HXX
|
|
|
|
#include <salimestatus.hxx>
|
|
|
|
#endif
|
2002-11-26 14:37:09 +00:00
|
|
|
|
2004-06-25 16:08:44 +00:00
|
|
|
#include <utility>
|
2007-01-23 06:07:44 +00:00
|
|
|
#include "lazydelete.hxx"
|
2004-06-25 16:08:44 +00:00
|
|
|
|
2001-05-18 08:26:12 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
|
2002-10-23 12:18:26 +00:00
|
|
|
// keycodes handled internally by VCL
|
2002-10-25 10:43:13 +00:00
|
|
|
class ImplReservedKey
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ImplReservedKey( KeyCode aKeyCode, USHORT nResId ) :
|
|
|
|
mKeyCode(aKeyCode), mnResId( nResId)
|
|
|
|
{}
|
|
|
|
|
|
|
|
KeyCode mKeyCode;
|
|
|
|
USHORT mnResId;
|
|
|
|
};
|
|
|
|
|
2004-06-25 16:08:44 +00:00
|
|
|
typedef std::pair<ImplReservedKey*, size_t> ReservedKeys;
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
struct ImplReservedKeysImpl
|
|
|
|
{
|
|
|
|
ReservedKeys* operator()()
|
|
|
|
{
|
|
|
|
static ImplReservedKey ImplReservedKeys[] =
|
|
|
|
{
|
2004-07-05 08:42:59 +00:00
|
|
|
ImplReservedKey(KeyCode(KEY_F1,0), SV_SHORTCUT_HELP),
|
|
|
|
ImplReservedKey(KeyCode(KEY_F1,KEY_SHIFT), SV_SHORTCUT_ACTIVEHELP),
|
|
|
|
ImplReservedKey(KeyCode(KEY_F1,KEY_MOD1), SV_SHORTCUT_CONTEXTHELP),
|
|
|
|
ImplReservedKey(KeyCode(KEY_F2,KEY_SHIFT), SV_SHORTCUT_CONTEXTHELP),
|
|
|
|
ImplReservedKey(KeyCode(KEY_F4,KEY_MOD1), SV_SHORTCUT_DOCKUNDOCK),
|
|
|
|
ImplReservedKey(KeyCode(KEY_F4,KEY_MOD2), SV_SHORTCUT_DOCKUNDOCK),
|
|
|
|
ImplReservedKey(KeyCode(KEY_F4,KEY_MOD1|KEY_MOD2), SV_SHORTCUT_DOCKUNDOCK),
|
|
|
|
ImplReservedKey(KeyCode(KEY_F6,0), SV_SHORTCUT_NEXTSUBWINDOW),
|
|
|
|
ImplReservedKey(KeyCode(KEY_F6,KEY_MOD1), SV_SHORTCUT_TODOCUMENT),
|
|
|
|
ImplReservedKey(KeyCode(KEY_F6,KEY_SHIFT), SV_SHORTCUT_PREVSUBWINDOW),
|
|
|
|
ImplReservedKey(KeyCode(KEY_F6,KEY_MOD1|KEY_SHIFT), SV_SHORTCUT_SPLITTER),
|
|
|
|
ImplReservedKey(KeyCode(KEY_F10,0), SV_SHORTCUT_MENUBAR)
|
2003-03-27 16:59:30 +00:00
|
|
|
#ifdef UNX
|
2004-06-25 16:08:44 +00:00
|
|
|
,
|
|
|
|
ImplReservedKey(KeyCode(KEY_1,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(KeyCode(KEY_2,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(KeyCode(KEY_3,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(KeyCode(KEY_4,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(KeyCode(KEY_5,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(KeyCode(KEY_6,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(KeyCode(KEY_7,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(KeyCode(KEY_8,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(KeyCode(KEY_9,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(KeyCode(KEY_0,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(KeyCode(KEY_ADD,KEY_SHIFT|KEY_MOD1), 0)
|
2003-03-27 16:59:30 +00:00
|
|
|
#endif
|
2004-06-25 16:08:44 +00:00
|
|
|
};
|
|
|
|
static ReservedKeys aKeys
|
|
|
|
(
|
|
|
|
&ImplReservedKeys[0],
|
|
|
|
sizeof(ImplReservedKeys) / sizeof(ImplReservedKey)
|
|
|
|
);
|
|
|
|
return &aKeys;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ImplReservedKeys
|
|
|
|
: public rtl::StaticAggregate<ReservedKeys, ImplReservedKeysImpl> {};
|
|
|
|
}
|
2002-10-23 12:18:26 +00:00
|
|
|
|
2000-10-26 05:32:57 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// #include <usr/refl.hxx>
|
|
|
|
class Reflection;
|
|
|
|
|
2003-12-01 12:07:39 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-15 10:33:48 +00:00
|
|
|
extern "C" {
|
|
|
|
typedef UnoWrapperBase* (SAL_CALL *FN_TkCreateUnoWrapper)();
|
2006-06-19 18:14:25 +00:00
|
|
|
}
|
2001-03-15 10:33:48 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// =======================================================================
|
|
|
|
|
|
|
|
// --------------
|
|
|
|
// - ImplHotKey -
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
struct ImplHotKey
|
|
|
|
{
|
|
|
|
ImplHotKey* mpNext;
|
|
|
|
void* mpUserData;
|
|
|
|
KeyCode maKeyCode;
|
|
|
|
Link maLink;
|
|
|
|
};
|
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
|
|
|
// -----------------
|
|
|
|
// - ImplEventHook -
|
|
|
|
// -----------------
|
|
|
|
|
|
|
|
struct ImplEventHook
|
|
|
|
{
|
|
|
|
ImplEventHook* mpNext;
|
|
|
|
void* mpUserData;
|
|
|
|
VCLEventHookProc mpProc;
|
|
|
|
};
|
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
2004-08-12 09:46:07 +00:00
|
|
|
// ---------------------
|
|
|
|
// - ImplPostEventData -
|
|
|
|
// ---------------------
|
|
|
|
|
|
|
|
struct ImplPostEventData
|
|
|
|
{
|
|
|
|
ULONG mnEvent;
|
|
|
|
const Window* mpWin;
|
|
|
|
ULONG mnEventId;
|
|
|
|
KeyEvent maKeyEvent;
|
|
|
|
MouseEvent maMouseEvent;
|
|
|
|
|
|
|
|
|
|
|
|
ImplPostEventData( ULONG nEvent, const Window* pWin, const KeyEvent& rKeyEvent ) :
|
|
|
|
mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maKeyEvent( rKeyEvent ) {}
|
|
|
|
ImplPostEventData( ULONG nEvent, const Window* pWin, const MouseEvent& rMouseEvent ) :
|
|
|
|
mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maMouseEvent( rMouseEvent ) {}
|
|
|
|
|
|
|
|
~ImplPostEventData() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef ::std::pair< Window*, ImplPostEventData* > ImplPostEventPair;
|
|
|
|
|
|
|
|
static ::std::list< ImplPostEventPair > aPostedEventList;
|
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
Application* GetpApp()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( !pSVData )
|
|
|
|
return NULL;
|
|
|
|
return pSVData->mpApp;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Application::Application()
|
|
|
|
{
|
2005-06-30 12:14:12 +00:00
|
|
|
if( ! ImplGetSVData() )
|
|
|
|
ImplInitSVData();
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplGetSVData()->mpApp = this;
|
|
|
|
InitSalData();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Application::~Application()
|
|
|
|
{
|
|
|
|
ImplDeInitSVData();
|
|
|
|
DeInitSalData();
|
|
|
|
ImplGetSVData()->mpApp = NULL;
|
|
|
|
ImplDestroySVData();
|
|
|
|
GlobalDeInitTools();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-06-19 18:14:25 +00:00
|
|
|
void Application::InitAppRes( const ResId& )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::QueryExit()
|
|
|
|
{
|
|
|
|
WorkWindow* pAppWin = ImplGetSVData()->maWinData.mpAppWin;
|
|
|
|
|
|
|
|
// Aufruf des Close-Handlers des Applikationsfensters
|
|
|
|
if ( pAppWin )
|
|
|
|
return pAppWin->Close();
|
|
|
|
else
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::UserEvent( ULONG, void* )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::ShowStatusText( const XubString& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::ShowHelpStatusText( const XubString& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::ActivateExtHelp()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::DeactivateExtHelp()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::HideStatusText()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::HideHelpStatusText()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::FocusChanged()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::DataChanged( const DataChangedEvent& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2000-10-13 08:43:02 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void Application::Init()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-10-23 05:44:59 +00:00
|
|
|
void Application::DeInit()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
USHORT Application::GetCommandLineParamCount()
|
|
|
|
{
|
2001-03-20 09:36:58 +00:00
|
|
|
vos::OStartupInfo aStartInfo;
|
2000-09-18 16:07:07 +00:00
|
|
|
return (USHORT)aStartInfo.getCommandArgCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
XubString Application::GetCommandLineParam( USHORT nParam )
|
|
|
|
{
|
2001-03-20 09:36:58 +00:00
|
|
|
vos::OStartupInfo aStartInfo;
|
|
|
|
rtl::OUString aParam;
|
2000-09-18 16:07:07 +00:00
|
|
|
aStartInfo.getCommandArg( nParam, aParam );
|
|
|
|
return XubString( aParam );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
const XubString& Application::GetAppFileName()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
DBG_ASSERT( pSVData->maAppData.mpAppFileName, "AppFileName vor SVMain ?!" );
|
|
|
|
if ( pSVData->maAppData.mpAppFileName )
|
|
|
|
return *pSVData->maAppData.mpAppFileName;
|
2001-09-07 12:47:30 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* #91147# provide a fallback for people without initialized
|
|
|
|
* vcl here (like setup in responsefile mode)
|
|
|
|
*/
|
|
|
|
static String aAppFileName;
|
|
|
|
if( !aAppFileName.Len() )
|
|
|
|
{
|
|
|
|
vos::OStartupInfo aStartInfo;
|
|
|
|
::rtl::OUString aExeFileName;
|
|
|
|
|
|
|
|
aStartInfo.getExecutableFile( aExeFileName );
|
|
|
|
|
|
|
|
// convert path to native file format
|
|
|
|
rtl::OUString aNativeFileName;
|
|
|
|
osl::FileBase::getSystemPathFromFileURL( aExeFileName, aNativeFileName );
|
|
|
|
aAppFileName = aNativeFileName;
|
|
|
|
}
|
|
|
|
|
|
|
|
return aAppFileName;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
USHORT Application::Exception( USHORT nError )
|
|
|
|
{
|
|
|
|
switch ( nError & EXC_MAJORTYPE )
|
|
|
|
{
|
|
|
|
// Bei System machen wir nichts und lassen dem System den
|
|
|
|
// vortritt
|
|
|
|
case EXC_SYSTEM:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case EXC_DISPLAY:
|
|
|
|
case EXC_REMOTE:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
case EXC_RSCNOTLOADED:
|
|
|
|
Abort( XubString( RTL_CONSTASCII_USTRINGPARAM( "Resource not loaded" ) ) );
|
|
|
|
break;
|
|
|
|
case EXC_SYSOBJNOTCREATED:
|
|
|
|
Abort( XubString( RTL_CONSTASCII_USTRINGPARAM( "System Object not created" ) ) );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Abort( XubString( RTL_CONSTASCII_USTRINGPARAM( "Unknown Error" ) ) );
|
|
|
|
break;
|
|
|
|
#else
|
|
|
|
default:
|
|
|
|
Abort( ImplGetSVEmptyStr() );
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::Abort( const XubString& rErrorText )
|
|
|
|
{
|
|
|
|
SalAbort( rErrorText );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2002-10-23 12:18:26 +00:00
|
|
|
ULONG Application::GetReservedKeyCodeCount()
|
|
|
|
{
|
2004-06-25 16:08:44 +00:00
|
|
|
return ImplReservedKeys::get()->second;
|
2002-10-23 12:18:26 +00:00
|
|
|
}
|
2002-10-25 10:43:13 +00:00
|
|
|
|
2002-10-23 12:18:26 +00:00
|
|
|
const KeyCode* Application::GetReservedKeyCode( ULONG i )
|
2002-10-23 11:13:22 +00:00
|
|
|
{
|
2002-10-23 12:18:26 +00:00
|
|
|
if( i >= GetReservedKeyCodeCount() )
|
|
|
|
return NULL;
|
|
|
|
else
|
2004-06-25 16:08:44 +00:00
|
|
|
return &ImplReservedKeys::get()->first[i].mKeyCode;
|
2002-10-25 10:43:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String Application::GetReservedKeyCodeDescription( ULONG i )
|
|
|
|
{
|
2005-09-28 13:37:14 +00:00
|
|
|
ResMgr* pResMgr = ImplGetResMgr();
|
|
|
|
if( ! pResMgr )
|
|
|
|
return String();
|
2004-06-25 16:08:44 +00:00
|
|
|
ImplReservedKey *pImplReservedKeys = ImplReservedKeys::get()->first;
|
|
|
|
if( i >= GetReservedKeyCodeCount() || ! pImplReservedKeys[i].mnResId )
|
2002-10-25 10:43:13 +00:00
|
|
|
return String();
|
|
|
|
else
|
2007-04-26 08:26:32 +00:00
|
|
|
return String( ResId( pImplReservedKeys[i].mnResId, *pResMgr ) );
|
2002-10-23 11:13:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Application::Execute()
|
|
|
|
{
|
|
|
|
DBG_STARTAPPEXECUTE();
|
|
|
|
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
pSVData->maAppData.mbInAppExecute = TRUE;
|
|
|
|
|
|
|
|
while ( !pSVData->maAppData.mbAppQuit )
|
|
|
|
Application::Yield();
|
|
|
|
|
|
|
|
pSVData->maAppData.mbInAppExecute = FALSE;
|
|
|
|
|
|
|
|
DBG_ENDAPPEXECUTE();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-07-10 15:34:10 +00:00
|
|
|
void Application::Reschedule( bool bAllEvents )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
2006-07-10 15:34:10 +00:00
|
|
|
// run timers that have timed out
|
2001-12-11 14:03:05 +00:00
|
|
|
if ( !pSVData->mbNoCallTimer )
|
|
|
|
while ( pSVData->mbNotAllTimerCalled )
|
2006-06-19 18:14:25 +00:00
|
|
|
Timer::ImplTimerCallbackProc();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pSVData->maAppData.mnDispatchLevel++;
|
2006-07-10 15:34:10 +00:00
|
|
|
pSVData->mpDefInst->Yield( false, bAllEvents );
|
2000-09-18 16:07:07 +00:00
|
|
|
pSVData->maAppData.mnDispatchLevel--;
|
2007-01-23 06:07:44 +00:00
|
|
|
|
|
|
|
// flush lazy deleted objects
|
|
|
|
if( pSVData->maAppData.mnDispatchLevel == 0 )
|
|
|
|
vcl::LazyDelete::flush();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-07-10 15:34:10 +00:00
|
|
|
void Application::Yield( bool bAllEvents )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
2006-07-10 15:34:10 +00:00
|
|
|
// run timers that have timed out
|
2001-12-11 14:03:05 +00:00
|
|
|
if ( !pSVData->mbNoCallTimer )
|
|
|
|
while ( pSVData->mbNotAllTimerCalled )
|
2006-06-19 18:14:25 +00:00
|
|
|
Timer::ImplTimerCallbackProc();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-07-10 15:34:10 +00:00
|
|
|
// do not wait for events if application was already quit; in that
|
|
|
|
// case only dispatch events already available
|
2000-09-18 16:07:07 +00:00
|
|
|
pSVData->maAppData.mnDispatchLevel++;
|
2006-07-10 15:34:10 +00:00
|
|
|
pSVData->mpDefInst->Yield( !pSVData->maAppData.mbAppQuit, bAllEvents );
|
2000-09-18 16:07:07 +00:00
|
|
|
pSVData->maAppData.mnDispatchLevel--;
|
2007-01-23 06:07:44 +00:00
|
|
|
|
|
|
|
// flush lazy deleted objects
|
|
|
|
if( pSVData->maAppData.mnDispatchLevel == 0 )
|
|
|
|
vcl::LazyDelete::flush();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-06-19 18:14:25 +00:00
|
|
|
IMPL_STATIC_LINK_NOINSTANCE( ImplSVAppData, ImplQuitMsg, void*, EMPTYARG )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplGetSVData()->maAppData.mbAppQuit = TRUE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::Quit()
|
|
|
|
{
|
|
|
|
Application::PostUserEvent( STATIC_LINK( NULL, ImplSVAppData, ImplQuitMsg ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
vos::IMutex& Application::GetSolarMutex()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
return *(pSVData->mpDefInst->GetYieldMutex());
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
vos::OThread::TThreadIdentifier Application::GetMainThreadIdentifier()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->mnMainThreadId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
ULONG Application::ReleaseSolarMutex()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
return pSVData->mpDefInst->ReleaseYieldMutex();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::AcquireSolarMutex( ULONG nCount )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
pSVData->mpDefInst->AcquireYieldMutex( nCount );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::IsInMain()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.mbInAppMain;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::IsInExecute()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.mbInAppExecute;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::IsShutDown()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.mbAppQuit;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::IsInModalMode()
|
|
|
|
{
|
|
|
|
return (ImplGetSVData()->maAppData.mnModalMode != 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
USHORT Application::GetDispatchLevel()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.mnDispatchLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::AnyInput( USHORT nType )
|
|
|
|
{
|
2003-11-18 13:31:58 +00:00
|
|
|
return (BOOL)ImplGetSVData()->mpDefInst->AnyInput( nType );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
ULONG Application::GetLastInputInterval()
|
|
|
|
{
|
|
|
|
return (Time::GetSystemTicks()-ImplGetSVData()->maAppData.mnLastInputTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
extern int nImplSysDialog;
|
|
|
|
|
|
|
|
BOOL Application::IsUICaptured()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
// Wenn Mouse gecaptured, oder im TrackingModus oder im Auswahlmodus
|
|
|
|
// eines FloatingWindows (wie Menus, Aufklapp-ToolBoxen) soll kein
|
|
|
|
// weiteres Fenster aufgezogen werden
|
2001-07-06 15:14:31 +00:00
|
|
|
// D&D aktive !!!
|
2001-02-14 07:32:01 +00:00
|
|
|
if ( pSVData->maWinData.mpCaptureWin || pSVData->maWinData.mpTrackWin ||
|
|
|
|
pSVData->maWinData.mpFirstFloat || nImplSysDialog )
|
2000-09-18 16:07:07 +00:00
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::IsUserActive( USHORT nTest )
|
|
|
|
{
|
|
|
|
if ( nTest & (USERACTIVE_MOUSEDRAG | USERACTIVE_INPUT) )
|
|
|
|
{
|
|
|
|
if ( IsUICaptured() )
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nTest & USERACTIVE_INPUT )
|
|
|
|
{
|
|
|
|
if ( GetLastInputInterval() < 500 )
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if ( AnyInput( INPUT_KEYBOARD ) )
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nTest & USERACTIVE_MODALDIALOG )
|
|
|
|
{
|
|
|
|
if ( ImplGetSVData()->maAppData.mnModalDialog )
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-06-19 18:14:25 +00:00
|
|
|
void Application::SystemSettingsChanging( AllSettings& /*rSettings*/,
|
|
|
|
Window* /*pFrame*/ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::MergeSystemSettings( AllSettings& rSettings )
|
|
|
|
{
|
2003-04-11 16:27:47 +00:00
|
|
|
Window* pWindow = ImplGetSVData()->maWinData.mpFirstFrame;
|
|
|
|
if( ! pWindow )
|
|
|
|
pWindow = ImplGetDefaultWindow();
|
2006-05-18 09:08:08 +00:00
|
|
|
if( pWindow )
|
2003-04-11 16:27:47 +00:00
|
|
|
{
|
2006-05-18 09:08:08 +00:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( !pSVData->maAppData.mbSettingsInit )
|
|
|
|
{
|
|
|
|
pWindow->ImplGetFrame()->UpdateSettings( *pSVData->maAppData.mpSettings );
|
|
|
|
pWindow->ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings );
|
|
|
|
pSVData->maAppData.mbSettingsInit = TRUE;
|
|
|
|
}
|
|
|
|
pWindow->ImplGetFrame()->UpdateSettings( rSettings );
|
|
|
|
pWindow->ImplUpdateGlobalSettings( rSettings, FALSE );
|
2003-04-11 16:27:47 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2004-07-05 08:42:59 +00:00
|
|
|
bool Application::ValidateSystemFont()
|
|
|
|
{
|
|
|
|
Window* pWindow = ImplGetSVData()->maWinData.mpFirstFrame;
|
|
|
|
if( ! pWindow )
|
|
|
|
pWindow = ImplGetDefaultWindow();
|
|
|
|
|
2006-05-18 09:08:08 +00:00
|
|
|
if( pWindow )
|
|
|
|
{
|
|
|
|
AllSettings aSettings;
|
|
|
|
pWindow->ImplGetFrame()->UpdateSettings( aSettings );
|
|
|
|
return pWindow->ImplCheckUIFont( aSettings.GetStyleSettings().GetAppFont() );
|
|
|
|
}
|
|
|
|
return false;
|
2004-07-05 08:42:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Application::SetSettings( const AllSettings& rSettings )
|
|
|
|
{
|
2006-04-07 14:29:41 +00:00
|
|
|
MsLangId::setConfiguredSystemLanguage( rSettings.GetLanguage());
|
|
|
|
MsLangId::setConfiguredSystemUILanguage( rSettings.GetUILanguage());
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( !pSVData->maAppData.mpSettings )
|
|
|
|
{
|
|
|
|
pSVData->maAppData.mpSettings = new AllSettings();
|
|
|
|
*pSVData->maAppData.mpSettings = rSettings;
|
2005-01-03 16:38:00 +00:00
|
|
|
ResMgr::SetDefaultLocale( rSettings.GetUILocale() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AllSettings aOldSettings = *pSVData->maAppData.mpSettings;
|
2003-03-27 16:59:30 +00:00
|
|
|
if( aOldSettings.GetUILanguage() != rSettings.GetUILanguage() && pSVData->mpResMgr )
|
|
|
|
{
|
|
|
|
delete pSVData->mpResMgr;
|
|
|
|
pSVData->mpResMgr = NULL;
|
|
|
|
}
|
2005-01-03 16:38:00 +00:00
|
|
|
ResMgr::SetDefaultLocale( rSettings.GetUILocale() );
|
2000-09-18 16:07:07 +00:00
|
|
|
*pSVData->maAppData.mpSettings = rSettings;
|
|
|
|
ULONG nChangeFlags = aOldSettings.GetChangeFlags( *pSVData->maAppData.mpSettings );
|
|
|
|
if ( nChangeFlags )
|
|
|
|
{
|
|
|
|
DataChangedEvent aDCEvt( DATACHANGED_SETTINGS, &aOldSettings, nChangeFlags );
|
|
|
|
GetpApp()->DataChanged( aDCEvt );
|
|
|
|
|
2002-07-01 06:39:55 +00:00
|
|
|
// notify data change handler
|
2002-07-17 08:43:42 +00:00
|
|
|
ImplCallEventListeners( VCLEVENT_APPLICATION_DATACHANGED, NULL, &aDCEvt);
|
2002-07-01 06:39:55 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// Update all windows
|
|
|
|
Window* pFirstFrame = pSVData->maWinData.mpFirstFrame;
|
|
|
|
// Daten, die neu berechnet werden muessen, zuruecksetzen
|
2004-09-08 14:04:25 +00:00
|
|
|
long nOldDPIX = 0;
|
|
|
|
long nOldDPIY = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pFirstFrame )
|
|
|
|
{
|
|
|
|
nOldDPIX = pFirstFrame->mnDPIX;
|
|
|
|
nOldDPIY = pFirstFrame->mnDPIY;
|
|
|
|
pSVData->maGDIData.mnAppFontX = 0;
|
|
|
|
}
|
|
|
|
Window* pFrame = pFirstFrame;
|
|
|
|
while ( pFrame )
|
|
|
|
{
|
|
|
|
// AppFont-Cache-Daten zuruecksetzen
|
2005-01-13 17:38:27 +00:00
|
|
|
pFrame->mpWindowImpl->mpFrameData->meMapUnit = MAP_PIXEL;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// UpdateSettings am ClientWindow aufrufen, damit
|
|
|
|
// die Daten nicht doppelt geupdatet werden
|
|
|
|
Window* pClientWin = pFrame;
|
|
|
|
while ( pClientWin->ImplGetClientWindow() )
|
|
|
|
pClientWin = pClientWin->ImplGetClientWindow();
|
|
|
|
pClientWin->UpdateSettings( rSettings, TRUE );
|
|
|
|
|
2005-01-13 17:38:27 +00:00
|
|
|
Window* pTempWin = pFrame->mpWindowImpl->mpFrameData->mpFirstOverlap;
|
2000-09-18 16:07:07 +00:00
|
|
|
while ( pTempWin )
|
|
|
|
{
|
|
|
|
// UpdateSettings am ClientWindow aufrufen, damit
|
|
|
|
// die Daten nicht doppelt geupdatet werden
|
|
|
|
pClientWin = pTempWin;
|
|
|
|
while ( pClientWin->ImplGetClientWindow() )
|
|
|
|
pClientWin = pClientWin->ImplGetClientWindow();
|
|
|
|
pClientWin->UpdateSettings( rSettings, TRUE );
|
2005-01-13 17:38:27 +00:00
|
|
|
pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2005-01-13 17:38:27 +00:00
|
|
|
pFrame = pFrame->mpWindowImpl->mpFrameData->mpNextFrame;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Wenn sich die DPI-Aufloesung fuer Screen-Ausgaben
|
|
|
|
// geaendert hat, setzen wir auch bei allen
|
|
|
|
// Screen-Kompatiblen VirDev's die neue Aufloesung
|
|
|
|
pFirstFrame = pSVData->maWinData.mpFirstFrame;
|
|
|
|
if ( pFirstFrame )
|
|
|
|
{
|
|
|
|
if ( (pFirstFrame->mnDPIX != nOldDPIX) ||
|
|
|
|
(pFirstFrame->mnDPIY != nOldDPIY) )
|
|
|
|
{
|
|
|
|
VirtualDevice* pVirDev = pSVData->maGDIData.mpFirstVirDev;
|
|
|
|
while ( pVirDev )
|
|
|
|
{
|
|
|
|
if ( pVirDev->mbScreenComp &&
|
|
|
|
(pVirDev->mnDPIX == nOldDPIX) &&
|
|
|
|
(pVirDev->mnDPIY == nOldDPIY) )
|
|
|
|
{
|
|
|
|
pVirDev->mnDPIX = pFirstFrame->mnDPIX;
|
|
|
|
pVirDev->mnDPIY = pFirstFrame->mnDPIY;
|
|
|
|
if ( pVirDev->IsMapMode() )
|
|
|
|
{
|
|
|
|
MapMode aMapMode = pVirDev->GetMapMode();
|
|
|
|
pVirDev->SetMapMode();
|
|
|
|
pVirDev->SetMapMode( aMapMode );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pVirDev = pVirDev->mpNext;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
const AllSettings& Application::GetSettings()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( !pSVData->maAppData.mpSettings )
|
|
|
|
pSVData->maAppData.mpSettings = new AllSettings();
|
|
|
|
return *(pSVData->maAppData.mpSettings);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::NotifyAllWindows( DataChangedEvent& rDCEvt )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
Window* pFrame = pSVData->maWinData.mpFirstFrame;
|
|
|
|
while ( pFrame )
|
|
|
|
{
|
|
|
|
pFrame->NotifyAllChilds( rDCEvt );
|
|
|
|
|
2005-01-13 17:38:27 +00:00
|
|
|
Window* pSysWin = pFrame->mpWindowImpl->mpFrameData->mpFirstOverlap;
|
2000-09-18 16:07:07 +00:00
|
|
|
while ( pSysWin )
|
|
|
|
{
|
|
|
|
pSysWin->NotifyAllChilds( rDCEvt );
|
2005-01-13 17:38:27 +00:00
|
|
|
pSysWin = pSysWin->mpWindowImpl->mpNextOverlap;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2005-01-13 17:38:27 +00:00
|
|
|
pFrame = pFrame->mpWindowImpl->mpFrameData->mpNextFrame;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2002-07-17 08:43:42 +00:00
|
|
|
void Application::ImplCallEventListeners( ULONG nEvent, Window *pWin, void* pData )
|
2002-07-01 06:39:55 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2002-07-17 08:43:42 +00:00
|
|
|
VclWindowEvent aEvent( pWin, nEvent, pData );
|
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpEventListeners )
|
|
|
|
if ( !pSVData->maAppData.mpEventListeners->empty() )
|
|
|
|
pSVData->maAppData.mpEventListeners->Call( &aEvent );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-05-05 09:51:27 +00:00
|
|
|
void Application::ImplCallEventListeners( VclSimpleEvent* pEvent )
|
2002-07-18 07:04:31 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpEventListeners )
|
|
|
|
if ( !pSVData->maAppData.mpEventListeners->empty() )
|
|
|
|
pSVData->maAppData.mpEventListeners->Call( pEvent );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2002-07-17 08:43:42 +00:00
|
|
|
void Application::AddEventListener( const Link& rEventListener )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( !pSVData->maAppData.mpEventListeners )
|
|
|
|
pSVData->maAppData.mpEventListeners = new VclEventListeners;
|
|
|
|
pSVData->maAppData.mpEventListeners->push_back( rEventListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::RemoveEventListener( const Link& rEventListener )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( pSVData->maAppData.mpEventListeners )
|
|
|
|
pSVData->maAppData.mpEventListeners->remove( rEventListener );
|
2002-07-01 06:39:55 +00:00
|
|
|
}
|
|
|
|
|
2002-07-18 07:04:31 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void Application::AddKeyListener( const Link& rKeyListener )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( !pSVData->maAppData.mpKeyListeners )
|
|
|
|
pSVData->maAppData.mpKeyListeners = new VclEventListeners;
|
|
|
|
pSVData->maAppData.mpKeyListeners->push_back( rKeyListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::RemoveKeyListener( const Link& rKeyListener )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( pSVData->maAppData.mpKeyListeners )
|
|
|
|
pSVData->maAppData.mpKeyListeners->remove( rKeyListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::HandleKey( ULONG nEvent, Window *pWin, KeyEvent* pKeyEvent )
|
|
|
|
{
|
|
|
|
// let listeners process the key event
|
|
|
|
VclWindowEvent aEvent( pWin, nEvent, (void *) pKeyEvent );
|
|
|
|
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
BOOL bProcessed = FALSE;
|
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpKeyListeners )
|
|
|
|
if ( !pSVData->maAppData.mpKeyListeners->empty() )
|
|
|
|
bProcessed = pSVData->maAppData.mpKeyListeners->Process( &aEvent );
|
|
|
|
|
|
|
|
return bProcessed;
|
|
|
|
}
|
|
|
|
|
2004-08-12 09:46:07 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
ULONG Application::PostKeyEvent( ULONG nEvent, Window *pWin, KeyEvent* pKeyEvent )
|
|
|
|
{
|
|
|
|
const ::vos::OGuard aGuard( GetSolarMutex() );
|
|
|
|
ULONG nEventId = 0;
|
|
|
|
|
|
|
|
if( pWin && pKeyEvent )
|
|
|
|
{
|
|
|
|
ImplPostEventData* pPostEventData = new ImplPostEventData( nEvent, pWin, *pKeyEvent );
|
|
|
|
|
|
|
|
PostUserEvent( nEventId,
|
|
|
|
STATIC_LINK( NULL, Application, PostEventHandler ),
|
|
|
|
pPostEventData );
|
|
|
|
|
|
|
|
if( nEventId )
|
|
|
|
{
|
|
|
|
pPostEventData->mnEventId = nEventId;
|
|
|
|
aPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
delete pPostEventData;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nEventId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
ULONG Application::PostMouseEvent( ULONG nEvent, Window *pWin, MouseEvent* pMouseEvent )
|
|
|
|
{
|
|
|
|
const ::vos::OGuard aGuard( GetSolarMutex() );
|
|
|
|
ULONG nEventId = 0;
|
|
|
|
|
|
|
|
if( pWin && pMouseEvent )
|
|
|
|
{
|
|
|
|
Point aTransformedPos( pMouseEvent->GetPosPixel() );
|
|
|
|
|
|
|
|
aTransformedPos.X() += pWin->mnOutOffX;
|
|
|
|
aTransformedPos.Y() += pWin->mnOutOffY;
|
|
|
|
|
|
|
|
const MouseEvent aTransformedEvent( aTransformedPos, pMouseEvent->GetClicks(), pMouseEvent->GetMode(),
|
|
|
|
pMouseEvent->GetButtons(), pMouseEvent->GetModifier() );
|
|
|
|
|
|
|
|
ImplPostEventData* pPostEventData = new ImplPostEventData( nEvent, pWin, aTransformedEvent );
|
|
|
|
|
|
|
|
PostUserEvent( nEventId,
|
|
|
|
STATIC_LINK( NULL, Application, PostEventHandler ),
|
|
|
|
pPostEventData );
|
|
|
|
|
|
|
|
if( nEventId )
|
|
|
|
{
|
|
|
|
pPostEventData->mnEventId = nEventId;
|
|
|
|
aPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
delete pPostEventData;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nEventId;
|
|
|
|
}
|
2002-10-09 10:27:24 +00:00
|
|
|
|
2004-08-12 09:46:07 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2006-06-19 18:14:25 +00:00
|
|
|
IMPL_STATIC_LINK_NOINSTANCE( Application, PostEventHandler, void*, pCallData )
|
2002-10-09 10:27:24 +00:00
|
|
|
{
|
2004-08-12 09:46:07 +00:00
|
|
|
const ::vos::OGuard aGuard( GetSolarMutex() );
|
|
|
|
ImplPostEventData* pData = static_cast< ImplPostEventData * >( pCallData );
|
|
|
|
const void* pEventData;
|
|
|
|
ULONG nEvent;
|
|
|
|
const ULONG nEventId = pData->mnEventId;
|
|
|
|
|
|
|
|
switch( pData->mnEvent )
|
2002-10-09 10:27:24 +00:00
|
|
|
{
|
2004-08-12 09:46:07 +00:00
|
|
|
case VCLEVENT_WINDOW_MOUSEMOVE:
|
|
|
|
nEvent = SALEVENT_EXTERNALMOUSEMOVE;
|
|
|
|
pEventData = &pData->maMouseEvent;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
|
|
|
|
nEvent = SALEVENT_EXTERNALMOUSEBUTTONDOWN;
|
|
|
|
pEventData = &pData->maMouseEvent;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VCLEVENT_WINDOW_MOUSEBUTTONUP:
|
|
|
|
nEvent = SALEVENT_EXTERNALMOUSEBUTTONUP;
|
|
|
|
pEventData = &pData->maMouseEvent;
|
|
|
|
break;
|
|
|
|
|
2002-10-09 10:27:24 +00:00
|
|
|
case VCLEVENT_WINDOW_KEYINPUT:
|
|
|
|
nEvent = SALEVENT_EXTERNALKEYINPUT;
|
2004-08-12 09:46:07 +00:00
|
|
|
pEventData = &pData->maKeyEvent;
|
|
|
|
break;
|
|
|
|
|
2002-10-09 10:27:24 +00:00
|
|
|
case VCLEVENT_WINDOW_KEYUP:
|
|
|
|
nEvent = SALEVENT_EXTERNALKEYUP;
|
2004-08-12 09:46:07 +00:00
|
|
|
pEventData = &pData->maKeyEvent;
|
|
|
|
break;
|
|
|
|
|
2002-10-09 10:27:24 +00:00
|
|
|
default:
|
2004-08-12 09:46:07 +00:00
|
|
|
nEvent = 0;
|
|
|
|
pEventData = NULL;
|
|
|
|
break;
|
2002-10-09 10:27:24 +00:00
|
|
|
};
|
2004-08-12 09:46:07 +00:00
|
|
|
|
2005-01-13 17:38:27 +00:00
|
|
|
if( pData->mpWin && pData->mpWin->mpWindowImpl->mpFrameWindow && pEventData )
|
|
|
|
ImplWindowFrameProc( (void*) pData->mpWin->mpWindowImpl->mpFrameWindow, NULL, (USHORT) nEvent, pEventData );
|
2004-08-12 09:46:07 +00:00
|
|
|
|
|
|
|
// remove this event from list of posted events, watch for destruction of internal data
|
|
|
|
::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() );
|
|
|
|
|
|
|
|
while( aIter != aPostedEventList.end() )
|
|
|
|
{
|
|
|
|
if( nEventId == (*aIter).second->mnEventId )
|
|
|
|
{
|
|
|
|
delete (*aIter).second;
|
|
|
|
aIter = aPostedEventList.erase( aIter );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
++aIter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::RemoveMouseAndKeyEvents( Window* pWin )
|
|
|
|
{
|
|
|
|
const ::vos::OGuard aGuard( GetSolarMutex() );
|
|
|
|
|
|
|
|
// remove all events for specific window, watch for destruction of internal data
|
|
|
|
::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() );
|
|
|
|
|
|
|
|
while( aIter != aPostedEventList.end() )
|
|
|
|
{
|
|
|
|
if( pWin == (*aIter).first )
|
|
|
|
{
|
|
|
|
if( (*aIter).second->mnEventId )
|
|
|
|
RemoveUserEvent( (*aIter).second->mnEventId );
|
|
|
|
|
|
|
|
delete (*aIter).second;
|
|
|
|
aIter = aPostedEventList.erase( aIter );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
++aIter;
|
|
|
|
}
|
2002-10-09 10:27:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
2002-07-01 06:39:55 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
ULONG Application::PostUserEvent( ULONG nEvent, void* pEventData )
|
|
|
|
{
|
|
|
|
ULONG nEventId;
|
|
|
|
PostUserEvent( nEventId, nEvent, pEventData );
|
|
|
|
return nEventId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
ULONG Application::PostUserEvent( const Link& rLink, void* pCaller )
|
|
|
|
{
|
|
|
|
ULONG nEventId;
|
|
|
|
PostUserEvent( nEventId, rLink, pCaller );
|
|
|
|
return nEventId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::PostUserEvent( ULONG& rEventId, ULONG nEvent, void* pEventData )
|
|
|
|
{
|
|
|
|
ImplSVEvent* pSVEvent = new ImplSVEvent;
|
|
|
|
pSVEvent->mnEvent = nEvent;
|
|
|
|
pSVEvent->mpData = pEventData;
|
|
|
|
pSVEvent->mpLink = NULL;
|
|
|
|
pSVEvent->mpWindow = NULL;
|
|
|
|
pSVEvent->mbCall = TRUE;
|
|
|
|
rEventId = (ULONG)pSVEvent;
|
2006-05-18 09:08:08 +00:00
|
|
|
Window* pDefWindow = ImplGetDefaultWindow();
|
|
|
|
if ( pDefWindow && pDefWindow->ImplGetFrame()->PostEvent( pSVEvent ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rEventId = 0;
|
|
|
|
delete pSVEvent;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::PostUserEvent( ULONG& rEventId, const Link& rLink, void* pCaller )
|
|
|
|
{
|
|
|
|
ImplSVEvent* pSVEvent = new ImplSVEvent;
|
|
|
|
pSVEvent->mnEvent = 0;
|
|
|
|
pSVEvent->mpData = pCaller;
|
|
|
|
pSVEvent->mpLink = new Link( rLink );
|
|
|
|
pSVEvent->mpWindow = NULL;
|
|
|
|
pSVEvent->mbCall = TRUE;
|
|
|
|
rEventId = (ULONG)pSVEvent;
|
2006-05-18 09:08:08 +00:00
|
|
|
Window* pDefWindow = ImplGetDefaultWindow();
|
|
|
|
if ( pDefWindow && pDefWindow->ImplGetFrame()->PostEvent( pSVEvent ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rEventId = 0;
|
|
|
|
delete pSVEvent;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::RemoveUserEvent( ULONG nUserEvent )
|
|
|
|
{
|
2004-03-19 11:51:05 +00:00
|
|
|
if(nUserEvent)
|
|
|
|
{
|
|
|
|
ImplSVEvent* pSVEvent = (ImplSVEvent*)nUserEvent;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-03-19 11:51:05 +00:00
|
|
|
DBG_ASSERT( !pSVEvent->mpWindow,
|
|
|
|
"Application::RemoveUserEvent(): Event is send to a window" );
|
|
|
|
DBG_ASSERT( pSVEvent->mbCall,
|
|
|
|
"Application::RemoveUserEvent(): Event is already removed" );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-03-19 11:51:05 +00:00
|
|
|
if ( pSVEvent->mpWindow )
|
|
|
|
{
|
2006-08-11 16:43:55 +00:00
|
|
|
if( ! pSVEvent->maDelData.IsDelete() )
|
|
|
|
pSVEvent->mpWindow->ImplRemoveDel( &(pSVEvent->maDelData) );
|
2004-03-19 11:51:05 +00:00
|
|
|
pSVEvent->mpWindow = NULL;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-03-19 11:51:05 +00:00
|
|
|
pSVEvent->mbCall = FALSE;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::InsertIdleHdl( const Link& rLink, USHORT nPrio )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
// Falls er noch nicht existiert, dann anlegen
|
|
|
|
if ( !pSVData->maAppData.mpIdleMgr )
|
|
|
|
pSVData->maAppData.mpIdleMgr = new ImplIdleMgr;
|
|
|
|
|
|
|
|
return pSVData->maAppData.mpIdleMgr->InsertIdleHdl( rLink, nPrio );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::RemoveIdleHdl( const Link& rLink )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpIdleMgr )
|
|
|
|
pSVData->maAppData.mpIdleMgr->RemoveIdleHdl( rLink );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
WorkWindow* Application::GetAppWindow()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maWinData.mpAppWin;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Window* Application::GetFocusWindow()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maWinData.mpFocusWin;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
OutputDevice* Application::GetDefaultDevice()
|
|
|
|
{
|
|
|
|
return ImplGetDefaultWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Window* Application::GetFirstTopLevelWindow()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
return pSVData->maWinData.mpFirstFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Window* Application::GetNextTopLevelWindow( Window* pWindow )
|
|
|
|
{
|
2005-01-13 17:38:27 +00:00
|
|
|
return pWindow->mpWindowImpl->mpFrameData->mpNextFrame;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2002-07-18 07:04:31 +00:00
|
|
|
long Application::GetTopWindowCount()
|
|
|
|
{
|
|
|
|
long nRet = 0;
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2006-05-05 09:51:27 +00:00
|
|
|
Window *pWin = pSVData ? pSVData->maWinData.mpFirstFrame : NULL;
|
2002-07-18 07:04:31 +00:00
|
|
|
while( pWin )
|
|
|
|
{
|
2002-08-13 13:04:46 +00:00
|
|
|
if( pWin->ImplGetWindow()->IsTopWindow() )
|
2002-07-18 07:04:31 +00:00
|
|
|
nRet++;
|
2005-01-13 17:38:27 +00:00
|
|
|
pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame;
|
2002-07-18 07:04:31 +00:00
|
|
|
}
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Window* Application::GetTopWindow( long nIndex )
|
|
|
|
{
|
|
|
|
long nIdx = 0;
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2006-05-05 09:51:27 +00:00
|
|
|
Window *pWin = pSVData ? pSVData->maWinData.mpFirstFrame : NULL;
|
2002-07-18 07:04:31 +00:00
|
|
|
while( pWin )
|
|
|
|
{
|
2002-08-13 13:04:46 +00:00
|
|
|
if( pWin->ImplGetWindow()->IsTopWindow() )
|
2002-07-18 07:04:31 +00:00
|
|
|
if( nIdx == nIndex )
|
2002-08-13 13:04:46 +00:00
|
|
|
return pWin->ImplGetWindow();
|
2002-07-18 07:04:31 +00:00
|
|
|
else
|
|
|
|
nIdx++;
|
2005-01-13 17:38:27 +00:00
|
|
|
pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame;
|
2002-07-18 07:04:31 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Window* Application::GetActiveTopWindow()
|
|
|
|
{
|
|
|
|
Window *pWin = ImplGetSVData()->maWinData.mpFocusWin;
|
|
|
|
while( pWin )
|
|
|
|
{
|
|
|
|
if( pWin->IsTopWindow() )
|
|
|
|
return pWin;
|
2005-01-13 17:38:27 +00:00
|
|
|
pWin = pWin->mpWindowImpl->mpParent;
|
2002-07-18 07:04:31 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Application::SetAppName( const XubString& rUniqueName )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
// Falls er noch nicht existiert, dann anlegen
|
|
|
|
if ( !pSVData->maAppData.mpAppName )
|
|
|
|
pSVData->maAppData.mpAppName = new XubString( rUniqueName );
|
|
|
|
else
|
|
|
|
*(pSVData->maAppData.mpAppName) = rUniqueName;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
XubString Application::GetAppName()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( pSVData->maAppData.mpAppName )
|
|
|
|
return *(pSVData->maAppData.mpAppName);
|
|
|
|
else
|
|
|
|
return ImplGetSVEmptyStr();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::SetDisplayName( const UniString& rName )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
// Falls er noch nicht existiert, dann anlegen
|
|
|
|
if ( !pSVData->maAppData.mpDisplayName )
|
|
|
|
pSVData->maAppData.mpDisplayName = new UniString( rName );
|
|
|
|
else
|
|
|
|
*(pSVData->maAppData.mpDisplayName) = rName;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
UniString Application::GetDisplayName()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( pSVData->maAppData.mpDisplayName )
|
|
|
|
return *(pSVData->maAppData.mpDisplayName);
|
|
|
|
else if ( pSVData->maWinData.mpAppWin )
|
|
|
|
return pSVData->maWinData.mpAppWin->GetText();
|
|
|
|
else
|
|
|
|
return ImplGetSVEmptyStr();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-07-26 08:11:18 +00:00
|
|
|
unsigned int Application::GetScreenCount()
|
|
|
|
{
|
|
|
|
SalSystem* pSys = ImplGetSalSystem();
|
|
|
|
return pSys ? pSys->GetDisplayScreenCount() : 0;
|
|
|
|
}
|
|
|
|
|
2007-01-25 10:22:53 +00:00
|
|
|
rtl::OUString Application::GetScreenName( unsigned int nScreen )
|
|
|
|
{
|
|
|
|
SalSystem* pSys = ImplGetSalSystem();
|
|
|
|
return pSys ? pSys->GetScreenName( nScreen ) : rtl::OUString();
|
|
|
|
}
|
|
|
|
|
2006-10-06 08:58:12 +00:00
|
|
|
bool Application::IsMultiDisplay()
|
|
|
|
{
|
|
|
|
SalSystem* pSys = ImplGetSalSystem();
|
|
|
|
return pSys ? pSys->IsMultiDisplay() : false;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int Application::GetDefaultDisplayNumber()
|
|
|
|
{
|
|
|
|
SalSystem* pSys = ImplGetSalSystem();
|
|
|
|
return pSys ? pSys->GetDefaultDisplayNumber() : 0;
|
|
|
|
}
|
|
|
|
|
2006-07-26 08:11:18 +00:00
|
|
|
Rectangle Application::GetScreenPosSizePixel( unsigned int nScreen )
|
|
|
|
{
|
|
|
|
SalSystem* pSys = ImplGetSalSystem();
|
|
|
|
return pSys ? pSys->GetDisplayScreenPosSizePixel( nScreen ) : Rectangle();
|
|
|
|
}
|
|
|
|
|
2006-10-06 08:58:12 +00:00
|
|
|
Rectangle Application::GetWorkAreaPosSizePixel( unsigned int nScreen )
|
|
|
|
{
|
|
|
|
SalSystem* pSys = ImplGetSalSystem();
|
|
|
|
return pSys ? pSys->GetDisplayWorkAreaPosSizePixel( nScreen ) : Rectangle();
|
|
|
|
}
|
|
|
|
|
2006-07-26 08:11:18 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
BOOL Application::InsertAccel( Accelerator* pAccel )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
if ( !pSVData->maAppData.mpAccelMgr )
|
|
|
|
pSVData->maAppData.mpAccelMgr = new ImplAccelManager();
|
|
|
|
return pSVData->maAppData.mpAccelMgr->InsertAccel( pAccel );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::RemoveAccel( Accelerator* pAccel )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpAccelMgr )
|
|
|
|
pSVData->maAppData.mpAccelMgr->RemoveAccel( pAccel );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::FlushAccel()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpAccelMgr )
|
|
|
|
pSVData->maAppData.mpAccelMgr->FlushAccel();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2001-08-28 13:34:31 +00:00
|
|
|
BOOL Application::CallAccel( const KeyCode& rKeyCode, USHORT nRepeat )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpAccelMgr )
|
|
|
|
{
|
|
|
|
if ( pSVData->maAppData.mpAccelMgr->IsAccelKey( rKeyCode, nRepeat ) )
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Application::SetHelp( Help* pHelp )
|
|
|
|
{
|
|
|
|
ImplGetSVData()->maAppData.mpHelp = pHelp;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Help* Application::GetHelp()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.mpHelp;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::EnableAutoHelpId( BOOL bEnabled )
|
|
|
|
{
|
|
|
|
ImplGetSVData()->maHelpData.mbAutoHelpId = bEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::IsAutoHelpIdEnabled()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maHelpData.mbAutoHelpId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::EnableAutoMnemonic( BOOL bEnabled )
|
|
|
|
{
|
2002-10-18 12:58:20 +00:00
|
|
|
AllSettings aSettings = GetSettings();
|
|
|
|
StyleSettings aStyle = aSettings.GetStyleSettings();
|
|
|
|
aStyle.SetAutoMnemonic( bEnabled );
|
|
|
|
aSettings.SetStyleSettings( aStyle );
|
|
|
|
SetSettings( aSettings );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::IsAutoMnemonicEnabled()
|
|
|
|
{
|
2002-10-18 12:58:20 +00:00
|
|
|
return GetSettings().GetStyleSettings().GetAutoMnemonic();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::SetDialogScaleX( short nScale )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
pSVData->maAppData.mnDialogScaleX = nScale;
|
|
|
|
pSVData->maGDIData.mnAppFontX = pSVData->maGDIData.mnRealAppFontX;
|
|
|
|
if ( nScale )
|
|
|
|
pSVData->maGDIData.mnAppFontX += (pSVData->maGDIData.mnAppFontX*nScale)/100;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
short Application::GetDialogScaleX()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.mnDialogScaleX;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::SetDefDialogParent( Window* pWindow )
|
|
|
|
{
|
|
|
|
ImplGetSVData()->maWinData.mpDefDialogParent = pWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Window* Application::GetDefDialogParent()
|
|
|
|
{
|
2002-10-22 08:39:05 +00:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
// #103442# find some useful dialog parent if there
|
|
|
|
// was no default set
|
|
|
|
// NOTE: currently even the default is not used
|
|
|
|
if( FALSE && pSVData->maWinData.mpDefDialogParent != NULL )
|
|
|
|
return pSVData->maWinData.mpDefDialogParent;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// always use the topmost parent of the candidate
|
|
|
|
// window to avoid using dialogs or floaters
|
|
|
|
// as DefDialogParent
|
|
|
|
|
|
|
|
// current focus frame
|
|
|
|
Window *pWin = NULL;
|
2006-05-05 07:59:51 +00:00
|
|
|
if( (pWin = pSVData->maWinData.mpFocusWin) != NULL )
|
2002-10-22 08:39:05 +00:00
|
|
|
{
|
2005-11-01 11:58:43 +00:00
|
|
|
while( pWin->mpWindowImpl && pWin->mpWindowImpl->mpParent )
|
2005-01-13 17:38:27 +00:00
|
|
|
pWin = pWin->mpWindowImpl->mpParent;
|
2005-11-01 11:58:43 +00:00
|
|
|
|
2006-05-05 07:59:51 +00:00
|
|
|
if( (pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0 )
|
2005-11-01 11:58:43 +00:00
|
|
|
{
|
2006-05-05 07:59:51 +00:00
|
|
|
// check for corrupted window hierarchy, #122232#, may be we now crash somewhere else
|
|
|
|
if( !pWin->mpWindowImpl )
|
|
|
|
{
|
|
|
|
DBG_ERROR( "Window hierarchy corrupted!" );
|
|
|
|
pSVData->maWinData.mpFocusWin = NULL; // avoid further access
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-11-01 11:58:43 +00:00
|
|
|
|
2006-05-05 07:59:51 +00:00
|
|
|
// MAV: before the implementation has used only decorated windows,
|
|
|
|
// but it is not true in case of ActiveX or plugin scenario,
|
|
|
|
// so this check is commented out
|
|
|
|
// if( pWin->mpWindowImpl->mpFrameWindow->GetStyle() & (WB_MOVEABLE | WB_SIZEABLE) )
|
|
|
|
return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
|
|
|
|
// else
|
|
|
|
// return NULL;
|
|
|
|
}
|
2002-10-22 08:39:05 +00:00
|
|
|
}
|
2003-04-11 16:27:47 +00:00
|
|
|
// last active application frame
|
2006-06-19 18:14:25 +00:00
|
|
|
if( NULL != (pWin = pSVData->maWinData.mpActiveApplicationFrame) )
|
2003-04-11 16:27:47 +00:00
|
|
|
{
|
2005-01-13 17:38:27 +00:00
|
|
|
return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
|
2003-04-11 16:27:47 +00:00
|
|
|
}
|
2002-10-22 08:39:05 +00:00
|
|
|
else
|
|
|
|
{
|
2003-04-11 16:27:47 +00:00
|
|
|
// first visible top window (may be totally wrong....)
|
2002-10-22 08:39:05 +00:00
|
|
|
pWin = pSVData->maWinData.mpFirstFrame;
|
|
|
|
while( pWin )
|
|
|
|
{
|
2006-05-05 07:59:51 +00:00
|
|
|
if( pWin->ImplGetWindow()->IsTopWindow() &&
|
|
|
|
pWin->mpWindowImpl->mbReallyVisible &&
|
|
|
|
(pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0
|
|
|
|
)
|
2002-10-22 08:39:05 +00:00
|
|
|
{
|
2005-01-13 17:38:27 +00:00
|
|
|
while( pWin->mpWindowImpl->mpParent )
|
|
|
|
pWin = pWin->mpWindowImpl->mpParent;
|
|
|
|
return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
|
2002-10-22 08:39:05 +00:00
|
|
|
}
|
2005-01-13 17:38:27 +00:00
|
|
|
pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame;
|
2002-10-22 08:39:05 +00:00
|
|
|
}
|
|
|
|
// use the desktop
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::EnableDialogCancel( BOOL bDialogCancel )
|
|
|
|
{
|
|
|
|
ImplGetSVData()->maAppData.mbDialogCancel = bDialogCancel;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::IsDialogCancelEnabled()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.mbDialogCancel;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::SetSystemWindowMode( USHORT nMode )
|
|
|
|
{
|
|
|
|
ImplGetSVData()->maAppData.mnSysWinMode = nMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
USHORT Application::GetSystemWindowMode()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.mnSysWinMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-11-16 13:11:37 +00:00
|
|
|
const String& Application::GetFontPath()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( !pSVData->maAppData.mpFontPath )
|
|
|
|
{
|
|
|
|
if( const char* pFontPath = ::getenv( "SAL_FONTPATH_PRIVATE" ) )
|
|
|
|
pSVData->maAppData.mpFontPath = new String( String::CreateFromAscii( pFontPath ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pSVData->maAppData.mpFontPath )
|
|
|
|
return *(pSVData->maAppData.mpFontPath);
|
|
|
|
return ImplGetSVEmptyStr();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::SetFontPath( const String& rPath )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
// if it doesn't exist create a new one
|
|
|
|
if( !pSVData->maAppData.mpFontPath )
|
|
|
|
pSVData->maAppData.mpFontPath = new String( rPath );
|
|
|
|
else
|
|
|
|
*(pSVData->maAppData.mpFontPath) = rPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
UniqueItemId Application::CreateUniqueId()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
if ( !pSVData->maAppData.mpUniqueIdCont )
|
|
|
|
pSVData->maAppData.mpUniqueIdCont = new UniqueIdContainer( UNIQUEID_SV_BEGIN );
|
|
|
|
return pSVData->maAppData.mpUniqueIdCont->CreateId();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > Application::GetVCLToolkit()
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > xT;
|
2001-03-15 10:33:48 +00:00
|
|
|
UnoWrapperBase* pWrapper = Application::GetUnoWrapper( TRUE );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pWrapper )
|
|
|
|
xT = pWrapper->GetVCLToolkit();
|
|
|
|
return xT;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2001-03-15 10:33:48 +00:00
|
|
|
UnoWrapperBase* Application::GetUnoWrapper( BOOL bCreateIfNotExist )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-15 10:33:48 +00:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
static BOOL bAlreadyTriedToCreate = FALSE;
|
|
|
|
if ( !pSVData->mpUnoWrapper && bCreateIfNotExist && !bAlreadyTriedToCreate )
|
|
|
|
{
|
|
|
|
::rtl::OUString aLibName = ::vcl::unohelper::CreateLibraryName( "tk", TRUE );
|
|
|
|
oslModule hTkLib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_DEFAULT );
|
|
|
|
if ( hTkLib )
|
|
|
|
{
|
|
|
|
::rtl::OUString aFunctionName( RTL_CONSTASCII_USTRINGPARAM( "CreateUnoWrapper" ) );
|
2006-06-19 18:14:25 +00:00
|
|
|
FN_TkCreateUnoWrapper fnCreateWrapper = (FN_TkCreateUnoWrapper)osl_getFunctionSymbol( hTkLib, aFunctionName.pData );
|
2001-03-15 10:33:48 +00:00
|
|
|
if ( fnCreateWrapper )
|
|
|
|
{
|
|
|
|
pSVData->mpUnoWrapper = fnCreateWrapper();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DBG_ASSERT( pSVData->mpUnoWrapper, "UnoWrapper could not be created!" );
|
|
|
|
bAlreadyTriedToCreate = TRUE;
|
|
|
|
}
|
|
|
|
return pSVData->mpUnoWrapper;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::SetUnoWrapper( UnoWrapperBase* pWrapper )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
DBG_ASSERT( !pSVData->mpUnoWrapper, "SetUnoWrapper: Wrapper allready exists" );
|
|
|
|
pSVData->mpUnoWrapper = pWrapper;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2001-02-01 13:08:06 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayConnection > Application::GetDisplayConnection()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2006-10-13 07:30:41 +00:00
|
|
|
|
|
|
|
if( !pSVData->mxDisplayConnection.is() )
|
|
|
|
pSVData->mxDisplayConnection.set( new ::vcl::DisplayConnection );
|
|
|
|
|
|
|
|
return pSVData->mxDisplayConnection;
|
2001-02-01 13:08:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Application::SetFilterHdl( const Link& rLink )
|
|
|
|
{
|
|
|
|
ImplGetSVData()->maGDIData.mpGrfConverter->SetFilterHdl( rLink );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
const Link& Application::GetFilterHdl()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maGDIData.mpGrfConverter->GetFilterHdl();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL ImplCallHotKey( const KeyCode& rKeyCode )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
ImplHotKey* pHotKeyData = pSVData->maAppData.mpFirstHotKey;
|
|
|
|
while ( pHotKeyData )
|
|
|
|
{
|
|
|
|
if ( pHotKeyData->maKeyCode.IsDefinedKeyCodeEqual( rKeyCode ) )
|
|
|
|
{
|
|
|
|
pHotKeyData->maLink.Call( pHotKeyData->mpUserData );
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
pHotKeyData = pHotKeyData->mpNext;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ImplFreeHotKeyData()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
ImplHotKey* pTempHotKeyData;
|
|
|
|
ImplHotKey* pHotKeyData = pSVData->maAppData.mpFirstHotKey;
|
|
|
|
while ( pHotKeyData )
|
|
|
|
{
|
|
|
|
pTempHotKeyData = pHotKeyData->mpNext;
|
|
|
|
delete pHotKeyData;
|
|
|
|
pHotKeyData = pTempHotKeyData;
|
|
|
|
}
|
|
|
|
|
|
|
|
pSVData->maAppData.mpFirstHotKey = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
ULONG Application::AddHotKey( const KeyCode& rKeyCode, const Link& rLink, void* pData )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
ImplHotKey* pHotKeyData = new ImplHotKey;
|
|
|
|
pHotKeyData->mpUserData = pData;
|
|
|
|
pHotKeyData->maKeyCode = rKeyCode;
|
|
|
|
pHotKeyData->maLink = rLink;
|
|
|
|
pHotKeyData->mpNext = pSVData->maAppData.mpFirstHotKey;
|
|
|
|
pSVData->maAppData.mpFirstHotKey = pHotKeyData;
|
|
|
|
return (ULONG)pHotKeyData;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::RemoveHotKey( ULONG nId )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
ImplHotKey* pFindHotKeyData = (ImplHotKey*)nId;
|
|
|
|
ImplHotKey* pPrevHotKeyData = NULL;
|
|
|
|
ImplHotKey* pHotKeyData = pSVData->maAppData.mpFirstHotKey;
|
|
|
|
while ( pHotKeyData )
|
|
|
|
{
|
|
|
|
if ( pHotKeyData == pFindHotKeyData )
|
|
|
|
{
|
|
|
|
if ( pPrevHotKeyData )
|
|
|
|
pPrevHotKeyData->mpNext = pFindHotKeyData->mpNext;
|
|
|
|
else
|
|
|
|
pSVData->maAppData.mpFirstHotKey = pFindHotKeyData->mpNext;
|
|
|
|
delete pFindHotKeyData;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
pPrevHotKeyData = pHotKeyData;
|
|
|
|
pHotKeyData = pHotKeyData->mpNext;
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG_ASSERT( pHotKeyData, "Application::RemoveHotKey() - HotKey is not added" );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ImplFreeEventHookData()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
ImplEventHook* pTempEventHookData;
|
|
|
|
ImplEventHook* pEventHookData = pSVData->maAppData.mpFirstEventHook;
|
|
|
|
while ( pEventHookData )
|
|
|
|
{
|
|
|
|
pTempEventHookData = pEventHookData->mpNext;
|
|
|
|
delete pEventHookData;
|
|
|
|
pEventHookData = pTempEventHookData;
|
|
|
|
}
|
|
|
|
|
|
|
|
pSVData->maAppData.mpFirstEventHook = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
ULONG Application::AddEventHook( VCLEventHookProc pProc, void* pData )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
ImplEventHook* pEventHookData = new ImplEventHook;
|
|
|
|
pEventHookData->mpUserData = pData;
|
|
|
|
pEventHookData->mpProc = pProc;
|
|
|
|
pEventHookData->mpNext = pSVData->maAppData.mpFirstEventHook;
|
|
|
|
pSVData->maAppData.mpFirstEventHook = pEventHookData;
|
|
|
|
return (ULONG)pEventHookData;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::RemoveEventHook( ULONG nId )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
ImplEventHook* pFindEventHookData = (ImplEventHook*)nId;
|
|
|
|
ImplEventHook* pPrevEventHookData = NULL;
|
|
|
|
ImplEventHook* pEventHookData = pSVData->maAppData.mpFirstEventHook;
|
|
|
|
while ( pEventHookData )
|
|
|
|
{
|
|
|
|
if ( pEventHookData == pFindEventHookData )
|
|
|
|
{
|
|
|
|
if ( pPrevEventHookData )
|
|
|
|
pPrevEventHookData->mpNext = pFindEventHookData->mpNext;
|
|
|
|
else
|
|
|
|
pSVData->maAppData.mpFirstEventHook = pFindEventHookData->mpNext;
|
|
|
|
delete pFindEventHookData;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
pPrevEventHookData = pEventHookData;
|
|
|
|
pEventHookData = pEventHookData->mpNext;
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG_ASSERT( pEventHookData, "Application::RemoveEventHook() - EventHook is not added" );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
long Application::CallEventHooks( NotifyEvent& rEvt )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
long nRet = 0;
|
|
|
|
ImplEventHook* pTempEventHookData;
|
|
|
|
ImplEventHook* pEventHookData = pSVData->maAppData.mpFirstEventHook;
|
|
|
|
while ( pEventHookData )
|
|
|
|
{
|
|
|
|
pTempEventHookData = pEventHookData->mpNext;
|
|
|
|
nRet = pEventHookData->mpProc( rEvt, pEventHookData->mpUserData );
|
|
|
|
if ( nRet )
|
|
|
|
break;
|
|
|
|
pEventHookData = pTempEventHookData;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
long Application::CallPreNotify( NotifyEvent& rEvt )
|
|
|
|
{
|
|
|
|
return ImplCallPreNotify( rEvt );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
long Application::CallEvent( NotifyEvent& rEvt )
|
|
|
|
{
|
|
|
|
return ImplCallEvent( rEvt );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-04-07 14:29:41 +00:00
|
|
|
const LocaleDataWrapper& Application::GetAppLocaleDataWrapper()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-04-07 14:29:41 +00:00
|
|
|
return GetSettings().GetLocaleDataWrapper();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2000-10-23 05:44:59 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Application::EnableHeadlessMode( BOOL bEnable )
|
|
|
|
{
|
|
|
|
EnableDialogCancel( bEnable );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
BOOL Application::IsHeadlessModeEnabled()
|
|
|
|
{
|
|
|
|
return IsDialogCancelEnabled();
|
|
|
|
}
|
|
|
|
|
2001-07-06 13:35:36 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2002-11-26 14:37:09 +00:00
|
|
|
bool Application::CanToggleImeStatusWindow()
|
2001-11-27 08:49:18 +00:00
|
|
|
{
|
2003-11-18 13:31:58 +00:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( ! pSVData->mpImeStatus )
|
|
|
|
pSVData->mpImeStatus = pSVData->mpDefInst->CreateI18NImeStatus();
|
|
|
|
return pSVData->mpImeStatus->canToggle();
|
2002-11-26 14:37:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Application::ShowImeStatusWindow(bool bShow)
|
|
|
|
{
|
|
|
|
ImplGetSVData()->maAppData.meShowImeStatusWindow = bShow
|
|
|
|
? ImplSVAppData::ImeStatusWindowMode_SHOW
|
|
|
|
: ImplSVAppData::ImeStatusWindowMode_HIDE;
|
2003-11-18 13:31:58 +00:00
|
|
|
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( ! pSVData->mpImeStatus )
|
|
|
|
pSVData->mpImeStatus = pSVData->mpDefInst->CreateI18NImeStatus();
|
|
|
|
pSVData->mpImeStatus->toggle();
|
2001-11-27 08:49:18 +00:00
|
|
|
}
|
|
|
|
|
2002-11-26 14:37:09 +00:00
|
|
|
bool Application::GetShowImeStatusWindowDefault()
|
|
|
|
{
|
|
|
|
rtl_TextEncodingInfo aInfo;
|
|
|
|
aInfo.StructSize = sizeof aInfo;
|
|
|
|
return rtl_getTextEncodingInfo(osl_getThreadTextEncoding(), &aInfo)
|
|
|
|
&& aInfo.MaximumCharSize > 1;
|
|
|
|
}
|
2001-11-27 08:49:18 +00:00
|
|
|
|
2004-05-10 11:57:57 +00:00
|
|
|
const ::rtl::OUString& Application::GetDesktopEnvironment()
|
|
|
|
{
|
|
|
|
return SalGetDesktopEnvironment();
|
|
|
|
}
|
|
|
|
|
2002-11-26 14:37:09 +00:00
|
|
|
BOOL Application::IsAccessibilityEnabled()
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-04-11 16:27:47 +00:00
|
|
|
|
|
|
|
BOOL InitAccessBridge( BOOL bShowCancel, BOOL &rCancelled )
|
|
|
|
{
|
2006-05-05 09:51:27 +00:00
|
|
|
BOOL bRet = true;
|
2003-04-11 16:27:47 +00:00
|
|
|
|
2006-05-05 09:51:27 +00:00
|
|
|
// Disable Java bridge on UNIX
|
2006-06-19 18:14:25 +00:00
|
|
|
#if defined UNX
|
|
|
|
(void) bShowCancel; // unsued
|
|
|
|
(void) rCancelled; // unused
|
|
|
|
#else
|
2006-05-05 09:51:27 +00:00
|
|
|
bRet = ImplInitAccessBridge( bShowCancel, rCancelled );
|
|
|
|
|
2003-04-11 16:27:47 +00:00
|
|
|
if( !bRet && bShowCancel && !rCancelled )
|
|
|
|
{
|
|
|
|
// disable accessibility if the user chooses to continue
|
|
|
|
AllSettings aSettings = Application::GetSettings();
|
|
|
|
MiscSettings aMisc = aSettings.GetMiscSettings();
|
|
|
|
aMisc.SetEnableATToolSupport( FALSE );
|
|
|
|
aSettings.SetMiscSettings( aMisc );
|
|
|
|
Application::SetSettings( aSettings );
|
|
|
|
}
|
2006-05-05 09:51:27 +00:00
|
|
|
#endif // !UNX
|
2003-04-11 16:27:47 +00:00
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
2004-01-06 12:13:36 +00:00
|
|
|
|
|
|
|
// MT: AppProperty, AppEvent was in oldsv.cxx, but is still needed...
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
|
|
|
|
TYPEINIT0(ApplicationProperty)
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static PropertyHandler* pHandler=NULL;
|
|
|
|
|
|
|
|
void Application::Property( ApplicationProperty& rProp )
|
|
|
|
{
|
|
|
|
if ( pHandler )
|
|
|
|
pHandler->Property( rProp );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::SetPropertyHandler( PropertyHandler* p )
|
|
|
|
{
|
|
|
|
if ( pHandler )
|
|
|
|
delete pHandler;
|
|
|
|
pHandler = p;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-06-19 18:14:25 +00:00
|
|
|
void Application::AppEvent( const ApplicationEvent& /*rAppEvent*/ )
|
2004-01-06 12:13:36 +00:00
|
|
|
{
|
|
|
|
}
|