LibreOffice Module sw (master) 1
flddropdown.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#ifndef INCLUDED_SW_INC_FLDDROPDOWN_HXX
20#define INCLUDED_SW_INC_FLDDROPDOWN_HXX
21
22#include <com/sun/star/uno/Sequence.h>
23#include "swdllapi.h"
24#include "fldbas.hxx"
25
26#include <vector>
27
31class SAL_DLLPUBLIC_RTTI SwDropDownFieldType final : public SwFieldType
32{
33public:
38
42 virtual ~SwDropDownFieldType() override;
43
49 virtual std::unique_ptr<SwFieldType> Copy() const override;
50};
51
59{
63 std::vector<OUString> m_aValues;
64
69
73 OUString m_aName;
74
78 OUString m_aHelp;
79
83 OUString m_aToolTip;
84
93 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
94
100 virtual std::unique_ptr<SwField> Copy() const override;
101
102public:
109
115 SwDropDownField(const SwDropDownField& rSrc);
116
120 virtual ~SwDropDownField() override;
121
129 virtual OUString GetPar1() const override;
130
136 virtual OUString GetPar2() const override;
137
145 virtual void SetPar1(const OUString& rStr) override;
146
152 virtual void SetPar2(const OUString& rStr) override;
153
161 void SetItems(std::vector<OUString>&& rItems);
162
170 void SetItems(const css::uno::Sequence<OUString>& rItems);
171
177 css::uno::Sequence<OUString> GetItemSequence() const;
178
184 const OUString& GetSelectedItem() const { return m_aSelectedItem; }
185
191 const OUString& GetName() const { return m_aName; }
192
198 const OUString& GetHelp() const { return m_aHelp; }
199
205 const OUString& GetToolTip() const { return m_aToolTip; }
206
215 void SetSelectedItem(const OUString& rItem);
216
222 void SetName(const OUString& rName);
223
229 void SetHelp(const OUString& rHelp);
230
236 void SetToolTip(const OUString& rToolTip);
237
248 virtual bool QueryValue(css::uno::Any& rVal, sal_uInt16 nWhichId) const override;
249
260 virtual bool PutValue(const css::uno::Any& rVal, sal_uInt16 nWhichId) override;
261};
262
263#endif
264
265/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Field type for dropdown boxes.
Definition: flddropdown.hxx:32
Dropdown field.
Definition: flddropdown.hxx:59
void SetItems(const css::uno::Sequence< OUString > &rItems)
Sets the items of the dropdown box.
const OUString & GetHelp() const
Returns the help text of the field.
void SetItems(std::vector< OUString > &&rItems)
Sets the items of the dropdown box.
OUString m_aName
the name of the field
Definition: flddropdown.hxx:73
OUString m_aHelp
help text
Definition: flddropdown.hxx:78
OUString m_aSelectedItem
the selected item
Definition: flddropdown.hxx:68
const OUString & GetName() const
Returns the name of the field.
const OUString & GetToolTip() const
Returns the tool tip of the field.
const OUString & GetSelectedItem() const
Returns the selected item.
OUString m_aToolTip
tool tip string
Definition: flddropdown.hxx:83
std::vector< OUString > m_aValues
the possible values (aka items) of the dropdown box
Definition: flddropdown.hxx:63
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:242
virtual std::unique_ptr< SwFieldType > Copy() const =0
Base class of all fields.
Definition: fldbas.hxx:292
virtual OUString GetPar1() const
Definition: fldbas.cxx:321
virtual void SetPar1(const OUString &rStr)
Definition: fldbas.cxx:336
virtual void SetPar2(const OUString &rStr)
Definition: fldbas.cxx:339
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const =0
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const
Definition: fldbas.cxx:351
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId)
Definition: fldbas.cxx:369
virtual std::unique_ptr< SwField > Copy() const =0
virtual OUString GetPar2() const
Definition: fldbas.cxx:326
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
OUString m_aName
#define SW_DLLPUBLIC
Definition: swdllapi.h:28