LibreOffice Module sw (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SwDropDownField Class Referencefinal

Dropdown field. More...

#include <flddropdown.hxx>

Inheritance diagram for SwDropDownField:
[legend]
Collaboration diagram for SwDropDownField:
[legend]

Public Member Functions

 SwDropDownField (SwFieldType *pTyp)
 Constructor. More...
 
 SwDropDownField (const SwDropDownField &rSrc)
 Copy constructor. More...
 
virtual ~SwDropDownField () override
 Destructor. More...
 
virtual OUString GetPar1 () const override
 Returns the selected value. More...
 
virtual OUString GetPar2 () const override
 Returns the name of the field. More...
 
virtual void SetPar1 (const OUString &rStr) override
 Sets the selected value. More...
 
virtual void SetPar2 (const OUString &rStr) override
 Sets the name of the field. More...
 
void SetItems (std::vector< OUString > &&rItems)
 Sets the items of the dropdown box. More...
 
void SetItems (const css::uno::Sequence< OUString > &rItems)
 Sets the items of the dropdown box. More...
 
css::uno::Sequence< OUString > GetItemSequence () const
 Returns the items of the dropdown box. More...
 
const OUString & GetSelectedItem () const
 Returns the selected item. More...
 
const OUString & GetName () const
 Returns the name of the field. More...
 
const OUString & GetHelp () const
 Returns the help text of the field. More...
 
const OUString & GetToolTip () const
 Returns the tool tip of the field. More...
 
void SetSelectedItem (const OUString &rItem)
 Sets the selected item. More...
 
void SetName (const OUString &rName)
 Sets the name of the field. More...
 
void SetHelp (const OUString &rHelp)
 Sets the help text of the field. More...
 
void SetToolTip (const OUString &rToolTip)
 Sets the tool tip of the field. More...
 
virtual bool QueryValue (css::uno::Any &rVal, sal_uInt16 nWhichId) const override
 API: Gets a property value from the dropdown field. More...
 
virtual bool PutValue (const css::uno::Any &rVal, sal_uInt16 nWhichId) override
 API: Sets a property value on the dropdown field. More...
 
- Public Member Functions inherited from SwField
virtual ~SwField ()
 
 SwField (SwField const &)=default
 
 SwField (SwField &&)=default
 
SwFieldoperator= (SwField const &)=default
 
SwFieldoperator= (SwField &&)=default
 
SwFieldTypeGetTyp () const
 
virtual SwFieldTypeChgTyp (SwFieldType *)
 Set new type (used for copying among documents). More...
 
OUString ExpandField (bool bCached, SwRootFrame const *pLayout) const
 expand the field. More...
 
virtual OUString GetFieldName () const
 get name or content More...
 
std::unique_ptr< SwFieldCopyField () const
 
SwFieldIds Which () const
 ResId. More...
 
SwFieldTypesEnum GetTypeId () const
 
virtual sal_uInt16 GetSubType () const
 
virtual void SetSubType (sal_uInt16)
 
LanguageType GetLanguage () const
 Language at field position. More...
 
virtual void SetLanguage (LanguageType nLng)
 
sal_uInt32 GetFormat () const
 Query parameters for dialog and for BASIC. More...
 
virtual OUString GetPar1 () const
 
virtual OUString GetPar2 () const
 
virtual OUString GetFormula () const
 
void ChangeFormat (sal_uInt32 n)
 
virtual void SetPar1 (const OUString &rStr)
 
virtual void SetPar2 (const OUString &rStr)
 
virtual bool QueryValue (css::uno::Any &rVal, sal_uInt16 nWhichId) const
 
virtual bool PutValue (const css::uno::Any &rVal, sal_uInt16 nWhichId)
 
bool HasClickHdl () const
 Does the field possess an action on its ClickHandler? (e.g. INetFields, ...). More...
 
bool IsFixed () const
 
bool IsAutomaticLanguage () const
 
void SetAutomaticLanguage (bool const bSet)
 
virtual OUString GetDescription () const
 
bool IsClickable () const
 Is this field clickable? More...
 
virtual void dumpAsXml (xmlTextWriterPtr pWriter) const
 
const OUString & GetTitle () const
 
void SetTitle (const OUString &rTitle)
 

Private Member Functions

virtual OUString ExpandImpl (SwRootFrame const *pLayout) const override
 Expands the field. More...
 
virtual std::unique_ptr< SwFieldCopy () const override
 Creates a copy of this field. More...
 

Private Attributes

std::vector< OUString > m_aValues
 the possible values (aka items) of the dropdown box More...
 
OUString m_aSelectedItem
 the selected item More...
 
OUString m_aName
 the name of the field More...
 
OUString m_aHelp
 help text More...
 
OUString m_aToolTip
 tool tip string More...
 

Additional Inherited Members

- Protected Member Functions inherited from SwField
void SetFormat (sal_uInt32 const nSet)
 
 SwField (SwFieldType *pTyp, sal_uInt32 nFormat=0, LanguageType nLang=LANGUAGE_SYSTEM, bool m_bUseFieldValueCache=true)
 

Detailed Description

Dropdown field.

The dropdown field contains a list of strings. At most one of them can be selected.

Definition at line 58 of file flddropdown.hxx.

Constructor & Destructor Documentation

◆ SwDropDownField() [1/2]

SwDropDownField::SwDropDownField ( SwFieldType pTyp)

Constructor.

Parameters
pTypfield type for this field

Definition at line 47 of file flddropdown.cxx.

References LANGUAGE_SYSTEM.

◆ SwDropDownField() [2/2]

SwDropDownField::SwDropDownField ( const SwDropDownField rSrc)

Copy constructor.

Parameters
rSrcdropdown field to copy

Definition at line 52 of file flddropdown.cxx.

References GetFormat(), m_aName, and m_aValues.

◆ ~SwDropDownField()

SwDropDownField::~SwDropDownField ( )
overridevirtual

Destructor.

Definition at line 59 of file flddropdown.cxx.

Member Function Documentation

◆ Copy()

std::unique_ptr< SwField > SwDropDownField::Copy ( ) const
overrideprivatevirtual

Creates a copy of this field.

Returns
the copy of this field

Implements SwField.

Definition at line 78 of file flddropdown.cxx.

◆ ExpandImpl()

OUString SwDropDownField::ExpandImpl ( SwRootFrame const *  pLayout) const
overrideprivatevirtual

Expands the field.

The expanded value of the field is the value of the selected item. If no item is selected, an empty string is returned.

Returns
the expanded value of the field

Implements SwField.

Definition at line 63 of file flddropdown.cxx.

References GetSelectedItem(), and m_aValues.

◆ GetHelp()

const OUString & SwDropDownField::GetHelp ( ) const
inline

Returns the help text of the field.

Returns
the help text of the field

Definition at line 198 of file flddropdown.hxx.

Referenced by WW8AttributeOutput::DropdownField().

◆ GetItemSequence()

uno::Sequence< OUString > SwDropDownField::GetItemSequence ( ) const

◆ GetName()

const OUString & SwDropDownField::GetName ( ) const
inline

Returns the name of the field.

Returns
the name of the field

Definition at line 191 of file flddropdown.hxx.

References m_aName.

Referenced by WW8AttributeOutput::DropdownField(), GetPar2(), DocxAttributeOutput::StartField_Impl(), and DocxAttributeOutput::WriteField_Impl().

◆ GetPar1()

OUString SwDropDownField::GetPar1 ( ) const
overridevirtual

Returns the selected value.

See also
Expand
Returns
the selected value

Reimplemented from SwField.

Definition at line 83 of file flddropdown.cxx.

References GetSelectedItem().

◆ GetPar2()

OUString SwDropDownField::GetPar2 ( ) const
overridevirtual

Returns the name of the field.

Returns
the name of the field

Reimplemented from SwField.

Definition at line 88 of file flddropdown.cxx.

References GetName().

Referenced by sw::DropDownFieldDialog::DropDownFieldDialog(), and IMPL_LINK_NOARG().

◆ GetSelectedItem()

const OUString & SwDropDownField::GetSelectedItem ( ) const
inline

◆ GetToolTip()

const OUString & SwDropDownField::GetToolTip ( ) const
inline

Returns the tool tip of the field.

Returns
the tool tip of the field

Definition at line 205 of file flddropdown.hxx.

Referenced by WW8AttributeOutput::DropdownField().

◆ PutValue()

bool SwDropDownField::PutValue ( const css::uno::Any &  rVal,
sal_uInt16  nWhichId 
)
overridevirtual

API: Sets a property value on the dropdown field.

Parameters
rValvalue to set
nMId
  • FIELD_PROP_PAR1 Set selected item (String)
  • FIELD_PROP_STRINGS Set all items (Sequence)
  • FIELD_PROP_PAR3 Set the help text of the field.
  • FIELD_PROP_PAR4 Set the tool tip of the field.

Reimplemented from SwField.

Definition at line 177 of file flddropdown.cxx.

References aSeq, FIELD_PROP_PAR1, FIELD_PROP_PAR2, FIELD_PROP_PAR3, FIELD_PROP_PAR4, FIELD_PROP_STRINGS, m_aHelp, m_aName, m_aToolTip, SetItems(), and SetSelectedItem().

◆ QueryValue()

bool SwDropDownField::QueryValue ( css::uno::Any &  rVal,
sal_uInt16  nWhichId 
) const
overridevirtual

API: Gets a property value from the dropdown field.

Parameters
rValreturn value
nMId
  • FIELD_PROP_PAR1 Get selected item (String)
  • FIELD_PROP_STRINGS Get all items (Sequence)
  • FIELD_PROP_PAR3 Get the help text of the field.
  • FIELD_PROP_PAR4 Get the tool tip of the field.

Reimplemented from SwField.

Definition at line 150 of file flddropdown.cxx.

References FIELD_PROP_PAR1, FIELD_PROP_PAR2, FIELD_PROP_PAR3, FIELD_PROP_PAR4, FIELD_PROP_STRINGS, GetItemSequence(), m_aHelp, m_aName, m_aSelectedItem, and m_aToolTip.

◆ SetHelp()

void SwDropDownField::SetHelp ( const OUString &  rHelp)

Sets the help text of the field.

Parameters
rHelpthe help text

Definition at line 140 of file flddropdown.cxx.

References m_aHelp.

Referenced by SwXTextField::attach(), and SwWW8ImplReader::Read_F_FormListBox().

◆ SetItems() [1/2]

void SwDropDownField::SetItems ( const css::uno::Sequence< OUString > &  rItems)

Sets the items of the dropdown box.

After setting the items the selection will be empty.

Parameters
rItemsthe new items

◆ SetItems() [2/2]

void SwDropDownField::SetItems ( std::vector< OUString > &&  rItems)

Sets the items of the dropdown box.

After setting the items the selection will be empty.

Parameters
rItemsthe new items

Referenced by SwXTextField::attach(), PutValue(), and SwWW8ImplReader::Read_F_FormListBox().

◆ SetName()

void SwDropDownField::SetName ( const OUString &  rName)

Sets the name of the field.

Parameters
rNamethe new name of the field

Definition at line 135 of file flddropdown.cxx.

References m_aName.

Referenced by SwXTextField::attach(), SwWW8ImplReader::Read_F_FormListBox(), and SetPar2().

◆ SetPar1()

void SwDropDownField::SetPar1 ( const OUString &  rStr)
overridevirtual

Sets the selected value.

If rStr is an item of the field that item will be selected. Otherwise no item will be selected, i.e. the resulting selection will be empty.

Reimplemented from SwField.

Definition at line 93 of file flddropdown.cxx.

References SetSelectedItem().

◆ SetPar2()

void SwDropDownField::SetPar2 ( const OUString &  rStr)
overridevirtual

Sets the name of the field.

Parameters
rStrthe new name of the field

Reimplemented from SwField.

Definition at line 98 of file flddropdown.cxx.

References SetName().

◆ SetSelectedItem()

void SwDropDownField::SetSelectedItem ( const OUString &  rItem)

Sets the selected item.

If rItem is found in this dropdown field it is selected. If rItem is not found the selection will be empty.

Parameters
rItemthe item to be set

Definition at line 124 of file flddropdown.cxx.

References m_aSelectedItem, and m_aValues.

Referenced by SwXTextField::attach(), PutValue(), SwWW8ImplReader::Read_F_FormListBox(), and SetPar1().

◆ SetToolTip()

void SwDropDownField::SetToolTip ( const OUString &  rToolTip)

Sets the tool tip of the field.

Parameters
rToolTipthe tool tip

Definition at line 145 of file flddropdown.cxx.

References m_aToolTip.

Referenced by SwXTextField::attach(), and SwWW8ImplReader::Read_F_FormListBox().

Member Data Documentation

◆ m_aHelp

OUString SwDropDownField::m_aHelp
private

help text

Definition at line 78 of file flddropdown.hxx.

Referenced by PutValue(), QueryValue(), and SetHelp().

◆ m_aName

OUString SwDropDownField::m_aName
private

the name of the field

Definition at line 73 of file flddropdown.hxx.

Referenced by PutValue(), QueryValue(), and SetName().

◆ m_aSelectedItem

OUString SwDropDownField::m_aSelectedItem
private

the selected item

Definition at line 68 of file flddropdown.hxx.

Referenced by QueryValue(), and SetSelectedItem().

◆ m_aToolTip

OUString SwDropDownField::m_aToolTip
private

tool tip string

Definition at line 83 of file flddropdown.hxx.

Referenced by PutValue(), QueryValue(), and SetToolTip().

◆ m_aValues

std::vector<OUString> SwDropDownField::m_aValues
private

the possible values (aka items) of the dropdown box

Definition at line 63 of file flddropdown.hxx.

Referenced by ExpandImpl(), GetItemSequence(), and SetSelectedItem().


The documentation for this class was generated from the following files: