Line data Source code
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 :
20 : #include "cmdid.h"
21 : #include "swmodule.hxx"
22 : #include "view.hxx"
23 : #include "wrtsh.hxx"
24 : #include "globals.hrc"
25 : #include "helpid.h"
26 :
27 : #include <sfx2/styfitem.hxx>
28 :
29 : #include "uitool.hxx"
30 : #include "ccoll.hxx"
31 : #include "fmtcol.hxx"
32 : #include "hintids.hxx"
33 : #include "docsh.hxx"
34 : #include "docstyle.hxx"
35 : #include "hints.hxx"
36 :
37 : #include "chrdlg.hrc"
38 : #include <vcl/svapp.hxx>
39 :
40 : #include <unomid.h>
41 :
42 : //!! order of entries has to be the same as in
43 : //!! CommandStruct SwCondCollItem::aCmds[]
44 :
45 : const char *aCommandContext[COND_COMMAND_COUNT] =
46 : {
47 : "TableHeader",
48 : "Table",
49 : "Frame",
50 : "Section",
51 : "Footnote",
52 : "Endnote",
53 : "Header",
54 : "Footer",
55 : "OutlineLevel1",
56 : "OutlineLevel2",
57 : "OutlineLevel3",
58 : "OutlineLevel4",
59 : "OutlineLevel5",
60 : "OutlineLevel6",
61 : "OutlineLevel7",
62 : "OutlineLevel8",
63 : "OutlineLevel9",
64 : "OutlineLevel10",
65 : "NumberingLevel1",
66 : "NumberingLevel2",
67 : "NumberingLevel3",
68 : "NumberingLevel4",
69 : "NumberingLevel5",
70 : "NumberingLevel6",
71 : "NumberingLevel7",
72 : "NumberingLevel8",
73 : "NumberingLevel9",
74 : "NumberingLevel10"
75 : };
76 :
77 0 : sal_Int16 GetCommandContextIndex( const OUString &rContextName )
78 : {
79 0 : sal_Int16 nRes = -1;
80 0 : for (sal_Int16 i = 0; nRes == -1 && i < COND_COMMAND_COUNT; ++i)
81 : {
82 0 : if (rContextName.equalsAscii( aCommandContext[i] ))
83 0 : nRes = i;
84 : }
85 0 : return nRes;
86 : }
87 :
88 56 : OUString GetCommandContextByIndex( sal_Int16 nIndex )
89 : {
90 56 : OUString aRes;
91 56 : if (0 <= nIndex && nIndex < COND_COMMAND_COUNT)
92 : {
93 56 : aRes = OUString::createFromAscii( aCommandContext[ nIndex ] );
94 : }
95 56 : return aRes;
96 : }
97 :
98 : // Globals
99 :
100 : const CommandStruct SwCondCollItem::aCmds[] =
101 : {
102 : { PARA_IN_TABLEHEAD, 0 },
103 : { PARA_IN_TABLEBODY, 0 },
104 : { PARA_IN_FRAME, 0 },
105 : { PARA_IN_SECTION, 0 },
106 : { PARA_IN_FOOTENOTE, 0 },
107 : { PARA_IN_ENDNOTE, 0 },
108 : { PARA_IN_HEADER, 0 },
109 : { PARA_IN_FOOTER, 0 },
110 : { PARA_IN_OUTLINE, 0 },
111 : { PARA_IN_OUTLINE, 1 },
112 : { PARA_IN_OUTLINE, 2 },
113 : { PARA_IN_OUTLINE, 3 },
114 : { PARA_IN_OUTLINE, 4 },
115 : { PARA_IN_OUTLINE, 5 },
116 : { PARA_IN_OUTLINE, 6 },
117 : { PARA_IN_OUTLINE, 7 },
118 : { PARA_IN_OUTLINE, 8 },
119 : { PARA_IN_OUTLINE, 9 },
120 : { PARA_IN_LIST, 0 },
121 : { PARA_IN_LIST, 1 },
122 : { PARA_IN_LIST, 2 },
123 : { PARA_IN_LIST, 3 },
124 : { PARA_IN_LIST, 4 },
125 : { PARA_IN_LIST, 5 },
126 : { PARA_IN_LIST, 6 },
127 : { PARA_IN_LIST, 7 },
128 : { PARA_IN_LIST, 8 },
129 : { PARA_IN_LIST, 9 }
130 : };
131 :
132 0 : TYPEINIT1_AUTOFACTORY(SwCondCollItem, SfxPoolItem)
133 :
134 : // Item for the transport of the condition table
135 0 : SwCondCollItem::SwCondCollItem(sal_uInt16 _nWhich ) :
136 0 : SfxPoolItem(_nWhich)
137 : {
138 :
139 0 : }
140 :
141 0 : SwCondCollItem::~SwCondCollItem()
142 : {
143 0 : }
144 :
145 0 : SfxPoolItem* SwCondCollItem::Clone( SfxItemPool * /*pPool*/ ) const
146 : {
147 0 : return new SwCondCollItem(*this);
148 : }
149 :
150 0 : bool SwCondCollItem::operator==( const SfxPoolItem& rItem) const
151 : {
152 : assert(SfxPoolItem::operator==(rItem));
153 0 : bool bReturn = true;
154 0 : for(sal_uInt16 i = 0; i < COND_COMMAND_COUNT; i++)
155 0 : if (m_sStyles[i] !=
156 0 : static_cast<SwCondCollItem const&>(rItem).m_sStyles[i])
157 : {
158 0 : bReturn = false;
159 0 : break;
160 : }
161 :
162 0 : return bReturn;
163 : }
164 :
165 0 : OUString SwCondCollItem::GetStyle(sal_uInt16 const nPos) const
166 : {
167 0 : return (nPos < COND_COMMAND_COUNT) ? m_sStyles[nPos] : OUString();
168 : }
169 :
170 : void
171 0 : SwCondCollItem::SetStyle(OUString const*const pStyle, sal_uInt16 const nPos)
172 : {
173 0 : if( nPos < COND_COMMAND_COUNT )
174 0 : m_sStyles[nPos] = (pStyle) ? *pStyle : OUString();
175 177 : }
176 :
177 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|