LibreOffice Module svl (master) 1
itemiter.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
20#include <svl/itemiter.hxx>
21#include <svl/itemset.hxx>
22
24 : m_rSet(rItemSet)
25{
26 if (!m_rSet.m_nCount)
27 {
28 m_nStart = 0;
29 m_nEnd = 0;
30 }
31 else
32 {
33 SfxPoolItem const** ppFnd = m_rSet.m_ppItems;
34
35 // Find the first Item that is set
36 for (m_nStart = 0; !*(ppFnd + m_nStart); ++m_nStart)
37 ; // empty loop
38 if (1 < m_rSet.Count())
39 for (m_nEnd = m_rSet.TotalCount(); !*(ppFnd + --m_nEnd);)
40 ; // empty loop
41 else
43 }
44
46}
47
48// Precondition : m_nCurrent < m_nEnd
50{
51 SfxPoolItem const** ppFnd = m_rSet.m_ppItems;
52 do
53 {
54 m_nCurrent++;
55 } while (m_nCurrent < m_nEnd && !*(ppFnd + m_nCurrent));
56 return *(ppFnd + m_nCurrent);
57}
58
59SfxItemState SfxItemIter::GetItemState(bool bSrchInParent, const SfxPoolItem** ppItem) const
60{
61 sal_uInt16 nWhich = (*(m_rSet.m_ppItems + m_nCurrent))->Which();
62 return m_rSet.GetItemStateImpl(nWhich, bSrchInParent, ppItem, m_nCurrent);
63}
64
66{
67 sal_uInt16 nWhich = (*(m_rSet.m_ppItems + m_nCurrent))->Which();
68 const_cast<SfxItemSet&>(m_rSet).ClearSingleItemImpl(nWhich, m_nCurrent);
69}
70
71/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 m_nStart
Definition: itemiter.hxx:30
void ClearItem()
Definition: itemiter.cxx:65
const SfxPoolItem * ImplNextItem()
Definition: itemiter.cxx:49
SfxItemIter(const SfxItemSet &rSet)
Definition: itemiter.cxx:23
sal_uInt16 m_nCurrent
Definition: itemiter.hxx:32
SfxItemState GetItemState(bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: itemiter.cxx:59
const SfxItemSet & m_rSet
Definition: itemiter.hxx:29
sal_uInt16 m_nEnd
Definition: itemiter.hxx:31
sal_uInt16 Count() const
Definition: itemset.hxx:95
sal_uInt16 TotalCount() const
Definition: itemset.cxx:851
SfxItemState GetItemStateImpl(sal_uInt16 nWhich, bool bSrchInParent, const SfxPoolItem **ppItem, std::optional< sal_uInt16 > oItemsOffsetHint) const
Definition: itemset.cxx:328
SfxPoolItem const ** m_ppItems
pointer to array of items, we allocate and free this unless m_bItemsFixed==true
Definition: itemset.hxx:43
sal_uInt16 m_nCount
number of items
Definition: itemset.hxx:45
SfxItemState
These values have to match the values in the css::frame::status::ItemState IDL to be found at offapi/...
Definition: poolitem.hxx:82