1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #if defined(_MSC_VER) && (_MSC_VER > 1310) 28 #pragma warning(disable : 4917 4555) 29 #endif 30 31 #include "common.h" 32 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 33 #include <com/sun/star/container/XNameAccess.hpp> 34 35 ::rtl::OUString getStorageTypeFromGUID_Impl( GUID* guid ) 36 { 37 if ( *guid == OID_WriterTextServer ) 38 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarWriterDocument.6" ) ); 39 40 if ( *guid == OID_WriterOASISTextServer ) 41 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.WriterDocument.1" ) ); 42 43 if ( *guid == OID_CalcServer ) 44 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarCalcDocument.6" ) ); 45 46 if ( *guid == OID_CalcOASISServer ) 47 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.CalcDocument.1" ) ); 48 49 if ( *guid == OID_DrawingServer ) 50 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarDrawDocument.6" ) ); 51 52 if ( *guid == OID_DrawingOASISServer ) 53 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.DrawDocument.1" ) ); 54 55 if ( *guid == OID_PresentationServer ) 56 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarImpressDocument.6" ) ); 57 58 if ( *guid == OID_PresentationOASISServer ) 59 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.ImpressDocument.1" ) ); 60 61 if ( *guid == OID_MathServer ) 62 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarMathDocument.6" ) ); 63 64 if ( *guid == OID_MathOASISServer ) 65 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.MathDocument.1" ) ); 66 67 return ::rtl::OUString(); 68 } 69 70 ::rtl::OUString getServiceNameFromGUID_Impl( GUID* guid ) 71 { 72 if ( *guid == OID_WriterTextServer ) 73 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.TextDocument" ) ); 74 75 if ( *guid == OID_WriterOASISTextServer ) 76 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.TextDocument" ) ); 77 78 if ( *guid == OID_CalcServer ) 79 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Calc.SpreadsheetDocument" ) ); 80 81 if ( *guid == OID_CalcOASISServer ) 82 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Calc.SpreadsheetDocument" ) ); 83 84 if ( *guid == OID_DrawingServer ) 85 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.DrawingDocument" ) ); 86 87 if ( *guid == OID_DrawingOASISServer ) 88 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.DrawingDocument" ) ); 89 90 if ( *guid == OID_PresentationServer ) 91 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.PresentationDocument" ) ); 92 93 if ( *guid == OID_PresentationOASISServer ) 94 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.PresentationDocument" ) ); 95 96 if ( *guid == OID_MathServer ) 97 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Math.FormulaDocument" ) ); 98 99 if ( *guid == OID_MathOASISServer ) 100 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Math.FormulaDocument" ) ); 101 102 return ::rtl::OUString(); 103 } 104 105 ::rtl::OUString getFilterNameFromGUID_Impl( GUID* guid ) 106 { 107 if ( *guid == OID_WriterTextServer ) 108 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Writer)" ) ); 109 110 if ( *guid == OID_WriterOASISTextServer ) 111 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer8" ) ); 112 113 if ( *guid == OID_CalcServer ) 114 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Calc)" ) ); 115 116 if ( *guid == OID_CalcOASISServer ) 117 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "calc8" ) ); 118 119 if ( *guid == OID_DrawingServer ) 120 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Draw)" ) ); 121 122 if ( *guid == OID_DrawingOASISServer ) 123 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "draw8" ) ); 124 125 if ( *guid == OID_PresentationServer ) 126 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Impress)" ) ); 127 128 if ( *guid == OID_PresentationOASISServer ) 129 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "impress8" ) ); 130 131 if ( *guid == OID_MathServer ) 132 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Math)" ) ); 133 134 if ( *guid == OID_MathOASISServer ) 135 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "math8" ) ); 136 137 return ::rtl::OUString(); 138 } 139 140 ::rtl::OUString getTestFileURLFromGUID_Impl( GUID* guid ) 141 { 142 if ( *guid == OID_WriterTextServer ) 143 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxw" ) ); 144 145 if ( *guid == OID_WriterOASISTextServer ) 146 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.odt" ) ); 147 148 if ( *guid == OID_CalcServer ) 149 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxc" ) ); 150 151 if ( *guid == OID_CalcOASISServer ) 152 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.ods" ) ); 153 154 if ( *guid == OID_DrawingServer ) 155 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxd" ) ); 156 157 if ( *guid == OID_DrawingOASISServer ) 158 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.odg" ) ); 159 160 if ( *guid == OID_PresentationServer ) 161 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxi" ) ); 162 163 if ( *guid == OID_PresentationOASISServer ) 164 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.odp" ) ); 165 166 if ( *guid == OID_MathServer ) 167 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxm" ) ); 168 169 if ( *guid == OID_MathOASISServer ) 170 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.odf" ) ); 171 172 return ::rtl::OUString(); 173 } 174 175 /* 176 ::rtl::OUString getCurTypeNameFromGUID_Impl( const uno::Reference< lang::XMultiServiceFactory > xFactory, GUID* guid ) 177 { 178 ::rtl::OUString aResult; 179 180 const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.document.FilterFactory" ) ); 181 uno::Reference < container::XNameAccess > xFilters = uno::Reference < io::XOutputStream > ( 182 xFactory->createInstance ( aServiceName ), 183 uno::UNO_QUERY ); 184 185 if ( xFilters.is() ) 186 { 187 ::rtl::OUString aFilterName = getFilterNameFromGUID_Impl( guid ); 188 if ( aFilterName.getLength() ) 189 { 190 uno::Any aAnyProp = xFilters->getByName( aFilterName ); 191 uno::Sequence< beans::PropertyValue > aProperties; 192 if ( aAnyProp >>= aProperties ) ) 193 { 194 for ( sal_Int32 nInd = 0; nInd < aProperties.getLength; nInd++ ) 195 if ( aProperties[nInd].Name.equalsAscii( "UIName" ) 196 { 197 aProperties[nInd].Value >>= aResult; 198 break; 199 } 200 } 201 } 202 } 203 204 return aResult; 205 } 206 */ 207 208 // Fix strange warnings about some 209 // ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. 210 // warning C4505: 'xxx' : unreferenced local function has been removed 211 #if defined(_MSC_VER) 212 #pragma warning(disable: 4505) 213 #endif 214