LibreOffice Module sw (master) 1
uinums.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_UINUMS_HXX
20#define INCLUDED_SW_SOURCE_UIBASE_INC_UINUMS_HXX
21
22#include <numrule.hxx>
23#include <swdllapi.h>
24
25#include <memory>
26#include <vector>
27
28class SfxPoolItem;
29class SwWrtShell;
30class SvStream;
31
32namespace sw { class StoredChapterNumberingRules; }
33
34#define MAX_NUM_RULES 9
35
37{
38 OUString maName;
39 // the NumRule's formats _have_ to be independent of a document
40 // (They should always be there!)
41 class SAL_DLLPRIVATE SwNumFormatGlobal
42 {
43 friend class SwNumRulesWithName;
46 sal_uInt16 m_nCharPoolId;
47 std::vector<std::unique_ptr<SfxPoolItem>> m_Items;
48
50
51 public:
52 SwNumFormatGlobal( const SwNumFormat& rFormat );
55
56 SwNumFormat MakeNumFormat(SwWrtShell& rSh) const;
57 };
58
59 std::unique_ptr<SwNumFormatGlobal> m_aFormats[ MAXLEVEL ];
60
62 friend class SwChapterNumRules;
63 void SetName(const OUString& rSet) {maName = rSet;}
64 void SetNumFormat(size_t, SwNumFormat const&, OUString const&);
65 SwNumRulesWithName() = default;
66
67public:
68 SwNumRulesWithName(const SwNumRule &, OUString );
71
72 SwNumRulesWithName &operator=(const SwNumRulesWithName &);
73
74 const OUString& GetName() const { return maName; }
75 void ResetNumRule(SwWrtShell& rSh, SwNumRule& ) const;
76
77 void GetNumFormat(size_t, SwNumFormat const*&, OUString const*&) const;
78};
79
81{
82public:
83 enum { nMaxRules = MAX_NUM_RULES }; // currently 9 defined forms
84private:
85 std::unique_ptr<SwNumRulesWithName> m_pNumRules[ MAX_NUM_RULES ];
86
87 void Init();
88 void Save();
89
90public:
93
94 inline const SwNumRulesWithName* GetRules(sal_uInt16 nIdx) const;
95 void CreateEmptyNumRule(sal_uInt16 nIdx); // for import
96 void ApplyNumRules( const SwNumRulesWithName &rCopy,
97 sal_uInt16 nIdx);
98};
99
100inline const SwNumRulesWithName *SwChapterNumRules::GetRules(sal_uInt16 nIdx) const
101{
102 assert(nIdx < nMaxRules);
103 return m_pNumRules[nIdx].get();
104}
105
106
107namespace sw
108{
109
111 SwChapterNumRules & rRules, SvStream & rStream, OUString const&);
113 SwChapterNumRules & rRules, SvStream & rStream, OUString const&);
114
115} // namespace sw
116
117#endif
118
119/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString maName
const SwNumRulesWithName * GetRules(sal_uInt16 nIdx) const
Definition: uinums.hxx:100
std::unique_ptr< SwNumRulesWithName > m_pNumRules[MAX_NUM_RULES]
Definition: uinums.hxx:85
std::vector< std::unique_ptr< SfxPoolItem > > m_Items
Definition: uinums.hxx:47
SwNumFormatGlobal & operator=(const SwNumFormatGlobal &)=delete
std::unique_ptr< SwNumFormatGlobal > m_aFormats[MAXLEVEL]
Definition: uinums.hxx:59
void SetName(const OUString &rSet)
Definition: uinums.hxx:63
SwNumRulesWithName()=default
OUString maName
Definition: uinums.hxx:38
const OUString & GetName() const
Definition: uinums.hxx:74
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void Init()
Dialog to specify the properties of date form field.
void ExportStoredChapterNumberingRules(SwChapterNumRules &rRules, SvStream &rStream, OUString const &rFileName)
void ImportStoredChapterNumberingRules(SwChapterNumRules &rRules, SvStream &rStream, OUString const &rFileName)
static SfxItemSet & rSet
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
#define MAX_NUM_RULES
Definition: uinums.hxx:34