Update ooo320-m1
[ooovba.git] / framework / source / loadenv / targethelper.cxx
blobc8681a5b2c02abe7372e795b85cfcc280838bf15
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: targethelper.cxx,v $
10 * $Revision: 1.6.82.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_framework.hxx"
34 //_______________________________________________
35 // own includes
37 #ifndef __FRAMEWORK_LOADENV_TARGETHELPER_HXX_
38 #include <loadenv/targethelper.hxx>
39 #endif
41 //_______________________________________________
42 // namespace
44 namespace framework{
46 //_______________________________________________
47 // declarations
49 /*-----------------------------------------------
50 05.08.2003 09:08
51 -----------------------------------------------*/
52 sal_Bool TargetHelper::matchSpecialTarget(const ::rtl::OUString& sCheckTarget ,
53 ESpecialTarget eSpecialTarget)
55 switch(eSpecialTarget)
57 case E_SELF :
58 return (
59 (!sCheckTarget.getLength() ) ||
60 (sCheckTarget.equals(SPECIALTARGET_SELF))
63 case E_PARENT :
64 return (sCheckTarget.equals(SPECIALTARGET_PARENT));
66 case E_TOP :
67 return (sCheckTarget.equals(SPECIALTARGET_TOP));
69 case E_BLANK :
70 return (sCheckTarget.equals(SPECIALTARGET_BLANK));
72 case E_DEFAULT :
73 return (sCheckTarget.equals(SPECIALTARGET_DEFAULT));
75 case E_BEAMER :
76 return (sCheckTarget.equals(SPECIALTARGET_BEAMER));
78 case E_MENUBAR :
79 return (sCheckTarget.equals(SPECIALTARGET_MENUBAR));
81 case E_HELPAGENT :
82 return (sCheckTarget.equals(SPECIALTARGET_HELPAGENT));
84 case E_HELPTASK :
85 return (sCheckTarget.equals(SPECIALTARGET_HELPTASK));
86 default:
87 return sal_False;
90 return sal_False;
93 /*-----------------------------------------------
94 05.08.2003 09:17
95 -----------------------------------------------*/
96 sal_Bool TargetHelper::isValidNameForFrame(const ::rtl::OUString& sName)
98 // some special targets are realy special ones :-)
99 // E.g. the are realy used to locate one frame inside the frame tree.
100 if (
101 (!sName.getLength() ) ||
102 (TargetHelper::matchSpecialTarget(sName, E_HELPTASK)) ||
103 (TargetHelper::matchSpecialTarget(sName, E_BEAMER) )
105 return sal_True;
107 // all other names must be checked more general
108 // special targets starts with a "_".
109 return (sName.indexOf('_') != 0);
112 } // namespace framework