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 <tools/shl.hxx>
30 : : #include <tools/resid.hxx>
31 : : #include <tools/stream.hxx>
32 : : #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
33 : :
34 : : #include <editeng/optitems.hxx>
35 : : #include <editeng/eerdll.hxx>
36 : : #include <editeng/editrids.hrc>
37 : :
38 : : using namespace ::com::sun::star::uno;
39 : : using namespace ::com::sun::star::linguistic2;
40 : :
41 : : // STATIC DATA -----------------------------------------------------------
42 : :
43 [ # # ][ # # ]: 0 : TYPEINIT1(SfxSpellCheckItem, SfxPoolItem);
44 [ # # ][ # # ]: 0 : TYPEINIT1(SfxHyphenRegionItem, SfxPoolItem);
45 : :
46 : : // class SfxSpellCheckItem -----------------------------------------------
47 : :
48 : 0 : SfxSpellCheckItem::SfxSpellCheckItem
49 : : (
50 : : Reference< XSpellChecker1 > &xChecker,
51 : : sal_uInt16 _nWhich
52 : : ) :
53 : :
54 : 0 : SfxPoolItem( _nWhich )
55 : : {
56 [ # # ]: 0 : xSpellCheck = xChecker;
57 : 0 : }
58 : :
59 : : // -----------------------------------------------------------------------
60 : :
61 : 0 : SfxSpellCheckItem::SfxSpellCheckItem( const SfxSpellCheckItem& rItem ) :
62 : :
63 : : SfxPoolItem( rItem ),
64 [ # # ]: 0 : xSpellCheck( rItem.GetXSpellChecker() )
65 : : {
66 : 0 : }
67 : :
68 : : //------------------------------------------------------------------------
69 : :
70 : 0 : SfxItemPresentation SfxSpellCheckItem::GetPresentation
71 : : (
72 : : SfxItemPresentation ePres,
73 : : SfxMapUnit ,
74 : : SfxMapUnit ,
75 : : String& rText,
76 : : const IntlWrapper*
77 : : ) const
78 : : {
79 [ # # # ]: 0 : switch ( ePres )
80 : : {
81 : : case SFX_ITEM_PRESENTATION_NONE:
82 : 0 : rText.Erase();
83 : 0 : return SFX_ITEM_PRESENTATION_NONE;
84 : :
85 : : case SFX_ITEM_PRESENTATION_NAMELESS:
86 : : case SFX_ITEM_PRESENTATION_COMPLETE:
87 : : {
88 : 0 : return ePres;
89 : : }
90 : : default:
91 : 0 : return SFX_ITEM_PRESENTATION_NONE;
92 : : }
93 : : }
94 : :
95 : : // -----------------------------------------------------------------------
96 : :
97 : 0 : SfxPoolItem* SfxSpellCheckItem::Clone( SfxItemPool* ) const
98 : : {
99 [ # # ]: 0 : return new SfxSpellCheckItem( *this );
100 : : }
101 : :
102 : : // -----------------------------------------------------------------------
103 : :
104 : 0 : int SfxSpellCheckItem::operator==( const SfxPoolItem& rItem ) const
105 : : {
106 : : DBG_ASSERT( SfxPoolItem::operator==(rItem), "unequal types" );
107 [ # # ]: 0 : return ( xSpellCheck == ( (const SfxSpellCheckItem& )rItem ).GetXSpellChecker() );
108 : : }
109 : :
110 : : // class SfxHyphenRegionItem -----------------------------------------------
111 : :
112 : 0 : SfxHyphenRegionItem::SfxHyphenRegionItem( const sal_uInt16 nId ) :
113 : :
114 : 0 : SfxPoolItem( nId )
115 : : {
116 : 0 : nMinLead = nMinTrail = 0;
117 : 0 : }
118 : :
119 : : // -----------------------------------------------------------------------
120 : :
121 : 0 : SfxHyphenRegionItem::SfxHyphenRegionItem( const SfxHyphenRegionItem& rItem ) :
122 : :
123 : : SfxPoolItem ( rItem ),
124 : :
125 : 0 : nMinLead ( rItem.GetMinLead() ),
126 : 0 : nMinTrail ( rItem.GetMinTrail() )
127 : : {
128 : 0 : }
129 : :
130 : : // -----------------------------------------------------------------------
131 : :
132 : 0 : int SfxHyphenRegionItem::operator==( const SfxPoolItem& rAttr ) const
133 : : {
134 : : DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
135 : :
136 : : return ( ( ( (SfxHyphenRegionItem&)rAttr ).nMinLead == nMinLead ) &&
137 [ # # ][ # # ]: 0 : ( ( (SfxHyphenRegionItem&)rAttr ).nMinTrail == nMinTrail ) );
138 : : }
139 : :
140 : : // -----------------------------------------------------------------------
141 : :
142 : 0 : SfxPoolItem* SfxHyphenRegionItem::Clone( SfxItemPool* ) const
143 : : {
144 [ # # ]: 0 : return new SfxHyphenRegionItem( *this );
145 : : }
146 : :
147 : : //------------------------------------------------------------------------
148 : :
149 : 0 : SfxItemPresentation SfxHyphenRegionItem::GetPresentation
150 : : (
151 : : SfxItemPresentation ePres,
152 : : SfxMapUnit ,
153 : : SfxMapUnit ,
154 : : String& rText,
155 : : const IntlWrapper*
156 : : ) const
157 : : {
158 [ # # # ]: 0 : switch ( ePres )
159 : : {
160 : : case SFX_ITEM_PRESENTATION_NONE:
161 : 0 : rText.Erase();
162 : 0 : return SFX_ITEM_PRESENTATION_NONE;
163 : :
164 : : case SFX_ITEM_PRESENTATION_NAMELESS:
165 : : case SFX_ITEM_PRESENTATION_COMPLETE:
166 : : {
167 [ # # ]: 0 : rText += String::CreateFromInt32( nMinLead );
168 [ # # ][ # # ]: 0 : rText += EE_RESSTR( RID_SVXITEMS_HYPHEN_MINLEAD );
169 : 0 : rText += ',';
170 [ # # ]: 0 : rText += String::CreateFromInt32( nMinTrail );
171 [ # # ][ # # ]: 0 : rText += EE_RESSTR( RID_SVXITEMS_HYPHEN_MINTRAIL );
172 : 0 : return ePres;
173 : : }
174 : : default:
175 : 0 : return SFX_ITEM_PRESENTATION_NONE;
176 : : }
177 : : }
178 : :
179 : : // -----------------------------------------------------------------------
180 : :
181 : 0 : SfxPoolItem* SfxHyphenRegionItem::Create(SvStream& rStrm, sal_uInt16 ) const
182 : : {
183 : : sal_uInt8 _nMinLead, _nMinTrail;
184 [ # # ][ # # ]: 0 : rStrm >> _nMinLead >> _nMinTrail;
185 [ # # ][ # # ]: 0 : SfxHyphenRegionItem* pAttr = new SfxHyphenRegionItem( Which() );
186 : 0 : pAttr->GetMinLead() = _nMinLead;
187 : 0 : pAttr->GetMinTrail() = _nMinTrail;
188 : 0 : return pAttr;
189 : : }
190 : :
191 : : // -----------------------------------------------------------------------
192 : :
193 : 0 : SvStream& SfxHyphenRegionItem::Store( SvStream& rStrm, sal_uInt16 ) const
194 : : {
195 : 0 : rStrm << (sal_uInt8) GetMinLead()
196 : 0 : << (sal_uInt8) GetMinTrail();
197 : 0 : return rStrm;
198 : : }
199 : :
200 : :
201 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|