tdf#120787: fine-tune window flags w/ focus on floating toolbars
[LibreOffice.git] / framework / inc / protocols.h
blobc0a1743b65748322c1cff680e3d3c27f42808881
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 /*TODO outline this implementation :-) */
22 #ifndef INCLUDED_FRAMEWORK_INC_PROTOCOLS_H
23 #define INCLUDED_FRAMEWORK_INC_PROTOCOLS_H
25 #include <rtl/ustring.hxx>
27 namespace framework{
29 /**
30 some protocols must be checked during loading or dispatching URLs manually
31 It can be necessary to decide, if a URL represent a non visible content or
32 a real visible component.
35 // indicates a loadable content in general!
36 #define SPECIALPROTOCOL_PRIVATE "private:"
37 // indicates loading of components using a model directly
38 #define SPECIALPROTOCOL_PRIVATE_OBJECT "private:object"
39 // indicates loading of components using a stream only
40 #define SPECIALPROTOCOL_PRIVATE_STREAM "private:stream"
41 // indicates creation of empty documents
42 #define SPECIALPROTOCOL_PRIVATE_FACTORY "private:factory"
43 // internal protocol of the sfx project for generic dispatch functionality
44 #define SPECIALPROTOCOL_SLOT "slot:"
45 // external representation of the slot protocol using names instead of id's
46 #define SPECIALPROTOCOL_UNO ".uno:"
47 // special sfx protocol to execute macros
48 #define SPECIALPROTOCOL_MACRO "macro:"
49 // generic way to start uno services during dispatch
50 #define SPECIALPROTOCOL_SERVICE "service:"
51 // for sending mails
52 #define SPECIALPROTOCOL_MAILTO "mailto:"
53 // for sending news
54 #define SPECIALPROTOCOL_NEWS "news:"
56 /** well known protocols */
57 enum class EProtocol
59 PrivateObject,
60 PrivateStream,
61 PrivateFactory,
62 Slot,
63 Uno,
64 Macro,
65 Service,
66 MailTo,
67 News
70 class ProtocolCheck
72 public:
74 /**
75 it checks if given URL match the required protocol only
76 It should be used instead of specifyProtocol() if only this question
77 is interesting to perform the code. We must not check for all possible protocols here...
79 static bool isProtocol( const OUString& sURL, EProtocol eRequired )
81 bool bRet = false;
82 switch(eRequired)
84 case EProtocol::PrivateObject:
85 bRet = sURL.startsWith(SPECIALPROTOCOL_PRIVATE_OBJECT);
86 break;
87 case EProtocol::PrivateStream:
88 bRet = sURL.startsWith(SPECIALPROTOCOL_PRIVATE_STREAM);
89 break;
90 case EProtocol::PrivateFactory:
91 bRet = sURL.startsWith(SPECIALPROTOCOL_PRIVATE_FACTORY);
92 break;
93 case EProtocol::Slot:
94 bRet = sURL.startsWith(SPECIALPROTOCOL_SLOT);
95 break;
96 case EProtocol::Uno:
97 bRet = sURL.startsWith(SPECIALPROTOCOL_UNO);
98 break;
99 case EProtocol::Macro:
100 bRet = sURL.startsWith(SPECIALPROTOCOL_MACRO);
101 break;
102 case EProtocol::Service:
103 bRet = sURL.startsWith(SPECIALPROTOCOL_SERVICE);
104 break;
105 case EProtocol::MailTo:
106 bRet = sURL.startsWith(SPECIALPROTOCOL_MAILTO);
107 break;
108 case EProtocol::News:
109 bRet = sURL.startsWith(SPECIALPROTOCOL_NEWS);
110 break;
111 default:
112 bRet = false;
113 break;
115 return bRet;
119 } // namespace framework
121 #endif // INCLUDED_FRAMEWORK_INC_PROTOCOLS_H
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */