1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_UINUMS_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_UINUMS_HXX
22 #include <numrule.hxx>
32 namespace sw
{ class StoredChapterNumberingRules
; }
34 #define MAX_NUM_RULES 9
36 class SW_DLLPUBLIC SwNumRulesWithName final
39 // the NumRule's formats _have_ to be independent of a document
40 // (They should always be there!)
41 class SAL_DLLPRIVATE SwNumFormatGlobal
43 friend class SwNumRulesWithName
;
45 OUString sCharFormatName
;
46 sal_uInt16 nCharPoolId
;
47 std::vector
<std::unique_ptr
<SfxPoolItem
>> m_Items
;
49 SwNumFormatGlobal
& operator=( const SwNumFormatGlobal
& ) = delete;
52 SwNumFormatGlobal( const SwNumFormat
& rFormat
);
53 SwNumFormatGlobal( const SwNumFormatGlobal
& );
56 SwNumFormat
MakeNumFormat(SwWrtShell
& rSh
) const;
59 std::unique_ptr
<SwNumFormatGlobal
> aFormats
[ MAXLEVEL
];
61 friend class sw::StoredChapterNumberingRules
;
62 friend class SwChapterNumRules
;
63 void SetName(const OUString
& rSet
) {maName
= rSet
;}
64 void SetNumFormat(size_t, SwNumFormat
const&, OUString
const&);
65 SwNumRulesWithName() = default;
68 SwNumRulesWithName(const SwNumRule
&, const OUString
&);
69 SwNumRulesWithName( const SwNumRulesWithName
& );
70 ~SwNumRulesWithName();
72 SwNumRulesWithName
&operator=(const SwNumRulesWithName
&);
74 const OUString
& GetName() const { return maName
; }
75 void ResetNumRule(SwWrtShell
& rSh
, SwNumRule
& ) const;
77 void GetNumFormat(size_t, SwNumFormat
const*&, OUString
const*&) const;
80 class SW_DLLPUBLIC SwChapterNumRules final
83 enum { nMaxRules
= MAX_NUM_RULES
}; // currently 9 defined forms
85 std::unique_ptr
<SwNumRulesWithName
> pNumRules
[ MAX_NUM_RULES
];
94 inline const SwNumRulesWithName
* GetRules(sal_uInt16 nIdx
) const;
95 void CreateEmptyNumRule(sal_uInt16 nIdx
); // for import
96 void ApplyNumRules( const SwNumRulesWithName
&rCopy
,
100 inline const SwNumRulesWithName
*SwChapterNumRules::GetRules(sal_uInt16 nIdx
) const
102 assert(nIdx
< nMaxRules
);
103 return pNumRules
[nIdx
].get();
110 void ExportStoredChapterNumberingRules(
111 SwChapterNumRules
& rRules
, SvStream
& rStream
, OUString
const&);
112 void ImportStoredChapterNumberingRules(
113 SwChapterNumRules
& rRules
, SvStream
& rStream
, OUString
const&);
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */