Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / framework / source / loadenv / targethelper.cxx
blobaab509b0fc6d421613248fd309b22f0cd92e9fa6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <loadenv/targethelper.hxx>
21 #include <targets.h>
23 namespace framework{
25 bool TargetHelper::matchSpecialTarget(const OUString& sCheckTarget ,
26 ESpecialTarget eSpecialTarget)
28 switch(eSpecialTarget)
30 case ESpecialTarget::Blank :
31 return sCheckTarget == SPECIALTARGET_BLANK;
33 case ESpecialTarget::Default :
34 return sCheckTarget == SPECIALTARGET_DEFAULT;
36 case ESpecialTarget::Beamer :
37 return sCheckTarget == SPECIALTARGET_BEAMER;
39 case ESpecialTarget::HelpTask :
40 return sCheckTarget == SPECIALTARGET_HELPTASK;
41 default:
42 return false;
46 bool TargetHelper::isValidNameForFrame(const OUString& sName)
48 // some special targets are really special ones :-)
49 // E.g. the are really used to locate one frame inside the frame tree.
50 if (
51 (sName.isEmpty() ) ||
52 (TargetHelper::matchSpecialTarget(sName, ESpecialTarget::HelpTask)) ||
53 (TargetHelper::matchSpecialTarget(sName, ESpecialTarget::Beamer) )
55 return true;
57 // all other names must be checked more general
58 // special targets starts with a "_".
59 return (sName.indexOf('_') != 0);
62 } // namespace framework
64 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */