1*2c7984eaSAndrew Rist /**************************************************************
2*2c7984eaSAndrew Rist  *
3*2c7984eaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2c7984eaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2c7984eaSAndrew Rist  * distributed with this work for additional information
6*2c7984eaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2c7984eaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2c7984eaSAndrew Rist  * "License"); you may not use this file except in compliance
9*2c7984eaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2c7984eaSAndrew Rist  *
11*2c7984eaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2c7984eaSAndrew Rist  *
13*2c7984eaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2c7984eaSAndrew Rist  * software distributed under the License is distributed on an
15*2c7984eaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2c7984eaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*2c7984eaSAndrew Rist  * specific language governing permissions and limitations
18*2c7984eaSAndrew Rist  * under the License.
19*2c7984eaSAndrew Rist  *
20*2c7984eaSAndrew Rist  *************************************************************/
21*2c7984eaSAndrew Rist 
22cdf0e10cSrcweir // Registrar.h: Schnittstelle f�r die Klasse Registrar.
23cdf0e10cSrcweir //
24cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef _REGISTRAR_HXX_
27cdf0e10cSrcweir #define _REGISTRAR_HXX_
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "registry.hxx"
30cdf0e10cSrcweir #include "registrationcontextinformation.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #ifndef _CONSTANTS_HXX_
33cdf0e10cSrcweir #include "constants.hxx"
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class Registrar
37cdf0e10cSrcweir {
38cdf0e10cSrcweir public:
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 	Registrar(const RegistrationContextInformation& RegContext);
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 	virtual ~Registrar();
43cdf0e10cSrcweir 
44cdf0e10cSrcweir     bool IsRegisteredFor(int State) const;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 	virtual void RegisterForMsWord() const;
47cdf0e10cSrcweir 	virtual void UnregisterForMsWord() const;
48cdf0e10cSrcweir     virtual bool QueryPreselectMsWordRegistration() const;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 	virtual void RegisterForMsExcel() const;
51cdf0e10cSrcweir 	virtual void UnregisterForMsExcel() const;
52cdf0e10cSrcweir     virtual bool QueryPreselectMsExcelRegistration() const;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	virtual void RegisterForMsPowerPoint() const;
55cdf0e10cSrcweir 	virtual void UnregisterForMsPowerPoint() const;
56cdf0e10cSrcweir     virtual bool QueryPreselectMsPowerPointRegistration() const;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	virtual void RegisterAsHtmlEditorForInternetExplorer() const;
59cdf0e10cSrcweir 	virtual void UnregisterAsHtmlEditorForInternetExplorer() const;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	virtual void RegisterAsDefaultHtmlEditorForInternetExplorer() const;
62cdf0e10cSrcweir 	virtual void UnregisterAsDefaultHtmlEditorForInternetExplorer() const;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	virtual void RegisterAsDefaultShellHtmlEditor() const;
65cdf0e10cSrcweir 	virtual void UnregisterAsDefaultShellHtmlEditor() const;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	/** Restore the last registration state (necessary for
68cdf0e10cSrcweir 		Setup repair)
69cdf0e10cSrcweir 	*/
70cdf0e10cSrcweir 	virtual void RepairRegistrationState() const;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     /** Unregisters all and delete all Registry keys we have written
73cdf0e10cSrcweir     */
74cdf0e10cSrcweir     virtual void UnregisterAllAndCleanUpRegistry() const;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir protected:
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     virtual void RegisterForMsOfficeApplication(
79cdf0e10cSrcweir         const std::wstring& FileExtension,
80cdf0e10cSrcweir         const std::wstring& DocumentDisplayName,
81cdf0e10cSrcweir         const std::wstring& DefaultIconEntry,
82cdf0e10cSrcweir         const std::wstring& DefaultShellCommand,
83cdf0e10cSrcweir         const std::wstring& ShellNewCommandDisplayName,
84cdf0e10cSrcweir         const RegistrationContextInformation::OFFICE_APPLICATION eOfficeApp) const;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     virtual void UnregisterForMsOfficeApplication(
87cdf0e10cSrcweir         const std::wstring& FileExtension) const;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     virtual RegistryKey GetRootKeyForDefHtmlEditorForIERegistration() const;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	void SaveRegisteredFor(int State) const;
92cdf0e10cSrcweir     void SaveNotRegisteredFor(int State) const;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     int GetRegisterState() const;
95cdf0e10cSrcweir     void SetRegisterState(int NewState) const;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     virtual bool QueryPreselectForMsApplication(const std::wstring& file_extension) const;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     /** A helper function (for readability) returns true if OpenOffice is already
100cdf0e10cSrcweir           registered for a MS application
101cdf0e10cSrcweir 
102cdf0e10cSrcweir           @param DocumentExtensionDefValue
103cdf0e10cSrcweir                       The default value of the appropriate document extension Registry key
104cdf0e10cSrcweir     */
105cdf0e10cSrcweir     bool IsOpenOfficeRegisteredForMsApplication(const std::wstring& DocumentExtensionDefValue) const;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir protected:
108cdf0e10cSrcweir 	const RegistrationContextInformation&	m_ContextInformation;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     const std::wstring FORWARD_KEY_PREFIX;
111cdf0e10cSrcweir     const std::wstring DEFAULT_VALUE_NAME;
112cdf0e10cSrcweir     const std::wstring BACKUP_VALUE_NAME;
113cdf0e10cSrcweir     const std::wstring PRIVATE_BACKUP_KEY_NAME;
114cdf0e10cSrcweir     const std::wstring REGISTRATION_STATE;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     RegistryKey	 m_RootKey;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir // prevent copy/assignment
119cdf0e10cSrcweir private:
120cdf0e10cSrcweir 	Registrar(const Registrar&);
121cdf0e10cSrcweir 	Registrar& operator=(const Registrar&);
122cdf0e10cSrcweir };
123cdf0e10cSrcweir 
124cdf0e10cSrcweir #endif
125