1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sw.hxx" 30 31 32 33 #include "cmdid.h" 34 #include <tools/list.hxx> 35 #include "swmodule.hxx" 36 #include "view.hxx" 37 #include "wrtsh.hxx" 38 #include "globals.hrc" 39 #include "helpid.h" 40 41 42 #include <sfx2/styfitem.hxx> 43 44 #include "uitool.hxx" 45 #include "ccoll.hxx" 46 #include "fmtcol.hxx" 47 #include "hintids.hxx" 48 #include "docsh.hxx" 49 #include "docstyle.hxx" 50 #include "hints.hxx" 51 52 #include "chrdlg.hrc" 53 #include "ccoll.hrc" 54 #include <vcl/svapp.hxx> 55 56 #include <unomid.h> 57 58 // ****************************************************************** 59 60 //!! order of entries has to be the same as in 61 //!! CommandStruct SwCondCollItem::aCmds[] 62 63 const char *aCommandContext[COND_COMMAND_COUNT] = 64 { 65 "TableHeader", 66 "Table", 67 "Frame", 68 "Section", 69 "Footnote", 70 "Endnote", 71 "Header", 72 "Footer", 73 "OutlineLevel1", 74 "OutlineLevel2", 75 "OutlineLevel3", 76 "OutlineLevel4", 77 "OutlineLevel5", 78 "OutlineLevel6", 79 "OutlineLevel7", 80 "OutlineLevel8", 81 "OutlineLevel9", 82 "OutlineLevel10", 83 "NumberingLevel1", 84 "NumberingLevel2", 85 "NumberingLevel3", 86 "NumberingLevel4", 87 "NumberingLevel5", 88 "NumberingLevel6", 89 "NumberingLevel7", 90 "NumberingLevel8", 91 "NumberingLevel9", 92 "NumberingLevel10" 93 }; 94 95 sal_Int16 GetCommandContextIndex( const rtl::OUString &rContextName ) 96 { 97 sal_Int16 nRes = -1; 98 for (sal_Int16 i = 0; nRes == -1 && i < COND_COMMAND_COUNT; ++i) 99 { 100 if (rContextName.equalsAscii( aCommandContext[i] )) 101 nRes = i; 102 } 103 return nRes; 104 } 105 106 rtl::OUString GetCommandContextByIndex( sal_Int16 nIndex ) 107 { 108 rtl::OUString aRes; 109 if (0 <= nIndex && nIndex < COND_COMMAND_COUNT) 110 { 111 aRes = C2U( aCommandContext[ nIndex ] ); 112 } 113 return aRes; 114 } 115 116 // Globals ****************************************************************** 117 118 119 CommandStruct SwCondCollItem::aCmds[] = 120 { 121 { PARA_IN_TABLEHEAD, 0 }, 122 { PARA_IN_TABLEBODY, 0 }, 123 { PARA_IN_FRAME, 0 }, 124 { PARA_IN_SECTION, 0 }, 125 { PARA_IN_FOOTENOTE, 0 }, 126 { PARA_IN_ENDNOTE, 0 }, 127 { PARA_IN_HEADER, 0 }, 128 { PARA_IN_FOOTER, 0 }, 129 { PARA_IN_OUTLINE, 0 }, 130 { PARA_IN_OUTLINE, 1 }, 131 { PARA_IN_OUTLINE, 2 }, 132 { PARA_IN_OUTLINE, 3 }, 133 { PARA_IN_OUTLINE, 4 }, 134 { PARA_IN_OUTLINE, 5 }, 135 { PARA_IN_OUTLINE, 6 }, 136 { PARA_IN_OUTLINE, 7 }, 137 { PARA_IN_OUTLINE, 8 }, 138 { PARA_IN_OUTLINE, 9 }, 139 { PARA_IN_LIST, 0 }, 140 { PARA_IN_LIST, 1 }, 141 { PARA_IN_LIST, 2 }, 142 { PARA_IN_LIST, 3 }, 143 { PARA_IN_LIST, 4 }, 144 { PARA_IN_LIST, 5 }, 145 { PARA_IN_LIST, 6 }, 146 { PARA_IN_LIST, 7 }, 147 { PARA_IN_LIST, 8 }, 148 { PARA_IN_LIST, 9 } 149 }; 150 151 152 TYPEINIT1_AUTOFACTORY(SwCondCollItem, SfxPoolItem) 153 154 /**************************************************************************** 155 Item fuer den Transport der Bedingungstabelle 156 ****************************************************************************/ 157 158 159 SwCondCollItem::SwCondCollItem(sal_uInt16 _nWhich ) : 160 SfxPoolItem(_nWhich) 161 { 162 163 } 164 /**************************************************************************** 165 166 ****************************************************************************/ 167 168 169 SwCondCollItem::~SwCondCollItem() 170 { 171 } 172 173 /**************************************************************************** 174 175 ****************************************************************************/ 176 177 178 SfxPoolItem* SwCondCollItem::Clone( SfxItemPool * /*pPool*/ ) const 179 { 180 return new SwCondCollItem(*this); 181 } 182 183 /**************************************************************************** 184 185 ****************************************************************************/ 186 187 188 int SwCondCollItem::operator==( const SfxPoolItem& rItem) const 189 { 190 DBG_ASSERT( SfxPoolItem::operator==(rItem), "unterschiedliche Typen" ); 191 sal_Bool bReturn = sal_True; 192 for(sal_uInt16 i = 0; i < COND_COMMAND_COUNT; i++) 193 if(sStyles[i] != ((SwCondCollItem&)rItem).sStyles[i]) 194 { 195 bReturn = sal_False; 196 break; 197 } 198 199 return bReturn; 200 } 201 202 /**************************************************************************** 203 204 ****************************************************************************/ 205 206 207 const String& SwCondCollItem::GetStyle(sal_uInt16 nPos) const 208 { 209 return nPos < COND_COMMAND_COUNT ? sStyles[nPos] : aEmptyStr; 210 } 211 212 /**************************************************************************** 213 214 ****************************************************************************/ 215 216 217 void SwCondCollItem::SetStyle(const String* pStyle, sal_uInt16 nPos) 218 { 219 if( nPos < COND_COMMAND_COUNT ) 220 sStyles[nPos] = pStyle ? *pStyle : aEmptyStr; 221 } 222 223 224 /**************************************************************************** 225 226 ****************************************************************************/ 227 228 229 const CommandStruct* SwCondCollItem::GetCmds() 230 { 231 return aCmds; 232 } 233 234 235 236 237