15900e8ecSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
35900e8ecSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
45900e8ecSAndrew Rist * or more contributor license agreements. See the NOTICE file
55900e8ecSAndrew Rist * distributed with this work for additional information
65900e8ecSAndrew Rist * regarding copyright ownership. The ASF licenses this file
75900e8ecSAndrew Rist * to you under the Apache License, Version 2.0 (the
85900e8ecSAndrew Rist * "License"); you may not use this file except in compliance
95900e8ecSAndrew Rist * with the License. You may obtain a copy of the License at
105900e8ecSAndrew Rist *
115900e8ecSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
125900e8ecSAndrew Rist *
135900e8ecSAndrew Rist * Unless required by applicable law or agreed to in writing,
145900e8ecSAndrew Rist * software distributed under the License is distributed on an
155900e8ecSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165900e8ecSAndrew Rist * KIND, either express or implied. See the License for the
175900e8ecSAndrew Rist * specific language governing permissions and limitations
185900e8ecSAndrew Rist * under the License.
195900e8ecSAndrew Rist *
205900e8ecSAndrew Rist *************************************************************/
215900e8ecSAndrew Rist
225900e8ecSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svtools.hxx"
26cdf0e10cSrcweir #include <svtools/svtabbx.hxx>
27cdf0e10cSrcweir #include <svtools/headbar.hxx>
28cdf0e10cSrcweir #include <svtools/svtdata.hxx>
29cdf0e10cSrcweir #ifndef _SVTOOLS_HRC
30cdf0e10cSrcweir #include <svtools/svtools.hrc>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
33cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
34cdf0e10cSrcweir #ifndef SVTOOLS_ACCESSIBLE_FACTORY_HXX
35cdf0e10cSrcweir #include "svtaccessiblefactory.hxx"
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir
38cdf0e10cSrcweir using namespace ::com::sun::star::uno;
39cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
40cdf0e10cSrcweir
41cdf0e10cSrcweir #define MYTABMASK \
42cdf0e10cSrcweir ( SV_LBOXTAB_ADJUST_RIGHT | SV_LBOXTAB_ADJUST_LEFT | SV_LBOXTAB_ADJUST_CENTER | SV_LBOXTAB_ADJUST_NUMERIC )
43cdf0e10cSrcweir
44cdf0e10cSrcweir // SvTreeListBox-Callback
45cdf0e10cSrcweir
SetTabs()46cdf0e10cSrcweir void SvTabListBox::SetTabs()
47cdf0e10cSrcweir {
48cdf0e10cSrcweir SvTreeListBox::SetTabs();
49cdf0e10cSrcweir if( nTabCount )
50cdf0e10cSrcweir {
51cdf0e10cSrcweir DBG_ASSERT(pTabList,"TabList ?");
52cdf0e10cSrcweir
53cdf0e10cSrcweir // die TreeListBox hat jetzt ihre Tabulatoren in die Liste eingefuegt.
54cdf0e10cSrcweir // jetzt plustern wir die Liste mit zusaetzlichen Tabulatoren auf,
55cdf0e10cSrcweir // und passen den ganz rechten Tab der Treelistbox an.
56cdf0e10cSrcweir
57cdf0e10cSrcweir // den ganz rechten Tab nehmen
58cdf0e10cSrcweir // HACK fuer den Explorer! Wenn der ViewParent != 0 ist, dann wird
59cdf0e10cSrcweir // der erste Tab der TreeListBox von der TreelistBox berechnet!
60cdf0e10cSrcweir // Dies wird fuer ButtonsOnRoot benoetigt, da der Explorer nicht
61cdf0e10cSrcweir // weiss, welchen zusaetzlichen Offset er in diesem Modus auf
62cdf0e10cSrcweir // den Tabulator addieren muss. Die TreeListBox weiss es!
63cdf0e10cSrcweir /*
64cdf0e10cSrcweir if( !pViewParent )
65cdf0e10cSrcweir {
66cdf0e10cSrcweir SvLBoxTab* pFirstTab = (SvLBoxTab*)aTabs.GetObject( aTabs.Count()-1 );
67cdf0e10cSrcweir pFirstTab->SetPos( pTabList[0].GetPos() );
68cdf0e10cSrcweir pFirstTab->nFlags &= ~MYTABMASK;
69cdf0e10cSrcweir pFirstTab->nFlags |= pTabList[0].nFlags;
70cdf0e10cSrcweir }
71cdf0e10cSrcweir */
72cdf0e10cSrcweir
73cdf0e10cSrcweir // alle anderen Tabs an Liste haengen
74cdf0e10cSrcweir for( sal_uInt16 nCurTab = 1; nCurTab < nTabCount; nCurTab++ )
75cdf0e10cSrcweir {
76cdf0e10cSrcweir SvLBoxTab* pTab = pTabList+nCurTab;
77cdf0e10cSrcweir AddTab( pTab->GetPos(), pTab->nFlags );
78cdf0e10cSrcweir }
79cdf0e10cSrcweir }
80cdf0e10cSrcweir }
81cdf0e10cSrcweir
InitEntry(SvLBoxEntry * pEntry,const XubString & rStr,const Image & rColl,const Image & rExp,SvLBoxButtonKind eButtonKind)82cdf0e10cSrcweir void SvTabListBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rStr,
83cdf0e10cSrcweir const Image& rColl, const Image& rExp, SvLBoxButtonKind eButtonKind )
84cdf0e10cSrcweir {
85cdf0e10cSrcweir SvTreeListBox::InitEntry( pEntry, rStr, rColl, rExp, eButtonKind );
86cdf0e10cSrcweir XubString aToken;
87cdf0e10cSrcweir
88cdf0e10cSrcweir const xub_Unicode* pCurToken = aCurEntry.GetBuffer();
89cdf0e10cSrcweir sal_uInt16 nCurTokenLen;
90cdf0e10cSrcweir const xub_Unicode* pNextToken = GetToken( pCurToken, nCurTokenLen );
91cdf0e10cSrcweir sal_uInt16 nCount = nTabCount; nCount--;
92cdf0e10cSrcweir for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ )
93cdf0e10cSrcweir {
94cdf0e10cSrcweir if( pCurToken && nCurTokenLen )
95cdf0e10cSrcweir // aToken.Assign( pCurToken, nCurTokenLen );
96cdf0e10cSrcweir aToken = XubString( pCurToken, nCurTokenLen );
97cdf0e10cSrcweir else
98cdf0e10cSrcweir aToken.Erase();
99cdf0e10cSrcweir SvLBoxString* pStr = new SvLBoxString( pEntry, 0, aToken );
100cdf0e10cSrcweir pEntry->AddItem( pStr );
101cdf0e10cSrcweir pCurToken = pNextToken;
102cdf0e10cSrcweir if( pCurToken )
103cdf0e10cSrcweir pNextToken = GetToken( pCurToken, nCurTokenLen );
104cdf0e10cSrcweir else
105cdf0e10cSrcweir nCurTokenLen = 0;
106cdf0e10cSrcweir }
107cdf0e10cSrcweir }
108cdf0e10cSrcweir
109cdf0e10cSrcweir
SvTabListBox(Window * pParent,WinBits nBits)110cdf0e10cSrcweir SvTabListBox::SvTabListBox( Window* pParent, WinBits nBits )
111cdf0e10cSrcweir : SvTreeListBox( pParent, nBits )
112cdf0e10cSrcweir {
113cdf0e10cSrcweir pTabList = 0;
114cdf0e10cSrcweir nTabCount = 0;
115cdf0e10cSrcweir pViewParent = 0;
116cdf0e10cSrcweir SetHighlightRange(); // ueber volle Breite selektieren
117cdf0e10cSrcweir }
118cdf0e10cSrcweir
SvTabListBox(Window * pParent,const ResId & rResId)119cdf0e10cSrcweir SvTabListBox::SvTabListBox( Window* pParent, const ResId& rResId )
120cdf0e10cSrcweir : SvTreeListBox( pParent, rResId )
121cdf0e10cSrcweir {
122cdf0e10cSrcweir pTabList = 0;
123cdf0e10cSrcweir nTabCount = 0;
124cdf0e10cSrcweir pViewParent = 0;
125cdf0e10cSrcweir SvTabListBox::Resize();
126cdf0e10cSrcweir SetHighlightRange();
127cdf0e10cSrcweir }
128cdf0e10cSrcweir
~SvTabListBox()129cdf0e10cSrcweir SvTabListBox::~SvTabListBox()
130cdf0e10cSrcweir {
131cdf0e10cSrcweir // array-delete
132cdf0e10cSrcweir delete [] pTabList;
133cdf0e10cSrcweir #ifdef DBG_UTIL
134cdf0e10cSrcweir pTabList = 0;
135cdf0e10cSrcweir nTabCount = 0;
136cdf0e10cSrcweir #endif
137cdf0e10cSrcweir }
138cdf0e10cSrcweir
SetTabs(long * pTabs,MapUnit eMapUnit)139cdf0e10cSrcweir void SvTabListBox::SetTabs( long* pTabs, MapUnit eMapUnit )
140cdf0e10cSrcweir {
141cdf0e10cSrcweir DBG_ASSERT(pTabs,"SetTabs:NULL-Ptr");
142cdf0e10cSrcweir if( !pTabs )
143cdf0e10cSrcweir return;
144cdf0e10cSrcweir
145cdf0e10cSrcweir delete [] pTabList;
146cdf0e10cSrcweir sal_uInt16 nCount = (sal_uInt16)(*pTabs);
147cdf0e10cSrcweir pTabList = new SvLBoxTab[ nCount ];
148cdf0e10cSrcweir nTabCount = nCount;
149cdf0e10cSrcweir
150cdf0e10cSrcweir MapMode aMMSource( eMapUnit );
151cdf0e10cSrcweir MapMode aMMDest( MAP_PIXEL );
152cdf0e10cSrcweir
153cdf0e10cSrcweir pTabs++;
154cdf0e10cSrcweir for( sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++, pTabs++ )
155cdf0e10cSrcweir {
156cdf0e10cSrcweir Size aSize( *pTabs, 0 );
157cdf0e10cSrcweir aSize = LogicToLogic( aSize, &aMMSource, &aMMDest );
158cdf0e10cSrcweir long nNewTab = aSize.Width();
159cdf0e10cSrcweir pTabList[nIdx].SetPos( nNewTab );
160cdf0e10cSrcweir pTabList[nIdx].nFlags=(SV_LBOXTAB_ADJUST_LEFT| SV_LBOXTAB_INV_ALWAYS);
161cdf0e10cSrcweir }
162cdf0e10cSrcweir SvTreeListBox::nTreeFlags |= TREEFLAG_RECALCTABS;
163cdf0e10cSrcweir if( IsUpdateMode() )
164cdf0e10cSrcweir Invalidate();
165cdf0e10cSrcweir }
166cdf0e10cSrcweir
SetTab(sal_uInt16 nTab,long nValue,MapUnit eMapUnit)167cdf0e10cSrcweir void SvTabListBox::SetTab( sal_uInt16 nTab,long nValue,MapUnit eMapUnit )
168cdf0e10cSrcweir {
169cdf0e10cSrcweir DBG_ASSERT(nTab<nTabCount,"Invalid Tab-Pos");
170cdf0e10cSrcweir if( nTab < nTabCount )
171cdf0e10cSrcweir {
172cdf0e10cSrcweir DBG_ASSERT(pTabList,"TabList?");
173cdf0e10cSrcweir MapMode aMMSource( eMapUnit );
174cdf0e10cSrcweir MapMode aMMDest( MAP_PIXEL );
175cdf0e10cSrcweir Size aSize( nValue, 0 );
176cdf0e10cSrcweir aSize = LogicToLogic( aSize, &aMMSource, &aMMDest );
177cdf0e10cSrcweir nValue = aSize.Width();
178cdf0e10cSrcweir pTabList[ nTab ].SetPos( nValue );
179cdf0e10cSrcweir SvTreeListBox::nTreeFlags |= TREEFLAG_RECALCTABS;
180cdf0e10cSrcweir if( IsUpdateMode() )
181cdf0e10cSrcweir Invalidate();
182cdf0e10cSrcweir }
183cdf0e10cSrcweir }
184cdf0e10cSrcweir
InsertEntry(const XubString & rText,SvLBoxEntry * pParent,sal_Bool,sal_uLong nPos,void * pUserData,SvLBoxButtonKind)185cdf0e10cSrcweir SvLBoxEntry* SvTabListBox::InsertEntry( const XubString& rText, SvLBoxEntry* pParent,
186cdf0e10cSrcweir sal_Bool /*bChildsOnDemand*/,
187cdf0e10cSrcweir sal_uLong nPos, void* pUserData,
188cdf0e10cSrcweir SvLBoxButtonKind )
189cdf0e10cSrcweir {
190cdf0e10cSrcweir return InsertEntryToColumn( rText, pParent, nPos, 0xffff, pUserData );
191cdf0e10cSrcweir }
192cdf0e10cSrcweir
InsertEntry(const XubString & rText,const Image & rExpandedEntryBmp,const Image & rCollapsedEntryBmp,SvLBoxEntry * pParent,sal_Bool,sal_uLong nPos,void * pUserData,SvLBoxButtonKind)193cdf0e10cSrcweir SvLBoxEntry* SvTabListBox::InsertEntry( const XubString& rText,
194cdf0e10cSrcweir const Image& rExpandedEntryBmp,
195cdf0e10cSrcweir const Image& rCollapsedEntryBmp,
196cdf0e10cSrcweir SvLBoxEntry* pParent,
197cdf0e10cSrcweir sal_Bool /*bChildsOnDemand*/,
198cdf0e10cSrcweir sal_uLong nPos, void* pUserData,
199cdf0e10cSrcweir SvLBoxButtonKind )
200cdf0e10cSrcweir {
201cdf0e10cSrcweir return InsertEntryToColumn( rText, rExpandedEntryBmp, rCollapsedEntryBmp,
202cdf0e10cSrcweir pParent, nPos, 0xffff, pUserData );
203cdf0e10cSrcweir }
204cdf0e10cSrcweir
InsertEntryToColumn(const XubString & rStr,SvLBoxEntry * pParent,sal_uLong nPos,sal_uInt16 nCol,void * pUser)205cdf0e10cSrcweir SvLBoxEntry* SvTabListBox::InsertEntryToColumn(const XubString& rStr,SvLBoxEntry* pParent,sal_uLong nPos,sal_uInt16 nCol,
206cdf0e10cSrcweir void* pUser )
207cdf0e10cSrcweir {
208cdf0e10cSrcweir XubString aStr;
209cdf0e10cSrcweir if( nCol != 0xffff )
210cdf0e10cSrcweir {
211cdf0e10cSrcweir while( nCol )
212cdf0e10cSrcweir {
213cdf0e10cSrcweir aStr += '\t';
214cdf0e10cSrcweir nCol--;
215cdf0e10cSrcweir }
216cdf0e10cSrcweir }
217cdf0e10cSrcweir aStr += rStr;
218cdf0e10cSrcweir XubString aFirstStr( aStr );
219cdf0e10cSrcweir sal_uInt16 nEnd = aFirstStr.Search( '\t' );
220cdf0e10cSrcweir if( nEnd != STRING_NOTFOUND )
221cdf0e10cSrcweir {
222cdf0e10cSrcweir aFirstStr.Erase( nEnd );
223cdf0e10cSrcweir aCurEntry = aStr;
224cdf0e10cSrcweir aCurEntry.Erase( 0, ++nEnd );
225cdf0e10cSrcweir }
226cdf0e10cSrcweir else
227cdf0e10cSrcweir aCurEntry.Erase();
228cdf0e10cSrcweir return SvTreeListBox::InsertEntry( aFirstStr, pParent, sal_False, nPos, pUser );
229cdf0e10cSrcweir }
230cdf0e10cSrcweir
InsertEntryToColumn(const XubString & rStr,const Image & rExpandedEntryBmp,const Image & rCollapsedEntryBmp,SvLBoxEntry * pParent,sal_uLong nPos,sal_uInt16 nCol,void * pUser)231cdf0e10cSrcweir SvLBoxEntry* SvTabListBox::InsertEntryToColumn( const XubString& rStr,
232cdf0e10cSrcweir const Image& rExpandedEntryBmp, const Image& rCollapsedEntryBmp,
233cdf0e10cSrcweir SvLBoxEntry* pParent,sal_uLong nPos,sal_uInt16 nCol, void* pUser )
234cdf0e10cSrcweir {
235cdf0e10cSrcweir XubString aStr;
236cdf0e10cSrcweir if( nCol != 0xffff )
237cdf0e10cSrcweir {
238cdf0e10cSrcweir while( nCol )
239cdf0e10cSrcweir {
240cdf0e10cSrcweir aStr += '\t';
241cdf0e10cSrcweir nCol--;
242cdf0e10cSrcweir }
243cdf0e10cSrcweir }
244cdf0e10cSrcweir aStr += rStr;
245cdf0e10cSrcweir XubString aFirstStr( aStr );
246cdf0e10cSrcweir sal_uInt16 nEnd = aFirstStr.Search( '\t' );
247cdf0e10cSrcweir if( nEnd != STRING_NOTFOUND )
248cdf0e10cSrcweir {
249cdf0e10cSrcweir aFirstStr.Erase( nEnd );
250cdf0e10cSrcweir aCurEntry = aStr;
251cdf0e10cSrcweir aCurEntry.Erase( 0, ++nEnd );
252cdf0e10cSrcweir }
253cdf0e10cSrcweir else
254cdf0e10cSrcweir aCurEntry.Erase();
255cdf0e10cSrcweir
256cdf0e10cSrcweir return SvTreeListBox::InsertEntry(
257cdf0e10cSrcweir aFirstStr,
258cdf0e10cSrcweir rExpandedEntryBmp, rCollapsedEntryBmp,
259cdf0e10cSrcweir pParent, sal_False, nPos, pUser );
260cdf0e10cSrcweir }
261cdf0e10cSrcweir
InsertEntryToColumn(const XubString & rStr,sal_uLong nPos,sal_uInt16 nCol,void * pUser)262cdf0e10cSrcweir SvLBoxEntry* SvTabListBox::InsertEntryToColumn( const XubString& rStr, sal_uLong nPos,
263cdf0e10cSrcweir sal_uInt16 nCol, void* pUser )
264cdf0e10cSrcweir {
265cdf0e10cSrcweir return InsertEntryToColumn( rStr,0,nPos, nCol, pUser );
266cdf0e10cSrcweir }
267cdf0e10cSrcweir
GetEntryText(SvLBoxEntry * pEntry) const268cdf0e10cSrcweir String SvTabListBox::GetEntryText( SvLBoxEntry* pEntry ) const
269cdf0e10cSrcweir {
270cdf0e10cSrcweir return GetEntryText( pEntry, 0xffff );
271cdf0e10cSrcweir }
272cdf0e10cSrcweir
GetEntryText(SvLBoxEntry * pEntry,sal_uInt16 nCol) const273cdf0e10cSrcweir String SvTabListBox::GetEntryText( SvLBoxEntry* pEntry, sal_uInt16 nCol ) const
274cdf0e10cSrcweir {
275cdf0e10cSrcweir DBG_ASSERT(pEntry,"GetEntryText:Invalid Entry");
276cdf0e10cSrcweir XubString aResult;
277cdf0e10cSrcweir if( pEntry )
278cdf0e10cSrcweir {
279cdf0e10cSrcweir sal_uInt16 nCount = pEntry->ItemCount();
280cdf0e10cSrcweir sal_uInt16 nCur = 0;
281cdf0e10cSrcweir while( nCur < nCount )
282cdf0e10cSrcweir {
283cdf0e10cSrcweir SvLBoxItem* pStr = pEntry->GetItem( nCur );
284cdf0e10cSrcweir if( pStr->IsA() == SV_ITEM_ID_LBOXSTRING )
285cdf0e10cSrcweir {
286cdf0e10cSrcweir if( nCol == 0xffff )
287cdf0e10cSrcweir {
288cdf0e10cSrcweir if( aResult.Len() )
289cdf0e10cSrcweir aResult += '\t';
290cdf0e10cSrcweir aResult += static_cast<SvLBoxString*>( pStr )->GetText();
291cdf0e10cSrcweir }
292cdf0e10cSrcweir else
293cdf0e10cSrcweir {
294cdf0e10cSrcweir if( nCol == 0 )
295cdf0e10cSrcweir return static_cast<SvLBoxString*>( pStr )->GetText();
296cdf0e10cSrcweir nCol--;
297cdf0e10cSrcweir }
298cdf0e10cSrcweir }
299cdf0e10cSrcweir nCur++;
300cdf0e10cSrcweir }
301cdf0e10cSrcweir }
302cdf0e10cSrcweir return aResult;
303cdf0e10cSrcweir }
304cdf0e10cSrcweir
GetEntryText(sal_uLong nPos,sal_uInt16 nCol) const305cdf0e10cSrcweir String SvTabListBox::GetEntryText( sal_uLong nPos, sal_uInt16 nCol ) const
306cdf0e10cSrcweir {
307cdf0e10cSrcweir SvLBoxEntry* pEntry = GetEntryOnPos( nPos );
308cdf0e10cSrcweir return GetEntryText( pEntry, nCol );
309cdf0e10cSrcweir }
310cdf0e10cSrcweir
SetEntryText(const XubString & rStr,sal_uLong nPos,sal_uInt16 nCol)311cdf0e10cSrcweir void SvTabListBox::SetEntryText( const XubString& rStr, sal_uLong nPos, sal_uInt16 nCol )
312cdf0e10cSrcweir {
313cdf0e10cSrcweir SvLBoxEntry* pEntry = SvTreeListBox::GetEntry( nPos );
314cdf0e10cSrcweir SetEntryText( rStr, pEntry, nCol );
315cdf0e10cSrcweir }
316cdf0e10cSrcweir
SetEntryText(const XubString & rStr,SvLBoxEntry * pEntry,sal_uInt16 nCol)317cdf0e10cSrcweir void SvTabListBox::SetEntryText( const XubString& rStr, SvLBoxEntry* pEntry, sal_uInt16 nCol )
318cdf0e10cSrcweir {
319cdf0e10cSrcweir DBG_ASSERT(pEntry,"SetEntryText:Invalid Entry");
320cdf0e10cSrcweir if( !pEntry )
321cdf0e10cSrcweir return;
322cdf0e10cSrcweir
323cdf0e10cSrcweir String sOldText = GetEntryText( pEntry, nCol );
324cdf0e10cSrcweir if ( sOldText == rStr )
325cdf0e10cSrcweir return;
326cdf0e10cSrcweir
327cdf0e10cSrcweir sal_uInt16 nTextColumn = nCol;
328cdf0e10cSrcweir const xub_Unicode* pCurToken = rStr.GetBuffer();
329cdf0e10cSrcweir sal_uInt16 nCurTokenLen;
330cdf0e10cSrcweir const xub_Unicode* pNextToken = GetToken( pCurToken, nCurTokenLen );
331cdf0e10cSrcweir
332cdf0e10cSrcweir XubString aTemp;
333cdf0e10cSrcweir sal_uInt16 nCount = pEntry->ItemCount();
334cdf0e10cSrcweir sal_uInt16 nCur = 0;
335cdf0e10cSrcweir while( nCur < nCount )
336cdf0e10cSrcweir {
337cdf0e10cSrcweir SvLBoxItem* pStr = pEntry->GetItem( nCur );
338cdf0e10cSrcweir if( pStr && pStr->IsA() == SV_ITEM_ID_LBOXSTRING )
339cdf0e10cSrcweir {
340cdf0e10cSrcweir if( nCol == 0xffff )
341cdf0e10cSrcweir {
342cdf0e10cSrcweir if( pCurToken )
343cdf0e10cSrcweir aTemp = XubString( pCurToken, nCurTokenLen );
344cdf0e10cSrcweir else
345cdf0e10cSrcweir aTemp.Erase(); // alle Spalten ohne Token loeschen
346cdf0e10cSrcweir ((SvLBoxString*)pStr)->SetText( pEntry, aTemp );
347cdf0e10cSrcweir pCurToken = pNextToken;
348cdf0e10cSrcweir pNextToken = GetToken( pCurToken, nCurTokenLen );
349cdf0e10cSrcweir }
350cdf0e10cSrcweir else
351cdf0e10cSrcweir {
352cdf0e10cSrcweir if( !nCol )
353cdf0e10cSrcweir {
354cdf0e10cSrcweir aTemp = XubString( pCurToken, nCurTokenLen );
355cdf0e10cSrcweir ((SvLBoxString*)pStr)->SetText( pEntry, aTemp );
356cdf0e10cSrcweir if( !pNextToken )
357cdf0e10cSrcweir break;
358cdf0e10cSrcweir pCurToken = pNextToken;
359cdf0e10cSrcweir pNextToken = GetToken( pCurToken, nCurTokenLen );
360cdf0e10cSrcweir }
361cdf0e10cSrcweir else
362cdf0e10cSrcweir nCol--;
363cdf0e10cSrcweir }
364cdf0e10cSrcweir }
365cdf0e10cSrcweir nCur++;
366cdf0e10cSrcweir }
367cdf0e10cSrcweir GetModel()->InvalidateEntry( pEntry );
368cdf0e10cSrcweir
369cdf0e10cSrcweir TabListBoxEventData* pData = new TabListBoxEventData( pEntry, nTextColumn, sOldText );
370cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_TABLECELL_NAMECHANGED, pData );
371cdf0e10cSrcweir delete pData;
372cdf0e10cSrcweir }
373cdf0e10cSrcweir
GetCellText(sal_uLong nPos,sal_uInt16 nCol) const374cdf0e10cSrcweir String SvTabListBox::GetCellText( sal_uLong nPos, sal_uInt16 nCol ) const
375cdf0e10cSrcweir {
376cdf0e10cSrcweir SvLBoxEntry* pEntry = GetEntryOnPos( nPos );
377cdf0e10cSrcweir DBG_ASSERT( pEntry, "SvTabListBox::GetCellText(): Invalid Entry" );
378cdf0e10cSrcweir XubString aResult;
379cdf0e10cSrcweir if ( pEntry && pEntry->ItemCount() > ( nCol + 1 ) )
380cdf0e10cSrcweir {
381cdf0e10cSrcweir SvLBoxItem* pStr = pEntry->GetItem( nCol + 1 );
382cdf0e10cSrcweir if ( pStr && pStr->IsA() == SV_ITEM_ID_LBOXSTRING )
383cdf0e10cSrcweir aResult = static_cast< SvLBoxString* >( pStr )->GetText();
384cdf0e10cSrcweir }
385cdf0e10cSrcweir return aResult;
386cdf0e10cSrcweir }
387cdf0e10cSrcweir
GetEntryPos(const XubString & rStr,sal_uInt16 nCol)388cdf0e10cSrcweir sal_uLong SvTabListBox::GetEntryPos( const XubString& rStr, sal_uInt16 nCol )
389cdf0e10cSrcweir {
390cdf0e10cSrcweir sal_uLong nPos = 0;
391cdf0e10cSrcweir SvLBoxEntry* pEntry = First();
392cdf0e10cSrcweir while( pEntry )
393cdf0e10cSrcweir {
394cdf0e10cSrcweir XubString aStr( GetEntryText( pEntry, nCol ));
395cdf0e10cSrcweir if( aStr == rStr )
396cdf0e10cSrcweir return nPos;
397cdf0e10cSrcweir pEntry = Next( pEntry );
398cdf0e10cSrcweir nPos++;
399cdf0e10cSrcweir }
400cdf0e10cSrcweir return 0xffffffff;
401cdf0e10cSrcweir }
402cdf0e10cSrcweir
GetEntryPos(const SvLBoxEntry * pEntry) const403cdf0e10cSrcweir sal_uLong SvTabListBox::GetEntryPos( const SvLBoxEntry* pEntry ) const
404cdf0e10cSrcweir {
405cdf0e10cSrcweir sal_uLong nPos = 0;
406cdf0e10cSrcweir SvLBoxEntry* pTmpEntry = First();
407cdf0e10cSrcweir while( pTmpEntry )
408cdf0e10cSrcweir {
409cdf0e10cSrcweir if ( pTmpEntry == pEntry )
410cdf0e10cSrcweir return nPos;
411cdf0e10cSrcweir pTmpEntry = Next( pTmpEntry );
412cdf0e10cSrcweir ++nPos;
413cdf0e10cSrcweir }
414cdf0e10cSrcweir return 0xffffffff;
415cdf0e10cSrcweir }
416cdf0e10cSrcweir
Resize()417cdf0e10cSrcweir void __EXPORT SvTabListBox::Resize()
418cdf0e10cSrcweir {
419cdf0e10cSrcweir SvTreeListBox::Resize();
420cdf0e10cSrcweir }
421cdf0e10cSrcweir
422cdf0e10cSrcweir // static
GetToken(const xub_Unicode * pPtr,sal_uInt16 & rLen)423cdf0e10cSrcweir const xub_Unicode* SvTabListBox::GetToken( const xub_Unicode* pPtr, sal_uInt16& rLen )
424cdf0e10cSrcweir {
425cdf0e10cSrcweir if( !pPtr || *pPtr == 0 )
426cdf0e10cSrcweir {
427cdf0e10cSrcweir rLen = 0;
428cdf0e10cSrcweir return 0;
429cdf0e10cSrcweir }
430cdf0e10cSrcweir xub_Unicode c = *pPtr;
431cdf0e10cSrcweir sal_uInt16 nLen = 0;
432cdf0e10cSrcweir while( c != '\t' && c != 0 )
433cdf0e10cSrcweir {
434cdf0e10cSrcweir pPtr++;
435cdf0e10cSrcweir nLen++;
436cdf0e10cSrcweir c = *pPtr;
437cdf0e10cSrcweir }
438cdf0e10cSrcweir if( c )
439cdf0e10cSrcweir pPtr++; // Tab ueberspringen
440cdf0e10cSrcweir else
441cdf0e10cSrcweir pPtr = 0;
442cdf0e10cSrcweir rLen = nLen;
443cdf0e10cSrcweir return pPtr;
444cdf0e10cSrcweir }
445cdf0e10cSrcweir
GetTabEntryText(sal_uLong nPos,sal_uInt16 nCol) const446cdf0e10cSrcweir String SvTabListBox::GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const
447cdf0e10cSrcweir {
448cdf0e10cSrcweir SvLBoxEntry* pEntry = SvTreeListBox::GetEntry( nPos );
449cdf0e10cSrcweir DBG_ASSERT( pEntry, "GetTabEntryText(): Invalid entry " );
450cdf0e10cSrcweir XubString aResult;
451cdf0e10cSrcweir if ( pEntry )
452cdf0e10cSrcweir {
453cdf0e10cSrcweir sal_uInt16 nCount = pEntry->ItemCount();
454cdf0e10cSrcweir sal_uInt16 nCur = ( 0 == nCol && IsCellFocusEnabled() ) ? GetCurrentTabPos() : 0;
455cdf0e10cSrcweir while( nCur < nCount )
456cdf0e10cSrcweir {
457cdf0e10cSrcweir SvLBoxItem* pStr = pEntry->GetItem( nCur );
458cdf0e10cSrcweir if ( pStr->IsA() == SV_ITEM_ID_LBOXSTRING )
459cdf0e10cSrcweir {
460cdf0e10cSrcweir if ( nCol == 0xffff )
461cdf0e10cSrcweir {
462cdf0e10cSrcweir if ( aResult.Len() )
463cdf0e10cSrcweir aResult += '\t';
464cdf0e10cSrcweir aResult += static_cast<SvLBoxString*>( pStr )->GetText();
465cdf0e10cSrcweir }
466cdf0e10cSrcweir else
467cdf0e10cSrcweir {
468cdf0e10cSrcweir if ( nCol == 0 )
469cdf0e10cSrcweir {
470cdf0e10cSrcweir String sRet = static_cast<SvLBoxString*>( pStr )->GetText();
471cdf0e10cSrcweir if ( sRet.Len() == 0 )
472cdf0e10cSrcweir sRet = String( SvtResId( STR_SVT_ACC_EMPTY_FIELD ) );
473cdf0e10cSrcweir return sRet;
474cdf0e10cSrcweir }
475cdf0e10cSrcweir --nCol;
476cdf0e10cSrcweir }
477cdf0e10cSrcweir }
478cdf0e10cSrcweir ++nCur;
479cdf0e10cSrcweir }
480cdf0e10cSrcweir }
481cdf0e10cSrcweir return aResult;
482cdf0e10cSrcweir }
483cdf0e10cSrcweir
GetEntryOnPos(sal_uLong _nEntryPos) const484cdf0e10cSrcweir SvLBoxEntry* SvTabListBox::GetEntryOnPos( sal_uLong _nEntryPos ) const
485cdf0e10cSrcweir {
486cdf0e10cSrcweir SvLBoxEntry* pEntry = NULL;
487cdf0e10cSrcweir sal_uLong i, nPos = 0, nCount = GetLevelChildCount( NULL );
488cdf0e10cSrcweir for ( i = 0; i < nCount; ++i )
489cdf0e10cSrcweir {
490cdf0e10cSrcweir SvLBoxEntry* pParent = GetEntry(i);
491cdf0e10cSrcweir if ( nPos == _nEntryPos )
492cdf0e10cSrcweir {
493cdf0e10cSrcweir pEntry = pParent;
494cdf0e10cSrcweir break;
495cdf0e10cSrcweir }
496cdf0e10cSrcweir else
497cdf0e10cSrcweir {
498cdf0e10cSrcweir nPos++;
499cdf0e10cSrcweir pEntry = GetChildOnPos( pParent, _nEntryPos, nPos );
500cdf0e10cSrcweir if ( pEntry )
501cdf0e10cSrcweir break;
502cdf0e10cSrcweir }
503cdf0e10cSrcweir }
504cdf0e10cSrcweir
505cdf0e10cSrcweir return pEntry;
506cdf0e10cSrcweir }
507cdf0e10cSrcweir
GetChildOnPos(SvLBoxEntry * _pParent,sal_uLong _nEntryPos,sal_uLong & _rPos) const508cdf0e10cSrcweir SvLBoxEntry* SvTabListBox::GetChildOnPos( SvLBoxEntry* _pParent, sal_uLong _nEntryPos, sal_uLong& _rPos ) const
509cdf0e10cSrcweir {
510cdf0e10cSrcweir sal_uLong i, nCount = GetLevelChildCount( _pParent );
511cdf0e10cSrcweir for ( i = 0; i < nCount; ++i )
512cdf0e10cSrcweir {
513cdf0e10cSrcweir SvLBoxEntry* pParent = GetEntry( _pParent, i );
514cdf0e10cSrcweir if ( _rPos == _nEntryPos )
515cdf0e10cSrcweir return pParent;
516cdf0e10cSrcweir else
517cdf0e10cSrcweir {
518cdf0e10cSrcweir _rPos++;
519cdf0e10cSrcweir SvLBoxEntry* pEntry = GetChildOnPos( pParent, _nEntryPos, _rPos );
520cdf0e10cSrcweir if ( pEntry )
521cdf0e10cSrcweir return pEntry;
522cdf0e10cSrcweir }
523cdf0e10cSrcweir }
524cdf0e10cSrcweir
525cdf0e10cSrcweir return NULL;
526cdf0e10cSrcweir }
527cdf0e10cSrcweir
SetTabJustify(sal_uInt16 nTab,SvTabJustify eJustify)528cdf0e10cSrcweir void SvTabListBox::SetTabJustify( sal_uInt16 nTab, SvTabJustify eJustify)
529cdf0e10cSrcweir {
530cdf0e10cSrcweir if( nTab >= nTabCount )
531cdf0e10cSrcweir return;
532cdf0e10cSrcweir SvLBoxTab* pTab = &(pTabList[ nTab ]);
533cdf0e10cSrcweir sal_uInt16 nFlags = pTab->nFlags;
534cdf0e10cSrcweir nFlags &= (~MYTABMASK);
535cdf0e10cSrcweir nFlags |= (sal_uInt16)eJustify;
536cdf0e10cSrcweir pTab->nFlags = nFlags;
537cdf0e10cSrcweir SvTreeListBox::nTreeFlags |= TREEFLAG_RECALCTABS;
538cdf0e10cSrcweir if( IsUpdateMode() )
539cdf0e10cSrcweir Invalidate();
540cdf0e10cSrcweir }
541cdf0e10cSrcweir
GetTabJustify(sal_uInt16 nTab) const542cdf0e10cSrcweir SvTabJustify SvTabListBox::GetTabJustify( sal_uInt16 nTab ) const
543cdf0e10cSrcweir {
544cdf0e10cSrcweir SvTabJustify eResult = AdjustLeft;
545cdf0e10cSrcweir if( nTab >= nTabCount )
546cdf0e10cSrcweir return eResult;
547cdf0e10cSrcweir SvLBoxTab* pTab = &(pTabList[ nTab ]);
548cdf0e10cSrcweir sal_uInt16 nFlags = pTab->nFlags;
549cdf0e10cSrcweir nFlags &= MYTABMASK;
550cdf0e10cSrcweir eResult = (SvTabJustify)nFlags;
551cdf0e10cSrcweir return eResult;
552cdf0e10cSrcweir }
553cdf0e10cSrcweir
GetLogicTab(sal_uInt16 nTab)554cdf0e10cSrcweir long SvTabListBox::GetLogicTab( sal_uInt16 nTab )
555cdf0e10cSrcweir {
556cdf0e10cSrcweir if( SvTreeListBox::nTreeFlags & TREEFLAG_RECALCTABS )
557cdf0e10cSrcweir ((SvTabListBox*)this)->SetTabs();
558cdf0e10cSrcweir
559cdf0e10cSrcweir DBG_ASSERT(nTab<nTabCount,"GetTabPos:Invalid Tab");
560cdf0e10cSrcweir return ((SvLBoxTab*)aTabs.GetObject( nTab ))->GetPos();
561cdf0e10cSrcweir }
562cdf0e10cSrcweir
563cdf0e10cSrcweir // class SvHeaderTabListBoxImpl ------------------------------------------
564cdf0e10cSrcweir
565cdf0e10cSrcweir namespace svt
566cdf0e10cSrcweir {
567cdf0e10cSrcweir struct SvHeaderTabListBoxImpl
568cdf0e10cSrcweir {
569cdf0e10cSrcweir HeaderBar* m_pHeaderBar;
570cdf0e10cSrcweir AccessibleFactoryAccess m_aFactoryAccess;
571cdf0e10cSrcweir
SvHeaderTabListBoxImplsvt::SvHeaderTabListBoxImpl572cdf0e10cSrcweir SvHeaderTabListBoxImpl() : m_pHeaderBar( NULL ) { }
573cdf0e10cSrcweir };
574cdf0e10cSrcweir }
575cdf0e10cSrcweir
576cdf0e10cSrcweir // class SvHeaderTabListBox ----------------------------------------------
577cdf0e10cSrcweir
SvHeaderTabListBox(Window * pParent,WinBits nWinStyle)578cdf0e10cSrcweir SvHeaderTabListBox::SvHeaderTabListBox( Window* pParent, WinBits nWinStyle ) :
579cdf0e10cSrcweir
580cdf0e10cSrcweir SvTabListBox( pParent, nWinStyle ),
581cdf0e10cSrcweir
582cdf0e10cSrcweir m_bFirstPaint ( sal_True ),
583cdf0e10cSrcweir m_pImpl ( new ::svt::SvHeaderTabListBoxImpl ),
584cdf0e10cSrcweir m_pAccessible ( NULL )
585cdf0e10cSrcweir {
586cdf0e10cSrcweir }
587cdf0e10cSrcweir
588cdf0e10cSrcweir // -----------------------------------------------------------------------
589cdf0e10cSrcweir
SvHeaderTabListBox(Window * pParent,const ResId & rResId)590cdf0e10cSrcweir SvHeaderTabListBox::SvHeaderTabListBox( Window* pParent, const ResId& rResId ) :
591cdf0e10cSrcweir
592cdf0e10cSrcweir SvTabListBox( pParent, rResId ),
593cdf0e10cSrcweir
594cdf0e10cSrcweir m_bFirstPaint ( sal_True ),
595cdf0e10cSrcweir m_pImpl ( new ::svt::SvHeaderTabListBoxImpl ),
596cdf0e10cSrcweir m_pAccessible ( NULL )
597cdf0e10cSrcweir {
598cdf0e10cSrcweir }
599cdf0e10cSrcweir
600cdf0e10cSrcweir // -----------------------------------------------------------------------
601cdf0e10cSrcweir
~SvHeaderTabListBox()602cdf0e10cSrcweir SvHeaderTabListBox::~SvHeaderTabListBox()
603cdf0e10cSrcweir {
604cdf0e10cSrcweir delete m_pImpl;
605cdf0e10cSrcweir }
606cdf0e10cSrcweir
607cdf0e10cSrcweir // -----------------------------------------------------------------------
608cdf0e10cSrcweir
Paint(const Rectangle & rRect)609cdf0e10cSrcweir void SvHeaderTabListBox::Paint( const Rectangle& rRect )
610cdf0e10cSrcweir {
611cdf0e10cSrcweir if ( m_bFirstPaint )
612cdf0e10cSrcweir {
613cdf0e10cSrcweir m_bFirstPaint = sal_False;
614cdf0e10cSrcweir RepaintScrollBars();
615cdf0e10cSrcweir }
616cdf0e10cSrcweir SvTabListBox::Paint( rRect );
617cdf0e10cSrcweir }
618cdf0e10cSrcweir
619cdf0e10cSrcweir // -----------------------------------------------------------------------
620cdf0e10cSrcweir
InitHeaderBar(HeaderBar * pHeaderBar)621cdf0e10cSrcweir void SvHeaderTabListBox::InitHeaderBar( HeaderBar* pHeaderBar )
622cdf0e10cSrcweir {
623cdf0e10cSrcweir DBG_ASSERT( !m_pImpl->m_pHeaderBar, "header bar already initialized" );
624cdf0e10cSrcweir DBG_ASSERT( pHeaderBar, "invalid header bar initialization" );
625cdf0e10cSrcweir m_pImpl->m_pHeaderBar = pHeaderBar;
626cdf0e10cSrcweir SetScrolledHdl( LINK( this, SvHeaderTabListBox, ScrollHdl_Impl ) );
627cdf0e10cSrcweir m_pImpl->m_pHeaderBar->SetCreateAccessibleHdl( LINK( this, SvHeaderTabListBox, CreateAccessibleHdl_Impl ) );
628cdf0e10cSrcweir }
629cdf0e10cSrcweir
630cdf0e10cSrcweir // -----------------------------------------------------------------------
631cdf0e10cSrcweir
IsItemChecked(SvLBoxEntry * pEntry,sal_uInt16 nCol) const632cdf0e10cSrcweir sal_Bool SvHeaderTabListBox::IsItemChecked( SvLBoxEntry* pEntry, sal_uInt16 nCol ) const
633cdf0e10cSrcweir {
634cdf0e10cSrcweir SvButtonState eState = SV_BUTTON_UNCHECKED;
635cdf0e10cSrcweir SvLBoxButton* pItem = (SvLBoxButton*)( pEntry->GetItem( nCol + 1 ) );
636cdf0e10cSrcweir
637cdf0e10cSrcweir if ( pItem && ( (SvLBoxItem*)pItem )->IsA() == SV_ITEM_ID_LBOXBUTTON )
638cdf0e10cSrcweir {
639cdf0e10cSrcweir sal_uInt16 nButtonFlags = pItem->GetButtonFlags();
640cdf0e10cSrcweir eState = pCheckButtonData->ConvertToButtonState( nButtonFlags );
641cdf0e10cSrcweir }
642cdf0e10cSrcweir
643cdf0e10cSrcweir return ( eState == SV_BUTTON_CHECKED );
644cdf0e10cSrcweir }
645cdf0e10cSrcweir
646cdf0e10cSrcweir // -----------------------------------------------------------------------
647cdf0e10cSrcweir
InsertEntryToColumn(const XubString & rStr,sal_uLong nPos,sal_uInt16 nCol,void * pUserData)648cdf0e10cSrcweir SvLBoxEntry* SvHeaderTabListBox::InsertEntryToColumn(
649cdf0e10cSrcweir const XubString& rStr, sal_uLong nPos, sal_uInt16 nCol, void* pUserData )
650cdf0e10cSrcweir {
651cdf0e10cSrcweir SvLBoxEntry* pEntry = SvTabListBox::InsertEntryToColumn( rStr, nPos, nCol, pUserData );
652cdf0e10cSrcweir RecalculateAccessibleChildren();
653cdf0e10cSrcweir return pEntry;
654cdf0e10cSrcweir }
655cdf0e10cSrcweir
656cdf0e10cSrcweir // -----------------------------------------------------------------------
657cdf0e10cSrcweir
InsertEntryToColumn(const XubString & rStr,SvLBoxEntry * pParent,sal_uLong nPos,sal_uInt16 nCol,void * pUserData)658cdf0e10cSrcweir SvLBoxEntry* SvHeaderTabListBox::InsertEntryToColumn(
659cdf0e10cSrcweir const XubString& rStr, SvLBoxEntry* pParent, sal_uLong nPos, sal_uInt16 nCol, void* pUserData )
660cdf0e10cSrcweir {
661cdf0e10cSrcweir SvLBoxEntry* pEntry = SvTabListBox::InsertEntryToColumn( rStr, pParent, nPos, nCol, pUserData );
662cdf0e10cSrcweir RecalculateAccessibleChildren();
663cdf0e10cSrcweir return pEntry;
664cdf0e10cSrcweir }
665cdf0e10cSrcweir
666cdf0e10cSrcweir // -----------------------------------------------------------------------
667cdf0e10cSrcweir
InsertEntryToColumn(const XubString & rStr,const Image & rExpandedEntryBmp,const Image & rCollapsedEntryBmp,SvLBoxEntry * pParent,sal_uLong nPos,sal_uInt16 nCol,void * pUserData)668cdf0e10cSrcweir SvLBoxEntry* SvHeaderTabListBox::InsertEntryToColumn(
669cdf0e10cSrcweir const XubString& rStr, const Image& rExpandedEntryBmp, const Image& rCollapsedEntryBmp,
670cdf0e10cSrcweir SvLBoxEntry* pParent, sal_uLong nPos, sal_uInt16 nCol, void* pUserData )
671cdf0e10cSrcweir {
672cdf0e10cSrcweir SvLBoxEntry* pEntry = SvTabListBox::InsertEntryToColumn(
673cdf0e10cSrcweir rStr, rExpandedEntryBmp, rCollapsedEntryBmp, pParent, nPos, nCol, pUserData );
674cdf0e10cSrcweir RecalculateAccessibleChildren();
675cdf0e10cSrcweir return pEntry;
676cdf0e10cSrcweir }
677cdf0e10cSrcweir
678cdf0e10cSrcweir // -----------------------------------------------------------------------
679cdf0e10cSrcweir
Insert(SvLBoxEntry * pEnt,SvLBoxEntry * pPar,sal_uLong nPos)680cdf0e10cSrcweir sal_uLong SvHeaderTabListBox::Insert(
681cdf0e10cSrcweir SvLBoxEntry* pEnt, SvLBoxEntry* pPar, sal_uLong nPos )
682cdf0e10cSrcweir {
683cdf0e10cSrcweir sal_uLong n = SvTabListBox::Insert( pEnt, pPar, nPos );
684cdf0e10cSrcweir RecalculateAccessibleChildren();
685cdf0e10cSrcweir return n;
686cdf0e10cSrcweir }
687cdf0e10cSrcweir
688cdf0e10cSrcweir // -----------------------------------------------------------------------
689cdf0e10cSrcweir
Insert(SvLBoxEntry * pEntry,sal_uLong nRootPos)690cdf0e10cSrcweir sal_uLong SvHeaderTabListBox::Insert( SvLBoxEntry* pEntry, sal_uLong nRootPos )
691cdf0e10cSrcweir {
692cdf0e10cSrcweir sal_uLong nPos = SvTabListBox::Insert( pEntry, nRootPos );
693cdf0e10cSrcweir RecalculateAccessibleChildren();
694cdf0e10cSrcweir return nPos;
695cdf0e10cSrcweir }
696cdf0e10cSrcweir
697cdf0e10cSrcweir // -----------------------------------------------------------------------
698cdf0e10cSrcweir
RemoveEntry(SvLBoxEntry * _pEntry)699cdf0e10cSrcweir void SvHeaderTabListBox::RemoveEntry( SvLBoxEntry* _pEntry )
700cdf0e10cSrcweir {
701cdf0e10cSrcweir GetModel()->Remove( _pEntry );
702cdf0e10cSrcweir m_aAccessibleChildren.clear();
703cdf0e10cSrcweir }
704cdf0e10cSrcweir
705cdf0e10cSrcweir // -----------------------------------------------------------------------
706cdf0e10cSrcweir
Clear()707cdf0e10cSrcweir void SvHeaderTabListBox::Clear()
708cdf0e10cSrcweir {
709cdf0e10cSrcweir SvTabListBox::Clear();
710cdf0e10cSrcweir m_aAccessibleChildren.clear();
711cdf0e10cSrcweir }
712cdf0e10cSrcweir
713cdf0e10cSrcweir // -----------------------------------------------------------------------
714cdf0e10cSrcweir
IMPL_LINK(SvHeaderTabListBox,ScrollHdl_Impl,SvTabListBox *,EMPTYARG)715cdf0e10cSrcweir IMPL_LINK( SvHeaderTabListBox, ScrollHdl_Impl, SvTabListBox*, EMPTYARG )
716cdf0e10cSrcweir {
717cdf0e10cSrcweir m_pImpl->m_pHeaderBar->SetOffset( -GetXOffset() );
718cdf0e10cSrcweir return 0;
719cdf0e10cSrcweir }
720cdf0e10cSrcweir
721cdf0e10cSrcweir // -----------------------------------------------------------------------
722cdf0e10cSrcweir
IMPL_LINK(SvHeaderTabListBox,CreateAccessibleHdl_Impl,HeaderBar *,EMPTYARG)723cdf0e10cSrcweir IMPL_LINK( SvHeaderTabListBox, CreateAccessibleHdl_Impl, HeaderBar*, EMPTYARG )
724cdf0e10cSrcweir {
725cdf0e10cSrcweir Window* pParent = m_pImpl->m_pHeaderBar->GetAccessibleParentWindow();
726cdf0e10cSrcweir DBG_ASSERT( pParent, "SvHeaderTabListBox..CreateAccessibleHdl_Impl - accessible parent not found" );
727cdf0e10cSrcweir if ( pParent )
728cdf0e10cSrcweir {
729cdf0e10cSrcweir ::com::sun::star::uno::Reference< XAccessible > xAccParent = pParent->GetAccessible();
730cdf0e10cSrcweir if ( xAccParent.is() )
731cdf0e10cSrcweir {
732cdf0e10cSrcweir Reference< XAccessible > xAccessible = m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxHeaderBar(
733cdf0e10cSrcweir xAccParent, *this, ::svt::BBTYPE_COLUMNHEADERBAR );
734cdf0e10cSrcweir m_pImpl->m_pHeaderBar->SetAccessible( xAccessible );
735cdf0e10cSrcweir }
736cdf0e10cSrcweir }
737cdf0e10cSrcweir return 0;
738cdf0e10cSrcweir }
739cdf0e10cSrcweir
740cdf0e10cSrcweir // -----------------------------------------------------------------------
741cdf0e10cSrcweir
RecalculateAccessibleChildren()742cdf0e10cSrcweir void SvHeaderTabListBox::RecalculateAccessibleChildren()
743cdf0e10cSrcweir {
744cdf0e10cSrcweir if ( !m_aAccessibleChildren.empty() )
745cdf0e10cSrcweir {
746cdf0e10cSrcweir sal_uInt32 nCount = ( GetRowCount() + 1 ) * GetColumnCount();
747cdf0e10cSrcweir if ( m_aAccessibleChildren.size() < nCount )
748cdf0e10cSrcweir m_aAccessibleChildren.resize( nCount );
749cdf0e10cSrcweir else
750cdf0e10cSrcweir {
751cdf0e10cSrcweir DBG_ASSERT( m_aAccessibleChildren.size() == nCount, "wrong children count" );
752cdf0e10cSrcweir }
753cdf0e10cSrcweir }
754cdf0e10cSrcweir }
755cdf0e10cSrcweir
756cdf0e10cSrcweir // -----------------------------------------------------------------------
757cdf0e10cSrcweir
IsCellCheckBox(long _nRow,sal_uInt16 _nColumn,TriState & _rState)758cdf0e10cSrcweir sal_Bool SvHeaderTabListBox::IsCellCheckBox( long _nRow, sal_uInt16 _nColumn, TriState& _rState )
759cdf0e10cSrcweir {
760cdf0e10cSrcweir sal_Bool bRet = sal_False;
761cdf0e10cSrcweir SvLBoxEntry* pEntry = GetEntry( _nRow );
762cdf0e10cSrcweir if ( pEntry )
763cdf0e10cSrcweir {
764cdf0e10cSrcweir sal_uInt16 nItemCount = pEntry->ItemCount();
765cdf0e10cSrcweir if ( nItemCount > ( _nColumn + 1 ) )
766cdf0e10cSrcweir {
767cdf0e10cSrcweir SvLBoxButton* pItem = (SvLBoxButton*)( pEntry->GetItem( _nColumn + 1 ) );
768cdf0e10cSrcweir if ( pItem && ( (SvLBoxItem*)pItem )->IsA() == SV_ITEM_ID_LBOXBUTTON )
769cdf0e10cSrcweir {
770cdf0e10cSrcweir bRet = sal_True;
771cdf0e10cSrcweir _rState = ( ( pItem->GetButtonFlags() & SV_ITEMSTATE_UNCHECKED ) == 0 )
772cdf0e10cSrcweir ? STATE_CHECK : STATE_NOCHECK;
773cdf0e10cSrcweir }
774cdf0e10cSrcweir }
775cdf0e10cSrcweir else
776cdf0e10cSrcweir {
777cdf0e10cSrcweir DBG_ERRORFILE( "SvHeaderTabListBox::IsCellCheckBox(): column out of range" );
778cdf0e10cSrcweir }
779cdf0e10cSrcweir }
780cdf0e10cSrcweir return bRet;
781cdf0e10cSrcweir }
782cdf0e10cSrcweir
783cdf0e10cSrcweir // -----------------------------------------------------------------------
GetRowCount() const784cdf0e10cSrcweir long SvHeaderTabListBox::GetRowCount() const
785cdf0e10cSrcweir {
786cdf0e10cSrcweir return GetEntryCount();
787cdf0e10cSrcweir }
788cdf0e10cSrcweir // -----------------------------------------------------------------------
GetColumnCount() const789cdf0e10cSrcweir sal_uInt16 SvHeaderTabListBox::GetColumnCount() const
790cdf0e10cSrcweir {
791cdf0e10cSrcweir return m_pImpl->m_pHeaderBar->GetItemCount();
792cdf0e10cSrcweir }
793cdf0e10cSrcweir // -----------------------------------------------------------------------
GetCurrRow() const794cdf0e10cSrcweir sal_Int32 SvHeaderTabListBox::GetCurrRow() const
795cdf0e10cSrcweir {
796cdf0e10cSrcweir sal_Int32 nRet = -1;
797cdf0e10cSrcweir SvLBoxEntry* pEntry = GetCurEntry();
798cdf0e10cSrcweir if ( pEntry )
799cdf0e10cSrcweir {
800cdf0e10cSrcweir sal_uLong nCount = GetEntryCount();
801cdf0e10cSrcweir for ( sal_uLong i = 0; i < nCount; ++i )
802cdf0e10cSrcweir {
803cdf0e10cSrcweir if ( pEntry == GetEntry(i) )
804cdf0e10cSrcweir {
805cdf0e10cSrcweir nRet = i;
806cdf0e10cSrcweir break;
807cdf0e10cSrcweir }
808cdf0e10cSrcweir }
809cdf0e10cSrcweir }
810cdf0e10cSrcweir
811cdf0e10cSrcweir return nRet;
812cdf0e10cSrcweir }
813cdf0e10cSrcweir // -----------------------------------------------------------------------
GetCurrColumn() const814cdf0e10cSrcweir sal_uInt16 SvHeaderTabListBox::GetCurrColumn() const
815cdf0e10cSrcweir {
816cdf0e10cSrcweir sal_uInt16 nPos = GetCurrentTabPos() - 1;
817cdf0e10cSrcweir return nPos;
818cdf0e10cSrcweir }
819cdf0e10cSrcweir // -----------------------------------------------------------------------
GetRowDescription(sal_Int32 _nRow) const820cdf0e10cSrcweir ::rtl::OUString SvHeaderTabListBox::GetRowDescription( sal_Int32 _nRow ) const
821cdf0e10cSrcweir {
822cdf0e10cSrcweir return ::rtl::OUString( GetEntryText( _nRow ) );
823cdf0e10cSrcweir }
824cdf0e10cSrcweir // -----------------------------------------------------------------------
GetColumnDescription(sal_uInt16 _nColumn) const825cdf0e10cSrcweir ::rtl::OUString SvHeaderTabListBox::GetColumnDescription( sal_uInt16 _nColumn ) const
826cdf0e10cSrcweir {
827cdf0e10cSrcweir return ::rtl::OUString( m_pImpl->m_pHeaderBar->GetItemText( m_pImpl->m_pHeaderBar->GetItemId( _nColumn ) ) );
828cdf0e10cSrcweir }
829cdf0e10cSrcweir // -----------------------------------------------------------------------
HasRowHeader() const830cdf0e10cSrcweir sal_Bool SvHeaderTabListBox::HasRowHeader() const
831cdf0e10cSrcweir {
832cdf0e10cSrcweir return sal_False;
833cdf0e10cSrcweir }
834cdf0e10cSrcweir // -----------------------------------------------------------------------
IsCellFocusable() const835cdf0e10cSrcweir sal_Bool SvHeaderTabListBox::IsCellFocusable() const
836cdf0e10cSrcweir {
837cdf0e10cSrcweir return IsCellFocusEnabled();
838cdf0e10cSrcweir }
839cdf0e10cSrcweir // -----------------------------------------------------------------------
GoToCell(sal_Int32 _nRow,sal_uInt16 _nColumn)840cdf0e10cSrcweir sal_Bool SvHeaderTabListBox::GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn )
841cdf0e10cSrcweir {
842cdf0e10cSrcweir sal_Bool bRet = ( IsCellFocusEnabled() == sal_True );
843cdf0e10cSrcweir if ( bRet )
844cdf0e10cSrcweir {
845cdf0e10cSrcweir // first set cursor to _nRow
846cdf0e10cSrcweir SetCursor( GetEntry( _nRow ), sal_True );
847cdf0e10cSrcweir // then set the focus into _nColumn
848cdf0e10cSrcweir bRet = ( SetCurrentTabPos( _nColumn ) == true );
849cdf0e10cSrcweir }
850cdf0e10cSrcweir return bRet;
851cdf0e10cSrcweir }
852cdf0e10cSrcweir // -----------------------------------------------------------------------
SetNoSelection()853cdf0e10cSrcweir void SvHeaderTabListBox::SetNoSelection()
854cdf0e10cSrcweir {
855cdf0e10cSrcweir SvLBox::SelectAll( sal_False );
856cdf0e10cSrcweir }
857cdf0e10cSrcweir // -----------------------------------------------------------------------
SelectAll()858cdf0e10cSrcweir void SvHeaderTabListBox::SelectAll()
859cdf0e10cSrcweir {
860cdf0e10cSrcweir SvLBox::SelectAll( sal_True );
861cdf0e10cSrcweir }
862cdf0e10cSrcweir // -----------------------------------------------------------------------
SelectAll(sal_Bool bSelect,sal_Bool bPaint)863cdf0e10cSrcweir void SvHeaderTabListBox::SelectAll( sal_Bool bSelect, sal_Bool bPaint )
864cdf0e10cSrcweir {
865cdf0e10cSrcweir // overwritten just to disambiguate the SelectAll() from the base' class SelectAll( BOOl, sal_Bool )
866cdf0e10cSrcweir SvTabListBox::SelectAll( bSelect, bPaint );
867cdf0e10cSrcweir }
868cdf0e10cSrcweir
869cdf0e10cSrcweir // -----------------------------------------------------------------------
SelectRow(long _nRow,sal_Bool _bSelect,sal_Bool)870cdf0e10cSrcweir void SvHeaderTabListBox::SelectRow( long _nRow, sal_Bool _bSelect, sal_Bool )
871cdf0e10cSrcweir {
872cdf0e10cSrcweir Select( GetEntry( _nRow ), _bSelect );
873cdf0e10cSrcweir }
874cdf0e10cSrcweir // -----------------------------------------------------------------------
SelectColumn(sal_uInt16,sal_Bool)875cdf0e10cSrcweir void SvHeaderTabListBox::SelectColumn( sal_uInt16, sal_Bool )
876cdf0e10cSrcweir {
877cdf0e10cSrcweir }
878cdf0e10cSrcweir // -----------------------------------------------------------------------
GetSelectedRowCount() const879cdf0e10cSrcweir sal_Int32 SvHeaderTabListBox::GetSelectedRowCount() const
880cdf0e10cSrcweir {
881cdf0e10cSrcweir return GetSelectionCount();
882cdf0e10cSrcweir }
883cdf0e10cSrcweir // -----------------------------------------------------------------------
GetSelectedColumnCount() const884cdf0e10cSrcweir sal_Int32 SvHeaderTabListBox::GetSelectedColumnCount() const
885cdf0e10cSrcweir {
886cdf0e10cSrcweir return 0;
887cdf0e10cSrcweir }
888cdf0e10cSrcweir // -----------------------------------------------------------------------
IsRowSelected(long _nRow) const889cdf0e10cSrcweir bool SvHeaderTabListBox::IsRowSelected( long _nRow ) const
890cdf0e10cSrcweir {
891cdf0e10cSrcweir SvLBoxEntry* pEntry = GetEntry( _nRow );
892cdf0e10cSrcweir return ( pEntry && IsSelected( pEntry ) );
893cdf0e10cSrcweir }
894cdf0e10cSrcweir // -----------------------------------------------------------------------
IsColumnSelected(long) const895cdf0e10cSrcweir sal_Bool SvHeaderTabListBox::IsColumnSelected( long ) const
896cdf0e10cSrcweir {
897cdf0e10cSrcweir return sal_False;
898cdf0e10cSrcweir }
899cdf0e10cSrcweir // -----------------------------------------------------------------------
GetAllSelectedRows(::com::sun::star::uno::Sequence<sal_Int32> &) const900cdf0e10cSrcweir void SvHeaderTabListBox::GetAllSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& ) const
901cdf0e10cSrcweir {
902cdf0e10cSrcweir }
903cdf0e10cSrcweir // -----------------------------------------------------------------------
GetAllSelectedColumns(::com::sun::star::uno::Sequence<sal_Int32> &) const904cdf0e10cSrcweir void SvHeaderTabListBox::GetAllSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& ) const
905cdf0e10cSrcweir {
906cdf0e10cSrcweir }
907cdf0e10cSrcweir // -----------------------------------------------------------------------
IsCellVisible(sal_Int32,sal_uInt16) const908cdf0e10cSrcweir sal_Bool SvHeaderTabListBox::IsCellVisible( sal_Int32, sal_uInt16 ) const
909cdf0e10cSrcweir {
910cdf0e10cSrcweir return sal_True;
911cdf0e10cSrcweir }
912cdf0e10cSrcweir // -----------------------------------------------------------------------
GetAccessibleCellText(long _nRow,sal_uInt16 _nColumnPos) const913cdf0e10cSrcweir String SvHeaderTabListBox::GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const
914cdf0e10cSrcweir {
915cdf0e10cSrcweir return ::rtl::OUString( GetTabEntryText( _nRow, _nColumnPos ) );
916cdf0e10cSrcweir }
917cdf0e10cSrcweir // -----------------------------------------------------------------------
calcHeaderRect(sal_Bool _bIsColumnBar,sal_Bool _bOnScreen)918cdf0e10cSrcweir Rectangle SvHeaderTabListBox::calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen )
919cdf0e10cSrcweir {
920cdf0e10cSrcweir Rectangle aRect;
921cdf0e10cSrcweir if ( _bIsColumnBar )
922cdf0e10cSrcweir {
923cdf0e10cSrcweir Window* pParent = NULL;
924cdf0e10cSrcweir if ( !_bOnScreen )
925cdf0e10cSrcweir pParent = m_pImpl->m_pHeaderBar->GetAccessibleParentWindow();
926cdf0e10cSrcweir
927cdf0e10cSrcweir aRect = m_pImpl->m_pHeaderBar->GetWindowExtentsRelative( pParent );
928cdf0e10cSrcweir }
929cdf0e10cSrcweir return aRect;
930cdf0e10cSrcweir }
931cdf0e10cSrcweir // -----------------------------------------------------------------------
calcTableRect(sal_Bool _bOnScreen)932cdf0e10cSrcweir Rectangle SvHeaderTabListBox::calcTableRect( sal_Bool _bOnScreen )
933cdf0e10cSrcweir {
934cdf0e10cSrcweir Window* pParent = NULL;
935cdf0e10cSrcweir if ( !_bOnScreen )
936cdf0e10cSrcweir pParent = GetAccessibleParentWindow();
937cdf0e10cSrcweir
938cdf0e10cSrcweir Rectangle aRect( GetWindowExtentsRelative( pParent ) );
939cdf0e10cSrcweir return aRect;
940cdf0e10cSrcweir }
941cdf0e10cSrcweir // -----------------------------------------------------------------------
GetFieldRectPixelAbs(sal_Int32 _nRow,sal_uInt16 _nColumn,sal_Bool _bIsHeader,sal_Bool _bOnScreen)942cdf0e10cSrcweir Rectangle SvHeaderTabListBox::GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_Bool _bIsHeader, sal_Bool _bOnScreen )
943cdf0e10cSrcweir {
944cdf0e10cSrcweir DBG_ASSERT( !_bIsHeader || 0 == _nRow, "invalid parameters" );
945cdf0e10cSrcweir Rectangle aRect;
946cdf0e10cSrcweir SvLBoxEntry* pEntry = GetEntry( _nRow );
947cdf0e10cSrcweir if ( pEntry )
948cdf0e10cSrcweir {
949cdf0e10cSrcweir aRect = _bIsHeader ? calcHeaderRect( sal_True, sal_False ) : GetBoundingRect( pEntry );
950cdf0e10cSrcweir Point aTopLeft = aRect.TopLeft();
951cdf0e10cSrcweir DBG_ASSERT( m_pImpl->m_pHeaderBar->GetItemCount() > _nColumn, "invalid column" );
952cdf0e10cSrcweir Rectangle aItemRect = m_pImpl->m_pHeaderBar->GetItemRect( m_pImpl->m_pHeaderBar->GetItemId( _nColumn ) );
953cdf0e10cSrcweir aTopLeft.X() = aItemRect.Left();
954cdf0e10cSrcweir Size aSize = aItemRect.GetSize();
955cdf0e10cSrcweir aRect = Rectangle( aTopLeft, aSize );
956cdf0e10cSrcweir Window* pParent = NULL;
957cdf0e10cSrcweir if ( !_bOnScreen )
958cdf0e10cSrcweir pParent = GetAccessibleParentWindow();
959cdf0e10cSrcweir aTopLeft = aRect.TopLeft();
960cdf0e10cSrcweir aTopLeft += GetWindowExtentsRelative( pParent ).TopLeft();
961cdf0e10cSrcweir aRect = Rectangle( aTopLeft, aRect.GetSize() );
962cdf0e10cSrcweir }
963cdf0e10cSrcweir
964cdf0e10cSrcweir return aRect;
965cdf0e10cSrcweir }
966cdf0e10cSrcweir // -----------------------------------------------------------------------
CreateAccessibleCell(sal_Int32 _nRow,sal_uInt16 _nColumnPos)967cdf0e10cSrcweir Reference< XAccessible > SvHeaderTabListBox::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos )
968cdf0e10cSrcweir {
969cdf0e10cSrcweir OSL_ENSURE( m_pAccessible, "Invalid call: Accessible is null" );
970cdf0e10cSrcweir
971cdf0e10cSrcweir Reference< XAccessible > xChild;
972cdf0e10cSrcweir sal_Int32 nIndex = -1;
973cdf0e10cSrcweir
974cdf0e10cSrcweir if ( !AreChildrenTransient() )
975cdf0e10cSrcweir {
976cdf0e10cSrcweir const sal_uInt16 nColumnCount = GetColumnCount();
977cdf0e10cSrcweir
978cdf0e10cSrcweir // first call? -> initial list
979cdf0e10cSrcweir if ( m_aAccessibleChildren.empty() )
980cdf0e10cSrcweir {
981cdf0e10cSrcweir sal_Int32 nCount = ( GetRowCount() + 1 ) * nColumnCount;
982cdf0e10cSrcweir m_aAccessibleChildren.assign( nCount, Reference< XAccessible >() );
983cdf0e10cSrcweir }
984cdf0e10cSrcweir
985cdf0e10cSrcweir nIndex = ( _nRow * nColumnCount ) + _nColumnPos + nColumnCount;
986cdf0e10cSrcweir xChild = m_aAccessibleChildren[ nIndex ];
987cdf0e10cSrcweir }
988cdf0e10cSrcweir
989cdf0e10cSrcweir if ( !xChild.is() )
990cdf0e10cSrcweir {
991cdf0e10cSrcweir TriState eState = STATE_DONTKNOW;
992cdf0e10cSrcweir sal_Bool bIsCheckBox = IsCellCheckBox( _nRow, _nColumnPos, eState );
993cdf0e10cSrcweir if ( bIsCheckBox )
994cdf0e10cSrcweir xChild = m_pImpl->m_aFactoryAccess.getFactory().createAccessibleCheckBoxCell(
995cdf0e10cSrcweir m_pAccessible->getAccessibleChild( 0 ), *this, NULL, _nRow, _nColumnPos, eState, sal_True, sal_False );
996cdf0e10cSrcweir else
997cdf0e10cSrcweir xChild = m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxTableCell(
998cdf0e10cSrcweir m_pAccessible->getAccessibleChild( 0 ), *this, NULL, _nRow, _nColumnPos, OFFSET_NONE );
999cdf0e10cSrcweir
1000cdf0e10cSrcweir // insert into list
1001cdf0e10cSrcweir if ( !AreChildrenTransient() )
1002cdf0e10cSrcweir m_aAccessibleChildren[ nIndex ] = xChild;
1003cdf0e10cSrcweir }
1004cdf0e10cSrcweir
1005cdf0e10cSrcweir return xChild;
1006cdf0e10cSrcweir }
1007cdf0e10cSrcweir // -----------------------------------------------------------------------
CreateAccessibleRowHeader(sal_Int32)1008cdf0e10cSrcweir Reference< XAccessible > SvHeaderTabListBox::CreateAccessibleRowHeader( sal_Int32 )
1009cdf0e10cSrcweir {
1010cdf0e10cSrcweir Reference< XAccessible > xHeader;
1011cdf0e10cSrcweir return xHeader;
1012cdf0e10cSrcweir }
1013cdf0e10cSrcweir // -----------------------------------------------------------------------
CreateAccessibleColumnHeader(sal_uInt16 _nColumn)1014cdf0e10cSrcweir Reference< XAccessible > SvHeaderTabListBox::CreateAccessibleColumnHeader( sal_uInt16 _nColumn )
1015cdf0e10cSrcweir {
1016cdf0e10cSrcweir // first call? -> initial list
1017cdf0e10cSrcweir if ( m_aAccessibleChildren.empty() )
1018cdf0e10cSrcweir {
1019cdf0e10cSrcweir const sal_uInt16 nColumnCount = GetColumnCount();
1020cdf0e10cSrcweir sal_Int32 nCount = AreChildrenTransient() ?
1021cdf0e10cSrcweir nColumnCount : ( GetRowCount() + 1 ) * nColumnCount;
1022cdf0e10cSrcweir m_aAccessibleChildren.assign( nCount, Reference< XAccessible >() );
1023cdf0e10cSrcweir }
1024cdf0e10cSrcweir
1025cdf0e10cSrcweir // get header
1026cdf0e10cSrcweir Reference< XAccessible > xChild = m_aAccessibleChildren[ _nColumn ];
1027cdf0e10cSrcweir // already exists?
1028cdf0e10cSrcweir if ( !xChild.is() && m_pAccessible )
1029cdf0e10cSrcweir {
1030cdf0e10cSrcweir // no -> create new header cell
1031cdf0e10cSrcweir xChild = m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxHeaderCell(
1032cdf0e10cSrcweir _nColumn, m_pAccessible->getHeaderBar( ::svt::BBTYPE_COLUMNHEADERBAR ),
1033cdf0e10cSrcweir *this, NULL, ::svt::BBTYPE_COLUMNHEADERCELL
1034cdf0e10cSrcweir );
1035cdf0e10cSrcweir
1036cdf0e10cSrcweir // insert into list
1037cdf0e10cSrcweir m_aAccessibleChildren[ _nColumn ] = xChild;
1038cdf0e10cSrcweir }
1039cdf0e10cSrcweir
1040cdf0e10cSrcweir return xChild;
1041cdf0e10cSrcweir }
1042cdf0e10cSrcweir // -----------------------------------------------------------------------
GetAccessibleControlCount() const1043cdf0e10cSrcweir sal_Int32 SvHeaderTabListBox::GetAccessibleControlCount() const
1044cdf0e10cSrcweir {
1045cdf0e10cSrcweir return -1;
1046cdf0e10cSrcweir }
1047cdf0e10cSrcweir // -----------------------------------------------------------------------
CreateAccessibleControl(sal_Int32)1048cdf0e10cSrcweir Reference< XAccessible > SvHeaderTabListBox::CreateAccessibleControl( sal_Int32 )
1049cdf0e10cSrcweir {
1050cdf0e10cSrcweir Reference< XAccessible > xControl;
1051cdf0e10cSrcweir return xControl;
1052cdf0e10cSrcweir }
1053cdf0e10cSrcweir // -----------------------------------------------------------------------
ConvertPointToControlIndex(sal_Int32 &,const Point &)1054cdf0e10cSrcweir sal_Bool SvHeaderTabListBox::ConvertPointToControlIndex( sal_Int32&, const Point& )
1055cdf0e10cSrcweir {
1056cdf0e10cSrcweir return sal_False;
1057cdf0e10cSrcweir }
1058cdf0e10cSrcweir // -----------------------------------------------------------------------
ConvertPointToCellAddress(sal_Int32 &,sal_uInt16 &,const Point &)1059cdf0e10cSrcweir sal_Bool SvHeaderTabListBox::ConvertPointToCellAddress( sal_Int32&, sal_uInt16&, const Point& )
1060cdf0e10cSrcweir {
1061cdf0e10cSrcweir return sal_False;
1062cdf0e10cSrcweir }
1063cdf0e10cSrcweir // -----------------------------------------------------------------------
ConvertPointToRowHeader(sal_Int32 &,const Point &)1064cdf0e10cSrcweir sal_Bool SvHeaderTabListBox::ConvertPointToRowHeader( sal_Int32&, const Point& )
1065cdf0e10cSrcweir {
1066cdf0e10cSrcweir return sal_False;
1067cdf0e10cSrcweir }
1068cdf0e10cSrcweir // -----------------------------------------------------------------------
ConvertPointToColumnHeader(sal_uInt16 &,const Point &)1069cdf0e10cSrcweir sal_Bool SvHeaderTabListBox::ConvertPointToColumnHeader( sal_uInt16&, const Point& )
1070cdf0e10cSrcweir {
1071cdf0e10cSrcweir return sal_False;
1072cdf0e10cSrcweir }
1073cdf0e10cSrcweir // -----------------------------------------------------------------------
GetAccessibleObjectName(::svt::AccessibleBrowseBoxObjType _eType,sal_Int32 _nPos) const1074cdf0e10cSrcweir ::rtl::OUString SvHeaderTabListBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos ) const
1075cdf0e10cSrcweir {
1076cdf0e10cSrcweir ::rtl::OUString aRetText;
1077cdf0e10cSrcweir switch( _eType )
1078cdf0e10cSrcweir {
1079cdf0e10cSrcweir case ::svt::BBTYPE_BROWSEBOX:
1080cdf0e10cSrcweir case ::svt::BBTYPE_TABLE:
1081cdf0e10cSrcweir case ::svt::BBTYPE_COLUMNHEADERBAR:
1082cdf0e10cSrcweir // should be empty now (see #i63983)
1083cdf0e10cSrcweir aRetText = ::rtl::OUString();
1084cdf0e10cSrcweir break;
1085cdf0e10cSrcweir
1086cdf0e10cSrcweir case ::svt::BBTYPE_TABLECELL:
1087cdf0e10cSrcweir {
1088cdf0e10cSrcweir // here we need a valid pos, we can not handle -1
1089cdf0e10cSrcweir if ( _nPos >= 0 )
1090cdf0e10cSrcweir {
1091cdf0e10cSrcweir sal_uInt16 nColumnCount = GetColumnCount();
1092cdf0e10cSrcweir if (nColumnCount > 0)
1093cdf0e10cSrcweir {
1094cdf0e10cSrcweir sal_Int32 nRow = _nPos / nColumnCount;
1095cdf0e10cSrcweir sal_uInt16 nColumn = static_cast< sal_uInt16 >( _nPos % nColumnCount );
1096cdf0e10cSrcweir aRetText = GetCellText( nRow, nColumn );
1097cdf0e10cSrcweir }
1098cdf0e10cSrcweir }
1099cdf0e10cSrcweir break;
1100cdf0e10cSrcweir }
1101cdf0e10cSrcweir case ::svt::BBTYPE_CHECKBOXCELL:
1102cdf0e10cSrcweir {
1103cdf0e10cSrcweir break; // checkbox cells have no name
1104cdf0e10cSrcweir }
1105cdf0e10cSrcweir case ::svt::BBTYPE_COLUMNHEADERCELL:
1106cdf0e10cSrcweir {
1107cdf0e10cSrcweir aRetText = m_pImpl->m_pHeaderBar->GetItemText( m_pImpl->m_pHeaderBar->GetItemId( (sal_uInt16)_nPos ) );
1108cdf0e10cSrcweir break;
1109cdf0e10cSrcweir }
1110cdf0e10cSrcweir
1111cdf0e10cSrcweir case ::svt::BBTYPE_ROWHEADERBAR:
1112cdf0e10cSrcweir case ::svt::BBTYPE_ROWHEADERCELL:
1113cdf0e10cSrcweir aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "error" ) );
1114cdf0e10cSrcweir break;
1115cdf0e10cSrcweir
1116cdf0e10cSrcweir default:
1117cdf0e10cSrcweir OSL_ENSURE(0,"BrowseBox::GetAccessibleName: invalid enum!");
1118cdf0e10cSrcweir }
1119cdf0e10cSrcweir return aRetText;
1120cdf0e10cSrcweir }
1121cdf0e10cSrcweir // -----------------------------------------------------------------------
GetAccessibleObjectDescription(::svt::AccessibleBrowseBoxObjType _eType,sal_Int32 _nPos) const1122cdf0e10cSrcweir ::rtl::OUString SvHeaderTabListBox::GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos ) const
1123cdf0e10cSrcweir {
1124cdf0e10cSrcweir ::rtl::OUString aRetText;
1125cdf0e10cSrcweir
1126cdf0e10cSrcweir if( _eType == ::svt::BBTYPE_TABLECELL && _nPos != -1 )
1127cdf0e10cSrcweir {
1128cdf0e10cSrcweir static const String sVar1( RTL_CONSTASCII_USTRINGPARAM( "%1" ) );
1129cdf0e10cSrcweir static const String sVar2( RTL_CONSTASCII_USTRINGPARAM( "%2" ) );
1130cdf0e10cSrcweir
1131cdf0e10cSrcweir sal_uInt16 nColumnCount = GetColumnCount();
1132cdf0e10cSrcweir if (nColumnCount > 0)
1133cdf0e10cSrcweir {
1134cdf0e10cSrcweir sal_Int32 nRow = _nPos / nColumnCount;
1135cdf0e10cSrcweir sal_uInt16 nColumn = static_cast< sal_uInt16 >( _nPos % nColumnCount );
1136cdf0e10cSrcweir
1137cdf0e10cSrcweir String aText( SvtResId( STR_SVT_ACC_DESC_TABLISTBOX ) );
1138cdf0e10cSrcweir aText.SearchAndReplace( sVar1, String::CreateFromInt32( nRow ) );
1139cdf0e10cSrcweir String sColHeader = m_pImpl->m_pHeaderBar->GetItemText( m_pImpl->m_pHeaderBar->GetItemId( nColumn ) );
1140cdf0e10cSrcweir if ( sColHeader.Len() == 0 )
1141cdf0e10cSrcweir sColHeader = String::CreateFromInt32( nColumn );
1142cdf0e10cSrcweir aText.SearchAndReplace( sVar2, sColHeader );
1143cdf0e10cSrcweir aRetText = aText;
1144cdf0e10cSrcweir }
1145cdf0e10cSrcweir }
1146cdf0e10cSrcweir
1147cdf0e10cSrcweir return aRetText;
1148cdf0e10cSrcweir }
1149cdf0e10cSrcweir // -----------------------------------------------------------------------
FillAccessibleStateSet(::utl::AccessibleStateSetHelper & _rStateSet,::svt::AccessibleBrowseBoxObjType _eType) const1150cdf0e10cSrcweir void SvHeaderTabListBox::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, ::svt::AccessibleBrowseBoxObjType _eType ) const
1151cdf0e10cSrcweir {
1152cdf0e10cSrcweir switch( _eType )
1153cdf0e10cSrcweir {
1154cdf0e10cSrcweir case ::svt::BBTYPE_BROWSEBOX:
1155cdf0e10cSrcweir case ::svt::BBTYPE_TABLE:
1156cdf0e10cSrcweir {
1157cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::FOCUSABLE );
1158cdf0e10cSrcweir if ( HasFocus() )
1159cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::FOCUSED );
1160cdf0e10cSrcweir if ( IsActive() )
1161cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::ACTIVE );
1162cdf0e10cSrcweir if ( IsEnabled() )
1163cdf0e10cSrcweir {
1164cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::ENABLED );
1165cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::SENSITIVE );
1166cdf0e10cSrcweir }
1167cdf0e10cSrcweir if ( IsReallyVisible() )
1168cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::VISIBLE );
1169cdf0e10cSrcweir if ( _eType == ::svt::BBTYPE_TABLE )
1170cdf0e10cSrcweir {
1171cdf0e10cSrcweir
1172cdf0e10cSrcweir if ( AreChildrenTransient() )
1173cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
1174cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
1175cdf0e10cSrcweir }
1176cdf0e10cSrcweir break;
1177cdf0e10cSrcweir }
1178cdf0e10cSrcweir
1179cdf0e10cSrcweir case ::svt::BBTYPE_COLUMNHEADERBAR:
1180cdf0e10cSrcweir {
1181cdf0e10cSrcweir sal_Int32 nCurRow = GetCurrRow();
1182cdf0e10cSrcweir sal_uInt16 nCurColumn = GetCurrColumn();
1183cdf0e10cSrcweir if ( IsCellVisible( nCurRow, nCurColumn ) )
1184cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::VISIBLE );
1185*2bfcd321SSteve Yin if ( IsEnabled() )
1186*2bfcd321SSteve Yin _rStateSet.AddState( AccessibleStateType::ENABLED );
1187cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::TRANSIENT );
1188cdf0e10cSrcweir break;
1189cdf0e10cSrcweir }
1190cdf0e10cSrcweir
1191cdf0e10cSrcweir case ::svt::BBTYPE_ROWHEADERCELL:
1192cdf0e10cSrcweir case ::svt::BBTYPE_COLUMNHEADERCELL:
1193cdf0e10cSrcweir {
1194cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::VISIBLE );
1195cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::FOCUSABLE );
1196cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::TRANSIENT );
1197*2bfcd321SSteve Yin if ( IsEnabled() )
1198*2bfcd321SSteve Yin _rStateSet.AddState( AccessibleStateType::ENABLED );
1199cdf0e10cSrcweir break;
1200cdf0e10cSrcweir }
1201cdf0e10cSrcweir default:
1202cdf0e10cSrcweir break;
1203cdf0e10cSrcweir }
1204cdf0e10cSrcweir }
1205cdf0e10cSrcweir // -----------------------------------------------------------------------
FillAccessibleStateSetForCell(::utl::AccessibleStateSetHelper & _rStateSet,sal_Int32 _nRow,sal_uInt16 _nColumn) const1206cdf0e10cSrcweir void SvHeaderTabListBox::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumn ) const
1207cdf0e10cSrcweir {
1208cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::SELECTABLE );
1209cdf0e10cSrcweir if ( AreChildrenTransient() )
1210cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::TRANSIENT );
1211cdf0e10cSrcweir
1212cdf0e10cSrcweir if ( IsCellVisible( _nRow, _nColumn ) )
1213cdf0e10cSrcweir {
1214cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::VISIBLE );
1215cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::ENABLED );
1216cdf0e10cSrcweir }
1217cdf0e10cSrcweir
1218cdf0e10cSrcweir if ( IsRowSelected( _nRow ) )
1219cdf0e10cSrcweir {
1220cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::ACTIVE );
1221cdf0e10cSrcweir _rStateSet.AddState( AccessibleStateType::SELECTED );
1222cdf0e10cSrcweir }
1223*2bfcd321SSteve Yin if ( IsEnabled() )
1224*2bfcd321SSteve Yin _rStateSet.AddState( AccessibleStateType::ENABLED );
1225cdf0e10cSrcweir }
1226cdf0e10cSrcweir // -----------------------------------------------------------------------
GrabTableFocus()1227cdf0e10cSrcweir void SvHeaderTabListBox::GrabTableFocus()
1228cdf0e10cSrcweir {
1229cdf0e10cSrcweir GrabFocus();
1230cdf0e10cSrcweir }
1231cdf0e10cSrcweir // -----------------------------------------------------------------------
GetGlyphBoundRects(const Point & rOrigin,const String & rStr,int nIndex,int nLen,int nBase,MetricVector & rVector)1232cdf0e10cSrcweir sal_Bool SvHeaderTabListBox::GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector )
1233cdf0e10cSrcweir {
1234cdf0e10cSrcweir return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, nBase, rVector );
1235cdf0e10cSrcweir }
1236cdf0e10cSrcweir // -----------------------------------------------------------------------
GetWindowExtentsRelative(Window * pRelativeWindow) const1237cdf0e10cSrcweir Rectangle SvHeaderTabListBox::GetWindowExtentsRelative( Window *pRelativeWindow ) const
1238cdf0e10cSrcweir {
1239cdf0e10cSrcweir return Control::GetWindowExtentsRelative( pRelativeWindow );
1240cdf0e10cSrcweir }
1241cdf0e10cSrcweir // -----------------------------------------------------------------------
GrabFocus()1242cdf0e10cSrcweir void SvHeaderTabListBox::GrabFocus()
1243cdf0e10cSrcweir {
1244cdf0e10cSrcweir Control::GrabFocus();
1245cdf0e10cSrcweir }
1246cdf0e10cSrcweir // -----------------------------------------------------------------------
GetAccessible(sal_Bool bCreate)1247cdf0e10cSrcweir Reference< XAccessible > SvHeaderTabListBox::GetAccessible( sal_Bool bCreate )
1248cdf0e10cSrcweir {
1249cdf0e10cSrcweir return Control::GetAccessible( bCreate );
1250cdf0e10cSrcweir }
1251cdf0e10cSrcweir // -----------------------------------------------------------------------
GetAccessibleParentWindow() const1252cdf0e10cSrcweir Window* SvHeaderTabListBox::GetAccessibleParentWindow() const
1253cdf0e10cSrcweir {
1254cdf0e10cSrcweir return Control::GetAccessibleParentWindow();
1255cdf0e10cSrcweir }
1256cdf0e10cSrcweir // -----------------------------------------------------------------------
GetWindowInstance()1257cdf0e10cSrcweir Window* SvHeaderTabListBox::GetWindowInstance()
1258cdf0e10cSrcweir {
1259cdf0e10cSrcweir return this;
1260cdf0e10cSrcweir }
1261cdf0e10cSrcweir // -----------------------------------------------------------------------
CreateAccessible()1262cdf0e10cSrcweir Reference< XAccessible > SvHeaderTabListBox::CreateAccessible()
1263cdf0e10cSrcweir {
1264cdf0e10cSrcweir Window* pParent = GetAccessibleParentWindow();
1265cdf0e10cSrcweir DBG_ASSERT( pParent, "SvHeaderTabListBox::::CreateAccessible - accessible parent not found" );
1266cdf0e10cSrcweir
1267cdf0e10cSrcweir Reference< XAccessible > xAccessible;
1268cdf0e10cSrcweir if ( m_pAccessible ) xAccessible = m_pAccessible->getMyself();
1269cdf0e10cSrcweir
1270cdf0e10cSrcweir if( pParent && !m_pAccessible )
1271cdf0e10cSrcweir {
1272cdf0e10cSrcweir Reference< XAccessible > xAccParent = pParent->GetAccessible();
1273cdf0e10cSrcweir if ( xAccParent.is() )
1274cdf0e10cSrcweir {
1275cdf0e10cSrcweir m_pAccessible = m_pImpl->m_aFactoryAccess.getFactory().createAccessibleTabListBox( xAccParent, *this );
1276cdf0e10cSrcweir if ( m_pAccessible )
1277cdf0e10cSrcweir xAccessible = m_pAccessible->getMyself();
1278cdf0e10cSrcweir }
1279cdf0e10cSrcweir }
1280cdf0e10cSrcweir return xAccessible;
1281cdf0e10cSrcweir }
1282cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetFieldCharacterBounds(sal_Int32,sal_Int32,sal_Int32)1283cdf0e10cSrcweir Rectangle SvHeaderTabListBox::GetFieldCharacterBounds(sal_Int32,sal_Int32,sal_Int32)
1284cdf0e10cSrcweir {
1285cdf0e10cSrcweir Rectangle aRect;
1286cdf0e10cSrcweir return aRect;
1287cdf0e10cSrcweir }
1288cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point & _rPoint)1289cdf0e10cSrcweir sal_Int32 SvHeaderTabListBox::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)
1290cdf0e10cSrcweir {
1291cdf0e10cSrcweir String sText = GetAccessibleCellText( _nRow, static_cast< sal_uInt16 >( _nColumnPos ) );
1292cdf0e10cSrcweir MetricVector aRects;
1293cdf0e10cSrcweir if ( GetGlyphBoundRects(Point(0,0),sText,0,STRING_LEN,0,aRects) )
1294cdf0e10cSrcweir {
1295cdf0e10cSrcweir for (MetricVector::iterator aIter = aRects.begin(); aIter != aRects.end(); ++aIter)
1296cdf0e10cSrcweir {
1297cdf0e10cSrcweir if( aIter->IsInside(_rPoint) )
1298cdf0e10cSrcweir return aIter - aRects.begin();
1299cdf0e10cSrcweir }
1300cdf0e10cSrcweir }
1301cdf0e10cSrcweir
1302cdf0e10cSrcweir return -1;
1303cdf0e10cSrcweir }
1304cdf0e10cSrcweir // -----------------------------------------------------------------------------
1305cdf0e10cSrcweir
1306cdf0e10cSrcweir
1307