LibreOffice Module fpicker (master) 1
resourceprovider.cxx
Go to the documentation of this file.
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 <sal/config.h>
21
22#include <memory>
23
24#include <rtl/ustrbuf.hxx>
25#include "resourceprovider.hxx"
26#include <osl/mutex.hxx>
27#include <fpicker/strings.hrc>
28#include <vcl/settings.hxx>
29#include <vcl/svapp.hxx>
30
31#include <unotools/resmgr.hxx>
32#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
33#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
35
36using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds;
37using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds;
38
39#define FOLDERPICKER_TITLE 500
40#define FOLDER_PICKER_DEF_DESCRIPTION 501
41
42// we have to translate control ids to resource ids
43
44namespace {
45
46struct Entry
47{
48 sal_Int32 ctrlId;
49 TranslateId resId;
50};
51
52}
53
55 { CHECKBOX_AUTOEXTENSION, STR_SVT_FILEPICKER_AUTO_EXTENSION },
56 { CHECKBOX_PASSWORD, STR_SVT_FILEPICKER_PASSWORD },
57 { CHECKBOX_FILTEROPTIONS, STR_SVT_FILEPICKER_FILTER_OPTIONS },
58 { CHECKBOX_READONLY, STR_SVT_FILEPICKER_READONLY },
59 { CHECKBOX_LINK, STR_SVT_FILEPICKER_INSERT_AS_LINK },
60 { CHECKBOX_PREVIEW, STR_SVT_FILEPICKER_SHOW_PREVIEW },
61 { PUSHBUTTON_PLAY, STR_SVT_FILEPICKER_PLAY },
62 { LISTBOX_VERSION_LABEL, STR_SVT_FILEPICKER_VERSION },
63 { LISTBOX_TEMPLATE_LABEL, STR_SVT_FILEPICKER_TEMPLATES },
64 { LISTBOX_IMAGE_TEMPLATE_LABEL, STR_SVT_FILEPICKER_IMAGE_TEMPLATE },
65 { LISTBOX_IMAGE_ANCHOR_LABEL, STR_SVT_FILEPICKER_IMAGE_ANCHOR },
66 { CHECKBOX_SELECTION, STR_SVT_FILEPICKER_SELECTION },
67 { FOLDERPICKER_TITLE, STR_SVT_FOLDERPICKER_DEFAULT_TITLE },
68 { FOLDER_PICKER_DEF_DESCRIPTION, STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION },
69 { CHECKBOX_GPGENCRYPTION, STR_SVT_FILEPICKER_GPGENCRYPT }
70};
71
73
74static TranslateId CtrlIdToResId( sal_Int32 aControlId )
75{
76 TranslateId pResId;
77
78 for ( sal_Int32 i = 0; i < SIZE_TABLE; i++ )
79 {
80 if ( CtrlIdToResIdTable[i].ctrlId == aControlId )
81 {
82 pResId = CtrlIdToResIdTable[i].resId;
83 break;
84 }
85 }
86
87 return pResId;
88}
89
90namespace CResourceProvider
91{
92 OUString getResString( sal_Int16 aId )
93 {
94 OUString aResOUString;
95 // translate the control id to a resource id
96 TranslateId pResId = CtrlIdToResId(aId);
97 if (pResId)
98 aResOUString = FpsResId(pResId);
99 return aResOUString;
100 }
101}
102
103/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString FpsResId(TranslateId aId)
#define SAL_N_ELEMENTS(arr)
NSString * getResString(sal_Int32 aId)
int i
static TranslateId CtrlIdToResId(sal_Int32 aControlId)
#define FOLDER_PICKER_DEF_DESCRIPTION
#define FOLDERPICKER_TITLE
const sal_Int32 SIZE_TABLE
Entry const CtrlIdToResIdTable[]