/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: offmgr_appctor.cxx,v $
 *
 *  $Revision: 1.6 $
 *
 *  last change: $Author: rt $ $Date: 2006/10/27 14:09:47 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    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.
 *
 *    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.
 *
 *    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
 *
 ************************************************************************/

#ifdef PRECOMPILED
#include "ofapch.hxx"
#endif


#ifndef _MyEDITENG_HXX //autogen
#include <bf_svx/editeng.hxx>
#endif
#ifndef _SVX_DIALDLL_HXX
#include <bf_svx/dialdll.hxx>
#endif
#ifndef _BASRDLL_HXX
#include <basic/basrdll.hxx>
#endif
#ifndef _EDITDLL_HXX
#include <bf_svx/editdll.hxx>
#endif
#ifndef _SVX_ITEMDATA_HXX
#include <bf_svx/itemdata.hxx>
#endif
#ifndef _SV_EDIT_HXX
#include <vcl/edit.hxx>
#endif
#ifndef _SVX_CHARMAP_HXX
#include <bf_svx/charmap.hxx>
#endif
#ifndef _SVDETC_HXX
#include <bf_svx/svdetc.hxx>
#endif
#ifndef _SVDOUTL_HXX
#include <bf_svx/svdoutl.hxx>
#endif
#ifndef _SV_MSGBOX_HXX
#include <vcl/msgbox.hxx>
#endif
#ifndef _SVXERR_HXX
#include <bf_svx/svxerr.hxx>
#endif
#ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
#include <svtools/moduleoptions.hxx>
#endif
#include <rtl/logfile.hxx>

#pragma hdrstop

#include "app.hxx"
#include "appimp.hxx"
namespace binfilter {

#define DEFINE_CONST_UNICODE(CONSTASCII)        UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII))

static SvxDialogDll*   pSvxDLL  = NULL;
static BasicDLL*       pBasic   = NULL;
static EditDLL*        pEditDLL = NULL;
//static BasicIDEDLL*    pIdeDLL  = NULL;
static SvxGlobalItemData* pItemData = NULL;
static SvxErrorHandler* pSvxErrorHdl = NULL;

// ------------------------------------------------------------------------
//Sonderzeichen einfuegen fuer Edits

/*?*/  String GetSpecialCharsForEdit(Window* pParent, const Font& rFont)
/*?*/  {DBG_BF_ASSERT(0, "STRIP"); String sRet; return sRet;//STRIP001 
/*?*/  }

/*N*/ OfficeApplication::OfficeApplication() :
/*N*/ 
/*N*/ 	SfxApplication(),
/*N*/ 	pImpl		( NULL ),
/*N*/ 	pDataImpl   ( NULL )
/*N*/ 
/*N*/ {
/*N*/ 	RTL_LOGFILE_CONTEXT( aLog, "offmgr (cd100003) ::OfficeApplication::OfficeApplication" );
/*N*/     SetName( DEFINE_CONST_UNICODE("StarOffice") );
/*N*/ 
/*N*/     sal_uInt32 nFeatures = SvtModuleOptions().GetFeatures();
/*N*/ 	if ( nFeatures )
/*N*/ 		SetFeatures( nFeatures );
/*N*/ 
/*N*/ 	RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create OfficeAppl_Impl,OfficeData_Impl,SetResManager" );
/*N*/ 	pImpl = new OfficeAppl_Impl;
/*N*/ 	pDataImpl = new OfficeData_Impl(*this);
// #i32692# 	Resource::SetResManager( GetOffResManager() );
/*N*/ 	RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create OfficeAppl_Impl,OfficeData_Impl,SetResManager" );
/*N*/ 
/*N*/ 	RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ initialize libraries: SvxDialogDLL,BasicDLL,EditDLL,BasicIDEDLL" );
//STRIP005 /*N*/     InitLabelResMgr( "iso" );
/*N*/ 	Edit::SetGetSpecialCharsFunction(&GetSpecialCharsForEdit);
/*N*/     pSvxDLL  = new SvxDialogDll;
/*N*/     pBasic   = new BasicDLL;
/*N*/     pEditDLL = new EditDLL;
/*N*/ //    pIdeDLL  = new BasicIDEDLL;
/*N*/     pItemData = new SvxGlobalItemData;
/*N*/ 	EditEngine::SetGetAutoCorrectHdl( LINK( this, OfficeApplication, ImplGetAutoCorrect ) );
/*N*/ 	RTL_LOGFILE_CONTEXT_TRACE( aLog, "} initialize libraries: SvxDialogDLL,BasicDLL,EditDLL,BasicIDEDLL" );
/*N*/ 
/*N*/ 	SfxApplication::SetApp( this );
/*N*/ 	pSvxErrorHdl = new SvxErrorHandler();
/*N*/ }

//-------------------------------------------------------------------------

/*N*/ OfficeApplication::~OfficeApplication()
/*N*/ {
/*N*/     Deinitialize();
/*N*/ 	delete pSvxErrorHdl;
/*N*/ 	delete ( &GetSdrGlobalData() )->pOutliner;  // vor EditDLL, wegen Static-Defaults
/*N*/ 	( &GetSdrGlobalData() )->pOutliner = NULL;
/*N*/ 	delete pEditDLL;
/*N*/ 	delete pBasic;
/*N*/ //    delete pIdeDLL;
/*N*/ 	delete pSvxDLL;
/*N*/ 
// #i32692# 	Resource::SetResManager( NULL );
/*N*/ 
/*N*/ 	DeleteDataImpl();
/*N*/ 	delete pImpl->pResMgr;
/*N*/ 	delete pImpl;
/*N*/     delete pItemData;
/*N*/ }


}
