merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / Accessibility / AccessibleGlobal.cxx
blobf37bd4be3201ad0ec99c5f62a4d8b03adb72824e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AccessibleDataPilotControl.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_sc.hxx"
34 #include "AccessibleGlobal.hxx"
36 using ::com::sun::star::uno::RuntimeException;
37 using ::com::sun::star::uno::Reference;
38 using ::com::sun::star::uno::Sequence;
39 using ::std::set;
41 ScAccessibleStateSet::ScAccessibleStateSet()
45 ScAccessibleStateSet::~ScAccessibleStateSet()
49 // XAccessibleStateSet
51 sal_Bool SAL_CALL ScAccessibleStateSet::isEmpty() throw (RuntimeException)
53 return maStates.empty();
56 sal_Bool SAL_CALL ScAccessibleStateSet::contains(sal_Int16 nState)
57 throw (RuntimeException)
59 return maStates.count(nState) != 0;
62 sal_Bool SAL_CALL ScAccessibleStateSet::containsAll(
63 const Sequence<sal_Int16>& aStateSet) throw (RuntimeException)
65 sal_Int32 n = aStateSet.getLength();
66 for (sal_Int32 i = 0; i < n; ++i)
68 if (!maStates.count(aStateSet[i]))
69 // This state is not set.
70 return false;
72 // All specified states are set.
73 return true;
76 Sequence<sal_Int16> SAL_CALL ScAccessibleStateSet::getStates()
77 throw (RuntimeException)
79 Sequence<sal_Int16> aSeq(0);
80 set<sal_Int16>::const_iterator itr = maStates.begin(), itrEnd = maStates.end();
81 for (size_t i = 0; itr != itrEnd; ++itr, ++i)
83 aSeq.realloc(i+1);
84 aSeq[i] = *itr;
86 return aSeq;
89 void ScAccessibleStateSet::insert(sal_Int16 nState)
91 maStates.insert(nState);
94 void ScAccessibleStateSet::clear()
96 maStates.clear();