merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / ui / misc / stringlistitem.cxx
blobdb02fad29303353920b89bbb36f8c7879407c74d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: stringlistitem.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #ifndef _DBAUI_STRINGLISTITEM_HXX_
35 #include "stringlistitem.hxx"
36 #endif
38 //.........................................................................
39 namespace dbaui
41 //.........................................................................
43 using namespace ::com::sun::star::uno;
45 //=========================================================================
46 //= OStringListItem
47 //=========================================================================
48 TYPEINIT1(OStringListItem, SfxPoolItem);
49 //-------------------------------------------------------------------------
50 OStringListItem::OStringListItem(sal_Int16 _nWhich, const Sequence< ::rtl::OUString >& _rList)
51 :SfxPoolItem(_nWhich)
52 ,m_aList(_rList)
56 //-------------------------------------------------------------------------
57 OStringListItem::OStringListItem(const OStringListItem& _rSource)
58 :SfxPoolItem(_rSource)
59 ,m_aList(_rSource.m_aList)
63 //-------------------------------------------------------------------------
64 int OStringListItem::operator==(const SfxPoolItem& _rItem) const
66 const OStringListItem* pCompare = PTR_CAST(OStringListItem, &_rItem);
67 if ((!pCompare) || (pCompare->m_aList.getLength() != m_aList.getLength()))
68 return 0;
70 // compare all strings individually
71 const ::rtl::OUString* pMyStrings = m_aList.getConstArray();
72 const ::rtl::OUString* pCompareStrings = pCompare->m_aList.getConstArray();
74 for (sal_Int32 i=0; i<m_aList.getLength(); ++i, ++pMyStrings, ++pCompareStrings)
75 if (!pMyStrings->equals(*pCompareStrings))
76 return 0;
78 return 1;
81 //-------------------------------------------------------------------------
82 SfxPoolItem* OStringListItem::Clone(SfxItemPool* /* _pPool */) const
84 return new OStringListItem(*this);
87 //.........................................................................
88 } // namespace dbaui
89 //.........................................................................