LibreOffice Module framework (master) 1
targethelper.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
21#include <targets.h>
22
23namespace framework{
24
25bool TargetHelper::matchSpecialTarget(std::u16string_view sCheckTarget ,
26 ESpecialTarget eSpecialTarget)
27{
28 switch(eSpecialTarget)
29 {
31 return sCheckTarget == SPECIALTARGET_BLANK;
32
34 return sCheckTarget == SPECIALTARGET_DEFAULT;
35
37 return sCheckTarget == SPECIALTARGET_BEAMER;
38
40 return sCheckTarget == SPECIALTARGET_HELPTASK;
41 default:
42 return false;
43 }
44}
45
46bool TargetHelper::isValidNameForFrame(std::u16string_view sName)
47{
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.empty() ) ||
54 )
55 return true;
56
57 // all other names must be checked more general
58 // special targets starts with a "_".
59 return (sName.find('_') != 0);
60}
61
62} // namespace framework
63
64/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool matchSpecialTarget(std::u16string_view sCheckTarget, ESpecialTarget eSpecialTarget)
it checks the given unknown target name, if it's the expected special one.
static bool isValidNameForFrame(std::u16string_view sName)
it checks, if the given name can be used to set it at a frame using XFrame.setName() method.
ESpecialTarget
it's used at the following interfaces to classify target names.
OUString sName
constexpr OUStringLiteral SPECIALTARGET_BEAMER
Definition: targets.h:33
constexpr OUStringLiteral SPECIALTARGET_BLANK
Definition: targets.h:31
constexpr OUStringLiteral SPECIALTARGET_DEFAULT
Definition: targets.h:32
constexpr OUStringLiteral SPECIALTARGET_HELPTASK
Definition: targets.h:34