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