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