Files
libreoffice/embedserv/source/embed/guid.cxx

219 lines
8.6 KiB
C++
Raw Normal View History

2003-03-05 14:50:11 +00:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
2003-03-05 14:50:11 +00:00
*
* $RCSfile: guid.cxx,v $
2003-03-05 14:50:11 +00:00
*
* $Revision: 1.6 $
2003-03-05 14:50:11 +00:00
*
* last change: $Author: rt $ $Date: 2005-09-08 18:52:52 $
2003-03-05 14:50:11 +00:00
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
2003-03-05 14:50:11 +00:00
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
2003-03-05 14:50:11 +00:00
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
2003-03-05 14:50:11 +00:00
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
2003-03-05 14:50:11 +00:00
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
2003-03-05 14:50:11 +00:00
*
************************************************************************/
#include "common.h"
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
2003-04-02 14:44:52 +00:00
::rtl::OUString getStorageTypeFromGUID_Impl( GUID* guid )
{
if ( *guid == OID_WriterTextServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarWriterDocument.6" ) );
if ( *guid == OID_WriterOASISTextServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.WriterDocument.1" ) );
2003-04-02 14:44:52 +00:00
if ( *guid == OID_CalcServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarCalcDocument.6" ) );
if ( *guid == OID_CalcOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.CalcDocument.1" ) );
2003-04-02 14:44:52 +00:00
if ( *guid == OID_DrawingServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarDrawDocument.6" ) );
if ( *guid == OID_DrawingOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.DrawDocument.1" ) );
2003-04-02 14:44:52 +00:00
if ( *guid == OID_PresentationServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarImpressDocument.6" ) );
if ( *guid == OID_PresentationOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.ImpressDocument.1" ) );
2003-04-02 14:44:52 +00:00
if ( *guid == OID_MathServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarMathDocument.6" ) );
if ( *guid == OID_MathOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.MathDocument.1" ) );
2003-04-02 14:44:52 +00:00
return ::rtl::OUString();
}
2003-03-05 14:50:11 +00:00
::rtl::OUString getServiceNameFromGUID_Impl( GUID* guid )
{
if ( *guid == OID_WriterTextServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.TextDocument" ) );
if ( *guid == OID_WriterOASISTextServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.TextDocument" ) );
2003-03-05 14:50:11 +00:00
if ( *guid == OID_CalcServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Calc.SpreadsheetDocument" ) );
if ( *guid == OID_CalcOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Calc.SpreadsheetDocument" ) );
2003-03-05 14:50:11 +00:00
if ( *guid == OID_DrawingServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.DrawingDocument" ) );
if ( *guid == OID_DrawingOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.DrawingDocument" ) );
2003-03-05 14:50:11 +00:00
if ( *guid == OID_PresentationServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.PresentationDocument" ) );
if ( *guid == OID_PresentationOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.PresentationDocument" ) );
2003-03-05 14:50:11 +00:00
if ( *guid == OID_MathServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Math.FormulaDocument" ) );
if ( *guid == OID_MathOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Math.FormulaDocument" ) );
2003-03-05 14:50:11 +00:00
return ::rtl::OUString();
}
::rtl::OUString getFilterNameFromGUID_Impl( GUID* guid )
{
if ( *guid == OID_WriterTextServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Writer)" ) );
if ( *guid == OID_WriterOASISTextServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer8" ) );
2003-03-05 14:50:11 +00:00
if ( *guid == OID_CalcServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Calc)" ) );
if ( *guid == OID_CalcOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "calc8" ) );
2003-03-05 14:50:11 +00:00
if ( *guid == OID_DrawingServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Draw)" ) );
if ( *guid == OID_DrawingOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "draw8" ) );
2003-03-05 14:50:11 +00:00
if ( *guid == OID_PresentationServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Impress)" ) );
if ( *guid == OID_PresentationOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "impress8" ) );
2003-03-05 14:50:11 +00:00
if ( *guid == OID_MathServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Math)" ) );
if ( *guid == OID_MathOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "math8" ) );
2003-03-05 14:50:11 +00:00
return ::rtl::OUString();
}
2003-03-17 10:03:28 +00:00
::rtl::OUString getTestFileURLFromGUID_Impl( GUID* guid )
{
if ( *guid == OID_WriterTextServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxw" ) );
if ( *guid == OID_WriterOASISTextServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.odt" ) );
2003-03-17 10:03:28 +00:00
if ( *guid == OID_CalcServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxc" ) );
if ( *guid == OID_CalcOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.ods" ) );
2003-03-17 10:03:28 +00:00
if ( *guid == OID_DrawingServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxd" ) );
if ( *guid == OID_DrawingOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.odg" ) );
2003-03-17 10:03:28 +00:00
if ( *guid == OID_PresentationServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxi" ) );
if ( *guid == OID_PresentationOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.odp" ) );
2003-03-17 10:03:28 +00:00
if ( *guid == OID_MathServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxm" ) );
if ( *guid == OID_MathOASISServer )
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.odf" ) );
2003-03-17 10:03:28 +00:00
return ::rtl::OUString();
}
2003-03-05 14:50:11 +00:00
/*
::rtl::OUString getCurTypeNameFromGUID_Impl( const uno::Reference< lang::XMultiServiceFactory > xFactory, GUID* guid )
{
::rtl::OUString aResult;
const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.document.FilterFactory" ) );
uno::Reference < container::XNameAccess > xFilters = uno::Reference < io::XOutputStream > (
xFactory->createInstance ( aServiceName ),
uno::UNO_QUERY );
if ( xFilters.is() )
{
::rtl::OUString aFilterName = getFilterNameFromGUID_Impl( guid );
if ( aFilterName.getLength() )
{
uno::Any aAnyProp = xFilters->getByName( aFilterName );
uno::Sequence< beans::PropertyValue > aProperties;
if ( aAnyProp >>= aProperties ) )
{
for ( sal_Int32 nInd = 0; nInd < aProperties.getLength; nInd++ )
if ( aProperties[nInd].Name.equalsAscii( "UIName" )
{
aProperties[nInd].Value >>= aResult;
break;
}
}
}
}
return aResult;
}
*/