Avoid potential negative array index access to cached text.
[LibreOffice.git] / embedserv / source / embed / guid.cxx
blob5b284a8a9dff566c8cc1543511e7c97c1fd014c8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <common.h>
21 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
22 #include <com/sun/star/container/XNameAccess.hpp>
24 #include "guid.hxx"
26 wchar_t const * getStorageTypeFromGUID_Impl( GUID const * guid )
28 if ( *guid == OID_WriterTextServer )
29 return L"soffice.StarWriterDocument.6";
31 if ( *guid == OID_WriterOASISTextServer )
32 return L"LibreOffice.WriterDocument.1";
34 if ( *guid == OID_CalcServer )
35 return L"soffice.StarCalcDocument.6";
37 if ( *guid == OID_CalcOASISServer )
38 return L"LibreOffice.CalcDocument.1";
40 if ( *guid == OID_DrawingServer )
41 return L"soffice.StarDrawDocument.6";
43 if ( *guid == OID_DrawingOASISServer )
44 return L"LibreOffice.DrawDocument.1";
46 if ( *guid == OID_PresentationServer )
47 return L"soffice.StarImpressDocument.6";
49 if ( *guid == OID_PresentationOASISServer )
50 return L"LibreOffice.ImpressDocument.1";
52 if ( *guid == OID_MathServer )
53 return L"soffice.StarMathDocument.6";
55 if ( *guid == OID_MathOASISServer )
56 return L"LibreOffice.MathDocument.1";
58 return L"";
61 std::u16string_view getServiceNameFromGUID_Impl( GUID const * guid )
63 if ( *guid == OID_WriterTextServer )
64 return u"com.sun.star.comp.Writer.TextDocument";
66 if ( *guid == OID_WriterOASISTextServer )
67 return u"com.sun.star.comp.Writer.TextDocument";
69 if ( *guid == OID_CalcServer )
70 return u"com.sun.star.comp.Calc.SpreadsheetDocument";
72 if ( *guid == OID_CalcOASISServer )
73 return u"com.sun.star.comp.Calc.SpreadsheetDocument";
75 if ( *guid == OID_DrawingServer )
76 return u"com.sun.star.comp.Draw.DrawingDocument";
78 if ( *guid == OID_DrawingOASISServer )
79 return u"com.sun.star.comp.Draw.DrawingDocument";
81 if ( *guid == OID_PresentationServer )
82 return u"com.sun.star.comp.Draw.PresentationDocument";
84 if ( *guid == OID_PresentationOASISServer )
85 return u"com.sun.star.comp.Draw.PresentationDocument";
87 if ( *guid == OID_MathServer )
88 return u"com.sun.star.comp.Math.FormulaDocument";
90 if ( *guid == OID_MathOASISServer )
91 return u"com.sun.star.comp.Math.FormulaDocument";
93 return u"";
96 OUString getFilterNameFromGUID_Impl( GUID const * guid )
98 if ( *guid == OID_WriterTextServer )
99 return "StarOffice XML (Writer)";
101 if ( *guid == OID_WriterOASISTextServer )
102 return "writer8";
104 if ( *guid == OID_CalcServer )
105 return "StarOffice XML (Calc)";
107 if ( *guid == OID_CalcOASISServer )
108 return "calc8";
110 if ( *guid == OID_DrawingServer )
111 return "StarOffice XML (Draw)";
113 if ( *guid == OID_DrawingOASISServer )
114 return "draw8";
116 if ( *guid == OID_PresentationServer )
117 return "StarOffice XML (Impress)";
119 if ( *guid == OID_PresentationOASISServer )
120 return "impress8";
122 if ( *guid == OID_MathServer )
123 return "StarOffice XML (Math)";
125 if ( *guid == OID_MathOASISServer )
126 return "math8";
128 return OUString();
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */