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 
31 class SAL_DLLPUBLIC_RTTI SwDropDownFieldType final : public SwFieldType
32 {
33 public:
38 
42  virtual ~SwDropDownFieldType() override;
43 
49  virtual std::unique_ptr<SwFieldType> Copy () const override;
50 };
51 
58 class SW_DLLPUBLIC SwDropDownField final : public SwField
59 {
63  std::vector<OUString> aValues;
64 
68  OUString aSelectedItem;
69 
73  OUString aName;
74 
78  OUString aHelp;
79 
83  OUString aToolTip;
84 
93  virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
94 
100  virtual std::unique_ptr<SwField> Copy() const override;
101 
102 public:
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(const 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 aSelectedItem;}
185 
191  const OUString& GetName() const { return aName;}
192 
198  const OUString& GetHelp() const { return aHelp;}
199 
205  const OUString& GetToolTip() const { return 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: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:234
OUString aName
the name of the field
Definition: flddropdown.hxx:73
virtual std::unique_ptr< SwFieldType > Copy() const =0
Base class of all fields.
Definition: fldbas.hxx:280
const OUString & GetHelp() const
Returns the help text of the field.
const OUString & GetName() const
Returns the name of the field.
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
virtual OUString GetPar1() const
Definition: fldbas.cxx:263
OUString aSelectedItem
the selected item
Definition: flddropdown.hxx:68
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const =0
virtual void SetPar2(const OUString &rStr)
Definition: fldbas.cxx:281
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId)
Definition: fldbas.cxx:306
const OUString & GetSelectedItem() const
Returns the selected item.
Field type for dropdown boxes.
Definition: flddropdown.hxx:31
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const
Definition: fldbas.cxx:293
std::vector< OUString > aValues
the possible values (aka items) of the dropdown box
Definition: flddropdown.hxx:63
virtual void SetPar1(const OUString &rStr)
Definition: fldbas.cxx:278
virtual std::unique_ptr< SwField > Copy() const =0
const OUString & GetToolTip() const
Returns the tool tip of the field.
virtual OUString GetPar2() const
Definition: fldbas.cxx:268
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
OUString aHelp
help text
Definition: flddropdown.hxx:78
OUString aToolTip
tool tip string
Definition: flddropdown.hxx:83
Dropdown field.
Definition: flddropdown.hxx:58