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 <unotools/moduleoptions.hxx>
30 : : #include <unotools/fltrcfg.hxx>
31 : : #include "optfltr.hxx"
32 : : #include "optfltr.hrc"
33 : : #include <cuires.hrc>
34 : : #include "helpid.hrc"
35 : : #include <dialmgr.hxx>
36 : :
37 : : enum MSFltrPg2_CheckBoxEntries {
38 : : Math,
39 : : Writer,
40 : : Calc,
41 : : Impress,
42 : : InvalidCBEntry
43 : : };
44 : :
45 : : // -----------------------------------------------------------------------
46 : :
47 : 0 : OfaMSFilterTabPage::OfaMSFilterTabPage(Window* pParent, const SfxItemSet& rSet)
48 : 0 : : SfxTabPage( pParent, CUI_RES( RID_OFAPAGE_MSFILTEROPT ), rSet ),
49 [ # # ]: 0 : aMSWordGB ( this, CUI_RES( GB_WORD ) ),
50 [ # # ]: 0 : aWBasicCodeCB ( this, CUI_RES( CB_WBAS_CODE ) ),
51 [ # # ]: 0 : aWBasicWbctblCB ( this, CUI_RES( CB_WBAS_WBCTBL ) ),
52 [ # # ]: 0 : aWBasicStgCB ( this, CUI_RES( CB_WBAS_STG ) ),
53 [ # # ]: 0 : aMSExcelGB ( this, CUI_RES( GB_EXCEL ) ),
54 [ # # ]: 0 : aEBasicCodeCB ( this, CUI_RES( CB_EBAS_CODE ) ),
55 [ # # ]: 0 : aEBasicExectblCB( this, CUI_RES( CB_EBAS_EXECTBL ) ),
56 [ # # ]: 0 : aEBasicStgCB ( this, CUI_RES( CB_EBAS_STG ) ),
57 [ # # ]: 0 : aMSPPointGB ( this, CUI_RES( GB_PPOINT ) ),
58 [ # # ]: 0 : aPBasicCodeCB ( this, CUI_RES( CB_PBAS_CODE ) ),
59 [ # # ][ # # ]: 0 : aPBasicStgCB ( this, CUI_RES( CB_PBAS_STG ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
60 : : {
61 [ # # ]: 0 : FreeResource();
62 : :
63 [ # # ]: 0 : aWBasicCodeCB.SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl ) );
64 [ # # ]: 0 : aEBasicCodeCB.SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl ) );
65 : 0 : }
66 : :
67 [ # # ][ # # ]: 0 : OfaMSFilterTabPage::~OfaMSFilterTabPage()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
68 : : {
69 [ # # ]: 0 : }
70 : :
71 : 0 : IMPL_LINK_NOARG(OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl)
72 : : {
73 : 0 : aWBasicWbctblCB.Enable( aWBasicCodeCB.IsChecked() );
74 : 0 : return 0;
75 : : }
76 : :
77 : 0 : IMPL_LINK_NOARG(OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl)
78 : : {
79 : 0 : aEBasicExectblCB.Enable( aEBasicCodeCB.IsChecked() );
80 : 0 : return 0;
81 : : }
82 : :
83 : 0 : SfxTabPage* OfaMSFilterTabPage::Create( Window* pParent,
84 : : const SfxItemSet& rAttrSet )
85 : : {
86 [ # # ]: 0 : return new OfaMSFilterTabPage( pParent, rAttrSet );
87 : : }
88 : :
89 : 0 : sal_Bool OfaMSFilterTabPage::FillItemSet( SfxItemSet& )
90 : : {
91 : 0 : SvtFilterOptions& rOpt = SvtFilterOptions::Get();
92 : :
93 : : sal_Bool bFlag;
94 [ # # ]: 0 : if( aWBasicCodeCB.GetSavedValue() != (bFlag = aWBasicCodeCB.IsChecked()))
95 : 0 : rOpt.SetLoadWordBasicCode( bFlag );
96 [ # # ]: 0 : if( aWBasicWbctblCB.GetSavedValue() != (bFlag = aWBasicWbctblCB.IsChecked()))
97 : 0 : rOpt.SetLoadWordBasicExecutable( bFlag );
98 [ # # ]: 0 : if( aWBasicStgCB.GetSavedValue() != (bFlag = aWBasicStgCB.IsChecked()))
99 : 0 : rOpt.SetLoadWordBasicStorage( bFlag );
100 : :
101 [ # # ]: 0 : if( aEBasicCodeCB.GetSavedValue() != (bFlag = aEBasicCodeCB.IsChecked()))
102 : 0 : rOpt.SetLoadExcelBasicCode( bFlag );
103 [ # # ]: 0 : if( aEBasicExectblCB.GetSavedValue() != (bFlag = aEBasicExectblCB.IsChecked()))
104 : 0 : rOpt.SetLoadExcelBasicExecutable( bFlag );
105 [ # # ]: 0 : if( aEBasicStgCB.GetSavedValue() != (bFlag = aEBasicStgCB.IsChecked()))
106 : 0 : rOpt.SetLoadExcelBasicStorage( bFlag );
107 : :
108 [ # # ]: 0 : if( aPBasicCodeCB.GetSavedValue() != (bFlag = aPBasicCodeCB.IsChecked()))
109 : 0 : rOpt.SetLoadPPointBasicCode( bFlag );
110 [ # # ]: 0 : if( aPBasicStgCB.GetSavedValue() != (bFlag = aPBasicStgCB.IsChecked()))
111 : 0 : rOpt.SetLoadPPointBasicStorage( bFlag );
112 : :
113 : 0 : return sal_False;
114 : : }
115 : :
116 : 0 : void OfaMSFilterTabPage::Reset( const SfxItemSet& )
117 : : {
118 : 0 : const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
119 : :
120 : 0 : aWBasicCodeCB.Check( rOpt.IsLoadWordBasicCode() );
121 : 0 : aWBasicCodeCB.SaveValue();
122 : 0 : aWBasicWbctblCB.Check( rOpt.IsLoadWordBasicExecutable() );
123 : 0 : aWBasicWbctblCB.SaveValue();
124 : 0 : aWBasicStgCB.Check( rOpt.IsLoadWordBasicStorage() );
125 : 0 : aWBasicStgCB.SaveValue();
126 : 0 : LoadWordBasicCheckHdl_Impl( &aWBasicCodeCB );
127 : :
128 : 0 : aEBasicCodeCB.Check( rOpt.IsLoadExcelBasicCode() );
129 : 0 : aEBasicCodeCB.SaveValue();
130 : 0 : aEBasicExectblCB.Check( rOpt.IsLoadExcelBasicExecutable() );
131 : 0 : aEBasicExectblCB.SaveValue();
132 : 0 : aEBasicStgCB.Check( rOpt.IsLoadExcelBasicStorage() );
133 : 0 : aEBasicStgCB.SaveValue();
134 : 0 : LoadExcelBasicCheckHdl_Impl( &aEBasicCodeCB );
135 : :
136 : 0 : aPBasicCodeCB.Check( rOpt.IsLoadPPointBasicCode() );
137 : 0 : aPBasicCodeCB.SaveValue();
138 : 0 : aPBasicStgCB.Check( rOpt.IsLoadPPointBasicStorage() );
139 : 0 : aPBasicStgCB.SaveValue();
140 : 0 : }
141 : :
142 : 0 : OfaMSFilterTabPage2::OfaMSFilterTabPage2( Window* pParent,
143 : : const SfxItemSet& rSet )
144 : 0 : : SfxTabPage( pParent, CUI_RES( RID_OFAPAGE_MSFILTEROPT2 ), rSet ),
145 [ # # ]: 0 : m_aCheckLBContainer(this, CUI_RES( CLB_SETTINGS)),
146 : : aCheckLB(m_aCheckLBContainer),
147 [ # # ]: 0 : aHeader1FT ( this, CUI_RES( FT_HEADER1_EXPLANATION )),
148 [ # # ]: 0 : aHeader2FT ( this, CUI_RES( FT_HEADER2_EXPLANATION )),
149 [ # # ]: 0 : sHeader1 ( CUI_RES( ST_HEADER1 )),
150 [ # # ]: 0 : sHeader2 ( CUI_RES( ST_HEADER2 )),
151 [ # # ]: 0 : sChgToFromMath ( CUI_RES( ST_CHG_MATH )),
152 [ # # ]: 0 : sChgToFromWriter ( CUI_RES( ST_CHG_WRITER )),
153 [ # # ]: 0 : sChgToFromCalc ( CUI_RES( ST_CHG_CALC )),
154 [ # # ]: 0 : sChgToFromImpress ( CUI_RES( ST_CHG_IMPRESS )),
155 [ # # ][ # # ]: 0 : pCheckButtonData(0)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
156 : : {
157 [ # # ]: 0 : FreeResource();
158 : :
159 : : static long aStaticTabs[] = { 3, 0, 20, 40 };
160 [ # # ]: 0 : aCheckLB.SvxSimpleTable::SetTabs( aStaticTabs );
161 : :
162 [ # # ]: 0 : String sHeader( sHeader1 );
163 [ # # ][ # # ]: 0 : (( sHeader += '\t' ) += sHeader2 ) += '\t';
[ # # ]
164 : : aCheckLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND,
165 [ # # ][ # # ]: 0 : HIB_CENTER | HIB_VCENTER | HIB_FIXEDPOS | HIB_FIXED );
166 : :
167 [ # # ]: 0 : aCheckLB.SetHelpId( HID_OFAPAGE_MSFLTR2_CLB );
168 [ # # ][ # # ]: 0 : aCheckLB.SetStyle( aCheckLB.GetStyle()|WB_HSCROLL| WB_VSCROLL );
[ # # ]
169 : 0 : }
170 : :
171 [ # # ][ # # ]: 0 : OfaMSFilterTabPage2::~OfaMSFilterTabPage2()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
172 : : {
173 [ # # ][ # # ]: 0 : delete pCheckButtonData;
174 [ # # ]: 0 : }
175 : :
176 : 0 : SfxTabPage* OfaMSFilterTabPage2::Create( Window* pParent,
177 : : const SfxItemSet& rAttrSet )
178 : : {
179 [ # # ]: 0 : return new OfaMSFilterTabPage2( pParent, rAttrSet );
180 : : }
181 : :
182 : 0 : sal_Bool OfaMSFilterTabPage2::FillItemSet( SfxItemSet& )
183 : : {
184 : 0 : SvtFilterOptions& rOpt = SvtFilterOptions::Get();
185 : :
186 : : static struct ChkCBoxEntries{
187 : : MSFltrPg2_CheckBoxEntries eType;
188 : : sal_Bool (SvtFilterOptions:: *FnIs)() const;
189 : : void (SvtFilterOptions:: *FnSet)( sal_Bool bFlag );
190 : : } aChkArr[] = {
191 : : { Math, &SvtFilterOptions::IsMathType2Math,
192 : : &SvtFilterOptions::SetMathType2Math },
193 : : { Math, &SvtFilterOptions::IsMath2MathType,
194 : : &SvtFilterOptions::SetMath2MathType },
195 : : { Writer, &SvtFilterOptions::IsWinWord2Writer,
196 : : &SvtFilterOptions::SetWinWord2Writer },
197 : : { Writer, &SvtFilterOptions::IsWriter2WinWord,
198 : : &SvtFilterOptions::SetWriter2WinWord },
199 : : { Calc, &SvtFilterOptions::IsExcel2Calc,
200 : : &SvtFilterOptions::SetExcel2Calc },
201 : : { Calc, &SvtFilterOptions::IsCalc2Excel,
202 : : &SvtFilterOptions::SetCalc2Excel },
203 : : { Impress, &SvtFilterOptions::IsPowerPoint2Impress,
204 : : &SvtFilterOptions::SetPowerPoint2Impress },
205 : : { Impress, &SvtFilterOptions::IsImpress2PowerPoint,
206 : : &SvtFilterOptions::SetImpress2PowerPoint },
207 : : { InvalidCBEntry, 0, 0 }
208 : : };
209 : :
210 : 0 : sal_Bool bCheck, bFirst = sal_True;
211 [ # # ]: 0 : for( const ChkCBoxEntries* pArr = aChkArr;
212 : 0 : InvalidCBEntry != pArr->eType; ++pArr, bFirst = !bFirst )
213 : : {
214 [ # # ]: 0 : sal_uInt16 nCol = bFirst ? 1 : 2;
215 : 0 : SvLBoxEntry* pEntry = GetEntry4Type( pArr->eType );
216 [ # # ]: 0 : if( pEntry )
217 : : {
218 : 0 : SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem( nCol ));
219 [ # # ][ # # ]: 0 : if( pItem && ((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON )
[ # # ]
220 : : {
221 : 0 : sal_uInt16 nButtonFlags = pItem->GetButtonFlags();
222 : : bCheck = SV_BUTTON_CHECKED ==
223 : 0 : pCheckButtonData->ConvertToButtonState( nButtonFlags );
224 : :
225 [ # # ][ # # ]: 0 : if( bCheck != (rOpt.*pArr->FnIs)() )
226 [ # # ]: 0 : (rOpt.*pArr->FnSet)( bCheck );
227 : : }
228 : : }
229 : : }
230 : :
231 : 0 : return sal_True;
232 : : }
233 : :
234 : 0 : void OfaMSFilterTabPage2::Reset( const SfxItemSet& )
235 : : {
236 [ # # ]: 0 : SvtFilterOptions& rOpt = SvtFilterOptions::Get();
237 : :
238 [ # # ]: 0 : aCheckLB.SetUpdateMode(sal_False);
239 [ # # ]: 0 : aCheckLB.Clear();
240 : :
241 [ # # ]: 0 : SvtModuleOptions aModuleOpt;
242 : :
243 : : // int the same sequence as the enums of MSFltrPg2_CheckBoxEntries
244 [ # # ][ # # ]: 0 : if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) )
245 [ # # ]: 0 : InsertEntry( sChgToFromMath, static_cast< sal_IntPtr >( Math ) );
246 [ # # ][ # # ]: 0 : if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
247 [ # # ]: 0 : InsertEntry( sChgToFromWriter, static_cast< sal_IntPtr >( Writer ) );
248 [ # # ][ # # ]: 0 : if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
249 [ # # ]: 0 : InsertEntry( sChgToFromCalc, static_cast< sal_IntPtr >( Calc ) );
250 [ # # ][ # # ]: 0 : if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
251 [ # # ]: 0 : InsertEntry( sChgToFromImpress, static_cast< sal_IntPtr >( Impress ) );
252 : :
253 : : static struct ChkCBoxEntries{
254 : : MSFltrPg2_CheckBoxEntries eType;
255 : : sal_Bool (SvtFilterOptions:: *FnIs)() const;
256 : : } aChkArr[] = {
257 : : { Math, &SvtFilterOptions::IsMathType2Math },
258 : : { Math, &SvtFilterOptions::IsMath2MathType },
259 : : { Writer, &SvtFilterOptions::IsWinWord2Writer },
260 : : { Writer, &SvtFilterOptions::IsWriter2WinWord },
261 : : { Calc, &SvtFilterOptions::IsExcel2Calc },
262 : : { Calc, &SvtFilterOptions::IsCalc2Excel },
263 : : { Impress, &SvtFilterOptions::IsPowerPoint2Impress },
264 : : { Impress, &SvtFilterOptions::IsImpress2PowerPoint },
265 : : { InvalidCBEntry, NULL }
266 : : };
267 : :
268 : 0 : sal_Bool bFirst = sal_True;
269 [ # # ]: 0 : for( const ChkCBoxEntries* pArr = aChkArr;
270 : 0 : InvalidCBEntry != pArr->eType; ++pArr, bFirst = !bFirst )
271 : : {
272 [ # # ]: 0 : sal_uInt16 nCol = bFirst ? 1 : 2;
273 [ # # ]: 0 : SvLBoxEntry* pEntry = GetEntry4Type( static_cast< sal_IntPtr >( pArr->eType ) );
274 [ # # ]: 0 : if( pEntry )
275 : : {
276 [ # # ]: 0 : SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem( nCol ));
277 [ # # ][ # # ]: 0 : if( pItem && ((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON )
[ # # ][ # # ]
278 : : {
279 [ # # ][ # # ]: 0 : if( (rOpt.*pArr->FnIs)() )
[ # # ]
280 [ # # ]: 0 : pItem->SetStateChecked();
281 : : else
282 [ # # ]: 0 : pItem->SetStateUnchecked();
283 [ # # ]: 0 : aCheckLB.InvalidateEntry( pEntry );
284 : : }
285 : : }
286 : : }
287 [ # # ][ # # ]: 0 : aCheckLB.SetUpdateMode( sal_True );
288 : 0 : }
289 : :
290 : 0 : void OfaMSFilterTabPage2::InsertEntry( const String& _rTxt, sal_IntPtr _nType )
291 : : {
292 [ # # ]: 0 : SvLBoxEntry* pEntry = new SvLBoxEntry;
293 : :
294 [ # # ]: 0 : if( !pCheckButtonData )
295 [ # # ]: 0 : pCheckButtonData = new SvLBoxButtonData( &aCheckLB );
296 : :
297 [ # # ][ # # ]: 0 : pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0));
[ # # ][ # # ]
[ # # ]
298 : : pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox,
299 [ # # ]: 0 : 0, pCheckButtonData ) );
300 : : pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox,
301 [ # # ]: 0 : 0, pCheckButtonData ) );
302 [ # # ][ # # ]: 0 : pEntry->AddItem( new SvLBoxString( pEntry, 0, _rTxt ) );
[ # # ]
303 : :
304 : 0 : pEntry->SetUserData( (void*)_nType );
305 : 0 : aCheckLB.Insert( pEntry );
306 : 0 : }
307 : :
308 : 0 : SvLBoxEntry* OfaMSFilterTabPage2::GetEntry4Type( sal_IntPtr _nType ) const
309 : : {
310 : 0 : SvLBoxEntry* pEntry = aCheckLB.First();
311 [ # # ]: 0 : while ( pEntry )
312 : : {
313 [ # # ]: 0 : if ( _nType == sal_IntPtr( pEntry->GetUserData() ) )
314 : 0 : return pEntry;
315 : 0 : pEntry = aCheckLB.Next( pEntry );
316 : : }
317 : 0 : return NULL;
318 : : }
319 : :
320 : 0 : void OfaMSFilterTabPage2::MSFltrSimpleTable::SetTabs()
321 : : {
322 : 0 : SvxSimpleTable::SetTabs();
323 : 0 : sal_uInt16 nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE;
324 : :
325 [ # # ]: 0 : if( aTabs.size() > 1 )
326 : : {
327 : 0 : SvLBoxTab* pTab = aTabs[1];
328 : 0 : pTab->nFlags &= ~nAdjust;
329 : 0 : pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
330 : : }
331 [ # # ]: 0 : if( aTabs.size() > 2 )
332 : : {
333 : 0 : SvLBoxTab* pTab = aTabs[2];
334 : 0 : pTab->nFlags &= ~nAdjust;
335 : 0 : pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
336 : : }
337 : 0 : }
338 : :
339 : 0 : void OfaMSFilterTabPage2::MSFltrSimpleTable::HBarClick()
340 : : {
341 : : // sorting is stopped by this overloading
342 : 0 : }
343 : :
344 : 0 : void OfaMSFilterTabPage2::MSFltrSimpleTable::SetCheckButtonState(
345 : : SvLBoxEntry* pEntry, sal_uInt16 nCol, SvButtonState eState)
346 : : {
347 : 0 : SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1));
348 : :
349 : : DBG_ASSERT(pItem,"SetCheckButton:Item not found");
350 [ # # ]: 0 : if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
351 : : {
352 [ # # # # ]: 0 : switch( eState )
353 : : {
354 : : case SV_BUTTON_CHECKED:
355 : 0 : pItem->SetStateChecked();
356 : 0 : break;
357 : :
358 : : case SV_BUTTON_UNCHECKED:
359 : 0 : pItem->SetStateUnchecked();
360 : 0 : break;
361 : :
362 : : case SV_BUTTON_TRISTATE:
363 : 0 : pItem->SetStateTristate();
364 : 0 : break;
365 : : }
366 : 0 : InvalidateEntry( pEntry );
367 : : }
368 : 0 : }
369 : :
370 : 0 : SvButtonState OfaMSFilterTabPage2::MSFltrSimpleTable::GetCheckButtonState(
371 : : SvLBoxEntry* pEntry, sal_uInt16 nCol ) const
372 : : {
373 : 0 : SvButtonState eState = SV_BUTTON_UNCHECKED;
374 : 0 : SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1));
375 : : DBG_ASSERT(pItem,"GetChButnState:Item not found");
376 : :
377 [ # # ]: 0 : if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
378 : : {
379 : 0 : sal_uInt16 nButtonFlags = pItem->GetButtonFlags();
380 : 0 : eState = pCheckButtonData->ConvertToButtonState( nButtonFlags );
381 : : }
382 : :
383 : 0 : return eState;
384 : : }
385 : :
386 : 0 : void OfaMSFilterTabPage2::MSFltrSimpleTable::CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, sal_Bool bChecked)
387 : : {
388 [ # # ]: 0 : if ( nPos < GetEntryCount() )
389 : : SetCheckButtonState(
390 : : GetEntry(nPos),
391 : : nCol,
392 : : bChecked ? SvButtonState( SV_BUTTON_CHECKED ) :
393 [ # # ]: 0 : SvButtonState( SV_BUTTON_UNCHECKED ) );
394 : 0 : }
395 : :
396 : 0 : void OfaMSFilterTabPage2::MSFltrSimpleTable::KeyInput( const KeyEvent& rKEvt )
397 : : {
398 [ # # # # ]: 0 : if(!rKEvt.GetKeyCode().GetModifier() &&
[ # # ]
399 : 0 : KEY_SPACE == rKEvt.GetKeyCode().GetCode())
400 : : {
401 : 0 : sal_uLong nSelPos = GetModel()->GetAbsPos(GetCurEntry());
402 : 0 : sal_uInt16 nCol = GetCurrentTabPos() - 1;
403 [ # # ]: 0 : if ( nCol < 2 )
404 : : {
405 : 0 : SvLBoxEntry* pEntry = GetEntry( nSelPos );
406 : 0 : sal_Bool bIsChecked = ( GetCheckButtonState( pEntry, nCol ) == SV_BUTTON_CHECKED );
407 : 0 : CheckEntryPos( nSelPos, nCol, !bIsChecked );
408 : 0 : CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)pEntry );
409 : : }
410 : : else
411 : : {
412 [ # # ]: 0 : sal_uInt16 nCheck = GetCheckButtonState( GetEntry(nSelPos), 1 ) == SV_BUTTON_CHECKED ? 1 : 0;
413 [ # # ]: 0 : if(GetCheckButtonState( GetEntry(nSelPos), 0 ))
414 : 0 : nCheck += 2;
415 : 0 : nCheck--;
416 : 0 : nCheck &= 3;
417 : 0 : CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1));
418 : 0 : CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2));
419 : : }
420 : : }
421 : : else
422 : 0 : SvxSimpleTable::KeyInput(rKEvt);
423 : 0 : }
424 : :
425 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|