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

Generated by: LCOV version 1.10