merge the formfield patch from ooo-build
[ooovba.git] / basic / source / app / apperror.cxx
blobd6bb483588bbba321f808526c38d173a910f208a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: apperror.cxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_basic.hxx"
33 #include <tools/config.hxx>
34 #include <svtools/ctrltool.hxx>
35 #ifndef _BASIC_TTRESHLP_HXX
36 #include <basic/ttstrhlp.hxx>
37 #endif
38 #include "basic.hrc"
39 #include "apperror.hxx"
41 TYPEINIT1(AppError,AppWin);
42 AppError::AppError( BasicFrame* pParent, String aFileName )
43 : AppWin( pParent )
45 SetText( aFileName ); // Call before MsgEdit!!
46 pDataEdit = new MsgEdit( this, pParent, WB_HSCROLL | WB_VSCROLL | WB_LEFT );
47 LoadIniFile();
48 bHasFile = pDataEdit->Load( aFileName );
49 DirEntry aEntry( aFileName );
50 UpdateFileInfo( HAS_BEEN_LOADED );
51 // Define icon
52 // pIcon = new Icon( ResId( RID_WORKICON ) );
53 // if( pIcon ) SetIcon( *pIcon );
55 pDataEdit->Show();
56 GrabFocus();
59 AppError::~AppError()
61 DataEdit* pTemp = pDataEdit;
62 pDataEdit = NULL;
63 delete pTemp;
66 // Set up the menu
67 long AppError::InitMenu( Menu* pMenu )
69 AppWin::InitMenu (pMenu );
71 pMenu->EnableItem( RID_EDITUNDO, FALSE );
72 pMenu->EnableItem( RID_EDITREDO, FALSE );
74 return TRUE;
77 long AppError::DeInitMenu( Menu* pMenu )
79 AppWin::DeInitMenu (pMenu );
81 pMenu->EnableItem( RID_EDITUNDO );
82 pMenu->EnableItem( RID_EDITREDO );
84 return TRUE;
87 USHORT AppError::GetLineNr(){ return pDataEdit->GetLineNr(); }
89 FileType AppError::GetFileType()
91 return FT_RESULT_FILE;
94 void AppError::LoadIniFile()
96 Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
97 aConf.SetGroup("Misc");
98 ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" );
99 aConf.SetGroup( aCurrentProfile );
100 aBaseDir = DirEntry( aConf.ReadKey("BaseDir") );
103 FontList aFontList( pFrame ); // Just some Window is needed
104 aConf.SetGroup("Misc");
105 String aFontName = String( aConf.ReadKey( "ScriptFontName", "Courier" ), RTL_TEXTENCODING_UTF8 );
106 String aFontStyle = String( aConf.ReadKey( "ScriptFontStyle", "normal" ), RTL_TEXTENCODING_UTF8 );
107 String aFontSize = String( aConf.ReadKey( "ScriptFontSize", "12" ), RTL_TEXTENCODING_UTF8 );
108 Font aFont = aFontList.Get( aFontName, aFontStyle );
109 // ULONG nFontSize = aFontSize.GetValue( FUNIT_POINT );
110 ULONG nFontSize = aFontSize.ToInt32();
111 // aFont.SetSize( Size( nFontSize, nFontSize ) );
112 aFont.SetHeight( nFontSize );
114 aFont.SetTransparent( FALSE );
115 // aFont.SetAlign( ALIGN_BOTTOM );
116 // aFont.SetHeight( aFont.GetHeight()+2 );
117 pDataEdit->SetFont( aFont );