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 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_framework.hxx" 30 31 //_______________________________________________ 32 // own includes 33 34 #ifndef __FRAMEWORK_LOADENV_TARGETHELPER_HXX_ 35 #include <loadenv/targethelper.hxx> 36 #endif 37 38 //_______________________________________________ 39 // namespace 40 41 namespace framework{ 42 43 //_______________________________________________ 44 // declarations 45 46 /*----------------------------------------------- 47 05.08.2003 09:08 48 -----------------------------------------------*/ 49 sal_Bool TargetHelper::matchSpecialTarget(const ::rtl::OUString& sCheckTarget , 50 ESpecialTarget eSpecialTarget) 51 { 52 switch(eSpecialTarget) 53 { 54 case E_SELF : 55 return ( 56 (!sCheckTarget.getLength() ) || 57 (sCheckTarget.equals(SPECIALTARGET_SELF)) 58 ); 59 60 case E_PARENT : 61 return (sCheckTarget.equals(SPECIALTARGET_PARENT)); 62 63 case E_TOP : 64 return (sCheckTarget.equals(SPECIALTARGET_TOP)); 65 66 case E_BLANK : 67 return (sCheckTarget.equals(SPECIALTARGET_BLANK)); 68 69 case E_DEFAULT : 70 return (sCheckTarget.equals(SPECIALTARGET_DEFAULT)); 71 72 case E_BEAMER : 73 return (sCheckTarget.equals(SPECIALTARGET_BEAMER)); 74 75 case E_MENUBAR : 76 return (sCheckTarget.equals(SPECIALTARGET_MENUBAR)); 77 78 case E_HELPAGENT : 79 return (sCheckTarget.equals(SPECIALTARGET_HELPAGENT)); 80 81 case E_HELPTASK : 82 return (sCheckTarget.equals(SPECIALTARGET_HELPTASK)); 83 default: 84 return sal_False; 85 } 86 87 return sal_False; 88 } 89 90 /*----------------------------------------------- 91 05.08.2003 09:17 92 -----------------------------------------------*/ 93 sal_Bool TargetHelper::isValidNameForFrame(const ::rtl::OUString& sName) 94 { 95 // some special targets are realy special ones :-) 96 // E.g. the are realy used to locate one frame inside the frame tree. 97 if ( 98 (!sName.getLength() ) || 99 (TargetHelper::matchSpecialTarget(sName, E_HELPTASK)) || 100 (TargetHelper::matchSpecialTarget(sName, E_BEAMER) ) 101 ) 102 return sal_True; 103 104 // all other names must be checked more general 105 // special targets starts with a "_". 106 return (sName.indexOf('_') != 0); 107 } 108 109 } // namespace framework 110