1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xit.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #ifndef _SFXSTRITEM_HXX //autogen
35 #include <bf_svtools/stritem.hxx>
41 /************************************************************************/
43 extern String aNameOrIndexEmptyString
;
45 /************************************************************************/
56 typedef BOOL (*SvxCompareValueFunc
)( const NameOrIndex
* p1
, const NameOrIndex
* p2
);
61 class NameOrIndex
: public SfxStringItem
66 void Detach() { nPalIndex
= -1; }
70 NameOrIndex() { nPalIndex
= -1; }
71 NameOrIndex(USHORT nWhich
, long nIndex
);
72 NameOrIndex(USHORT nWhich
,
73 const String
& rName
= aNameOrIndexEmptyString
);
74 NameOrIndex(USHORT nWhich
, SvStream
& rIn
);
75 NameOrIndex(const NameOrIndex
& rNameOrIndex
);
78 virtual int operator==(const SfxPoolItem
& rItem
) const;
79 virtual SvStream
& Store(SvStream
& rOut
, USHORT nItemVersion
) const;
81 String
GetName() const { return GetValue(); }
82 void SetName(const String
& rName
) { SetValue(rName
); }
83 long GetIndex() const { return nPalIndex
; }
84 void SetIndex(long nIndex
) { nPalIndex
= nIndex
; }
85 BOOL
IsIndex() const { return (nPalIndex
>= 0); }
87 /** this static checks if the given NameOrIndex item has a unique name for its value.
88 The returned String is a unique name for an item with this value in both given pools.
89 Argument pPool2 can be null.
90 If returned string equals NameOrIndex->GetName(), the name was already unique.
92 static String
CheckNamedItem( const NameOrIndex
* pCheckItem
, const sal_uInt16 nWhich
, const SfxItemPool
* pPool1
, const SfxItemPool
* pPool2
, SvxCompareValueFunc pCompareValueFunc
, USHORT nPrefixResId
, XPropertyList
* pDefaults
= NULL
);
95 }//end of namespace binfilter