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 : :
29 : : #ifndef _SVX_XIT_HXX
30 : : #define _SVX_XIT_HXX
31 : :
32 : : #include <svl/stritem.hxx>
33 : : #include <svx/xtable.hxx>
34 : : #include <svx/xdef.hxx>
35 : : #include "svx/svxdllapi.h"
36 : :
37 : : /************************************************************************/
38 : :
39 : : class SfxItemPool;
40 : : class NameOrIndex;
41 : :
42 : : typedef sal_Bool (*SvxCompareValueFunc)( const NameOrIndex* p1, const NameOrIndex* p2 );
43 : :
44 : : //-------------------
45 : : // class NameOrIndex
46 : : //-------------------
47 : : class SVX_DLLPUBLIC NameOrIndex : public SfxStringItem
48 : : {
49 : : sal_Int32 nPalIndex;
50 : :
51 : : protected:
52 : : void Detach() { nPalIndex = -1; }
53 : :
54 : : public:
55 : : TYPEINFO();
56 : 0 : NameOrIndex() { nPalIndex = -1; }
57 : : NameOrIndex(sal_uInt16 nWhich, sal_Int32 nIndex);
58 : : NameOrIndex(sal_uInt16 nWhich,
59 : : const String& rName= String());
60 : : NameOrIndex(sal_uInt16 nWhich, SvStream& rIn);
61 : : NameOrIndex(const NameOrIndex& rNameOrIndex);
62 [ - + ]: 11023 : ~NameOrIndex() {};
63 : :
64 : : virtual int operator==(const SfxPoolItem& rItem) const;
65 : : virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
66 : : virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
67 : : virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const;
68 : :
69 : 207 : String GetName() const { return GetValue(); }
70 : : void SetName(const String& rName) { SetValue(rName); }
71 : : sal_Int32 GetIndex() const { return nPalIndex; }
72 : : void SetIndex(sal_Int32 nIndex) { nPalIndex = nIndex; }
73 : : sal_Bool IsIndex() const { return (nPalIndex >= 0); }
74 : :
75 : : /** this static checks if the given NameOrIndex item has a unique name for its value.
76 : : The returned String is a unique name for an item with this value in both given pools.
77 : : Argument pPool2 can be null.
78 : : If returned string equals NameOrIndex->GetName(), the name was already unique.
79 : : */
80 : : static String CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* pPool2, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, const XPropertyListRef &pDefaults );
81 : : };
82 : :
83 : : #endif
84 : :
85 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|