1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hints.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
36 #include <com/sun/star/i18n/ScriptType.hdl>
38 #include <svx/scripttypeitem.hxx>
39 #include <hintids.hxx>
40 #include <swtypes.hxx>
44 SwFmtChg::SwFmtChg( SwFmt
*pFmt
)
45 : SwMsgPoolItem( RES_FMT_CHG
),
50 SwInsChr::SwInsChr( xub_StrLen nP
)
51 : SwMsgPoolItem( RES_INS_CHR
),
57 SwInsTxt::SwInsTxt( xub_StrLen nP
, xub_StrLen nL
)
58 : SwMsgPoolItem( RES_INS_TXT
),
65 SwDelChr::SwDelChr( xub_StrLen nP
)
66 : SwMsgPoolItem( RES_DEL_CHR
),
72 SwDelTxt::SwDelTxt( xub_StrLen nS
, xub_StrLen nL
)
73 : SwMsgPoolItem( RES_DEL_TXT
),
80 SwUpdateAttr::SwUpdateAttr( xub_StrLen nS
, xub_StrLen nE
, USHORT nW
)
81 : SwMsgPoolItem( RES_UPDATE_ATTR
),
88 // SwRefMarkFldUpdate wird verschickt, wenn sich die ReferenzMarkierungen
89 // Updaten sollen. Um Seiten-/KapitelNummer feststellen zu koennen, muss
90 // der akt. Frame befragt werden. Dafuer wird das akt. OutputDevice benoetigt.
93 SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice
* pOutput
)
94 : SwMsgPoolItem( RES_REFMARKFLD_UPDATE
),
97 ASSERT( pOut
, "es muss ein OutputDevice-Pointer gesetzt werden!" );
101 SwDocPosUpdate::SwDocPosUpdate( const SwTwips nDcPos
)
102 : SwMsgPoolItem( RES_DOCPOS_UPDATE
),
108 // SwTableFmlUpdate wird verschickt, wenn sich die Tabelle neu berechnen soll
109 SwTableFmlUpdate::SwTableFmlUpdate( const SwTable
* pNewTbl
)
110 : SwMsgPoolItem( RES_TABLEFML_UPDATE
),
111 pTbl( pNewTbl
), pHistory( 0 ), nSplitLine( USHRT_MAX
),
115 bModified
= bBehindSplitLine
= FALSE
;
116 ASSERT( pTbl
, "es muss ein Table-Pointer gesetzt werden!" );
120 SwAutoFmtGetDocNode::SwAutoFmtGetDocNode( const SwNodes
* pNds
)
121 : SwMsgPoolItem( RES_AUTOFMT_DOCNODE
),
122 pCntntNode( 0 ), pNodes( pNds
)
126 SwAttrSetChg::SwAttrSetChg( const SwAttrSet
& rTheSet
, SwAttrSet
& rSet
)
127 : SwMsgPoolItem( RES_ATTRSET_CHG
),
130 pTheChgdSet( &rTheSet
)
134 SwAttrSetChg::SwAttrSetChg( const SwAttrSetChg
& rChgSet
)
135 : SwMsgPoolItem( RES_ATTRSET_CHG
),
137 pTheChgdSet( rChgSet
.pTheChgdSet
)
139 pChgSet
= new SwAttrSet( *rChgSet
.pChgSet
);
143 SwAttrSetChg::~SwAttrSetChg()
152 void SwAttrSetChg::ClearItem( USHORT nWhch
)
154 ASSERT( bDelSet
, "der Set darf nicht veraendert werden!" );
155 pChgSet
->ClearItem( nWhch
);
161 SwMsgPoolItem::SwMsgPoolItem( USHORT nWhch
)
162 : SfxPoolItem( nWhch
)
166 // "Overhead" vom SfxPoolItem
167 int SwMsgPoolItem::operator==( const SfxPoolItem
& ) const
169 ASSERT( FALSE
, "SwMsgPoolItem kennt kein ==" );
174 SfxPoolItem
* SwMsgPoolItem::Clone( SfxItemPool
* ) const
176 ASSERT( FALSE
, "SwMsgPoolItem kennt kein Clone" );
180 /******************************************************************************
181 * hole aus der Default-Attribut Tabelle ueber den Which-Wert
182 * das entsprechende default Attribut.
183 * Ist keines vorhanden, returnt ein 0-Pointer !!!
184 * Used to be inlined (hintids.hxx) in PRODUCT.
185 ******************************************************************************/
187 const SfxPoolItem
* GetDfltAttr( USHORT nWhich
)
189 return aAttrTab
[ nWhich
- POOLATTR_BEGIN
];
192 const SfxPoolItem
* GetDfltAttr( USHORT nWhich
)
194 ASSERT_ID( nWhich
< POOLATTR_END
&& nWhich
>= POOLATTR_BEGIN
,
197 SfxPoolItem
*pHt
= aAttrTab
[ nWhich
- POOLATTR_BEGIN
];
198 ASSERT( pHt
, "GetDfltFmtAttr(): Dflt == 0" );
205 SwCondCollCondChg::SwCondCollCondChg( SwFmt
*pFmt
)
206 : SwMsgPoolItem( RES_CONDCOLL_CONDCHG
), pChangedFmt( pFmt
)
211 SwVirtPageNumInfo::SwVirtPageNumInfo( const SwPageFrm
*pPg
) :
212 SwMsgPoolItem( RES_VIRTPAGENUM_INFO
),
219 // --> OD 2008-02-19 #refactorlists#
220 //SwNumRuleInfo::SwNumRuleInfo( const String& rRuleName )
221 // : SwMsgPoolItem( RES_GETNUMNODES ), rName( rRuleName )
225 //void SwNumRuleInfo::AddNode( SwTxtNode& rNd )
227 // aList.Insert(rNd.GetIndex(), &rNd);
230 SwNRuleLowerLevel::SwNRuleLowerLevel( const String
& rRuleName
, BYTE nSrchLvl
)
231 : SwMsgPoolItem( RES_GETLOWERNUMLEVEL
), rName( rRuleName
),
237 SwFindNearestNode::SwFindNearestNode( const SwNode
& rNd
)
238 : SwMsgPoolItem( RES_FINDNEARESTNODE
), pNd( &rNd
), pFnd( 0 )
242 void SwFindNearestNode::CheckNode( const SwNode
& rNd
)
244 if( &pNd
->GetNodes() == &rNd
.GetNodes() )
246 ULONG nIdx
= rNd
.GetIndex();
247 if( nIdx
< pNd
->GetIndex() &&
248 ( !pFnd
|| nIdx
> pFnd
->GetIndex() ) &&
249 nIdx
> rNd
.GetNodes().GetEndOfExtras().GetIndex() )
256 USHORT
GetWhichOfScript( USHORT nWhich
, USHORT nScript
)
258 static const USHORT aLangMap
[3] =
259 { RES_CHRATR_LANGUAGE
, RES_CHRATR_CJK_LANGUAGE
, RES_CHRATR_CTL_LANGUAGE
};
260 static const USHORT aFontMap
[3] =
261 { RES_CHRATR_FONT
, RES_CHRATR_CJK_FONT
, RES_CHRATR_CTL_FONT
};
262 static const USHORT aFontSizeMap
[3] =
263 { RES_CHRATR_FONTSIZE
, RES_CHRATR_CJK_FONTSIZE
, RES_CHRATR_CTL_FONTSIZE
};
264 static const USHORT aWeightMap
[3] =
265 { RES_CHRATR_WEIGHT
, RES_CHRATR_CJK_WEIGHT
, RES_CHRATR_CTL_WEIGHT
};
266 static const USHORT aPostureMap
[3] =
267 { RES_CHRATR_POSTURE
, RES_CHRATR_CJK_POSTURE
, RES_CHRATR_CTL_POSTURE
};
272 case RES_CHRATR_LANGUAGE
:
273 case RES_CHRATR_CJK_LANGUAGE
:
274 case RES_CHRATR_CTL_LANGUAGE
:
278 case RES_CHRATR_FONT
:
279 case RES_CHRATR_CJK_FONT
:
280 case RES_CHRATR_CTL_FONT
:
284 case RES_CHRATR_FONTSIZE
:
285 case RES_CHRATR_CJK_FONTSIZE
:
286 case RES_CHRATR_CTL_FONTSIZE
:
290 case RES_CHRATR_WEIGHT
:
291 case RES_CHRATR_CJK_WEIGHT
:
292 case RES_CHRATR_CTL_WEIGHT
:
295 case RES_CHRATR_POSTURE
:
296 case RES_CHRATR_CJK_POSTURE
:
297 case RES_CHRATR_CTL_POSTURE
:
308 using namespace ::com::sun::star::i18n
;
310 if( ScriptType::WEAK
== nScript
)
311 nScript
= GetI18NScriptTypeOfLanguage( (USHORT
)GetAppLanguage() );
314 case ScriptType::COMPLEX
: ++pM
; // no break;
315 case ScriptType::ASIAN
: ++pM
; // no break;