LCOV - code coverage report
Current view: top level - libreoffice/vcl/unx/gtk/fpicker - resourceprovider.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 12 0.0 %
Date: 2012-12-27 Functions: 0 2 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             : 
      20             : #include <osl/diagnose.h>
      21             : #include <vcl/svapp.hxx>
      22             : #include <tools/resmgr.hxx>
      23             : #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
      24             : #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
      25             : 
      26             : #include "svids.hrc"
      27             : #include "svdata.hxx"
      28             : #include "gtk/fpicker/SalGtkPicker.hxx"
      29             : 
      30             : using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds;
      31             : using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds;
      32             : 
      33             : //---------------------------------------
      34             : // translate control ids to resource ids
      35             : //---------------------------------------
      36             : static const struct
      37             : {
      38             :     sal_Int32 ctrlId;
      39             :     sal_Int16 resId;
      40             : } CtrlIdToResIdTable[] = {
      41             :     { CHECKBOX_AUTOEXTENSION,                   STR_FPICKER_AUTO_EXTENSION },
      42             :     { CHECKBOX_PASSWORD,                        STR_FPICKER_PASSWORD },
      43             :     { CHECKBOX_FILTEROPTIONS,                   STR_FPICKER_FILTER_OPTIONS },
      44             :     { CHECKBOX_READONLY,                        STR_FPICKER_READONLY },
      45             :     { CHECKBOX_LINK,                            STR_FPICKER_INSERT_AS_LINK },
      46             :     { CHECKBOX_PREVIEW,                         STR_FPICKER_SHOW_PREVIEW },
      47             :     { PUSHBUTTON_PLAY,                          STR_FPICKER_PLAY },
      48             :     { LISTBOX_VERSION_LABEL,                    STR_FPICKER_VERSION },
      49             :     { LISTBOX_TEMPLATE_LABEL,                   STR_FPICKER_TEMPLATES },
      50             :     { LISTBOX_IMAGE_TEMPLATE_LABEL,             STR_FPICKER_IMAGE_TEMPLATE },
      51             :     { CHECKBOX_SELECTION,                       STR_FPICKER_SELECTION },
      52             :     { FOLDERPICKER_TITLE,                       STR_FPICKER_FOLDER_DEFAULT_TITLE },
      53             :     { FOLDER_PICKER_DEF_DESCRIPTION,            STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION },
      54             :     { FILE_PICKER_OVERWRITE,                    STR_FPICKER_ALREADYEXISTOVERWRITE },
      55             :     { FILE_PICKER_ALLFORMATS,                   STR_FPICKER_ALLFORMATS },
      56             :     { FILE_PICKER_TITLE_OPEN,                   STR_FPICKER_OPEN },
      57             :     { FILE_PICKER_TITLE_SAVE,                   STR_FPICKER_SAVE },
      58             :     { FILE_PICKER_FILE_TYPE,                    STR_FPICKER_TYPE }
      59             : };
      60             : 
      61           0 : static sal_Int16 CtrlIdToResId( sal_Int32 aControlId )
      62             : {
      63           0 :     for ( size_t i = 0; i < SAL_N_ELEMENTS( CtrlIdToResIdTable ); i++ )
      64             :     {
      65           0 :         if ( CtrlIdToResIdTable[i].ctrlId == aControlId )
      66           0 :             return CtrlIdToResIdTable[i].resId;
      67             :     }
      68           0 :     return -1;
      69             : }
      70             : 
      71           0 : rtl::OUString SalGtkPicker::getResString( sal_Int32 aId )
      72             : {
      73           0 :     rtl::OUString aResString;
      74             :     try
      75             :     {
      76             :         // translate the control id to a resource id
      77           0 :         sal_Int16 aResId = CtrlIdToResId( aId );
      78           0 :         if ( aResId > -1 )
      79           0 :             aResString = ResId(aResId, *ImplGetResMgr()).toString();
      80             :     }
      81           0 :     catch(...)
      82             :     {
      83             :     }
      84             : 
      85           0 :     return aResString.replace('~', '_');
      86             : }
      87             : 
      88             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10