12c7984eaSAndrew Rist /************************************************************** 22c7984eaSAndrew Rist * 32c7984eaSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 42c7984eaSAndrew Rist * or more contributor license agreements. See the NOTICE file 52c7984eaSAndrew Rist * distributed with this work for additional information 62c7984eaSAndrew Rist * regarding copyright ownership. The ASF licenses this file 72c7984eaSAndrew Rist * to you under the Apache License, Version 2.0 (the 82c7984eaSAndrew Rist * "License"); you may not use this file except in compliance 92c7984eaSAndrew Rist * with the License. You may obtain a copy of the License at 102c7984eaSAndrew Rist * 112c7984eaSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 122c7984eaSAndrew Rist * 132c7984eaSAndrew Rist * Unless required by applicable law or agreed to in writing, 142c7984eaSAndrew Rist * software distributed under the License is distributed on an 152c7984eaSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 162c7984eaSAndrew Rist * KIND, either express or implied. See the License for the 172c7984eaSAndrew Rist * specific language governing permissions and limitations 182c7984eaSAndrew Rist * under the License. 192c7984eaSAndrew Rist * 202c7984eaSAndrew Rist *************************************************************/ 212c7984eaSAndrew Rist 22cdf0e10cSrcweir // MsOfficeDocumentInformation.h: Schnittstelle f�r die Klasse MsOfficeDocumentInformation. 23cdf0e10cSrcweir // 24cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 25cdf0e10cSrcweir 26cdf0e10cSrcweir #ifndef _REGISTRATIONCONTEXTINFORMATION_HXX_ 27cdf0e10cSrcweir #define _REGISTRATIONCONTEXTINFORMATION_HXX_ 28cdf0e10cSrcweir 29cdf0e10cSrcweir #ifdef _MSC_VER 30cdf0e10cSrcweir #pragma warning(push, 1) /* disable warnings within system headers */ 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir #define WIN32_LEAN_AND_MEAN 33cdf0e10cSrcweir #include <windows.h> 34cdf0e10cSrcweir #include <msi.h> 35cdf0e10cSrcweir #ifdef _MSC_VER 36cdf0e10cSrcweir #pragma warning(pop) 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include <string> 40cdf0e10cSrcweir 41cdf0e10cSrcweir /** A simple implementation class that returns the 42cdf0e10cSrcweir appropriate display names for the Microsoft 43cdf0e10cSrcweir Office document types. 44cdf0e10cSrcweir Under Windows 9x this class checks if the 45cdf0e10cSrcweir document display name is convertable to an ANSI 46cdf0e10cSrcweir string and if not returns an english default. 47cdf0e10cSrcweir So we avoid garbage if soemone for instance 48*ff3f4ebcSOliver-Rainer Wittmann installs an japanese version 49cdf0e10cSrcweir under a German Windows 98 for instance. 50cdf0e10cSrcweir */ 51cdf0e10cSrcweir class RegistrationContextInformation 52cdf0e10cSrcweir { 53cdf0e10cSrcweir public: 54cdf0e10cSrcweir 55cdf0e10cSrcweir enum SHELL_COMMAND {New, Open, Print, Printto}; 56cdf0e10cSrcweir enum OFFICE_APPLICATION {Office, Writer, Calc, Impress}; 57cdf0e10cSrcweir 58cdf0e10cSrcweir RegistrationContextInformation(MSIHANDLE hMsi, const std::wstring& OpenOfficeExecutablePath); 59cdf0e10cSrcweir 60cdf0e10cSrcweir /** Word document information 61cdf0e10cSrcweir The icon index is the index of the icon 62cdf0e10cSrcweir in soffice.exe to be associated with 63cdf0e10cSrcweir word document files 64cdf0e10cSrcweir */ 65cdf0e10cSrcweir std::wstring GetWordDocumentDisplayName() const; 66cdf0e10cSrcweir std::wstring GetWordDocumentFileExtension() const; 67cdf0e10cSrcweir std::wstring GetWordDocumentDefaultIconEntry() const; 68cdf0e10cSrcweir std::wstring GetWordDocumentDefaultShellCommand() const; 69cdf0e10cSrcweir 70cdf0e10cSrcweir /** Word template information 71cdf0e10cSrcweir The icon index is the index of the icon 72cdf0e10cSrcweir in soffice.exe to be associated with 73cdf0e10cSrcweir word template files 74cdf0e10cSrcweir */ 75cdf0e10cSrcweir std::wstring GetWordTemplateDisplayName() const; 76cdf0e10cSrcweir std::wstring GetWordTemplateFileExtension() const; 77cdf0e10cSrcweir std::wstring GetWordTemplateDefaultIconEntry() const; 78cdf0e10cSrcweir std::wstring GetWordTemplateDefaultShellCommand() const; 79cdf0e10cSrcweir 80cdf0e10cSrcweir /** Rtf document information 81cdf0e10cSrcweir The icon index is the index of the icon 82cdf0e10cSrcweir in soffice.exe to be associated with 83cdf0e10cSrcweir rtf document files 84cdf0e10cSrcweir */ 85cdf0e10cSrcweir std::wstring GetRtfDocumentDisplayName() const; 86cdf0e10cSrcweir std::wstring GetRtfDocumentFileExtension() const; 87cdf0e10cSrcweir std::wstring GetRtfDocumentDefaultIconEntry() const; 88cdf0e10cSrcweir std::wstring GetRtfDocumentDefaultShellCommand() const; 89cdf0e10cSrcweir 90cdf0e10cSrcweir /** Excel sheet information 91cdf0e10cSrcweir The icon index is the index of the icon 92cdf0e10cSrcweir in soffice.exe to be associated with 93cdf0e10cSrcweir Excel sheets 94cdf0e10cSrcweir */ 95cdf0e10cSrcweir std::wstring GetExcelSheetDisplayName() const; 96cdf0e10cSrcweir std::wstring GetExcelSheetFileExtension() const; 97cdf0e10cSrcweir std::wstring GetExcelSheetDefaultIconEntry() const; 98cdf0e10cSrcweir std::wstring GetExcelSheetDefaultShellCommand() const; 99cdf0e10cSrcweir 100cdf0e10cSrcweir /** Excel template information 101cdf0e10cSrcweir The icon index is the index of the icon 102cdf0e10cSrcweir in soffice.exe to be associated with 103cdf0e10cSrcweir Excel template files 104cdf0e10cSrcweir */ 105cdf0e10cSrcweir std::wstring GetExcelTemplateDisplayName() const; 106cdf0e10cSrcweir std::wstring GetExcelTemplateFileExtension() const; 107cdf0e10cSrcweir std::wstring GetExcelTemplateDefaultIconEntry() const; 108cdf0e10cSrcweir std::wstring GetExcelTemplateDefaultShellCommand() const; 109cdf0e10cSrcweir 110cdf0e10cSrcweir /** PowerPoint document information 111cdf0e10cSrcweir The icon index is the index of the icon 112cdf0e10cSrcweir in soffice.exe to be associated with 113cdf0e10cSrcweir PowerPoint document files 114cdf0e10cSrcweir */ 115cdf0e10cSrcweir std::wstring GetPowerPointDocumentDisplayName() const; 116cdf0e10cSrcweir std::wstring GetPowerPointDocumentFileExtension() const; 117cdf0e10cSrcweir std::wstring GetPowerPointDocumentDefaultIconEntry() const; 118cdf0e10cSrcweir std::wstring GetPowerPointDocumentDefaultShellCommand() const; 119cdf0e10cSrcweir 120cdf0e10cSrcweir /** PowerPoint template information 121cdf0e10cSrcweir The icon index is the index of the icon 122cdf0e10cSrcweir in soffice.exe to be associated with 123cdf0e10cSrcweir PowerPoint template files 124cdf0e10cSrcweir */ 125cdf0e10cSrcweir std::wstring GetPowerPointTemplateDisplayName() const; 126cdf0e10cSrcweir std::wstring GetPowerPointTemplateFileExtension() const; 127cdf0e10cSrcweir std::wstring GetPowerPointTemplateDefaultIconEntry() const; 128cdf0e10cSrcweir std::wstring GetPowerPointTemplateDefaultShellCommand() const; 129cdf0e10cSrcweir 130cdf0e10cSrcweir /** PowerPoint Show information 131cdf0e10cSrcweir */ 132cdf0e10cSrcweir std::wstring GetPowerPointShowDisplayName() const; 133cdf0e10cSrcweir std::wstring GetPowerPointShowFileExtension() const; 134cdf0e10cSrcweir std::wstring GetPowerPointShowDefaultIconEntry() const; 135cdf0e10cSrcweir std::wstring GetPowerPointShowDefaultShellCommand() const; 136cdf0e10cSrcweir 137cdf0e10cSrcweir /** The string for the "New" command that should appear 138cdf0e10cSrcweir in the Explorer context menu when someone right 139cdf0e10cSrcweir clicks a Microsoft document 140cdf0e10cSrcweir */ 141cdf0e10cSrcweir std::wstring ShellNewCommandDisplayName() const; 142cdf0e10cSrcweir 143cdf0e10cSrcweir /** The string for the "Edit" command that should 144cdf0e10cSrcweir appear in the Explorer context menu when someone 145cdf0e10cSrcweir right clicks a document 146cdf0e10cSrcweir */ 147cdf0e10cSrcweir std::wstring ShellEditCommandDisplayName() const; 148cdf0e10cSrcweir 149cdf0e10cSrcweir /** A friendly name for the application 150cdf0e10cSrcweir */ 151cdf0e10cSrcweir std::wstring GetOpenOfficeFriendlyAppName() const; 152cdf0e10cSrcweir 153*ff3f4ebcSOliver-Rainer Wittmann /** The path to the office executable 154cdf0e10cSrcweir */ 155cdf0e10cSrcweir std::wstring GetOpenOfficeExecutablePath() const; 156cdf0e10cSrcweir 157cdf0e10cSrcweir /** The name of the executable (currently "soffice.exe" 158cdf0e10cSrcweir but may change in the future, who knows) 159cdf0e10cSrcweir */ 160cdf0e10cSrcweir std::wstring GetOpenOfficeExecutableName() const; 161cdf0e10cSrcweir 162cdf0e10cSrcweir /** A command line for the specified shell command 163cdf0e10cSrcweir */ 164cdf0e10cSrcweir std::wstring GetOpenOfficeCommandline(SHELL_COMMAND ShellCommand, 165cdf0e10cSrcweir OFFICE_APPLICATION OfficeApp) const; 166cdf0e10cSrcweir 167cdf0e10cSrcweir private: 168cdf0e10cSrcweir bool IsConvertableToAnsi(const std::wstring& String) const; 169cdf0e10cSrcweir 170cdf0e10cSrcweir void ExtractOpenOfficeExecNameFromPath(); 171cdf0e10cSrcweir 172cdf0e10cSrcweir private: 173cdf0e10cSrcweir MSIHANDLE msihandle_; 174cdf0e10cSrcweir bool m_IsWin9x; 175cdf0e10cSrcweir std::wstring m_OOExecPath; 176cdf0e10cSrcweir std::wstring m_OOExecName; 177cdf0e10cSrcweir }; 178cdf0e10cSrcweir 179cdf0e10cSrcweir #endif 180