xref: /AOO41X/main/framework/source/loadenv/targethelper.cxx (revision 6d739b60ff8f4ed2134ae1442e284f9da90334b4)
1*6d739b60SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*6d739b60SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*6d739b60SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*6d739b60SAndrew Rist  * distributed with this work for additional information
6*6d739b60SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*6d739b60SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*6d739b60SAndrew Rist  * "License"); you may not use this file except in compliance
9*6d739b60SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*6d739b60SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*6d739b60SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*6d739b60SAndrew Rist  * software distributed under the License is distributed on an
15*6d739b60SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*6d739b60SAndrew Rist  * KIND, either express or implied.  See the License for the
17*6d739b60SAndrew Rist  * specific language governing permissions and limitations
18*6d739b60SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*6d739b60SAndrew Rist  *************************************************************/
21*6d739b60SAndrew Rist 
22*6d739b60SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_framework.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_______________________________________________
28cdf0e10cSrcweir // own includes
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #ifndef __FRAMEWORK_LOADENV_TARGETHELPER_HXX_
31cdf0e10cSrcweir #include <loadenv/targethelper.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir 
34cdf0e10cSrcweir //_______________________________________________
35cdf0e10cSrcweir // namespace
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace framework{
38cdf0e10cSrcweir 
39cdf0e10cSrcweir //_______________________________________________
40cdf0e10cSrcweir // declarations
41cdf0e10cSrcweir 
42cdf0e10cSrcweir /*-----------------------------------------------
43cdf0e10cSrcweir     05.08.2003 09:08
44cdf0e10cSrcweir -----------------------------------------------*/
matchSpecialTarget(const::rtl::OUString & sCheckTarget,ESpecialTarget eSpecialTarget)45cdf0e10cSrcweir sal_Bool TargetHelper::matchSpecialTarget(const ::rtl::OUString& sCheckTarget  ,
46cdf0e10cSrcweir                                                 ESpecialTarget   eSpecialTarget)
47cdf0e10cSrcweir {
48cdf0e10cSrcweir     switch(eSpecialTarget)
49cdf0e10cSrcweir     {
50cdf0e10cSrcweir         case E_SELF :
51cdf0e10cSrcweir             return (
52cdf0e10cSrcweir                     (!sCheckTarget.getLength()              ) ||
53cdf0e10cSrcweir                     (sCheckTarget.equals(SPECIALTARGET_SELF))
54cdf0e10cSrcweir                    );
55cdf0e10cSrcweir 
56cdf0e10cSrcweir         case E_PARENT :
57cdf0e10cSrcweir             return (sCheckTarget.equals(SPECIALTARGET_PARENT));
58cdf0e10cSrcweir 
59cdf0e10cSrcweir         case E_TOP :
60cdf0e10cSrcweir             return (sCheckTarget.equals(SPECIALTARGET_TOP));
61cdf0e10cSrcweir 
62cdf0e10cSrcweir         case E_BLANK :
63cdf0e10cSrcweir             return (sCheckTarget.equals(SPECIALTARGET_BLANK));
64cdf0e10cSrcweir 
65cdf0e10cSrcweir         case E_DEFAULT :
66cdf0e10cSrcweir             return (sCheckTarget.equals(SPECIALTARGET_DEFAULT));
67cdf0e10cSrcweir 
68cdf0e10cSrcweir         case E_BEAMER :
69cdf0e10cSrcweir             return (sCheckTarget.equals(SPECIALTARGET_BEAMER));
70cdf0e10cSrcweir 
71cdf0e10cSrcweir         case E_MENUBAR :
72cdf0e10cSrcweir             return (sCheckTarget.equals(SPECIALTARGET_MENUBAR));
73cdf0e10cSrcweir 
74cdf0e10cSrcweir         case E_HELPAGENT :
75cdf0e10cSrcweir             return (sCheckTarget.equals(SPECIALTARGET_HELPAGENT));
76cdf0e10cSrcweir 
77cdf0e10cSrcweir         case E_HELPTASK :
78cdf0e10cSrcweir             return (sCheckTarget.equals(SPECIALTARGET_HELPTASK));
79cdf0e10cSrcweir         default:
80cdf0e10cSrcweir             return sal_False;
81cdf0e10cSrcweir     }
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     return sal_False;
84cdf0e10cSrcweir }
85cdf0e10cSrcweir 
86cdf0e10cSrcweir /*-----------------------------------------------
87cdf0e10cSrcweir     05.08.2003 09:17
88cdf0e10cSrcweir -----------------------------------------------*/
isValidNameForFrame(const::rtl::OUString & sName)89cdf0e10cSrcweir sal_Bool TargetHelper::isValidNameForFrame(const ::rtl::OUString& sName)
90cdf0e10cSrcweir {
91cdf0e10cSrcweir     // some special targets are realy special ones :-)
92cdf0e10cSrcweir     // E.g. the are realy used to locate one frame inside the frame tree.
93cdf0e10cSrcweir     if (
94cdf0e10cSrcweir         (!sName.getLength()                                 ) ||
95cdf0e10cSrcweir         (TargetHelper::matchSpecialTarget(sName, E_HELPTASK)) ||
96cdf0e10cSrcweir         (TargetHelper::matchSpecialTarget(sName, E_BEAMER)  )
97cdf0e10cSrcweir        )
98cdf0e10cSrcweir         return sal_True;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     // all other names must be checked more general
101cdf0e10cSrcweir     // special targets starts with a "_".
102cdf0e10cSrcweir     return (sName.indexOf('_') != 0);
103cdf0e10cSrcweir }
104cdf0e10cSrcweir 
105cdf0e10cSrcweir } // namespace framework
106