1f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f8e07b45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f8e07b45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f8e07b45SAndrew Rist  * distributed with this work for additional information
6f8e07b45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f8e07b45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f8e07b45SAndrew Rist  * "License"); you may not use this file except in compliance
9f8e07b45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f8e07b45SAndrew Rist  *
11f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f8e07b45SAndrew Rist  *
13f8e07b45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f8e07b45SAndrew Rist  * software distributed under the License is distributed on an
15f8e07b45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f8e07b45SAndrew Rist  * KIND, either express or implied.  See the License for the
17f8e07b45SAndrew Rist  * specific language governing permissions and limitations
18f8e07b45SAndrew Rist  * under the License.
19f8e07b45SAndrew Rist  *
20f8e07b45SAndrew Rist  *************************************************************/
21f8e07b45SAndrew Rist 
22f8e07b45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __FRAMEWORK_TARGETHELPER_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_TARGETHELPER_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_______________________________________________
28cdf0e10cSrcweir // own includes
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <sal/types.h>
31cdf0e10cSrcweir #include <rtl/ustring.hxx>
32cdf0e10cSrcweir #include <targets.h>
33cdf0e10cSrcweir //_______________________________________________
34cdf0e10cSrcweir // namespace
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace framework{
37cdf0e10cSrcweir 
38cdf0e10cSrcweir //_______________________________________________
39cdf0e10cSrcweir // definitions
40cdf0e10cSrcweir 
41cdf0e10cSrcweir /** @short  can be used to detect, if a target name (used e.g. for XFrame.findFrame())
42cdf0e10cSrcweir             has a special meaning or can be used as normal frame name (e.g. for XFrame.setName()).
43cdf0e10cSrcweir 
44cdf0e10cSrcweir     @author as96863
45cdf0e10cSrcweir  */
46cdf0e10cSrcweir class TargetHelper
47cdf0e10cSrcweir {
48cdf0e10cSrcweir     //___________________________________________
49cdf0e10cSrcweir     // const
50cdf0e10cSrcweir 
51cdf0e10cSrcweir     public:
52cdf0e10cSrcweir 
53cdf0e10cSrcweir         /** @short  its used at the following interfaces to classify
54cdf0e10cSrcweir                     target names.
55cdf0e10cSrcweir          */
56cdf0e10cSrcweir         enum ESpecialTarget
57cdf0e10cSrcweir         {
58cdf0e10cSrcweir             E_NOT_SPECIAL   ,
59cdf0e10cSrcweir             E_SELF          ,
60cdf0e10cSrcweir             E_PARENT        ,
61cdf0e10cSrcweir             E_TOP           ,
62cdf0e10cSrcweir             E_BLANK         ,
63cdf0e10cSrcweir             E_DEFAULT       ,
64cdf0e10cSrcweir             E_BEAMER        ,
65cdf0e10cSrcweir             E_MENUBAR       ,
66cdf0e10cSrcweir             E_HELPAGENT     ,
67cdf0e10cSrcweir             E_HELPTASK
68cdf0e10cSrcweir         };
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     //___________________________________________
71cdf0e10cSrcweir     // interface
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     public:
74cdf0e10cSrcweir 
75cdf0e10cSrcweir         //___________________________________________
76cdf0e10cSrcweir 
77cdf0e10cSrcweir         /** @short  it checks the given unknown target name,
78cdf0e10cSrcweir                     if it's the expected special one.
79cdf0e10cSrcweir 
80cdf0e10cSrcweir             @note   An empty target is similar to "_self"!
81cdf0e10cSrcweir 
82cdf0e10cSrcweir             @param  sCheckTarget
83036fea61SDamjan Jovanovic                     must be the unknown target name, which should be checked.
84cdf0e10cSrcweir 
85cdf0e10cSrcweir             @param  eSpecialTarget
86cdf0e10cSrcweir                     represent the expected target.
87cdf0e10cSrcweir 
88cdf0e10cSrcweir             @return It returns <TRUE/> if <var>sCheckTarget</var> represent
89*15289133Smseidel                     the expected <var>eSpecialTarget</var> value; <FALSE/> otherwise.
90cdf0e10cSrcweir          */
91cdf0e10cSrcweir         static sal_Bool matchSpecialTarget(const ::rtl::OUString& sCheckTarget  ,
92cdf0e10cSrcweir                                                  ESpecialTarget   eSpecialTarget);
93cdf0e10cSrcweir 
94cdf0e10cSrcweir         //___________________________________________
95cdf0e10cSrcweir 
96cdf0e10cSrcweir         /** @short  it checks, if the given name can be used
97cdf0e10cSrcweir                     to set it at a frame using XFrame.setName() method.
98cdf0e10cSrcweir 
99cdf0e10cSrcweir             @descr  Because we handle special targets in a hard coded way
100cdf0e10cSrcweir                     (means we do not check the real name of a frame then)
101cdf0e10cSrcweir                     such named frames will never be found!
102cdf0e10cSrcweir 
103cdf0e10cSrcweir                     And in case such special names can exists one times only
104cdf0e10cSrcweir                     by definition inside the same frame tree (e.g. _beamer and
105cdf0e10cSrcweir                     OFFICE_HELP_TASK) its not a good idea to allow anything here :-)
106cdf0e10cSrcweir 
107036fea61SDamjan Jovanovic                     Of course we can't check unknown names, which are not special ones.
108cdf0e10cSrcweir                     But we decide, that it's not allowed to use "_" as first sign
109cdf0e10cSrcweir                     (because we reserve this letter for our own purposes!)
110cdf0e10cSrcweir                     and the value must not a well known special target.
111cdf0e10cSrcweir 
112cdf0e10cSrcweir             @param  sName
11330acf5e8Spfg                     the new frame name, which should be checked.
114cdf0e10cSrcweir          */
115cdf0e10cSrcweir         static sal_Bool isValidNameForFrame(const ::rtl::OUString& sName);
116cdf0e10cSrcweir };
117cdf0e10cSrcweir 
118cdf0e10cSrcweir } // namespace framework
119cdf0e10cSrcweir 
120cdf0e10cSrcweir #endif // #ifndef __FRAMEWORK_TARGETHELPER_HXX_
121