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