Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "cmdid.h"
31 : : #include "swmodule.hxx"
32 : : #include "view.hxx"
33 : : #include "wrtsh.hxx"
34 : : #include "globals.hrc"
35 : : #include "helpid.h"
36 : :
37 : : #include <sfx2/styfitem.hxx>
38 : :
39 : : #include "uitool.hxx"
40 : : #include "ccoll.hxx"
41 : : #include "fmtcol.hxx"
42 : : #include "hintids.hxx"
43 : : #include "docsh.hxx"
44 : : #include "docstyle.hxx"
45 : : #include "hints.hxx"
46 : :
47 : : #include "chrdlg.hrc"
48 : : #include "ccoll.hrc"
49 : : #include <vcl/svapp.hxx>
50 : :
51 : : #include <unomid.h>
52 : :
53 : : // ******************************************************************
54 : :
55 : : //!! order of entries has to be the same as in
56 : : //!! CommandStruct SwCondCollItem::aCmds[]
57 : :
58 : : const char *aCommandContext[COND_COMMAND_COUNT] =
59 : : {
60 : : "TableHeader",
61 : : "Table",
62 : : "Frame",
63 : : "Section",
64 : : "Footnote",
65 : : "Endnote",
66 : : "Header",
67 : : "Footer",
68 : : "OutlineLevel1",
69 : : "OutlineLevel2",
70 : : "OutlineLevel3",
71 : : "OutlineLevel4",
72 : : "OutlineLevel5",
73 : : "OutlineLevel6",
74 : : "OutlineLevel7",
75 : : "OutlineLevel8",
76 : : "OutlineLevel9",
77 : : "OutlineLevel10",
78 : : "NumberingLevel1",
79 : : "NumberingLevel2",
80 : : "NumberingLevel3",
81 : : "NumberingLevel4",
82 : : "NumberingLevel5",
83 : : "NumberingLevel6",
84 : : "NumberingLevel7",
85 : : "NumberingLevel8",
86 : : "NumberingLevel9",
87 : : "NumberingLevel10"
88 : : };
89 : :
90 : 0 : sal_Int16 GetCommandContextIndex( const rtl::OUString &rContextName )
91 : : {
92 : 0 : sal_Int16 nRes = -1;
93 [ # # ][ # # ]: 0 : for (sal_Int16 i = 0; nRes == -1 && i < COND_COMMAND_COUNT; ++i)
[ # # ]
94 : : {
95 [ # # ]: 0 : if (rContextName.equalsAscii( aCommandContext[i] ))
96 : 0 : nRes = i;
97 : : }
98 : 0 : return nRes;
99 : : }
100 : :
101 : 112 : rtl::OUString GetCommandContextByIndex( sal_Int16 nIndex )
102 : : {
103 : 112 : rtl::OUString aRes;
104 [ + - ][ + - ]: 112 : if (0 <= nIndex && nIndex < COND_COMMAND_COUNT)
105 : : {
106 : 112 : aRes = rtl::OUString::createFromAscii( aCommandContext[ nIndex ] );
107 : : }
108 : 112 : return aRes;
109 : : }
110 : :
111 : : // Globals ******************************************************************
112 : :
113 : :
114 : : CommandStruct SwCondCollItem::aCmds[] =
115 : : {
116 : : { PARA_IN_TABLEHEAD, 0 },
117 : : { PARA_IN_TABLEBODY, 0 },
118 : : { PARA_IN_FRAME, 0 },
119 : : { PARA_IN_SECTION, 0 },
120 : : { PARA_IN_FOOTENOTE, 0 },
121 : : { PARA_IN_ENDNOTE, 0 },
122 : : { PARA_IN_HEADER, 0 },
123 : : { PARA_IN_FOOTER, 0 },
124 : : { PARA_IN_OUTLINE, 0 },
125 : : { PARA_IN_OUTLINE, 1 },
126 : : { PARA_IN_OUTLINE, 2 },
127 : : { PARA_IN_OUTLINE, 3 },
128 : : { PARA_IN_OUTLINE, 4 },
129 : : { PARA_IN_OUTLINE, 5 },
130 : : { PARA_IN_OUTLINE, 6 },
131 : : { PARA_IN_OUTLINE, 7 },
132 : : { PARA_IN_OUTLINE, 8 },
133 : : { PARA_IN_OUTLINE, 9 },
134 : : { PARA_IN_LIST, 0 },
135 : : { PARA_IN_LIST, 1 },
136 : : { PARA_IN_LIST, 2 },
137 : : { PARA_IN_LIST, 3 },
138 : : { PARA_IN_LIST, 4 },
139 : : { PARA_IN_LIST, 5 },
140 : : { PARA_IN_LIST, 6 },
141 : : { PARA_IN_LIST, 7 },
142 : : { PARA_IN_LIST, 8 },
143 : : { PARA_IN_LIST, 9 }
144 : : };
145 : :
146 : :
147 [ # # ][ # # ]: 0 : TYPEINIT1_AUTOFACTORY(SwCondCollItem, SfxPoolItem)
[ # # ]
148 : :
149 : : /****************************************************************************
150 : : Item for the transport of the condition table
151 : : ****************************************************************************/
152 : :
153 : :
154 : 0 : SwCondCollItem::SwCondCollItem(sal_uInt16 _nWhich ) :
155 [ # # ][ # # : 0 : SfxPoolItem(_nWhich)
# # # # ]
156 : : {
157 : :
158 : 0 : }
159 : :
160 [ # # ]: 0 : SwCondCollItem::~SwCondCollItem()
161 : : {
162 [ # # ][ # # ]: 0 : }
[ # # ]
163 : :
164 : 0 : SfxPoolItem* SwCondCollItem::Clone( SfxItemPool * /*pPool*/ ) const
165 : : {
166 [ # # ]: 0 : return new SwCondCollItem(*this);
167 : : }
168 : :
169 : 0 : int SwCondCollItem::operator==( const SfxPoolItem& rItem) const
170 : : {
171 : : OSL_ENSURE( SfxPoolItem::operator==(rItem), "different types" );
172 : 0 : sal_Bool bReturn = sal_True;
173 [ # # ]: 0 : for(sal_uInt16 i = 0; i < COND_COMMAND_COUNT; i++)
174 [ # # ]: 0 : if(sStyles[i] != ((SwCondCollItem&)rItem).sStyles[i])
175 : : {
176 : 0 : bReturn = sal_False;
177 : 0 : break;
178 : : }
179 : :
180 : 0 : return bReturn;
181 : : }
182 : :
183 : 0 : const String& SwCondCollItem::GetStyle(sal_uInt16 nPos) const
184 : : {
185 [ # # ]: 0 : return nPos < COND_COMMAND_COUNT ? sStyles[nPos] : aEmptyStr;
186 : : }
187 : :
188 : 0 : void SwCondCollItem::SetStyle(const String* pStyle, sal_uInt16 nPos)
189 : : {
190 [ # # ]: 0 : if( nPos < COND_COMMAND_COUNT )
191 [ # # ]: 0 : sStyles[nPos] = pStyle ? *pStyle : aEmptyStr;
192 : 0 : }
193 : :
194 : 4 : const CommandStruct* SwCondCollItem::GetCmds()
195 : : {
196 : 4 : return aCmds;
197 : : }
198 : :
199 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|