xref: /aoo41x/main/sw/source/ui/inc/uinums.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _UINUMS_HXX
28 #define _UINUMS_HXX
29 
30 #include <svl/svarray.hxx>
31 #include <numrule.hxx>
32 #include "swdllapi.h"
33 
34 class SfxPoolItem;
35 class SwWrtShell;
36 class SvStream;
37 
38 #define MAX_NUM_RULES 9
39 
40 typedef SfxPoolItem* SfxPoolItemPtr;
41 SV_DECL_PTRARR_DEL( _SwNumFmtsAttrs, SfxPoolItemPtr, 5,0 )
42 
43 //------------------------------------------------------------------------
44 class SW_DLLPUBLIC SwNumRulesWithName
45 {
46 	String aName;
47 	// die Formate der NumRule muessen! unabhaengig von einem Document sein
48 	// (Sie sollen immer vorhanden sein!)
49 	class SW_DLLPRIVATE _SwNumFmtGlobal
50 	{
51 		SwNumFmt aFmt;
52 		String sCharFmtName;
53 		sal_uInt16 nCharPoolId;
54 		_SwNumFmtsAttrs aItems;
55 
56 		_SwNumFmtGlobal& operator=( const _SwNumFmtGlobal& );
57 
58 	public:
59 		_SwNumFmtGlobal( const SwNumFmt& rFmt );
60 		_SwNumFmtGlobal( const _SwNumFmtGlobal& );
61 		_SwNumFmtGlobal( SvStream&, sal_uInt16 nVersion );
62 		~_SwNumFmtGlobal();
63 
64 		void Store( SvStream& );
65 		void ChgNumFmt( SwWrtShell& rSh, SwNumFmt& rChg ) const;
66 	};
67 
68 	_SwNumFmtGlobal* aFmts[ MAXLEVEL ];
69 
70 protected:
71 	void SetName(const String& rSet) {aName = rSet;}
72 
73 public:
74 	SwNumRulesWithName(const SwNumRule &, const String &);
75 	SwNumRulesWithName( const SwNumRulesWithName & );
76 	SwNumRulesWithName(SvStream &, sal_uInt16 nVersion);
77 	~SwNumRulesWithName();
78 
79 	const SwNumRulesWithName &operator=(const SwNumRulesWithName &);
80 
81 	const String& GetName() const 				{ return aName; }
82 	void MakeNumRule( SwWrtShell& rSh, SwNumRule& rChg ) const;
83 
84 	void Store( SvStream& );
85 };
86 /********************************************************************
87 
88 ********************************************************************/
89 class SwBaseNumRules
90 {
91 public:
92 	enum { nMaxRules = MAX_NUM_RULES };			// zur Zeit 9 definierte Forms
93 protected:
94 	SwNumRulesWithName 	*pNumRules[ MAX_NUM_RULES ];
95 	String 				sFileName;
96 	sal_uInt16 				nVersion;
97  	sal_Bool 				bModified;
98 
99 	virtual int     	Load(SvStream&);
100 	virtual sal_Bool    	Store(SvStream&);
101 
102 	void 				Init();
103 
104 public:
105 	SwBaseNumRules(const String& rFileName);
106 	virtual ~SwBaseNumRules();
107 
108 	inline const SwNumRulesWithName*	GetRules(sal_uInt16 nIdx) const;
109 	virtual void 						ApplyNumRules(
110 												const SwNumRulesWithName &rCopy,
111 												sal_uInt16 nIdx);
112 
113 };
114 
115 /********************************************************************
116 
117 ********************************************************************/
118 class SwChapterNumRules : public SwBaseNumRules
119 {
120 
121 public:
122 	SwChapterNumRules();
123 	virtual ~SwChapterNumRules();
124 
125 	virtual void 		ApplyNumRules(	const SwNumRulesWithName &rCopy,
126 											sal_uInt16 nIdx);
127 };
128 
129 // INLINE METHODE --------------------------------------------------------
130 inline const SwNumRulesWithName *SwBaseNumRules::GetRules(sal_uInt16 nIdx) const
131 {
132 	ASSERT(nIdx < nMaxRules, Array der NumRules ueberindiziert.);
133 	return pNumRules[nIdx];
134 }
135 
136 #endif
137