LCOV - code coverage report
Current view: top level - forms/source/misc - property.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 175 175 100.0 %
Date: 2015-06-13 12:38:46 Functions: 5 5 100.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             : 
      20             : #include "frm_strings.hxx"
      21             : #include "property.hxx"
      22             : 
      23             : #include "property.hrc"
      24             : #include <cppuhelper/queryinterface.hxx>
      25             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      26             : 
      27             : #include <algorithm>
      28             : 
      29             : namespace frm
      30             : {
      31             : 
      32             : //= PropertyInfoService
      33             : 
      34          46 : PropertyInfoService::PropertyMap PropertyInfoService::s_AllKnownProperties;
      35             : 
      36       39863 : sal_Int32 PropertyInfoService::getPropertyId(const OUString& _rName)
      37             : {
      38       39863 :     initialize();
      39             : 
      40       39863 :     PropertyAssignment aCompareName(_rName, -1);
      41             : 
      42             :     ::std::pair<PropertyMap::iterator,PropertyMap::iterator> aPair = ::std::equal_range(
      43             :         s_AllKnownProperties.begin(),
      44             :         s_AllKnownProperties.end(),
      45             :         aCompareName,
      46       39863 :         PropertyAssignmentNameCompareLess());
      47             : 
      48       39863 :     sal_Int32 nHandle = -1;
      49       39863 :     if (aPair.first != aPair.second)
      50             :     {   // we found something _and_ we have an identity
      51       16852 :         nHandle = aPair.first->nHandle;
      52             :     }
      53             : 
      54       39863 :     return nHandle;
      55             : }
      56             : 
      57             : 
      58       39863 : sal_Int32 ConcreteInfoService::getPreferredPropertyId(const OUString& _rName)
      59             : {
      60       39863 :     return PropertyInfoService::getPropertyId(_rName);
      61             : }
      62             : 
      63             : 
      64             : #define ADD_PROP_ASSIGNMENT(varname) \
      65             :     s_AllKnownProperties.push_back(PropertyAssignment(PROPERTY_##varname, PROPERTY_ID_##varname))
      66             : 
      67       39863 : void PropertyInfoService::initialize()
      68             : {
      69       39863 :     if (!s_AllKnownProperties.empty())
      70       79694 :         return;
      71             : 
      72          32 :     s_AllKnownProperties.reserve(220);
      73             : 
      74          32 :     ADD_PROP_ASSIGNMENT(NAME);
      75          32 :     ADD_PROP_ASSIGNMENT(TAG);
      76          32 :     ADD_PROP_ASSIGNMENT(TABINDEX);
      77          32 :     ADD_PROP_ASSIGNMENT(CLASSID);
      78          32 :     ADD_PROP_ASSIGNMENT(ALIGN);
      79          32 :     ADD_PROP_ASSIGNMENT(FETCHSIZE);
      80          32 :     ADD_PROP_ASSIGNMENT(VALUE);
      81          32 :     ADD_PROP_ASSIGNMENT(VALUEMIN);
      82          32 :     ADD_PROP_ASSIGNMENT(VALUEMAX);
      83          32 :     ADD_PROP_ASSIGNMENT(VALUESTEP);
      84          32 :     ADD_PROP_ASSIGNMENT(TEXT);
      85          32 :     ADD_PROP_ASSIGNMENT(LABEL);
      86          32 :     ADD_PROP_ASSIGNMENT(NAVIGATION);
      87          32 :     ADD_PROP_ASSIGNMENT(CYCLE);
      88          32 :     ADD_PROP_ASSIGNMENT(CONTROLSOURCE);
      89          32 :     ADD_PROP_ASSIGNMENT(ENABLED);
      90          32 :     ADD_PROP_ASSIGNMENT(ENABLEVISIBLE);
      91          32 :     ADD_PROP_ASSIGNMENT(SPIN);
      92          32 :     ADD_PROP_ASSIGNMENT(READONLY);
      93          32 :     ADD_PROP_ASSIGNMENT(FILTER);
      94          32 :     ADD_PROP_ASSIGNMENT(WIDTH);
      95          32 :     ADD_PROP_ASSIGNMENT(SEARCHABLE);
      96          32 :     ADD_PROP_ASSIGNMENT(MULTILINE);
      97          32 :     ADD_PROP_ASSIGNMENT(TARGET_URL);
      98          32 :     ADD_PROP_ASSIGNMENT(DEFAULTCONTROL);
      99          32 :     ADD_PROP_ASSIGNMENT(MAXTEXTLEN);
     100          32 :     ADD_PROP_ASSIGNMENT(SIZE);
     101          32 :     ADD_PROP_ASSIGNMENT(DATE);
     102          32 :     ADD_PROP_ASSIGNMENT(TIME);
     103          32 :     ADD_PROP_ASSIGNMENT(STATE);
     104          32 :     ADD_PROP_ASSIGNMENT(TRISTATE);
     105          32 :     ADD_PROP_ASSIGNMENT(HIDDEN_VALUE);
     106          32 :     ADD_PROP_ASSIGNMENT(TARGET_FRAME);
     107          32 :     ADD_PROP_ASSIGNMENT(BUTTONTYPE);
     108          32 :     ADD_PROP_ASSIGNMENT(STRINGITEMLIST);
     109          32 :     ADD_PROP_ASSIGNMENT(DEFAULT_TEXT);
     110          32 :     ADD_PROP_ASSIGNMENT(DEFAULT_STATE);
     111          32 :     ADD_PROP_ASSIGNMENT(DEFAULT_DATE);
     112          32 :     ADD_PROP_ASSIGNMENT(DEFAULT_TIME);
     113          32 :     ADD_PROP_ASSIGNMENT(DEFAULT_VALUE);
     114          32 :     ADD_PROP_ASSIGNMENT(FORMATKEY);
     115          32 :     ADD_PROP_ASSIGNMENT(FORMATSSUPPLIER);
     116          32 :     ADD_PROP_ASSIGNMENT(SUBMIT_ACTION);
     117          32 :     ADD_PROP_ASSIGNMENT(SUBMIT_TARGET);
     118          32 :     ADD_PROP_ASSIGNMENT(SUBMIT_METHOD);
     119          32 :     ADD_PROP_ASSIGNMENT(SUBMIT_ENCODING);
     120          32 :     ADD_PROP_ASSIGNMENT(IMAGE_URL);
     121          32 :     ADD_PROP_ASSIGNMENT(GRAPHIC);
     122          32 :     ADD_PROP_ASSIGNMENT(EMPTY_IS_NULL);
     123          32 :     ADD_PROP_ASSIGNMENT(LISTSOURCETYPE);
     124          32 :     ADD_PROP_ASSIGNMENT(LISTSOURCE);
     125          32 :     ADD_PROP_ASSIGNMENT(SELECT_SEQ);
     126          32 :     ADD_PROP_ASSIGNMENT(VALUE_SEQ);
     127          32 :     ADD_PROP_ASSIGNMENT(SELECT_VALUE);
     128          32 :     ADD_PROP_ASSIGNMENT(SELECT_VALUE_SEQ);
     129          32 :     ADD_PROP_ASSIGNMENT(DEFAULT_SELECT_SEQ);
     130          32 :     ADD_PROP_ASSIGNMENT(MULTISELECTION);
     131          32 :     ADD_PROP_ASSIGNMENT(DECIMAL_ACCURACY);
     132          32 :     ADD_PROP_ASSIGNMENT(EDITMASK);
     133          32 :     ADD_PROP_ASSIGNMENT(ISREADONLY);
     134          32 :     ADD_PROP_ASSIGNMENT(FIELDTYPE);
     135          32 :     ADD_PROP_ASSIGNMENT(DECIMALS);
     136          32 :     ADD_PROP_ASSIGNMENT(REFVALUE);
     137          32 :     ADD_PROP_ASSIGNMENT(STRICTFORMAT);
     138          32 :     ADD_PROP_ASSIGNMENT(DATASOURCE);
     139          32 :     ADD_PROP_ASSIGNMENT(ALLOWADDITIONS);
     140          32 :     ADD_PROP_ASSIGNMENT(ALLOWEDITS);
     141          32 :     ADD_PROP_ASSIGNMENT(ALLOWDELETIONS);
     142          32 :     ADD_PROP_ASSIGNMENT(MASTERFIELDS);
     143          32 :     ADD_PROP_ASSIGNMENT(ISPASSTHROUGH);
     144          32 :     ADD_PROP_ASSIGNMENT(QUERY);
     145          32 :     ADD_PROP_ASSIGNMENT(LITERALMASK);
     146          32 :     ADD_PROP_ASSIGNMENT(SHOWTHOUSANDSEP);
     147          32 :     ADD_PROP_ASSIGNMENT(CURRENCYSYMBOL);
     148          32 :     ADD_PROP_ASSIGNMENT(DATEFORMAT);
     149          32 :     ADD_PROP_ASSIGNMENT(DATEMIN);
     150          32 :     ADD_PROP_ASSIGNMENT(DATEMAX);
     151          32 :     ADD_PROP_ASSIGNMENT(DATE_SHOW_CENTURY);
     152          32 :     ADD_PROP_ASSIGNMENT(TIMEFORMAT);
     153          32 :     ADD_PROP_ASSIGNMENT(TIMEMIN);
     154          32 :     ADD_PROP_ASSIGNMENT(TIMEMAX);
     155          32 :     ADD_PROP_ASSIGNMENT(LINECOUNT);
     156          32 :     ADD_PROP_ASSIGNMENT(BOUNDCOLUMN);
     157          32 :     ADD_PROP_ASSIGNMENT(HASNAVIGATION);
     158          32 :     ADD_PROP_ASSIGNMENT(FONT);
     159          32 :     ADD_PROP_ASSIGNMENT(BACKGROUNDCOLOR);
     160          32 :     ADD_PROP_ASSIGNMENT(FILLCOLOR);
     161          32 :     ADD_PROP_ASSIGNMENT(TEXTCOLOR);
     162          32 :     ADD_PROP_ASSIGNMENT(LINECOLOR);
     163          32 :     ADD_PROP_ASSIGNMENT(BORDER);
     164          32 :     ADD_PROP_ASSIGNMENT(DROPDOWN);
     165          32 :     ADD_PROP_ASSIGNMENT(HSCROLL);
     166          32 :     ADD_PROP_ASSIGNMENT(VSCROLL);
     167          32 :     ADD_PROP_ASSIGNMENT(TABSTOP);
     168          32 :     ADD_PROP_ASSIGNMENT(AUTOCOMPLETE);
     169          32 :     ADD_PROP_ASSIGNMENT(HARDLINEBREAKS);
     170          32 :     ADD_PROP_ASSIGNMENT(PRINTABLE);
     171          32 :     ADD_PROP_ASSIGNMENT(ECHO_CHAR);
     172          32 :     ADD_PROP_ASSIGNMENT(ROWHEIGHT);
     173          32 :     ADD_PROP_ASSIGNMENT(HELPTEXT);
     174          32 :     ADD_PROP_ASSIGNMENT(FONT_NAME);
     175          32 :     ADD_PROP_ASSIGNMENT(FONT_STYLENAME);
     176          32 :     ADD_PROP_ASSIGNMENT(FONT_FAMILY);
     177          32 :     ADD_PROP_ASSIGNMENT(FONT_CHARSET);
     178          32 :     ADD_PROP_ASSIGNMENT(FONT_HEIGHT);
     179          32 :     ADD_PROP_ASSIGNMENT(FONT_WEIGHT);
     180          32 :     ADD_PROP_ASSIGNMENT(FONT_SLANT);
     181          32 :     ADD_PROP_ASSIGNMENT(FONT_UNDERLINE);
     182          32 :     ADD_PROP_ASSIGNMENT(FONT_WORDLINEMODE);
     183          32 :     ADD_PROP_ASSIGNMENT(FONT_STRIKEOUT);
     184          32 :     ADD_PROP_ASSIGNMENT(TEXTLINECOLOR);
     185          32 :     ADD_PROP_ASSIGNMENT(FONTEMPHASISMARK);
     186          32 :     ADD_PROP_ASSIGNMENT(FONTRELIEF);
     187          32 :     ADD_PROP_ASSIGNMENT(HELPURL);
     188          32 :     ADD_PROP_ASSIGNMENT(RECORDMARKER);
     189          32 :     ADD_PROP_ASSIGNMENT(BOUNDFIELD);
     190          32 :     ADD_PROP_ASSIGNMENT(INPUT_REQUIRED);
     191          32 :     ADD_PROP_ASSIGNMENT(TREATASNUMERIC);
     192          32 :     ADD_PROP_ASSIGNMENT(EFFECTIVE_VALUE);
     193          32 :     ADD_PROP_ASSIGNMENT(EFFECTIVE_DEFAULT);
     194          32 :     ADD_PROP_ASSIGNMENT(EFFECTIVE_MIN);
     195          32 :     ADD_PROP_ASSIGNMENT(EFFECTIVE_MAX);
     196          32 :     ADD_PROP_ASSIGNMENT(HIDDEN);
     197          32 :     ADD_PROP_ASSIGNMENT(FILTERPROPOSAL);
     198          32 :     ADD_PROP_ASSIGNMENT(FIELDSOURCE);
     199          32 :     ADD_PROP_ASSIGNMENT(TABLENAME);
     200          32 :     ADD_PROP_ASSIGNMENT(CONTROLLABEL);
     201          32 :     ADD_PROP_ASSIGNMENT(CURRSYM_POSITION);
     202          32 :     ADD_PROP_ASSIGNMENT(CURSORCOLOR);
     203          32 :     ADD_PROP_ASSIGNMENT(ALWAYSSHOWCURSOR);
     204          32 :     ADD_PROP_ASSIGNMENT(DISPLAYSYNCHRON);
     205          32 :     ADD_PROP_ASSIGNMENT(ISMODIFIED);
     206          32 :     ADD_PROP_ASSIGNMENT(ISNEW);
     207          32 :     ADD_PROP_ASSIGNMENT(PRIVILEGES);
     208          32 :     ADD_PROP_ASSIGNMENT(DETAILFIELDS);
     209          32 :     ADD_PROP_ASSIGNMENT(COMMAND);
     210          32 :     ADD_PROP_ASSIGNMENT(COMMANDTYPE);
     211          32 :     ADD_PROP_ASSIGNMENT(RESULTSET_CONCURRENCY);
     212          32 :     ADD_PROP_ASSIGNMENT(INSERTONLY);
     213          32 :     ADD_PROP_ASSIGNMENT(RESULTSET_TYPE);
     214          32 :     ADD_PROP_ASSIGNMENT(ESCAPE_PROCESSING);
     215          32 :     ADD_PROP_ASSIGNMENT(APPLYFILTER);
     216          32 :     ADD_PROP_ASSIGNMENT(ISNULLABLE);
     217          32 :     ADD_PROP_ASSIGNMENT(ACTIVECOMMAND);
     218          32 :     ADD_PROP_ASSIGNMENT(ISCURRENCY);
     219          32 :     ADD_PROP_ASSIGNMENT(URL);
     220          32 :     ADD_PROP_ASSIGNMENT(TITLE);
     221          32 :     ADD_PROP_ASSIGNMENT(ACTIVE_CONNECTION);
     222          32 :     ADD_PROP_ASSIGNMENT(SCALE);
     223          32 :     ADD_PROP_ASSIGNMENT(SORT);
     224          32 :     ADD_PROP_ASSIGNMENT(PERSISTENCE_MAXTEXTLENGTH);
     225          32 :     ADD_PROP_ASSIGNMENT(SCROLL_VALUE);
     226          32 :     ADD_PROP_ASSIGNMENT(SPIN_VALUE);
     227          32 :     ADD_PROP_ASSIGNMENT(DEFAULT_SCROLL_VALUE);
     228          32 :     ADD_PROP_ASSIGNMENT(DEFAULT_SPIN_VALUE);
     229          32 :     ADD_PROP_ASSIGNMENT( WRITING_MODE );
     230          32 :     ADD_PROP_ASSIGNMENT( CONTEXT_WRITING_MODE );
     231          32 :     ADD_PROP_ASSIGNMENT( GENERATEVBAEVENTS );
     232             : 
     233             :     // now sort the array by name
     234             : 
     235             :     std::sort(
     236             :         s_AllKnownProperties.begin(),
     237             :         s_AllKnownProperties.end(),
     238             :         PropertyAssignmentNameCompareLess()
     239          32 :     );
     240             : }
     241             : 
     242             : 
     243         138 : }
     244             : //... namespace frm .......................................................
     245             : 
     246             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11