xref: /trunk/main/svx/inc/svx/xit.hxx (revision c7be74b1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVX_XIT_HXX
25 #define _SVX_XIT_HXX
26 
27 #include <svl/stritem.hxx>
28 #include <svx/xdef.hxx>
29 #include "svx/svxdllapi.h"
30 
31 /************************************************************************/
32 
33 class XDashList;
34 class XLineEndList;
35 class XHatchList;
36 class XBitmapList;
37 class XGradientList;
38 class SfxItemPool;
39 class NameOrIndex;
40 class XPropertyList;
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:
Detach()52 	void    Detach()    { nPalIndex = -1; }
53 
54 public:
55 			TYPEINFO();
NameOrIndex()56 			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);
~NameOrIndex()62 		   ~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 
GetName() const69 			String       GetName() const              { return GetValue();   }
SetName(const String & rName)70 			void         SetName(const String& rName) { SetValue(rName);     }
GetIndex() const71 			sal_Int32        GetIndex() const             { return nPalIndex;    }
SetIndex(sal_Int32 nIndex)72 			void         SetIndex(sal_Int32 nIndex)        { nPalIndex = nIndex;  }
IsIndex() const73 			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, XPropertyList* pDefaults = NULL );
81 };
82 
83 #endif
84