xref: /core/embedserv/source/embed/guid.cxx (revision a934115b)
1 /*************************************************************************
2  *
3  *  $RCSfile: guid.cxx,v $
4  *
5  *  $Revision: 1.1 $
6  *
7  *  last change: $Author: mav $ $Date: 2003-03-05 15:50:10 $
8  *
9  *  The Contents of this file are made available subject to the terms of
10  *  either of the following licenses
11  *
12  *         - GNU Lesser General Public License Version 2.1
13  *         - Sun Industry Standards Source License Version 1.1
14  *
15  *  Sun Microsystems Inc., October, 2000
16  *
17  *  GNU Lesser General Public License Version 2.1
18  *  =============================================
19  *  Copyright 2000 by Sun Microsystems, Inc.
20  *  901 San Antonio Road, Palo Alto, CA 94303, USA
21  *
22  *  This library is free software; you can redistribute it and/or
23  *  modify it under the terms of the GNU Lesser General Public
24  *  License version 2.1, as published by the Free Software Foundation.
25  *
26  *  This library is distributed in the hope that it will be useful,
27  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
28  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
29  *  Lesser General Public License for more details.
30  *
31  *  You should have received a copy of the GNU Lesser General Public
32  *  License along with this library; if not, write to the Free Software
33  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34  *  MA  02111-1307  USA
35  *
36  *
37  *  Sun Industry Standards Source License Version 1.1
38  *  =================================================
39  *  The contents of this file are subject to the Sun Industry Standards
40  *  Source License Version 1.1 (the "License"); You may not use this file
41  *  except in compliance with the License. You may obtain a copy of the
42  *  License at http://www.openoffice.org/license.html.
43  *
44  *  Software provided under this License is provided on an "AS IS" basis,
45  *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
46  *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
47  *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
48  *  See the License for the specific provisions governing your rights and
49  *  obligations concerning the Software.
50  *
51  *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
52  *
53  *  Copyright: 2000 by Sun Microsystems, Inc.
54  *
55  *  All Rights Reserved.
56  *
57  *  Contributor(s): _______________________________________
58  *
59  *
60  ************************************************************************/
61 
62 #include "common.h"
63 
64 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
65 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
66 #endif
67 #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
68 #include <com/sun/star/container/XNameAccess.hpp>
69 #endif
70 
71 
72 ::rtl::OUString getServiceNameFromGUID_Impl( GUID* guid )
73 {
74     if ( *guid == OID_WriterTextServer )
75         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.TextDocument" ) );
76 
77     if ( *guid == OID_WriterWebServer )
78         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.WebDocument" ) );
79 
80     if ( *guid == OID_WriterGlobalServer )
81         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.GlobalDocument" ) );
82 
83     if ( *guid == OID_CalcServer )
84         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Calc.SpreadsheetDocument" ) );
85 
86     if ( *guid == OID_DrawingServer )
87         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.DrawingDocument" ) );
88 
89     if ( *guid == OID_PresentationServer )
90         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.PresentationDocument" ) );
91 
92     if ( *guid == OID_MathServer )
93         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Math.FormulaDocument" ) );
94 
95     return ::rtl::OUString();
96 }
97 
98 ::rtl::OUString getFilterNameFromGUID_Impl( GUID* guid )
99 {
100     if ( *guid == OID_WriterTextServer )
101         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Writer)" ) );
102 
103     if ( *guid == OID_WriterWebServer )
104         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "HTML" ) );
105 
106     if ( *guid == OID_WriterGlobalServer )
107         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer_globaldocument_StarOffice_XML_Writer_GlobalDocument" ) );
108 
109     if ( *guid == OID_CalcServer )
110         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Calc)" ) );
111 
112     if ( *guid == OID_DrawingServer )
113         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Draw)" ) );
114 
115     if ( *guid == OID_PresentationServer )
116         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Impress)" ) );
117 
118     if ( *guid == OID_MathServer )
119         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Math)" ) );
120 
121     return ::rtl::OUString();
122 }
123 
124 /*
125 ::rtl::OUString getCurTypeNameFromGUID_Impl( const uno::Reference< lang::XMultiServiceFactory > xFactory, GUID* guid )
126 {
127     ::rtl::OUString aResult;
128 
129     const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.document.FilterFactory" ) );
130     uno::Reference < container::XNameAccess > xFilters = uno::Reference < io::XOutputStream > (
131                                                             xFactory->createInstance ( aServiceName ),
132                                                             uno::UNO_QUERY );
133 
134     if ( xFilters.is() )
135     {
136         ::rtl::OUString aFilterName = getFilterNameFromGUID_Impl( guid );
137         if ( aFilterName.getLength() )
138         {
139             uno::Any aAnyProp = xFilters->getByName( aFilterName );
140             uno::Sequence< beans::PropertyValue > aProperties;
141             if ( aAnyProp >>= aProperties ) )
142             {
143                 for ( sal_Int32 nInd = 0; nInd < aProperties.getLength; nInd++ )
144                     if ( aProperties[nInd].Name.equalsAscii( "UIName" )
145                     {
146                         aProperties[nInd].Value >>= aResult;
147                         break;
148                     }
149             }
150         }
151     }
152 
153     return aResult;
154 }
155 */
156 
157 
158