tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / include / svx / xit.hxx
blob67f4a7433349c1fd139e337fa7f0a852f15dca8b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_XIT_HXX
21 #define INCLUDED_SVX_XIT_HXX
23 #include <svl/stritem.hxx>
24 #include <svx/xtable.hxx>
25 #include <svx/svxdllapi.h>
26 #include <unotools/resmgr.hxx>
28 /************************************************************************/
30 class SfxItemPool;
31 class NameOrIndex;
33 typedef bool (*SvxCompareValueFunc)( const NameOrIndex* p1, const NameOrIndex* p2 );
37 class SVXCORE_DLLPUBLIC NameOrIndex : public SfxStringItem
39 sal_Int32 m_nPalIndex;
41 protected:
42 void Detach() { m_nPalIndex = -1; }
44 public:
45 NameOrIndex(SfxItemType eItemType) : SfxStringItem(0, eItemType) { m_nPalIndex = -1; }
46 NameOrIndex(TypedWhichId<NameOrIndex> nWhich, sal_Int32 nIndex, SfxItemType eItemType);
47 NameOrIndex(TypedWhichId<NameOrIndex> nWhich, const OUString& rName, SfxItemType eItemType);
48 NameOrIndex(const NameOrIndex& rNameOrIndex);
50 virtual bool operator==(const SfxPoolItem& rItem) const override;
51 virtual NameOrIndex* Clone(SfxItemPool* pPool = nullptr) const override;
52 // Marked as false since the SfxStringItem superclass supports hashing, but
53 // this class has not been checked for safety under hashing yet.
54 virtual bool supportsHashCode() const override { return false; }
56 OUString const & GetName() const { return GetValue(); }
57 void SetName(const OUString& rName) { SetValue(rName); }
58 bool IsIndex() const { return (m_nPalIndex >= 0); }
59 sal_Int32 GetPalIndex() const { return m_nPalIndex; }
61 /** this checks if the given NameOrIndex item has a unique name for its value.
62 The returned String is a unique name for an item with this value in both given pools.
63 If returned string equals NameOrIndex->GetName(), the name was already unique.
65 OUString CheckNamedItem(const sal_uInt16 nWhich, const SfxItemPool* pPool1, SvxCompareValueFunc pCompareValueFunc, TranslateId pPrefixResId, const XPropertyListRef &pDefaults) const;
67 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
70 #endif
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */