LibreOffice Module chart2 (master) 1
ItemConverter.hxx
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#pragma once
20
22#include <svl/itemset.hxx>
23
24#include <utility>
25
26namespace com::sun::star::beans { class XPropertySet; }
27namespace com::sun::star::beans { class XPropertySetInfo; }
28
29namespace chart::wrapper {
30
31
70{
71public:
76 css::uno::Reference< css::beans::XPropertySet > xPropertySet ,
77 SfxItemPool& rItemPool );
78 virtual ~ItemConverter() override;
79
80 typedef sal_uInt16 tWhichIdType;
81 typedef OUString tPropertyNameType;
83
84 typedef std::pair< tPropertyNameType, tMemberIdType > tPropertyNameWithMemberId;
85
95 virtual void FillItemSet( SfxItemSet & rOutItemSet ) const;
96
104 virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
105
111
115 static void InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItemSet &rSourceSet );
116
117protected:
118
121 virtual const WhichRangesContainer& GetWhichPairs() const = 0;
122
131 virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const = 0;
132
142 virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const;
143
155 virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet );
156
159
163 const css::uno::Reference< css::beans::XPropertySet >& GetPropertySet() const { return m_xPropertySet;}
164
165 // ____ ::utl::OEventListenerAdapter ____
166 virtual void _disposing( const css::lang::EventObject& rSource ) override;
167
168protected:
174 void resetPropertySet( const css::uno::Reference< css::beans::XPropertySet > & xPropSet );
175
176private:
177 css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
178 css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo;
179
181};
182
183}
184
185/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class serves for conversion between properties of an XPropertySet and SfxItems in SfxItemSets.
virtual const WhichRangesContainer & GetWhichPairs() const =0
implement this method to provide an array of which-ranges
void resetPropertySet(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
sets a new property set, that you get with GetPropertySet().
virtual void FillItemSet(SfxItemSet &rOutItemSet) const
applies all properties that can be mapped to items into the given item set.
css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo
virtual bool ApplySpecialItem(sal_uInt16 nWhichId, const SfxItemSet &rItemSet)
for items that can not be mapped directly to a property.
std::pair< tPropertyNameType, tMemberIdType > tPropertyNameWithMemberId
static void InvalidateUnequalItems(SfxItemSet &rDestSet, const SfxItemSet &rSourceSet)
Invalidates all items in rDestSet, that are set (state SfxItemState::SET) in both item sets (rDestSet...
css::uno::Reference< css::beans::XPropertySet > m_xPropertySet
SfxItemPool & GetItemPool() const
Returns the pool.
virtual void _disposing(const css::lang::EventObject &rSource) override
virtual bool GetItemProperty(tWhichIdType nWhichId, tPropertyNameWithMemberId &rOutProperty) const =0
implement this method to return a Property object for a given which id.
const css::uno::Reference< css::beans::XPropertySet > & GetPropertySet() const
Returns the XPropertySet that was given in the CTOR and is used to apply items in ApplyItemSet().
virtual bool ApplyItemSet(const SfxItemSet &rItemSet)
applies all properties that are results of a conversion from all items in rItemSet to the internal XP...
ItemConverter(css::uno::Reference< css::beans::XPropertySet > xPropertySet, SfxItemPool &rItemPool)
Construct an item converter that uses the given property set for reading/writing converted items.
virtual void FillSpecialItem(sal_uInt16 nWhichId, SfxItemSet &rOutItemSet) const
for items that can not be mapped directly to a property.
SfxItemSet CreateEmptyItemSet() const
creates an empty item set using the given pool or a common pool if empty (see GetItemPool) and allowi...
virtual ~ItemConverter() override
class SAL_NO_VTABLE XPropertySet
unsigned char sal_uInt8