1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*1d2dbeb0SAndrew Rist * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist *
11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist *
13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the
17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist * under the License.
19*1d2dbeb0SAndrew Rist *
20*1d2dbeb0SAndrew Rist *************************************************************/
21*1d2dbeb0SAndrew Rist
22*1d2dbeb0SAndrew Rist
23cdf0e10cSrcweir #ifndef _UINUMS_HXX
24cdf0e10cSrcweir #define _UINUMS_HXX
25cdf0e10cSrcweir
26cdf0e10cSrcweir #include <svl/svarray.hxx>
27cdf0e10cSrcweir #include <numrule.hxx>
28cdf0e10cSrcweir #include "swdllapi.h"
29cdf0e10cSrcweir
30cdf0e10cSrcweir class SfxPoolItem;
31cdf0e10cSrcweir class SwWrtShell;
32cdf0e10cSrcweir class SvStream;
33cdf0e10cSrcweir
34cdf0e10cSrcweir #define MAX_NUM_RULES 9
35cdf0e10cSrcweir
36cdf0e10cSrcweir typedef SfxPoolItem* SfxPoolItemPtr;
37cdf0e10cSrcweir SV_DECL_PTRARR_DEL( _SwNumFmtsAttrs, SfxPoolItemPtr, 5,0 )
38cdf0e10cSrcweir
39cdf0e10cSrcweir //------------------------------------------------------------------------
40cdf0e10cSrcweir class SW_DLLPUBLIC SwNumRulesWithName
41cdf0e10cSrcweir {
42cdf0e10cSrcweir String aName;
43cdf0e10cSrcweir // die Formate der NumRule muessen! unabhaengig von einem Document sein
44cdf0e10cSrcweir // (Sie sollen immer vorhanden sein!)
45cdf0e10cSrcweir class SW_DLLPRIVATE _SwNumFmtGlobal
46cdf0e10cSrcweir {
47cdf0e10cSrcweir SwNumFmt aFmt;
48cdf0e10cSrcweir String sCharFmtName;
49cdf0e10cSrcweir sal_uInt16 nCharPoolId;
50cdf0e10cSrcweir _SwNumFmtsAttrs aItems;
51cdf0e10cSrcweir
52cdf0e10cSrcweir _SwNumFmtGlobal& operator=( const _SwNumFmtGlobal& );
53cdf0e10cSrcweir
54cdf0e10cSrcweir public:
55cdf0e10cSrcweir _SwNumFmtGlobal( const SwNumFmt& rFmt );
56cdf0e10cSrcweir _SwNumFmtGlobal( const _SwNumFmtGlobal& );
57cdf0e10cSrcweir _SwNumFmtGlobal( SvStream&, sal_uInt16 nVersion );
58cdf0e10cSrcweir ~_SwNumFmtGlobal();
59cdf0e10cSrcweir
60cdf0e10cSrcweir void Store( SvStream& );
61cdf0e10cSrcweir void ChgNumFmt( SwWrtShell& rSh, SwNumFmt& rChg ) const;
62cdf0e10cSrcweir };
63cdf0e10cSrcweir
64cdf0e10cSrcweir _SwNumFmtGlobal* aFmts[ MAXLEVEL ];
65cdf0e10cSrcweir
66cdf0e10cSrcweir protected:
SetName(const String & rSet)67cdf0e10cSrcweir void SetName(const String& rSet) {aName = rSet;}
68cdf0e10cSrcweir
69cdf0e10cSrcweir public:
70cdf0e10cSrcweir SwNumRulesWithName(const SwNumRule &, const String &);
71cdf0e10cSrcweir SwNumRulesWithName( const SwNumRulesWithName & );
72cdf0e10cSrcweir SwNumRulesWithName(SvStream &, sal_uInt16 nVersion);
73cdf0e10cSrcweir ~SwNumRulesWithName();
74cdf0e10cSrcweir
75cdf0e10cSrcweir const SwNumRulesWithName &operator=(const SwNumRulesWithName &);
76cdf0e10cSrcweir
GetName() const77cdf0e10cSrcweir const String& GetName() const { return aName; }
78cdf0e10cSrcweir void MakeNumRule( SwWrtShell& rSh, SwNumRule& rChg ) const;
79cdf0e10cSrcweir
80cdf0e10cSrcweir void Store( SvStream& );
81cdf0e10cSrcweir };
82cdf0e10cSrcweir /********************************************************************
83cdf0e10cSrcweir
84cdf0e10cSrcweir ********************************************************************/
85cdf0e10cSrcweir class SwBaseNumRules
86cdf0e10cSrcweir {
87cdf0e10cSrcweir public:
88cdf0e10cSrcweir enum { nMaxRules = MAX_NUM_RULES }; // zur Zeit 9 definierte Forms
89cdf0e10cSrcweir protected:
90cdf0e10cSrcweir SwNumRulesWithName *pNumRules[ MAX_NUM_RULES ];
91cdf0e10cSrcweir String sFileName;
92cdf0e10cSrcweir sal_uInt16 nVersion;
93cdf0e10cSrcweir sal_Bool bModified;
94cdf0e10cSrcweir
95cdf0e10cSrcweir virtual int Load(SvStream&);
96cdf0e10cSrcweir virtual sal_Bool Store(SvStream&);
97cdf0e10cSrcweir
98cdf0e10cSrcweir void Init();
99cdf0e10cSrcweir
100cdf0e10cSrcweir public:
101cdf0e10cSrcweir SwBaseNumRules(const String& rFileName);
102cdf0e10cSrcweir virtual ~SwBaseNumRules();
103cdf0e10cSrcweir
104cdf0e10cSrcweir inline const SwNumRulesWithName* GetRules(sal_uInt16 nIdx) const;
105cdf0e10cSrcweir virtual void ApplyNumRules(
106cdf0e10cSrcweir const SwNumRulesWithName &rCopy,
107cdf0e10cSrcweir sal_uInt16 nIdx);
108cdf0e10cSrcweir
109cdf0e10cSrcweir };
110cdf0e10cSrcweir
111cdf0e10cSrcweir /********************************************************************
112cdf0e10cSrcweir
113cdf0e10cSrcweir ********************************************************************/
114cdf0e10cSrcweir class SwChapterNumRules : public SwBaseNumRules
115cdf0e10cSrcweir {
116cdf0e10cSrcweir
117cdf0e10cSrcweir public:
118cdf0e10cSrcweir SwChapterNumRules();
119cdf0e10cSrcweir virtual ~SwChapterNumRules();
120cdf0e10cSrcweir
121cdf0e10cSrcweir virtual void ApplyNumRules( const SwNumRulesWithName &rCopy,
122cdf0e10cSrcweir sal_uInt16 nIdx);
123cdf0e10cSrcweir };
124cdf0e10cSrcweir
125cdf0e10cSrcweir // INLINE METHODE --------------------------------------------------------
GetRules(sal_uInt16 nIdx) const126cdf0e10cSrcweir inline const SwNumRulesWithName *SwBaseNumRules::GetRules(sal_uInt16 nIdx) const
127cdf0e10cSrcweir {
128cdf0e10cSrcweir ASSERT(nIdx < nMaxRules, Array der NumRules ueberindiziert.);
129cdf0e10cSrcweir return pNumRules[nIdx];
130cdf0e10cSrcweir }
131cdf0e10cSrcweir
132cdf0e10cSrcweir #endif
133