fix build
[LibreOffice.git] / include / svx / unopool.hxx
blob01269e6fd844b7849f63d7d2785d9e8e732a3d4a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #ifndef INCLUDED_SVX_UNOPOOL_HXX
21 #define INCLUDED_SVX_UNOPOOL_HXX
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <comphelper/propertysethelper.hxx>
25 #include <comphelper/compbase.hxx>
26 #include <svx/svxdllapi.h>
27 #include <svl/itempool.hxx>
29 class SdrModel;
30 class SfxItemPool;
32 /** This class implements the service com.sun.star.drawing.Defaults.
33 It works on the SfxItemPool from the given model and the global
34 draw object item pool.
35 The class can work in a read only mode without a model. Derivated
36 classes can set a model on demand by overriding getModelPool().
38 typedef ::comphelper::WeakComponentImplHelper<css::lang::XServiceInfo> SvxUnoDrawPool_Base;
40 class SVX_DLLPUBLIC SvxUnoDrawPool : public SvxUnoDrawPool_Base,
41 public comphelper::PropertySetHelper
43 public:
44 SvxUnoDrawPool(SdrModel* pModel, rtl::Reference<comphelper::PropertySetInfo> const & xDefaults);
46 virtual ~SvxUnoDrawPool() noexcept override;
48 /** This returns the item pool from the given model, or the default pool if there is no model and bReadOnly is true.
49 If bReadOnly is false and there is no model the default implementation returns NULL.
51 virtual SfxItemPool* getModelPool( bool bReadOnly ) noexcept;
53 // overridden helpers from comphelper::PropertySetHelper
54 virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const css::uno::Any* pValues ) override;
55 virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, css::uno::Any* pValue ) override;
57 virtual void _getPropertyStates( const comphelper::PropertyMapEntry** ppEntries, css::beans::PropertyState* pStates ) override;
58 virtual void _setPropertyToDefault( const comphelper::PropertyMapEntry* pEntry ) override;
59 virtual css::uno::Any _getPropertyDefault( const comphelper::PropertyMapEntry* pEntry ) override;
61 // XInterface
62 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
63 virtual void SAL_CALL acquire() noexcept override
64 { OWeakObject::acquire(); }
65 virtual void SAL_CALL release() noexcept override
66 { OWeakObject::release(); }
68 // XTypeProvider
69 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
70 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
72 // XServiceInfo
73 virtual OUString SAL_CALL getImplementationName() override;
74 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
75 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
77 protected:
78 void init();
80 /// @throws css::beans::UnknownPropertyException
81 static void getAny( SfxItemPool const * pPool, const comphelper::PropertyMapEntry* pEntry, css::uno::Any& rValue );
82 /// @throws css::beans::UnknownPropertyException
83 /// @throws css::lang::IllegalArgumentException
84 /// @throws css::uno::RuntimeException
85 virtual void putAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, const css::uno::Any& rValue );
87 private:
88 SdrModel* mpModel;
89 rtl::Reference<SfxItemPool> mpDefaultsPool;
92 #endif
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */