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 #include <hints.hxx> 31 32 #ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_ 33 #include <com/sun/star/i18n/ScriptType.hdl> 34 #endif 35 #include <editeng/scripttypeitem.hxx> 36 #include <hintids.hxx> 37 #include <swtypes.hxx> 38 #include <ndtxt.hxx> 39 #include <errhdl.hxx> 40 41 SwFmtChg::SwFmtChg( SwFmt *pFmt ) 42 : SwMsgPoolItem( RES_FMT_CHG ), 43 pChangedFmt( pFmt ) 44 {} 45 46 47 48 SwInsTxt::SwInsTxt( xub_StrLen nP, xub_StrLen nL ) 49 : SwMsgPoolItem( RES_INS_TXT ), 50 nPos( nP ), 51 nLen( nL ) 52 {} 53 54 55 56 SwDelChr::SwDelChr( xub_StrLen nP ) 57 : SwMsgPoolItem( RES_DEL_CHR ), 58 nPos( nP ) 59 {} 60 61 62 63 SwDelTxt::SwDelTxt( xub_StrLen nS, xub_StrLen nL ) 64 : SwMsgPoolItem( RES_DEL_TXT ), 65 nStart( nS ), 66 nLen( nL ) 67 {} 68 69 70 71 SwUpdateAttr::SwUpdateAttr( xub_StrLen nS, xub_StrLen nE, sal_uInt16 nW ) 72 : SwMsgPoolItem( RES_UPDATE_ATTR ), 73 nStart( nS ), 74 nEnd( nE ), 75 nWhichAttr( nW ) 76 {} 77 78 79 // SwRefMarkFldUpdate wird verschickt, wenn sich die ReferenzMarkierungen 80 // Updaten sollen. Um Seiten-/KapitelNummer feststellen zu koennen, muss 81 // der akt. Frame befragt werden. Dafuer wird das akt. OutputDevice benoetigt. 82 83 84 SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice* pOutput ) 85 : SwMsgPoolItem( RES_REFMARKFLD_UPDATE ), 86 pOut( pOutput ) 87 { 88 ASSERT( pOut, "es muss ein OutputDevice-Pointer gesetzt werden!" ); 89 } 90 91 92 SwDocPosUpdate::SwDocPosUpdate( const SwTwips nDcPos ) 93 : SwMsgPoolItem( RES_DOCPOS_UPDATE ), 94 nDocPos(nDcPos) 95 {} 96 97 98 99 // SwTableFmlUpdate wird verschickt, wenn sich die Tabelle neu berechnen soll 100 SwTableFmlUpdate::SwTableFmlUpdate( const SwTable* pNewTbl ) 101 : SwMsgPoolItem( RES_TABLEFML_UPDATE ), 102 pTbl( pNewTbl ), pHistory( 0 ), nSplitLine( USHRT_MAX ), 103 eFlags( TBL_CALC ) 104 { 105 DATA.pDelTbl = 0; 106 bModified = bBehindSplitLine = sal_False; 107 ASSERT( pTbl, "es muss ein Table-Pointer gesetzt werden!" ); 108 } 109 110 111 SwAutoFmtGetDocNode::SwAutoFmtGetDocNode( const SwNodes* pNds ) 112 : SwMsgPoolItem( RES_AUTOFMT_DOCNODE ), 113 pCntntNode( 0 ), pNodes( pNds ) 114 {} 115 116 117 SwAttrSetChg::SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet ) 118 : SwMsgPoolItem( RES_ATTRSET_CHG ), 119 bDelSet( sal_False ), 120 pChgSet( &rSet ), 121 pTheChgdSet( &rTheSet ) 122 {} 123 124 125 SwAttrSetChg::SwAttrSetChg( const SwAttrSetChg& rChgSet ) 126 : SwMsgPoolItem( RES_ATTRSET_CHG ), 127 bDelSet( sal_True ), 128 pTheChgdSet( rChgSet.pTheChgdSet ) 129 { 130 pChgSet = new SwAttrSet( *rChgSet.pChgSet ); 131 } 132 133 134 SwAttrSetChg::~SwAttrSetChg() 135 { 136 if( bDelSet ) 137 delete pChgSet; 138 } 139 140 141 #ifdef DBG_UTIL 142 143 void SwAttrSetChg::ClearItem( sal_uInt16 nWhch ) 144 { 145 ASSERT( bDelSet, "der Set darf nicht veraendert werden!" ); 146 pChgSet->ClearItem( nWhch ); 147 } 148 149 #endif 150 151 152 SwMsgPoolItem::SwMsgPoolItem( sal_uInt16 nWhch ) 153 : SfxPoolItem( nWhch ) 154 {} 155 156 157 // "Overhead" vom SfxPoolItem 158 int SwMsgPoolItem::operator==( const SfxPoolItem& ) const 159 { 160 ASSERT( sal_False, "SwMsgPoolItem kennt kein ==" ); 161 return 0; 162 } 163 164 165 SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const 166 { 167 ASSERT( sal_False, "SwMsgPoolItem kennt kein Clone" ); 168 return 0; 169 } 170 171 /****************************************************************************** 172 * hole aus der Default-Attribut Tabelle ueber den Which-Wert 173 * das entsprechende default Attribut. 174 * Ist keines vorhanden, returnt ein 0-Pointer !!! 175 * Used to be inlined (hintids.hxx) in PRODUCT. 176 ******************************************************************************/ 177 #ifndef DBG_UTIL 178 const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich ) 179 { 180 return aAttrTab[ nWhich - POOLATTR_BEGIN ]; 181 } 182 #else 183 const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich ) 184 { 185 ASSERT_ID( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN, 186 ERR_OUTOFSCOPE ); 187 188 SfxPoolItem *pHt = aAttrTab[ nWhich - POOLATTR_BEGIN ]; 189 ASSERT( pHt, "GetDfltFmtAttr(): Dflt == 0" ); 190 return pHt; 191 } 192 #endif 193 194 195 196 SwCondCollCondChg::SwCondCollCondChg( SwFmt *pFmt ) 197 : SwMsgPoolItem( RES_CONDCOLL_CONDCHG ), pChangedFmt( pFmt ) 198 { 199 } 200 201 202 SwVirtPageNumInfo::SwVirtPageNumInfo( const SwPageFrm *pPg ) : 203 SwMsgPoolItem( RES_VIRTPAGENUM_INFO ), 204 pPage( 0 ), 205 pOrigPage( pPg ), 206 pFrm( 0 ) 207 { 208 } 209 210 // --> OD 2008-02-19 #refactorlists# 211 //SwNumRuleInfo::SwNumRuleInfo( const String& rRuleName ) 212 // : SwMsgPoolItem( RES_GETNUMNODES ), rName( rRuleName ) 213 //{ 214 //} 215 216 //void SwNumRuleInfo::AddNode( SwTxtNode& rNd ) 217 //{ 218 // aList.Insert(rNd.GetIndex(), &rNd); 219 //} 220 221 222 SwFindNearestNode::SwFindNearestNode( const SwNode& rNd ) 223 : SwMsgPoolItem( RES_FINDNEARESTNODE ), pNd( &rNd ), pFnd( 0 ) 224 { 225 } 226 227 void SwFindNearestNode::CheckNode( const SwNode& rNd ) 228 { 229 if( &pNd->GetNodes() == &rNd.GetNodes() ) 230 { 231 sal_uLong nIdx = rNd.GetIndex(); 232 if( nIdx < pNd->GetIndex() && 233 ( !pFnd || nIdx > pFnd->GetIndex() ) && 234 nIdx > rNd.GetNodes().GetEndOfExtras().GetIndex() ) 235 pFnd = &rNd; 236 } 237 } 238 239 240 241 sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript ) 242 { 243 static const sal_uInt16 aLangMap[3] = 244 { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE }; 245 static const sal_uInt16 aFontMap[3] = 246 { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_FONT}; 247 static const sal_uInt16 aFontSizeMap[3] = 248 { RES_CHRATR_FONTSIZE, RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CTL_FONTSIZE }; 249 static const sal_uInt16 aWeightMap[3] = 250 { RES_CHRATR_WEIGHT, RES_CHRATR_CJK_WEIGHT, RES_CHRATR_CTL_WEIGHT}; 251 static const sal_uInt16 aPostureMap[3] = 252 { RES_CHRATR_POSTURE, RES_CHRATR_CJK_POSTURE, RES_CHRATR_CTL_POSTURE}; 253 254 const sal_uInt16* pM; 255 switch( nWhich ) 256 { 257 case RES_CHRATR_LANGUAGE: 258 case RES_CHRATR_CJK_LANGUAGE: 259 case RES_CHRATR_CTL_LANGUAGE: 260 pM = aLangMap; 261 break; 262 263 case RES_CHRATR_FONT: 264 case RES_CHRATR_CJK_FONT: 265 case RES_CHRATR_CTL_FONT: 266 pM = aFontMap; 267 break; 268 269 case RES_CHRATR_FONTSIZE: 270 case RES_CHRATR_CJK_FONTSIZE: 271 case RES_CHRATR_CTL_FONTSIZE: 272 pM = aFontSizeMap; 273 break; 274 275 case RES_CHRATR_WEIGHT: 276 case RES_CHRATR_CJK_WEIGHT: 277 case RES_CHRATR_CTL_WEIGHT: 278 pM = aWeightMap; 279 break; 280 case RES_CHRATR_POSTURE: 281 case RES_CHRATR_CJK_POSTURE: 282 case RES_CHRATR_CTL_POSTURE: 283 pM = aPostureMap; 284 break; 285 286 default: 287 pM = 0; 288 } 289 290 sal_uInt16 nRet; 291 if( pM ) 292 { 293 using namespace ::com::sun::star::i18n; 294 { 295 if( ScriptType::WEAK == nScript ) 296 nScript = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); 297 switch( nScript) 298 { 299 case ScriptType::COMPLEX: ++pM; // no break; 300 case ScriptType::ASIAN: ++pM; // no break; 301 default: nRet = *pM; 302 } 303 } 304 } 305 else 306 nRet = nWhich; 307 return nRet; 308 } 309