Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "stringlistitem.hxx"
21 :
22 : namespace dbaui
23 : {
24 :
25 : using namespace ::com::sun::star::uno;
26 :
27 : // OStringListItem
28 0 : TYPEINIT1(OStringListItem, SfxPoolItem);
29 0 : OStringListItem::OStringListItem(sal_Int16 _nWhich, const Sequence< OUString >& _rList)
30 : :SfxPoolItem(_nWhich)
31 0 : ,m_aList(_rList)
32 : {
33 0 : }
34 :
35 0 : OStringListItem::OStringListItem(const OStringListItem& _rSource)
36 : :SfxPoolItem(_rSource)
37 0 : ,m_aList(_rSource.m_aList)
38 : {
39 0 : }
40 :
41 0 : bool OStringListItem::operator==(const SfxPoolItem& _rItem) const
42 : {
43 0 : const OStringListItem* pCompare = PTR_CAST(OStringListItem, &_rItem);
44 0 : if ((!pCompare) || (pCompare->m_aList.getLength() != m_aList.getLength()))
45 0 : return false;
46 :
47 : // compare all strings individually
48 0 : const OUString* pMyStrings = m_aList.getConstArray();
49 0 : const OUString* pCompareStrings = pCompare->m_aList.getConstArray();
50 :
51 0 : for (sal_Int32 i=0; i<m_aList.getLength(); ++i, ++pMyStrings, ++pCompareStrings)
52 0 : if (!pMyStrings->equals(*pCompareStrings))
53 0 : return false;
54 :
55 0 : return true;
56 : }
57 :
58 0 : SfxPoolItem* OStringListItem::Clone(SfxItemPool* /* _pPool */) const
59 : {
60 0 : return new OStringListItem(*this);
61 : }
62 :
63 : } // namespace dbaui
64 :
65 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|