LibreOffice Module svx (master)  1
xit.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_SVX_XIT_HXX
21 #define INCLUDED_SVX_XIT_HXX
22 
23 #include <svl/stritem.hxx>
24 #include <svx/xtable.hxx>
25 #include <svx/svxdllapi.h>
26 #include <unotools/resmgr.hxx>
27 
28 /************************************************************************/
29 
30 class SfxItemPool;
31 class NameOrIndex;
32 
33 typedef bool (*SvxCompareValueFunc)( const NameOrIndex* p1, const NameOrIndex* p2 );
34 
35 
36 
38 {
39  sal_Int32 nPalIndex;
40 
41 protected:
42  void Detach() { nPalIndex = -1; }
43 
44 public:
45  NameOrIndex() { nPalIndex = -1; }
46  NameOrIndex(sal_uInt16 nWhich, sal_Int32 nIndex);
47  NameOrIndex(sal_uInt16 nWhich, const OUString& rName);
48  NameOrIndex(const NameOrIndex& rNameOrIndex);
49 
50  virtual bool operator==(const SfxPoolItem& rItem) const override;
51  virtual NameOrIndex* Clone(SfxItemPool* pPool = nullptr) const override;
52 
53  OUString const & GetName() const { return GetValue(); }
54  void SetName(const OUString& rName) { SetValue(rName); }
55  bool IsIndex() const { return (nPalIndex >= 0); }
56  sal_Int32 GetPalIndex() const { return nPalIndex; }
57 
63  static OUString CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, SvxCompareValueFunc pCompareValueFunc, TranslateId pPrefixResId, const XPropertyListRef &pDefaults );
64 
65  void dumpAsXml(xmlTextWriterPtr pWriter) const override;
66 };
67 
68 #endif
69 
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _xmlTextWriter * xmlTextWriterPtr
virtual bool operator==(const SfxPoolItem &rItem) const override
bool(* SvxCompareValueFunc)(const NameOrIndex *p1, const NameOrIndex *p2)
Definition: xit.hxx:33
void dumpAsXml(xmlTextWriterPtr pWriter) const override
sal_Int32 nPalIndex
Definition: xit.hxx:39
void SetValue(const OUString &rTheValue)
sal_Int32 GetPalIndex() const
Definition: xit.hxx:56
virtual SfxStringItem * Clone(SfxItemPool *=nullptr) const override
void Detach()
Definition: xit.hxx:42
const OUString & GetValue() const
bool IsIndex() const
Definition: xit.hxx:55
void SetName(const OUString &rName)
Definition: xit.hxx:54
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
NameOrIndex()
Definition: xit.hxx:45
OUString const & GetName() const
Definition: xit.hxx:53