xref: /trunk/main/svl/source/items/slstitm.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1*40df464eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*40df464eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*40df464eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*40df464eSAndrew Rist  * distributed with this work for additional information
6*40df464eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*40df464eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*40df464eSAndrew Rist  * "License"); you may not use this file except in compliance
9*40df464eSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*40df464eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*40df464eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*40df464eSAndrew Rist  * software distributed under the License is distributed on an
15*40df464eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*40df464eSAndrew Rist  * KIND, either express or implied.  See the License for the
17*40df464eSAndrew Rist  * specific language governing permissions and limitations
18*40df464eSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*40df464eSAndrew Rist  *************************************************************/
21*40df464eSAndrew Rist 
22*40df464eSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svl.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svl/slstitm.hxx>
28cdf0e10cSrcweir #include <svl/poolitem.hxx>
29cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
30cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
31cdf0e10cSrcweir #include <tools/stream.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir // STATIC DATA -----------------------------------------------------------
34cdf0e10cSrcweir 
35cdf0e10cSrcweir DBG_NAME(SfxStringListItem)
36cdf0e10cSrcweir 
37cdf0e10cSrcweir // -----------------------------------------------------------------------
38cdf0e10cSrcweir 
39cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(SfxStringListItem, SfxPoolItem);
40cdf0e10cSrcweir 
41cdf0e10cSrcweir class SfxImpStringList
42cdf0e10cSrcweir {
43cdf0e10cSrcweir public:
44cdf0e10cSrcweir     sal_uInt16  nRefCount;
45cdf0e10cSrcweir     List    aList;
46cdf0e10cSrcweir 
SfxImpStringList()47cdf0e10cSrcweir             SfxImpStringList() { nRefCount = 1; }
48cdf0e10cSrcweir             ~SfxImpStringList();
49cdf0e10cSrcweir     void    Sort( sal_Bool bAscending, List* );
50cdf0e10cSrcweir };
51cdf0e10cSrcweir 
52cdf0e10cSrcweir //------------------------------------------------------------------------
53cdf0e10cSrcweir 
~SfxImpStringList()54cdf0e10cSrcweir SfxImpStringList::~SfxImpStringList()
55cdf0e10cSrcweir {
56cdf0e10cSrcweir     DBG_ASSERT(nRefCount!=0xffff,"ImpList already deleted");
57cdf0e10cSrcweir     String* pStr = (String*)aList.First();
58cdf0e10cSrcweir     while( pStr )
59cdf0e10cSrcweir     {
60cdf0e10cSrcweir         delete pStr;
61cdf0e10cSrcweir         pStr = (String*)aList.Next();
62cdf0e10cSrcweir     }
63cdf0e10cSrcweir     nRefCount = 0xffff;
64cdf0e10cSrcweir }
65cdf0e10cSrcweir 
66cdf0e10cSrcweir //------------------------------------------------------------------------
67cdf0e10cSrcweir 
Sort(sal_Bool bAscending,List * pParallelList)68cdf0e10cSrcweir void SfxImpStringList::Sort( sal_Bool bAscending, List* pParallelList )
69cdf0e10cSrcweir {
70cdf0e10cSrcweir     DBG_ASSERT(!pParallelList || pParallelList->Count() >= aList.Count(),"Sort:ParallelList too small");
71cdf0e10cSrcweir     sal_uLong nCount = aList.Count();
72cdf0e10cSrcweir     if( nCount > 1 )
73cdf0e10cSrcweir     {
74cdf0e10cSrcweir         nCount -= 2;
75cdf0e10cSrcweir         // Bubble Dir Einen
76cdf0e10cSrcweir         sal_Bool bSwapped = sal_True;
77cdf0e10cSrcweir         while( bSwapped )
78cdf0e10cSrcweir         {
79cdf0e10cSrcweir             bSwapped = sal_False;
80cdf0e10cSrcweir             for( sal_uLong nCur = 0; nCur <= nCount; nCur++ )
81cdf0e10cSrcweir             {
82cdf0e10cSrcweir                 String* pStr1 = (String*)aList.GetObject( nCur );
83cdf0e10cSrcweir                 String* pStr2 = (String*)aList.GetObject( nCur+1 );
84cdf0e10cSrcweir                 // COMPARE_GREATER => pStr2 ist groesser als pStr1
85cdf0e10cSrcweir                 StringCompare eCompare = pStr1->CompareIgnoreCaseToAscii( *pStr2 ); //@@@
86cdf0e10cSrcweir                 sal_Bool bSwap = sal_False;
87cdf0e10cSrcweir                 if( bAscending )
88cdf0e10cSrcweir                 {
89cdf0e10cSrcweir                     if( eCompare == COMPARE_LESS )
90cdf0e10cSrcweir                         bSwap = sal_True;
91cdf0e10cSrcweir                 }
92cdf0e10cSrcweir                 else if( eCompare == COMPARE_GREATER )
93cdf0e10cSrcweir                     bSwap = sal_True;
94cdf0e10cSrcweir 
95cdf0e10cSrcweir                 if( bSwap )
96cdf0e10cSrcweir                 {
97cdf0e10cSrcweir                     bSwapped = sal_True;
98cdf0e10cSrcweir                     aList.Replace( pStr1, nCur + 1 );
99cdf0e10cSrcweir                     aList.Replace( pStr2, nCur );
100cdf0e10cSrcweir                     if( pParallelList )
101cdf0e10cSrcweir                     {
102cdf0e10cSrcweir                         void* p1 = pParallelList->GetObject( nCur );
103cdf0e10cSrcweir                         void* p2 = pParallelList->GetObject( nCur + 1 );
104cdf0e10cSrcweir                         pParallelList->Replace( p1, nCur + 1 );
105cdf0e10cSrcweir                         pParallelList->Replace( p2, nCur );
106cdf0e10cSrcweir                     }
107cdf0e10cSrcweir                 }
108cdf0e10cSrcweir             }
109cdf0e10cSrcweir         }
110cdf0e10cSrcweir     }
111cdf0e10cSrcweir }
112cdf0e10cSrcweir 
113cdf0e10cSrcweir // class SfxStringListItem -----------------------------------------------
114cdf0e10cSrcweir 
SfxStringListItem()115cdf0e10cSrcweir SfxStringListItem::SfxStringListItem() :
116cdf0e10cSrcweir     pImp(NULL)
117cdf0e10cSrcweir {
118cdf0e10cSrcweir }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir //------------------------------------------------------------------------
121cdf0e10cSrcweir 
SfxStringListItem(sal_uInt16 which,const List * pList)122cdf0e10cSrcweir SfxStringListItem::SfxStringListItem( sal_uInt16 which, const List* pList ) :
123cdf0e10cSrcweir     SfxPoolItem( which ),
124cdf0e10cSrcweir     pImp(NULL)
125cdf0e10cSrcweir {
126cdf0e10cSrcweir     // PB: das Putten einer leeren Liste funktionierte nicht,
127cdf0e10cSrcweir     // deshalb habe ich hier die Abfrage nach dem Count auskommentiert
128cdf0e10cSrcweir     if( pList /*!!! && pList->Count() */ )
129cdf0e10cSrcweir     {
130cdf0e10cSrcweir         pImp = new SfxImpStringList;
131cdf0e10cSrcweir 
132cdf0e10cSrcweir         long i, nCount = pList->Count();
133cdf0e10cSrcweir         String  *pStr1, *pStr2;
134cdf0e10cSrcweir         for( i=0; i < nCount; i++ )
135cdf0e10cSrcweir         {
136cdf0e10cSrcweir             pStr1 = (String*)pList->GetObject(i);
137cdf0e10cSrcweir             pStr2 = new String( *pStr1 );
138cdf0e10cSrcweir             pImp->aList.Insert( pStr2, LIST_APPEND );
139cdf0e10cSrcweir         }
140cdf0e10cSrcweir     }
141cdf0e10cSrcweir }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir //------------------------------------------------------------------------
144cdf0e10cSrcweir 
SfxStringListItem(sal_uInt16 which,SvStream & rStream)145cdf0e10cSrcweir SfxStringListItem::SfxStringListItem( sal_uInt16 which, SvStream& rStream ) :
146cdf0e10cSrcweir     SfxPoolItem( which ),
147cdf0e10cSrcweir     pImp(NULL)
148cdf0e10cSrcweir {
149cdf0e10cSrcweir     long nEntryCount;
150cdf0e10cSrcweir     rStream >> nEntryCount;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir     if( nEntryCount )
153cdf0e10cSrcweir         pImp = new SfxImpStringList;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     long   i;
156cdf0e10cSrcweir     String*  pStr;
157cdf0e10cSrcweir     for( i=0; i < nEntryCount; i++ )
158cdf0e10cSrcweir     {
159cdf0e10cSrcweir         pStr = new String;
160cdf0e10cSrcweir         readByteString(rStream, *pStr);
161cdf0e10cSrcweir         pImp->aList.Insert( pStr, LIST_APPEND );
162cdf0e10cSrcweir     }
163cdf0e10cSrcweir }
164cdf0e10cSrcweir 
165cdf0e10cSrcweir //------------------------------------------------------------------------
166cdf0e10cSrcweir 
SfxStringListItem(const SfxStringListItem & rItem)167cdf0e10cSrcweir SfxStringListItem::SfxStringListItem( const SfxStringListItem& rItem ) :
168cdf0e10cSrcweir     SfxPoolItem( rItem ),
169cdf0e10cSrcweir     pImp(NULL)
170cdf0e10cSrcweir {
171cdf0e10cSrcweir     pImp = rItem.pImp;
172cdf0e10cSrcweir 
173cdf0e10cSrcweir     if( pImp )
174cdf0e10cSrcweir     {
175cdf0e10cSrcweir         DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
176cdf0e10cSrcweir         pImp->nRefCount++;
177cdf0e10cSrcweir     }
178cdf0e10cSrcweir }
179cdf0e10cSrcweir 
180cdf0e10cSrcweir //------------------------------------------------------------------------
181cdf0e10cSrcweir 
~SfxStringListItem()182cdf0e10cSrcweir SfxStringListItem::~SfxStringListItem()
183cdf0e10cSrcweir {
184cdf0e10cSrcweir     if( pImp )
185cdf0e10cSrcweir     {
186cdf0e10cSrcweir         DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
187cdf0e10cSrcweir         if( pImp->nRefCount > 1 )
188cdf0e10cSrcweir             pImp->nRefCount--;
189cdf0e10cSrcweir         else
190cdf0e10cSrcweir             delete pImp;
191cdf0e10cSrcweir     }
192cdf0e10cSrcweir }
193cdf0e10cSrcweir 
194cdf0e10cSrcweir //------------------------------------------------------------------------
195cdf0e10cSrcweir 
GetList()196cdf0e10cSrcweir List* SfxStringListItem::GetList()
197cdf0e10cSrcweir {
198cdf0e10cSrcweir     if( !pImp )
199cdf0e10cSrcweir         pImp = new SfxImpStringList;
200cdf0e10cSrcweir     DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
201cdf0e10cSrcweir     return &(pImp->aList);
202cdf0e10cSrcweir }
203cdf0e10cSrcweir 
204cdf0e10cSrcweir //------------------------------------------------------------------------
205cdf0e10cSrcweir 
operator ==(const SfxPoolItem & rItem) const206cdf0e10cSrcweir int SfxStringListItem::operator==( const SfxPoolItem& rItem ) const
207cdf0e10cSrcweir {
208cdf0e10cSrcweir     DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
209cdf0e10cSrcweir 
210cdf0e10cSrcweir     SfxStringListItem* pItem = (SfxStringListItem*)&rItem;
211cdf0e10cSrcweir 
212cdf0e10cSrcweir     if( pImp == pItem->pImp )
213cdf0e10cSrcweir         return sal_True;
214cdf0e10cSrcweir     else
215cdf0e10cSrcweir         return sal_False;
216cdf0e10cSrcweir }
217cdf0e10cSrcweir 
218cdf0e10cSrcweir //------------------------------------------------------------------------
219cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const220cdf0e10cSrcweir SfxItemPresentation SfxStringListItem::GetPresentation
221cdf0e10cSrcweir (
222cdf0e10cSrcweir     SfxItemPresentation     /*ePresentation*/,
223cdf0e10cSrcweir     SfxMapUnit              /*eCoreMetric*/,
224cdf0e10cSrcweir     SfxMapUnit              /*ePresentationMetric*/,
225cdf0e10cSrcweir     XubString&              rText,
226cdf0e10cSrcweir     const IntlWrapper *
227cdf0e10cSrcweir )   const
228cdf0e10cSrcweir {
229cdf0e10cSrcweir     rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("(List)"));
230cdf0e10cSrcweir     return SFX_ITEM_PRESENTATION_NONE;
231cdf0e10cSrcweir }
232cdf0e10cSrcweir 
233cdf0e10cSrcweir //------------------------------------------------------------------------
234cdf0e10cSrcweir 
Clone(SfxItemPool *) const235cdf0e10cSrcweir SfxPoolItem* SfxStringListItem::Clone( SfxItemPool *) const
236cdf0e10cSrcweir {
237cdf0e10cSrcweir     return new SfxStringListItem( *this );
238cdf0e10cSrcweir     /*
239cdf0e10cSrcweir     if( pImp )
240cdf0e10cSrcweir         return new SfxStringListItem( Which(), &(pImp->aList) );
241cdf0e10cSrcweir     else
242cdf0e10cSrcweir         return new SfxStringListItem( Which(), NULL );
243cdf0e10cSrcweir     */
244cdf0e10cSrcweir 
245cdf0e10cSrcweir }
246cdf0e10cSrcweir 
247cdf0e10cSrcweir //------------------------------------------------------------------------
248cdf0e10cSrcweir 
Create(SvStream & rStream,sal_uInt16) const249cdf0e10cSrcweir SfxPoolItem* SfxStringListItem::Create( SvStream & rStream, sal_uInt16 ) const
250cdf0e10cSrcweir {
251cdf0e10cSrcweir     return new SfxStringListItem( Which(), rStream );
252cdf0e10cSrcweir }
253cdf0e10cSrcweir 
254cdf0e10cSrcweir //------------------------------------------------------------------------
255cdf0e10cSrcweir 
Store(SvStream & rStream,sal_uInt16) const256cdf0e10cSrcweir SvStream& SfxStringListItem::Store( SvStream & rStream, sal_uInt16 ) const
257cdf0e10cSrcweir {
258cdf0e10cSrcweir     if( !pImp )
259cdf0e10cSrcweir     {
260cdf0e10cSrcweir         rStream << 0L;
261cdf0e10cSrcweir         return rStream;
262cdf0e10cSrcweir     }
263cdf0e10cSrcweir 
264cdf0e10cSrcweir     DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
265cdf0e10cSrcweir 
266cdf0e10cSrcweir     long nCount = pImp->aList.Count();
267cdf0e10cSrcweir     rStream << nCount;
268cdf0e10cSrcweir 
269cdf0e10cSrcweir     long i;
270cdf0e10cSrcweir     String* pStr;
271cdf0e10cSrcweir     for( i=0; i < nCount; i++ )
272cdf0e10cSrcweir     {
273cdf0e10cSrcweir         pStr = (String*)(pImp->aList.GetObject( i ));
274cdf0e10cSrcweir         writeByteString(rStream, *pStr);
275cdf0e10cSrcweir     }
276cdf0e10cSrcweir 
277cdf0e10cSrcweir     return rStream;
278cdf0e10cSrcweir }
279cdf0e10cSrcweir 
280cdf0e10cSrcweir //------------------------------------------------------------------------
281cdf0e10cSrcweir 
SetString(const XubString & rStr)282cdf0e10cSrcweir void SfxStringListItem::SetString( const XubString& rStr )
283cdf0e10cSrcweir {
284cdf0e10cSrcweir     DBG_ASSERT(GetRefCount()==0,"SetString:RefCount!=0");
285cdf0e10cSrcweir 
286cdf0e10cSrcweir     if ( pImp && (pImp->nRefCount == 1) )
287cdf0e10cSrcweir         delete pImp;
288cdf0e10cSrcweir     else
289cdf0e10cSrcweir     if( pImp )
290cdf0e10cSrcweir         pImp->nRefCount--;
291cdf0e10cSrcweir     pImp = new SfxImpStringList;
292cdf0e10cSrcweir 
293cdf0e10cSrcweir     xub_StrLen nStart = 0;
294cdf0e10cSrcweir     xub_StrLen nDelimPos;
295cdf0e10cSrcweir     XubString aStr(rStr);
296cdf0e10cSrcweir     aStr.ConvertLineEnd(LINEEND_CR);
297cdf0e10cSrcweir     do
298cdf0e10cSrcweir     {
299cdf0e10cSrcweir         nDelimPos = aStr.Search( _CR, nStart );
300cdf0e10cSrcweir         xub_StrLen nLen;
301cdf0e10cSrcweir         if ( nDelimPos == STRING_NOTFOUND )
302cdf0e10cSrcweir             nLen = 0xffff;
303cdf0e10cSrcweir         else
304cdf0e10cSrcweir             nLen = nDelimPos - nStart;
305cdf0e10cSrcweir 
306cdf0e10cSrcweir         XubString* pStr = new XubString(aStr.Copy(nStart, nLen));
307cdf0e10cSrcweir         // String gehoert der Liste
308cdf0e10cSrcweir         pImp->aList.Insert( pStr, LIST_APPEND );
309cdf0e10cSrcweir 
310cdf0e10cSrcweir         nStart += nLen + 1 ;    // delimiter ueberspringen
311cdf0e10cSrcweir     } while( nDelimPos != STRING_NOTFOUND );
312cdf0e10cSrcweir 
313cdf0e10cSrcweir     // Kein Leerstring am Ende
314cdf0e10cSrcweir     if( pImp->aList.Last() &&
315cdf0e10cSrcweir         !((XubString*)pImp->aList.Last())->Len() )
316cdf0e10cSrcweir         delete (XubString*)pImp->aList.Remove( pImp->aList.Count()-1 );
317cdf0e10cSrcweir }
318cdf0e10cSrcweir 
319cdf0e10cSrcweir //------------------------------------------------------------------------
320cdf0e10cSrcweir 
GetString()321cdf0e10cSrcweir XubString SfxStringListItem::GetString()
322cdf0e10cSrcweir {
323cdf0e10cSrcweir     XubString aStr;
324cdf0e10cSrcweir     if ( pImp )
325cdf0e10cSrcweir     {
326cdf0e10cSrcweir         DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
327cdf0e10cSrcweir         XubString* pStr = (XubString*)(pImp->aList.First());
328cdf0e10cSrcweir         while( pStr )
329cdf0e10cSrcweir         {
330cdf0e10cSrcweir             aStr += *pStr;
331cdf0e10cSrcweir             pStr = (XubString*)(pImp->aList.Next());
332cdf0e10cSrcweir             if ( pStr )
333cdf0e10cSrcweir                 aStr += '\r';
334cdf0e10cSrcweir         }
335cdf0e10cSrcweir     }
336cdf0e10cSrcweir     aStr.ConvertLineEnd();
337cdf0e10cSrcweir     return aStr;
338cdf0e10cSrcweir }
339cdf0e10cSrcweir 
340cdf0e10cSrcweir //------------------------------------------------------------------------
341cdf0e10cSrcweir 
342cdf0e10cSrcweir #ifndef TF_POOLABLE
343cdf0e10cSrcweir 
IsPoolable() const344cdf0e10cSrcweir int SfxStringListItem::IsPoolable() const
345cdf0e10cSrcweir {
346cdf0e10cSrcweir     return sal_False;
347cdf0e10cSrcweir }
348cdf0e10cSrcweir 
349cdf0e10cSrcweir #endif
350cdf0e10cSrcweir 
351cdf0e10cSrcweir //------------------------------------------------------------------------
352cdf0e10cSrcweir 
Sort(sal_Bool bAscending,List * pParallelList)353cdf0e10cSrcweir void SfxStringListItem::Sort( sal_Bool bAscending, List* pParallelList )
354cdf0e10cSrcweir {
355cdf0e10cSrcweir     DBG_ASSERT(GetRefCount()==0,"Sort:RefCount!=0");
356cdf0e10cSrcweir     if( pImp )
357cdf0e10cSrcweir         pImp->Sort( bAscending, pParallelList );
358cdf0e10cSrcweir }
359cdf0e10cSrcweir 
360cdf0e10cSrcweir //----------------------------------------------------------------------------
SetStringList(const com::sun::star::uno::Sequence<rtl::OUString> & rList)361cdf0e10cSrcweir void SfxStringListItem::SetStringList( const com::sun::star::uno::Sequence< rtl::OUString >& rList )
362cdf0e10cSrcweir {
363cdf0e10cSrcweir     DBG_ASSERT(GetRefCount()==0,"SetString:RefCount!=0");
364cdf0e10cSrcweir 
365cdf0e10cSrcweir     if ( pImp && (pImp->nRefCount == 1) )
366cdf0e10cSrcweir         delete pImp;
367cdf0e10cSrcweir     else
368cdf0e10cSrcweir     if( pImp )
369cdf0e10cSrcweir         pImp->nRefCount--;
370cdf0e10cSrcweir     pImp = new SfxImpStringList;
371cdf0e10cSrcweir 
372cdf0e10cSrcweir     for ( sal_Int32 n = 0; n < rList.getLength(); n++ )
373cdf0e10cSrcweir     {
374cdf0e10cSrcweir         XubString* pStr = new XubString( rList[n] );
375cdf0e10cSrcweir         // String gehoert der Liste
376cdf0e10cSrcweir         pImp->aList.Insert( pStr, LIST_APPEND );
377cdf0e10cSrcweir     }
378cdf0e10cSrcweir }
379cdf0e10cSrcweir 
380cdf0e10cSrcweir //----------------------------------------------------------------------------
GetStringList(com::sun::star::uno::Sequence<rtl::OUString> & rList) const381cdf0e10cSrcweir void SfxStringListItem::GetStringList( com::sun::star::uno::Sequence< rtl::OUString >& rList ) const
382cdf0e10cSrcweir {
383cdf0e10cSrcweir     long nCount = pImp->aList.Count();
384cdf0e10cSrcweir 
385cdf0e10cSrcweir     rList.realloc( nCount );
386cdf0e10cSrcweir     for( long i=0; i < nCount; i++ )
387cdf0e10cSrcweir         rList[i] = *(String*)(pImp->aList.GetObject( i ));
388cdf0e10cSrcweir }
389cdf0e10cSrcweir 
390cdf0e10cSrcweir //----------------------------------------------------------------------------
391cdf0e10cSrcweir // virtual
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)392cdf0e10cSrcweir sal_Bool SfxStringListItem::PutValue( const com::sun::star::uno::Any& rVal,sal_uInt8 )
393cdf0e10cSrcweir {
394cdf0e10cSrcweir     com::sun::star::uno::Sequence< rtl::OUString > aValue;
395cdf0e10cSrcweir     if ( rVal >>= aValue )
396cdf0e10cSrcweir     {
397cdf0e10cSrcweir         SetStringList( aValue );
398cdf0e10cSrcweir         return sal_True;
399cdf0e10cSrcweir     }
400cdf0e10cSrcweir 
401cdf0e10cSrcweir     DBG_ERROR( "SfxStringListItem::PutValue - Wrong type!" );
402cdf0e10cSrcweir     return sal_False;
403cdf0e10cSrcweir }
404cdf0e10cSrcweir 
405cdf0e10cSrcweir //----------------------------------------------------------------------------
406cdf0e10cSrcweir // virtual
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const407cdf0e10cSrcweir sal_Bool SfxStringListItem::QueryValue( com::sun::star::uno::Any& rVal,sal_uInt8 ) const
408cdf0e10cSrcweir {
409cdf0e10cSrcweir     // GetString() is not const!!!
410cdf0e10cSrcweir     SfxStringListItem* pThis = const_cast< SfxStringListItem * >( this );
411cdf0e10cSrcweir 
412cdf0e10cSrcweir     com::sun::star::uno::Sequence< rtl::OUString > aStringList;
413cdf0e10cSrcweir     pThis->GetStringList( aStringList );
414cdf0e10cSrcweir     rVal = ::com::sun::star::uno::makeAny( aStringList );
415cdf0e10cSrcweir     return sal_True;
416cdf0e10cSrcweir }
417