Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <com/sun/star/i18n/ScriptType.hpp>
30 : : #include <editeng/scripttypeitem.hxx>
31 : : #include <hintids.hxx>
32 : : #include <hints.hxx>
33 : : #include <ndtxt.hxx>
34 : : #include <swtypes.hxx>
35 : :
36 : 27615 : SwFmtChg::SwFmtChg( SwFmt* pFmt )
37 : 27615 : : SwMsgPoolItem( RES_FMT_CHG ), pChangedFmt( pFmt )
38 : : {
39 : 27615 : }
40 : :
41 : 11071 : SwInsTxt::SwInsTxt( xub_StrLen nP, xub_StrLen nL )
42 : 11071 : : SwMsgPoolItem( RES_INS_TXT ), nPos( nP ), nLen( nL )
43 : : {
44 : 11071 : }
45 : :
46 : 449 : SwDelChr::SwDelChr( xub_StrLen nP )
47 : 449 : : SwMsgPoolItem( RES_DEL_CHR ), nPos( nP )
48 : : {
49 : 449 : }
50 : :
51 : 2086 : SwDelTxt::SwDelTxt( xub_StrLen nS, xub_StrLen nL )
52 : 2086 : : SwMsgPoolItem( RES_DEL_TXT ), nStart( nS ), nLen( nL )
53 : : {
54 : 2086 : }
55 : :
56 : 16535 : SwUpdateAttr::SwUpdateAttr( xub_StrLen nS, xub_StrLen nE, sal_uInt16 nW )
57 : 16535 : : SwMsgPoolItem( RES_UPDATE_ATTR ), nStart( nS ), nEnd( nE ), nWhichAttr( nW )
58 : : {
59 : 16535 : }
60 : :
61 : :
62 : : /** Is sent if reference marks should be updated.
63 : :
64 : : To get the page/chapter number, the frame has to be asked. For that we need
65 : : the current OutputDevice.
66 : : */
67 : 0 : SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice* pOutput )
68 : : : SwMsgPoolItem( RES_REFMARKFLD_UPDATE ),
69 : 0 : pOut( pOutput )
70 : : {
71 : : OSL_ENSURE( pOut, "No OutputDevice pointer" );
72 : 0 : }
73 : :
74 : 1551 : SwDocPosUpdate::SwDocPosUpdate( const SwTwips nDcPos )
75 : 1551 : : SwMsgPoolItem( RES_DOCPOS_UPDATE ), nDocPos(nDcPos)
76 : : {
77 : 1551 : }
78 : :
79 : : /** Is sent if a table should be recalculated */
80 : 285 : SwTableFmlUpdate::SwTableFmlUpdate( const SwTable* pNewTbl )
81 : : : SwMsgPoolItem( RES_TABLEFML_UPDATE ),
82 : : pTbl( pNewTbl ), pHistory( 0 ), nSplitLine( USHRT_MAX ),
83 : 285 : eFlags( TBL_CALC )
84 : : {
85 : 285 : DATA.pDelTbl = 0;
86 : 285 : bModified = bBehindSplitLine = sal_False;
87 : : OSL_ENSURE( pTbl, "No Table pointer" );
88 : 285 : }
89 : :
90 : 128923 : SwAutoFmtGetDocNode::SwAutoFmtGetDocNode( const SwNodes* pNds )
91 : 128923 : : SwMsgPoolItem( RES_AUTOFMT_DOCNODE ), pCntntNode( 0 ), pNodes( pNds )
92 : : {
93 : 128923 : }
94 : :
95 : 212958 : SwAttrSetChg::SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet )
96 : : : SwMsgPoolItem( RES_ATTRSET_CHG ),
97 : : bDelSet( sal_False ),
98 : : pChgSet( &rSet ),
99 : 212958 : pTheChgdSet( &rTheSet )
100 : : {
101 : 212958 : }
102 : :
103 : 282768 : SwAttrSetChg::SwAttrSetChg( const SwAttrSetChg& rChgSet )
104 : : : SwMsgPoolItem( RES_ATTRSET_CHG ),
105 : : bDelSet( sal_True ),
106 : 282768 : pTheChgdSet( rChgSet.pTheChgdSet )
107 : : {
108 [ + - ][ + - ]: 282768 : pChgSet = new SwAttrSet( *rChgSet.pChgSet );
109 : 282768 : }
110 : :
111 : 495726 : SwAttrSetChg::~SwAttrSetChg()
112 : : {
113 [ + + ]: 495726 : if( bDelSet )
114 [ + - ][ + - ]: 282768 : delete pChgSet;
115 [ - + ]: 495726 : }
116 : :
117 : : #ifdef DBG_UTIL
118 : : void SwAttrSetChg::ClearItem( sal_uInt16 nWhch )
119 : : {
120 : : OSL_ENSURE( bDelSet, "der Set darf nicht veraendert werden!" );
121 : : pChgSet->ClearItem( nWhch );
122 : : }
123 : : #endif
124 : :
125 : 735930 : SwMsgPoolItem::SwMsgPoolItem( sal_uInt16 nWhch )
126 : 735930 : : SfxPoolItem( nWhch )
127 : : {
128 : 735930 : }
129 : :
130 : : // "Overhead" of SfxPoolItem
131 : 0 : int SwMsgPoolItem::operator==( const SfxPoolItem& ) const
132 : : {
133 : : OSL_FAIL( "SwMsgPoolItem kennt kein ==" );
134 : 0 : return 0;
135 : : }
136 : :
137 : 0 : SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const
138 : : {
139 : : OSL_FAIL( "SwMsgPoolItem kennt kein Clone" );
140 : 0 : return 0;
141 : : }
142 : :
143 : : #if OSL_DEBUG_LEVEL > 0
144 : : /** Get the default attribute from corresponding default attribute table.
145 : :
146 : : @param[in] nWhich Position in table
147 : : @return Attribute if found, null pointer otherwise
148 : : */
149 : : const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
150 : : {
151 : : OSL_ASSERT( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN );
152 : :
153 : : SfxPoolItem *pHt = aAttrTab[ nWhich - POOLATTR_BEGIN ];
154 : : OSL_ENSURE( pHt, "GetDfltFmtAttr(): Dflt == 0" );
155 : : return pHt;
156 : : }
157 : : #else
158 : : /** Get the default attribute from corresponding default attribute table.
159 : :
160 : : @param[in] nWhich Position in table
161 : : */
162 : 4116 : const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
163 : : {
164 : 4116 : return aAttrTab[ nWhich - POOLATTR_BEGIN ];
165 : : }
166 : : #endif
167 : :
168 : 0 : SwCondCollCondChg::SwCondCollCondChg( SwFmt *pFmt )
169 : 0 : : SwMsgPoolItem( RES_CONDCOLL_CONDCHG ), pChangedFmt( pFmt )
170 : : {
171 : 0 : }
172 : :
173 : 0 : SwVirtPageNumInfo::SwVirtPageNumInfo( const SwPageFrm *pPg ) :
174 : 0 : SwMsgPoolItem( RES_VIRTPAGENUM_INFO ), pPage( 0 ), pOrigPage( pPg ), pFrm( 0 )
175 : : {
176 : 0 : }
177 : :
178 : :
179 : 2 : SwFindNearestNode::SwFindNearestNode( const SwNode& rNd )
180 : 2 : : SwMsgPoolItem( RES_FINDNEARESTNODE ), pNd( &rNd ), pFnd( 0 )
181 : : {
182 : 2 : }
183 : :
184 : 0 : void SwFindNearestNode::CheckNode( const SwNode& rNd )
185 : : {
186 [ # # ]: 0 : if( &pNd->GetNodes() == &rNd.GetNodes() )
187 : : {
188 : 0 : sal_uLong nIdx = rNd.GetIndex();
189 [ # # # # : 0 : if( nIdx < pNd->GetIndex() &&
# # ][ # # ]
[ # # ]
190 : 0 : ( !pFnd || nIdx > pFnd->GetIndex() ) &&
191 : 0 : nIdx > rNd.GetNodes().GetEndOfExtras().GetIndex() )
192 : 0 : pFnd = &rNd;
193 : : }
194 : 0 : }
195 : :
196 : 287915 : sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript )
197 : : {
198 : : static const sal_uInt16 aLangMap[3] =
199 : : { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE };
200 : : static const sal_uInt16 aFontMap[3] =
201 : : { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_FONT};
202 : : static const sal_uInt16 aFontSizeMap[3] =
203 : : { RES_CHRATR_FONTSIZE, RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CTL_FONTSIZE };
204 : : static const sal_uInt16 aWeightMap[3] =
205 : : { RES_CHRATR_WEIGHT, RES_CHRATR_CJK_WEIGHT, RES_CHRATR_CTL_WEIGHT};
206 : : static const sal_uInt16 aPostureMap[3] =
207 : : { RES_CHRATR_POSTURE, RES_CHRATR_CJK_POSTURE, RES_CHRATR_CTL_POSTURE};
208 : :
209 : : const sal_uInt16* pM;
210 [ + + - - : 287915 : switch( nWhich )
- - ]
211 : : {
212 : : case RES_CHRATR_LANGUAGE:
213 : : case RES_CHRATR_CJK_LANGUAGE:
214 : : case RES_CHRATR_CTL_LANGUAGE:
215 : 287231 : pM = aLangMap;
216 : 287231 : break;
217 : :
218 : : case RES_CHRATR_FONT:
219 : : case RES_CHRATR_CJK_FONT:
220 : : case RES_CHRATR_CTL_FONT:
221 : 684 : pM = aFontMap;
222 : 684 : break;
223 : :
224 : : case RES_CHRATR_FONTSIZE:
225 : : case RES_CHRATR_CJK_FONTSIZE:
226 : : case RES_CHRATR_CTL_FONTSIZE:
227 : 0 : pM = aFontSizeMap;
228 : 0 : break;
229 : :
230 : : case RES_CHRATR_WEIGHT:
231 : : case RES_CHRATR_CJK_WEIGHT:
232 : : case RES_CHRATR_CTL_WEIGHT:
233 : 0 : pM = aWeightMap;
234 : 0 : break;
235 : :
236 : : case RES_CHRATR_POSTURE:
237 : : case RES_CHRATR_CJK_POSTURE:
238 : : case RES_CHRATR_CTL_POSTURE:
239 : 0 : pM = aPostureMap;
240 : 0 : break;
241 : :
242 : : default:
243 : 0 : pM = 0;
244 : : }
245 : :
246 : : sal_uInt16 nRet;
247 [ + - ]: 287915 : if( pM )
248 : : {
249 : : using namespace ::com::sun::star::i18n;
250 : : {
251 [ + + ]: 287915 : if( ScriptType::WEAK == nScript )
252 : 1389 : nScript = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() );
253 [ - + + ]: 287915 : switch( nScript)
254 : : {
255 : : case ScriptType::COMPLEX:
256 : 0 : ++pM; // no break;
257 : : case ScriptType::ASIAN:
258 : 138 : ++pM; // no break;
259 : : default:
260 : 287915 : nRet = *pM;
261 : : }
262 : : }
263 : : }
264 : : else
265 : 0 : nRet = nWhich;
266 : 287915 : return nRet;
267 : : }
268 : :
269 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|