xref: /aoo4110/main/sw/inc/chpfld.hxx (revision b1cdbd2c)
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 SW_CHPFLD_HXX
24 #define SW_CHPFLD_HXX
25 
26 #include "fldbas.hxx"
27 
28 
29 class SwFrm;
30 class SwCntntNode;
31 class SwTxtNode;
32 
33 
34 enum SwChapterFormat
35 {
36 	CF_BEGIN,
37 	CF_NUMBER = CF_BEGIN,		// nur die Kapitelnummer
38 	CF_TITLE,					// nur die "Ueberschrift"
39 	CF_NUM_TITLE,				// Kapitelnummer und "Ueberschrift"
40 	CF_NUMBER_NOPREPST,			// nur die Kapitelnummer ohne Post/Prefix
41 	CF_NUM_NOPREPST_TITLE,		// Kapitelnummer ohne Post/Prefix und "Ueberschrift"
42 	CF_END
43 };
44 
45 /*--------------------------------------------------------------------
46 	Beschreibung: Kapitel
47  --------------------------------------------------------------------*/
48 
49 class SwChapterFieldType : public SwFieldType
50 {
51 public:
52 	SwChapterFieldType();
53 
54 	virtual SwFieldType*	Copy() const;
55 
56 };
57 
58 
59 
60 /*--------------------------------------------------------------------
61 	Beschreibung: Kapitelnummer
62  --------------------------------------------------------------------*/
63 class SW_DLLPUBLIC SwChapterField : public SwField
64 {
65 	friend class SwChapterFieldType;
66 	sal_uInt8 nLevel;
67 	String sTitle, sNumber, sPre, sPost;
68 
69     virtual String   Expand() const;
70     virtual SwField* Copy() const;
71 
72 public:
73 	SwChapterField(SwChapterFieldType*, sal_uInt32 nFmt = 0);
74 
75     // --> OD 2008-02-14 #i53420#
76 //    void ChangeExpansion( const SwFrm*,
77 //                          const SwTxtNode*,
78 //                          sal_Bool bSrchNum = sal_False);
79     void ChangeExpansion( const SwFrm*,
80                           const SwCntntNode*,
81 		sal_Bool bSrchNum = sal_False);
82     // <--
83 	void ChangeExpansion(const SwTxtNode &rNd, sal_Bool bSrchNum);
84 
85 	inline sal_uInt8 GetLevel() const;
86 	inline void	SetLevel(sal_uInt8);
87 
88 	inline const String& GetNumber() const;
89 	inline const String& GetTitle() const;
90     virtual sal_Bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
91     virtual sal_Bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
92 };
93 
GetLevel() const94 inline sal_uInt8 SwChapterField::GetLevel() const 	{ return nLevel; }
SetLevel(sal_uInt8 nLev)95 inline void	SwChapterField::SetLevel(sal_uInt8 nLev) { nLevel = nLev; }
GetNumber() const96 inline const String& SwChapterField::GetNumber() const { return sNumber; }
GetTitle() const97 inline const String& SwChapterField::GetTitle() const { return sTitle; }
98 
99 #endif // SW_CHPFLD_HXX
100