bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / ui / chrdlg / ccoll.cxx
blobb5c7359e318f7c1f1c9673f54b02c5498c3c16b2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
21 #include "cmdid.h"
22 #include "swmodule.hxx"
23 #include "view.hxx"
24 #include "wrtsh.hxx"
25 #include "globals.hrc"
26 #include "helpid.h"
28 #include <sfx2/styfitem.hxx>
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"
38 #include "chrdlg.hrc"
39 #include "ccoll.hrc"
40 #include <vcl/svapp.hxx>
42 #include <unomid.h>
44 // ******************************************************************
46 //!! order of entries has to be the same as in
47 //!! CommandStruct SwCondCollItem::aCmds[]
49 const char *aCommandContext[COND_COMMAND_COUNT] =
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"
81 sal_Int16 GetCommandContextIndex( const OUString &rContextName )
83 sal_Int16 nRes = -1;
84 for (sal_Int16 i = 0; nRes == -1 && i < COND_COMMAND_COUNT; ++i)
86 if (rContextName.equalsAscii( aCommandContext[i] ))
87 nRes = i;
89 return nRes;
92 OUString GetCommandContextByIndex( sal_Int16 nIndex )
94 OUString aRes;
95 if (0 <= nIndex && nIndex < COND_COMMAND_COUNT)
97 aRes = OUString::createFromAscii( aCommandContext[ nIndex ] );
99 return aRes;
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 },
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 }
138 TYPEINIT1_AUTOFACTORY(SwCondCollItem, SfxPoolItem)
140 /****************************************************************************
141 Item for the transport of the condition table
142 ****************************************************************************/
145 SwCondCollItem::SwCondCollItem(sal_uInt16 _nWhich ) :
146 SfxPoolItem(_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])
167 bReturn = sal_False;
168 break;
171 return bReturn;
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()
187 return aCmds;
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */