Branch data Line data Source code
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 : :
20 : :
21 : : #include "AccessibleGlobal.hxx"
22 : :
23 : : using ::com::sun::star::uno::RuntimeException;
24 : : using ::com::sun::star::uno::Reference;
25 : : using ::com::sun::star::uno::Sequence;
26 : : using ::std::set;
27 : :
28 [ # # ]: 0 : ScAccessibleStateSet::ScAccessibleStateSet()
29 : : {
30 : 0 : }
31 : :
32 : 0 : ScAccessibleStateSet::~ScAccessibleStateSet()
33 : : {
34 [ # # ]: 0 : }
35 : :
36 : : // XAccessibleStateSet
37 : :
38 : 0 : sal_Bool SAL_CALL ScAccessibleStateSet::isEmpty() throw (RuntimeException)
39 : : {
40 : 0 : return maStates.empty();
41 : : }
42 : :
43 : 0 : sal_Bool SAL_CALL ScAccessibleStateSet::contains(sal_Int16 nState)
44 : : throw (RuntimeException)
45 : : {
46 : 0 : return maStates.count(nState) != 0;
47 : : }
48 : :
49 : 0 : sal_Bool SAL_CALL ScAccessibleStateSet::containsAll(
50 : : const Sequence<sal_Int16>& aStateSet) throw (RuntimeException)
51 : : {
52 : 0 : sal_Int32 n = aStateSet.getLength();
53 [ # # ]: 0 : for (sal_Int32 i = 0; i < n; ++i)
54 : : {
55 [ # # ]: 0 : if (!maStates.count(aStateSet[i]))
56 : : // This state is not set.
57 : 0 : return false;
58 : : }
59 : : // All specified states are set.
60 : 0 : return true;
61 : : }
62 : :
63 : 0 : Sequence<sal_Int16> SAL_CALL ScAccessibleStateSet::getStates()
64 : : throw (RuntimeException)
65 : : {
66 [ # # ]: 0 : Sequence<sal_Int16> aSeq(0);
67 : 0 : set<sal_Int16>::const_iterator itr = maStates.begin(), itrEnd = maStates.end();
68 [ # # ][ # # ]: 0 : for (size_t i = 0; itr != itrEnd; ++itr, ++i)
[ # # ]
69 : : {
70 [ # # ]: 0 : aSeq.realloc(i+1);
71 [ # # ][ # # ]: 0 : aSeq[i] = *itr;
72 : : }
73 : 0 : return aSeq;
74 : : }
75 : :
76 : 0 : void ScAccessibleStateSet::insert(sal_Int16 nState)
77 : : {
78 : 0 : maStates.insert(nState);
79 : 0 : }
80 : :
81 : 0 : void ScAccessibleStateSet::clear()
82 : : {
83 : 0 : maStates.clear();
84 : 0 : }
85 : :
86 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|