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