Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _OFF_OFAITEM_HXX
29 : : #define _OFF_OFAITEM_HXX
30 : :
31 : : #include <svl/poolitem.hxx>
32 : : #include <rtl/ref.hxx>
33 : : #include "svx/svxdllapi.h"
34 : :
35 : : // class OfaPtrItem ------------------------------------------------------
36 : :
37 [ # # ]: 0 : class SVX_DLLPUBLIC OfaPtrItem : public SfxPoolItem
38 : : {
39 : : private:
40 : : void* pPtr;
41 : :
42 : : public:
43 : : OfaPtrItem( sal_uInt16 nWhich, void *pPtr );
44 : : OfaPtrItem( const OfaPtrItem& );
45 : :
46 : : virtual int operator==( const SfxPoolItem& ) const;
47 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
48 : :
49 : 0 : void* GetValue() const { return pPtr; }
50 : : void SetValue( void* pNewPtr ) { pPtr = pNewPtr; }
51 : : };
52 : :
53 : : // class OfaRefItem - for ref counting items
54 : :
55 : : template <class reference_type>
56 [ # # ]: 0 : class OfaRefItem : public SfxPoolItem
57 : : {
58 : : private:
59 : : rtl::Reference<reference_type> mxRef;
60 : : public:
61 : 0 : OfaRefItem( sal_uInt16 _nWhich, const rtl::Reference<reference_type> &xRef )
62 : 0 : : SfxPoolItem( _nWhich ), mxRef( xRef )
63 : 0 : {}
64 : 0 : OfaRefItem( const OfaRefItem& rItem )
65 : 0 : : SfxPoolItem( rItem.Which() ), mxRef( rItem.mxRef )
66 : 0 : {}
67 : 0 : virtual int operator==( const SfxPoolItem& rItem ) const
68 : : {
69 : 0 : return mxRef == ((OfaRefItem<reference_type> &)rItem).mxRef;
70 : : }
71 : 0 : virtual SfxPoolItem*Clone( SfxItemPool* /*pPool = 0*/ ) const
72 : : {
73 [ # # ]: 0 : return new OfaRefItem( *this );
74 : : }
75 : 0 : inline rtl::Reference<reference_type> GetValue() const
76 : : {
77 : 0 : return mxRef;
78 : : }
79 : : inline void SetValue( const rtl::Reference<reference_type> &xRef )
80 : : {
81 : : mxRef = xRef;
82 : : }
83 : : };
84 : :
85 : : #endif
86 : :
87 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|