1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <tools/resid.hxx>
21 #include <tools/stream.hxx>
22 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
24 #include <editeng/optitems.hxx>
25 #include <editeng/eerdll.hxx>
26 #include <editeng/editrids.hrc>
28 using namespace ::com::sun::star::uno
;
29 using namespace ::com::sun::star::linguistic2
;
31 // STATIC DATA -----------------------------------------------------------
33 TYPEINIT1(SfxSpellCheckItem
, SfxPoolItem
);
34 TYPEINIT1(SfxHyphenRegionItem
, SfxPoolItem
);
36 // class SfxSpellCheckItem -----------------------------------------------
38 SfxSpellCheckItem::SfxSpellCheckItem
40 Reference
< XSpellChecker1
> &xChecker
,
44 SfxPoolItem( _nWhich
)
46 xSpellCheck
= xChecker
;
51 SfxSpellCheckItem::SfxSpellCheckItem( const SfxSpellCheckItem
& rItem
) :
54 xSpellCheck( rItem
.GetXSpellChecker() )
60 bool SfxSpellCheckItem::GetPresentation
74 SfxPoolItem
* SfxSpellCheckItem::Clone( SfxItemPool
* ) const
76 return new SfxSpellCheckItem( *this );
81 bool SfxSpellCheckItem::operator==( const SfxPoolItem
& rItem
) const
83 DBG_ASSERT( SfxPoolItem::operator==(rItem
), "unequal types" );
84 return ( xSpellCheck
== static_cast<const SfxSpellCheckItem
&>( rItem
).GetXSpellChecker() );
87 // class SfxHyphenRegionItem -----------------------------------------------
89 SfxHyphenRegionItem::SfxHyphenRegionItem( const sal_uInt16 nId
) :
93 nMinLead
= nMinTrail
= 0;
98 SfxHyphenRegionItem::SfxHyphenRegionItem( const SfxHyphenRegionItem
& rItem
) :
100 SfxPoolItem ( rItem
),
102 nMinLead ( rItem
.GetMinLead() ),
103 nMinTrail ( rItem
.GetMinTrail() )
109 bool SfxHyphenRegionItem::operator==( const SfxPoolItem
& rAttr
) const
111 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
113 return ( ( static_cast<const SfxHyphenRegionItem
&>( rAttr
).nMinLead
== nMinLead
) &&
114 ( static_cast<const SfxHyphenRegionItem
&>( rAttr
).nMinTrail
== nMinTrail
) );
119 SfxPoolItem
* SfxHyphenRegionItem::Clone( SfxItemPool
* ) const
121 return new SfxHyphenRegionItem( *this );
126 bool SfxHyphenRegionItem::GetPresentation
128 SfxItemPresentation
/*ePres*/,
136 EE_RESSTR(RID_SVXITEMS_HYPHEN_MINLEAD
).replaceAll("%1", OUString::number(nMinLead
)) +
138 EE_RESSTR(RID_SVXITEMS_HYPHEN_MINTRAIL
).replaceAll("%1", OUString::number(nMinTrail
));
144 SfxPoolItem
* SfxHyphenRegionItem::Create(SvStream
& rStrm
, sal_uInt16
) const
146 sal_uInt8 _nMinLead
, _nMinTrail
;
147 rStrm
.ReadUChar( _nMinLead
).ReadUChar( _nMinTrail
);
148 SfxHyphenRegionItem
* pAttr
= new SfxHyphenRegionItem( Which() );
149 pAttr
->GetMinLead() = _nMinLead
;
150 pAttr
->GetMinTrail() = _nMinTrail
;
156 SvStream
& SfxHyphenRegionItem::Store( SvStream
& rStrm
, sal_uInt16
) const
158 rStrm
.WriteUChar( GetMinLead() )
159 .WriteUChar( GetMinTrail() );
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */