1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include "swmodule.hxx"
25 #include "globals.hrc"
28 #include <sfx2/styfitem.hxx>
33 #include "hintids.hxx"
35 #include "docstyle.hxx"
40 #include <vcl/svapp.hxx>
44 // ******************************************************************
46 //!! order of entries has to be the same as in
47 //!! CommandStruct SwCondCollItem::aCmds[]
49 const char *aCommandContext
[COND_COMMAND_COUNT
] =
81 sal_Int16
GetCommandContextIndex( const OUString
&rContextName
)
84 for (sal_Int16 i
= 0; nRes
== -1 && i
< COND_COMMAND_COUNT
; ++i
)
86 if (rContextName
.equalsAscii( aCommandContext
[i
] ))
92 OUString
GetCommandContextByIndex( sal_Int16 nIndex
)
95 if (0 <= nIndex
&& nIndex
< COND_COMMAND_COUNT
)
97 aRes
= OUString::createFromAscii( aCommandContext
[ nIndex
] );
102 // Globals ******************************************************************
105 CommandStruct
SwCondCollItem::aCmds
[] =
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 },
138 TYPEINIT1_AUTOFACTORY(SwCondCollItem
, SfxPoolItem
)
140 /****************************************************************************
141 Item for the transport of the condition table
142 ****************************************************************************/
145 SwCondCollItem::SwCondCollItem(sal_uInt16 _nWhich
) :
151 SwCondCollItem::~SwCondCollItem()
155 SfxPoolItem
* SwCondCollItem::Clone( SfxItemPool
* /*pPool*/ ) const
157 return new SwCondCollItem(*this);
160 int SwCondCollItem::operator==( const SfxPoolItem
& rItem
) const
162 OSL_ENSURE( SfxPoolItem::operator==(rItem
), "different types" );
163 sal_Bool bReturn
= sal_True
;
164 for(sal_uInt16 i
= 0; i
< COND_COMMAND_COUNT
; i
++)
165 if(sStyles
[i
] != ((SwCondCollItem
&)rItem
).sStyles
[i
])
174 const String
& SwCondCollItem::GetStyle(sal_uInt16 nPos
) const
176 return nPos
< COND_COMMAND_COUNT
? sStyles
[nPos
] : aEmptyStr
;
179 void SwCondCollItem::SetStyle(const String
* pStyle
, sal_uInt16 nPos
)
181 if( nPos
< COND_COMMAND_COUNT
)
182 sStyles
[nPos
] = pStyle
? *pStyle
: aEmptyStr
;
185 const CommandStruct
* SwCondCollItem::GetCmds()
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */