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_TARGETHELPER_HXX_ 29 #define __FRAMEWORK_TARGETHELPER_HXX_ 30 31 //_______________________________________________ 32 // own includes 33 34 #include <sal/types.h> 35 #include <rtl/ustring.hxx> 36 #include <targets.h> 37 //_______________________________________________ 38 // namespace 39 40 namespace framework{ 41 42 //_______________________________________________ 43 // definitions 44 45 /** @short can be used to detect, if a target name (used e.g. for XFrame.findFrame()) 46 has a special meaning or can be used as normal frame name (e.g. for XFrame.setName()). 47 48 @author as96863 49 */ 50 class TargetHelper 51 { 52 //___________________________________________ 53 // const 54 55 public: 56 57 /** @short its used at the following interfaces to classify 58 target names. 59 */ 60 enum ESpecialTarget 61 { 62 E_NOT_SPECIAL , 63 E_SELF , 64 E_PARENT , 65 E_TOP , 66 E_BLANK , 67 E_DEFAULT , 68 E_BEAMER , 69 E_MENUBAR , 70 E_HELPAGENT , 71 E_HELPTASK 72 }; 73 74 //___________________________________________ 75 // interface 76 77 public: 78 79 //___________________________________________ 80 81 /** @short it checks the given unknown target name, 82 if it's the expected special one. 83 84 @note An empty target is similar to "_self"! 85 86 @param sCheckTarget 87 must be the unknwon target name, which should be checked. 88 89 @param eSpecialTarget 90 represent the expected target. 91 92 @return It returns <TRUE/> if <var>sCheckTarget</var> represent 93 the expected <var>eSpecialTarget</var> value; <FALSE/> otherwhise. 94 */ 95 static sal_Bool matchSpecialTarget(const ::rtl::OUString& sCheckTarget , 96 ESpecialTarget eSpecialTarget); 97 98 //___________________________________________ 99 100 /** @short it checks, if the given name can be used 101 to set it at a frame using XFrame.setName() method. 102 103 @descr Because we handle special targets in a hard coded way 104 (means we do not check the real name of a frame then) 105 such named frames will never be found! 106 107 And in case such special names can exists one times only 108 by definition inside the same frame tree (e.g. _beamer and 109 OFFICE_HELP_TASK) its not a good idea to allow anything here :-) 110 111 Of course we can't check unknwon names, which are not special ones. 112 But we decide, that it's not allowed to use "_" as first sign 113 (because we reserve this letter for our own purposes!) 114 and the value must not a well known special target. 115 116 @param sName 117 the new frame name, which sould be checked. 118 */ 119 static sal_Bool isValidNameForFrame(const ::rtl::OUString& sName); 120 }; 121 122 } // namespace framework 123 124 #endif // #ifndef __FRAMEWORK_TARGETHELPER_HXX_ 125