LCOV - code coverage report
Current view: top level - vcl/unx/gtk/fpicker - resourceprovider.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 13 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             : 
      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             : // translate control ids to resource ids
      34             : 
      35             : static const struct
      36             : {
      37             :     sal_Int32 ctrlId;
      38             :     sal_Int16 resId;
      39             : } CtrlIdToResIdTable[] = {
      40             :     { CHECKBOX_AUTOEXTENSION,                   STR_FPICKER_AUTO_EXTENSION },
      41             :     { CHECKBOX_PASSWORD,                        STR_FPICKER_PASSWORD },
      42             :     { CHECKBOX_FILTEROPTIONS,                   STR_FPICKER_FILTER_OPTIONS },
      43             :     { CHECKBOX_READONLY,                        STR_FPICKER_READONLY },
      44             :     { CHECKBOX_LINK,                            STR_FPICKER_INSERT_AS_LINK },
      45             :     { CHECKBOX_PREVIEW,                         STR_FPICKER_SHOW_PREVIEW },
      46             :     { PUSHBUTTON_PLAY,                          STR_FPICKER_PLAY },
      47             :     { LISTBOX_VERSION_LABEL,                    STR_FPICKER_VERSION },
      48             :     { LISTBOX_TEMPLATE_LABEL,                   STR_FPICKER_TEMPLATES },
      49             :     { LISTBOX_IMAGE_TEMPLATE_LABEL,             STR_FPICKER_IMAGE_TEMPLATE },
      50             :     { CHECKBOX_SELECTION,                       STR_FPICKER_SELECTION },
      51             :     { FOLDERPICKER_TITLE,                       STR_FPICKER_FOLDER_DEFAULT_TITLE },
      52             :     { FOLDER_PICKER_DEF_DESCRIPTION,            STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION },
      53             :     { FILE_PICKER_OVERWRITE_PRIMARY,            STR_FPICKER_ALREADYEXISTOVERWRITE_PRIMARY },
      54             :     { FILE_PICKER_OVERWRITE_SECONDARY,          STR_FPICKER_ALREADYEXISTOVERWRITE_SECONDARY },
      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 : OUString SalGtkPicker::getResString( sal_Int32 aId )
      72             : {
      73           0 :     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           0 : }
      87             : 
      88             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10