1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ccoll.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
37 #include <tools/list.hxx>
38 #include "swmodule.hxx"
41 #include "globals.hrc"
45 #include <sfx2/styfitem.hxx>
50 #include "hintids.hxx"
52 #include "docstyle.hxx"
57 #include <vcl/svapp.hxx>
61 // ******************************************************************
63 //!! order of entries has to be the same as in
64 //!! CommandStruct SwCondCollItem::aCmds[]
66 const char *aCommandContext
[COND_COMMAND_COUNT
] =
98 sal_Int16
GetCommandContextIndex( const rtl::OUString
&rContextName
)
101 for (sal_Int16 i
= 0; nRes
== -1 && i
< COND_COMMAND_COUNT
; ++i
)
103 if (rContextName
.equalsAscii( aCommandContext
[i
] ))
109 rtl::OUString
GetCommandContextByIndex( sal_Int16 nIndex
)
112 if (0 <= nIndex
&& nIndex
< COND_COMMAND_COUNT
)
114 aRes
= C2U( aCommandContext
[ nIndex
] );
119 // Globals ******************************************************************
122 CommandStruct
SwCondCollItem::aCmds
[] =
124 { PARA_IN_TABLEHEAD
, 0 },
125 { PARA_IN_TABLEBODY
, 0 },
126 { PARA_IN_FRAME
, 0 },
127 { PARA_IN_SECTION
, 0 },
128 { PARA_IN_FOOTENOTE
, 0 },
129 { PARA_IN_ENDNOTE
, 0 },
130 { PARA_IN_HEADER
, 0 },
131 { PARA_IN_FOOTER
, 0 },
132 { PARA_IN_OUTLINE
, 0 },
133 { PARA_IN_OUTLINE
, 1 },
134 { PARA_IN_OUTLINE
, 2 },
135 { PARA_IN_OUTLINE
, 3 },
136 { PARA_IN_OUTLINE
, 4 },
137 { PARA_IN_OUTLINE
, 5 },
138 { PARA_IN_OUTLINE
, 6 },
139 { PARA_IN_OUTLINE
, 7 },
140 { PARA_IN_OUTLINE
, 8 },
141 { PARA_IN_OUTLINE
, 9 },
155 TYPEINIT1_AUTOFACTORY(SwCondCollItem
, SfxPoolItem
)
157 /****************************************************************************
158 Item fuer den Transport der Bedingungstabelle
159 ****************************************************************************/
162 SwCondCollItem::SwCondCollItem(USHORT _nWhich
) :
167 /****************************************************************************
169 ****************************************************************************/
172 SwCondCollItem::~SwCondCollItem()
176 /****************************************************************************
178 ****************************************************************************/
181 SfxPoolItem
* SwCondCollItem::Clone( SfxItemPool
* /*pPool*/ ) const
183 return new SwCondCollItem(*this);
186 /****************************************************************************
188 ****************************************************************************/
191 int SwCondCollItem::operator==( const SfxPoolItem
& rItem
) const
193 DBG_ASSERT( SfxPoolItem::operator==(rItem
), "unterschiedliche Typen" );
195 for(USHORT i
= 0; i
< COND_COMMAND_COUNT
; i
++)
196 if(sStyles
[i
] != ((SwCondCollItem
&)rItem
).sStyles
[i
])
205 /****************************************************************************
207 ****************************************************************************/
210 const String
& SwCondCollItem::GetStyle(USHORT nPos
) const
213 return nPos
< COND_COMMAND_COUNT
? sStyles
[nPos
] : aEmptyStr
;
215 return nPos
< COND_COMMAND_COUNT
? (String
)sStyles
[nPos
] : aEmptyStr
;
219 /****************************************************************************
221 ****************************************************************************/
224 void SwCondCollItem::SetStyle(const String
* pStyle
, USHORT nPos
)
226 if( nPos
< COND_COMMAND_COUNT
)
228 sStyles
[nPos
] = pStyle
? *pStyle
: aEmptyStr
;
230 sStyles
[nPos
] = pStyle
? (String
)*pStyle
: aEmptyStr
;
235 /****************************************************************************
237 ****************************************************************************/
240 const CommandStruct
* SwCondCollItem::GetCmds()