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 #ifndef _UINUMS_HXX
24 #define _UINUMS_HXX
25
26 #include <svl/svarray.hxx>
27 #include <numrule.hxx>
28 #include "swdllapi.h"
29
30 class SfxPoolItem;
31 class SwWrtShell;
32 class SvStream;
33
34 #define MAX_NUM_RULES 9
35
36 typedef SfxPoolItem* SfxPoolItemPtr;
37 SV_DECL_PTRARR_DEL( _SwNumFmtsAttrs, SfxPoolItemPtr, 5,0 )
38
39 //------------------------------------------------------------------------
40 class SW_DLLPUBLIC SwNumRulesWithName
41 {
42 String aName;
43 // die Formate der NumRule muessen! unabhaengig von einem Document sein
44 // (Sie sollen immer vorhanden sein!)
45 class SW_DLLPRIVATE _SwNumFmtGlobal
46 {
47 SwNumFmt aFmt;
48 String sCharFmtName;
49 sal_uInt16 nCharPoolId;
50 _SwNumFmtsAttrs aItems;
51
52 _SwNumFmtGlobal& operator=( const _SwNumFmtGlobal& );
53
54 public:
55 _SwNumFmtGlobal( const SwNumFmt& rFmt );
56 _SwNumFmtGlobal( const _SwNumFmtGlobal& );
57 _SwNumFmtGlobal( SvStream&, sal_uInt16 nVersion );
58 ~_SwNumFmtGlobal();
59
60 void Store( SvStream& );
61 void ChgNumFmt( SwWrtShell& rSh, SwNumFmt& rChg ) const;
62 };
63
64 _SwNumFmtGlobal* aFmts[ MAXLEVEL ];
65
66 protected:
SetName(const String & rSet)67 void SetName(const String& rSet) {aName = rSet;}
68
69 public:
70 SwNumRulesWithName(const SwNumRule &, const String &);
71 SwNumRulesWithName( const SwNumRulesWithName & );
72 SwNumRulesWithName(SvStream &, sal_uInt16 nVersion);
73 ~SwNumRulesWithName();
74
75 const SwNumRulesWithName &operator=(const SwNumRulesWithName &);
76
GetName() const77 const String& GetName() const { return aName; }
78 void MakeNumRule( SwWrtShell& rSh, SwNumRule& rChg ) const;
79
80 void Store( SvStream& );
81 };
82 /********************************************************************
83
84 ********************************************************************/
85 class SwBaseNumRules
86 {
87 public:
88 enum { nMaxRules = MAX_NUM_RULES }; // zur Zeit 9 definierte Forms
89 protected:
90 SwNumRulesWithName *pNumRules[ MAX_NUM_RULES ];
91 String sFileName;
92 sal_uInt16 nVersion;
93 sal_Bool bModified;
94
95 virtual int Load(SvStream&);
96 virtual sal_Bool Store(SvStream&);
97
98 void Init();
99
100 public:
101 SwBaseNumRules(const String& rFileName);
102 virtual ~SwBaseNumRules();
103
104 inline const SwNumRulesWithName* GetRules(sal_uInt16 nIdx) const;
105 virtual void ApplyNumRules(
106 const SwNumRulesWithName &rCopy,
107 sal_uInt16 nIdx);
108
109 };
110
111 /********************************************************************
112
113 ********************************************************************/
114 class SwChapterNumRules : public SwBaseNumRules
115 {
116
117 public:
118 SwChapterNumRules();
119 virtual ~SwChapterNumRules();
120
121 virtual void ApplyNumRules( const SwNumRulesWithName &rCopy,
122 sal_uInt16 nIdx);
123 };
124
125 // INLINE METHODE --------------------------------------------------------
GetRules(sal_uInt16 nIdx) const126 inline const SwNumRulesWithName *SwBaseNumRules::GetRules(sal_uInt16 nIdx) const
127 {
128 ASSERT(nIdx < nMaxRules, Array der NumRules ueberindiziert.);
129 return pNumRules[nIdx];
130 }
131
132 #endif
133