merge the formfield patch from ooo-build
[ooovba.git] / desktop / win32 / source / setup / setup.hxx
blob1393fbd326e4c16abec69b62938055d979efef31
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: setup.hxx,v $
10 * $Revision: 1.12 $
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 #include "setup_main.hxx"
33 //--------------------------------------------------------------------------
35 #ifdef SetupAppX
36 #undef SetupAppX
37 #endif
39 #ifdef Create_SetupAppX
40 #undef Create_SetupAppX
41 #endif
43 #ifdef LanguageDataX
44 #undef LanguageDataX
45 #endif
48 #ifdef UNICODE
49 #define SetupAppX SetupAppW
50 #define Create_SetupAppX Create_SetupAppW
51 #define LanguageDataX LanguageDataW
52 #else
53 #define SetupAppX SetupAppA
54 #define Create_SetupAppX Create_SetupAppA
55 #define LanguageDataX LanguageDataA
56 #endif
58 //--------------------------------------------------------------------------
60 struct LanguageDataX
62 long m_nLanguageID;
63 LPTSTR m_pTransform;
65 LanguageDataX( LPTSTR pData );
66 ~LanguageDataX();
69 //--------------------------------------------------------------------------
71 class SetupAppX : public SetupApp
73 HINSTANCE m_hInst;
74 HANDLE m_hMapFile;
75 LPTSTR m_pAppTitle;
76 LPTSTR m_pCmdLine;
77 LPTSTR m_pDatabase;
78 LPTSTR m_pReqVersion;
79 LPTSTR m_pProductName;
80 LPTSTR m_pAdvertise;
81 LPTSTR m_pTmpName;
82 LPTSTR m_pErrorText;
83 LPTSTR m_pModuleFile;
84 LPTSTR m_pPatchFiles;
85 LPCTSTR m_pUpgradeKey;
86 LPCTSTR m_pProductVersion;
87 int *m_pMSIErrorCode;
89 boolean m_bQuiet : 1;
90 boolean m_bIgnoreAlreadyRunning : 1;
91 boolean m_bRegNoMsoTypes :1;
92 boolean m_bRegAllMsoTypes :1;
93 boolean m_bIsMinorUpgrade :1;
94 boolean m_bSupportsPatch :1;
96 FILE *m_pLogFile;
98 long m_nLanguageID;
99 long m_nLanguageCount;
100 LanguageDataX** m_ppLanguageList;
102 private:
104 boolean GetPathToFile( TCHAR* pFileName, TCHAR **pPath );
105 LPCTSTR GetPathToMSI();
107 int GetNameValue( TCHAR* pLine, TCHAR **pName, TCHAR **pValue );
108 boolean GetProfileSection( LPCTSTR pFileName, LPCTSTR pSection,
109 DWORD& rSize, LPTSTR *pRetBuf );
110 LPTSTR CopyIniFile( LPCTSTR pIniFile );
111 void ConvertNewline( LPTSTR pText ) const;
113 boolean LaunchInstaller( LPCTSTR pParam );
114 HMODULE LoadMsiLibrary();
115 DWORD WaitForProcess( HANDLE hHandle );
117 boolean GetCmdLineParameters( LPTSTR *pCmdLine );
118 DWORD GetNextArgument( LPCTSTR pStr, LPTSTR *pArg,
119 LPTSTR *pNext, boolean bStripQuotes = false );
120 boolean IsAdmin();
123 boolean GetCommandLine();
125 boolean IsTerminalServerInstalled() const;
126 void AddFileToPatchList( TCHAR* pPath, TCHAR* pFile );
127 boolean IsPatchInstalled( TCHAR* pBaseDir, TCHAR* pFileName );
128 public:
129 SetupAppX();
130 ~SetupAppX();
132 virtual boolean Initialize( HINSTANCE hInst );
133 virtual boolean AlreadyRunning() const;
134 virtual boolean ReadProfile();
135 virtual boolean GetPatches();
136 virtual boolean ChooseLanguage( long& rLanguage );
137 virtual boolean CheckVersion();
138 virtual boolean CheckForUpgrade();
139 virtual boolean Install( long nLanguage );
141 virtual UINT GetError() const;
142 virtual void DisplayError( UINT nErr ) const;
144 void Log( LPCTSTR pMessage, LPCTSTR pText = NULL ) const;
146 long GetLanguageCount() const { return m_nLanguageCount; }
147 long GetLanguageID( long nIndex ) const;
148 void GetLanguageName( long nLanguage, LPTSTR sName ) const;
150 LPCTSTR GetAppTitle() const { return m_pAppTitle; }
151 LPTSTR SetProdToAppTitle( LPCTSTR pProdName );
152 HINSTANCE GetHInst() const { return m_hInst; }
155 //--------------------------------------------------------------------------