LibreOffice Module svl (master) 1
whiter.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/itemset.hxx>
21#include <svl/whiter.hxx>
22
24 : m_rItemSet(rSet)
25 , m_pCurrentWhichPair(rSet.m_pWhichRanges.begin())
26 , m_nOffsetFromStartOfCurrentWhichPair(0)
27 , m_nItemsOffset(0)
28{
29}
30
31sal_uInt16 SfxWhichIter::GetCurWhich() const
32{
34 if (m_pCurrentWhichPair >= (rWhichRanges.begin() + rWhichRanges.size()))
35 return 0;
37}
38
40{
42 if (m_pCurrentWhichPair >= (rWhichRanges.begin() + rWhichRanges.size()))
43 return 0;
44
45 const sal_uInt16 nLastWhich = m_pCurrentWhichPair->first + m_nOffsetFromStartOfCurrentWhichPair;
47 if (m_pCurrentWhichPair->second == nLastWhich)
48 {
52 }
53 if (m_pCurrentWhichPair >= (rWhichRanges.begin() + rWhichRanges.size()))
54 return 0;
56}
57
59{
63 return m_pCurrentWhichPair->first;
64}
65
66SfxItemState SfxWhichIter::GetItemState(bool bSrchInParent, const SfxPoolItem** ppItem) const
67{
69 sal_uInt16 nItemsOffsetHint = m_nItemsOffset + m_nOffsetFromStartOfCurrentWhichPair;
70 return m_rItemSet.GetItemStateImpl(nWhich, bSrchInParent, ppItem, nItemsOffsetHint);
71}
72
74{
76 sal_uInt16 nItemOffsetHint = m_nItemsOffset + m_nOffsetFromStartOfCurrentWhichPair;
77 const_cast<SfxItemSet&>(m_rItemSet).ClearSingleItemImpl(nWhich, nItemOffsetHint);
78}
79
80/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxItemState GetItemStateImpl(sal_uInt16 nWhich, bool bSrchInParent, const SfxPoolItem **ppItem, std::optional< sal_uInt16 > oItemsOffsetHint) const
Definition: itemset.cxx:328
WhichRangesContainer m_pWhichRanges
array of Which Ranges
Definition: itemset.hxx:44
SfxWhichIter(const SfxItemSet &rSet)
Definition: whiter.cxx:23
sal_uInt16 FirstWhich()
Definition: whiter.cxx:58
sal_uInt16 GetCurWhich() const
Definition: whiter.cxx:31
SfxItemState GetItemState(bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: whiter.cxx:66
const SfxItemSet & m_rItemSet
Definition: whiter.hxx:35
void ClearItem()
Definition: whiter.cxx:73
sal_uInt16 m_nOffsetFromStartOfCurrentWhichPair
Definition: whiter.hxx:37
sal_uInt16 m_nItemsOffset
Offset into m_ppItems array in SfxItemSet.
Definition: whiter.hxx:39
const WhichPair * m_pCurrentWhichPair
Definition: whiter.hxx:36
sal_uInt16 NextWhich()
Definition: whiter.cxx:39
enumrange< T >::Iterator begin(enumrange< T >)
SfxItemState
These values have to match the values in the css::frame::status::ItemState IDL to be found at offapi/...
Definition: poolitem.hxx:82
static SfxItemSet & rSet
Most of the time, the which ranges we point at are a compile-time literal.
Definition: whichranges.hxx:79
sal_Int32 size() const noexcept
const_iterator begin() const noexcept