1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "AccessibleGlobal.hxx"
22 using ::com::sun::star::uno::RuntimeException
;
23 using ::com::sun::star::uno::Reference
;
24 using ::com::sun::star::uno::Sequence
;
27 ScAccessibleStateSet::ScAccessibleStateSet()
31 ScAccessibleStateSet::~ScAccessibleStateSet()
35 // XAccessibleStateSet
37 sal_Bool SAL_CALL
ScAccessibleStateSet::isEmpty() throw (RuntimeException
, std::exception
)
39 return maStates
.empty();
42 sal_Bool SAL_CALL
ScAccessibleStateSet::contains(sal_Int16 nState
)
43 throw (RuntimeException
, std::exception
)
45 return maStates
.count(nState
) != 0;
48 sal_Bool SAL_CALL
ScAccessibleStateSet::containsAll(
49 const Sequence
<sal_Int16
>& aStateSet
) throw (RuntimeException
, std::exception
)
51 sal_Int32 n
= aStateSet
.getLength();
52 for (sal_Int32 i
= 0; i
< n
; ++i
)
54 if (!maStates
.count(aStateSet
[i
]))
55 // This state is not set.
58 // All specified states are set.
62 Sequence
<sal_Int16
> SAL_CALL
ScAccessibleStateSet::getStates()
63 throw (RuntimeException
, std::exception
)
65 Sequence
<sal_Int16
> aSeq(0);
66 set
<sal_Int16
>::const_iterator itr
= maStates
.begin(), itrEnd
= maStates
.end();
67 for (size_t i
= 0; itr
!= itrEnd
; ++itr
, ++i
)
75 void ScAccessibleStateSet::insert(sal_Int16 nState
)
77 maStates
.insert(nState
);
80 void ScAccessibleStateSet::clear()
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */