Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <com/sun/star/i18n/ScriptType.hpp>
21 : #include <editeng/scripttypeitem.hxx>
22 : #include <hintids.hxx>
23 : #include <hints.hxx>
24 : #include <ndtxt.hxx>
25 : #include <swtypes.hxx>
26 :
27 82503 : SwFmtChg::SwFmtChg( SwFmt* pFmt )
28 82503 : : SwMsgPoolItem( RES_FMT_CHG ), pChangedFmt( pFmt )
29 : {
30 82503 : }
31 :
32 10298 : SwInsTxt::SwInsTxt( sal_Int32 nP, sal_Int32 nL )
33 10298 : : SwMsgPoolItem( RES_INS_TXT ), nPos( nP ), nLen( nL )
34 : {
35 10298 : }
36 :
37 1730 : SwDelChr::SwDelChr( sal_Int32 nP )
38 1730 : : SwMsgPoolItem( RES_DEL_CHR ), nPos( nP )
39 : {
40 1730 : }
41 :
42 1041 : SwDelTxt::SwDelTxt( sal_Int32 nS, sal_Int32 nL )
43 1041 : : SwMsgPoolItem( RES_DEL_TXT ), nStart( nS ), nLen( nL )
44 : {
45 1041 : }
46 :
47 55367 : SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW )
48 55367 : : SwMsgPoolItem( RES_UPDATE_ATTR ), nStart( nS ), nEnd( nE ), nWhichAttr( nW )
49 : {
50 55367 : }
51 :
52 : /** Is sent if reference marks should be updated.
53 :
54 : To get the page/chapter number, the frame has to be asked. For that we need
55 : the current OutputDevice.
56 : */
57 0 : SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice* pOutput )
58 : : SwMsgPoolItem( RES_REFMARKFLD_UPDATE ),
59 0 : pOut( pOutput )
60 : {
61 : OSL_ENSURE( pOut, "No OutputDevice pointer" );
62 0 : }
63 :
64 2356 : SwDocPosUpdate::SwDocPosUpdate( const SwTwips nDcPos )
65 2356 : : SwMsgPoolItem( RES_DOCPOS_UPDATE ), nDocPos(nDcPos)
66 : {
67 2356 : }
68 :
69 : /** Is sent if a table should be recalculated */
70 673 : SwTableFmlUpdate::SwTableFmlUpdate( const SwTable* pNewTbl )
71 : : SwMsgPoolItem( RES_TABLEFML_UPDATE ),
72 : pTbl( pNewTbl ), pHistory( 0 ), nSplitLine( USHRT_MAX ),
73 673 : eFlags( TBL_CALC )
74 : {
75 673 : DATA.pDelTbl = 0;
76 673 : bModified = bBehindSplitLine = sal_False;
77 : OSL_ENSURE( pTbl, "No Table pointer" );
78 673 : }
79 :
80 94351 : SwAutoFmtGetDocNode::SwAutoFmtGetDocNode( const SwNodes* pNds )
81 94351 : : SwMsgPoolItem( RES_AUTOFMT_DOCNODE ), pCntntNode( 0 ), pNodes( pNds )
82 : {
83 94351 : }
84 :
85 707238 : SwAttrSetChg::SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet )
86 : : SwMsgPoolItem( RES_ATTRSET_CHG ),
87 : bDelSet( sal_False ),
88 : pChgSet( &rSet ),
89 707238 : pTheChgdSet( &rTheSet )
90 : {
91 707238 : }
92 :
93 532224 : SwAttrSetChg::SwAttrSetChg( const SwAttrSetChg& rChgSet )
94 : : SwMsgPoolItem( RES_ATTRSET_CHG ),
95 : bDelSet( sal_True ),
96 532224 : pTheChgdSet( rChgSet.pTheChgdSet )
97 : {
98 532224 : pChgSet = new SwAttrSet( *rChgSet.pChgSet );
99 532224 : }
100 :
101 2478924 : SwAttrSetChg::~SwAttrSetChg()
102 : {
103 1239462 : if( bDelSet )
104 532224 : delete pChgSet;
105 1239462 : }
106 :
107 : #ifdef DBG_UTIL
108 : void SwAttrSetChg::ClearItem( sal_uInt16 nWhch )
109 : {
110 : OSL_ENSURE( bDelSet, "The Set may not be changed!" );
111 : pChgSet->ClearItem( nWhch );
112 : }
113 : #endif
114 :
115 1703412 : SwMsgPoolItem::SwMsgPoolItem( sal_uInt16 nWhch )
116 1703412 : : SfxPoolItem( nWhch )
117 : {
118 1703412 : }
119 :
120 : // "Overhead" of SfxPoolItem
121 0 : bool SwMsgPoolItem::operator==( const SfxPoolItem& ) const
122 : {
123 : OSL_FAIL( "SwMsgPoolItem knows no ==" );
124 0 : return false;
125 : }
126 :
127 0 : SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const
128 : {
129 : OSL_FAIL( "SwMsgPoolItem knows no Clone" );
130 0 : return 0;
131 : }
132 :
133 : #if OSL_DEBUG_LEVEL > 0
134 : /** Get the default attribute from corresponding default attribute table.
135 :
136 : @param[in] nWhich Position in table
137 : @return Attribute if found, null pointer otherwise
138 : */
139 : const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
140 : {
141 : OSL_ASSERT( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN );
142 :
143 : SfxPoolItem *pHt = aAttrTab[ nWhich - POOLATTR_BEGIN ];
144 : OSL_ENSURE( pHt, "GetDfltFmtAttr(): Dflt == 0" );
145 : return pHt;
146 : }
147 : #else
148 : /** Get the default attribute from corresponding default attribute table.
149 :
150 : @param[in] nWhich Position in table
151 : */
152 3630 : const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
153 : {
154 3630 : return aAttrTab[ nWhich - POOLATTR_BEGIN ];
155 : }
156 : #endif
157 :
158 0 : SwCondCollCondChg::SwCondCollCondChg( SwFmt *pFmt )
159 0 : : SwMsgPoolItem( RES_CONDCOLL_CONDCHG ), pChangedFmt( pFmt )
160 : {
161 0 : }
162 :
163 217 : SwVirtPageNumInfo::SwVirtPageNumInfo( const SwPageFrm *pPg ) :
164 217 : SwMsgPoolItem( RES_VIRTPAGENUM_INFO ), pPage( 0 ), pOrigPage( pPg ), pFrm( 0 )
165 : {
166 217 : }
167 :
168 2285 : SwFindNearestNode::SwFindNearestNode( const SwNode& rNd )
169 2285 : : SwMsgPoolItem( RES_FINDNEARESTNODE ), pNd( &rNd ), pFnd( 0 )
170 : {
171 2285 : }
172 :
173 23928 : void SwFindNearestNode::CheckNode( const SwNode& rNd )
174 : {
175 23928 : if( &pNd->GetNodes() == &rNd.GetNodes() )
176 : {
177 23928 : sal_uLong nIdx = rNd.GetIndex();
178 60926 : if( nIdx < pNd->GetIndex() &&
179 38622 : ( !pFnd || nIdx > pFnd->GetIndex() ) &&
180 3837 : nIdx > rNd.GetNodes().GetEndOfExtras().GetIndex() )
181 3837 : pFnd = &rNd;
182 : }
183 23928 : }
184 :
185 161221 : sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript )
186 : {
187 : static const sal_uInt16 aLangMap[3] =
188 : { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE };
189 : static const sal_uInt16 aFontMap[3] =
190 : { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_FONT};
191 : static const sal_uInt16 aFontSizeMap[3] =
192 : { RES_CHRATR_FONTSIZE, RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CTL_FONTSIZE };
193 : static const sal_uInt16 aWeightMap[3] =
194 : { RES_CHRATR_WEIGHT, RES_CHRATR_CJK_WEIGHT, RES_CHRATR_CTL_WEIGHT};
195 : static const sal_uInt16 aPostureMap[3] =
196 : { RES_CHRATR_POSTURE, RES_CHRATR_CJK_POSTURE, RES_CHRATR_CTL_POSTURE};
197 :
198 : const sal_uInt16* pM;
199 161221 : switch( nWhich )
200 : {
201 : case RES_CHRATR_LANGUAGE:
202 : case RES_CHRATR_CJK_LANGUAGE:
203 : case RES_CHRATR_CTL_LANGUAGE:
204 141694 : pM = aLangMap;
205 141694 : break;
206 :
207 : case RES_CHRATR_FONT:
208 : case RES_CHRATR_CJK_FONT:
209 : case RES_CHRATR_CTL_FONT:
210 19527 : pM = aFontMap;
211 19527 : break;
212 :
213 : case RES_CHRATR_FONTSIZE:
214 : case RES_CHRATR_CJK_FONTSIZE:
215 : case RES_CHRATR_CTL_FONTSIZE:
216 0 : pM = aFontSizeMap;
217 0 : break;
218 :
219 : case RES_CHRATR_WEIGHT:
220 : case RES_CHRATR_CJK_WEIGHT:
221 : case RES_CHRATR_CTL_WEIGHT:
222 0 : pM = aWeightMap;
223 0 : break;
224 :
225 : case RES_CHRATR_POSTURE:
226 : case RES_CHRATR_CJK_POSTURE:
227 : case RES_CHRATR_CTL_POSTURE:
228 0 : pM = aPostureMap;
229 0 : break;
230 :
231 : default:
232 0 : pM = 0;
233 : }
234 :
235 : sal_uInt16 nRet;
236 161221 : if( pM )
237 : {
238 : using namespace ::com::sun::star;
239 : {
240 161221 : if( i18n::ScriptType::WEAK == nScript )
241 1412 : nScript = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() );
242 161221 : switch( nScript)
243 : {
244 : case i18n::ScriptType::COMPLEX:
245 10 : ++pM; // no break;
246 : case i18n::ScriptType::ASIAN:
247 65 : ++pM; // no break;
248 : default:
249 161221 : nRet = *pM;
250 : }
251 : }
252 : }
253 : else
254 0 : nRet = nWhich;
255 161221 : return nRet;
256 : }
257 :
258 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|