fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / xmlhelp / source / cxxhelp / provider / urlparameter.hxx
blobfa57a89c0365c2ad48ab7970b05931e0b1bb75b7
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 #ifndef _URLPARAMETER_HXX_
21 #define _URLPARAMETER_HXX_
23 #include <rtl/ustring.hxx>
24 #include <rtl/string.hxx>
25 #include <com/sun/star/ucb/IllegalIdentifierException.hpp>
26 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
27 #include <com/sun/star/io/XActiveDataSink.hpp>
28 #include <com/sun/star/io/XOutputStream.hpp>
29 #include <com/sun/star/ucb/Command.hpp>
31 namespace chelp {
34 class Databases;
37 class DbtToStringConverter
39 public:
41 DbtToStringConverter( const sal_Char* ptr )
42 : m_ptr( ptr )
47 OUString getHash()
49 if( m_ptr )
51 sal_Int32 sizeOfFile = ( sal_Int32 ) m_ptr[0];
52 OUString Hash( m_ptr+1,sizeOfFile,RTL_TEXTENCODING_UTF8 );
53 sal_Int32 idx;
54 if( ( idx = Hash.indexOf( sal_Unicode( '#' ) ) ) != -1 )
55 return Hash.copy( 1+idx );
57 return OUString();
61 OUString getFile()
63 if( ! m_ptr )
64 return OUString();
66 sal_Int32 sizeOfFile = ( sal_Int32 ) m_ptr[0];
67 OUString File( m_ptr+1,sizeOfFile,RTL_TEXTENCODING_UTF8 );
68 sal_Int32 idx;
69 if( ( idx = File.indexOf( sal_Unicode( '#' ) ) ) != -1 )
70 return File.copy( 0,idx );
71 else
72 return File;
76 OUString getDatabase()
78 if( ! m_ptr )
79 return OUString();
81 sal_Int32 sizeOfDatabase = ( int ) m_ptr[ 1+ ( sal_Int32 ) m_ptr[0] ];
82 return OUString( m_ptr + 2 + ( sal_Int32 ) m_ptr[0],sizeOfDatabase,RTL_TEXTENCODING_UTF8 );
86 OUString getTitle()
88 if( ! m_ptr )
89 return OUString();
91 sal_Int32 sizeOfTitle =
92 ( sal_Int32 ) m_ptr[ 2 + m_ptr[0] + ( sal_Int32 ) m_ptr[ 1+ ( sal_Int32 ) m_ptr[0] ] ];
93 return OUString( m_ptr + 3 + m_ptr[0] + ( sal_Int32 ) m_ptr[ 1+ ( sal_Int32 ) m_ptr[0] ],
94 sizeOfTitle,
95 RTL_TEXTENCODING_UTF8 );
99 private:
101 const sal_Char* m_ptr;
108 class URLParameter
110 public:
112 URLParameter( const OUString& aURL,
113 Databases* pDatabases )
114 throw( com::sun::star::ucb::IllegalIdentifierException );
116 bool isPicture() const { return m_aModule == "picture"; }
117 bool isActive() const { return !m_aActive.isEmpty() && m_aActive == "true"; }
118 bool isQuery() const { return m_aId.isEmpty() && !m_aQuery.isEmpty(); }
119 bool isEntryForModule() const { return m_aId == "start" || m_bStart; }
120 bool isFile() const { return !m_aId.isEmpty(); }
121 bool isModule() const { return m_aId.isEmpty() && !m_aModule.isEmpty(); }
122 bool isRoot() const { return m_aModule.isEmpty(); }
123 bool isErrorDocument();
125 OUString get_url() const { return m_aURL; }
127 OUString get_id();
129 OUString get_tag();
131 // Not called for an directory
133 OUString get_path() { return get_the_path(); }
135 OUString get_eid() const { return m_aEid; }
137 OUString get_title();
139 OUString get_jar() { return get_the_jar(); }
141 OUString get_ExtensionRegistryPath() const { return m_aExtensionRegistryPath; }
143 OUString get_module() const { return m_aModule; }
145 OUString get_dbpar() const
147 if( !m_aDbPar.isEmpty() )
148 return m_aDbPar;
149 else
150 return m_aModule;
153 OUString get_prefix() const { return m_aPrefix; }
155 OUString get_language();
157 OUString get_device() const { return m_aDevice; }
159 OUString get_program();
161 OUString get_query() const { return m_aQuery; }
163 OUString get_scope() const { return m_aScope; }
165 OUString get_system() const { return m_aSystem; }
167 sal_Int32 get_hitCount() const { return m_nHitCount; }
169 OString getByName( const char* par );
171 void open( const com::sun::star::ucb::Command& aCommand,
172 sal_Int32 CommandId,
173 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment,
174 const com::sun::star::uno::Reference< com::sun::star::io::XActiveDataSink >& xDataSink );
176 void open( const com::sun::star::ucb::Command& aCommand,
177 sal_Int32 CommandId,
178 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment,
179 const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xDataSink );
181 private:
183 Databases* m_pDatabases;
185 bool m_bHelpDataFileRead;
186 bool m_bStart;
187 bool m_bUseDB;
189 OUString m_aURL;
191 OUString m_aTag;
192 OUString m_aId;
193 OUString m_aPath;
194 OUString m_aModule;
195 OUString m_aTitle;
196 OUString m_aJar;
197 OUString m_aExtensionRegistryPath;
198 OUString m_aEid;
199 OUString m_aDbPar;
201 OUString m_aDefaultLanguage;
202 OUString m_aLanguage;
204 OUString m_aPrefix;
205 OUString m_aDevice;
206 OUString m_aProgram;
207 OUString m_aSystem;
208 OUString m_aActive;
210 OUString m_aQuery;
211 OUString m_aScope;
213 OUString m_aExpr;
215 sal_Int32 m_nHitCount; // The default maximum hitcount
218 // private methods
220 void init( bool bDefaultLanguageIsInitialized );
222 OUString get_the_tag();
224 OUString get_the_path();
226 OUString get_the_title();
228 OUString get_the_jar();
230 void readHelpDataFile();
232 void parse() throw( com::sun::star::ucb::IllegalIdentifierException );
234 bool scheme();
236 bool module();
238 bool name( bool modulePresent );
240 bool query();
242 }; // end class URLParameter
245 } // end namespace chelp
247 #endif
249 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */