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

Generated by: LCOV version 1.10