1 // Registrar.h: Schnittstelle f�r die Klasse Registrar.
2 //
3 //////////////////////////////////////////////////////////////////////
4 
5 #ifndef _REGISTRAR_HXX_
6 #define _REGISTRAR_HXX_
7 
8 #include "registry.hxx"
9 #include "registrationcontextinformation.hxx"
10 
11 #ifndef _CONSTANTS_HXX_
12 #include "constants.hxx"
13 #endif
14 
15 class Registrar
16 {
17 public:
18 
19 	Registrar(const RegistrationContextInformation& RegContext);
20 
21 	virtual ~Registrar();
22 
23     bool IsRegisteredFor(int State) const;
24 
25 	virtual void RegisterForMsWord() const;
26 	virtual void UnregisterForMsWord() const;
27     virtual bool QueryPreselectMsWordRegistration() const;
28 
29 	virtual void RegisterForMsExcel() const;
30 	virtual void UnregisterForMsExcel() const;
31     virtual bool QueryPreselectMsExcelRegistration() const;
32 
33 	virtual void RegisterForMsPowerPoint() const;
34 	virtual void UnregisterForMsPowerPoint() const;
35     virtual bool QueryPreselectMsPowerPointRegistration() const;
36 
37 	virtual void RegisterAsHtmlEditorForInternetExplorer() const;
38 	virtual void UnregisterAsHtmlEditorForInternetExplorer() const;
39 
40 	virtual void RegisterAsDefaultHtmlEditorForInternetExplorer() const;
41 	virtual void UnregisterAsDefaultHtmlEditorForInternetExplorer() const;
42 
43 	virtual void RegisterAsDefaultShellHtmlEditor() const;
44 	virtual void UnregisterAsDefaultShellHtmlEditor() const;
45 
46 	/** Restore the last registration state (necessary for
47 		Setup repair)
48 	*/
49 	virtual void RepairRegistrationState() const;
50 
51     /** Unregisters all and delete all Registry keys we have written
52     */
53     virtual void UnregisterAllAndCleanUpRegistry() const;
54 
55 protected:
56 
57     virtual void RegisterForMsOfficeApplication(
58         const std::wstring& FileExtension,
59         const std::wstring& DocumentDisplayName,
60         const std::wstring& DefaultIconEntry,
61         const std::wstring& DefaultShellCommand,
62         const std::wstring& ShellNewCommandDisplayName,
63         const RegistrationContextInformation::OFFICE_APPLICATION eOfficeApp) const;
64 
65     virtual void UnregisterForMsOfficeApplication(
66         const std::wstring& FileExtension) const;
67 
68     virtual RegistryKey GetRootKeyForDefHtmlEditorForIERegistration() const;
69 
70 	void SaveRegisteredFor(int State) const;
71     void SaveNotRegisteredFor(int State) const;
72 
73     int GetRegisterState() const;
74     void SetRegisterState(int NewState) const;
75 
76     virtual bool QueryPreselectForMsApplication(const std::wstring& file_extension) const;
77 
78     /** A helper function (for readability) returns true if OpenOffice is already
79           registered for a MS application
80 
81           @param DocumentExtensionDefValue
82                       The default value of the appropriate document extension Registry key
83     */
84     bool IsOpenOfficeRegisteredForMsApplication(const std::wstring& DocumentExtensionDefValue) const;
85 
86 protected:
87 	const RegistrationContextInformation&	m_ContextInformation;
88 
89     const std::wstring FORWARD_KEY_PREFIX;
90     const std::wstring DEFAULT_VALUE_NAME;
91     const std::wstring BACKUP_VALUE_NAME;
92     const std::wstring PRIVATE_BACKUP_KEY_NAME;
93     const std::wstring REGISTRATION_STATE;
94 
95     RegistryKey	 m_RootKey;
96 
97 // prevent copy/assignment
98 private:
99 	Registrar(const Registrar&);
100 	Registrar& operator=(const Registrar&);
101 };
102 
103 #endif
104