xref: /aoo41x/main/sw/source/ui/chrdlg/ccoll.cxx (revision efeef26f)
1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*efeef26fSAndrew Rist  * distributed with this work for additional information
6*efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*efeef26fSAndrew Rist  *
11*efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist  *
13*efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*efeef26fSAndrew Rist  * specific language governing permissions and limitations
18*efeef26fSAndrew Rist  * under the License.
19*efeef26fSAndrew Rist  *
20*efeef26fSAndrew Rist  *************************************************************/
21*efeef26fSAndrew Rist 
22*efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "cmdid.h"
30cdf0e10cSrcweir #include <tools/list.hxx>
31cdf0e10cSrcweir #include "swmodule.hxx"
32cdf0e10cSrcweir #include "view.hxx"
33cdf0e10cSrcweir #include "wrtsh.hxx"
34cdf0e10cSrcweir #include "globals.hrc"
35cdf0e10cSrcweir #include "helpid.h"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <sfx2/styfitem.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include "uitool.hxx"
41cdf0e10cSrcweir #include "ccoll.hxx"
42cdf0e10cSrcweir #include "fmtcol.hxx"
43cdf0e10cSrcweir #include "hintids.hxx"
44cdf0e10cSrcweir #include "docsh.hxx"
45cdf0e10cSrcweir #include "docstyle.hxx"
46cdf0e10cSrcweir #include "hints.hxx"
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #include "chrdlg.hrc"
49cdf0e10cSrcweir #include "ccoll.hrc"
50cdf0e10cSrcweir #include <vcl/svapp.hxx>
51cdf0e10cSrcweir 
52cdf0e10cSrcweir #include <unomid.h>
53cdf0e10cSrcweir 
54cdf0e10cSrcweir // ******************************************************************
55cdf0e10cSrcweir 
56cdf0e10cSrcweir //!! order of entries has to be the same as in
57cdf0e10cSrcweir //!! CommandStruct SwCondCollItem::aCmds[]
58cdf0e10cSrcweir 
59cdf0e10cSrcweir const char *aCommandContext[COND_COMMAND_COUNT] =
60cdf0e10cSrcweir {
61cdf0e10cSrcweir     "TableHeader",
62cdf0e10cSrcweir     "Table",
63cdf0e10cSrcweir     "Frame",
64cdf0e10cSrcweir     "Section",
65cdf0e10cSrcweir     "Footnote",
66cdf0e10cSrcweir     "Endnote",
67cdf0e10cSrcweir     "Header",
68cdf0e10cSrcweir     "Footer",
69cdf0e10cSrcweir     "OutlineLevel1",
70cdf0e10cSrcweir     "OutlineLevel2",
71cdf0e10cSrcweir     "OutlineLevel3",
72cdf0e10cSrcweir     "OutlineLevel4",
73cdf0e10cSrcweir     "OutlineLevel5",
74cdf0e10cSrcweir     "OutlineLevel6",
75cdf0e10cSrcweir     "OutlineLevel7",
76cdf0e10cSrcweir     "OutlineLevel8",
77cdf0e10cSrcweir     "OutlineLevel9",
78cdf0e10cSrcweir     "OutlineLevel10",
79cdf0e10cSrcweir     "NumberingLevel1",
80cdf0e10cSrcweir     "NumberingLevel2",
81cdf0e10cSrcweir     "NumberingLevel3",
82cdf0e10cSrcweir     "NumberingLevel4",
83cdf0e10cSrcweir     "NumberingLevel5",
84cdf0e10cSrcweir     "NumberingLevel6",
85cdf0e10cSrcweir     "NumberingLevel7",
86cdf0e10cSrcweir     "NumberingLevel8",
87cdf0e10cSrcweir     "NumberingLevel9",
88cdf0e10cSrcweir     "NumberingLevel10"
89cdf0e10cSrcweir };
90cdf0e10cSrcweir 
GetCommandContextIndex(const rtl::OUString & rContextName)91cdf0e10cSrcweir sal_Int16 GetCommandContextIndex( const rtl::OUString &rContextName )
92cdf0e10cSrcweir {
93cdf0e10cSrcweir     sal_Int16 nRes = -1;
94cdf0e10cSrcweir     for (sal_Int16 i = 0;  nRes == -1 && i < COND_COMMAND_COUNT;  ++i)
95cdf0e10cSrcweir     {
96cdf0e10cSrcweir         if (rContextName.equalsAscii( aCommandContext[i] ))
97cdf0e10cSrcweir             nRes = i;
98cdf0e10cSrcweir     }
99cdf0e10cSrcweir     return nRes;
100cdf0e10cSrcweir }
101cdf0e10cSrcweir 
GetCommandContextByIndex(sal_Int16 nIndex)102cdf0e10cSrcweir rtl::OUString GetCommandContextByIndex( sal_Int16 nIndex )
103cdf0e10cSrcweir {
104cdf0e10cSrcweir     rtl::OUString aRes;
105cdf0e10cSrcweir     if (0 <= nIndex  &&  nIndex < COND_COMMAND_COUNT)
106cdf0e10cSrcweir     {
107cdf0e10cSrcweir         aRes = C2U( aCommandContext[ nIndex ] );
108cdf0e10cSrcweir     }
109cdf0e10cSrcweir     return aRes;
110cdf0e10cSrcweir }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir // Globals ******************************************************************
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 
115cdf0e10cSrcweir CommandStruct SwCondCollItem::aCmds[] =
116cdf0e10cSrcweir {
117cdf0e10cSrcweir 	{ PARA_IN_TABLEHEAD,	0 },
118cdf0e10cSrcweir 	{ PARA_IN_TABLEBODY, 	0 },
119cdf0e10cSrcweir 	{ PARA_IN_FRAME, 		0 },
120cdf0e10cSrcweir 	{ PARA_IN_SECTION, 		0 },
121cdf0e10cSrcweir 	{ PARA_IN_FOOTENOTE,	0 },
122cdf0e10cSrcweir 	{ PARA_IN_ENDNOTE,		0 },
123cdf0e10cSrcweir 	{ PARA_IN_HEADER, 		0 },
124cdf0e10cSrcweir 	{ PARA_IN_FOOTER, 		0 },
125cdf0e10cSrcweir 	{ PARA_IN_OUTLINE, 		0 },
126cdf0e10cSrcweir 	{ PARA_IN_OUTLINE, 		1 },
127cdf0e10cSrcweir 	{ PARA_IN_OUTLINE, 		2 },
128cdf0e10cSrcweir 	{ PARA_IN_OUTLINE, 		3 },
129cdf0e10cSrcweir 	{ PARA_IN_OUTLINE, 		4 },
130cdf0e10cSrcweir 	{ PARA_IN_OUTLINE, 		5 },
131cdf0e10cSrcweir 	{ PARA_IN_OUTLINE, 		6 },
132cdf0e10cSrcweir 	{ PARA_IN_OUTLINE, 		7 },
133cdf0e10cSrcweir 	{ PARA_IN_OUTLINE, 		8 },
134cdf0e10cSrcweir 	{ PARA_IN_OUTLINE, 		9 },
135cdf0e10cSrcweir 	{ PARA_IN_LIST, 		0 },
136cdf0e10cSrcweir 	{ PARA_IN_LIST, 		1 },
137cdf0e10cSrcweir 	{ PARA_IN_LIST, 		2 },
138cdf0e10cSrcweir 	{ PARA_IN_LIST, 		3 },
139cdf0e10cSrcweir 	{ PARA_IN_LIST, 		4 },
140cdf0e10cSrcweir 	{ PARA_IN_LIST, 		5 },
141cdf0e10cSrcweir 	{ PARA_IN_LIST, 		6 },
142cdf0e10cSrcweir 	{ PARA_IN_LIST, 		7 },
143cdf0e10cSrcweir 	{ PARA_IN_LIST, 		8 },
144cdf0e10cSrcweir 	{ PARA_IN_LIST, 		9 }
145cdf0e10cSrcweir };
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 
TYPEINIT1_AUTOFACTORY(SwCondCollItem,SfxPoolItem)148cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(SwCondCollItem, SfxPoolItem)
149cdf0e10cSrcweir 
150cdf0e10cSrcweir /****************************************************************************
151cdf0e10cSrcweir 	Item fuer den Transport der Bedingungstabelle
152cdf0e10cSrcweir ****************************************************************************/
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 
155cdf0e10cSrcweir SwCondCollItem::SwCondCollItem(sal_uInt16 _nWhich ) :
156cdf0e10cSrcweir     SfxPoolItem(_nWhich)
157cdf0e10cSrcweir {
158cdf0e10cSrcweir 
159cdf0e10cSrcweir }
160cdf0e10cSrcweir /****************************************************************************
161cdf0e10cSrcweir 
162cdf0e10cSrcweir ****************************************************************************/
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 
~SwCondCollItem()165cdf0e10cSrcweir SwCondCollItem::~SwCondCollItem()
166cdf0e10cSrcweir {
167cdf0e10cSrcweir }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir /****************************************************************************
170cdf0e10cSrcweir 
171cdf0e10cSrcweir ****************************************************************************/
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 
Clone(SfxItemPool *) const174cdf0e10cSrcweir SfxPoolItem*   SwCondCollItem::Clone( SfxItemPool * /*pPool*/ ) const
175cdf0e10cSrcweir {
176cdf0e10cSrcweir 	return new SwCondCollItem(*this);
177cdf0e10cSrcweir }
178cdf0e10cSrcweir 
179cdf0e10cSrcweir /****************************************************************************
180cdf0e10cSrcweir 
181cdf0e10cSrcweir ****************************************************************************/
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 
operator ==(const SfxPoolItem & rItem) const184cdf0e10cSrcweir int SwCondCollItem::operator==( const SfxPoolItem& rItem) const
185cdf0e10cSrcweir {
186cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rItem), "unterschiedliche Typen" );
187cdf0e10cSrcweir 	sal_Bool bReturn = sal_True;
188cdf0e10cSrcweir 	for(sal_uInt16 i = 0; i < COND_COMMAND_COUNT; i++)
189cdf0e10cSrcweir 		if(sStyles[i] != ((SwCondCollItem&)rItem).sStyles[i])
190cdf0e10cSrcweir 		{
191cdf0e10cSrcweir 			bReturn = sal_False;
192cdf0e10cSrcweir 			break;
193cdf0e10cSrcweir 		}
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 	return bReturn;
196cdf0e10cSrcweir }
197cdf0e10cSrcweir 
198cdf0e10cSrcweir /****************************************************************************
199cdf0e10cSrcweir 
200cdf0e10cSrcweir ****************************************************************************/
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 
GetStyle(sal_uInt16 nPos) const203cdf0e10cSrcweir const String&	SwCondCollItem::GetStyle(sal_uInt16 nPos) const
204cdf0e10cSrcweir {
205cdf0e10cSrcweir 	return nPos < COND_COMMAND_COUNT ? sStyles[nPos] : aEmptyStr;
206cdf0e10cSrcweir }
207cdf0e10cSrcweir 
208cdf0e10cSrcweir /****************************************************************************
209cdf0e10cSrcweir 
210cdf0e10cSrcweir ****************************************************************************/
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 
SetStyle(const String * pStyle,sal_uInt16 nPos)213cdf0e10cSrcweir void SwCondCollItem::SetStyle(const String* pStyle, sal_uInt16 nPos)
214cdf0e10cSrcweir {
215cdf0e10cSrcweir 	if( nPos < COND_COMMAND_COUNT )
216cdf0e10cSrcweir 		sStyles[nPos] = pStyle ? *pStyle : aEmptyStr;
217cdf0e10cSrcweir }
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 
220cdf0e10cSrcweir /****************************************************************************
221cdf0e10cSrcweir 
222cdf0e10cSrcweir ****************************************************************************/
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 
GetCmds()225cdf0e10cSrcweir const CommandStruct* SwCondCollItem::GetCmds()
226cdf0e10cSrcweir {
227cdf0e10cSrcweir 	return aCmds;
228cdf0e10cSrcweir }
229cdf0e10cSrcweir 
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 
233