1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef __FRAMEWORK_STORAGE_SCRIPTURI_HXX_ 29 #define __FRAMEWORK_STORAGE_SCRIPTURI_HXX_ 30 31 #include <osl/mutex.hxx> 32 #include <rtl/ustring> 33 34 #include <com/sun/star/lang/IllegalArgumentException.hpp> 35 36 namespace scripting_impl { 37 // for simplification 38 #define css ::com::sun::star 39 #define dcsssf ::drafts::com::sun::star::script::framework 40 41 struct Uri { 42 bool valid; 43 ::rtl::OUString uri; 44 ::rtl::OUString location; 45 ::rtl::OUString language; 46 ::rtl::OUString functionName; 47 ::rtl::OUString logicalName; 48 }; 49 /** 50 * Helper class for dealing with script URIs. 51 */ 52 class ScriptURI 53 { 54 public: 55 ScriptURI( const ::rtl::OUString& scriptURI ) 56 throw ( css::lang::IllegalArgumentException ); 57 virtual ~ScriptURI() SAL_THROW ( () ); 58 59 /** 60 * This function returns the location of the script 61 * 62 */ 63 virtual ::rtl::OUString getLocation(); 64 65 /** 66 * This function returns the language of the script, eg. java, 67 * StarBasic,... 68 * 69 */ 70 virtual ::rtl::OUString getLanguage(); 71 72 /** 73 * This function returns the language dependent function name of 74 * the script 75 */ 76 virtual ::rtl::OUString getFunctionName(); 77 78 /** 79 * This function returns the language independent logical name of 80 * the script 81 */ 82 virtual ::rtl::OUString getLogicalName(); 83 84 /** 85 * This function returns the full URI 86 * 87 */ 88 virtual ::rtl::OUString getURI(); 89 90 private: 91 ::osl::Mutex m_mutex; 92 93 /** @internal */ 94 sal_Bool m_valid; 95 96 //the private strings 97 /** the string representation of the this objects URI */ 98 ::rtl::OUString m_uri; 99 /** the location of the script referred to by this URI */ 100 ::rtl::OUString m_location; 101 /** the language of the script referred to by this URI */ 102 ::rtl::OUString m_language; 103 /** the language dependent function name of the script referred to by this URI */ 104 ::rtl::OUString m_functionName; 105 /** the language independent logical name of the script referred to by this URI */ 106 ::rtl::OUString m_logicalName; 107 108 //attempt to parse the URI provided 109 /** @internal */ 110 Uri parseIt(); 111 //set the members 112 /** @internal */ 113 void set_values( Uri ); 114 bool isValid(); 115 } 116 ; // class ScriptURI 117 118 } //namespace script_uri 119 120 #endif // define __FRAMEWORK_STORAGE_SCRIPTURI_HXX_ 121