diff options
Diffstat (limited to 'forms/source')
23 files changed, 133 insertions, 658 deletions
diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index 3c8690321704..e8bdea30e299 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -38,7 +38,7 @@ #include <comphelper/basicio.hxx> #include <comphelper/servicehelper.hxx> #include "services.hxx" -#include "frm_resource.hrc" +#include "strings.hrc" #include <tools/debug.hxx> diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx index c99cf8a1808e..cac09c9d5099 100644 --- a/forms/source/component/ComboBox.cxx +++ b/forms/source/component/ComboBox.cxx @@ -24,7 +24,7 @@ #include "services.hxx" #include "frm_resource.hxx" -#include "frm_resource.hrc" +#include "strings.hrc" #include "BaseListBox.hxx" #include <com/sun/star/sdb/SQLErrorEvent.hpp> diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index d56659fcec70..e4ba7f24fa4b 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -21,7 +21,7 @@ #include "componenttools.hxx" #include "DatabaseForm.hxx" #include "EventThread.hxx" -#include "frm_resource.hrc" +#include "strings.hrc" #include "frm_resource.hxx" #include "GroupManager.hxx" #include "property.hrc" diff --git a/forms/source/component/EditBase.cxx b/forms/source/component/EditBase.cxx index 99ecfdb316d1..eef46ef2bbb9 100644 --- a/forms/source/component/EditBase.cxx +++ b/forms/source/component/EditBase.cxx @@ -25,7 +25,7 @@ #include <comphelper/basicio.hxx> #include <cppuhelper/queryinterface.hxx> #include "frm_resource.hxx" -#include "frm_resource.hrc" +#include "strings.hrc" #include <tools/time.hxx> #include <tools/date.hxx> #include <com/sun/star/util/Time.hpp> diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index 96225e6cba06..eee60278e94f 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -19,7 +19,7 @@ #include "Filter.hxx" #include "FormComponent.hxx" -#include "frm_resource.hrc" +#include "strings.hrc" #include "frm_resource.hxx" #include "property.hrc" #include "property.hxx" diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 296b06ca3d68..fae24966a626 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -18,7 +18,7 @@ */ #include "componenttools.hxx" #include "FormComponent.hxx" -#include "frm_resource.hrc" +#include "strings.hrc" #include "frm_resource.hxx" #include "property.hrc" #include "services.hxx" diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index 096b2bcf9351..cbae77c3211c 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -21,7 +21,7 @@ #include "property.hrc" #include "property.hxx" #include "frm_resource.hxx" -#include "frm_resource.hrc" +#include "strings.hrc" #include "propertybaghelper.hxx" #include <comphelper/sequence.hxx> #include <comphelper/numbers.hxx> diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx index 33e66450f2f7..c72c211ce2b0 100644 --- a/forms/source/component/ImageControl.cxx +++ b/forms/source/component/ImageControl.cxx @@ -20,7 +20,7 @@ #include "ImageControl.hxx" #include "property.hrc" -#include "frm_resource.hrc" +#include "strings.hrc" #include "frm_resource.hxx" #include "services.hxx" #include "componenttools.hxx" diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index dd53979ebbc1..7d1f39ca8e14 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -24,7 +24,7 @@ #include "property.hrc" #include "services.hxx" #include "frm_resource.hxx" -#include "frm_resource.hrc" +#include "strings.hrc" #include "BaseListBox.hxx" #include "listenercontainers.hxx" #include "componenttools.hxx" diff --git a/forms/source/inc/frm_resource.hrc b/forms/source/inc/frm_resource.hrc deleted file mode 100644 index e3a4eb04af90..000000000000 --- a/forms/source/inc/frm_resource.hrc +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FORMS_SOURCE_INC_FRM_RESOURCE_HRC -#define INCLUDED_FORMS_SOURCE_INC_FRM_RESOURCE_HRC - -#include <svl/solar.hrc> - -#define RID_FRM_STRINGS_START RID_FORMLAYER_START - -//- String-IDs -#define RID_BASELISTBOX_ERROR_FILLLIST ( RID_FRM_STRINGS_START + 0 ) -#define RID_STR_IMPORT_GRAPHIC ( RID_FRM_STRINGS_START + 1 ) -#define RID_STR_CONTROL_SUBSTITUTED_NAME ( RID_FRM_STRINGS_START + 2 ) -#define RID_STR_CONTROL_SUBSTITUTED_EPXPLAIN ( RID_FRM_STRINGS_START + 3 ) -#define RID_STR_READERROR ( RID_FRM_STRINGS_START + 4 ) -#define RID_STR_CONNECTERROR ( RID_FRM_STRINGS_START + 5 ) -#define RID_ERR_LOADING_FORM ( RID_FRM_STRINGS_START + 6 ) -#define RID_ERR_REFRESHING_FORM ( RID_FRM_STRINGS_START + 7 ) -#define RID_STR_ERR_INSERTRECORD ( RID_FRM_STRINGS_START + 8 ) -#define RID_STR_ERR_UPDATERECORD ( RID_FRM_STRINGS_START + 9 ) -#define RID_STR_ERR_DELETERECORD ( RID_FRM_STRINGS_START + 10 ) -#define RID_STR_ERR_DELETERECORDS ( RID_FRM_STRINGS_START + 11 ) -#define RID_STR_NEED_NON_NULL_OBJECT ( RID_FRM_STRINGS_START + 12 ) -#define RID_STR_OPEN_GRAPHICS ( RID_FRM_STRINGS_START + 13 ) -#define RID_STR_CLEAR_GRAPHICS ( RID_FRM_STRINGS_START + 14 ) -#define RID_STR_INVALIDSTREAM ( RID_FRM_STRINGS_START + 15 ) -#define RID_STR_SYNTAXERROR ( RID_FRM_STRINGS_START + 16 ) -#define RID_STR_INCOMPATIBLE_TYPES ( RID_FRM_STRINGS_START + 17 ) -#define RID_STR_INVALID_VALIDATOR ( RID_FRM_STRINGS_START + 18 ) -#define RID_STR_LABEL_RECORD ( RID_FRM_STRINGS_START + 19 ) -#define RID_STR_LABEL_OF ( RID_FRM_STRINGS_START + 20 ) - -#define RID_STR_XFORMS_NO_BINDING_EXPRESSION ( RID_FRM_STRINGS_START + 21 ) -#define RID_STR_XFORMS_INVALID_BINDING_EXPRESSION (RID_FRM_STRINGS_START + 22) -#define RID_STR_XFORMS_INVALID_VALUE ( RID_FRM_STRINGS_START + 23 ) -#define RID_STR_XFORMS_REQUIRED ( RID_FRM_STRINGS_START + 24 ) -#define RID_STR_XFORMS_INVALID_CONSTRAINT ( RID_FRM_STRINGS_START + 25 ) -#define RID_STR_XFORMS_VALUE_IS_NOT_A ( RID_FRM_STRINGS_START + 26 ) -#define RID_STR_XFORMS_VALUE_MAX_INCL ( RID_FRM_STRINGS_START + 27 ) -#define RID_STR_XFORMS_VALUE_MAX_EXCL ( RID_FRM_STRINGS_START + 28 ) -#define RID_STR_XFORMS_VALUE_MIN_INCL ( RID_FRM_STRINGS_START + 29 ) -#define RID_STR_XFORMS_VALUE_MIN_EXCL ( RID_FRM_STRINGS_START + 30 ) -#define RID_STR_XFORMS_VALUE_TOTAL_DIGITS ( RID_FRM_STRINGS_START + 32 ) -#define RID_STR_XFORMS_VALUE_FRACTION_DIGITS ( RID_FRM_STRINGS_START + 33 ) -#define RID_STR_XFORMS_VALUE_LENGTH ( RID_FRM_STRINGS_START + 34 ) -#define RID_STR_XFORMS_VALUE_MIN_LENGTH ( RID_FRM_STRINGS_START + 35 ) -#define RID_STR_XFORMS_VALUE_MAX_LENGTH ( RID_FRM_STRINGS_START + 36 ) - -#define RID_STR_DATATYPE_STRING ( RID_FRM_STRINGS_START + 37 ) -#define RID_STR_DATATYPE_URL ( RID_FRM_STRINGS_START + 38 ) -#define RID_STR_DATATYPE_BOOLEAN ( RID_FRM_STRINGS_START + 39 ) -#define RID_STR_DATATYPE_DECIMAL ( RID_FRM_STRINGS_START + 40 ) -#define RID_STR_DATATYPE_FLOAT ( RID_FRM_STRINGS_START + 41 ) -#define RID_STR_DATATYPE_DOUBLE ( RID_FRM_STRINGS_START + 42 ) -#define RID_STR_DATATYPE_DATE ( RID_FRM_STRINGS_START + 43 ) -#define RID_STR_DATATYPE_TIME ( RID_FRM_STRINGS_START + 44 ) -#define RID_STR_DATATYPE_DATETIME ( RID_FRM_STRINGS_START + 45 ) -#define RID_STR_DATATYPE_YEAR ( RID_FRM_STRINGS_START + 47 ) -#define RID_STR_DATATYPE_MONTH ( RID_FRM_STRINGS_START + 49 ) -#define RID_STR_DATATYPE_DAY ( RID_FRM_STRINGS_START + 50 ) - -#define RID_STR_XFORMS_CANT_EVALUATE ( RID_FRM_STRINGS_START + 51 ) -#define RID_STR_XFORMS_PATTERN_DOESNT_MATCH ( RID_FRM_STRINGS_START + 52 ) -#define RID_STR_XFORMS_BINDING_UI_NAME ( RID_FRM_STRINGS_START + 53 ) - -#define RID_STR_QUERY_SAVE_MODIFIED_ROW ( RID_FRM_STRINGS_START + 54 ) -#define RID_STR_COULD_NOT_SET_ORDER ( RID_FRM_STRINGS_START + 55 ) -#define RID_STR_COULD_NOT_SET_FILTER ( RID_FRM_STRINGS_START + 56 ) -#define RID_STR_FEATURE_REQUIRES_PARAMETERS ( RID_FRM_STRINGS_START + 57 ) -#define RID_STR_FEATURE_NOT_EXECUTABLE ( RID_FRM_STRINGS_START + 58 ) -#define RID_STR_FEATURE_UNKNOWN ( RID_FRM_STRINGS_START + 59 ) - -#define RID_STR_XFORMS_CANT_REMOVE_TYPE ( RID_FRM_STRINGS_START + 60 ) - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/inc/frm_resource.hxx b/forms/source/inc/frm_resource.hxx index 6597893ab384..529d0f43b391 100644 --- a/forms/source/inc/frm_resource.hxx +++ b/forms/source/inc/frm_resource.hxx @@ -22,42 +22,18 @@ #include <rtl/ustring.hxx> -class SimpleResMgr; - namespace frm { #define FRM_RES_STRING(id) ResourceManager::loadString(id) // handling resources within the FormLayer library - class ResourceManager + namespace ResourceManager { - static SimpleResMgr* m_pImpl; - private: - // no instantiation allowed - ResourceManager() = delete; - ~ResourceManager() { } - - // we'll instantiate one static member of the following class, which, in its dtor, - // ensures that m_pImpl will be deleted - class EnsureDelete - { - public: - EnsureDelete() { } - ~EnsureDelete(); - }; - friend class EnsureDelete; - - protected: - static void ensureImplExists(); - - public: - /** loads the string with the specified resource id from the FormLayer resource file + /** loads the string with the specified resource id from the FormLayer mo file */ - static OUString loadString(sal_uInt16 _nResId); + OUString loadString(const char* pResId); }; - - } diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index 2d7430ed6cfb..5c2facc6505f 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -18,7 +18,7 @@ */ -#include "frm_resource.hrc" +#include "strings.hrc" #include "frm_resource.hxx" #include "InterfaceContainer.hxx" #include "componenttools.hxx" diff --git a/forms/source/resource/frm_resource.cxx b/forms/source/resource/frm_resource.cxx index 3ae6805694c3..4a3ff363abf6 100644 --- a/forms/source/resource/frm_resource.cxx +++ b/forms/source/resource/frm_resource.cxx @@ -18,58 +18,21 @@ */ #include "frm_resource.hxx" -#include <tools/simplerm.hxx> +#include <tools/resmgr.hxx> -// needed as long as we have no contexts for components #include <vcl/svapp.hxx> #include <vcl/settings.hxx> -#include <svl/solar.hrc> - - namespace frm { - - - //= ResourceManager - - SimpleResMgr* ResourceManager::m_pImpl = nullptr; - - - ResourceManager::EnsureDelete::~EnsureDelete() - { - delete ResourceManager::m_pImpl; - } - - - void ResourceManager::ensureImplExists() + namespace ResourceManager { - if (m_pImpl) - return; - - m_pImpl = SimpleResMgr::Create("frm", Application::GetSettings().GetUILanguageTag()); - - if (m_pImpl) + OUString loadString(const char* pResId) { - // no that we have a impl class make sure it's deleted on unloading the library - static ResourceManager::EnsureDelete s_aDeleteTheImplClas; + static std::locale loc = Translate::Create("frm", Application::GetSettings().GetUILanguageTag()); + return Translate::get(pResId, loc); } } - - - OUString ResourceManager::loadString(sal_uInt16 _nResId) - { - OUString sReturn; - - ensureImplExists(); - if (m_pImpl) - sReturn = m_pImpl->ReadString(_nResId); - - return sReturn; - } - - } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/resource/strings.src b/forms/source/resource/strings.src deleted file mode 100644 index 3a252c7d78ab..000000000000 --- a/forms/source/resource/strings.src +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "frm_resource.hrc" - -String RID_BASELISTBOX_ERROR_FILLLIST -{ - Text [ en-US ] = "The contents of a combo box or list field could not be determined."; -}; - -String RID_STR_IMPORT_GRAPHIC -{ - Text [ en-US ] = "Insert Image" ; -}; - -String RID_STR_CONTROL_SUBSTITUTED_NAME -{ - Text [ en-US ] = "substituted"; -}; - -String RID_STR_CONTROL_SUBSTITUTED_EPXPLAIN -{ - Text [ en-US ] = "An error occurred while this control was being loaded. It was therefore replaced with a placeholder."; -}; - -String RID_STR_READERROR -{ - Text [ en-US ] = "Error reading data from database" ; -}; - -String RID_STR_CONNECTERROR -{ - Text [ en-US ] = "Connection failed" ; -}; - -String RID_ERR_LOADING_FORM -{ - Text [ en-US ] = "The data content could not be loaded."; -}; - -String RID_ERR_REFRESHING_FORM -{ - Text [ en-US ] = "The data content could not be updated"; -}; - -String RID_STR_ERR_INSERTRECORD -{ - Text [ en-US ] = "Error inserting the new record"; -}; - -String RID_STR_ERR_UPDATERECORD -{ - Text [ en-US ] = "Error updating the current record"; -}; - -String RID_STR_ERR_DELETERECORD -{ - Text [ en-US ] = "Error deleting the current record"; -}; - -String RID_STR_ERR_DELETERECORDS -{ - Text [ en-US ] = "Error deleting the specified records"; -}; - -String RID_STR_NEED_NON_NULL_OBJECT -{ - Text [ en-US ] = "The object cannot be NULL."; -}; - -String RID_STR_OPEN_GRAPHICS -{ - Text [ en-US ] = "Insert Image from..."; -}; - -String RID_STR_CLEAR_GRAPHICS -{ - Text [ en-US ] = "Remove Image"; -}; - -String RID_STR_INVALIDSTREAM -{ - Text [ en-US ] = "The given stream is invalid."; -}; - -String RID_STR_SYNTAXERROR -{ - Text [ en-US ] = "Syntax error in query expression" ; -}; - -String RID_STR_INCOMPATIBLE_TYPES -{ - Text [ en-US ] = "The value types supported by the binding cannot be used for exchanging data with this control."; -}; - -String RID_STR_LABEL_RECORD -{ - Text [ en-US ] = "Record"; -}; - -String RID_STR_INVALID_VALIDATOR -{ - Text [ en-US ] = "The control is connected to an external value binding, which at the same time acts as validator. You need to revoke the value binding, before you can set a new validator."; -}; - -String RID_STR_LABEL_OF -{ - Text [ en-US ] = "of"; -}; - -String RID_STR_QUERY_SAVE_MODIFIED_ROW -{ - Text [ en-US ] = "The content of the current form has been modified.\nDo you want to save your changes?"; -}; -String RID_STR_COULD_NOT_SET_ORDER -{ - Text [ en-US ] = "Error setting the sort criteria"; -}; -String RID_STR_COULD_NOT_SET_FILTER -{ - Text [ en-US ] = "Error setting the filter criteria"; -}; -String RID_STR_FEATURE_REQUIRES_PARAMETERS -{ - Text [ en-US ] = "To execute this function, parameters are needed."; -}; -String RID_STR_FEATURE_NOT_EXECUTABLE -{ - Text [ en-US ] = "This function cannot be executed, but is only for status queries."; -}; -String RID_STR_FEATURE_UNKNOWN -{ - Text [ en-US ] = "Unknown function."; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/resource/xforms.src b/forms/source/resource/xforms.src deleted file mode 100644 index 8c47e872c49c..000000000000 --- a/forms/source/resource/xforms.src +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "frm_resource.hrc" - -String RID_STR_XFORMS_NO_BINDING_EXPRESSION -{ - Text [ en-US ] = "Please enter a binding expression."; -}; - -String RID_STR_XFORMS_INVALID_BINDING_EXPRESSION -{ - Text [ en-US ] = "This is an invalid binding expression."; -}; - -String RID_STR_XFORMS_INVALID_VALUE -{ - Text [ en-US ] = "Value is invalid."; -}; - -String RID_STR_XFORMS_REQUIRED -{ - Text [ en-US ] = "A value is required."; -}; - -String RID_STR_XFORMS_INVALID_CONSTRAINT -{ - Text [ en-US ] = "The constraint '$1' not validated."; -}; - -String RID_STR_XFORMS_VALUE_IS_NOT_A -{ - Text [ en-US ] = "The value is not of the type '$2'."; -}; - -String RID_STR_XFORMS_VALUE_MAX_INCL -{ - Text [ en-US ] = "The value must be smaller than or equal to $2."; -}; - -String RID_STR_XFORMS_VALUE_MAX_EXCL -{ - Text [ en-US ] = "The value must be smaller than $2."; -}; - -String RID_STR_XFORMS_VALUE_MIN_INCL -{ - Text [ en-US ] = "The value must be greater than or equal to $2."; -}; - -String RID_STR_XFORMS_VALUE_MIN_EXCL -{ - Text [ en-US ] = "The value must be greater than $2."; -}; - -String RID_STR_XFORMS_VALUE_TOTAL_DIGITS -{ - Text [ en-US ] = "$2 digits allowed at most."; -}; - -String RID_STR_XFORMS_VALUE_FRACTION_DIGITS -{ - Text [ en-US ] = "$2 fraction digits allowed at most."; -}; - -String RID_STR_XFORMS_VALUE_LENGTH -{ - Text [ en-US ] = "The string must be $2 characters long."; -}; - -String RID_STR_XFORMS_VALUE_MIN_LENGTH -{ - Text [ en-US ] = "The string must be at least $2 characters long."; -}; - -String RID_STR_XFORMS_VALUE_MAX_LENGTH -{ - Text [ en-US ] = "The string can only be $2 characters long at most."; -}; - -String RID_STR_DATATYPE_STRING -{ - Text [ en-US ] = "String"; -}; - -String RID_STR_DATATYPE_URL -{ - Text [ en-US ] = "Hyperlink"; -}; - -String RID_STR_DATATYPE_BOOLEAN -{ - Text [ en-US ] = "True/False (Boolean)"; -}; - -String RID_STR_DATATYPE_DECIMAL -{ - Text [ en-US ] = "Decimal"; -}; - -String RID_STR_DATATYPE_FLOAT -{ - Text [ en-US ] = "Floating point"; -}; - -String RID_STR_DATATYPE_DOUBLE -{ - Text [ en-US ] = "Double"; -}; - -String RID_STR_DATATYPE_DATE -{ - Text [ en-US ] = "Date"; -}; - -String RID_STR_DATATYPE_TIME -{ - Text [ en-US ] = "Time"; -}; - -String RID_STR_DATATYPE_DATETIME -{ - Text [ en-US ] = "Date and Time"; -}; - -String RID_STR_DATATYPE_YEAR -{ - Text [ en-US ] = "Year"; -}; - -String RID_STR_DATATYPE_MONTH -{ - Text [ en-US ] = "Month"; -}; - -String RID_STR_DATATYPE_DAY -{ - Text [ en-US ] = "Day"; -}; - -String RID_STR_XFORMS_CANT_EVALUATE -{ - Text [ en-US ] = "Error during evaluation"; -}; - -String RID_STR_XFORMS_PATTERN_DOESNT_MATCH -{ - Text [ en-US ] = "The string '$1' does not match the required regular expression '$2'."; -}; - -String RID_STR_XFORMS_BINDING_UI_NAME -{ - Text [ en-US ] = "Binding" ; -}; - -String RID_STR_XFORMS_CANT_REMOVE_TYPE -{ - Text [ en-US ] = "This is a built-in type and cannot be removed." ; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx index d291bfb4649d..340b4518f7d9 100644 --- a/forms/source/runtime/formoperations.cxx +++ b/forms/source/runtime/formoperations.cxx @@ -22,7 +22,7 @@ #include "formoperations.hxx" #include "frm_strings.hxx" #include "frm_resource.hxx" -#include "frm_resource.hrc" +#include "strings.hrc" #include "services.hxx" #include <com/sun/star/ucb/AlreadyInitializedException.hpp> @@ -771,12 +771,12 @@ namespace frm default: { - sal_uInt16 nErrorResourceId = RID_STR_FEATURE_UNKNOWN; + const char* pErrorResourceId = RID_STR_FEATURE_UNKNOWN; if ( lcl_requiresArguments( _nFeature ) ) - nErrorResourceId = RID_STR_FEATURE_REQUIRES_PARAMETERS; + pErrorResourceId = RID_STR_FEATURE_REQUIRES_PARAMETERS; else if ( !lcl_isExecutableFeature( _nFeature ) ) - nErrorResourceId = RID_STR_FEATURE_NOT_EXECUTABLE; - throw IllegalArgumentException( FRM_RES_STRING( nErrorResourceId ), *this, 1 ); + pErrorResourceId = RID_STR_FEATURE_NOT_EXECUTABLE; + throw IllegalArgumentException( FRM_RES_STRING( pErrorResourceId ), *this, 1 ); } } // switch } @@ -1695,7 +1695,7 @@ namespace frm template < typename FunctObj > - void FormOperations::impl_doActionInSQLContext_throw( FunctObj f, sal_uInt16 _nErrorResourceId ) const + void FormOperations::impl_doActionInSQLContext_throw( FunctObj f, const char* pErrorResourceId ) const { try { @@ -1704,12 +1704,11 @@ namespace frm #if HAVE_FEATURE_DBCONNECTIVITY catch( const SQLException& ) { - if ( !_nErrorResourceId ) - // no information to prepend + if (!pErrorResourceId) // no information to prepend throw; SQLExceptionInfo aInfo( ::cppu::getCaughtException() ); - OUString sAdditionalError( FRM_RES_STRING( _nErrorResourceId ) ); + OUString sAdditionalError( FRM_RES_STRING( pErrorResourceId ) ); aInfo.prepend( sAdditionalError ); aInfo.doThrow(); } @@ -1717,7 +1716,7 @@ namespace frm catch( const RuntimeException& ) { throw; } catch( const Exception& ) { - OUString sAdditionalError( FRM_RES_STRING( _nErrorResourceId ) ); + OUString sAdditionalError( FRM_RES_STRING( pErrorResourceId ) ); throw WrappedTargetException( sAdditionalError, *const_cast< FormOperations* >( this ), ::cppu::getCaughtException() ); } } diff --git a/forms/source/runtime/formoperations.hxx b/forms/source/runtime/formoperations.hxx index db76e57f7df8..425e789f8419 100644 --- a/forms/source/runtime/formoperations.hxx +++ b/forms/source/runtime/formoperations.hxx @@ -290,11 +290,11 @@ namespace frm @param f a functionoid with no arguments to do the work - @param _nErrorResourceId + @param pErrorResourceId the id of the resources string to use as error message */ template < typename FunctObj > - void impl_doActionInSQLContext_throw( FunctObj f, sal_uInt16 _nErrorResourceId ) const; + void impl_doActionInSQLContext_throw( FunctObj f, const char* pErrorResourceId ) const; // functionoid to call appendOrderByColumn class impl_appendOrderByColumn_throw diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx index dd183941eb61..981a711d085e 100644 --- a/forms/source/solar/control/navtoolbar.cxx +++ b/forms/source/solar/control/navtoolbar.cxx @@ -21,7 +21,7 @@ #include "navtoolbar.hxx" #include "frm_resource.hxx" #include "featuredispatcher.hxx" -#include "frm_resource.hrc" +#include "strings.hrc" #include "commandimageprovider.hxx" #include <com/sun/star/uno/Any.hxx> @@ -52,10 +52,10 @@ namespace frm || ( _nFeatureId == LID_RECORD_FILLER ); } - OUString getLabelString( sal_uInt16 _nResId ) + OUString getLabelString(const char* pResId) { OUString sLabel( " " ); - sLabel += FRM_RES_STRING( _nResId ); + sLabel += FRM_RES_STRING(pResId); sLabel += " "; return sLabel; } diff --git a/forms/source/xforms/datatyperepository.cxx b/forms/source/xforms/datatyperepository.cxx index 6d622a1ea8c7..cafdd5ce07b3 100644 --- a/forms/source/xforms/datatyperepository.cxx +++ b/forms/source/xforms/datatyperepository.cxx @@ -20,7 +20,7 @@ #include "datatyperepository.hxx" #include "datatypes.hxx" -#include "frm_resource.hrc" +#include "strings.hrc" #include "frm_resource.hxx" #include "frm_strings.hxx" #include "property.hrc" diff --git a/forms/source/xforms/datatypes.cxx b/forms/source/xforms/datatypes.cxx index 3bd0fb0537a6..5b8373223389 100644 --- a/forms/source/xforms/datatypes.cxx +++ b/forms/source/xforms/datatypes.cxx @@ -159,26 +159,25 @@ namespace xforms sal_Bool OXSDDataType::validate( const OUString& sValue ) { - return ( _validate( sValue ) == 0 ); + return ( _validate( sValue ) == nullptr ); } OUString OXSDDataType::explainInvalid( const OUString& sValue ) { // get reason - sal_uInt16 nReason = _validate( sValue ); + const char* pReason = _validate( sValue ); // get resource and return localized string - return ( nReason == 0 ) + return (!pReason) ? OUString() - : getResource( nReason, sValue, - _explainInvalid( nReason ) ); + : getResource( pReason, sValue, + _explainInvalid( pReason ) ); } - - OUString OXSDDataType::_explainInvalid( sal_uInt16 nReason ) + OUString OXSDDataType::_explainInvalid(const OString& rReason) { - if ( RID_STR_XFORMS_PATTERN_DOESNT_MATCH == nReason ) + if ( RID_STR_XFORMS_PATTERN_DOESNT_MATCH == rReason ) { OSL_ENSURE( !m_sPattern.isEmpty(), "OXSDDataType::_explainInvalid: how can this error occur without a regular expression?" ); return m_sPattern; @@ -186,7 +185,6 @@ namespace xforms return OUString(); } - namespace { void lcl_initializePatternMatcher( ::std::unique_ptr< RegexMatcher >& _rpMatcher, const OUString& _rPattern ) @@ -215,8 +213,7 @@ namespace xforms } } - - sal_uInt16 OXSDDataType::_validate( const OUString& _rValue ) + const char* OXSDDataType::_validate( const OUString& _rValue ) { // care for the regular expression if ( !m_sPattern.isEmpty() ) @@ -233,7 +230,7 @@ namespace xforms return RID_STR_XFORMS_PATTERN_DOESNT_MATCH; } - return 0; + return nullptr; } @@ -422,66 +419,43 @@ namespace xforms return bReturn; } - - sal_uInt16 OValueLimitedType_Base::_validate( const OUString& rValue ) + const char* OValueLimitedType_Base::_validate( const OUString& rValue ) { - sal_uInt16 nReason = OXSDDataType::_validate( rValue ); - if( nReason == 0 ) + const char* pReason = OXSDDataType::_validate( rValue ); + if (!pReason) { // convert value and check format double f; if( ! _getValue( rValue, f ) ) - nReason = RID_STR_XFORMS_VALUE_IS_NOT_A; + pReason = RID_STR_XFORMS_VALUE_IS_NOT_A; // check range else if( ( m_aMaxInclusive.hasValue() ) && f > m_fCachedMaxInclusive ) - nReason = RID_STR_XFORMS_VALUE_MAX_INCL; + pReason = RID_STR_XFORMS_VALUE_MAX_INCL; else if( ( m_aMaxExclusive.hasValue() ) && f >= m_fCachedMaxExclusive ) - nReason = RID_STR_XFORMS_VALUE_MAX_EXCL; + pReason = RID_STR_XFORMS_VALUE_MAX_EXCL; else if( ( m_aMinInclusive.hasValue() ) && f < m_fCachedMinInclusive ) - nReason = RID_STR_XFORMS_VALUE_MIN_INCL; + pReason = RID_STR_XFORMS_VALUE_MIN_INCL; else if( ( m_aMinExclusive.hasValue() ) && f <= m_fCachedMinExclusive ) - nReason = RID_STR_XFORMS_VALUE_MIN_EXCL; + pReason = RID_STR_XFORMS_VALUE_MIN_EXCL; } - return nReason; + return pReason; } - - OUString OValueLimitedType_Base::_explainInvalid( sal_uInt16 nReason ) + OUString OValueLimitedType_Base::_explainInvalid(const OString& rReason) { OUStringBuffer sInfo; - switch( nReason ) - { - case 0: - // nothing to do! - break; - - case RID_STR_XFORMS_VALUE_IS_NOT_A: + if (rReason == RID_STR_XFORMS_VALUE_IS_NOT_A) sInfo.append( getName() ); - break; - - case RID_STR_XFORMS_VALUE_MAX_INCL: + else if (rReason == RID_STR_XFORMS_VALUE_MAX_INCL) sInfo.append( typedValueAsHumanReadableString( m_aMaxInclusive ) ); - break; - - case RID_STR_XFORMS_VALUE_MAX_EXCL: + else if (rReason == RID_STR_XFORMS_VALUE_MAX_EXCL) sInfo.append( typedValueAsHumanReadableString( m_aMaxExclusive ) ); - break; - - case RID_STR_XFORMS_VALUE_MIN_INCL: + else if (rReason == RID_STR_XFORMS_VALUE_MIN_INCL) sInfo.append( typedValueAsHumanReadableString( m_aMinInclusive ) ); - break; - - case RID_STR_XFORMS_VALUE_MIN_EXCL: + else if (rReason == RID_STR_XFORMS_VALUE_MIN_EXCL) sInfo.append( typedValueAsHumanReadableString( m_aMinExclusive ) ); - break; - - default: - OSL_FAIL( "OValueLimitedType::_explainInvalid: unknown reason!" ); - break; - } - return sInfo.makeStringAndClear(); } @@ -538,12 +512,12 @@ namespace xforms } - sal_uInt16 OStringType::_validate( const OUString& rValue ) + const char* OStringType::_validate( const OUString& rValue ) { // check regexp, whitespace etc. in parent class - sal_uInt16 nReason = OStringType_Base::_validate( rValue ); + const char* pReason = OStringType_Base::_validate( rValue ); - if( nReason == 0 ) + if (!pReason) { // check string constraints sal_Int32 nLength = rValue.getLength(); @@ -551,48 +525,41 @@ namespace xforms if ( m_aLength >>= nLimit ) { if ( nLimit != nLength ) - nReason = RID_STR_XFORMS_VALUE_LENGTH; + pReason = RID_STR_XFORMS_VALUE_LENGTH; } else { if ( ( m_aMaxLength >>= nLimit ) && ( nLength > nLimit ) ) - nReason = RID_STR_XFORMS_VALUE_MAX_LENGTH; + pReason = RID_STR_XFORMS_VALUE_MAX_LENGTH; else if ( ( m_aMinLength >>= nLimit ) && ( nLength < nLimit ) ) - nReason = RID_STR_XFORMS_VALUE_MIN_LENGTH; + pReason = RID_STR_XFORMS_VALUE_MIN_LENGTH; } } - return nReason; + return pReason; } - - OUString OStringType::_explainInvalid( sal_uInt16 nReason ) + OUString OStringType::_explainInvalid(const OString& rReason) { sal_Int32 nValue = 0; OUStringBuffer sInfo; - switch( nReason ) + if (rReason == RID_STR_XFORMS_VALUE_LENGTH) { - case 0: - // nothing to do! - break; - - case RID_STR_XFORMS_VALUE_LENGTH: if( m_aLength >>= nValue ) sInfo.append( nValue ); - break; - - case RID_STR_XFORMS_VALUE_MAX_LENGTH: + } + else if (rReason == RID_STR_XFORMS_VALUE_MAX_LENGTH) + { if( m_aMaxLength >>= nValue ) sInfo.append( nValue ); - break; - - case RID_STR_XFORMS_VALUE_MIN_LENGTH: + } + else if (rReason == RID_STR_XFORMS_VALUE_MIN_LENGTH) + { if( m_aMinLength >>= nValue ) sInfo.append( nValue ); - break; - - default: - sInfo.append( OStringType_Base::_explainInvalid( nReason ) ); - break; + } + else if (!rReason.isEmpty()) + { + sInfo.append(OStringType_Base::_explainInvalid(rReason)); } return sInfo.makeStringAndClear(); } @@ -612,20 +579,19 @@ namespace xforms OBooleanType_Base::initializeClone( _rCloneSource ); } - sal_uInt16 OBooleanType::_validate( const OUString& sValue ) + const char* OBooleanType::_validate( const OUString& sValue ) { - sal_uInt16 nInvalidityReason = OBooleanType_Base::_validate( sValue ); - if ( nInvalidityReason ) - return nInvalidityReason; + const char* pInvalidityReason = OBooleanType_Base::_validate( sValue ); + if ( pInvalidityReason ) + return pInvalidityReason; bool bValid = sValue == "0" || sValue == "1" || sValue == "true" || sValue == "false"; - return bValid ? 0 : RID_STR_XFORMS_INVALID_VALUE; + return bValid ? nullptr : RID_STR_XFORMS_INVALID_VALUE; } - - OUString OBooleanType::_explainInvalid( sal_uInt16 nReason ) + OUString OBooleanType::_explainInvalid(const OString& rReason) { - return ( nReason == 0 ) ? OUString() : getName(); + return rReason.isEmpty() ? OUString() : getName(); } ODecimalType::ODecimalType( const OUString& _rName, sal_Int16 _nTypeClass ) @@ -655,12 +621,12 @@ namespace xforms // validate decimals and return code for which facets failed // to be used by: ODecimalType::validate and ODecimalType::explainInvalid - sal_uInt16 ODecimalType::_validate( const OUString& rValue ) + const char* ODecimalType::_validate( const OUString& rValue ) { - sal_Int16 nReason = ODecimalType_Base::_validate( rValue ); + const char* pReason = ODecimalType_Base::_validate( rValue ); // check digits (if no other cause is available so far) - if( nReason == 0 ) + if (!pReason) { sal_Int32 nLength = rValue.getLength(); sal_Int32 n = 0; @@ -679,40 +645,36 @@ namespace xforms sal_Int32 nValue = 0; if( ( m_aTotalDigits >>= nValue ) && nTotalDigits > nValue ) - nReason = RID_STR_XFORMS_VALUE_TOTAL_DIGITS; + pReason = RID_STR_XFORMS_VALUE_TOTAL_DIGITS; else if( ( m_aFractionDigits >>= nValue ) && ( nFractionDigits > nValue ) ) - nReason = RID_STR_XFORMS_VALUE_FRACTION_DIGITS; + pReason = RID_STR_XFORMS_VALUE_FRACTION_DIGITS; } - return nReason; + return pReason; } - - OUString ODecimalType::_explainInvalid( sal_uInt16 nReason ) + OUString ODecimalType::_explainInvalid(const OString& rReason) { sal_Int32 nValue = 0; OUStringBuffer sInfo; - switch( nReason ) + if (rReason == RID_STR_XFORMS_VALUE_TOTAL_DIGITS) { - case RID_STR_XFORMS_VALUE_TOTAL_DIGITS: if( m_aTotalDigits >>= nValue ) sInfo.append( nValue ); - break; - - case RID_STR_XFORMS_VALUE_FRACTION_DIGITS: + } + else if (rReason == RID_STR_XFORMS_VALUE_FRACTION_DIGITS) + { if( m_aFractionDigits >>= nValue ) sInfo.append( nValue ); - break; - - default: - sInfo.append( ODecimalType_Base::_explainInvalid( nReason ) ); - break; + } + else + { + sInfo.append(ODecimalType_Base::_explainInvalid(rReason)); } return sInfo.makeStringAndClear(); } - OUString ODecimalType::typedValueAsHumanReadableString( const Any& _rValue ) const { double fValue( 0 ); @@ -751,7 +713,7 @@ namespace xforms DEFAULT_IMPLEMNENT_SUBTYPE( ODateType, DATE ) - sal_uInt16 ODateType::_validate( const OUString& _rValue ) + const char* ODateType::_validate( const OUString& _rValue ) { return ODateType_Base::_validate( _rValue ); } @@ -793,7 +755,7 @@ namespace xforms DEFAULT_IMPLEMNENT_SUBTYPE( OTimeType, TIME ) - sal_uInt16 OTimeType::_validate( const OUString& _rValue ) + const char* OTimeType::_validate( const OUString& _rValue ) { return OTimeType_Base::_validate( _rValue ); } @@ -841,13 +803,11 @@ namespace xforms DEFAULT_IMPLEMNENT_SUBTYPE( ODateTimeType, DATETIME ) - - sal_uInt16 ODateTimeType::_validate( const OUString& _rValue ) + const char* ODateTimeType::_validate( const OUString& _rValue ) { return ODateTimeType_Base::_validate( _rValue ); } - namespace { double lcl_normalizeDateTime( const DateTime& _rValue ) diff --git a/forms/source/xforms/datatypes.hxx b/forms/source/xforms/datatypes.hxx index 7c84694eabcc..ee00452e5b94 100644 --- a/forms/source/xforms/datatypes.hxx +++ b/forms/source/xforms/datatypes.hxx @@ -118,8 +118,8 @@ namespace xforms virtual void initializeClone( const OXSDDataType& _rCloneSource ); // helper method for validate and explainInvalid - virtual sal_uInt16 _validate( const OUString& value ); - virtual OUString _explainInvalid( sal_uInt16 nReason ); + virtual const char* _validate( const OUString& value ); + virtual OUString _explainInvalid( const OString& rReason ); // helper method for checking properties values which are to be set virtual bool checkPropertySanity( sal_Int32 _nHandle, const css::uno::Any& _rNewValue, OUString& _rErrorMessage ); @@ -177,8 +177,8 @@ namespace xforms // OXSDDataType overridables virtual bool _getValue( const OUString& value, double& fValue ); - virtual sal_uInt16 _validate( const OUString& value ) override; - virtual OUString _explainInvalid( sal_uInt16 nReason ) override; + virtual const char* _validate( const OUString& value ) override; + virtual OUString _explainInvalid( const OString& rReason ) override; // own overridables /** translate a given value into a human-readable string @@ -249,8 +249,8 @@ namespace xforms DECLARE_DEFAULT_CLONING( OBooleanType ) // OXSDDataType overridables - virtual sal_uInt16 _validate( const OUString& value ) override; - virtual OUString _explainInvalid( sal_uInt16 nReason ) override; + virtual const char* _validate( const OUString& value ) override; + virtual OUString _explainInvalid( const OString& rReason ) override; }; class OStringType; @@ -272,8 +272,8 @@ namespace xforms void initializeTypedClone( const OStringType& _rCloneSource ); // OXSDDataType overridables - virtual sal_uInt16 _validate( const OUString& value ) override; - virtual OUString _explainInvalid( sal_uInt16 nReason ) override; + virtual const char* _validate( const OUString& value ) override; + virtual OUString _explainInvalid( const OString& rReason ) override; virtual bool checkPropertySanity( sal_Int32 _nHandle, const css::uno::Any& _rNewValue, OUString& _rErrorMessage ) override; virtual void registerProperties() override; }; @@ -294,8 +294,8 @@ namespace xforms void initializeTypedClone( const ODecimalType& _rCloneSource ); // OXSDDataType overridables - virtual sal_uInt16 _validate( const OUString& value ) override; - virtual OUString _explainInvalid( sal_uInt16 nReason ) override; + virtual const char* _validate( const OUString& value ) override; + virtual OUString _explainInvalid( const OString& rReason ) override; virtual void registerProperties() override; // OValueLimitedType overridables @@ -321,7 +321,7 @@ namespace xforms DECLARE_DEFAULT_CLONING( classname ) \ \ /* OXSDDataType overridables */ \ - virtual sal_uInt16 _validate( const OUString& value ) override; \ + virtual const char* _validate( const OUString& value ) override; \ virtual bool _getValue( const OUString& value, double& fValue ) override; \ \ /* OValueLimitedType overridables */ \ diff --git a/forms/source/xforms/resourcehelper.cxx b/forms/source/xforms/resourcehelper.cxx index a0614572db5f..49ecdb5b6140 100644 --- a/forms/source/xforms/resourcehelper.cxx +++ b/forms/source/xforms/resourcehelper.cxx @@ -28,30 +28,30 @@ namespace xforms { -OUString getResource( sal_uInt16 nResourceId ) +OUString getResource(const char* pResourceId) { - return getResource( nResourceId, OUString(), OUString(), OUString() ); + return getResource(pResourceId, OUString(), OUString(), OUString()); } -OUString getResource( sal_uInt16 nResourceId, - const OUString& rInfo1 ) +OUString getResource(const char* pResourceId, + const OUString& rInfo1) { - return getResource( nResourceId, rInfo1, OUString(), OUString() ); + return getResource(pResourceId, rInfo1, OUString(), OUString()); } -OUString getResource( sal_uInt16 nResourceId, - const OUString& rInfo1, - const OUString& rInfo2 ) +OUString getResource(const char* pResourceId, + const OUString& rInfo1, + const OUString& rInfo2) { - return getResource( nResourceId, rInfo1, rInfo2, OUString() ); + return getResource(pResourceId, rInfo1, rInfo2, OUString()); } -OUString getResource( sal_uInt16 nResourceId, - const OUString& rInfo1, - const OUString& rInfo2, - const OUString& rInfo3 ) +OUString getResource(const char* pResourceId, + const OUString& rInfo1, + const OUString& rInfo2, + const OUString& rInfo3) { - OUString sResource = frm::ResourceManager::loadString( nResourceId ); + OUString sResource = frm::ResourceManager::loadString(pResourceId); OSL_ENSURE( !sResource.isEmpty(), "resource not found?" ); OUString sString( sResource ); diff --git a/forms/source/xforms/resourcehelper.hxx b/forms/source/xforms/resourcehelper.hxx index ef166dae3ad7..85a01cc74737 100644 --- a/forms/source/xforms/resourcehelper.hxx +++ b/forms/source/xforms/resourcehelper.hxx @@ -20,7 +20,7 @@ #define INCLUDED_FORMS_SOURCE_XFORMS_RESOURCEHELPER_HXX // include resource IDs -#include <frm_resource.hrc> +#include <strings.hrc> #include <sal/types.h> #include <rtl/ustring.hxx> @@ -28,15 +28,15 @@ namespace xforms { /// get a resource string for the current language - OUString getResource( sal_uInt16 ); + OUString getResource(const char*); // overloaded: get a resource string, and substitute parameters - OUString getResource( sal_uInt16, const OUString& ); - OUString getResource( sal_uInt16, const OUString&, - const OUString& ); - OUString getResource( sal_uInt16, const OUString&, + OUString getResource(const char*, const OUString&); + OUString getResource(const char*, const OUString&, + const OUString&); + OUString getResource(const char*, const OUString&, const OUString&, - const OUString& ); + const OUString&); } // namespace |