LCOV - code coverage report
Current view: top level - sw/inc - flddropdown.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 4 0.0 %
Date: 2014-11-03 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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.hxx>
      23             : #include "swdllapi.h"
      24             : #include "fldbas.hxx"
      25             : 
      26             : #include <vector>
      27             : 
      28             : /**
      29             :     Field type for dropdown boxes.
      30             : */
      31             : class SwDropDownFieldType : public SwFieldType
      32             : {
      33             : public:
      34             :     /**
      35             :        Constructor
      36             :     */
      37             :     SwDropDownFieldType();
      38             : 
      39             :     /**
      40             :        Destructor
      41             :     */
      42             :     virtual ~SwDropDownFieldType();
      43             : 
      44             :     /**
      45             :        Create a copy of this field type.
      46             : 
      47             :        @return a copy of this type
      48             :     */
      49             :     virtual SwFieldType * Copy () const SAL_OVERRIDE;
      50             : };
      51             : 
      52             : /**
      53             :    Dropdown field.
      54             : 
      55             :    The dropdown field contains a list of strings. At most one of them
      56             :    can be selected.
      57             : */
      58             : class SW_DLLPUBLIC SwDropDownField : public SwField
      59             : {
      60             :     /**
      61             :        the possible values (aka items) of the dropdown box
      62             :     */
      63             :     std::vector<OUString> aValues;
      64             : 
      65             :     /**
      66             :       the selected item
      67             :     */
      68             :     OUString aSelectedItem;
      69             : 
      70             :     /**
      71             :       the name of the field
      72             :     */
      73             :     OUString aName;
      74             : 
      75             :     /**
      76             :        help text
      77             :      */
      78             :     OUString aHelp;
      79             : 
      80             :     /**
      81             :        tool tip string
      82             :      */
      83             :     OUString aToolTip;
      84             : 
      85             :     /**
      86             :        Expands the field.
      87             : 
      88             :        The expanded value of the field is the value of the selected
      89             :        item. If no item is selected, an empty string is returned.
      90             : 
      91             :        @return the expanded value of the field
      92             :     */
      93             :     virtual OUString Expand() const SAL_OVERRIDE;
      94             : 
      95             :     /**
      96             :        Creates a copy of this field.
      97             : 
      98             :        @return the copy of this field
      99             :     */
     100             :     virtual SwField * Copy() const SAL_OVERRIDE;
     101             : 
     102             : public:
     103             :     /**
     104             :        Constructor
     105             : 
     106             :        @param pTyp field type for this field
     107             :     */
     108             :     SwDropDownField(SwFieldType * pTyp);
     109             : 
     110             :     /**
     111             :        Copy constructor
     112             : 
     113             :        @param rSrc dropdown field to copy
     114             :     */
     115             :     SwDropDownField(const SwDropDownField & rSrc);
     116             : 
     117             :     /**
     118             :        Destructor
     119             :     */
     120             :     virtual ~SwDropDownField();
     121             : 
     122             :     /**
     123             :        Returns the selected value.
     124             : 
     125             :        @see Expand
     126             : 
     127             :        @return the selected value
     128             :     */
     129             :     virtual OUString GetPar1() const SAL_OVERRIDE;
     130             : 
     131             :     /**
     132             :        Returns the name of the field.
     133             : 
     134             :        @return the name of the field
     135             :     */
     136             :     virtual OUString GetPar2() const SAL_OVERRIDE;
     137             : 
     138             :     /**
     139             :        Sets the selected value.
     140             : 
     141             :        If rStr is an item of the field that item will be
     142             :        selected. Otherwise no item will be selected, i.e. the
     143             :        resulting selection will be empty.
     144             :     */
     145             :     virtual void SetPar1(const OUString & rStr) SAL_OVERRIDE;
     146             : 
     147             :     /**
     148             :        Sets the name of the field.
     149             : 
     150             :        @param rStr the new name of the field
     151             :     */
     152             :     virtual void SetPar2(const OUString & rStr) SAL_OVERRIDE;
     153             : 
     154             :     /**
     155             :        Sets the items of the dropdown box.
     156             : 
     157             :        After setting the items the selection will be empty.
     158             : 
     159             :        @param rItems the new items
     160             :     */
     161             :     void SetItems(const std::vector<OUString> & rItems);
     162             : 
     163             :     /**
     164             :        Sets the items of the dropdown box.
     165             : 
     166             :        After setting the items the selection will be empty.
     167             : 
     168             :        @param rItems the new items
     169             :     */
     170             :     void SetItems(const com::sun::star::uno::Sequence<OUString> & rItems);
     171             : 
     172             :     /**
     173             :         Returns the items of the dropdown box.
     174             : 
     175             :         @return the items of the dropdown box
     176             :     */
     177             :     com::sun::star::uno::Sequence<OUString> GetItemSequence() const;
     178             : 
     179             :     /**
     180             :        Returns the selected item.
     181             : 
     182             :        @return the selected item
     183             :     */
     184           0 :     const OUString& GetSelectedItem() const { return aSelectedItem;}
     185             : 
     186             :     /**
     187             :        Returns the name of the field.
     188             : 
     189             :        @return the name of the field
     190             :     */
     191           0 :     const OUString& GetName() const { return aName;}
     192             : 
     193             :     /**
     194             :        Returns the help text of the field.
     195             : 
     196             :        @return the help text of the field
     197             :     */
     198           0 :     const OUString& GetHelp() const { return aHelp;}
     199             : 
     200             :     /**
     201             :        Returns the tool tip of the field.
     202             : 
     203             :        @return the tool tip of the field
     204             :      */
     205           0 :     const OUString& GetToolTip() const { return aToolTip;}
     206             : 
     207             :     /**
     208             :        Sets the selected item.
     209             : 
     210             :        If rItem is found in this dropdown field it is selected. If
     211             :        rItem is not found the selection will be empty.
     212             : 
     213             :        @param rItem the item to be set
     214             : 
     215             :        @retval sal_True the selected item was successfully set
     216             :        @retval sal_True failure (empty selection)
     217             :     */
     218             :     bool SetSelectedItem(const OUString & rItem);
     219             : 
     220             :     /**
     221             :        Sets the name of the field.
     222             : 
     223             :        @param rName the new name of the field
     224             :     */
     225             :     void SetName(const OUString & rName);
     226             : 
     227             :     /**
     228             :        Sets the help text of the field.
     229             : 
     230             :        @param rHelp    the help text
     231             :     */
     232             :     void SetHelp(const OUString & rHelp);
     233             : 
     234             :     /**
     235             :        Sets the tool tip of the field.
     236             : 
     237             :        @param rToolTip  the tool tip
     238             :     */
     239             :     void SetToolTip(const OUString & rToolTip);
     240             : 
     241             :     /**
     242             :        API: Gets a property value from the dropdown field.
     243             : 
     244             :        @param rVal return value
     245             :        @param nMId
     246             :           - FIELD_PROP_PAR1 Get selected item (String)
     247             :           - FIELD_PROP_STRINGS Get all items (Sequence)
     248             :           - FIELD_PROP_PAR3 Get the help text of the field.
     249             :           - FIELD_PROP_PAR4 Get the tool tip of the field.
     250             :     */
     251             :     virtual bool QueryValue(com::sun::star::uno::Any &rVal, sal_uInt16 nWhichId) const SAL_OVERRIDE;
     252             : 
     253             :     /**
     254             :        API: Sets a property value on the dropdown field.
     255             : 
     256             :        @param rVal value to set
     257             :        @param nMId
     258             :           - FIELD_PROP_PAR1 Set selected item (String)
     259             :           - FIELD_PROP_STRINGS Set all items (Sequence)
     260             :           - FIELD_PROP_PAR3  Set the help text of the field.
     261             :           - FIELD_PROP_PAR4  Set the tool tip of the field.
     262             :     */
     263             :     virtual bool PutValue(const com::sun::star::uno::Any &rVal, sal_uInt16 nWhichId) SAL_OVERRIDE;
     264             : };
     265             : 
     266             : #endif
     267             : 
     268             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10