diff options
Diffstat (limited to 'extensions')
292 files changed, 5430 insertions, 6117 deletions
diff --git a/extensions/CppunitTest_extensions_bibliography.mk b/extensions/CppunitTest_extensions_bibliography.mk new file mode 100644 index 000000000000..c5503a46862e --- /dev/null +++ b/extensions/CppunitTest_extensions_bibliography.mk @@ -0,0 +1,43 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#************************************************************************* +# +# 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/. +# +#************************************************************************* + +$(eval $(call gb_CppunitTest_CppunitTest,extensions_bibliography)) + +$(eval $(call gb_CppunitTest_use_externals,extensions_bibliography,\ + boost_headers \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,extensions_bibliography, \ + extensions/qa/bibliography/bibliography \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,extensions_bibliography, \ + comphelper \ + cppu \ + sal \ + test \ + unotest \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,extensions_bibliography)) + +$(eval $(call gb_CppunitTest_use_ure,extensions_bibliography)) +$(eval $(call gb_CppunitTest_use_vcl,extensions_bibliography)) + +$(eval $(call gb_CppunitTest_use_rdb,extensions_bibliography,services)) + +$(eval $(call gb_CppunitTest_use_custom_headers,extensions_bibliography,\ + officecfg/registry \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,extensions_bibliography)) + +# vim: set noet sw=4 ts=4: diff --git a/extensions/CppunitTest_extensions_test_update.mk b/extensions/CppunitTest_extensions_test_update.mk index 02876aab74d5..da6b83a311b8 100644 --- a/extensions/CppunitTest_extensions_test_update.mk +++ b/extensions/CppunitTest_extensions_test_update.mk @@ -18,12 +18,12 @@ $(eval $(call gb_CppunitTest_add_exception_objects,extensions_test_update, \ $(eval $(call gb_CppunitTest_use_external,extensions_test_update,boost_headers)) $(eval $(call gb_CppunitTest_use_libraries,extensions_test_update, \ + comphelper \ cppu \ cppuhelper \ sal \ salhelper \ test \ - tl \ utl \ unotest \ vcl \ diff --git a/extensions/IwyuFilter_extensions.yaml b/extensions/IwyuFilter_extensions.yaml index 4dd6ee91c36e..0e0ba4c9c16c 100644 --- a/extensions/IwyuFilter_extensions.yaml +++ b/extensions/IwyuFilter_extensions.yaml @@ -1,6 +1,9 @@ --- assumeFilename: extensions/source/propctrlr/formcomponenthandler.cxx excludelist: + extensions/inc/strings.hrc: + # Needed for TranslateId macro + - unotools/resmgr.hxx extensions/source/logging/loghandler.hxx: # Don't propose hxx -> h change in URE libs - cppuhelper/interfacecontainer.hxx @@ -80,3 +83,6 @@ excludelist: extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx: # Actually used - com/sun/star/inspection/XObjectInspectorUI.hpp + extensions/source/scanner/grid.cxx: + # Needed for rtl::math::expm1 + - rtl/math.hxx diff --git a/extensions/Library_WinUserInfoBe.mk b/extensions/Library_WinUserInfoBe.mk index 34a635851a82..3e20e09419af 100644 --- a/extensions/Library_WinUserInfoBe.mk +++ b/extensions/Library_WinUserInfoBe.mk @@ -11,7 +11,11 @@ $(eval $(call gb_Library_Library,WinUserInfoBe)) -$(eval $(call gb_Library_set_componentfile,WinUserInfoBe,extensions/source/config/WinUserInfo/WinUserInfoBe)) +$(eval $(call gb_Library_set_componentfile,WinUserInfoBe,extensions/source/config/WinUserInfo/WinUserInfoBe,services)) + +$(eval $(call gb_Library_use_custom_headers,WinUserInfoBe,\ + officecfg/registry \ +)) $(eval $(call gb_Library_use_sdk_api,WinUserInfoBe)) diff --git a/extensions/Library_abp.mk b/extensions/Library_abp.mk index 0262b3a02e0b..85d0942efd25 100644 --- a/extensions/Library_abp.mk +++ b/extensions/Library_abp.mk @@ -11,7 +11,7 @@ $(eval $(call gb_Library_Library,abp)) -$(eval $(call gb_Library_set_componentfile,abp,extensions/source/abpilot/abp)) +$(eval $(call gb_Library_set_componentfile,abp,extensions/source/abpilot/abp,services)) $(eval $(call gb_Library_set_include,abp,\ $$(INCLUDE) \ diff --git a/extensions/Library_bib.mk b/extensions/Library_bib.mk index 1f04de241c23..147b8034f3e4 100644 --- a/extensions/Library_bib.mk +++ b/extensions/Library_bib.mk @@ -11,7 +11,7 @@ $(eval $(call gb_Library_Library,bib)) -$(eval $(call gb_Library_set_componentfile,bib,extensions/source/bibliography/bib)) +$(eval $(call gb_Library_set_componentfile,bib,extensions/source/bibliography/bib,services)) $(eval $(call gb_Library_set_include,bib,\ $$(INCLUDE) \ @@ -39,6 +39,7 @@ $(eval $(call gb_Library_add_exception_objects,bib,\ $(eval $(call gb_Library_use_libraries,bib,\ dbtools \ + sfx \ sot \ svt \ svl \ diff --git a/extensions/Library_dbp.mk b/extensions/Library_dbp.mk index 38c58e4f1f0d..ec5f75c127a2 100644 --- a/extensions/Library_dbp.mk +++ b/extensions/Library_dbp.mk @@ -11,7 +11,7 @@ $(eval $(call gb_Library_Library,dbp)) -$(eval $(call gb_Library_set_componentfile,dbp,extensions/source/dbpilots/dbp)) +$(eval $(call gb_Library_set_componentfile,dbp,extensions/source/dbpilots/dbp,services)) $(eval $(call gb_Library_set_include,dbp,\ $$(INCLUDE) \ diff --git a/extensions/Library_ldapbe2.mk b/extensions/Library_ldapbe2.mk index 6d81426ad53e..c08ed88f744e 100644 --- a/extensions/Library_ldapbe2.mk +++ b/extensions/Library_ldapbe2.mk @@ -11,7 +11,7 @@ $(eval $(call gb_Library_Library,ldapbe2)) -$(eval $(call gb_Library_set_componentfile,ldapbe2,extensions/source/config/ldap/ldapbe2)) +$(eval $(call gb_Library_set_componentfile,ldapbe2,extensions/source/config/ldap/ldapbe2,services)) $(eval $(call gb_Library_use_sdk_api,ldapbe2)) @@ -46,9 +46,7 @@ else # 0S!=WNT $(eval $(call gb_Library_use_externals,ldapbe2,\ boost_headers \ openldap \ - nss3 \ - plc4 \ - ssl3 \ + openssl \ )) endif diff --git a/extensions/Library_log.mk b/extensions/Library_log.mk index 4db9012adaa1..edf42d35e1dc 100644 --- a/extensions/Library_log.mk +++ b/extensions/Library_log.mk @@ -11,7 +11,7 @@ $(eval $(call gb_Library_Library,log)) -$(eval $(call gb_Library_set_componentfile,log,extensions/source/logging/log)) +$(eval $(call gb_Library_set_componentfile,log,extensions/source/logging/log,services)) $(eval $(call gb_Library_use_external,log,boost_headers)) diff --git a/extensions/Library_oleautobridge.mk b/extensions/Library_oleautobridge.mk index 6aaf5555e250..38bd19eb8f06 100644 --- a/extensions/Library_oleautobridge.mk +++ b/extensions/Library_oleautobridge.mk @@ -11,7 +11,11 @@ $(eval $(call gb_Library_Library,oleautobridge)) -$(eval $(call gb_Library_set_componentfile,oleautobridge,extensions/source/ole/oleautobridge)) +$(eval $(call gb_Library_use_custom_headers,oleautobridge,\ + officecfg/registry \ +)) + +$(eval $(call gb_Library_set_componentfile,oleautobridge,extensions/source/ole/oleautobridge,services)) $(eval $(call gb_Library_use_api,oleautobridge,\ offapi \ @@ -35,7 +39,6 @@ $(eval $(call gb_Library_use_libraries,oleautobridge,\ cppuhelper \ cppu \ sal \ - tl \ )) $(eval $(call gb_Library_use_system_win32_libs,oleautobridge,\ diff --git a/extensions/Library_pcr.mk b/extensions/Library_pcr.mk index f01c00233dee..14187b9608bc 100644 --- a/extensions/Library_pcr.mk +++ b/extensions/Library_pcr.mk @@ -11,7 +11,7 @@ $(eval $(call gb_Library_Library,pcr)) -$(eval $(call gb_Library_set_componentfile,pcr,extensions/source/propctrlr/pcr)) +$(eval $(call gb_Library_set_componentfile,pcr,extensions/source/propctrlr/pcr,services)) $(eval $(call gb_Library_use_sdk_api,pcr)) diff --git a/extensions/Library_scn.mk b/extensions/Library_scn.mk index 4fc8788e851d..51c48fbfdf68 100644 --- a/extensions/Library_scn.mk +++ b/extensions/Library_scn.mk @@ -21,7 +21,7 @@ $(eval $(call gb_Library_set_include,scn,\ $$(INCLUDE) \ )) -$(eval $(call gb_Library_set_componentfile,scn,extensions/source/scanner/scn)) +$(eval $(call gb_Library_set_componentfile,scn,extensions/source/scanner/scn,services)) $(eval $(call gb_Library_use_sdk_api,scn)) diff --git a/extensions/Library_updatecheckui.mk b/extensions/Library_updatecheckui.mk index 86c59b608389..d889defa89c2 100644 --- a/extensions/Library_updatecheckui.mk +++ b/extensions/Library_updatecheckui.mk @@ -14,7 +14,7 @@ $(eval $(call gb_Library_set_include,updatecheckui,\ $$(INCLUDE) \ )) -$(eval $(call gb_Library_set_componentfile,updatecheckui,extensions/source/update/ui/updchk)) +$(eval $(call gb_Library_set_componentfile,updatecheckui,extensions/source/update/ui/updchk,services)) $(eval $(call gb_Library_use_external,updatecheckui,boost_headers)) diff --git a/extensions/Library_updatefeed.mk b/extensions/Library_updatefeed.mk index 8b9328e30e23..5b9baa7b1be7 100644 --- a/extensions/Library_updatefeed.mk +++ b/extensions/Library_updatefeed.mk @@ -9,7 +9,7 @@ $(eval $(call gb_Library_Library,updatefeed)) -$(eval $(call gb_Library_set_componentfile,updatefeed,extensions/source/update/feed/updatefeed)) +$(eval $(call gb_Library_set_componentfile,updatefeed,extensions/source/update/feed/updatefeed,services)) $(eval $(call gb_Library_use_externals,updatefeed, \ boost_headers \ diff --git a/extensions/Library_updchk.mk b/extensions/Library_updchk.mk index c7f1a54bb65e..85c0293231fa 100644 --- a/extensions/Library_updchk.mk +++ b/extensions/Library_updchk.mk @@ -9,7 +9,7 @@ $(eval $(call gb_Library_Library,updchk)) -$(eval $(call gb_Library_set_componentfile,updchk,extensions/source/update/check/updchk.uno)) +$(eval $(call gb_Library_set_componentfile,updchk,extensions/source/update/check/updchk.uno,services)) $(eval $(call gb_Library_set_include,updchk,\ $$(INCLUDE) \ @@ -18,12 +18,16 @@ $(eval $(call gb_Library_set_include,updchk,\ $(eval $(call gb_Library_use_sdk_api,updchk)) +$(eval $(call gb_Library_use_custom_headers,updchk,\ + officecfg/registry \ +)) + $(eval $(call gb_Library_use_libraries,updchk,\ + comphelper \ cppuhelper \ cppu \ sal \ salhelper \ - tl \ utl \ vcl \ )) diff --git a/extensions/Module_extensions.mk b/extensions/Module_extensions.mk index 43a32560e64c..f7bd82978382 100644 --- a/extensions/Module_extensions.mk +++ b/extensions/Module_extensions.mk @@ -13,7 +13,7 @@ $(eval $(call gb_Module_add_l10n_targets,extensions,\ AllLangMoTarget_pcr \ )) -ifneq ($(filter-out iOS ANDROID,$(OS)),) +ifeq (,$(DISABLE_DYNLOADING)) $(eval $(call gb_Module_add_targets,extensions,\ Library_abp \ Library_scn \ @@ -42,6 +42,10 @@ $(eval $(call gb_Module_add_targets,extensions,\ Library_bib \ )) +$(eval $(call gb_Module_add_check_targets,extensions,\ + CppunitTest_extensions_bibliography \ +)) + ifneq (,$(filter DBCONNECTIVITY,$(BUILD_TYPE))) $(eval $(call gb_Module_add_targets,extensions,\ Library_dbp \ @@ -52,6 +56,7 @@ $(eval $(call gb_Module_add_targets,extensions,\ endif ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) +ifeq (,$(ENABLE_WASM_STRIP_BASIC_DRAW_MATH_IMPRESS)) $(eval $(call gb_Module_add_targets,extensions,\ Library_updatefeed \ )) @@ -67,6 +72,7 @@ $(eval $(call gb_Module_add_check_targets,extensions,\ CppunitTest_extensions_test_update \ )) endif +endif # !ENABLE_WASM_STRIP_BASIC_DRAW_MATH_IMPRESS endif ifeq ($(OS),WNT) diff --git a/extensions/README b/extensions/README deleted file mode 100644 index 38df77e37fba..000000000000 --- a/extensions/README +++ /dev/null @@ -1,45 +0,0 @@ -This module contains a grab-bag of unrelated misc. libraries, *none* of which is an extension. - -== Application online update checking == - -When we start LO, first InitUpdateCheckJobThread is created, via -UpdateCheckJob::execute() (from extensions/source/update/check/updatecheckjob.cxx), -as a reaction to a "onFirstVisibleTask" event. It waits 25 seconds (so that it -does not interfere with the startup itself), and then calls -UpdateCheck::initialize() (from extensions/source/update/check/updatecheck.cxx). - -This creates one more thread, UpdateCheckThread, that regularly checks whether -we have reached the time when we should ask for the update. If yes, asks for -that, and shows the download button in the menu (if the new update is -available). - -== OLE automation bridge == - -A bridge between "OLE automation" and UNO, so you can use UNO services -from JScript, VBScript, etc. - -https://www.openoffice.org/udk/common/man/spec/ole_bridge.html - -See udkapi/com/sun/star/bridge/oleautomation/ApplicationRegistration.idl - -This is initialized in Desktop::Main() in Desktop::OpenClients_Impl() -by creating the service "com.sun.star.bridge.OleApplicationRegistration", -which is implemented by OleServer_Impl. - -See extensions/source/ole/ - -== ActiveX control == - -This allows embedding LO into a Win32 application as an ActiveX control. -See extensions/source/activex/ - -== Spotlight provider == - -On macOS, this allows indexing ODF documents with Spotlight. -See extensions/source/macosx/spotlight/ - -== Scanner support == - -You can scan from LibreOffice, using platform specific backends like TWAIN/SANE. -See extensions/source/scanner/ - diff --git a/extensions/README.md b/extensions/README.md new file mode 100644 index 000000000000..cc32c1f825cb --- /dev/null +++ b/extensions/README.md @@ -0,0 +1,57 @@ +# Miscellaneous Modules + +This module contains a grab-bag of unrelated miscellaneous libraries, *none* of +which is an extension. + +## Application Online Update Checking + +When we start LO, first `InitUpdateCheckJobThread` is created, via +`UpdateCheckJob::execute()` (from `extensions/source/update/check/updatecheckjob.cxx`), +as a reaction to a `onFirstVisibleTask` event. It waits 25 seconds (so that it +does not interfere with the startup itself), and then calls +`UpdateCheck::initialize()` (from `extensions/source/update/check/updatecheck.cxx`). + +This creates one more thread, `UpdateCheckThread`, that regularly checks whether +we have reached the time when we should ask for the update. If yes, asks for +that, and shows the download button in the menu (if the new update is +available). + +The update server will decide if there is an update available based on the user-agent +string created by UpdateInformationProvider::getUserAgent, the data used there is +extracted from instdir/program/versionrc and the update server takes the buildid into +account, so to experiment with the updates from a dev version getUserAgent needs +to return a recognized id. + +## OLE Automation Bridge + +A bridge between "OLE automation" and UNO, so you can use UNO services +from JScript, VBScript, etc. + +<https://www.openoffice.org/udk/common/man/spec/ole_bridge.html> + +See `udkapi/com/sun/star/bridge/oleautomation/ApplicationRegistration.idl` + +This is initialized in `Desktop::Main()` in `Desktop::OpenClients_Impl()` +by creating the service `com.sun.star.bridge.OleApplicationRegistration`, +which is implemented by `OleServer_Impl`. + +See `extensions/source/ole/` + +## ActiveX Control + +This allows embedding LO into a Win32 application as an ActiveX control. + +See `extensions/source/activex/` + +## Spotlight Provider + +On macOS, this allows indexing ODF documents with Spotlight. + +See `extensions/source/macosx/spotlight/` + +## Scanner Support + +You can scan from LibreOffice, using platform specific backends like TWAIN/SANE. + +See `extensions/source/scanner/` + diff --git a/extensions/UIConfig_sbibliography.mk b/extensions/UIConfig_sbibliography.mk index cf4835829262..7b4056380912 100644 --- a/extensions/UIConfig_sbibliography.mk +++ b/extensions/UIConfig_sbibliography.mk @@ -14,6 +14,7 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/sbibliography,\ )) $(eval $(call gb_UIConfig_add_uifiles,modules/sbibliography,\ + extensions/uiconfig/sbibliography/ui/autofiltermenu \ extensions/uiconfig/sbibliography/ui/choosedatasourcedialog \ extensions/uiconfig/sbibliography/ui/combobox \ extensions/uiconfig/sbibliography/ui/editbox \ diff --git a/extensions/inc/bitmaps.hlst b/extensions/inc/bitmaps.hlst index 60a388e0c7b4..de784683b35a 100644 --- a/extensions/inc/bitmaps.hlst +++ b/extensions/inc/bitmaps.hlst @@ -10,45 +10,39 @@ #ifndef INCLUDED_EXTENSIONS_INC_BITMAPS_HRC #define INCLUDED_EXTENSIONS_INC_BITMAPS_HRC -#define RID_EXTBMP_CONTROL "res/sx10144.png" -#define RID_EXTBMP_BUTTON "res/sx10594.png" -#define RID_EXTBMP_RADIOBUTTON "res/sx10595.png" -#define RID_EXTBMP_CHECKBOX "res/sx10596.png" -#define RID_EXTBMP_FIXEDTEXT "res/sx10597.png" -#define RID_EXTBMP_GROUPBOX "res/sx10598.png" -#define RID_EXTBMP_EDITBOX "res/sx10599.png" -#define RID_EXTBMP_LISTBOX "res/sx10600.png" -#define RID_EXTBMP_COMBOBOX "res/sx10601.png" -#define RID_EXTBMP_GRID "res/sx10603.png" -#define RID_EXTBMP_IMAGEBUTTON "res/sx10604.png" -#define RID_EXTBMP_FILECONTROL "res/sx10605.png" -#define RID_EXTBMP_DATEFIELD "res/sx10704.png" -#define RID_EXTBMP_TIMEFIELD "res/sx10705.png" -#define RID_EXTBMP_NUMERICFIELD "res/sx10706.png" -#define RID_EXTBMP_CURRENCYFIELD "res/sx10707.png" -#define RID_EXTBMP_PATTERNFIELD "res/sx10708.png" -#define RID_EXTBMP_IMAGECONTROL "res/sx10710.png" -#define RID_EXTBMP_HIDDEN "res/sx18022.png" -#define RID_EXTBMP_FORMATTEDFIELD "res/sx10728.png" -#define RID_EXTBMP_FILTER "res/sx10715.png" -#define RID_EXTBMP_FORMS "res/sx18013.png" -#define RID_EXTBMP_FORM "res/sx10593.png" -#define RID_EXTBMP_COLLAPSEDNODE "res/sx18002.png" -#define RID_EXTBMP_EXPANDEDNODE "res/sx18003.png" -#define RID_EXTBMP_SCROLLBAR "res/sx10768.png" -#define RID_EXTBMP_SPINBUTTON "res/sx10769.png" -#define RID_EXTBMP_NAVIGATIONBAR "res/sx10607.png" -#define RID_UPDATE_AVAILABLE_16 "extensions/res/update/ui/onlineupdate_16.png" -#define RID_UPDATE_AVAILABLE_26 "extensions/res/update/ui/onlineupdate_26.png" -#define RID_SCANNER_HANDLE "extensions/res/scanner/handle.png" -#define BMP_TABLE "res/sx03188.png" -#define BMP_QUERY "res/sx03202.png" -#define RID_EXTBMP_AUTOFILTER_SC "res/sc10716.png" -#define RID_EXTBMP_FILTERCRIT_SC "res/sc10715.png" -#define RID_EXTBMP_REMOVE_FILTER_SORT_SC "res/sc10711.png" -#define RID_EXTBMP_AUTOFILTER_LC "res/lc10716.png" -#define RID_EXTBMP_FILTERCRIT_LC "res/lc10715.png" -#define RID_EXTBMP_REMOVE_FILTER_SORT_LC "res/lc10711.png" +inline constexpr OUString RID_EXTBMP_CONTROL = u"res/sx10144.png"_ustr; +inline constexpr OUString RID_EXTBMP_BUTTON = u"res/sx10594.png"_ustr; +inline constexpr OUString RID_EXTBMP_RADIOBUTTON = u"res/sx10595.png"_ustr; +inline constexpr OUString RID_EXTBMP_CHECKBOX = u"res/sx10596.png"_ustr; +inline constexpr OUString RID_EXTBMP_FIXEDTEXT = u"res/sx10597.png"_ustr; +inline constexpr OUString RID_EXTBMP_GROUPBOX = u"res/sx10598.png"_ustr; +inline constexpr OUString RID_EXTBMP_EDITBOX = u"res/sx10599.png"_ustr; +inline constexpr OUString RID_EXTBMP_LISTBOX = u"res/sx10600.png"_ustr; +inline constexpr OUString RID_EXTBMP_COMBOBOX = u"res/sx10601.png"_ustr; +inline constexpr OUString RID_EXTBMP_GRID = u"res/sx10603.png"_ustr; +inline constexpr OUString RID_EXTBMP_IMAGEBUTTON = u"res/sx10604.png"_ustr; +inline constexpr OUString RID_EXTBMP_FILECONTROL = u"res/sx10605.png"_ustr; +inline constexpr OUString RID_EXTBMP_DATEFIELD = u"res/sx10704.png"_ustr; +inline constexpr OUString RID_EXTBMP_TIMEFIELD = u"res/sx10705.png"_ustr; +inline constexpr OUString RID_EXTBMP_NUMERICFIELD = u"res/sx10706.png"_ustr; +inline constexpr OUString RID_EXTBMP_CURRENCYFIELD = u"res/sx10707.png"_ustr; +inline constexpr OUString RID_EXTBMP_PATTERNFIELD = u"res/sx10708.png"_ustr; +inline constexpr OUString RID_EXTBMP_IMAGECONTROL = u"res/sx10710.png"_ustr; +inline constexpr OUString RID_EXTBMP_HIDDEN = u"res/sx18022.png"_ustr; +inline constexpr OUString RID_EXTBMP_FORMS = u"res/sx18013.png"_ustr; +inline constexpr OUString RID_EXTBMP_FORM = u"res/sx10593.png"_ustr; +inline constexpr OUString RID_EXTBMP_SCROLLBAR = u"res/sx10768.png"_ustr; +inline constexpr OUString RID_EXTBMP_SPINBUTTON = u"res/sx10769.png"_ustr; +inline constexpr OUString RID_EXTBMP_NAVIGATIONBAR = u"res/sx10607.png"_ustr; +inline constexpr OUString RID_SCANNER_HANDLE = u"extensions/res/scanner/handle.png"_ustr; +inline constexpr OUString BMP_TABLE = u"res/sx03188.png"_ustr; +inline constexpr OUString BMP_QUERY = u"res/sx03202.png"_ustr; +inline constexpr OUString RID_EXTBMP_AUTOFILTER_SC = u"res/sc10716.png"_ustr; +inline constexpr OUString RID_EXTBMP_FILTERCRIT_SC = u"res/sc10715.png"_ustr; +inline constexpr OUString RID_EXTBMP_REMOVE_FILTER_SORT_SC = u"res/sc10711.png"_ustr; +inline constexpr OUString RID_EXTBMP_AUTOFILTER_LC = u"res/lc10716.png"_ustr; +inline constexpr OUString RID_EXTBMP_FILTERCRIT_LC = u"res/lc10715.png"_ustr; +inline constexpr OUString RID_EXTBMP_REMOVE_FILTER_SORT_LC = u"res/lc10711.png"_ustr; #define SV_RESID_BITMAP_INFOBOX "vcl/res/infobox.png" #endif diff --git a/extensions/inc/command.hrc b/extensions/inc/command.hrc index 8ae09743b154..fe77e4940847 100644 --- a/extensions/inc/command.hrc +++ b/extensions/inc/command.hrc @@ -20,11 +20,13 @@ #ifndef INCLUDED_EXTENSIONS_INC_COMMAND_HRC #define INCLUDED_EXTENSIONS_INC_COMMAND_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#include <unotools/resmgr.hxx> + +#define NC_(Context, String) TranslateId(Context, u8##String) namespace { -const char* RID_RSC_ENUM_COMMAND_TYPE[] = +const TranslateId RID_RSC_ENUM_COMMAND_TYPE[] = { NC_("RID_RSC_ENUM_COMMAND_TYPE", "Table"), NC_("RID_RSC_ENUM_COMMAND_TYPE", "Query"), diff --git a/extensions/inc/helpids.h b/extensions/inc/helpids.h index 1f55a0fd1995..345af0c05430 100644 --- a/extensions/inc/helpids.h +++ b/extensions/inc/helpids.h @@ -20,306 +20,296 @@ #ifndef EXTENSIONS_HELPIDS_H #define EXTENSIONS_HELPIDS_H -#define HID_ABSPILOT_PREVIOUS "EXTENSIONS_HID_ABSPILOT_PREVIOUS" -#define HID_ABSPILOT_NEXT "EXTENSIONS_HID_ABSPILOT_NEXT" -#define HID_ABSPILOT_CANCEL "EXTENSIONS_HID_ABSPILOT_CANCEL" -#define HID_ABSPILOT_FINISH "EXTENSIONS_HID_ABSPILOT_FINISH" -#define UID_ABSPILOT_HELP "EXTENSIONS_UID_ABSPILOT_HELP" -#define HID_ABSPILOT "EXTENSIONS_HID_ABSPILOT" +#include <rtl/ustring.hxx> -#define HID_BIB_IDENTIFIER_POS "EXTENSIONS_HID_BIB_IDENTIFIER_POS" -#define HID_BIB_AUTHORITYTYPE_POS "EXTENSIONS_HID_BIB_AUTHORITYTYPE_POS" -#define HID_BIB_AUTHOR_POS "EXTENSIONS_HID_BIB_AUTHOR_POS" -#define HID_BIB_TITLE_POS "EXTENSIONS_HID_BIB_TITLE_POS" -#define HID_BIB_YEAR_POS "EXTENSIONS_HID_BIB_YEAR_POS" -#define HID_BIB_ISBN_POS "EXTENSIONS_HID_BIB_ISBN_POS" -#define HID_BIB_BOOKTITLE_POS "EXTENSIONS_HID_BIB_BOOKTITLE_POS" -#define HID_BIB_CHAPTER_POS "EXTENSIONS_HID_BIB_CHAPTER_POS" -#define HID_BIB_EDITION_POS "EXTENSIONS_HID_BIB_EDITION_POS" -#define HID_BIB_EDITOR_POS "EXTENSIONS_HID_BIB_EDITOR_POS" -#define HID_BIB_HOWPUBLISHED_POS "EXTENSIONS_HID_BIB_HOWPUBLISHED_POS" -#define HID_BIB_INSTITUTION_POS "EXTENSIONS_HID_BIB_INSTITUTION_POS" -#define HID_BIB_JOURNAL_POS "EXTENSIONS_HID_BIB_JOURNAL_POS" -#define HID_BIB_MONTH_POS "EXTENSIONS_HID_BIB_MONTH_POS" -#define HID_BIB_NOTE_POS "EXTENSIONS_HID_BIB_NOTE_POS" -#define HID_BIB_ANNOTE_POS "EXTENSIONS_HID_BIB_ANNOTE_POS" -#define HID_BIB_NUMBER_POS "EXTENSIONS_HID_BIB_NUMBER_POS" -#define HID_BIB_ORGANIZATIONS_POS "EXTENSIONS_HID_BIB_ORGANIZATIONS_POS" -#define HID_BIB_PAGES_POS "EXTENSIONS_HID_BIB_PAGES_POS" -#define HID_BIB_PUBLISHER_POS "EXTENSIONS_HID_BIB_PUBLISHER_POS" -#define HID_BIB_ADDRESS_POS "EXTENSIONS_HID_BIB_ADDRESS_POS" -#define HID_BIB_SCHOOL_POS "EXTENSIONS_HID_BIB_SCHOOL_POS" -#define HID_BIB_SERIES_POS "EXTENSIONS_HID_BIB_SERIES_POS" -#define HID_BIB_REPORTTYPE_POS "EXTENSIONS_HID_BIB_REPORTTYPE_POS" -#define HID_BIB_VOLUME_POS "EXTENSIONS_HID_BIB_VOLUME_POS" -#define HID_BIB_URL_POS "EXTENSIONS_HID_BIB_URL_POS" -#define HID_BIB_CUSTOM1_POS "EXTENSIONS_HID_BIB_CUSTOM1_POS" -#define HID_BIB_CUSTOM2_POS "EXTENSIONS_HID_BIB_CUSTOM2_POS" -#define HID_BIB_CUSTOM3_POS "EXTENSIONS_HID_BIB_CUSTOM3_POS" -#define HID_BIB_CUSTOM4_POS "EXTENSIONS_HID_BIB_CUSTOM4_POS" -#define HID_BIB_CUSTOM5_POS "EXTENSIONS_HID_BIB_CUSTOM5_POS" +inline constexpr OUString HID_ABSPILOT_PREVIOUS = u"EXTENSIONS_HID_ABSPILOT_PREVIOUS"_ustr; +inline constexpr OUString HID_ABSPILOT_NEXT = u"EXTENSIONS_HID_ABSPILOT_NEXT"_ustr; +inline constexpr OUString HID_ABSPILOT_CANCEL = u"EXTENSIONS_HID_ABSPILOT_CANCEL"_ustr; +inline constexpr OUString HID_ABSPILOT_FINISH = u"EXTENSIONS_HID_ABSPILOT_FINISH"_ustr; +inline constexpr OUString UID_ABSPILOT_HELP = u"EXTENSIONS_UID_ABSPILOT_HELP"_ustr; +inline constexpr OUString HID_ABSPILOT = u"EXTENSIONS_HID_ABSPILOT"_ustr; + +inline constexpr OUString HID_BIB_IDENTIFIER_POS = u"EXTENSIONS_HID_BIB_IDENTIFIER_POS"_ustr; +inline constexpr OUString HID_BIB_AUTHORITYTYPE_POS = u"EXTENSIONS_HID_BIB_AUTHORITYTYPE_POS"_ustr; +inline constexpr OUString HID_BIB_AUTHOR_POS = u"EXTENSIONS_HID_BIB_AUTHOR_POS"_ustr; +inline constexpr OUString HID_BIB_TITLE_POS = u"EXTENSIONS_HID_BIB_TITLE_POS"_ustr; +inline constexpr OUString HID_BIB_YEAR_POS = u"EXTENSIONS_HID_BIB_YEAR_POS"_ustr; +inline constexpr OUString HID_BIB_ISBN_POS = u"EXTENSIONS_HID_BIB_ISBN_POS"_ustr; +inline constexpr OUString HID_BIB_BOOKTITLE_POS = u"EXTENSIONS_HID_BIB_BOOKTITLE_POS"_ustr; +inline constexpr OUString HID_BIB_CHAPTER_POS = u"EXTENSIONS_HID_BIB_CHAPTER_POS"_ustr; +inline constexpr OUString HID_BIB_EDITION_POS = u"EXTENSIONS_HID_BIB_EDITION_POS"_ustr; +inline constexpr OUString HID_BIB_EDITOR_POS = u"EXTENSIONS_HID_BIB_EDITOR_POS"_ustr; +inline constexpr OUString HID_BIB_HOWPUBLISHED_POS = u"EXTENSIONS_HID_BIB_HOWPUBLISHED_POS"_ustr; +inline constexpr OUString HID_BIB_INSTITUTION_POS = u"EXTENSIONS_HID_BIB_INSTITUTION_POS"_ustr; +inline constexpr OUString HID_BIB_JOURNAL_POS = u"EXTENSIONS_HID_BIB_JOURNAL_POS"_ustr; +inline constexpr OUString HID_BIB_MONTH_POS = u"EXTENSIONS_HID_BIB_MONTH_POS"_ustr; +inline constexpr OUString HID_BIB_NOTE_POS = u"EXTENSIONS_HID_BIB_NOTE_POS"_ustr; +inline constexpr OUString HID_BIB_ANNOTE_POS = u"EXTENSIONS_HID_BIB_ANNOTE_POS"_ustr; +inline constexpr OUString HID_BIB_NUMBER_POS = u"EXTENSIONS_HID_BIB_NUMBER_POS"_ustr; +inline constexpr OUString HID_BIB_ORGANIZATIONS_POS = u"EXTENSIONS_HID_BIB_ORGANIZATIONS_POS"_ustr; +inline constexpr OUString HID_BIB_PAGES_POS = u"EXTENSIONS_HID_BIB_PAGES_POS"_ustr; +inline constexpr OUString HID_BIB_PUBLISHER_POS = u"EXTENSIONS_HID_BIB_PUBLISHER_POS"_ustr; +inline constexpr OUString HID_BIB_ADDRESS_POS = u"EXTENSIONS_HID_BIB_ADDRESS_POS"_ustr; +inline constexpr OUString HID_BIB_SCHOOL_POS = u"EXTENSIONS_HID_BIB_SCHOOL_POS"_ustr; +inline constexpr OUString HID_BIB_SERIES_POS = u"EXTENSIONS_HID_BIB_SERIES_POS"_ustr; +inline constexpr OUString HID_BIB_REPORTTYPE_POS = u"EXTENSIONS_HID_BIB_REPORTTYPE_POS"_ustr; +inline constexpr OUString HID_BIB_VOLUME_POS = u"EXTENSIONS_HID_BIB_VOLUME_POS"_ustr; +inline constexpr OUString HID_BIB_URL_POS = u"EXTENSIONS_HID_BIB_URL_POS"_ustr; +inline constexpr OUString HID_BIB_CUSTOM1_POS = u"EXTENSIONS_HID_BIB_CUSTOM1_POS"_ustr; +inline constexpr OUString HID_BIB_CUSTOM2_POS = u"EXTENSIONS_HID_BIB_CUSTOM2_POS"_ustr; +inline constexpr OUString HID_BIB_CUSTOM3_POS = u"EXTENSIONS_HID_BIB_CUSTOM3_POS"_ustr; +inline constexpr OUString HID_BIB_CUSTOM4_POS = u"EXTENSIONS_HID_BIB_CUSTOM4_POS"_ustr; +inline constexpr OUString HID_BIB_CUSTOM5_POS = u"EXTENSIONS_HID_BIB_CUSTOM5_POS"_ustr; +inline constexpr OUString HID_BIB_LOCAL_URL_POS = u"EXTENSIONS_HID_BIB_LOCAL_URL_POS"_ustr; #define HID_BIB_DB_GRIDCTRL "EXTENSIONS_HID_BIB_DB_GRIDCTRL" -#define HID_GROUPWIZARD_PREVIOUS "EXTENSIONS_HID_GROUPWIZARD_PREVIOUS" -#define HID_GROUPWIZARD_NEXT "EXTENSIONS_HID_GROUPWIZARD_NEXT" -#define HID_GROUPWIZARD_CANCEL "EXTENSIONS_HID_GROUPWIZARD_CANCEL" -#define HID_GROUPWIZARD_FINISH "EXTENSIONS_HID_GROUPWIZARD_FINISH" -#define HID_LISTWIZARD_PREVIOUS "EXTENSIONS_HID_LISTWIZARD_PREVIOUS" -#define HID_LISTWIZARD_NEXT "EXTENSIONS_HID_LISTWIZARD_NEXT" -#define HID_LISTWIZARD_CANCEL "EXTENSIONS_HID_LISTWIZARD_CANCEL" -#define HID_LISTWIZARD_FINISH "EXTENSIONS_HID_LISTWIZARD_FINISH" -#define HID_GRIDWIZARD_PREVIOUS "EXTENSIONS_HID_GRIDWIZARD_PREVIOUS" -#define HID_GRIDWIZARD_NEXT "EXTENSIONS_HID_GRIDWIZARD_NEXT" -#define HID_GRIDWIZARD_CANCEL "EXTENSIONS_HID_GRIDWIZARD_CANCEL" -#define HID_GRIDWIZARD_FINISH "EXTENSIONS_HID_GRIDWIZARD_FINISH" +inline constexpr OUString HID_GROUPWIZARD_PREVIOUS = u"EXTENSIONS_HID_GROUPWIZARD_PREVIOUS"_ustr; +inline constexpr OUString HID_GROUPWIZARD_NEXT = u"EXTENSIONS_HID_GROUPWIZARD_NEXT"_ustr; +inline constexpr OUString HID_GROUPWIZARD_CANCEL = u"EXTENSIONS_HID_GROUPWIZARD_CANCEL"_ustr; +inline constexpr OUString HID_GROUPWIZARD_FINISH = u"EXTENSIONS_HID_GROUPWIZARD_FINISH"_ustr; +inline constexpr OUString HID_LISTWIZARD_PREVIOUS = u"EXTENSIONS_HID_LISTWIZARD_PREVIOUS"_ustr; +inline constexpr OUString HID_LISTWIZARD_NEXT = u"EXTENSIONS_HID_LISTWIZARD_NEXT"_ustr; +inline constexpr OUString HID_LISTWIZARD_CANCEL = u"EXTENSIONS_HID_LISTWIZARD_CANCEL"_ustr; +inline constexpr OUString HID_LISTWIZARD_FINISH = u"EXTENSIONS_HID_LISTWIZARD_FINISH"_ustr; +inline constexpr OUString HID_GRIDWIZARD_PREVIOUS = u"EXTENSIONS_HID_GRIDWIZARD_PREVIOUS"_ustr; +inline constexpr OUString HID_GRIDWIZARD_NEXT = u"EXTENSIONS_HID_GRIDWIZARD_NEXT"_ustr; +inline constexpr OUString HID_GRIDWIZARD_CANCEL = u"EXTENSIONS_HID_GRIDWIZARD_CANCEL"_ustr; +inline constexpr OUString HID_GRIDWIZARD_FINISH = u"EXTENSIONS_HID_GRIDWIZARD_FINISH"_ustr; -#define HID_PROP_INPUT_REQUIRED "EXTENSIONS_HID_PROP_INPUT_REQUIRED" -#define HID_PROP_GROUPBOX "EXTENSIONS_HID_PROP_GROUPBOX" -#define HID_PROP_CONTROLSOURCE "EXTENSIONS_HID_PROP_CONTROLSOURCE" -#define HID_PROP_NAME "EXTENSIONS_HID_PROP_NAME" -#define HID_PROP_TABINDEX "EXTENSIONS_HID_PROP_TABINDEX" -#define HID_PROP_MASTERFIELDS "EXTENSIONS_HID_PROP_MASTERFIELDS" -#define HID_PROP_SLAVEFIELDS "EXTENSIONS_HID_PROP_SLAVEFIELDS" -#define HID_PROP_DATASOURCE "EXTENSIONS_HID_PROP_DATASOURCE" -#define HID_PROP_CURSORSOURCE "EXTENSIONS_HID_PROP_CURSORSOURCE" -#define HID_PROP_CURSORSOURCETYPE "EXTENSIONS_HID_PROP_CURSORSOURCETYPE" -#define HID_PROP_CURSORTYPE "EXTENSIONS_HID_PROP_CURSORTYPE" -#define HID_PROP_READONLY "EXTENSIONS_HID_PROP_READONLY" -#define HID_PROP_DATAENTRY "EXTENSIONS_HID_PROP_DATAENTRY" -#define HID_PROP_NAVIGATION "EXTENSIONS_HID_PROP_NAVIGATION" -#define HID_PROP_CYCLE "EXTENSIONS_HID_PROP_CYCLE" -#define HID_PROP_ALLOW_ADDITIONS "EXTENSIONS_HID_PROP_ALLOW_ADDITIONS" -#define HID_PROP_ALLOW_EDITS "EXTENSIONS_HID_PROP_ALLOW_EDITS" -#define HID_PROP_ALLOW_DELETIONS "EXTENSIONS_HID_PROP_ALLOW_DELETIONS" -#define HID_PROP_DIRTY "EXTENSIONS_HID_PROP_DIRTY" -#define HID_PROP_OLDVALUE "EXTENSIONS_HID_PROP_OLDVALUE" -#define HID_PROP_VALUE "EXTENSIONS_HID_PROP_VALUE" -#define HID_PROP_LOCKED "EXTENSIONS_HID_PROP_LOCKED" -#define HID_PROP_FORMATKEY "EXTENSIONS_HID_PROP_FORMATKEY" -#define HID_PROP_REQUIRED "EXTENSIONS_HID_PROP_REQUIRED" -#define HID_PROP_WHEEL_BEHAVIOR "EXTENSIONS_HID_PROP_WHEEL_BEHAVIOR" -#define HID_PROP_UNIQUE "EXTENSIONS_HID_PROP_UNIQUE" -#define HID_PROP_CLASSID "EXTENSIONS_HID_PROP_CLASSID" -#define HID_PROP_LEFT "EXTENSIONS_HID_PROP_LEFT" -#define HID_PROP_RIGHT "EXTENSIONS_HID_PROP_RIGHT" -#define HID_PROP_HEIGHT "EXTENSIONS_HID_PROP_HEIGHT" -#define HID_PROP_WIDTH "EXTENSIONS_HID_PROP_WIDTH" -#define HID_PROP_AUTOGROW "EXTENSIONS_HID_PROP_AUTOGROW" -#define HID_PROP_BOUNDCOLUMN "EXTENSIONS_HID_PROP_BOUNDCOLUMN" -#define HID_PROP_LISTSOURCETYPE "EXTENSIONS_HID_PROP_LISTSOURCETYPE" -#define HID_PROP_LISTSOURCE "EXTENSIONS_HID_PROP_LISTSOURCE" -#define HID_PROP_LISTINDEX "EXTENSIONS_HID_PROP_LISTINDEX" -#define HID_PROP_TEXT "EXTENSIONS_HID_PROP_TEXT" -#define HID_PROP_LABEL "EXTENSIONS_HID_PROP_LABEL" -#define HID_PROP_STRINGITEMLIST "EXTENSIONS_HID_PROP_STRINGITEMLIST" -#define HID_PROP_SEARCHING "EXTENSIONS_HID_PROP_SEARCHING" -#define HID_PROP_FONT "EXTENSIONS_HID_PROP_FONT" -#define HID_PROP_ROWHEIGHT "EXTENSIONS_HID_PROP_ROWHEIGHT" -#define HID_PROP_BACKGROUNDCOLOR "EXTENSIONS_HID_PROP_BACKGROUNDCOLOR" -#define HID_PROP_FILLCOLOR "EXTENSIONS_HID_PROP_FILLCOLOR" -#define HID_PROP_LINECOLOR "EXTENSIONS_HID_PROP_LINECOLOR" -#define HID_PROP_BORDER "EXTENSIONS_HID_PROP_BORDER" -#define HID_PROP_ALIGN "EXTENSIONS_HID_PROP_ALIGN" -#define HID_PROP_VERTICAL_ALIGN "EXTENSIONS_HID_PROP_VERTICAL_ALIGN" -#define HID_PROP_DROPDOWN "EXTENSIONS_HID_PROP_DROPDOWN" -#define HID_PROP_MULTILINE "EXTENSIONS_HID_PROP_MULTILINE" -#define HID_PROP_HSCROLL "EXTENSIONS_HID_PROP_HSCROLL" -#define HID_PROP_VSCROLL "EXTENSIONS_HID_PROP_VSCROLL" -#define HID_PROP_TABSTOP "EXTENSIONS_HID_PROP_TABSTOP" -#define HID_PROP_REFVALUE "EXTENSIONS_HID_PROP_REFVALUE" -#define HID_PROP_BUTTONTYPE "EXTENSIONS_HID_PROP_BUTTONTYPE" -#define HID_PROP_SUBMIT_ACTION "EXTENSIONS_HID_PROP_SUBMIT_ACTION" -#define HID_PROP_SUBMIT_METHOD "EXTENSIONS_HID_PROP_SUBMIT_METHOD" -#define HID_PROP_SUBMIT_ENCODING "EXTENSIONS_HID_PROP_SUBMIT_ENCODING" -#define HID_PROP_DEFAULTVALUE "EXTENSIONS_HID_PROP_DEFAULTVALUE" -#define HID_PROP_SUBMIT_TARGET "EXTENSIONS_HID_PROP_SUBMIT_TARGET" -#define HID_PROP_DEFAULT_STATE "EXTENSIONS_HID_PROP_DEFAULT_STATE" -#define HID_PROP_IMAGE_URL "EXTENSIONS_HID_PROP_IMAGE_URL" -#define HID_PROP_DEFAULT_SELECT_SEQ "EXTENSIONS_HID_PROP_DEFAULT_SELECT_SEQ" -#define HID_PROP_MULTISELECTION "EXTENSIONS_HID_PROP_MULTISELECTION" -#define HID_PROP_DATE "EXTENSIONS_HID_PROP_DATE" -#define HID_PROP_DATEMIN "EXTENSIONS_HID_PROP_DATEMIN" -#define HID_PROP_DATEMAX "EXTENSIONS_HID_PROP_DATEMAX" -#define HID_PROP_DATEFORMAT "EXTENSIONS_HID_PROP_DATEFORMAT" -#define HID_PROP_TIME "EXTENSIONS_HID_PROP_TIME" -#define HID_PROP_TIMEMIN "EXTENSIONS_HID_PROP_TIMEMIN" -#define HID_PROP_TIMEMAX "EXTENSIONS_HID_PROP_TIMEMAX" -#define HID_PROP_TIMEFORMAT "EXTENSIONS_HID_PROP_TIMEFORMAT" -#define HID_PROP_VALUEMIN "EXTENSIONS_HID_PROP_VALUEMIN" -#define HID_PROP_VALUEMAX "EXTENSIONS_HID_PROP_VALUEMAX" -#define HID_PROP_VALUESTEP "EXTENSIONS_HID_PROP_VALUESTEP" -#define HID_PROP_CURRENCYSYMBOL "EXTENSIONS_HID_PROP_CURRENCYSYMBOL" -#define HID_PROP_EDITMASK "EXTENSIONS_HID_PROP_EDITMASK" -#define HID_PROP_LITERALMASK "EXTENSIONS_HID_PROP_LITERALMASK" -#define HID_PROP_ENABLED "EXTENSIONS_HID_PROP_ENABLED" -#define HID_PROP_AUTOCOMPLETE "EXTENSIONS_HID_PROP_AUTOCOMPLETE" -#define HID_PROP_LINECOUNT "EXTENSIONS_HID_PROP_LINECOUNT" -#define HID_PROP_MAXTEXTLEN "EXTENSIONS_HID_PROP_MAXTEXTLEN" -#define HID_PROP_SPIN "EXTENSIONS_HID_PROP_SPIN" -#define HID_PROP_STRICTFORMAT "EXTENSIONS_HID_PROP_STRICTFORMAT" -#define HID_PROP_SHOWTHOUSANDSEP "EXTENSIONS_HID_PROP_SHOWTHOUSANDSEP" -#define HID_PROP_PRINTABLE "EXTENSIONS_HID_PROP_PRINTABLE" -#define HID_PROP_TARGET_URL "EXTENSIONS_HID_PROP_TARGET_URL" -#define HID_PROP_TARGET_FRAME "EXTENSIONS_HID_PROP_TARGET_FRAME" -#define HID_PROP_TAG "EXTENSIONS_HID_PROP_TAG" -#define HID_PROP_ECHO_CHAR "EXTENSIONS_HID_PROP_ECHO_CHAR" -#define HID_PROP_EMPTY_IS_NULL "EXTENSIONS_HID_PROP_EMPTY_IS_NULL" -#define HID_PROP_DECIMAL_ACCURACY "EXTENSIONS_HID_PROP_DECIMAL_ACCURACY" -#define HID_PROP_ENABLE_VISIBLE "EXTENSIONS_HID_PROP_ENABLE_VISIBLE" -#define HID_PROP_DEFAULT_BUTTON "EXTENSIONS_HID_PROP_DEFAULT_BUTTON" -#define HID_PROP_HIDDEN_VALUE "EXTENSIONS_HID_PROP_HIDDEN_VALUE" -#define HID_PROP_TRISTATE "EXTENSIONS_HID_PROP_TRISTATE" -#define HID_PROP_NAVIGATIONBAR "EXTENSIONS_HID_PROP_NAVIGATIONBAR" -#define HID_PROP_FILTER "EXTENSIONS_HID_PROP_FILTER" -#define HID_PROP_SORT_CRITERIA "EXTENSIONS_HID_PROP_SORT_CRITERIA" -#define HID_PROP_DEFAULT_LONG_VALUE "EXTENSIONS_HID_PROP_DEFAULT_LONG_VALUE" -#define HID_PROP_DEFAULT_TIME "EXTENSIONS_HID_PROP_DEFAULT_TIME" -#define HID_PROP_DEFAULT_DATE "EXTENSIONS_HID_PROP_DEFAULT_DATE" -#define HID_PROP_HELPTEXT "EXTENSIONS_HID_PROP_HELPTEXT" -#define HID_PROP_HELPURL "EXTENSIONS_HID_PROP_HELPURL" -#define HID_PROP_RECORDMARKER "EXTENSIONS_HID_PROP_RECORDMARKER" -#define HID_PROP_FILTERPROPOSAL "EXTENSIONS_HID_PROP_FILTERPROPOSAL" -#define HID_PROP_EFFECTIVEMIN "EXTENSIONS_HID_PROP_EFFECTIVEMIN" -#define HID_PROP_EFFECTIVEMAX "EXTENSIONS_HID_PROP_EFFECTIVEMAX" -#define HID_PROP_EFFECTIVEDEFAULT "EXTENSIONS_HID_PROP_EFFECTIVEDEFAULT" -#define HID_PROP_CONTROLLABEL "EXTENSIONS_HID_PROP_CONTROLLABEL" -#define HID_PROP_CURRSYM_POSITION "EXTENSIONS_HID_PROP_CURRSYM_POSITION" -#define HID_PROP_ESCAPE_PROCESSING "EXTENSIONS_HID_PROP_ESCAPE_PROCESSING" -#define HID_PROP_TITLE "EXTENSIONS_HID_PROP_TITLE" -#define HID_PROP_STEP "EXTENSIONS_HID_PROP_STEP" -#define HID_PROP_PROGRESSVALUE "EXTENSIONS_HID_PROP_PROGRESSVALUE" -#define HID_PROP_PROGRESSVALUE_MIN "EXTENSIONS_HID_PROP_PROGRESSVALUE_MIN" -#define HID_PROP_PROGRESSVALUE_MAX "EXTENSIONS_HID_PROP_PROGRESSVALUE_MAX" -#define HID_PROP_SCROLLVALUE "EXTENSIONS_HID_PROP_SCROLLVALUE" -#define HID_PROP_SCROLLVALUE_MAX "EXTENSIONS_HID_PROP_SCROLLVALUE_MAX" -#define HID_PROP_SCROLL_WIDTH "EXTENSIONS_HID_PROP_SCROLL_WIDTH" -#define HID_PROP_SCROLL_HEIGHT "EXTENSIONS_HID_PROP_SCROLL_HEIGHT" -#define HID_PROP_SCROLL_TOP "EXTENSIONS_HID_PROP_SCROLL_TOP" -#define HID_PROP_SCROLL_LEFT "EXTENSIONS_HID_PROP_SCROLL_LEFT" -#define HID_PROP_LINEINCREMENT "EXTENSIONS_HID_PROP_LINEINCREMENT" -#define HID_PROP_BLOCKINCREMENT "EXTENSIONS_HID_PROP_BLOCKINCREMENT" -#define HID_PROP_VISIBLESIZE "EXTENSIONS_HID_PROP_VISIBLESIZE" -#define HID_PROP_ORIENTATION "EXTENSIONS_HID_PROP_ORIENTATION" -#define HID_PROP_POSITIONX "EXTENSIONS_HID_PROP_POSITIONX" -#define HID_PROP_POSITIONY "EXTENSIONS_HID_PROP_POSITIONY" -#define HID_PROP_PUSHBUTTONTYPE "EXTENSIONS_HID_PROP_PUSHBUTTONTYPE" -#define HID_PROP_STATE "EXTENSIONS_HID_PROP_STATE" -#define HID_PROP_SCALEIMAGE "EXTENSIONS_HID_PROP_SCALEIMAGE" -#define HID_PROP_BOUND_CELL "EXTENSIONS_HID_PROP_BOUND_CELL" -#define HID_PROP_LIST_CELL_RANGE "EXTENSIONS_HID_PROP_LIST_CELL_RANGE" -#define HID_PROP_CELL_EXCHANGE_TYPE "EXTENSIONS_HID_PROP_CELL_EXCHANGE_TYPE" -#define HID_PROP_SELECTEDITEMS "EXTENSIONS_HID_PROP_SELECTEDITEMS" -#define HID_PROP_SCROLLVALUE_MIN "EXTENSIONS_HID_PROP_SCROLLVALUE_MIN" -#define HID_PROP_DEFAULT_SCROLLVALUE "EXTENSIONS_HID_PROP_DEFAULT_SCROLLVALUE" -#define HID_PROP_REPEAT_DELAY "EXTENSIONS_HID_PROP_REPEAT_DELAY" -#define HID_PROP_SYMBOLCOLOR "EXTENSIONS_HID_PROP_SYMBOLCOLOR" -#define HID_PROP_SPINVALUE "EXTENSIONS_HID_PROP_SPINVALUE" -#define HID_PROP_SPINVALUE_MIN "EXTENSIONS_HID_PROP_SPINVALUE_MIN" -#define HID_PROP_SPINVALUE_MAX "EXTENSIONS_HID_PROP_SPINVALUE_MAX" -#define HID_PROP_DEFAULT_SPINVALUE "EXTENSIONS_HID_PROP_DEFAULT_SPINVALUE" -#define HID_PROP_SPININCREMENT "EXTENSIONS_HID_PROP_SPININCREMENT" -#define HID_PROP_REPEAT "EXTENSIONS_HID_PROP_REPEAT" -#define HID_PROP_WORDBREAK "EXTENSIONS_HID_PROP_WORDBREAK" -#define HID_PROP_SHOW_SCROLLBARS "EXTENSIONS_HID_PROP_SHOW_SCROLLBARS" -#define HID_PROP_ICONSIZE "EXTENSIONS_HID_PROP_ICONSIZE" -#define HID_PROP_SHOW_POSITION "EXTENSIONS_HID_PROP_SHOW_POSITION" -#define HID_PROP_SHOW_NAVIGATION "EXTENSIONS_HID_PROP_SHOW_NAVIGATION" -#define HID_PROP_SHOW_RECORDACTIONS "EXTENSIONS_HID_PROP_SHOW_RECORDACTIONS" -#define HID_PROP_SHOW_FILTERSORT "EXTENSIONS_HID_PROP_SHOW_FILTERSORT" -#define HID_PROP_AUTOLINEBREAK "EXTENSIONS_HID_PROP_AUTOLINEBREAK" -#define HID_PROP_TEXTTYPE "EXTENSIONS_HID_PROP_TEXTTYPE" -#define HID_PROP_LINEEND_FORMAT "EXTENSIONS_HID_PROP_LINEEND_FORMAT" -#define HID_PROP_XSD_TOTAL_DIGITS "EXTENSIONS_HID_PROP_XSD_TOTAL_DIGITS" -#define HID_PROP_XSD_FRACTION_DIGITS "EXTENSIONS_HID_PROP_XSD_FRACTION_DIGITS" -#define HID_PROP_XSD_MAX_INCLUSIVE "EXTENSIONS_HID_PROP_XSD_MAX_INCLUSIVE" -#define HID_PROP_XSD_MAX_EXCLUSIVE "EXTENSIONS_HID_PROP_XSD_MAX_EXCLUSIVE" -#define HID_PROP_XSD_MIN_INCLUSIVE "EXTENSIONS_HID_PROP_XSD_MIN_INCLUSIVE" -#define HID_PROP_XSD_MIN_EXCLUSIVE "EXTENSIONS_HID_PROP_XSD_MIN_EXCLUSIVE" -#define HID_PROP_UNCHECKEDREFVALUE "EXTENSIONS_HID_PROP_UNCHECKEDREFVALUE" -#define HID_PROP_SUBMISSION_ID "EXTENSIONS_HID_PROP_SUBMISSION_ID" -#define HID_PROP_XML_DATA_MODEL "EXTENSIONS_HID_PROP_XML_DATA_MODEL" -#define HID_PROP_BIND_EXPRESSION "EXTENSIONS_HID_PROP_BIND_EXPRESSION" -#define HID_PROP_XSD_REQUIRED "EXTENSIONS_HID_PROP_XSD_REQUIRED" -#define HID_PROP_XSD_RELEVANT "EXTENSIONS_HID_PROP_XSD_RELEVANT" -#define HID_PROP_XSD_READONLY "EXTENSIONS_HID_PROP_XSD_READONLY" -#define HID_PROP_XSD_CONSTRAINT "EXTENSIONS_HID_PROP_XSD_CONSTRAINT" -#define HID_PROP_XSD_CALCULATION "EXTENSIONS_HID_PROP_XSD_CALCULATION" -#define HID_PROP_XSD_DATA_TYPE "EXTENSIONS_HID_PROP_XSD_DATA_TYPE" -#define HID_PROP_XSD_WHITESPACES "EXTENSIONS_HID_PROP_XSD_WHITESPACES" -#define HID_PROP_URL "EXTENSIONS_HID_PROP_URL" -#define HID_PROP_XSD_PATTERN "EXTENSIONS_HID_PROP_XSD_PATTERN" -#define HID_PROP_XSD_LENGTH "EXTENSIONS_HID_PROP_XSD_LENGTH" -#define HID_PROP_XSD_MIN_LENGTH "EXTENSIONS_HID_PROP_XSD_MIN_LENGTH" -#define HID_PROP_XSD_MAX_LENGTH "EXTENSIONS_HID_PROP_XSD_MAX_LENGTH" -#define HID_PROP_LIST_BINDING "EXTENSIONS_HID_PROP_LIST_BINDING" -#define HID_PROP_BINDING_NAME "EXTENSIONS_HID_PROP_BINDING_NAME" -#define HID_PROP_SELECTION_TYPE "EXTENSIONS_HID_PROP_SELECTION_TYPE" -#define HID_PROP_ROOT_DISPLAYED "EXTENSIONS_HID_PROP_ROOT_DISPLAYED" -#define HID_PROP_SHOWS_HANDLES "EXTENSIONS_HID_PROP_SHOWS_HANDLES" -#define HID_PROP_SHOWS_ROOT_HANDLES "EXTENSIONS_HID_PROP_SHOWS_ROOT_HANDLES" -#define HID_PROP_EDITABLE "EXTENSIONS_HID_PROP_EDITABLE" -#define HID_PROP_INVOKES_STOP_NOT_EDITING "EXTENSIONS_HID_PROP_INVOKES_STOP_NOT_EDITING" -#define HID_PROP_ROW_HEIGHT "EXTENSIONS_HID_PROP_ROW_HEIGHT" -#define HID_PROP_DECORATION "EXTENSIONS_HID_PROP_DECORATION" -#define HID_EVT_ACTIONPERFORMED "EXTENSIONS_HID_EVT_ACTIONPERFORMED" -#define HID_EVT_AFTERUPDATE "EXTENSIONS_HID_EVT_AFTERUPDATE" -#define HID_EVT_BEFOREUPDATE "EXTENSIONS_HID_EVT_BEFOREUPDATE" -#define HID_EVT_CONFIRMDELETE "EXTENSIONS_HID_EVT_CONFIRMDELETE" -#define HID_EVT_ERROROCCURRED "EXTENSIONS_HID_EVT_ERROROCCURRED" -#define HID_EVT_FOCUSGAINED "EXTENSIONS_HID_EVT_FOCUSGAINED" -#define HID_EVT_FOCUSLOST "EXTENSIONS_HID_EVT_FOCUSLOST" -#define HID_EVT_ITEMSTATECHANGED "EXTENSIONS_HID_EVT_ITEMSTATECHANGED" -#define HID_EVT_KEYTYPED "EXTENSIONS_HID_EVT_KEYTYPED" -#define HID_EVT_LOADED "EXTENSIONS_HID_EVT_LOADED" -#define HID_EVT_MOUSEDRAGGED "EXTENSIONS_HID_EVT_MOUSEDRAGGED" -#define HID_EVT_MOUSEENTERED "EXTENSIONS_HID_EVT_MOUSEENTERED" -#define HID_EVT_MOUSEEXITED "EXTENSIONS_HID_EVT_MOUSEEXITED" -#define HID_EVT_MOUSEMOVED "EXTENSIONS_HID_EVT_MOUSEMOVED" -#define HID_EVT_MOUSEPRESSED "EXTENSIONS_HID_EVT_MOUSEPRESSED" -#define HID_EVT_MOUSERELEASED "EXTENSIONS_HID_EVT_MOUSERELEASED" -#define HID_EVT_POSITIONED "EXTENSIONS_HID_EVT_POSITIONED" -#define HID_EVT_RESETTED "EXTENSIONS_HID_EVT_RESETTED" -#define HID_EVT_SUBMITTED "EXTENSIONS_HID_EVT_SUBMITTED" -#define HID_EVT_TEXTCHANGED "EXTENSIONS_HID_EVT_TEXTCHANGED" -#define HID_EVT_UNLOADED "EXTENSIONS_HID_EVT_UNLOADED" -#define HID_EVT_CHANGED "EXTENSIONS_HID_EVT_CHANGED" -#define HID_EVT_APPROVEACTIONPERFORMED "EXTENSIONS_HID_EVT_APPROVEACTIONPERFORMED" -#define HID_EVT_APPROVERESETTED "EXTENSIONS_HID_EVT_APPROVERESETTED" -#define HID_EVT_KEYUP "EXTENSIONS_HID_EVT_KEYUP" -#define HID_EVT_APPROVEPARAMETER "EXTENSIONS_HID_EVT_APPROVEPARAMETER" -#define HID_EVT_POSITIONING "EXTENSIONS_HID_EVT_POSITIONING" -#define HID_EVT_RELOADED "EXTENSIONS_HID_EVT_RELOADED" -#define HID_EVT_APPROVEROWCHANGE "EXTENSIONS_HID_EVT_APPROVEROWCHANGE" -#define HID_EVT_ROWCHANGE "EXTENSIONS_HID_EVT_ROWCHANGE" -#define HID_EVT_RELOADING "EXTENSIONS_HID_EVT_RELOADING" -#define HID_EVT_UNLOADING "EXTENSIONS_HID_EVT_UNLOADING" -#define HID_EVT_ADJUSTMENTVALUECHANGED "EXTENSIONS_HID_EVT_ADJUSTMENTVALUECHANGED" -#define HID_PROP_TOGGLE "EXTENSIONS_HID_PROP_TOGGLE" -#define HID_PROP_FOCUSONCLICK "EXTENSIONS_HID_PROP_FOCUSONCLICK" -#define HID_PROP_HIDEINACTIVESELECTION "EXTENSIONS_HID_PROP_HIDEINACTIVESELECTION" -#define HID_PROP_VISUALEFFECT "EXTENSIONS_HID_PROP_VISUALEFFECT" -#define HID_PROP_BORDERCOLOR "EXTENSIONS_HID_PROP_BORDERCOLOR" -#define HID_PROP_IMAGEPOSITION "EXTENSIONS_HID_PROP_IMAGEPOSITION" -#define HID_PROP_NOLABEL "EXTENSIONS_HID_PROP_NOLABEL" -#define HID_PROP_WRITING_MODE "EXTENSIONS_HID_PROP_WRITING_MODE" -#define HID_PROP_ANCHOR_TYPE "EXTENSIONS_HID_PROP_ANCHOR_TYPE" -#define HID_FM_PROPDLG_TABCTR "EXTENSIONS_HID_FM_PROPDLG_TABCTR" -#define HID_FM_PROPDLG_TAB_GENERAL "EXTENSIONS_HID_FM_PROPDLG_TAB_GENERAL" -#define HID_FM_PROPDLG_TAB_DATA "EXTENSIONS_HID_FM_PROPDLG_TAB_DATA" -#define HID_FM_PROPDLG_TAB_EVT "EXTENSIONS_HID_FM_PROPDLG_TAB_EVT" -#define HID_PROP_GROUP_NAME "EXTENSIONS_HID_PROP_GROUP_NAME" +inline constexpr OUString HID_PROP_INPUT_REQUIRED = u"EXTENSIONS_HID_PROP_INPUT_REQUIRED"_ustr; +inline constexpr OUString HID_PROP_CONTROLSOURCE = u"EXTENSIONS_HID_PROP_CONTROLSOURCE"_ustr; +inline constexpr OUString HID_PROP_NAME = u"EXTENSIONS_HID_PROP_NAME"_ustr; +inline constexpr OUString HID_PROP_TABINDEX = u"EXTENSIONS_HID_PROP_TABINDEX"_ustr; +inline constexpr OUString HID_PROP_MASTERFIELDS = u"EXTENSIONS_HID_PROP_MASTERFIELDS"_ustr; +inline constexpr OUString HID_PROP_SLAVEFIELDS = u"EXTENSIONS_HID_PROP_SLAVEFIELDS"_ustr; +inline constexpr OUString HID_PROP_DATASOURCE = u"EXTENSIONS_HID_PROP_DATASOURCE"_ustr; +inline constexpr OUString HID_PROP_CURSORSOURCE = u"EXTENSIONS_HID_PROP_CURSORSOURCE"_ustr; +inline constexpr OUString HID_PROP_CURSORSOURCETYPE = u"EXTENSIONS_HID_PROP_CURSORSOURCETYPE"_ustr; +inline constexpr OUString HID_PROP_READONLY = u"EXTENSIONS_HID_PROP_READONLY"_ustr; +inline constexpr OUString HID_PROP_DATAENTRY = u"EXTENSIONS_HID_PROP_DATAENTRY"_ustr; +inline constexpr OUString HID_PROP_NAVIGATION = u"EXTENSIONS_HID_PROP_NAVIGATION"_ustr; +inline constexpr OUString HID_PROP_CYCLE = u"EXTENSIONS_HID_PROP_CYCLE"_ustr; +inline constexpr OUString HID_PROP_ALLOW_ADDITIONS = u"EXTENSIONS_HID_PROP_ALLOW_ADDITIONS"_ustr; +inline constexpr OUString HID_PROP_ALLOW_EDITS = u"EXTENSIONS_HID_PROP_ALLOW_EDITS"_ustr; +inline constexpr OUString HID_PROP_ALLOW_DELETIONS = u"EXTENSIONS_HID_PROP_ALLOW_DELETIONS"_ustr; +inline constexpr OUString HID_PROP_VALUE = u"EXTENSIONS_HID_PROP_VALUE"_ustr; +inline constexpr OUString HID_PROP_FORMATKEY = u"EXTENSIONS_HID_PROP_FORMATKEY"_ustr; +inline constexpr OUString HID_PROP_WHEEL_BEHAVIOR = u"EXTENSIONS_HID_PROP_WHEEL_BEHAVIOR"_ustr; +inline constexpr OUString HID_PROP_HEIGHT = u"EXTENSIONS_HID_PROP_HEIGHT"_ustr; +inline constexpr OUString HID_PROP_WIDTH = u"EXTENSIONS_HID_PROP_WIDTH"_ustr; +inline constexpr OUString HID_PROP_AUTOGROW = u"EXTENSIONS_HID_PROP_AUTOGROW"_ustr; +inline constexpr OUString HID_PROP_BOUNDCOLUMN = u"EXTENSIONS_HID_PROP_BOUNDCOLUMN"_ustr; +inline constexpr OUString HID_PROP_LISTSOURCETYPE = u"EXTENSIONS_HID_PROP_LISTSOURCETYPE"_ustr; +inline constexpr OUString HID_PROP_LISTSOURCE = u"EXTENSIONS_HID_PROP_LISTSOURCE"_ustr; +inline constexpr OUString HID_PROP_LISTINDEX = u"EXTENSIONS_HID_PROP_LISTINDEX"_ustr; +inline constexpr OUString HID_PROP_TEXT = u"EXTENSIONS_HID_PROP_TEXT"_ustr; +inline constexpr OUString HID_PROP_LABEL = u"EXTENSIONS_HID_PROP_LABEL"_ustr; +inline constexpr OUString HID_PROP_STRINGITEMLIST = u"EXTENSIONS_HID_PROP_STRINGITEMLIST"_ustr; +inline constexpr OUString HID_PROP_FONT = u"EXTENSIONS_HID_PROP_FONT"_ustr; +inline constexpr OUString HID_PROP_ROWHEIGHT = u"EXTENSIONS_HID_PROP_ROWHEIGHT"_ustr; +inline constexpr OUString HID_PROP_BACKGROUNDCOLOR = u"EXTENSIONS_HID_PROP_BACKGROUNDCOLOR"_ustr; +inline constexpr OUString HID_PROP_FILLCOLOR = u"EXTENSIONS_HID_PROP_FILLCOLOR"_ustr; +inline constexpr OUString HID_PROP_LINECOLOR = u"EXTENSIONS_HID_PROP_LINECOLOR"_ustr; +inline constexpr OUString HID_PROP_BORDER = u"EXTENSIONS_HID_PROP_BORDER"_ustr; +inline constexpr OUString HID_PROP_ALIGN = u"EXTENSIONS_HID_PROP_ALIGN"_ustr; +inline constexpr OUString HID_PROP_VERTICAL_ALIGN = u"EXTENSIONS_HID_PROP_VERTICAL_ALIGN"_ustr; +inline constexpr OUString HID_PROP_DROPDOWN = u"EXTENSIONS_HID_PROP_DROPDOWN"_ustr; +inline constexpr OUString HID_PROP_MULTILINE = u"EXTENSIONS_HID_PROP_MULTILINE"_ustr; +inline constexpr OUString HID_PROP_HSCROLL = u"EXTENSIONS_HID_PROP_HSCROLL"_ustr; +inline constexpr OUString HID_PROP_VSCROLL = u"EXTENSIONS_HID_PROP_VSCROLL"_ustr; +inline constexpr OUString HID_PROP_TABSTOP = u"EXTENSIONS_HID_PROP_TABSTOP"_ustr; +inline constexpr OUString HID_PROP_REFVALUE = u"EXTENSIONS_HID_PROP_REFVALUE"_ustr; +inline constexpr OUString HID_PROP_BUTTONTYPE = u"EXTENSIONS_HID_PROP_BUTTONTYPE"_ustr; +inline constexpr OUString HID_PROP_SUBMIT_ACTION = u"EXTENSIONS_HID_PROP_SUBMIT_ACTION"_ustr; +inline constexpr OUString HID_PROP_SUBMIT_METHOD = u"EXTENSIONS_HID_PROP_SUBMIT_METHOD"_ustr; +inline constexpr OUString HID_PROP_SUBMIT_ENCODING = u"EXTENSIONS_HID_PROP_SUBMIT_ENCODING"_ustr; +inline constexpr OUString HID_PROP_DEFAULTVALUE = u"EXTENSIONS_HID_PROP_DEFAULTVALUE"_ustr; +inline constexpr OUString HID_PROP_SUBMIT_TARGET = u"EXTENSIONS_HID_PROP_SUBMIT_TARGET"_ustr; +inline constexpr OUString HID_PROP_DEFAULT_STATE = u"EXTENSIONS_HID_PROP_DEFAULT_STATE"_ustr; +inline constexpr OUString HID_PROP_IMAGE_URL = u"EXTENSIONS_HID_PROP_IMAGE_URL"_ustr; +inline constexpr OUString HID_PROP_DEFAULT_SELECT_SEQ = u"EXTENSIONS_HID_PROP_DEFAULT_SELECT_SEQ"_ustr; +inline constexpr OUString HID_PROP_MULTISELECTION = u"EXTENSIONS_HID_PROP_MULTISELECTION"_ustr; +inline constexpr OUString HID_PROP_DATE = u"EXTENSIONS_HID_PROP_DATE"_ustr; +inline constexpr OUString HID_PROP_DATEMIN = u"EXTENSIONS_HID_PROP_DATEMIN"_ustr; +inline constexpr OUString HID_PROP_DATEMAX = u"EXTENSIONS_HID_PROP_DATEMAX"_ustr; +inline constexpr OUString HID_PROP_DATEFORMAT = u"EXTENSIONS_HID_PROP_DATEFORMAT"_ustr; +inline constexpr OUString HID_PROP_TIME = u"EXTENSIONS_HID_PROP_TIME"_ustr; +inline constexpr OUString HID_PROP_TIMEMIN = u"EXTENSIONS_HID_PROP_TIMEMIN"_ustr; +inline constexpr OUString HID_PROP_TIMEMAX = u"EXTENSIONS_HID_PROP_TIMEMAX"_ustr; +inline constexpr OUString HID_PROP_TIMEFORMAT = u"EXTENSIONS_HID_PROP_TIMEFORMAT"_ustr; +inline constexpr OUString HID_PROP_VALUEMIN = u"EXTENSIONS_HID_PROP_VALUEMIN"_ustr; +inline constexpr OUString HID_PROP_VALUEMAX = u"EXTENSIONS_HID_PROP_VALUEMAX"_ustr; +inline constexpr OUString HID_PROP_VALUESTEP = u"EXTENSIONS_HID_PROP_VALUESTEP"_ustr; +inline constexpr OUString HID_PROP_CURRENCYSYMBOL = u"EXTENSIONS_HID_PROP_CURRENCYSYMBOL"_ustr; +inline constexpr OUString HID_PROP_EDITMASK = u"EXTENSIONS_HID_PROP_EDITMASK"_ustr; +inline constexpr OUString HID_PROP_LITERALMASK = u"EXTENSIONS_HID_PROP_LITERALMASK"_ustr; +inline constexpr OUString HID_PROP_ENABLED = u"EXTENSIONS_HID_PROP_ENABLED"_ustr; +inline constexpr OUString HID_PROP_AUTOCOMPLETE = u"EXTENSIONS_HID_PROP_AUTOCOMPLETE"_ustr; +inline constexpr OUString HID_PROP_LINECOUNT = u"EXTENSIONS_HID_PROP_LINECOUNT"_ustr; +inline constexpr OUString HID_PROP_MAXTEXTLEN = u"EXTENSIONS_HID_PROP_MAXTEXTLEN"_ustr; +inline constexpr OUString HID_PROP_SPIN = u"EXTENSIONS_HID_PROP_SPIN"_ustr; +inline constexpr OUString HID_PROP_STRICTFORMAT = u"EXTENSIONS_HID_PROP_STRICTFORMAT"_ustr; +inline constexpr OUString HID_PROP_SHOWTHOUSANDSEP = u"EXTENSIONS_HID_PROP_SHOWTHOUSANDSEP"_ustr; +inline constexpr OUString HID_PROP_PRINTABLE = u"EXTENSIONS_HID_PROP_PRINTABLE"_ustr; +inline constexpr OUString HID_PROP_TARGET_URL = u"EXTENSIONS_HID_PROP_TARGET_URL"_ustr; +inline constexpr OUString HID_PROP_TARGET_FRAME = u"EXTENSIONS_HID_PROP_TARGET_FRAME"_ustr; +inline constexpr OUString HID_PROP_TAG = u"EXTENSIONS_HID_PROP_TAG"_ustr; +inline constexpr OUString HID_PROP_ECHO_CHAR = u"EXTENSIONS_HID_PROP_ECHO_CHAR"_ustr; +inline constexpr OUString HID_PROP_EMPTY_IS_NULL = u"EXTENSIONS_HID_PROP_EMPTY_IS_NULL"_ustr; +inline constexpr OUString HID_PROP_DECIMAL_ACCURACY = u"EXTENSIONS_HID_PROP_DECIMAL_ACCURACY"_ustr; +inline constexpr OUString HID_PROP_ENABLE_VISIBLE = u"EXTENSIONS_HID_PROP_ENABLE_VISIBLE"_ustr; +inline constexpr OUString HID_PROP_DEFAULT_BUTTON = u"EXTENSIONS_HID_PROP_DEFAULT_BUTTON"_ustr; +inline constexpr OUString HID_PROP_HIDDEN_VALUE = u"EXTENSIONS_HID_PROP_HIDDEN_VALUE"_ustr; +inline constexpr OUString HID_PROP_TRISTATE = u"EXTENSIONS_HID_PROP_TRISTATE"_ustr; +inline constexpr OUString HID_PROP_NAVIGATIONBAR = u"EXTENSIONS_HID_PROP_NAVIGATIONBAR"_ustr; +inline constexpr OUString HID_PROP_FILTER = u"EXTENSIONS_HID_PROP_FILTER"_ustr; +inline constexpr OUString HID_PROP_SORT_CRITERIA = u"EXTENSIONS_HID_PROP_SORT_CRITERIA"_ustr; +inline constexpr OUString HID_PROP_DEFAULT_LONG_VALUE = u"EXTENSIONS_HID_PROP_DEFAULT_LONG_VALUE"_ustr; +inline constexpr OUString HID_PROP_DEFAULT_TIME = u"EXTENSIONS_HID_PROP_DEFAULT_TIME"_ustr; +inline constexpr OUString HID_PROP_DEFAULT_DATE = u"EXTENSIONS_HID_PROP_DEFAULT_DATE"_ustr; +inline constexpr OUString HID_PROP_HELPTEXT = u"EXTENSIONS_HID_PROP_HELPTEXT"_ustr; +inline constexpr OUString HID_PROP_HELPURL = u"EXTENSIONS_HID_PROP_HELPURL"_ustr; +inline constexpr OUString HID_PROP_RECORDMARKER = u"EXTENSIONS_HID_PROP_RECORDMARKER"_ustr; +inline constexpr OUString HID_PROP_FILTERPROPOSAL = u"EXTENSIONS_HID_PROP_FILTERPROPOSAL"_ustr; +inline constexpr OUString HID_PROP_EFFECTIVEMIN = u"EXTENSIONS_HID_PROP_EFFECTIVEMIN"_ustr; +inline constexpr OUString HID_PROP_EFFECTIVEMAX = u"EXTENSIONS_HID_PROP_EFFECTIVEMAX"_ustr; +inline constexpr OUString HID_PROP_EFFECTIVEDEFAULT = u"EXTENSIONS_HID_PROP_EFFECTIVEDEFAULT"_ustr; +inline constexpr OUString HID_PROP_CONTROLLABEL = u"EXTENSIONS_HID_PROP_CONTROLLABEL"_ustr; +inline constexpr OUString HID_PROP_CURRSYM_POSITION = u"EXTENSIONS_HID_PROP_CURRSYM_POSITION"_ustr; +inline constexpr OUString HID_PROP_ESCAPE_PROCESSING = u"EXTENSIONS_HID_PROP_ESCAPE_PROCESSING"_ustr; +inline constexpr OUString HID_PROP_TITLE = u"EXTENSIONS_HID_PROP_TITLE"_ustr; +inline constexpr OUString HID_PROP_STEP = u"EXTENSIONS_HID_PROP_STEP"_ustr; +inline constexpr OUString HID_PROP_PROGRESSVALUE = u"EXTENSIONS_HID_PROP_PROGRESSVALUE"_ustr; +inline constexpr OUString HID_PROP_PROGRESSVALUE_MIN = u"EXTENSIONS_HID_PROP_PROGRESSVALUE_MIN"_ustr; +inline constexpr OUString HID_PROP_PROGRESSVALUE_MAX = u"EXTENSIONS_HID_PROP_PROGRESSVALUE_MAX"_ustr; +inline constexpr OUString HID_PROP_SCROLLVALUE = u"EXTENSIONS_HID_PROP_SCROLLVALUE"_ustr; +inline constexpr OUString HID_PROP_SCROLLVALUE_MAX = u"EXTENSIONS_HID_PROP_SCROLLVALUE_MAX"_ustr; +inline constexpr OUString HID_PROP_SCROLL_WIDTH = u"EXTENSIONS_HID_PROP_SCROLL_WIDTH"_ustr; +inline constexpr OUString HID_PROP_SCROLL_HEIGHT = u"EXTENSIONS_HID_PROP_SCROLL_HEIGHT"_ustr; +inline constexpr OUString HID_PROP_SCROLL_TOP = u"EXTENSIONS_HID_PROP_SCROLL_TOP"_ustr; +inline constexpr OUString HID_PROP_SCROLL_LEFT = u"EXTENSIONS_HID_PROP_SCROLL_LEFT"_ustr; +inline constexpr OUString HID_PROP_LINEINCREMENT = u"EXTENSIONS_HID_PROP_LINEINCREMENT"_ustr; +inline constexpr OUString HID_PROP_BLOCKINCREMENT = u"EXTENSIONS_HID_PROP_BLOCKINCREMENT"_ustr; +inline constexpr OUString HID_PROP_VISIBLESIZE = u"EXTENSIONS_HID_PROP_VISIBLESIZE"_ustr; +inline constexpr OUString HID_PROP_ORIENTATION = u"EXTENSIONS_HID_PROP_ORIENTATION"_ustr; +inline constexpr OUString HID_PROP_POSITIONX = u"EXTENSIONS_HID_PROP_POSITIONX"_ustr; +inline constexpr OUString HID_PROP_POSITIONY = u"EXTENSIONS_HID_PROP_POSITIONY"_ustr; +inline constexpr OUString HID_PROP_PUSHBUTTONTYPE = u"EXTENSIONS_HID_PROP_PUSHBUTTONTYPE"_ustr; +inline constexpr OUString HID_PROP_STATE = u"EXTENSIONS_HID_PROP_STATE"_ustr; +inline constexpr OUString HID_PROP_SCALEIMAGE = u"EXTENSIONS_HID_PROP_SCALEIMAGE"_ustr; +inline constexpr OUString HID_PROP_BOUND_CELL = u"EXTENSIONS_HID_PROP_BOUND_CELL"_ustr; +inline constexpr OUString HID_PROP_LIST_CELL_RANGE = u"EXTENSIONS_HID_PROP_LIST_CELL_RANGE"_ustr; +inline constexpr OUString HID_PROP_CELL_EXCHANGE_TYPE = u"EXTENSIONS_HID_PROP_CELL_EXCHANGE_TYPE"_ustr; +inline constexpr OUString HID_PROP_SELECTEDITEMS = u"EXTENSIONS_HID_PROP_SELECTEDITEMS"_ustr; +inline constexpr OUString HID_PROP_SCROLLVALUE_MIN = u"EXTENSIONS_HID_PROP_SCROLLVALUE_MIN"_ustr; +inline constexpr OUString HID_PROP_DEFAULT_SCROLLVALUE = u"EXTENSIONS_HID_PROP_DEFAULT_SCROLLVALUE"_ustr; +inline constexpr OUString HID_PROP_REPEAT_DELAY = u"EXTENSIONS_HID_PROP_REPEAT_DELAY"_ustr; +inline constexpr OUString HID_PROP_SYMBOLCOLOR = u"EXTENSIONS_HID_PROP_SYMBOLCOLOR"_ustr; +inline constexpr OUString HID_PROP_SPINVALUE = u"EXTENSIONS_HID_PROP_SPINVALUE"_ustr; +inline constexpr OUString HID_PROP_SPINVALUE_MIN = u"EXTENSIONS_HID_PROP_SPINVALUE_MIN"_ustr; +inline constexpr OUString HID_PROP_SPINVALUE_MAX = u"EXTENSIONS_HID_PROP_SPINVALUE_MAX"_ustr; +inline constexpr OUString HID_PROP_DEFAULT_SPINVALUE = u"EXTENSIONS_HID_PROP_DEFAULT_SPINVALUE"_ustr; +inline constexpr OUString HID_PROP_SPININCREMENT = u"EXTENSIONS_HID_PROP_SPININCREMENT"_ustr; +inline constexpr OUString HID_PROP_REPEAT = u"EXTENSIONS_HID_PROP_REPEAT"_ustr; +inline constexpr OUString HID_PROP_WORDBREAK = u"EXTENSIONS_HID_PROP_WORDBREAK"_ustr; +inline constexpr OUString HID_PROP_SHOW_SCROLLBARS = u"EXTENSIONS_HID_PROP_SHOW_SCROLLBARS"_ustr; +inline constexpr OUString HID_PROP_ICONSIZE = u"EXTENSIONS_HID_PROP_ICONSIZE"_ustr; +inline constexpr OUString HID_PROP_SHOW_POSITION = u"EXTENSIONS_HID_PROP_SHOW_POSITION"_ustr; +inline constexpr OUString HID_PROP_SHOW_NAVIGATION = u"EXTENSIONS_HID_PROP_SHOW_NAVIGATION"_ustr; +inline constexpr OUString HID_PROP_SHOW_RECORDACTIONS = u"EXTENSIONS_HID_PROP_SHOW_RECORDACTIONS"_ustr; +inline constexpr OUString HID_PROP_SHOW_FILTERSORT = u"EXTENSIONS_HID_PROP_SHOW_FILTERSORT"_ustr; +inline constexpr OUString HID_PROP_TEXTTYPE = u"EXTENSIONS_HID_PROP_TEXTTYPE"_ustr; +inline constexpr OUString HID_PROP_LINEEND_FORMAT = u"EXTENSIONS_HID_PROP_LINEEND_FORMAT"_ustr; +inline constexpr OUString HID_PROP_XSD_TOTAL_DIGITS = u"EXTENSIONS_HID_PROP_XSD_TOTAL_DIGITS"_ustr; +inline constexpr OUString HID_PROP_XSD_FRACTION_DIGITS = u"EXTENSIONS_HID_PROP_XSD_FRACTION_DIGITS"_ustr; +inline constexpr OUString HID_PROP_XSD_MAX_INCLUSIVE = u"EXTENSIONS_HID_PROP_XSD_MAX_INCLUSIVE"_ustr; +inline constexpr OUString HID_PROP_XSD_MAX_EXCLUSIVE = u"EXTENSIONS_HID_PROP_XSD_MAX_EXCLUSIVE"_ustr; +inline constexpr OUString HID_PROP_XSD_MIN_INCLUSIVE = u"EXTENSIONS_HID_PROP_XSD_MIN_INCLUSIVE"_ustr; +inline constexpr OUString HID_PROP_XSD_MIN_EXCLUSIVE = u"EXTENSIONS_HID_PROP_XSD_MIN_EXCLUSIVE"_ustr; +inline constexpr OUString HID_PROP_UNCHECKEDREFVALUE = u"EXTENSIONS_HID_PROP_UNCHECKEDREFVALUE"_ustr; +inline constexpr OUString HID_PROP_SUBMISSION_ID = u"EXTENSIONS_HID_PROP_SUBMISSION_ID"_ustr; +inline constexpr OUString HID_PROP_XML_DATA_MODEL = u"EXTENSIONS_HID_PROP_XML_DATA_MODEL"_ustr; +inline constexpr OUString HID_PROP_BIND_EXPRESSION = u"EXTENSIONS_HID_PROP_BIND_EXPRESSION"_ustr; +inline constexpr OUString HID_PROP_XSD_REQUIRED = u"EXTENSIONS_HID_PROP_XSD_REQUIRED"_ustr; +inline constexpr OUString HID_PROP_XSD_RELEVANT = u"EXTENSIONS_HID_PROP_XSD_RELEVANT"_ustr; +inline constexpr OUString HID_PROP_XSD_READONLY = u"EXTENSIONS_HID_PROP_XSD_READONLY"_ustr; +inline constexpr OUString HID_PROP_XSD_CONSTRAINT = u"EXTENSIONS_HID_PROP_XSD_CONSTRAINT"_ustr; +inline constexpr OUString HID_PROP_XSD_CALCULATION = u"EXTENSIONS_HID_PROP_XSD_CALCULATION"_ustr; +inline constexpr OUString HID_PROP_XSD_DATA_TYPE = u"EXTENSIONS_HID_PROP_XSD_DATA_TYPE"_ustr; +inline constexpr OUString HID_PROP_XSD_WHITESPACES = u"EXTENSIONS_HID_PROP_XSD_WHITESPACES"_ustr; +inline constexpr OUString HID_PROP_URL = u"EXTENSIONS_HID_PROP_URL"_ustr; +inline constexpr OUString HID_PROP_XSD_PATTERN = u"EXTENSIONS_HID_PROP_XSD_PATTERN"_ustr; +inline constexpr OUString HID_PROP_XSD_LENGTH = u"EXTENSIONS_HID_PROP_XSD_LENGTH"_ustr; +inline constexpr OUString HID_PROP_XSD_MIN_LENGTH = u"EXTENSIONS_HID_PROP_XSD_MIN_LENGTH"_ustr; +inline constexpr OUString HID_PROP_XSD_MAX_LENGTH = u"EXTENSIONS_HID_PROP_XSD_MAX_LENGTH"_ustr; +inline constexpr OUString HID_PROP_LIST_BINDING = u"EXTENSIONS_HID_PROP_LIST_BINDING"_ustr; +inline constexpr OUString HID_PROP_BINDING_NAME = u"EXTENSIONS_HID_PROP_BINDING_NAME"_ustr; +inline constexpr OUString HID_PROP_SELECTION_TYPE = u"EXTENSIONS_HID_PROP_SELECTION_TYPE"_ustr; +inline constexpr OUString HID_PROP_ROOT_DISPLAYED = u"EXTENSIONS_HID_PROP_ROOT_DISPLAYED"_ustr; +inline constexpr OUString HID_PROP_SHOWS_HANDLES = u"EXTENSIONS_HID_PROP_SHOWS_HANDLES"_ustr; +inline constexpr OUString HID_PROP_SHOWS_ROOT_HANDLES = u"EXTENSIONS_HID_PROP_SHOWS_ROOT_HANDLES"_ustr; +inline constexpr OUString HID_PROP_EDITABLE = u"EXTENSIONS_HID_PROP_EDITABLE"_ustr; +inline constexpr OUString HID_PROP_INVOKES_STOP_NOT_EDITING = u"EXTENSIONS_HID_PROP_INVOKES_STOP_NOT_EDITING"_ustr; +inline constexpr OUString HID_PROP_DECORATION = u"EXTENSIONS_HID_PROP_DECORATION"_ustr; +inline constexpr OUString HID_EVT_ACTIONPERFORMED = u"EXTENSIONS_HID_EVT_ACTIONPERFORMED"_ustr; +inline constexpr OUString HID_EVT_AFTERUPDATE = u"EXTENSIONS_HID_EVT_AFTERUPDATE"_ustr; +inline constexpr OUString HID_EVT_BEFOREUPDATE = u"EXTENSIONS_HID_EVT_BEFOREUPDATE"_ustr; +inline constexpr OUString HID_EVT_CONFIRMDELETE = u"EXTENSIONS_HID_EVT_CONFIRMDELETE"_ustr; +inline constexpr OUString HID_EVT_ERROROCCURRED = u"EXTENSIONS_HID_EVT_ERROROCCURRED"_ustr; +inline constexpr OUString HID_EVT_FOCUSGAINED = u"EXTENSIONS_HID_EVT_FOCUSGAINED"_ustr; +inline constexpr OUString HID_EVT_FOCUSLOST = u"EXTENSIONS_HID_EVT_FOCUSLOST"_ustr; +inline constexpr OUString HID_EVT_ITEMSTATECHANGED = u"EXTENSIONS_HID_EVT_ITEMSTATECHANGED"_ustr; +inline constexpr OUString HID_EVT_KEYTYPED = u"EXTENSIONS_HID_EVT_KEYTYPED"_ustr; +inline constexpr OUString HID_EVT_LOADED = u"EXTENSIONS_HID_EVT_LOADED"_ustr; +inline constexpr OUString HID_EVT_MOUSEDRAGGED = u"EXTENSIONS_HID_EVT_MOUSEDRAGGED"_ustr; +inline constexpr OUString HID_EVT_MOUSEENTERED = u"EXTENSIONS_HID_EVT_MOUSEENTERED"_ustr; +inline constexpr OUString HID_EVT_MOUSEEXITED = u"EXTENSIONS_HID_EVT_MOUSEEXITED"_ustr; +inline constexpr OUString HID_EVT_MOUSEMOVED = u"EXTENSIONS_HID_EVT_MOUSEMOVED"_ustr; +inline constexpr OUString HID_EVT_MOUSEPRESSED = u"EXTENSIONS_HID_EVT_MOUSEPRESSED"_ustr; +inline constexpr OUString HID_EVT_MOUSERELEASED = u"EXTENSIONS_HID_EVT_MOUSERELEASED"_ustr; +inline constexpr OUString HID_EVT_POSITIONED = u"EXTENSIONS_HID_EVT_POSITIONED"_ustr; +inline constexpr OUString HID_EVT_RESETTED = u"EXTENSIONS_HID_EVT_RESETTED"_ustr; +inline constexpr OUString HID_EVT_SUBMITTED = u"EXTENSIONS_HID_EVT_SUBMITTED"_ustr; +inline constexpr OUString HID_EVT_TEXTCHANGED = u"EXTENSIONS_HID_EVT_TEXTCHANGED"_ustr; +inline constexpr OUString HID_EVT_UNLOADED = u"EXTENSIONS_HID_EVT_UNLOADED"_ustr; +inline constexpr OUString HID_EVT_CHANGED = u"EXTENSIONS_HID_EVT_CHANGED"_ustr; +inline constexpr OUString HID_EVT_APPROVEACTIONPERFORMED = u"EXTENSIONS_HID_EVT_APPROVEACTIONPERFORMED"_ustr; +inline constexpr OUString HID_EVT_APPROVERESETTED = u"EXTENSIONS_HID_EVT_APPROVERESETTED"_ustr; +inline constexpr OUString HID_EVT_KEYUP = u"EXTENSIONS_HID_EVT_KEYUP"_ustr; +inline constexpr OUString HID_EVT_APPROVEPARAMETER = u"EXTENSIONS_HID_EVT_APPROVEPARAMETER"_ustr; +inline constexpr OUString HID_EVT_POSITIONING = u"EXTENSIONS_HID_EVT_POSITIONING"_ustr; +inline constexpr OUString HID_EVT_RELOADED = u"EXTENSIONS_HID_EVT_RELOADED"_ustr; +inline constexpr OUString HID_EVT_APPROVEROWCHANGE = u"EXTENSIONS_HID_EVT_APPROVEROWCHANGE"_ustr; +inline constexpr OUString HID_EVT_ROWCHANGE = u"EXTENSIONS_HID_EVT_ROWCHANGE"_ustr; +inline constexpr OUString HID_EVT_RELOADING = u"EXTENSIONS_HID_EVT_RELOADING"_ustr; +inline constexpr OUString HID_EVT_UNLOADING = u"EXTENSIONS_HID_EVT_UNLOADING"_ustr; +inline constexpr OUString HID_EVT_ADJUSTMENTVALUECHANGED = u"EXTENSIONS_HID_EVT_ADJUSTMENTVALUECHANGED"_ustr; +inline constexpr OUString HID_PROP_TOGGLE = u"EXTENSIONS_HID_PROP_TOGGLE"_ustr; +inline constexpr OUString HID_PROP_FOCUSONCLICK = u"EXTENSIONS_HID_PROP_FOCUSONCLICK"_ustr; +inline constexpr OUString HID_PROP_HIDEINACTIVESELECTION = u"EXTENSIONS_HID_PROP_HIDEINACTIVESELECTION"_ustr; +inline constexpr OUString HID_PROP_VISUALEFFECT = u"EXTENSIONS_HID_PROP_VISUALEFFECT"_ustr; +inline constexpr OUString HID_PROP_BORDERCOLOR = u"EXTENSIONS_HID_PROP_BORDERCOLOR"_ustr; +inline constexpr OUString HID_PROP_IMAGEPOSITION = u"EXTENSIONS_HID_PROP_IMAGEPOSITION"_ustr; +inline constexpr OUString HID_PROP_NOLABEL = u"EXTENSIONS_HID_PROP_NOLABEL"_ustr; +inline constexpr OUString HID_PROP_WRITING_MODE = u"EXTENSIONS_HID_PROP_WRITING_MODE"_ustr; +inline constexpr OUString HID_PROP_ANCHOR_TYPE = u"EXTENSIONS_HID_PROP_ANCHOR_TYPE"_ustr; +inline constexpr OUString HID_FM_PROPDLG_TABCTR = u"EXTENSIONS_HID_FM_PROPDLG_TABCTR"_ustr; +inline constexpr OUString HID_FM_PROPDLG_TAB_GENERAL = u"EXTENSIONS_HID_FM_PROPDLG_TAB_GENERAL"_ustr; +inline constexpr OUString HID_FM_PROPDLG_TAB_DATA = u"EXTENSIONS_HID_FM_PROPDLG_TAB_DATA"_ustr; +inline constexpr OUString HID_FM_PROPDLG_TAB_EVT = u"EXTENSIONS_HID_FM_PROPDLG_TAB_EVT"_ustr; +inline constexpr OUString HID_PROP_GROUP_NAME = u"EXTENSIONS_HID_PROP_GROUP_NAME"_ustr; -#define HID_PROP_SELECTIONMODEL "EXTENSIONS_HID_PROP_SELECTIONMODEL" -#define HID_PROP_USEGRIDLINE "EXTENSIONS_HID_PROP_USEGRIDLINE" -#define HID_PROP_GRIDLINECOLOR "EXTENSIONS_HID_PROP_GRIDLINECOLOR" -#define HID_PROP_SHOWCOLUMNHEADER "EXTENSIONS_HID_PROP_SHOWCOLUMNHEADER" -#define HID_PROP_SHOWROWHEADER "EXTENSIONS_HID_PROP_SHOWROWHEADER" -#define HID_PROP_HEADERBACKGROUNDCOLOR "EXTENSIONS_HID_PROP_HEADERBACKGROUNDCOLOR" -#define HID_PROP_HEADERTEXTCOLOR "EXTENSIONS_HID_PROP_HEADERTEXTCOLOR" -#define HID_PROP_ACTIVESELECTIONBACKGROUNDCOLOR "EXTENSIONS_HID_PROP_ACTIVESELECTIONBACKGROUNDCOLOR" -#define HID_PROP_ACTIVESELECTIONTEXTCOLOR "EXTENSIONS_HID_PROP_ACTIVESELECTIONTEXTCOLOR" -#define HID_PROP_INACTIVESELECTIONBACKGROUNDCOLOR "EXTENSIONS_HID_PROP_INACTIVESELECTIONBACKGROUNDCOLOR" -#define HID_PROP_INACTIVESELECTIONTEXTCOLOR "EXTENSIONS_HID_PROP_INACTIVESELECTIONTEXTCOLOR" +inline constexpr OUString HID_PROP_SELECTIONMODEL = u"EXTENSIONS_HID_PROP_SELECTIONMODEL"_ustr; +inline constexpr OUString HID_PROP_USEGRIDLINE = u"EXTENSIONS_HID_PROP_USEGRIDLINE"_ustr; +inline constexpr OUString HID_PROP_GRIDLINECOLOR = u"EXTENSIONS_HID_PROP_GRIDLINECOLOR"_ustr; +inline constexpr OUString HID_PROP_SHOWCOLUMNHEADER = u"EXTENSIONS_HID_PROP_SHOWCOLUMNHEADER"_ustr; +inline constexpr OUString HID_PROP_SHOWROWHEADER = u"EXTENSIONS_HID_PROP_SHOWROWHEADER"_ustr; +inline constexpr OUString HID_PROP_HEADERBACKGROUNDCOLOR = u"EXTENSIONS_HID_PROP_HEADERBACKGROUNDCOLOR"_ustr; +inline constexpr OUString HID_PROP_HEADERTEXTCOLOR = u"EXTENSIONS_HID_PROP_HEADERTEXTCOLOR"_ustr; +inline constexpr OUString HID_PROP_ACTIVESELECTIONBACKGROUNDCOLOR = u"EXTENSIONS_HID_PROP_ACTIVESELECTIONBACKGROUNDCOLOR"_ustr; +inline constexpr OUString HID_PROP_ACTIVESELECTIONTEXTCOLOR = u"EXTENSIONS_HID_PROP_ACTIVESELECTIONTEXTCOLOR"_ustr; +inline constexpr OUString HID_PROP_INACTIVESELECTIONBACKGROUNDCOLOR = u"EXTENSIONS_HID_PROP_INACTIVESELECTIONBACKGROUNDCOLOR"_ustr; +inline constexpr OUString HID_PROP_INACTIVESELECTIONTEXTCOLOR = u"EXTENSIONS_HID_PROP_INACTIVESELECTIONTEXTCOLOR"_ustr; #define HID_CHECK_FOR_UPD_DLG "EXTENSIONS_HID_CHECK_FOR_UPD_DLG" #define HID_CHECK_FOR_UPD_CLOSE "EXTENSIONS_HID_CHECK_FOR_UPD_CLOSE" @@ -327,7 +317,6 @@ #define HID_CHECK_FOR_UPD_RESUME "EXTENSIONS_HID_CHECK_FOR_UPD_RESUME" #define HID_CHECK_FOR_UPD_DOWNLOAD "EXTENSIONS_HID_CHECK_FOR_UPD_DOWNLOAD" #define HID_CHECK_FOR_UPD_DOWNLOAD2 "EXTENSIONS_HID_CHECK_FOR_UPD_DOWNLOAD2" -#define HID_CHECK_FOR_UPD_INSTALL "EXTENSIONS_HID_CHECK_FOR_UPD_INSTALL" #define HID_CHECK_FOR_UPD_STATUS "EXTENSIONS_HID_CHECK_FOR_UPD_STATUS" #define HID_CHECK_FOR_UPD_DESCRIPTION "EXTENSIONS_HID_CHECK_FOR_UPD_DESCRIPTION" #define HID_CHECK_FOR_UPD_CANCEL "EXTENSIONS_HID_CHECK_FOR_UPD_CANCEL" diff --git a/extensions/inc/propctrlr.h b/extensions/inc/propctrlr.h index 9a819cc08c25..80e276b553c7 100644 --- a/extensions/inc/propctrlr.h +++ b/extensions/inc/propctrlr.h @@ -20,64 +20,66 @@ #ifndef EXTENSIONS_PROPCTRLR_H #define EXTENSIONS_PROPCTRLR_H -#define UID_PROP_DLG_FONT_TYPE "EXTENSIONS_UID_PROP_DLG_FONT_TYPE" -#define UID_PROP_DLG_IMAGE_URL "EXTENSIONS_UID_PROP_DLG_IMAGE_URL" -#define UID_PROP_DLG_BACKGROUNDCOLOR "EXTENSIONS_UID_PROP_DLG_BACKGROUNDCOLOR" -#define UID_PROP_DLG_SYMBOLCOLOR "EXTENSIONS_UID_PROP_DLG_SYMBOLCOLOR" -#define UID_PROP_DLG_ATTR_DATASOURCE "EXTENSIONS_UID_PROP_DLG_ATTR_DATASOURCE" -#define UID_PROP_DLG_ATTR_TARGET_URL "EXTENSIONS_UID_PROP_DLG_ATTR_TARGET_URL" -#define UID_PROP_DLG_NUMBER_FORMAT "EXTENSIONS_UID_PROP_DLG_NUMBER_FORMAT" -#define UID_PROP_DLG_CONTROLLABEL "EXTENSIONS_UID_PROP_DLG_CONTROLLABEL" -#define UID_PROP_DLG_FILLCOLOR "EXTENSIONS_UID_PROP_DLG_FILLCOLOR" -#define UID_PROP_DLG_TABINDEX "EXTENSIONS_UID_PROP_DLG_TABINDEX" -#define UID_PROP_DLG_SQLCOMMAND "EXTENSIONS_UID_PROP_DLG_SQLCOMMAND" -#define UID_PROP_DLG_FORMLINKFIELDS "EXTENSIONS_UID_PROP_DLG_FORMLINKFIELDS" -#define UID_PROP_DLG_FILTER "EXTENSIONS_UID_PROP_DLG_FILTER" -#define UID_PROP_DLG_ORDER "EXTENSIONS_UID_PROP_DLG_ORDER" -#define UID_PROP_DLG_SELECTION "EXTENSIONS_UID_PROP_DLG_SELECTION" -#define UID_PROP_DLG_BIND_EXPRESSION "EXTENSIONS_UID_PROP_DLG_BIND_EXPRESSION" -#define UID_PROP_DLG_XSD_REQUIRED "EXTENSIONS_UID_PROP_DLG_XSD_REQUIRED" -#define UID_PROP_DLG_XSD_RELEVANT "EXTENSIONS_UID_PROP_DLG_XSD_RELEVANT" -#define UID_PROP_DLG_XSD_READONLY "EXTENSIONS_UID_PROP_DLG_XSD_READONLY" -#define UID_PROP_DLG_XSD_CONSTRAINT "EXTENSIONS_UID_PROP_DLG_XSD_CONSTRAINT" -#define UID_PROP_DLG_XSD_CALCULATION "EXTENSIONS_UID_PROP_DLG_XSD_CALCULATION" -#define UID_PROP_ADD_DATA_TYPE "EXTENSIONS_UID_PROP_ADD_DATA_TYPE" -#define UID_PROP_REMOVE_DATA_TYPE "EXTENSIONS_UID_PROP_REMOVE_DATA_TYPE" -#define UID_PROP_DLG_BORDERCOLOR "EXTENSIONS_UID_PROP_DLG_BORDERCOLOR" +#include <rtl/ustring.hxx> -#define UID_BRWEVT_APPROVEACTIONPERFORMED "EXTENSIONS_UID_BRWEVT_APPROVEACTIONPERFORMED" -#define UID_BRWEVT_ACTIONPERFORMED "EXTENSIONS_UID_BRWEVT_ACTIONPERFORMED" -#define UID_BRWEVT_CHANGED "EXTENSIONS_UID_BRWEVT_CHANGED" -#define UID_BRWEVT_TEXTCHANGED "EXTENSIONS_UID_BRWEVT_TEXTCHANGED" -#define UID_BRWEVT_ITEMSTATECHANGED "EXTENSIONS_UID_BRWEVT_ITEMSTATECHANGED" -#define UID_BRWEVT_FOCUSGAINED "EXTENSIONS_UID_BRWEVT_FOCUSGAINED" -#define UID_BRWEVT_FOCUSLOST "EXTENSIONS_UID_BRWEVT_FOCUSLOST" -#define UID_BRWEVT_KEYTYPED "EXTENSIONS_UID_BRWEVT_KEYTYPED" -#define UID_BRWEVT_KEYUP "EXTENSIONS_UID_BRWEVT_KEYUP" -#define UID_BRWEVT_MOUSEENTERED "EXTENSIONS_UID_BRWEVT_MOUSEENTERED" -#define UID_BRWEVT_MOUSEDRAGGED "EXTENSIONS_UID_BRWEVT_MOUSEDRAGGED" -#define UID_BRWEVT_MOUSEMOVED "EXTENSIONS_UID_BRWEVT_MOUSEMOVED" -#define UID_BRWEVT_MOUSEPRESSED "EXTENSIONS_UID_BRWEVT_MOUSEPRESSED" -#define UID_BRWEVT_MOUSERELEASED "EXTENSIONS_UID_BRWEVT_MOUSERELEASED" -#define UID_BRWEVT_MOUSEEXITED "EXTENSIONS_UID_BRWEVT_MOUSEEXITED" -#define UID_BRWEVT_APPROVERESETTED "EXTENSIONS_UID_BRWEVT_APPROVERESETTED" -#define UID_BRWEVT_RESETTED "EXTENSIONS_UID_BRWEVT_RESETTED" -#define UID_BRWEVT_SUBMITTED "EXTENSIONS_UID_BRWEVT_SUBMITTED" -#define UID_BRWEVT_BEFOREUPDATE "EXTENSIONS_UID_BRWEVT_BEFOREUPDATE" -#define UID_BRWEVT_AFTERUPDATE "EXTENSIONS_UID_BRWEVT_AFTERUPDATE" -#define UID_BRWEVT_LOADED "EXTENSIONS_UID_BRWEVT_LOADED" -#define UID_BRWEVT_RELOADING "EXTENSIONS_UID_BRWEVT_RELOADING" -#define UID_BRWEVT_RELOADED "EXTENSIONS_UID_BRWEVT_RELOADED" -#define UID_BRWEVT_UNLOADING "EXTENSIONS_UID_BRWEVT_UNLOADING" -#define UID_BRWEVT_UNLOADED "EXTENSIONS_UID_BRWEVT_UNLOADED" -#define UID_BRWEVT_CONFIRMDELETE "EXTENSIONS_UID_BRWEVT_CONFIRMDELETE" -#define UID_BRWEVT_APPROVEROWCHANGE "EXTENSIONS_UID_BRWEVT_APPROVEROWCHANGE" -#define UID_BRWEVT_ROWCHANGE "EXTENSIONS_UID_BRWEVT_ROWCHANGE" -#define UID_BRWEVT_POSITIONING "EXTENSIONS_UID_BRWEVT_POSITIONING" -#define UID_BRWEVT_POSITIONED "EXTENSIONS_UID_BRWEVT_POSITIONED" -#define UID_BRWEVT_APPROVEPARAMETER "EXTENSIONS_UID_BRWEVT_APPROVEPARAMETER" -#define UID_BRWEVT_ERROROCCURRED "EXTENSIONS_UID_BRWEVT_ERROROCCURRED" -#define UID_BRWEVT_ADJUSTMENTVALUECHANGED "EXTENSIONS_UID_BRWEVT_ADJUSTMENTVALUECHANGED" +inline constexpr OUString UID_PROP_DLG_FONT_TYPE = u"EXTENSIONS_UID_PROP_DLG_FONT_TYPE"_ustr; +inline constexpr OUString UID_PROP_DLG_IMAGE_URL = u"EXTENSIONS_UID_PROP_DLG_IMAGE_URL"_ustr; +inline constexpr OUString UID_PROP_DLG_BACKGROUNDCOLOR = u"EXTENSIONS_UID_PROP_DLG_BACKGROUNDCOLOR"_ustr; +inline constexpr OUString UID_PROP_DLG_SYMBOLCOLOR = u"EXTENSIONS_UID_PROP_DLG_SYMBOLCOLOR"_ustr; +inline constexpr OUString UID_PROP_DLG_ATTR_DATASOURCE = u"EXTENSIONS_UID_PROP_DLG_ATTR_DATASOURCE"_ustr; +inline constexpr OUString UID_PROP_DLG_ATTR_TARGET_URL = u"EXTENSIONS_UID_PROP_DLG_ATTR_TARGET_URL"_ustr; +inline constexpr OUString UID_PROP_DLG_NUMBER_FORMAT = u"EXTENSIONS_UID_PROP_DLG_NUMBER_FORMAT"_ustr; +inline constexpr OUString UID_PROP_DLG_CONTROLLABEL = u"EXTENSIONS_UID_PROP_DLG_CONTROLLABEL"_ustr; +inline constexpr OUString UID_PROP_DLG_FILLCOLOR = u"EXTENSIONS_UID_PROP_DLG_FILLCOLOR"_ustr; +inline constexpr OUString UID_PROP_DLG_TABINDEX = u"EXTENSIONS_UID_PROP_DLG_TABINDEX"_ustr; +inline constexpr OUString UID_PROP_DLG_SQLCOMMAND = u"EXTENSIONS_UID_PROP_DLG_SQLCOMMAND"_ustr; +inline constexpr OUString UID_PROP_DLG_FORMLINKFIELDS = u"EXTENSIONS_UID_PROP_DLG_FORMLINKFIELDS"_ustr; +inline constexpr OUString UID_PROP_DLG_FILTER = u"EXTENSIONS_UID_PROP_DLG_FILTER"_ustr; +inline constexpr OUString UID_PROP_DLG_ORDER = u"EXTENSIONS_UID_PROP_DLG_ORDER"_ustr; +inline constexpr OUString UID_PROP_DLG_SELECTION = u"EXTENSIONS_UID_PROP_DLG_SELECTION"_ustr; +inline constexpr OUString UID_PROP_DLG_BIND_EXPRESSION = u"EXTENSIONS_UID_PROP_DLG_BIND_EXPRESSION"_ustr; +inline constexpr OUString UID_PROP_DLG_XSD_REQUIRED = u"EXTENSIONS_UID_PROP_DLG_XSD_REQUIRED"_ustr; +inline constexpr OUString UID_PROP_DLG_XSD_RELEVANT = u"EXTENSIONS_UID_PROP_DLG_XSD_RELEVANT"_ustr; +inline constexpr OUString UID_PROP_DLG_XSD_READONLY = u"EXTENSIONS_UID_PROP_DLG_XSD_READONLY"_ustr; +inline constexpr OUString UID_PROP_DLG_XSD_CONSTRAINT = u"EXTENSIONS_UID_PROP_DLG_XSD_CONSTRAINT"_ustr; +inline constexpr OUString UID_PROP_DLG_XSD_CALCULATION = u"EXTENSIONS_UID_PROP_DLG_XSD_CALCULATION"_ustr; +inline constexpr OUString UID_PROP_ADD_DATA_TYPE = u"EXTENSIONS_UID_PROP_ADD_DATA_TYPE"_ustr; +inline constexpr OUString UID_PROP_REMOVE_DATA_TYPE = u"EXTENSIONS_UID_PROP_REMOVE_DATA_TYPE"_ustr; +inline constexpr OUString UID_PROP_DLG_BORDERCOLOR = u"EXTENSIONS_UID_PROP_DLG_BORDERCOLOR"_ustr; + +inline constexpr OString UID_BRWEVT_APPROVEACTIONPERFORMED = "EXTENSIONS_UID_BRWEVT_APPROVEACTIONPERFORMED"_ostr; +inline constexpr OString UID_BRWEVT_ACTIONPERFORMED = "EXTENSIONS_UID_BRWEVT_ACTIONPERFORMED"_ostr; +inline constexpr OString UID_BRWEVT_CHANGED = "EXTENSIONS_UID_BRWEVT_CHANGED"_ostr; +inline constexpr OString UID_BRWEVT_TEXTCHANGED = "EXTENSIONS_UID_BRWEVT_TEXTCHANGED"_ostr; +inline constexpr OString UID_BRWEVT_ITEMSTATECHANGED = "EXTENSIONS_UID_BRWEVT_ITEMSTATECHANGED"_ostr; +inline constexpr OString UID_BRWEVT_FOCUSGAINED = "EXTENSIONS_UID_BRWEVT_FOCUSGAINED"_ostr; +inline constexpr OString UID_BRWEVT_FOCUSLOST = "EXTENSIONS_UID_BRWEVT_FOCUSLOST"_ostr; +inline constexpr OString UID_BRWEVT_KEYTYPED = "EXTENSIONS_UID_BRWEVT_KEYTYPED"_ostr; +inline constexpr OString UID_BRWEVT_KEYUP = "EXTENSIONS_UID_BRWEVT_KEYUP"_ostr; +inline constexpr OString UID_BRWEVT_MOUSEENTERED = "EXTENSIONS_UID_BRWEVT_MOUSEENTERED"_ostr; +inline constexpr OString UID_BRWEVT_MOUSEDRAGGED = "EXTENSIONS_UID_BRWEVT_MOUSEDRAGGED"_ostr; +inline constexpr OString UID_BRWEVT_MOUSEMOVED = "EXTENSIONS_UID_BRWEVT_MOUSEMOVED"_ostr; +inline constexpr OString UID_BRWEVT_MOUSEPRESSED = "EXTENSIONS_UID_BRWEVT_MOUSEPRESSED"_ostr; +inline constexpr OString UID_BRWEVT_MOUSERELEASED = "EXTENSIONS_UID_BRWEVT_MOUSERELEASED"_ostr; +inline constexpr OString UID_BRWEVT_MOUSEEXITED = "EXTENSIONS_UID_BRWEVT_MOUSEEXITED"_ostr; +inline constexpr OString UID_BRWEVT_APPROVERESETTED = "EXTENSIONS_UID_BRWEVT_APPROVERESETTED"_ostr; +inline constexpr OString UID_BRWEVT_RESETTED = "EXTENSIONS_UID_BRWEVT_RESETTED"_ostr; +inline constexpr OString UID_BRWEVT_SUBMITTED = "EXTENSIONS_UID_BRWEVT_SUBMITTED"_ostr; +inline constexpr OString UID_BRWEVT_BEFOREUPDATE = "EXTENSIONS_UID_BRWEVT_BEFOREUPDATE"_ostr; +inline constexpr OString UID_BRWEVT_AFTERUPDATE = "EXTENSIONS_UID_BRWEVT_AFTERUPDATE"_ostr; +inline constexpr OString UID_BRWEVT_LOADED = "EXTENSIONS_UID_BRWEVT_LOADED"_ostr; +inline constexpr OString UID_BRWEVT_RELOADING = "EXTENSIONS_UID_BRWEVT_RELOADING"_ostr; +inline constexpr OString UID_BRWEVT_RELOADED = "EXTENSIONS_UID_BRWEVT_RELOADED"_ostr; +inline constexpr OString UID_BRWEVT_UNLOADING = "EXTENSIONS_UID_BRWEVT_UNLOADING"_ostr; +inline constexpr OString UID_BRWEVT_UNLOADED = "EXTENSIONS_UID_BRWEVT_UNLOADED"_ostr; +inline constexpr OString UID_BRWEVT_CONFIRMDELETE = "EXTENSIONS_UID_BRWEVT_CONFIRMDELETE"_ostr; +inline constexpr OString UID_BRWEVT_APPROVEROWCHANGE = "EXTENSIONS_UID_BRWEVT_APPROVEROWCHANGE"_ostr; +inline constexpr OString UID_BRWEVT_ROWCHANGE = "EXTENSIONS_UID_BRWEVT_ROWCHANGE"_ostr; +inline constexpr OString UID_BRWEVT_POSITIONING = "EXTENSIONS_UID_BRWEVT_POSITIONING"_ostr; +inline constexpr OString UID_BRWEVT_POSITIONED = "EXTENSIONS_UID_BRWEVT_POSITIONED"_ostr; +inline constexpr OString UID_BRWEVT_APPROVEPARAMETER = "EXTENSIONS_UID_BRWEVT_APPROVEPARAMETER"_ostr; +inline constexpr OString UID_BRWEVT_ERROROCCURRED = "EXTENSIONS_UID_BRWEVT_ERROROCCURRED"_ostr; +inline constexpr OString UID_BRWEVT_ADJUSTMENTVALUECHANGED = "EXTENSIONS_UID_BRWEVT_ADJUSTMENTVALUECHANGED"_ostr; #endif // EXTENSIONS_PROPCTRLR_HRC diff --git a/extensions/inc/showhide.hrc b/extensions/inc/showhide.hrc index 0f7ec42ad346..3b5a931419a2 100644 --- a/extensions/inc/showhide.hrc +++ b/extensions/inc/showhide.hrc @@ -20,11 +20,13 @@ #ifndef INCLUDED_EXTENSIONS_INC_SHOWHIDE_HRC #define INCLUDED_EXTENSIONS_INC_SHOWHIDE_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#include <unotools/resmgr.hxx> + +#define NC_(Context, String) TranslateId(Context, u8##String) namespace { -const char* RID_RSC_ENUM_SHOWHIDE[] = +const TranslateId RID_RSC_ENUM_SHOWHIDE[] = { NC_("RID_RSC_ENUM_SHOWHIDE", "Hide"), NC_("RID_RSC_ENUM_SHOWHIDE", "Show") diff --git a/extensions/inc/stringarrays.hrc b/extensions/inc/stringarrays.hrc index c7053e143bf0..6eadf46cc42f 100644 --- a/extensions/inc/stringarrays.hrc +++ b/extensions/inc/stringarrays.hrc @@ -20,29 +20,31 @@ #ifndef INCLUDED_EXTENSIONS_INC_STRINGARRAYS_HRC #define INCLUDED_EXTENSIONS_INC_STRINGARRAYS_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#include <unotools/resmgr.hxx> -const char* RID_RSC_ENUM_VERTICAL_ALIGN[] = +#define NC_(Context, String) TranslateId(Context, u8##String) + +const TranslateId RID_RSC_ENUM_VERTICAL_ALIGN[] = { NC_("RID_RSC_ENUM_VERTICAL_ALIGN", "Top"), NC_("RID_RSC_ENUM_VERTICAL_ALIGN", "Middle"), NC_("RID_RSC_ENUM_VERTICAL_ALIGN", "Bottom") }; -const char* RID_RSC_ENUM_ICONSIZE_TYPE[] = +const TranslateId RID_RSC_ENUM_ICONSIZE_TYPE[] = { NC_("RID_RSC_ENUM_ICONSIZE_TYPE", "Small"), NC_("RID_RSC_ENUM_ICONSIZE_TYPE", "Large") }; -const char* RID_RSC_ENUM_BORDER_TYPE[] = +const TranslateId RID_RSC_ENUM_BORDER_TYPE[] = { NC_("RID_RSC_ENUM_BORDER_TYPE", "Without frame"), NC_("RID_RSC_ENUM_BORDER_TYPE", "3D look"), NC_("RID_RSC_ENUM_BORDER_TYPE", "Flat") }; -const char* RID_RSC_ENUM_LISTSOURCE_TYPE[] = +const TranslateId RID_RSC_ENUM_LISTSOURCE_TYPE[] = { NC_("RID_RSC_ENUM_LISTSOURCE_TYPE", "Valuelist"), NC_("RID_RSC_ENUM_LISTSOURCE_TYPE", "Table"), @@ -52,14 +54,14 @@ const char* RID_RSC_ENUM_LISTSOURCE_TYPE[] = NC_("RID_RSC_ENUM_LISTSOURCE_TYPE", "Tablefields" ) }; -const char* RID_RSC_ENUM_ALIGNMENT[] = +const TranslateId RID_RSC_ENUM_ALIGNMENT[] = { NC_("RID_RSC_ENUM_ALIGNMENT", "Left"), NC_("RID_RSC_ENUM_ALIGNMENT", "Center"), NC_("RID_RSC_ENUM_ALIGNMENT", "Right" ) }; -const char* RID_RSC_ENUM_BUTTONTYPE[] = +const TranslateId RID_RSC_ENUM_BUTTONTYPE[] = { NC_("RID_RSC_ENUM_BUTTONTYPE", "None"), NC_("RID_RSC_ENUM_BUTTONTYPE", "Submit form"), @@ -76,20 +78,14 @@ const char* RID_RSC_ENUM_BUTTONTYPE[] = NC_("RID_RSC_ENUM_BUTTONTYPE", "Refresh form") }; -const char* RID_RSC_ENUM_SUBMIT_METHOD[] = -{ - NC_("RID_RSC_ENUM_SUBMIT_METHOD", "Get"), - NC_("RID_RSC_ENUM_SUBMIT_METHOD", "Post" ) -}; - -const char* RID_RSC_ENUM_SUBMIT_ENCODING[] = +const TranslateId RID_RSC_ENUM_SUBMIT_ENCODING[] = { NC_("RID_RSC_ENUM_SUBMIT_ENCODING", "URL"), NC_("RID_RSC_ENUM_SUBMIT_ENCODING", "Multipart"), NC_("RID_RSC_ENUM_SUBMIT_ENCODING", "Text" ) }; -const char* RID_RSC_ENUM_DATEFORMAT_LIST[] = +const TranslateId RID_RSC_ENUM_DATEFORMAT_LIST[] = { NC_("RID_RSC_ENUM_DATEFORMAT_LIST", "Standard (short)"), NC_("RID_RSC_ENUM_DATEFORMAT_LIST", "Standard (short YY)"), @@ -105,7 +101,7 @@ const char* RID_RSC_ENUM_DATEFORMAT_LIST[] = NC_("RID_RSC_ENUM_DATEFORMAT_LIST", "YYYY-MM-DD" ), }; -const char* RID_RSC_ENUM_TIMEFORMAT_LIST[] = +const TranslateId RID_RSC_ENUM_TIMEFORMAT_LIST[] = { NC_("RID_RSC_ENUM_TIMEFORMAT_LIST", "13:45"), NC_("RID_RSC_ENUM_TIMEFORMAT_LIST", "13:45:00"), @@ -113,28 +109,28 @@ const char* RID_RSC_ENUM_TIMEFORMAT_LIST[] = NC_("RID_RSC_ENUM_TIMEFORMAT_LIST", "01:45:00 PM" ), }; -const char* RID_RSC_ENUM_CHECKED[] = +const TranslateId RID_RSC_ENUM_CHECKED[] = { NC_("RID_RSC_ENUM_CHECKED", "Not Selected"), NC_("RID_RSC_ENUM_CHECKED", "Selected"), NC_("RID_RSC_ENUM_CHECKED", "Not Defined" ) }; -const char* RID_RSC_ENUM_CYCLE[] = +const TranslateId RID_RSC_ENUM_CYCLE[] = { NC_("RID_RSC_ENUM_CYCLE", "All records"), NC_("RID_RSC_ENUM_CYCLE", "Active record"), NC_("RID_RSC_ENUM_CYCLE", "Current page" ) }; -const char* RID_RSC_ENUM_NAVIGATION[] = +const TranslateId RID_RSC_ENUM_NAVIGATION[] = { NC_("RID_RSC_ENUM_NAVIGATION", "No"), NC_("RID_RSC_ENUM_NAVIGATION", "Yes"), NC_("RID_RSC_ENUM_NAVIGATION", "Parent Form") }; -const char* RID_RSC_ENUM_SUBMIT_TARGET[] = +const TranslateId RID_RSC_ENUM_SUBMIT_TARGET[] = { NC_("RID_RSC_ENUM_SUBMIT_TARGET", "_blank"), NC_("RID_RSC_ENUM_SUBMIT_TARGET", "_parent"), @@ -142,7 +138,7 @@ const char* RID_RSC_ENUM_SUBMIT_TARGET[] = NC_("RID_RSC_ENUM_SUBMIT_TARGET", "_top") }; -const char* RID_RSC_ENUM_SELECTION_TYPE[] = +const TranslateId RID_RSC_ENUM_SELECTION_TYPE[] = { NC_("RID_RSC_ENUM_SELECTION_TYPE", "None" ), NC_("RID_RSC_ENUM_SELECTION_TYPE", "Single" ), @@ -150,13 +146,13 @@ const char* RID_RSC_ENUM_SELECTION_TYPE[] = NC_("RID_RSC_ENUM_SELECTION_TYPE", "Range" ) }; -const char* RID_RSC_ENUM_ORIENTATION[] = +const TranslateId RID_RSC_ENUM_ORIENTATION[] = { NC_("RID_RSC_ENUM_ORIENTATION", "Horizontal"), NC_("RID_RSC_ENUM_ORIENTATION", "Vertical") }; -const char* RID_RSC_ENUM_PUSHBUTTONTYPE[] = +const TranslateId RID_RSC_ENUM_PUSHBUTTONTYPE[] = { NC_("RID_RSC_ENUM_PUSHBUTTONTYPE", "Default"), NC_("RID_RSC_ENUM_PUSHBUTTONTYPE", "OK"), @@ -164,26 +160,26 @@ const char* RID_RSC_ENUM_PUSHBUTTONTYPE[] = NC_("RID_RSC_ENUM_PUSHBUTTONTYPE", "Help") }; -const char* RID_RSC_ENUM_CELL_EXCHANGE_TYPE[] = +const TranslateId RID_RSC_ENUM_CELL_EXCHANGE_TYPE[] = { NC_("RID_RSC_ENUM_CELL_EXCHANGE_TYPE", "The selected entry"), NC_("RID_RSC_ENUM_CELL_EXCHANGE_TYPE", "Position of the selected entry") }; -const char* RID_RSC_ENUM_TEXTTYPE[] = +const TranslateId RID_RSC_ENUM_TEXTTYPE[] = { NC_("RID_RSC_ENUM_TEXTTYPE", "Single-line"), NC_("RID_RSC_ENUM_TEXTTYPE", "Multi-line"), NC_("RID_RSC_ENUM_TEXTTYPE", "Multi-line with formatting") }; -const char* RID_RSC_ENUM_LINEEND_FORMAT[] = +const TranslateId RID_RSC_ENUM_LINEEND_FORMAT[] = { NC_("RID_RSC_ENUM_LINEEND_FORMAT", "LF (Unix)"), NC_("RID_RSC_ENUM_LINEEND_FORMAT", "CR+LF (Windows)") }; -const char* RID_RSC_ENUM_SCROLLBARS[] = +const TranslateId RID_RSC_ENUM_SCROLLBARS[] = { NC_("RID_RSC_ENUM_SCROLLBARS", "None"), NC_("RID_RSC_ENUM_SCROLLBARS", "Horizontal"), @@ -191,13 +187,13 @@ const char* RID_RSC_ENUM_SCROLLBARS[] = NC_("RID_RSC_ENUM_SCROLLBARS", "Both") }; -const char* RID_RSC_ENUM_VISUALEFFECT[] = +const TranslateId RID_RSC_ENUM_VISUALEFFECT[] = { NC_("RID_RSC_ENUM_VISUALEFFECT", "3D"), NC_("RID_RSC_ENUM_VISUALEFFECT", "Flat"), }; -const char* RID_RSC_ENUM_IMAGE_POSITION[] = +const TranslateId RID_RSC_ENUM_IMAGE_POSITION[] = { NC_("RID_RSC_ENUM_IMAGE_POSITION", "Left top"), NC_("RID_RSC_ENUM_IMAGE_POSITION", "Left centered"), @@ -214,35 +210,35 @@ const char* RID_RSC_ENUM_IMAGE_POSITION[] = NC_("RID_RSC_ENUM_IMAGE_POSITION", "Centered"), }; -const char* RID_RSC_ENUM_WHITESPACE_HANDLING[] = +const TranslateId RID_RSC_ENUM_WHITESPACE_HANDLING[] = { NC_("RID_RSC_ENUM_WHITESPACE_HANDLING", "Preserve"), NC_("RID_RSC_ENUM_WHITESPACE_HANDLING", "Replace"), NC_("RID_RSC_ENUM_WHITESPACE_HANDLING", "Collapse") }; -const char* RID_RSC_ENUM_SCALE_MODE[] = +const TranslateId RID_RSC_ENUM_SCALE_MODE[] = { NC_("RID_RSC_ENUM_SCALE_MODE", "No"), NC_("RID_RSC_ENUM_SCALE_MODE", "Keep Ratio"), NC_("RID_RSC_ENUM_SCALE_MODE", "Fit to Size") }; -const char* RID_RSC_ENUM_WRITING_MODE[] = +const TranslateId RID_RSC_ENUM_WRITING_MODE[] = { NC_("RID_RSC_ENUM_WRITING_MODE", "Left-to-right"), NC_("RID_RSC_ENUM_WRITING_MODE", "Right-to-left"), NC_("RID_RSC_ENUM_WRITING_MODE", "Use superordinate object settings") }; -const char* RID_RSC_ENUM_WHEEL_BEHAVIOR[] = +const TranslateId RID_RSC_ENUM_WHEEL_BEHAVIOR[] = { NC_("RID_RSC_ENUM_WHEEL_BEHAVIOR", "Never"), NC_("RID_RSC_ENUM_WHEEL_BEHAVIOR", "When focused"), NC_("RID_RSC_ENUM_WHEEL_BEHAVIOR", "Always") }; -const char* RID_RSC_ENUM_TEXT_ANCHOR_TYPE[] = +const TranslateId RID_RSC_ENUM_TEXT_ANCHOR_TYPE[] = { NC_("RID_RSC_ENUM_TEXT_ANCHOR_TYPE", "To Paragraph"), NC_("RID_RSC_ENUM_TEXT_ANCHOR_TYPE", "As Character"), @@ -251,7 +247,7 @@ const char* RID_RSC_ENUM_TEXT_ANCHOR_TYPE[] = NC_("RID_RSC_ENUM_TEXT_ANCHOR_TYPE", "To Character") }; -const char* RID_RSC_ENUM_SHEET_ANCHOR_TYPE[] = +const TranslateId RID_RSC_ENUM_SHEET_ANCHOR_TYPE[] = { NC_("RID_RSC_ENUM_SHEET_ANCHOR_TYPE", "To Page"), NC_("RID_RSC_ENUM_SHEET_ANCHOR_TYPE", "To Cell") diff --git a/extensions/inc/strings.hrc b/extensions/inc/strings.hrc index 63dc3ced1b7d..a14f66ef78a2 100644 --- a/extensions/inc/strings.hrc +++ b/extensions/inc/strings.hrc @@ -20,7 +20,9 @@ #ifndef INCLUDED_EXTENSIONS_INC_STRINGS_HRC #define INCLUDED_EXTENSIONS_INC_STRINGS_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#include <unotools/resmgr.hxx> + +#define NC_(Context, String) TranslateId(Context, u8##String) #define RID_STR_EDITMASK NC_("RID_STR_EDITMASK", "Edit mask") #define RID_STR_LITERALMASK NC_("RID_STR_LITERALMASK", "Literal mask") @@ -281,7 +283,7 @@ #define RID_STR_PROPTITLE_NUMERICFIELD NC_("RID_STR_PROPTITLE_NUMERICFIELD", "Numeric Field") #define RID_STR_PROPTITLE_CURRENCYFIELD NC_("RID_STR_PROPTITLE_CURRENCYFIELD", "Currency Field") #define RID_STR_PROPTITLE_PATTERNFIELD NC_("RID_STR_PROPTITLE_PATTERNFIELD", "Pattern Field") -#define RID_STR_PROPTITLE_DBGRID NC_("RID_STR_PROPTITLE_DBGRID", "Table Control ") +#define RID_STR_PROPTITLE_DBGRID NC_("RID_STR_PROPTITLE_DBGRID", "Table Control") #define STR_DETAIL_FORM NC_("STR_DETAIL_FORM", "Sub Form") #define STR_MASTER_FORM NC_("STR_MASTER_FORM", "Master Form") @@ -303,8 +305,6 @@ #define RID_UPDATE_STR_DOWNLOADING NC_("RID_UPDATE_STR_DOWNLOADING", "Downloading %PRODUCTNAME %NEXTVERSION...") #define RID_UPDATE_STR_READY_INSTALL NC_("RID_UPDATE_STR_READY_INSTALL", "Download of %PRODUCTNAME %NEXTVERSION completed. Ready for installation.") #define RID_UPDATE_STR_CANCEL_DOWNLOAD NC_("RID_UPDATE_STR_CANCEL_DOWNLOAD", "Do you really want to cancel the download?") -#define RID_UPDATE_STR_BEGIN_INSTALL NC_("RID_UPDATE_STR_BEGIN_INSTALL", "To install the update, %PRODUCTNAME %PRODUCTVERSION needs to be closed. Do you want to install the update now?") -#define RID_UPDATE_STR_INSTALL_ERROR NC_("RID_UPDATE_STR_INSTALL_ERROR", "Could not run the installer application, please run %FILE_NAME in %DOWNLOAD_PATH manually.") #define RID_UPDATE_STR_OVERWRITE_WARNING NC_("RID_UPDATE_STR_OVERWRITE_WARNING", "A file with that name already exists! Do you want to overwrite the existing file?") #define RID_UPDATE_STR_RELOAD_WARNING NC_("RID_UPDATE_STR_RELOAD_WARNING", "A file with the name '%FILENAME' already exists in '%DOWNLOAD_PATH'! Do you want to continue with the download or delete and reload the file?") #define RID_UPDATE_STR_RELOAD_RELOAD NC_("RID_UPDATE_STR_RELOAD_RELOAD", "Reload File") @@ -314,7 +314,6 @@ #define RID_UPDATE_FT_DESCRIPTION NC_("RID_UPDATE_FT_DESCRIPTION", "Description") #define RID_UPDATE_BTN_CLOSE NC_("RID_UPDATE_BTN_CLOSE", "Close") #define RID_UPDATE_BTN_DOWNLOAD NC_("RID_UPDATE_BTN_DOWNLOAD", "~Download") -#define RID_UPDATE_BTN_INSTALL NC_("RID_UPDATE_BTN_INSTALL", "~Install") #define RID_UPDATE_BTN_PAUSE NC_("RID_UPDATE_BTN_PAUSE", "~Pause") #define RID_UPDATE_BTN_RESUME NC_("RID_UPDATE_BTN_RESUME", "~Resume") #define RID_UPDATE_BTN_CANCEL NC_("RID_UPDATE_BTN_CANCEL", "Cancel") diff --git a/extensions/inc/yesno.hrc b/extensions/inc/yesno.hrc index 3992a1e8ab28..d205e604c495 100644 --- a/extensions/inc/yesno.hrc +++ b/extensions/inc/yesno.hrc @@ -20,11 +20,13 @@ #ifndef INCLUDED_EXTENSIONS_INC_YESNO_HRC #define INCLUDED_EXTENSIONS_INC_YESNO_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#include <unotools/resmgr.hxx> + +#define NC_(Context, String) TranslateId(Context, u8##String) namespace { -const char* RID_RSC_ENUM_YESNO[] = +const TranslateId RID_RSC_ENUM_YESNO[] = { NC_("RID_RSC_ENUM_YESNO", "No" ), NC_("RID_RSC_ENUM_YESNO", "Yes" ) diff --git a/extensions/qa/bibliography/bibliography.cxx b/extensions/qa/bibliography/bibliography.cxx new file mode 100644 index 000000000000..3919b787f3fe --- /dev/null +++ b/extensions/qa/bibliography/bibliography.cxx @@ -0,0 +1,50 @@ +/* -*- 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/. + */ + +#include <test/bootstrapfixture.hxx> +#include <unotest/macros_test.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/Bibliography.hpp> + +using namespace ::com::sun::star; + +namespace +{ +/// Covers extensions/source/bibliography/ fixes. +class Test : public test::BootstrapFixture, public unotest::MacrosTest +{ +}; +} + +CPPUNIT_TEST_FIXTURE(Test, testBibliographyLoader) +{ + // Given a bibliography provider: + uno::Reference<container::XNameAccess> xBibAccess + = frame::Bibliography::create(mxComponentContext); + uno::Reference<beans::XPropertySet> xPropSet(xBibAccess, uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aSeq; + + // When getting the column names: + xPropSet->getPropertyValue("BibliographyDataFieldNames") >>= aSeq; + + // Then make sure we have columns and all have non-empty names: + CPPUNIT_ASSERT(aSeq.hasElements()); + + // Without the accompanying fix in place, this test would have failed, as the last column + // (LOCAL_URL) had an empty field name: + for (const auto& rPair : aSeq) + { + CPPUNIT_ASSERT(!rPair.Name.isEmpty()); + } +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/qa/update/test_update.cxx b/extensions/qa/update/test_update.cxx index f99855dc6198..27d634b3b374 100644 --- a/extensions/qa/update/test_update.cxx +++ b/extensions/qa/update/test_update.cxx @@ -37,8 +37,7 @@ public: m_xProvider = deployment::UpdateInformationProvider::create( m_xContext ); // repositories that we will be checking - m_aRepositoryList.realloc( 1 ); - m_aRepositoryList[0] = m_directories.getURLFromSrc( u"/extensions/qa/update/simple.xml" ); + m_aRepositoryList = { m_directories.getURLFromSrc( u"/extensions/qa/update/simple.xml" ) }; } virtual void tearDown() override diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx index 802b0d853b52..c75f9cc5b168 100644 --- a/extensions/source/abpilot/abpfinalpage.cxx +++ b/extensions/source/abpilot/abpfinalpage.cxx @@ -27,13 +27,10 @@ #include <unotools/pathoptions.hxx> #include <svl/filenotation.hxx> #include <sfx2/docfilt.hxx> +#include <o3tl/string_view.hxx> namespace abp { - - using namespace ::svt; - using namespace ::utl; - static std::shared_ptr<const SfxFilter> lcl_getBaseFilter() { std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)"); @@ -61,9 +58,9 @@ namespace abp m_xName->connect_changed( LINK(this, FinalPage, OnEntryNameModified) ); m_xLocation->connect_changed( LINK(this, FinalPage, OnComboNameModified) ); - m_xRegisterName->connect_clicked( LINK( this, FinalPage, OnRegister ) ); + m_xRegisterName->connect_toggled( LINK( this, FinalPage, OnRegister ) ); m_xRegisterName->set_active(true); - m_xEmbed->connect_clicked( LINK( this, FinalPage, OnEmbed ) ); + m_xEmbed->connect_toggled( LINK( this, FinalPage, OnEmbed ) ); m_xEmbed->set_active(true); } @@ -94,14 +91,14 @@ namespace abp INetURLObject aURL( rSettings.sDataSourceName ); if( aURL.GetProtocol() == INetProtocol::NotValid ) { - OUString sPath = SvtPathOptions().GetWorkPath(); - sPath += "/" + rSettings.sDataSourceName; + OUString sPath = SvtPathOptions().GetWorkPath() + + "/" + rSettings.sDataSourceName; std::shared_ptr<const SfxFilter> pFilter = lcl_getBaseFilter(); if ( pFilter ) { OUString sExt = pFilter->GetDefaultExtension(); - sPath += sExt.getToken(1,'*'); + sPath += o3tl::getToken(sExt,1,'*'); } aURL.SetURL(sPath); @@ -113,7 +110,7 @@ namespace abp sal_Int32 nPos = sName.indexOf(aURL.GetFileExtension()); if ( nPos != -1 ) { - sName = sName.replaceAt(nPos-1, 4, ""); + sName = sName.replaceAt(nPos-1, 4, u""); } m_xName->set_text(sName); @@ -204,7 +201,7 @@ namespace abp implCheckName(); } - IMPL_LINK_NOARG(FinalPage, OnRegister, weld::Button&, void) + IMPL_LINK_NOARG(FinalPage, OnRegister, weld::Toggleable&, void) { bool bEnable = m_xRegisterName->get_active(); m_xNameLabel->set_sensitive(bEnable); @@ -212,7 +209,7 @@ namespace abp implCheckName(); } - IMPL_LINK_NOARG(FinalPage, OnEmbed, weld::Button&, void) + IMPL_LINK_NOARG(FinalPage, OnEmbed, weld::Toggleable&, void) { bool bEmbed = m_xEmbed->get_active(); m_xLocationLabel->set_sensitive(!bEmbed); diff --git a/extensions/source/abpilot/abpfinalpage.hxx b/extensions/source/abpilot/abpfinalpage.hxx index 400d4d8ad5e6..6c6c5d69d989 100644 --- a/extensions/source/abpilot/abpfinalpage.hxx +++ b/extensions/source/abpilot/abpfinalpage.hxx @@ -62,8 +62,8 @@ namespace abp DECL_LINK(OnEntryNameModified, weld::Entry&, void); DECL_LINK(OnComboNameModified, weld::ComboBox&, void); - DECL_LINK(OnRegister, weld::Button&, void); - DECL_LINK(OnEmbed, weld::Button&, void); + DECL_LINK(OnRegister, weld::Toggleable&, void); + DECL_LINK(OnEmbed, weld::Toggleable&, void); bool isValidName() const; void implCheckName(); diff --git a/extensions/source/abpilot/abspage.cxx b/extensions/source/abpilot/abspage.cxx index ee36cee27ab1..fbe338ea56c8 100644 --- a/extensions/source/abpilot/abspage.cxx +++ b/extensions/source/abpilot/abspage.cxx @@ -23,9 +23,8 @@ namespace abp { using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - AddressBookSourcePage::AddressBookSourcePage(weld::Container* pPage, OAddressBookSourcePilot* pDialog, const OUString& rUIXMLDescription, const OString& rID) + AddressBookSourcePage::AddressBookSourcePage(weld::Container* pPage, OAddressBookSourcePilot* pDialog, const OUString& rUIXMLDescription, const OUString& rID) : AddressBookSourcePage_Base(pPage, pDialog, rUIXMLDescription, rID) , m_pDialog(pDialog) { diff --git a/extensions/source/abpilot/abspage.hxx b/extensions/source/abpilot/abspage.hxx index 4d78533ad885..407713fab99d 100644 --- a/extensions/source/abpilot/abspage.hxx +++ b/extensions/source/abpilot/abspage.hxx @@ -37,7 +37,7 @@ namespace abp OAddressBookSourcePilot* m_pDialog; protected: - AddressBookSourcePage(weld::Container* pPage, OAddressBookSourcePilot* pController, const OUString& rUIXMLDescription, const OString& rID); + AddressBookSourcePage(weld::Container* pPage, OAddressBookSourcePilot* pController, const OUString& rUIXMLDescription, const OUString& rID); protected: // helper diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx index fee75664d983..fc135ec80c8f 100644 --- a/extensions/source/abpilot/abspilot.cxx +++ b/extensions/source/abpilot/abspilot.cxx @@ -50,7 +50,6 @@ namespace abp #define PATH_NO_SETTINGS_NO_FIELDS 4 using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; OAddressBookSourcePilot::OAddressBookSourcePilot(weld::Window* _pParent, const Reference< XComponentContext >& _rxORB) :OAddressBookSourcePilot_Base( _pParent ) @@ -119,7 +118,7 @@ namespace abp OUString OAddressBookSourcePilot::getStateDisplayName( WizardState _nState ) const { - const char* pResId = nullptr; + TranslateId pResId; switch ( _nState ) { case STATE_SELECT_ABTYPE: pResId = RID_STR_SELECT_ABTYPE; break; @@ -157,7 +156,7 @@ namespace abp addressconfig::writeTemplateAddressSource( getORB(), m_aSettings.bRegisterDataSource ? m_aSettings.sRegisteredDataSourceName : m_aSettings.sDataSourceName, m_aSettings.sSelectedTable ); // 4. write the field mapping - fieldmapping::writeTemplateAddressFieldMapping( getORB(), m_aSettings.aFieldMapping ); + fieldmapping::writeTemplateAddressFieldMapping( getORB(), std::map(m_aSettings.aFieldMapping) ); } void OAddressBookSourcePilot::implCleanup() @@ -361,7 +360,7 @@ namespace abp std::unique_ptr<BuilderPage> OAddressBookSourcePilot::createPage(WizardState _nState) { - OString sIdent(OString::number(_nState)); + OUString sIdent(OUString::number(_nState)); weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); std::unique_ptr<vcl::OWizardPage> xRet; diff --git a/extensions/source/abpilot/admininvokationimpl.cxx b/extensions/source/abpilot/admininvokationimpl.cxx index c8ec00b681a7..7e919c7e7ce0 100644 --- a/extensions/source/abpilot/admininvokationimpl.cxx +++ b/extensions/source/abpilot/admininvokationimpl.cxx @@ -18,7 +18,7 @@ */ #include "admininvokationimpl.hxx" -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <tools/debug.hxx> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/awt/XWindow.hpp> @@ -26,6 +26,7 @@ #include <comphelper/propertysequence.hxx> #include <strings.hrc> #include <componentmodule.hxx> +#include <utility> #include <vcl/stdtext.hxx> #include <vcl/weld.hxx> @@ -36,15 +37,14 @@ namespace abp using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::awt; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::sdbc; OAdminDialogInvokation::OAdminDialogInvokation(const Reference< XComponentContext >& _rxContext, - const css::uno::Reference< css::beans::XPropertySet >& _rxDataSource, + css::uno::Reference< css::beans::XPropertySet > _xDataSource, weld::Window* _pMessageParent) :m_xContext(_rxContext) - ,m_xDataSource(_rxDataSource) + ,m_xDataSource(std::move(_xDataSource)) ,m_pMessageParent(_pMessageParent) { DBG_ASSERT(m_xContext.is(), "OAdminDialogInvokation::OAdminDialogInvokation: invalid service factory!"); diff --git a/extensions/source/abpilot/admininvokationimpl.hxx b/extensions/source/abpilot/admininvokationimpl.hxx index 2003809c8727..fef7a11eb388 100644 --- a/extensions/source/abpilot/admininvokationimpl.hxx +++ b/extensions/source/abpilot/admininvokationimpl.hxx @@ -40,7 +40,7 @@ namespace abp public: OAdminDialogInvokation( const css::uno::Reference< css::uno::XComponentContext >& _rxContext, - const css::uno::Reference< css::beans::XPropertySet >& _rDataSource, + css::uno::Reference< css::beans::XPropertySet > _xDataSource, weld::Window* _pMessageParent ); diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx index ceb5e90f2515..fd5820fce1ee 100644 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ b/extensions/source/abpilot/datasourcehandling.cxx @@ -43,7 +43,7 @@ #include <comphelper/interaction.hxx> #include <comphelper/processfactory.hxx> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <unotools/sharedunocomponent.hxx> #include <vcl/stdtext.hxx> #include <vcl/weld.hxx> @@ -87,10 +87,6 @@ namespace abp using namespace ::com::sun::star::container; using namespace ::com::sun::star::frame; - - struct PackageAccessControl { }; - - static Reference< XDatabaseContext > lcl_getDataSourceContext( const Reference< XComponentContext >& _rxContext ) { Reference<XDatabaseContext> xContext = DatabaseContext::create(_rxContext); @@ -145,11 +141,11 @@ namespace abp { xNewDataSource->setPropertyValue( "URL", - makeAny( OUString::createFromAscii( _pInitialAsciiURL ) ) + Any( OUString::createFromAscii( _pInitialAsciiURL ) ) ); } - aReturn.setDataSource( xNewDataSource, _rName,PackageAccessControl() ); + aReturn.setDataSource( xNewDataSource, _rName ); } catch(const Exception&) { @@ -364,9 +360,9 @@ namespace abp uno::Reference<embed::XStorage> xStorage = pObjectShell->GetStorage(); uno::Sequence<beans::PropertyValue> aSequence = comphelper::InitPropertySequence( { - {"TargetStorage", uno::makeAny(xStorage)}, - {"StreamRelPath", uno::makeAny(aStreamRelPath)}, - {"BaseURI", uno::makeAny(aOwnURL)} + {"TargetStorage", uno::Any(xStorage)}, + {"StreamRelPath", uno::Any(aStreamRelPath)}, + {"BaseURI", uno::Any(aOwnURL)} }); xStorable->storeAsURL(sTmpName, aSequence); m_pImpl->sName = sTmpName; @@ -375,7 +371,7 @@ namespace abp // we can load it again next time the file is imported. uno::Reference<lang::XMultiServiceFactory> xFactory(pObjectShell->GetModel(), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPropertySet(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); - xPropertySet->setPropertyValue("EmbeddedDatabaseName", uno::makeAny(aStreamRelPath)); + xPropertySet->setPropertyValue("EmbeddedDatabaseName", uno::Any(aStreamRelPath)); } } } @@ -405,7 +401,7 @@ namespace abp } - void ODataSource::setDataSource( const Reference< XPropertySet >& _rxDS,const OUString& _sName, PackageAccessControl ) + void ODataSource::setDataSource( const Reference< XPropertySet >& _rxDS,const OUString& _sName ) { if (m_pImpl->xDataSource.get() == _rxDS.get()) // nothing to do @@ -562,17 +558,17 @@ namespace abp if ( aException.Message.isEmpty() ) { // prepend some context info - SQLContext aDetailedError; - aDetailedError.Message = compmodule::ModuleRes(RID_STR_NOCONNECTION); - aDetailedError.Details = compmodule::ModuleRes(RID_STR_PLEASECHECKSETTINGS); - aDetailedError.NextException = aError; + SQLContext aDetailedError(compmodule::ModuleRes(RID_STR_NOCONNECTION), // message + {}, {}, 0, + aError, // next exception + compmodule::ModuleRes(RID_STR_PLEASECHECKSETTINGS)); // details // handle (aka display) the new context info - xInteractions->handle( new OInteractionRequest( makeAny( aDetailedError ) ) ); + xInteractions->handle( new OInteractionRequest( Any( aDetailedError ) ) ); } else { // handle (aka display) the original error - xInteractions->handle( new OInteractionRequest( makeAny( aException ) ) ); + xInteractions->handle( new OInteractionRequest( Any( aException ) ) ); } } catch( const Exception& ) diff --git a/extensions/source/abpilot/datasourcehandling.hxx b/extensions/source/abpilot/datasourcehandling.hxx index 4f8a0cbc28d7..c6058e45e30a 100644 --- a/extensions/source/abpilot/datasourcehandling.hxx +++ b/extensions/source/abpilot/datasourcehandling.hxx @@ -81,7 +81,6 @@ namespace abp }; struct ODataSourceImpl; - struct PackageAccessControl; struct AddressSettings; /** a non-UNO wrapper for a data source <p>This class allows to access data sources without the need to compile the respective file with @@ -164,7 +163,7 @@ namespace abp */ bool hasTable( const OUString& _rTableName ) const; - /// return the intern data source object + /// return the internal data source object css::uno::Reference< css::beans::XPropertySet > getDataSource() const; @@ -174,7 +173,6 @@ namespace abp void setDataSource( const css::uno::Reference< css::beans::XPropertySet >& _rxDS ,const OUString& _sName - ,PackageAccessControl ); }; diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx b/extensions/source/abpilot/fieldmappingimpl.cxx index 8047053dc51d..b8e8ac56686c 100644 --- a/extensions/source/abpilot/fieldmappingimpl.cxx +++ b/extensions/source/abpilot/fieldmappingimpl.cxx @@ -24,13 +24,12 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <vcl/weld.hxx> #include <com/sun/star/util/AliasProgrammaticPair.hpp> #include <strings.hrc> #include <componentmodule.hxx> #include <unotools/confignode.hxx> -#include <sal/macros.h> #include <sal/log.hxx> @@ -50,7 +49,7 @@ namespace abp const char16_t sDriverSettingsNodeName[] = u"/org.openoffice.Office.DataAccess/DriverSettings/com.sun.star.comp.sdbc.MozabDriver"; - constexpr OUStringLiteral sAddressBookNodeName = u"/org.openoffice.Office.DataAccess/AddressBook"; + constexpr OUString sAddressBookNodeName = u"/org.openoffice.Office.DataAccess/AddressBook"_ustr; namespace fieldmapping { @@ -162,10 +161,10 @@ namespace abp _rxContext, sDriverAliasesNodeName, -1, OConfigurationTreeRoot::CM_READONLY); // loop through all programmatic pairs - DBG_ASSERT( 0 == SAL_N_ELEMENTS( pMappingProgrammatics ) % 2, + DBG_ASSERT( 0 == std::size( pMappingProgrammatics ) % 2, "fieldmapping::defaultMapping: invalid programmatic map!" ); // number of pairs - sal_Int32 const nIntersectedProgrammatics = SAL_N_ELEMENTS( pMappingProgrammatics ) / 2; + sal_Int32 const nIntersectedProgrammatics = std::size( pMappingProgrammatics ) / 2; const char** pProgrammatic = pMappingProgrammatics; OUString sAddressProgrammatic; @@ -204,11 +203,8 @@ namespace abp } - void writeTemplateAddressFieldMapping( const Reference< XComponentContext >& _rxContext, const MapString2String& _rFieldAssignment ) + void writeTemplateAddressFieldMapping( const Reference< XComponentContext >& _rxContext, MapString2String&& aFieldAssignment ) { - // want to have a non-const map for easier handling - MapString2String aFieldAssignment( _rFieldAssignment ); - // access the configuration information which the driver uses for determining its column names // create a config node for this @@ -222,8 +218,8 @@ namespace abp const OUString* pExistentFields = aExistentFields.getConstArray(); const OUString* pExistentFieldsEnd = pExistentFields + aExistentFields.getLength(); - const OUString sProgrammaticNodeName( "ProgrammaticFieldName" ); - const OUString sAssignedNodeName( "AssignedFieldName" ); + static constexpr OUString sProgrammaticNodeName( u"ProgrammaticFieldName"_ustr ); + static constexpr OUString sAssignedNodeName( u"AssignedFieldName"_ustr ); for ( ; pExistentFields != pExistentFieldsEnd; ++pExistentFields ) { @@ -241,7 +237,7 @@ namespace abp { // yes // -> set a new value OConfigurationNode aExistentField = aFields.openNode( *pExistentFields ); - aExistentField.setNodeValue( sAssignedNodeName, makeAny( aPos->second ) ); + aExistentField.setNodeValue( sAssignedNodeName, Any( aPos->second ) ); // and remove the mapping entry aFieldAssignment.erase( *pExistentFields ); } @@ -261,8 +257,8 @@ namespace abp // in case the config node for the fields already has the node named <aNewMapping->first>, // the entry should have been removed from aNewMapping (in the above loop) OConfigurationNode aNewField = aFields.createNode( elem.first ); - aNewField.setNodeValue( sProgrammaticNodeName, makeAny( elem.first ) ); - aNewField.setNodeValue( sAssignedNodeName, makeAny( elem.second ) ); + aNewField.setNodeValue( sProgrammaticNodeName, Any( elem.first ) ); + aNewField.setNodeValue( sAssignedNodeName, Any( elem.second ) ); } // commit the changes done @@ -286,9 +282,9 @@ namespace abp OConfigurationTreeRoot aAddressBookSettings = OConfigurationTreeRoot::createWithComponentContext( _rxContext, sAddressBookNodeName); - aAddressBookSettings.setNodeValue( OUString( "DataSourceName" ), makeAny( _rDataSourceName ) ); - aAddressBookSettings.setNodeValue( OUString( "Command" ), makeAny( _rTableName ) ); - aAddressBookSettings.setNodeValue( OUString( "CommandType" ), makeAny( sal_Int16(CommandType::TABLE) ) ); + aAddressBookSettings.setNodeValue( OUString( "DataSourceName" ), Any( _rDataSourceName ) ); + aAddressBookSettings.setNodeValue( OUString( "Command" ), Any( _rTableName ) ); + aAddressBookSettings.setNodeValue( OUString( "CommandType" ), Any( sal_Int16(CommandType::TABLE) ) ); // commit the changes done aAddressBookSettings.commit(); @@ -304,7 +300,7 @@ namespace abp _rxContext, sAddressBookNodeName); // set the flag - aAddressBookSettings.setNodeValue( OUString( "AutoPilotCompleted" ), makeAny( true ) ); + aAddressBookSettings.setNodeValue( OUString( "AutoPilotCompleted" ), Any( true ) ); // commit the changes done aAddressBookSettings.commit(); diff --git a/extensions/source/abpilot/fieldmappingimpl.hxx b/extensions/source/abpilot/fieldmappingimpl.hxx index d26172dfdb16..e4a2dd1c9649 100644 --- a/extensions/source/abpilot/fieldmappingimpl.hxx +++ b/extensions/source/abpilot/fieldmappingimpl.hxx @@ -77,7 +77,7 @@ namespace abp */ void writeTemplateAddressFieldMapping( const css::uno::Reference< css::uno::XComponentContext >& _rxContext, - const MapString2String& _rFieldAssignment + MapString2String&& _rFieldAssignment ); diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx index 6e923b00aff6..8db9f5a2ae43 100644 --- a/extensions/source/abpilot/typeselectionpage.cxx +++ b/extensions/source/abpilot/typeselectionpage.cxx @@ -107,22 +107,22 @@ namespace abp #endif // Items are displayed in list order - m_aAllTypes.push_back( ButtonItem( m_xEvolution.get(), AST_EVOLUTION, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( m_xEvolutionGroupwise.get(), AST_EVOLUTION_GROUPWISE, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( m_xEvolutionLdap.get(), AST_EVOLUTION_LDAP, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( m_xThunderbird.get(), AST_THUNDERBIRD, true ) ); - m_aAllTypes.push_back( ButtonItem( m_xKab.get(), AST_KAB, bHaveKab ) ); - m_aAllTypes.push_back( ButtonItem( m_xMacab.get(), AST_MACAB, bHaveMacab ) ); - m_aAllTypes.push_back( ButtonItem( m_xOther.get(), AST_OTHER, true ) ); - - Link<weld::Button&,void> aTypeSelectionHandler = LINK(this, TypeSelectionPage, OnTypeSelected ); + m_aAllTypes.emplace_back(m_xEvolution.get(), AST_EVOLUTION, bHaveEvolution); + m_aAllTypes.emplace_back(m_xEvolutionGroupwise.get(), AST_EVOLUTION_GROUPWISE, bHaveEvolution); + m_aAllTypes.emplace_back(m_xEvolutionLdap.get(), AST_EVOLUTION_LDAP, bHaveEvolution); + m_aAllTypes.emplace_back(m_xThunderbird.get(), AST_THUNDERBIRD, true); + m_aAllTypes.emplace_back(m_xKab.get(), AST_KAB, bHaveKab); + m_aAllTypes.emplace_back(m_xMacab.get(), AST_MACAB, bHaveMacab); + m_aAllTypes.emplace_back(m_xOther.get(), AST_OTHER, true); + + Link<weld::Toggleable&,void> aTypeSelectionHandler = LINK(this, TypeSelectionPage, OnTypeSelected ); for (auto const& elem : m_aAllTypes) { if (!elem.m_bVisible) elem.m_pItem->hide(); else { - elem.m_pItem->connect_clicked( aTypeSelectionHandler ); + elem.m_pItem->connect_toggled( aTypeSelectionHandler ); elem.m_pItem->show(); } } @@ -205,22 +205,20 @@ namespace abp return true; } - bool TypeSelectionPage::canAdvance() const { return AddressBookSourcePage::canAdvance() && (AST_INVALID != getSelectedType()); } - - IMPL_LINK_NOARG( TypeSelectionPage, OnTypeSelected, weld::Button&, void ) + IMPL_LINK(TypeSelectionPage, OnTypeSelected, weld::Toggleable&, rButton, void) { + if (!rButton.get_active()) + return; getDialog()->typeSelectionChanged( getSelectedType() ); updateDialogTravelUI(); } - } // namespace abp - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/typeselectionpage.hxx b/extensions/source/abpilot/typeselectionpage.hxx index 9caaeb8e1c4e..7c908057d642 100644 --- a/extensions/source/abpilot/typeselectionpage.hxx +++ b/extensions/source/abpilot/typeselectionpage.hxx @@ -71,7 +71,7 @@ namespace abp // OImportPage overridables virtual bool canAdvance() const override; - DECL_LINK( OnTypeSelected, weld::Button&, void ); + DECL_LINK( OnTypeSelected, weld::Toggleable&, void ); void selectType( AddressSourceType _eType ); }; diff --git a/extensions/source/abpilot/unodialogabp.cxx b/extensions/source/abpilot/unodialogabp.cxx index 812773213daa..9608f2551f2b 100644 --- a/extensions/source/abpilot/unodialogabp.cxx +++ b/extensions/source/abpilot/unodialogabp.cxx @@ -31,7 +31,6 @@ namespace abp { using namespace ::com::sun::star; using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::ui::dialogs; @@ -48,12 +47,12 @@ namespace abp return aReturn.hasValue() ? aReturn : OABSPilotUno_JBase::queryInterface( aType ); } - void SAL_CALL OABSPilotUno::acquire( ) throw () + void SAL_CALL OABSPilotUno::acquire( ) noexcept { svt::OGenericUnoDialog::acquire(); } - void SAL_CALL OABSPilotUno::release( ) throw () + void SAL_CALL OABSPilotUno::release( ) noexcept { svt::OGenericUnoDialog::release(); } @@ -105,8 +104,8 @@ namespace abp { Reference<awt::XWindow> xParentWindow; if (aArguments.getLength() == 1 && (aArguments[0] >>= xParentWindow) ) { - Sequence< Any > aNewArgs(1); - aNewArgs[0] <<= PropertyValue( "ParentWindow", 0, makeAny(xParentWindow), PropertyState_DIRECT_VALUE ); + Sequence< Any > aNewArgs{ Any(PropertyValue( + "ParentWindow", 0, Any(xParentWindow), PropertyState_DIRECT_VALUE )) }; OGenericUnoDialog::initialize(aNewArgs); } else { OGenericUnoDialog::initialize(aArguments); @@ -129,8 +128,8 @@ namespace abp // User has one chance to accept it or not. // (or he can start it again by using wizard-menu!) // So we should deregister it on our general job execution service by using right protocol parameters. - css::uno::Sequence< css::beans::NamedValue > lProtocol { { "Deactivate", css::uno::makeAny( true ) } }; - return makeAny( lProtocol ); + css::uno::Sequence< css::beans::NamedValue > lProtocol { { "Deactivate", css::uno::Any( true ) } }; + return Any( lProtocol ); } void OABSPilotUno::executedDialog(sal_Int16 _nExecutionResult) diff --git a/extensions/source/abpilot/unodialogabp.hxx b/extensions/source/abpilot/unodialogabp.hxx index cf3aaa6f5101..b8bd940afa04 100644 --- a/extensions/source/abpilot/unodialogabp.hxx +++ b/extensions/source/abpilot/unodialogabp.hxx @@ -44,8 +44,8 @@ namespace abp private: // XInterface (disambiguation) virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; - virtual void SAL_CALL acquire( ) throw () override; - virtual void SAL_CALL release( ) throw () override; + virtual void SAL_CALL acquire( ) noexcept override; + virtual void SAL_CALL release( ) noexcept override; // XTypeProvider virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; diff --git a/extensions/source/activex/SOActionsApproval.cxx b/extensions/source/activex/SOActionsApproval.cxx index a4092166272b..6fd6d0888141 100644 --- a/extensions/source/activex/SOActionsApproval.cxx +++ b/extensions/source/activex/SOActionsApproval.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -// SOActionsApproval.cpp : Implementation of CHelpApp and DLL registration. +// SOActionsApproval.cxx : Implementation of CHelpApp and DLL registration. #include <sal/config.h> @@ -25,33 +25,14 @@ #include "StdAfx2.h" +#include <so_activex.h> #include "SOActionsApproval.h" #include <sal/macros.h> -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif -#include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif - COM_DECLSPEC_NOTHROW STDMETHODIMP SOActionsApproval::InterfaceSupportsErrorInfo(REFIID riid) { - static const IID* arr[] = { - &IID_ISOActionsApproval, - }; - - for (std::size_t i = 0; i < SAL_N_ELEMENTS(arr); i++) - { -#ifdef _MSC_VER - if (InlineIsEqualGUID(*arr[i], riid)) -#else - if (::ATL::InlineIsEqualGUID(*arr[i], riid)) -#endif - return S_OK; - } + if (InlineIsEqualGUID(IID_ISOActionsApproval, riid)) + return S_OK; return S_FALSE; } diff --git a/extensions/source/activex/SOActionsApproval.h b/extensions/source/activex/SOActionsApproval.h index f96b23fd9452..9b8f4c1e992e 100644 --- a/extensions/source/activex/SOActionsApproval.h +++ b/extensions/source/activex/SOActionsApproval.h @@ -19,8 +19,7 @@ // SOActionsApproval.h: Definition of the SOActionsApproval class -#ifndef INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SOACTIONSAPPROVAL_H -#define INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SOACTIONSAPPROVAL_H +#pragma once #ifdef _MSC_VER #pragma once @@ -33,14 +32,7 @@ #include <atlctl.h> -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif #include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif // SOActionsApproval @@ -103,6 +95,4 @@ DECLARE_REGISTRY_RESOURCEID(IDR_SODOCUMENTEVENTLISTENER) } }; -#endif // INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SOACTIONSAPPROVAL_H - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/SOActiveX.cxx b/extensions/source/activex/SOActiveX.cxx index 5b387bc2beef..b72ab0d66ca0 100644 --- a/extensions/source/activex/SOActiveX.cxx +++ b/extensions/source/activex/SOActiveX.cxx @@ -20,21 +20,13 @@ // SOActiveX.cpp : Implementation of CSOActiveX #include "StdAfx2.h" +#include <so_activex.h> #include "SOActiveX.h" #include "SOComWindowPeer.h" #include "SODispatchInterceptor.h" #include "SOActionsApproval.h" #include "com_uno_helper.h" -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif -#include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif - #define STAROFFICE_WINDOWCLASS L"SOParentWindow" @@ -223,7 +215,7 @@ HRESULT CSOActiveX::Cleanup() pDispDocumentCloser ); if ( SUCCEEDED( hr ) && pDispDocumentCloser ) { - SAFEARRAY FAR* pInitFrame = SafeArrayCreateVector( VT_VARIANT, 0, 1 ); + SAFEARRAY* pInitFrame = SafeArrayCreateVector(VT_VARIANT, 0, 1); LONG nInitInd = 0; CComVariant pFrameVariant( mpDispFrame ); SafeArrayPutElement( pInitFrame, &nInitInd, &pFrameVariant ); @@ -359,7 +351,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPER // all information from the 'object' tag is in strings if (aVal[ind].vt == VT_BSTR && !wcscmp(aPropNames[ind].pstrName, L"src")) { - mCurFileUrl = wcsdup( aVal[ind].bstrVal ); + mCurFileUrl.AssignBSTR(aVal[ind].bstrVal); } else if( aVal[ind].vt == VT_BSTR && !wcscmp(aPropNames[ind].pstrName, L"readonly")) @@ -384,16 +376,10 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPER return hr; mbReadyForActivation = FALSE; - if (BSTR bStrUrl = SysAllocString(mCurFileUrl)) - { - hr = CBindStatusCallback<CSOActiveX>::Download( - this, &CSOActiveX::CallbackCreateXInputStream, bStrUrl, m_spClientSite, FALSE); - SysFreeString(bStrUrl); - if (hr == MK_S_ASYNCHRONOUS) - hr = S_OK; - } - else - hr = E_OUTOFMEMORY; + hr = CBindStatusCallback<CSOActiveX>::Download( + this, &CSOActiveX::CallbackCreateXInputStream, mCurFileUrl, m_spClientSite, FALSE); + if (hr == MK_S_ASYNCHRONOUS) + hr = S_OK; if ( !SUCCEEDED( hr ) ) { @@ -590,7 +576,7 @@ HRESULT CSOActiveX::CreateFrameOldWay( HWND hwnd, int width, int height ) hr = GetIDispByFunc( mpDispFactory, L"createInstance", &aServiceName, 1, mpInstanceLocker ); if( SUCCEEDED( hr ) && mpInstanceLocker ) { - SAFEARRAY FAR* pInitVals = SafeArrayCreateVector( VT_VARIANT, 0, 3 ); + SAFEARRAY* pInitVals = SafeArrayCreateVector(VT_VARIANT, 0, 3); // the first sequence element LONG nInitInd = 0; @@ -631,7 +617,7 @@ HRESULT CSOActiveX::CreateFrameOldWay( HWND hwnd, int width, int height ) HRESULT CSOActiveX::CallLoadComponentFromURL1PBool( OLECHAR const * sUrl, OLECHAR const * sArgName, BOOL sArgVal ) { - SAFEARRAY FAR* pPropVals = SafeArrayCreateVector( VT_DISPATCH, 0, 1 ); + SAFEARRAY* pPropVals = SafeArrayCreateVector(VT_DISPATCH, 0, 1); LONG ix = 0; CComPtr<IDispatch> pdispPropVal; HRESULT hr = GetUnoStruct( L"com.sun.star.beans.PropertyValue", pdispPropVal ); @@ -681,7 +667,7 @@ HRESULT CSOActiveX::CallDispatchMethod( OLECHAR const * sUrl, pdispXDispatch ); if( !SUCCEEDED( hr ) ) return hr; - SAFEARRAY FAR* pPropVals = SafeArrayCreateVector( VT_DISPATCH, 0, count ); + SAFEARRAY* pPropVals = SafeArrayCreateVector(VT_DISPATCH, 0, count); for( LONG ix = 0; ix < static_cast<LONG>(count); ix ++ ) { CComPtr<IDispatch> pdispPropVal; @@ -740,7 +726,7 @@ void CSOActiveX::CallbackCreateXInputStream( CBindStatusCallback<CSOActiveX>* /* if( SUCCEEDED( hr ) && mpDispTempFile ) { - SAFEARRAY FAR* pDataArray = SafeArrayCreateVector( VT_I1, 0, dwSize ); + SAFEARRAY* pDataArray = SafeArrayCreateVector(VT_I1, 0, dwSize); if ( pDataArray ) { @@ -801,13 +787,6 @@ HRESULT CSOActiveX::LoadURLToFrame( ) HRESULT hr = CallDispatchMethod( mCurFileUrl, aArgNames, aArgVals, nCount ); if( !SUCCEEDED( hr ) ) return hr; - CComVariant aBarName( L"MenuBarVisible" ); - CComVariant aBarVis; - aBarVis.vt = VT_BOOL; aBarVis.boolVal = VARIANT_FALSE; - hr = CallDispatchMethod( L"slot:6661", &aBarName, &aBarVis, 1 ); - // does not work for some documents, but it is no error - // if( !SUCCEEDED( hr ) ) return hr; - // try to get the model and set the presentation specific property, the setting will fail for other document formats CComPtr<IDispatch> pdispController; hr = GetIDispByFunc( mpDispFrame, L"getController", nullptr, 0, pdispController ); diff --git a/extensions/source/activex/SOActiveX.h b/extensions/source/activex/SOActiveX.h index 719bce5d4271..49f33d796047 100644 --- a/extensions/source/activex/SOActiveX.h +++ b/extensions/source/activex/SOActiveX.h @@ -19,8 +19,7 @@ // SOActiveX.h : Declaration of the CSOActiveX -#ifndef INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SOACTIVEX_H -#define INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SOACTIVEX_H +#pragma once #include "resource.h" @@ -30,14 +29,7 @@ #include <atlctl.h> -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif #include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif class SODispatchInterceptor; @@ -82,7 +74,7 @@ protected: CComPtr<IDispatch> mpDispFrame; CComPtr<IDispatch> mpInstanceLocker; CComPtr<IDispatch> mpDispWin; - OLECHAR const * mCurFileUrl; + CComBSTR mCurFileUrl; BOOL mbLoad; BOOL mbViewOnly; WNDCLASSW mPWinClass; @@ -210,6 +202,4 @@ public: SOVersion GetVersionConnected(); }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/SOComWindowPeer.cxx b/extensions/source/activex/SOComWindowPeer.cxx index 0a556466d32f..59510c24a7a7 100644 --- a/extensions/source/activex/SOComWindowPeer.cxx +++ b/extensions/source/activex/SOComWindowPeer.cxx @@ -17,40 +17,21 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -// SOComWindowPeer.cpp : Implementation of CHelpApp and DLL registration. +// SOComWindowPeer.cxx : Implementation of CHelpApp and DLL registration. #include <sal/config.h> #include <cstddef> #include "StdAfx2.h" +#include <so_activex.h> #include "SOComWindowPeer.h" #include <sal/macros.h> -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif -#include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif - COM_DECLSPEC_NOTHROW STDMETHODIMP SOComWindowPeer::InterfaceSupportsErrorInfo(REFIID riid) { - static const IID* arr[] = { - &IID_ISOComWindowPeer, - }; - - for (std::size_t i = 0; i < SAL_N_ELEMENTS(arr); i++) - { -#ifdef _MSC_VER - if (InlineIsEqualGUID(*arr[i], riid)) -#else - if (::ATL::InlineIsEqualGUID(*arr[i], riid)) -#endif - return S_OK; - } + if (InlineIsEqualGUID(IID_ISOComWindowPeer, riid)) + return S_OK; return S_FALSE; } diff --git a/extensions/source/activex/SOComWindowPeer.h b/extensions/source/activex/SOComWindowPeer.h index 8e2b704e6783..58136e813637 100644 --- a/extensions/source/activex/SOComWindowPeer.h +++ b/extensions/source/activex/SOComWindowPeer.h @@ -19,8 +19,7 @@ // SOComWindowPeer.h: Definition of the SOComWindowPeer class -#ifndef INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SOCOMWINDOWPEER_H -#define INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SOCOMWINDOWPEER_H +#pragma once #ifdef _MSC_VER #pragma once @@ -33,14 +32,7 @@ #include <atlctl.h> -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif #include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif // SOComWindowPeer @@ -157,6 +149,4 @@ DECLARE_REGISTRY_RESOURCEID(IDR_SOCOMWINDOWPEER) void SetHWNDInternally( HWND hwnd ) { m_hwnd = hwnd; } }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/SODispatchInterceptor.cxx b/extensions/source/activex/SODispatchInterceptor.cxx index f5497fc0efdd..97ea07568fde 100644 --- a/extensions/source/activex/SODispatchInterceptor.cxx +++ b/extensions/source/activex/SODispatchInterceptor.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -// SODispatchInterceptor.cpp : Implementation of CHelpApp and DLL registration. +// SODispatchInterceptor.cxx : Implementation of CHelpApp and DLL registration. #include <sal/config.h> @@ -25,43 +25,21 @@ #include <stdio.h> #include "StdAfx2.h" +#include <so_activex.h> #include "SOActiveX.h" #include "SODispatchInterceptor.h" #include "com_uno_helper.h" #include <sal/macros.h> -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif -#include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif - COM_DECLSPEC_NOTHROW STDMETHODIMP SODispatchInterceptor::InterfaceSupportsErrorInfo(REFIID riid) { - static const IID* arr[] = - { - &IID_ISODispatchInterceptor, - }; - - for (std::size_t i=0;i<SAL_N_ELEMENTS(arr);i++) - { -#ifdef _MSC_VER - if (InlineIsEqualGUID(*arr[i],riid)) -#else - if (::ATL::InlineIsEqualGUID(*arr[i],riid)) -#endif - return S_OK; - } + if (InlineIsEqualGUID(IID_ISODispatchInterceptor, riid)) + return S_OK; return S_FALSE; } -STDMETHODIMP SODispatchInterceptor::queryDispatch( IDispatch FAR* aURL, - BSTR aTargetFrameName, - long nSearchFlags, - IDispatch FAR* FAR* retVal ) +STDMETHODIMP SODispatchInterceptor::queryDispatch(IDispatch* aURL, BSTR aTargetFrameName, + long nSearchFlags, IDispatch** retVal) { if ( !aURL || !retVal ) return E_FAIL; @@ -116,7 +94,7 @@ STDMETHODIMP SODispatchInterceptor::queryDispatch( IDispatch FAR* aURL, return S_OK; } -STDMETHODIMP SODispatchInterceptor::queryDispatches( SAFEARRAY FAR* aDescripts, SAFEARRAY FAR* FAR* retVal) +STDMETHODIMP SODispatchInterceptor::queryDispatches(SAFEARRAY* aDescripts, SAFEARRAY** retVal) { if ( !aDescripts || !retVal || SafeArrayGetDim( aDescripts ) != 1 ) return E_FAIL; @@ -156,7 +134,7 @@ STDMETHODIMP SODispatchInterceptor::queryDispatches( SAFEARRAY FAR* aDescripts, } -STDMETHODIMP SODispatchInterceptor::dispatch( IDispatch FAR* aURL, SAFEARRAY FAR* aArgs) +STDMETHODIMP SODispatchInterceptor::dispatch(IDispatch* aURL, SAFEARRAY* aArgs) { // get url from aURL OLECHAR const * pUrlName = L"Complete"; @@ -211,19 +189,20 @@ STDMETHODIMP SODispatchInterceptor::dispatch( IDispatch FAR* aURL, SAFEARRAY FAR return S_OK; } -STDMETHODIMP SODispatchInterceptor::addStatusListener( IDispatch FAR* /*xControl*/, IDispatch FAR* /*aURL*/) +STDMETHODIMP SODispatchInterceptor::addStatusListener(IDispatch* /*xControl*/, IDispatch* /*aURL*/) { // not implemented return S_OK; } -STDMETHODIMP SODispatchInterceptor::removeStatusListener( IDispatch FAR* /*xControl*/, IDispatch FAR* /*aURL*/) +STDMETHODIMP SODispatchInterceptor::removeStatusListener(IDispatch* /*xControl*/, + IDispatch* /*aURL*/) { // not implemented return S_OK; } -STDMETHODIMP SODispatchInterceptor::getInterceptedURLs( SAFEARRAY FAR* FAR* pVal ) +STDMETHODIMP SODispatchInterceptor::getInterceptedURLs(SAFEARRAY** pVal) { *pVal = SafeArrayCreateVector( VT_BSTR, 0, 3 ); diff --git a/extensions/source/activex/SODispatchInterceptor.h b/extensions/source/activex/SODispatchInterceptor.h index aa8138024fc6..3c060434820b 100644 --- a/extensions/source/activex/SODispatchInterceptor.h +++ b/extensions/source/activex/SODispatchInterceptor.h @@ -19,8 +19,7 @@ // SODispatchInterceptor.h: Definition of the SODispatchInterceptor class -#ifndef INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SODISPATCHINTERCEPTOR_H -#define INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SODISPATCHINTERCEPTOR_H +#pragma once #ifdef _MSC_VER #pragma once @@ -173,6 +172,4 @@ DECLARE_REGISTRY_RESOURCEID(IDR_SODISPATCHINTERCEPTOR) } }; -#endif // INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SODISPATCHINTERCEPTOR_H - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/StdAfx2.h b/extensions/source/activex/StdAfx2.h index 01665c2001e3..b2ab095e91f3 100644 --- a/extensions/source/activex/StdAfx2.h +++ b/extensions/source/activex/StdAfx2.h @@ -21,8 +21,7 @@ // or project specific include files that are used frequently, // but are changed infrequently -#ifndef INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_STDAFX2_H -#define INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_STDAFX2_H +#pragma once #define STRICT #define _ATL_APARTMENT_THREADED @@ -42,7 +41,6 @@ #pragma clang diagnostic ignored "-Wmicrosoft" #pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wnon-pod-varargs" -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" #pragma clang diagnostic ignored "-Wnonportable-include-path" #pragma clang diagnostic ignored "-Wsequence-point" #pragma clang diagnostic ignored "-Wsign-compare" @@ -57,6 +55,7 @@ extern CComModule _Module; #include <atlcom.h> #include <atlctl.h> +#undef min #if defined __clang__ #pragma clang diagnostic pop @@ -66,6 +65,4 @@ extern CComModule _Module; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. -#endif // !defined(INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_STDAFX2_H) - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/so_activex.cxx b/extensions/source/activex/so_activex.cxx index b539e2897f2d..a4ce480613dc 100644 --- a/extensions/source/activex/so_activex.cxx +++ b/extensions/source/activex/so_activex.cxx @@ -27,15 +27,7 @@ #include "StdAfx2.h" #include "resource.h" #include <initguid.h> - -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif #include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif #if defined __clang__ #pragma clang diagnostic push @@ -50,6 +42,7 @@ #include "SOActiveX.h" #include <comphelper\documentconstants.hxx> +#include <sal/types.h> #include <exception> CComModule _Module; @@ -68,17 +61,6 @@ END_OBJECT_MAP() #define X64_LIB_NAME L"so_activex_x64.dll" #define X32_LIB_NAME L"so_activex.dll" -// to provide windows xp as build systems for mingw we need to define KEY_WOW64_64KEY -// in mingw 3.13 KEY_WOW64_64KEY isn't available < Win2003 systems. -// Also defined in setup_native\source\win32\customactions\reg64\reg64.cxx,source\win32\customactions\shellextensions\shellextensions.cxx and -// extensions\source\activex\main\so_activex.cpp -#ifndef KEY_WOW64_64KEY - #define KEY_WOW64_64KEY (0x0100) -#endif -#ifndef KEY_WOW64_32KEY - #define KEY_WOW64_32KEY (0x0200) -#endif - const REGSAM n64KeyAccess = KEY_ALL_ACCESS | KEY_WOW64_64KEY; const REGSAM n32KeyAccess = KEY_ALL_ACCESS; @@ -177,43 +159,43 @@ const char* const aFileExt[] = { ".vor", ".sxw", ".sxc", ".sxi", ".sxd", ".sxg", ".sxm", ".ott", ".otg", ".otp", ".ots", ".otf", ".odt", ".oth", ".odm", ".odg", ".odp", ".ods", ".odf"}; -const char* const aMimeType[] = { - "application/vnd.stardivision.writer", - - "application/vnd.stardivision.chart", - "application/vnd.stardivision.draw", - "application/vnd.stardivision.impress", - "application/vnd.stardivision.impress-packed", - "application/vnd.stardivision.calc", - "application/vnd.stardivision.writer", - "application/vnd.stardivision.math", - - MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII, - MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII, - MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII, - MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII, - - MIMETYPE_VND_SUN_XML_WRITER_ASCII, - MIMETYPE_VND_SUN_XML_CALC_ASCII, - MIMETYPE_VND_SUN_XML_IMPRESS_ASCII, - MIMETYPE_VND_SUN_XML_DRAW_ASCII, - MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII, - MIMETYPE_VND_SUN_XML_MATH_ASCII, - - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII, - - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII }; +const sal_Unicode* const aMimeType[] = { + u"application/vnd.stardivision.writer", + + u"application/vnd.stardivision.chart", + u"application/vnd.stardivision.draw", + u"application/vnd.stardivision.impress", + u"application/vnd.stardivision.impress-packed", + u"application/vnd.stardivision.calc", + u"application/vnd.stardivision.writer", + u"application/vnd.stardivision.math", + + MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII.getStr(), + + MIMETYPE_VND_SUN_XML_WRITER_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_CALC_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_IMPRESS_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_DRAW_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_MATH_ASCII.getStr(), + + MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_TEMPLATE_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII.getStr(), + + MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII.getStr() }; const int nForModes[] = { 16, 1, 2, 4, 4, 8, 16, 32, @@ -422,7 +404,7 @@ static HRESULT DllRegisterServerNative_Impl( int nMode, bool bForAllUsers, REGSA { if (nForModes[ind] & nMode) { - wsprintfA(aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind]); + wsprintfA(aSubKey, "%sMIME\\DataBase\\Content Type\\%ls", aPrefix, aMimeType[ind]); HRegKey hkey; s.upd(RegCreateKeyExA(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, @@ -494,7 +476,7 @@ static HRESULT DllUnregisterServerNative_Impl( int nMode, bool bForAllUsers, REG if( nForModes[ind] & nMode ) { DWORD nSubKeys = 0, nValues = 0; - wsprintfA(aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind]); + wsprintfA(aSubKey, "%sMIME\\DataBase\\Content Type\\%ls", aPrefix, aMimeType[ind]); Status s1(false); // no throw { HRegKey hkey; @@ -741,17 +723,20 @@ STDAPI DllRegisterServer() { HRESULT aResult = E_FAIL; - HMODULE aCurModule = GetModuleHandleW( bX64 ? X64_LIB_NAME : X32_LIB_NAME ); - DWORD nLibNameLen = sal::static_int_cast<DWORD>( - wcslen(bX64 ? X64_LIB_NAME : X32_LIB_NAME)); - + HMODULE aCurModule{}; + GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS + | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + reinterpret_cast<LPCWSTR>(&DllRegisterServer), &aCurModule); if( aCurModule ) { wchar_t pProgramPath[1024]; - DWORD nLen = GetModuleFileNameW( aCurModule, pProgramPath, 1024 ); - if ( nLen && nLen > nLibNameLen + 1 ) + wchar_t* pPathEnd = nullptr; + DWORD nLen = GetModuleFileNameW( aCurModule, pProgramPath, SAL_N_ELEMENTS(pProgramPath) ); + if ( nLen && nLen < SAL_N_ELEMENTS(pProgramPath) ) + pPathEnd = wcsrchr(pProgramPath, '\\'); + if (pPathEnd) { - pProgramPath[ nLen - nLibNameLen - 1 ] = 0; + *pPathEnd = 0; aResult = DllRegisterServerNative( 31, TRUE, bX64, pProgramPath ); if( SUCCEEDED( aResult ) ) aResult = DllRegisterServerDoc( 31, TRUE, bX64 ); diff --git a/extensions/source/bibliography/bibbeam.hxx b/extensions/source/bibliography/bibbeam.hxx index 57216922b7c7..4cc32d7da93e 100644 --- a/extensions/source/bibliography/bibbeam.hxx +++ b/extensions/source/bibliography/bibbeam.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBBEAM_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBBEAM_HXX +#pragma once #include <com/sun/star/awt/XControlContainer.hpp> #include <com/sun/star/frame/XDispatchProviderInterception.hpp> @@ -69,6 +68,4 @@ namespace bib } // namespace bib -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index f5a68212922d..11ba8999a62c 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -24,16 +24,16 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <o3tl/any.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdb; -constexpr OUStringLiteral cDataSourceHistory = u"DataSourceHistory"; +constexpr OUString cDataSourceHistory = u"DataSourceHistory"_ustr; Sequence<OUString> const & BibConfig::GetPropertyNames() { @@ -90,6 +90,7 @@ BibConfig::BibConfig() aColumnDefaults[28] = "Custom3"; aColumnDefaults[29] = "Custom4"; aColumnDefaults[30] = "Custom5"; + aColumnDefaults[31] = "LocalURL"; const Sequence< OUString > aPropertyNames = GetPropertyNames(); @@ -123,7 +124,7 @@ BibConfig::BibConfig() Sequence<OUString> aHistoryNames(3); OUString* pHistoryNames = aHistoryNames.getArray(); - OUString sPrefix = OUStringLiteral(cDataSourceHistory) + "/" + nodeName + "/"; + OUString sPrefix = OUString::Concat(cDataSourceHistory) + "/" + nodeName + "/"; pHistoryNames[0] = sPrefix + "DataSourceName"; pHistoryNames[1] = sPrefix + "Command"; pHistoryNames[2] = sPrefix + "CommandType"; @@ -215,7 +216,7 @@ void BibConfig::ImplCommit() for(sal_Int32 i = 0; i < static_cast<sal_Int32>(mvMappings.size()); i++) { const Mapping* pMapping = mvMappings[i].get(); - OUString sPrefix = OUStringLiteral(cDataSourceHistory) + "/_" + OUString::number(i) + "/"; + OUString sPrefix = OUString::Concat(cDataSourceHistory) + "/_" + OUString::number(i) + "/"; pNodeValues[nIndex].Name = sPrefix + "DataSourceName"; pNodeValues[nIndex++].Value <<= pMapping->sURL; pNodeValues[nIndex].Name = sPrefix + "Command"; @@ -234,14 +235,11 @@ void BibConfig::ImplCommit() !pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName.isEmpty()) { OUString sSubPrefix = sPrefix + "/_" + OUString::number(nFieldAssignment); - Sequence< PropertyValue > aAssignmentValues(2); - PropertyValue* pAssignmentValues = aAssignmentValues.getArray(); - pAssignmentValues[0].Name = sSubPrefix; - pAssignmentValues[0].Name += sFieldName; - pAssignmentValues[0].Value <<= pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName; - pAssignmentValues[1].Name = sSubPrefix; - pAssignmentValues[1].Name += sDatabaseFieldName; - pAssignmentValues[1].Value <<= pMapping->aColumnPairs[nFieldAssignment].sRealColumnName; + Sequence< PropertyValue > aAssignmentValues + { + comphelper::makePropertyValue(sSubPrefix + sFieldName, pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName), + comphelper::makePropertyValue(sSubPrefix + sDatabaseFieldName, pMapping->aColumnPairs[nFieldAssignment].sRealColumnName) + }; SetSetProperties( sPrefix, aAssignmentValues ); nFieldAssignment++; } diff --git a/extensions/source/bibliography/bibconfig.hxx b/extensions/source/bibliography/bibconfig.hxx index 37559999abf0..0d81491ff0ad 100644 --- a/extensions/source/bibliography/bibconfig.hxx +++ b/extensions/source/bibliography/bibconfig.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBCONFIG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBCONFIG_HXX +#pragma once #include <unotools/configitem.hxx> #include <tools/long.hxx> @@ -29,7 +28,7 @@ struct Mapping; typedef std::vector<std::unique_ptr<Mapping> > MappingArray; -#define COLUMN_COUNT 31 +#define COLUMN_COUNT 32 #define IDENTIFIER_POS 0 #define AUTHORITYTYPE_POS 1 #define AUTHOR_POS 2 @@ -61,6 +60,7 @@ typedef std::vector<std::unique_ptr<Mapping> > MappingArray; #define CUSTOM3_POS 28 #define CUSTOM4_POS 29 #define CUSTOM5_POS 30 +#define LOCAL_URL_POS 31 struct StringPair { @@ -149,6 +149,5 @@ public: const css::uno::Sequence<OUString>& GetDataSourceNames(); }; -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibcont.cxx b/extensions/source/bibliography/bibcont.cxx index 7c24b0fb3fd2..7e31f8b9b095 100644 --- a/extensions/source/bibliography/bibcont.cxx +++ b/extensions/source/bibliography/bibcont.cxx @@ -49,7 +49,6 @@ BibSplitWindow::BibSplitWindow( vcl::Window* pParent, WinBits nStyle ) : SplitWi } using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; //split window size is a percent value #define WIN_MIN_HEIGHT 10 @@ -193,7 +192,7 @@ void BibBookContainer::GetFocus() bool BibBookContainer::PreNotify( NotifyEvent& rNEvt ) { bool bHandled = false; - if( MouseNotifyEvent::KEYINPUT == rNEvt.GetType() ) + if( NotifyEventType::KEYINPUT == rNEvt.GetType() ) { const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); const vcl::KeyCode aKeyCode = pKEvt->GetKeyCode(); diff --git a/extensions/source/bibliography/bibcont.hxx b/extensions/source/bibliography/bibcont.hxx index aca9f0e68fc3..d90952ac32c3 100644 --- a/extensions/source/bibliography/bibcont.hxx +++ b/extensions/source/bibliography/bibcont.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBCONT_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBCONT_HXX +#pragma once #include <vcl/timer.hxx> #include <vcl/idle.hxx> @@ -91,6 +90,4 @@ class BibBookContainer: public BibSplitWindow virtual bool HandleShortCutKey( const KeyEvent& rKeyEvent ) override; // returns true, if key was handled }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index 312c47432f4a..c8d88d8d0160 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -18,11 +18,12 @@ */ #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <cppuhelper/supportsservice.hxx> #include <svl/itemprop.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <comphelper/processfactory.hxx> +#include <com/sun/star/awt/XVclWindowPeer.hpp> #include <com/sun/star/sdbc/ResultSetType.hpp> #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #include <com/sun/star/sdbc/SQLException.hpp> @@ -38,7 +39,6 @@ #include <com/sun/star/text/BibliographyDataField.hpp> #include <com/sun/star/form/XLoadable.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> -#include <toolkit/awt/vclxwindow.hxx> #include <vcl/window.hxx> #include <vcl/svapp.hxx> @@ -53,6 +53,7 @@ #include "bibconfig.hxx" #include <cppuhelper/implbase.hxx> #include <rtl/ref.hxx> +#include <o3tl/string_view.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -175,7 +176,7 @@ void BibliographyLoader::load(const Reference< XFrame > & rFrame, const OUString m_pBibMod = OpenBibModul(); - OUString aPartName = rURL.getToken( 1, '/' ); + std::u16string_view aPartName = o3tl::getToken(rURL, 1, '/' ); Reference<XPropertySet> xPrSet(rFrame, UNO_QUERY); if(xPrSet.is()) { @@ -183,7 +184,7 @@ void BibliographyLoader::load(const Reference< XFrame > & rFrame, const OUString aTitle <<= BibResId(RID_BIB_STR_FRAME_TITLE); xPrSet->setPropertyValue("Title", aTitle); } - if(aPartName == "View" || aPartName == "View1") + if(aPartName == u"View" || aPartName == u"View1") { loadView(rFrame, rListener); } @@ -211,9 +212,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, m_xDatMan->createDatabaseForm( aBibDesc ); - Reference< awt::XWindow > aWindow = rFrame->getContainerWindow(); - VCLXWindow* pParentComponent = comphelper::getUnoTunnelImplementation<VCLXWindow>(aWindow); - assert(pParentComponent); + Reference<awt::XWindow> aWindow = rFrame->getContainerWindow(); VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( aWindow ); @@ -238,13 +237,13 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, rFrame->setComponent( xWin, xCtrRef); pBeamer->SetXController(xCtrRef); - if (pParentComponent) + if (aWindow) { // not earlier because SetFocus() is triggered in setVisible() - pParentComponent->setVisible(true); + aWindow->setVisible(true); } - Reference<XLoadable>(m_xDatMan.get())->load(); + Reference<XLoadable>(m_xDatMan)->load(); m_xDatMan->RegisterInterceptor(pBeamer); if ( rListener.is() ) @@ -516,8 +515,7 @@ Reference< XPropertySetInfo > BibliographyLoader::getPropertySetInfo() { static const SfxItemPropertyMapEntry aBibProps_Impl[] = { - { u"BibliographyDataFieldNames", 0, cppu::UnoType<Sequence<PropertyValue>>::get(), PropertyAttribute::READONLY, 0}, - { u"", 0, css::uno::Type(), 0, 0 } + { u"BibliographyDataFieldNames"_ustr, 0, cppu::UnoType<Sequence<PropertyValue>>::get(), PropertyAttribute::READONLY, 0}, }; static Reference< XPropertySetInfo > xRet = SfxItemPropertySet(aBibProps_Impl).getPropertySetInfo(); @@ -566,14 +564,15 @@ Any BibliographyLoader::getPropertyValue(const OUString& rPropertyName) CUSTOM3_POS , // BibliographyDataField_CUSTOM3 CUSTOM4_POS , // BibliographyDataField_CUSTOM4 CUSTOM5_POS , // BibliographyDataField_CUSTOM5 - ISBN_POS //BibliographyDataField_ISBN + ISBN_POS , // BibliographyDataField_ISBN + LOCAL_URL_POS // BibliographyDataField_LOCAL_URL }; if(rPropertyName != "BibliographyDataFieldNames") throw UnknownPropertyException(rPropertyName); Sequence<PropertyValue> aSeq(COLUMN_COUNT); PropertyValue* pArray = aSeq.getArray(); BibConfig* pConfig = BibModul::GetConfig(); - for(sal_uInt16 i = 0; i <= text::BibliographyDataField::ISBN ; i++) + for(sal_uInt16 i = 0; i <= text::BibliographyDataField::LOCAL_URL ; i++) { pArray[i].Name = pConfig->GetDefColumnName(aInternalMapping[i]); pArray[i].Value <<= static_cast<sal_Int16>(i); diff --git a/extensions/source/bibliography/bibmod.cxx b/extensions/source/bibliography/bibmod.cxx index 1a4f6cca47d2..9d7ac60330ba 100644 --- a/extensions/source/bibliography/bibmod.cxx +++ b/extensions/source/bibliography/bibmod.cxx @@ -29,10 +29,6 @@ static BibModul* pBibModul=nullptr; static sal_uInt32 nBibModulCount=0; using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ucb; HdlBibModul OpenBibModul() { @@ -54,9 +50,9 @@ void CloseBibModul(HdlBibModul ppBibModul) } } -OUString BibResId(const char* pId) +OUString BibResId(TranslateId aId) { - return Translate::get(pId, pBibModul->GetResLocale()); + return Translate::get(aId, pBibModul->GetResLocale()); } BibConfig* BibModul::pBibConfig = nullptr; @@ -74,7 +70,7 @@ BibModul::~BibModul() pBibConfig = nullptr; } -BibDataManager* BibModul::createDataManager() +rtl::Reference<BibDataManager> BibModul::createDataManager() { return new BibDataManager(); } diff --git a/extensions/source/bibliography/bibmod.hxx b/extensions/source/bibliography/bibmod.hxx index e651f720e753..a695f93d6c83 100644 --- a/extensions/source/bibliography/bibmod.hxx +++ b/extensions/source/bibliography/bibmod.hxx @@ -17,10 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBMOD_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBMOD_HXX +#pragma once #include <locale> +#include <rtl/ref.hxx> class BibDataManager; class BibConfig; @@ -38,7 +38,7 @@ class BibModul const std::locale& GetResLocale() const { return m_aResLocale; } static BibConfig* GetConfig(); - static BibDataManager* createDataManager(); + static rtl::Reference<BibDataManager> createDataManager(); }; @@ -47,6 +47,4 @@ typedef BibModul** HdlBibModul; HdlBibModul OpenBibModul(); void CloseBibModul(HdlBibModul ppBibModul); -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibresid.hxx b/extensions/source/bibliography/bibresid.hxx index b555e632d97c..6e17e76f2af7 100644 --- a/extensions/source/bibliography/bibresid.hxx +++ b/extensions/source/bibliography/bibresid.hxx @@ -17,13 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBRESID_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBRESID_HXX +#pragma once #include <rtl/ustring.hxx> +#include <unotools/resmgr.hxx> -OUString BibResId(const char* pId); - -#endif // INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBRESID_HXX +OUString BibResId(TranslateId aId); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibshortcuthandler.hxx b/extensions/source/bibliography/bibshortcuthandler.hxx index e9e397cd5fd7..79563543bdcb 100644 --- a/extensions/source/bibliography/bibshortcuthandler.hxx +++ b/extensions/source/bibliography/bibshortcuthandler.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBSHORTCUTHANDLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBSHORTCUTHANDLER_HXX +#pragma once #include <vcl/window.hxx> #include <vcl/splitwin.hxx> @@ -64,6 +63,4 @@ public: BibSplitWindow( vcl::Window* pParent, WinBits nStyle); }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibtools.hxx b/extensions/source/bibliography/bibtools.hxx index 1fc9f0a358b2..9b0d388fa56b 100644 --- a/extensions/source/bibliography/bibtools.hxx +++ b/extensions/source/bibliography/bibtools.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBTOOLS_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBTOOLS_HXX +#pragma once #include <vcl/window.hxx> @@ -40,6 +39,4 @@ namespace bib } } -#endif // INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBTOOLS_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx index e4eca459631e..0809789854ce 100644 --- a/extensions/source/bibliography/bibview.cxx +++ b/extensions/source/bibliography/bibview.cxx @@ -28,13 +28,10 @@ #include <vcl/svapp.hxx> -#include <com/sun/star/sdbc/XResultSetUpdate.hpp> #include <vcl/weld.hxx> -#include <tools/debug.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::form; -using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; @@ -79,38 +76,11 @@ namespace bib { VclPtr<BibGeneralPage> pGeneralPage = m_pGeneralPage; m_pGeneralPage.clear(); - - pGeneralPage->CommitActiveControl(); - Reference< XForm > xForm = m_pDatMan->getForm(); - Reference< XPropertySet > xProps( xForm, UNO_QUERY ); - Reference< sdbc::XResultSetUpdate > xResUpd( xProps, UNO_QUERY ); - DBG_ASSERT( xResUpd.is(), "BibView::~BibView: invalid form!" ); - - if ( xResUpd.is() ) - { - Any aModified = xProps->getPropertyValue( "IsModified" ); - bool bFlag = false; - if ( ( aModified >>= bFlag ) && bFlag ) - { - - try - { - Any aNew = xProps->getPropertyValue( "IsNew" ); - aNew >>= bFlag; - if ( bFlag ) - xResUpd->insertRow(); - else - xResUpd->updateRow(); - } - catch( const uno::Exception&) {} - } - } + pGeneralPage.disposeAndClear(); // dispose will commit any uncommitted weld::Entry changes if ( m_aFormControlContainer.isFormConnected() ) m_aFormControlContainer.disconnectForm(); - pGeneralPage->RemoveListeners(); - pGeneralPage.disposeAndClear(); BibWindow::dispose(); } @@ -122,7 +92,6 @@ namespace bib if ( m_pGeneralPage ) { m_pGeneralPage->Hide(); - m_pGeneralPage->RemoveListeners(); m_pGeneralPage.disposeAndClear(); } @@ -198,15 +167,7 @@ namespace bib Reference< awt::XControlContainer > BibViewFormControlContainer::getControlContainer() { - return mpBibView->getControlContainer(); - } - - Reference< awt::XControlContainer > BibView::getControlContainer() const - { - Reference< awt::XControlContainer > xReturn; - if ( m_pGeneralPage ) - xReturn = m_pGeneralPage->GetControlContainer(); - return xReturn; + return nullptr; } void BibView::GetFocus() diff --git a/extensions/source/bibliography/bibview.hxx b/extensions/source/bibliography/bibview.hxx index 4198dac03987..3bed8ed134c9 100644 --- a/extensions/source/bibliography/bibview.hxx +++ b/extensions/source/bibliography/bibview.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBVIEW_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBVIEW_HXX +#pragma once #include <com/sun/star/awt/XControlContainer.hpp> #include "formcontrolcontainer.hxx" @@ -28,11 +27,8 @@ class BibDataManager; namespace com::sun::star::awt{ class XFocusListener;} - namespace bib { - - class BibView; class BibViewFormControlContainer : public FormControlContainer { @@ -73,7 +69,6 @@ namespace bib virtual void dispose() override; void UpdatePages(); - css::uno::Reference< css::awt::XControlContainer > getControlContainer() const; virtual void GetFocus() override; @@ -84,7 +79,5 @@ namespace bib } // namespace bib -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index a492c839712e..a15a3e889c18 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -21,7 +21,7 @@ #include <o3tl/any.hxx> #include <sal/log.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/sdbc/ResultSetType.hpp> #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> @@ -73,7 +73,7 @@ using namespace ::com::sun::star::lang; // PropertyNames constexpr OUStringLiteral FM_PROP_LABEL = u"Label"; -constexpr OUStringLiteral FM_PROP_CONTROLSOURCE = u"DataField"; +constexpr OUString FM_PROP_CONTROLSOURCE = u"DataField"_ustr; constexpr OUStringLiteral FM_PROP_NAME = u"Name"; static Reference< XConnection > getConnection(const OUString& _rURL) @@ -219,6 +219,7 @@ class MappingDialog_Impl : public weld::GenericDialogController std::unique_ptr<weld::ComboBox> m_xCustom3LB; std::unique_ptr<weld::ComboBox> m_xCustom4LB; std::unique_ptr<weld::ComboBox> m_xCustom5LB; + std::unique_ptr<weld::ComboBox> m_xLocalURLLB; weld::ComboBox* aListBoxes[COLUMN_COUNT]; DECL_LINK(OkHdl, weld::Button&, void); @@ -278,6 +279,7 @@ MappingDialog_Impl::MappingDialog_Impl(weld::Window* pParent, BibDataManager* pM , m_xCustom3LB(m_xBuilder->weld_combo_box("custom3Combobox")) , m_xCustom4LB(m_xBuilder->weld_combo_box("custom4Combobox")) , m_xCustom5LB(m_xBuilder->weld_combo_box("custom5Combobox")) + , m_xLocalURLLB(m_xBuilder->weld_combo_box("LocalURLCombobox")) { m_xOKBT->connect_clicked(LINK(this, MappingDialog_Impl, OkHdl)); OUString sTitle = m_xDialog->get_title(); @@ -315,6 +317,7 @@ MappingDialog_Impl::MappingDialog_Impl(weld::Window* pParent, BibDataManager* pM aListBoxes[28] = m_xCustom3LB.get(); aListBoxes[29] = m_xCustom4LB.get(); aListBoxes[30] = m_xCustom5LB.get(); + aListBoxes[31] = m_xLocalURLLB.get(); aListBoxes[0]->append_text(sNone); Reference< XNameAccess > xFields = getColumns( pDatMan->getForm() ); @@ -527,9 +530,7 @@ void SAL_CALL BibInterceptorHelper::setMasterDispatchProvider( const css::uno::R constexpr OUStringLiteral gGridName(u"theGrid"); BibDataManager::BibDataManager() - :BibDataManager_Base( GetMutex() ) - ,m_aLoadListeners(m_aMutex) - ,pBibView( nullptr ) + :pBibView( nullptr ) ,pToolbar(nullptr) { } @@ -627,11 +628,11 @@ void BibDataManager::InsertFields(const Reference< XFormComponent > & _rxGrid) Any aFormatted(bFormattedIsNumeric); xCurrentCol->setPropertyValue("TreatAsNumber", aFormatted); } - Any aColName = makeAny( rField ); + Any aColName( rField ); xCurrentCol->setPropertyValue(FM_PROP_CONTROLSOURCE, aColName); xCurrentCol->setPropertyValue(FM_PROP_LABEL, aColName); - xColContainer->insertByName( rField, makeAny( xCurrentCol ) ); + xColContainer->insertByName( rField, Any( xCurrentCol ) ); } } catch (const Exception&) @@ -658,7 +659,7 @@ Reference< awt::XControlModel > const & BibDataManager::updateGridModel(const Re m_xGridModel = createGridModel( gGridName ); Reference< XNameContainer > xNameCont(xDbForm, UNO_QUERY); - xNameCont->insertByName( sName, makeAny( m_xGridModel ) ); + xNameCont->insertByName( sName, Any( m_xGridModel ) ); } // insert the fields @@ -785,8 +786,8 @@ void BibDataManager::setFilter(const OUString& rQuery) m_xParser->setFilter( rQuery ); OUString aQuery = m_xParser->getFilter(); Reference< XPropertySet > xFormProps( m_xForm, UNO_QUERY_THROW ); - xFormProps->setPropertyValue( "Filter", makeAny( aQuery ) ); - xFormProps->setPropertyValue( "ApplyFilter", makeAny( true ) ); + xFormProps->setPropertyValue( "Filter", Any( aQuery ) ); + xFormProps->setPropertyValue( "ApplyFilter", Any( true ) ); reload(); } catch (const Exception&) @@ -848,9 +849,7 @@ void BibDataManager::startQueryWith(const OUString& rQuery) OUString aQueryString; if(!rQuery.isEmpty()) { - aQueryString=aQuoteChar; - aQueryString+=getQueryField(); - aQueryString+=aQuoteChar + " like '"; + aQueryString=aQuoteChar + getQueryField() + aQuoteChar + " like '"; OUString sQuery = rQuery.replaceAll("?","_").replaceAll("*","%"); aQueryString += sQuery + "%'"; } @@ -898,7 +897,7 @@ void BibDataManager::setActiveDataSource(const OUString& rURL) aActiveDataTable = aTableNameSeq[0]; aVal <<= aActiveDataTable; aPropertySet->setPropertyValue("Command", aVal); - aPropertySet->setPropertyValue("CommandType", makeAny(CommandType::TABLE)); + aPropertySet->setPropertyValue("CommandType", Any(CommandType::TABLE)); //Caching for Performance aVal <<= sal_Int32(50); aPropertySet->setPropertyValue("FetchSize", aVal); @@ -1013,8 +1012,9 @@ void SAL_CALL BibDataManager::load( ) { xFormAsLoadable->load(); + std::unique_lock g(m_aMutex); EventObject aEvt( static_cast< XWeak* >( this ) ); - m_aLoadListeners.notifyEach( &XLoadListener::loaded, aEvt ); + m_aLoadListeners.notifyEach( g, &XLoadListener::loaded, aEvt ); } } @@ -1033,13 +1033,15 @@ void SAL_CALL BibDataManager::unload( ) EventObject aEvt( static_cast< XWeak* >( this ) ); { - m_aLoadListeners.notifyEach( &XLoadListener::unloading, aEvt ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.notifyEach( g, &XLoadListener::unloading, aEvt ); } xFormAsLoadable->unload(); { - m_aLoadListeners.notifyEach( &XLoadListener::unloaded, aEvt ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.notifyEach( g, &XLoadListener::unloaded, aEvt ); } } @@ -1058,13 +1060,15 @@ void SAL_CALL BibDataManager::reload( ) EventObject aEvt( static_cast< XWeak* >( this ) ); { - m_aLoadListeners.notifyEach( &XLoadListener::reloading, aEvt ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.notifyEach( g, &XLoadListener::reloading, aEvt ); } xFormAsLoadable->reload(); { - m_aLoadListeners.notifyEach( &XLoadListener::reloaded, aEvt ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.notifyEach( g, &XLoadListener::reloaded, aEvt ); } } @@ -1083,13 +1087,15 @@ sal_Bool SAL_CALL BibDataManager::isLoaded( ) void SAL_CALL BibDataManager::addLoadListener( const Reference< XLoadListener >& aListener ) { - m_aLoadListeners.addInterface( aListener ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.addInterface( g, aListener ); } void SAL_CALL BibDataManager::removeLoadListener( const Reference< XLoadListener >& aListener ) { - m_aLoadListeners.removeInterface( aListener ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.removeInterface( g, aListener ); } @@ -1106,7 +1112,7 @@ Reference< awt::XControlModel > BibDataManager::createGridModel(const OUString& // set the Reference< XPropertySet > xPropSet( xModel, UNO_QUERY ); - xPropSet->setPropertyValue( "Name", makeAny( rName ) ); + xPropSet->setPropertyValue( "Name", Any( rName ) ); // set the name of the to-be-created control Any aAny(OUString("com.sun.star.form.control.InteractionGridControl")); @@ -1118,7 +1124,7 @@ Reference< awt::XControlModel > BibDataManager::createGridModel(const OUString& if (xPropInfo->hasPropertyByName(uProp)) { xPropSet->setPropertyValue( - uProp, makeAny<OUString>(INET_HID_SCHEME HID_BIB_DB_GRIDCTRL)); + uProp, Any(OUString(INET_HID_SCHEME + HID_BIB_DB_GRIDCTRL))); } } catch (const Exception&) @@ -1205,8 +1211,8 @@ Reference< awt::XControlModel > BibDataManager::loadControlModel( Any aFieldName; aFieldName <<= aName; xPropSet->setPropertyValue( FM_PROP_NAME,aFieldName); - xPropSet->setPropertyValue( FM_PROP_CONTROLSOURCE, makeAny( rName ) ); - xPropSet->setPropertyValue("NativeWidgetLook", makeAny( true ) ); + xPropSet->setPropertyValue( FM_PROP_CONTROLSOURCE, Any( rName ) ); + xPropSet->setPropertyValue("NativeWidgetLook", Any( true ) ); if (bForceListBox) { @@ -1264,7 +1270,7 @@ Reference< awt::XControlModel > BibDataManager::loadControlModel( Reference< XFormComponent > aFormComp(xModel,UNO_QUERY ); Reference< XNameContainer > xNameCont( m_xForm, UNO_QUERY ); - xNameCont->insertByName(aName, makeAny( aFormComp ) ); + xNameCont->insertByName(aName, Any( aFormComp ) ); // now if the form where we inserted the new model is already loaded, notify the model of this // Note that this implementation below is a HACK as it relies on the fact that the model adds itself diff --git a/extensions/source/bibliography/datman.hxx b/extensions/source/bibliography/datman.hxx index 3be03aaa9197..405cf83d85a5 100644 --- a/extensions/source/bibliography/datman.hxx +++ b/extensions/source/bibliography/datman.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_DATMAN_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_DATMAN_HXX +#pragma once #include "bibview.hxx" @@ -26,16 +25,14 @@ #include <com/sun/star/form/XForm.hpp> #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> #include <com/sun/star/form/runtime/XFormController.hpp> -#include <cppuhelper/compbase.hxx> -#include <comphelper/interfacecontainer2.hxx> +#include <comphelper/compbase.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <com/sun/star/form/XLoadable.hpp> -#include <comphelper/broadcasthelper.hxx> #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> #include <com/sun/star/frame/XDispatchProviderInterception.hpp> #include <cppuhelper/implbase.hxx> #include <vcl/vclptr.hxx> -namespace vcl { class Window; } namespace weld { class Window; } namespace bib @@ -74,11 +71,9 @@ public: virtual void SAL_CALL setMasterDispatchProvider( const css::uno::Reference< css::frame::XDispatchProvider >& xNewMasterDispatchProvider ) override; }; -typedef cppu::WeakComponentImplHelper < css::form::XLoadable +typedef comphelper::WeakComponentImplHelper < css::form::XLoadable > BibDataManager_Base; -class BibDataManager final - :public ::comphelper::OMutexAndBroadcastHelper - ,public BibDataManager_Base +class BibDataManager final : public BibDataManager_Base { private: css::uno::Reference< css::form::XForm > m_xForm; @@ -92,7 +87,7 @@ private: OUString aDataSourceURL; OUString aQuoteChar; - ::comphelper::OInterfaceContainerHelper2 m_aLoadListeners; + ::comphelper::OInterfaceContainerHelper4<css::form::XLoadListener> m_aLoadListeners; VclPtr< ::bib::BibView> pBibView; VclPtr<BibToolBar> pToolbar; @@ -168,6 +163,4 @@ public: }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/formcontrolcontainer.cxx b/extensions/source/bibliography/formcontrolcontainer.cxx index 5e9f7d37aa35..f8d43a8a7c88 100644 --- a/extensions/source/bibliography/formcontrolcontainer.cxx +++ b/extensions/source/bibliography/formcontrolcontainer.cxx @@ -19,7 +19,7 @@ #include "formcontrolcontainer.hxx" #include <sal/log.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <algorithm> @@ -92,15 +92,16 @@ namespace bib try { Reference< XControlContainer > xControlCont = getControlContainer(); - Sequence< Reference< XControl > > aControls; if ( xControlCont.is() ) - aControls = xControlCont->getControls(); - - std::for_each( - aControls.begin(), - aControls.end(), - ControlModeSwitch( _bDesign ) - ); + { + const Sequence<Reference<XControl>> aControls = xControlCont->getControls(); + + std::for_each( + aControls.begin(), + aControls.end(), + ControlModeSwitch( _bDesign ) + ); + } } catch( const Exception&) { diff --git a/extensions/source/bibliography/formcontrolcontainer.hxx b/extensions/source/bibliography/formcontrolcontainer.hxx index fc119a7eb1fa..b15105ad08c7 100644 --- a/extensions/source/bibliography/formcontrolcontainer.hxx +++ b/extensions/source/bibliography/formcontrolcontainer.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_FORMCONTROLCONTAINER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_FORMCONTROLCONTAINER_HXX +#pragma once #include <cppuhelper/basemutex.hxx> #include "loadlisteneradapter.hxx" @@ -63,6 +62,4 @@ namespace bib } // namespace bib -#endif // INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_FORMCONTROLCONTAINER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index 7f621eb72bea..758c8b3484c2 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -18,16 +18,19 @@ */ #include <comphelper/types.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include "framectr.hxx" #include "datman.hxx" #include <toolkit/helper/vclunohelper.hxx> #include "bibconfig.hxx" #include <cppuhelper/implbase.hxx> +#include <utility> #include <vcl/event.hxx> #include <vcl/svapp.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> #include <com/sun/star/form/XConfirmDeleteListener.hpp> #include <com/sun/star/form/runtime/XFormController.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -38,11 +41,11 @@ #include <com/sun/star/sdb/RowChangeAction.hpp> #include <com/sun/star/frame/CommandGroup.hpp> #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/multicontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <sot/exchange.hxx> #include <sot/formats.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <vcl/weld.hxx> #include <osl/mutex.hxx> @@ -121,7 +124,7 @@ class BibFrameCtrl_Impl : public cppu::WeakImplHelper < XFrameActionListener > { public: Mutex aMutex; - OMultiTypeInterfaceContainerHelper aLC; + comphelper::OMultiTypeInterfaceContainerHelper2 aLC; BibFrameController_Impl* pController; @@ -145,19 +148,19 @@ void BibFrameCtrl_Impl::disposing( const lang::EventObject& /*Source*/ ) pController->getFrame()->removeFrameActionListener( this ); } -BibFrameController_Impl::BibFrameController_Impl( const uno::Reference< awt::XWindow > & xComponent, +BibFrameController_Impl::BibFrameController_Impl( uno::Reference< awt::XWindow > xComponent, BibDataManager* pDataManager) - :xWindow( xComponent ) + :m_xWindow(std::move( xComponent )) ,m_xDatMan( pDataManager ) { - bDisposing=false; - mxImpl = new BibFrameCtrl_Impl; - mxImpl->pController = this; + m_bDisposing = false; + m_xImpl = new BibFrameCtrl_Impl; + m_xImpl->pController = this; } BibFrameController_Impl::~BibFrameController_Impl() { - mxImpl->pController = nullptr; + m_xImpl->pController = nullptr; m_xDatMan.clear(); } @@ -180,8 +183,8 @@ css::uno::Sequence< OUString > SAL_CALL BibFrameController_Impl::getSupportedSer void BibFrameController_Impl::attachFrame( const uno::Reference< XFrame > & xArg ) { - xFrame = xArg; - xFrame->addFrameActionListener( mxImpl.get() ); + m_xFrame = xArg; + m_xFrame->addFrameActionListener( m_xImpl ); } sal_Bool BibFrameController_Impl::attachModel( const uno::Reference< XModel > & /*xModel*/ ) @@ -192,9 +195,9 @@ sal_Bool BibFrameController_Impl::attachModel( const uno::Reference< XModel > & sal_Bool BibFrameController_Impl::suspend( sal_Bool bSuspend ) { if ( bSuspend ) - getFrame()->removeFrameActionListener( mxImpl.get() ); + getFrame()->removeFrameActionListener( m_xImpl ); else - getFrame()->addFrameActionListener( mxImpl.get() ); + getFrame()->addFrameActionListener( m_xImpl ); return true; } @@ -209,7 +212,7 @@ void BibFrameController_Impl::restoreViewData( const uno::Any& /*Value*/ ) uno::Reference< XFrame > BibFrameController_Impl::getFrame() { - return xFrame; + return m_xFrame; } uno::Reference< XModel > BibFrameController_Impl::getModel() @@ -219,28 +222,36 @@ uno::Reference< XModel > BibFrameController_Impl::getModel() void BibFrameController_Impl::dispose() { - bDisposing = true; + m_bDisposing = true; lang::EventObject aObject; + uno::Reference< XFrame > xFrame = getFrame(); + + if (xFrame.is()) + xFrame->removeFrameActionListener( m_xImpl ); + m_xFrame.clear(); + aObject.Source = static_cast<XController*>(this); - mxImpl->aLC.disposeAndClear(aObject); + m_xImpl->aLC.disposeAndClear(aObject); m_xDatMan.clear(); - aStatusListeners.clear(); + m_aStatusListeners.clear(); m_xLastQueriedFocusWin.clear(); + m_xWindow.clear(); + m_xImpl.clear(); } void BibFrameController_Impl::addEventListener( const uno::Reference< lang::XEventListener > & aListener ) { - mxImpl->aLC.addInterface( cppu::UnoType<lang::XEventListener>::get(), aListener ); + m_xImpl->aLC.addInterface( cppu::UnoType<lang::XEventListener>::get(), aListener ); } void BibFrameController_Impl::removeEventListener( const uno::Reference< lang::XEventListener > & aListener ) { - mxImpl->aLC.removeInterface( cppu::UnoType<lang::XEventListener>::get(), aListener ); + m_xImpl->aLC.removeInterface( cppu::UnoType<lang::XEventListener>::get(), aListener ); } uno::Reference< frame::XDispatch > BibFrameController_Impl::queryDispatch( const util::URL& aURL, const OUString& /*aTarget*/, sal_Int32 /*nSearchFlags*/ ) { - if ( !bDisposing ) + if ( !m_bDisposing ) { const CmdToInfoCache& rCmdCache = GetCommandToInfoCache(); CmdToInfoCache::const_iterator pIter = rCmdCache.find( aURL.Complete ); @@ -258,19 +269,18 @@ uno::Reference< frame::XDispatch > BibFrameController_Impl::queryDispatch( cons uno::Sequence<uno::Reference< XDispatch > > BibFrameController_Impl::queryDispatches( const uno::Sequence<DispatchDescriptor>& aDescripts ) { uno::Sequence< uno::Reference< XDispatch > > aDispatches( aDescripts.getLength() ); + auto aDispatchesRange = asNonConstRange(aDispatches); for ( sal_Int32 i=0; i<aDescripts.getLength(); ++i ) - aDispatches[i] = queryDispatch( aDescripts[i].FeatureURL, aDescripts[i].FrameName, aDescripts[i].SearchFlags ); + aDispatchesRange[i] = queryDispatch( aDescripts[i].FeatureURL, aDescripts[i].FrameName, aDescripts[i].SearchFlags ); return aDispatches; } uno::Sequence< ::sal_Int16 > SAL_CALL BibFrameController_Impl::getSupportedCommandGroups() { - uno::Sequence< ::sal_Int16 > aDispatchInfo( 4 ); - - aDispatchInfo[0] = frame::CommandGroup::EDIT; - aDispatchInfo[1] = frame::CommandGroup::DOCUMENT; - aDispatchInfo[2] = frame::CommandGroup::DATA; - aDispatchInfo[3] = frame::CommandGroup::VIEW; + uno::Sequence< ::sal_Int16 > aDispatchInfo{ frame::CommandGroup::EDIT, + frame::CommandGroup::DOCUMENT, + frame::CommandGroup::DATA, + frame::CommandGroup::VIEW }; return aDispatchInfo; } @@ -366,11 +376,11 @@ static vcl::Window* lcl_GetFocusChild( vcl::Window const * pParent ) //class XDispatch void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequence< beans::PropertyValue >& aArgs) { - if ( bDisposing ) + if ( m_bDisposing ) return; ::SolarMutexGuard aGuard; - weld::Window* pParent = Application::GetFrameWeld(xWindow); + weld::Window* pParent = Application::GetFrameWeld(m_xWindow); weld::WaitObject aWaitObject(pParent); OUString aCommand( _rURL.Path); @@ -389,10 +399,11 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen { try { - uno::Sequence< beans::PropertyValue > aNewDataSource(2); - beans::PropertyValue* pProps = aNewDataSource.getArray(); - pProps[0].Value <<= OUString(); - pProps[1].Value <<= aURL; + uno::Sequence< beans::PropertyValue > aNewDataSource + { + comphelper::makePropertyValue( {}, OUString() ), + comphelper::makePropertyValue( {}, aURL ) + }; ChangeDataSource(aNewDataSource); } catch(const Exception&) @@ -404,10 +415,10 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen } else if(aCommand == "Bib/autoFilter") { - sal_uInt16 nCount = aStatusListeners.size(); + sal_uInt16 nCount = m_aStatusListeners.size(); for ( sal_uInt16 n=0; n<nCount; n++ ) { - BibStatusDispatch *pObj = aStatusListeners[n].get(); + BibStatusDispatch *pObj = m_aStatusListeners[n].get(); if ( pObj->aURL.Path == "Bib/removeFilter" ) { FeatureStateEvent aEvent; @@ -440,7 +451,7 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen // create the dialog object uno::Reference< ui::dialogs::XExecutableDialog > xDialog = sdb::FilterDialog::createWithQuery(xContext, m_xDatMan->getParser(), - Reference<sdbc::XRowSet>(m_xDatMan->getForm(), uno::UNO_QUERY_THROW), xWindow); + Reference<sdbc::XRowSet>(m_xDatMan->getForm(), uno::UNO_QUERY_THROW), m_xWindow); // execute it if ( xDialog->execute( ) ) { @@ -455,10 +466,10 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen TOOLS_WARN_EXCEPTION( "extensions.biblio", "BibFrameController_Impl::dispatch" ); } - sal_uInt16 nCount = aStatusListeners.size(); + sal_uInt16 nCount = m_aStatusListeners.size(); for ( sal_uInt16 n=0; n<nCount; n++ ) { - BibStatusDispatch *pObj = aStatusListeners[n].get(); + BibStatusDispatch *pObj = m_aStatusListeners[n].get(); if ( pObj->aURL.Path == "Bib/removeFilter" && m_xDatMan->getParser().is()) { FeatureStateEvent aEvent; @@ -474,7 +485,7 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen { RemoveFilter(); } - else if( _rURL.Complete == "slot:5503" || aCommand == "CloseDoc" ) + else if( _rURL.Complete == ".uno:CloseDoc" || aCommand == "CloseDoc" ) { Application::PostUserEvent( LINK( this, BibFrameController_Impl, DisposeHdl ) ); @@ -592,7 +603,8 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen } IMPL_LINK_NOARG( BibFrameController_Impl, DisposeHdl, void*, void ) { - xFrame->dispose(); + if (m_xFrame.is()) + m_xFrame->dispose(); }; void BibFrameController_Impl::addStatusListener( @@ -601,7 +613,7 @@ void BibFrameController_Impl::addStatusListener( { BibConfig* pConfig = BibModul::GetConfig(); // create a new Reference and insert into listener array - aStatusListeners.push_back( std::make_unique<BibStatusDispatch>( aURL, aListener ) ); + m_aStatusListeners.push_back( std::make_unique<BibStatusDispatch>( aURL, aListener ) ); // send first status synchronously FeatureStateEvent aEvent; @@ -652,7 +664,7 @@ void BibFrameController_Impl::addStatusListener( } else if(aURL.Path == "Cut") { - m_xLastQueriedFocusWin = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); + m_xLastQueriedFocusWin = lcl_GetFocusChild( VCLUnoHelper::GetWindow( m_xWindow ) ); if (m_xLastQueriedFocusWin) { Reference<css::awt::XTextComponent> xEdit(m_xLastQueriedFocusWin->GetComponentInterface(), css::uno::UNO_QUERY); @@ -661,7 +673,7 @@ void BibFrameController_Impl::addStatusListener( } if(aURL.Path == "Copy") { - m_xLastQueriedFocusWin = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); + m_xLastQueriedFocusWin = lcl_GetFocusChild( VCLUnoHelper::GetWindow( m_xWindow ) ); if (m_xLastQueriedFocusWin) { Reference<css::awt::XTextComponent> xEdit(m_xLastQueriedFocusWin->GetComponentInterface(), css::uno::UNO_QUERY); @@ -671,7 +683,7 @@ void BibFrameController_Impl::addStatusListener( else if(aURL.Path == "Paste" ) { aEvent.IsEnabled = false; - m_xLastQueriedFocusWin = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); + m_xLastQueriedFocusWin = lcl_GetFocusChild( VCLUnoHelper::GetWindow( m_xWindow ) ); if (m_xLastQueriedFocusWin) { Reference<css::awt::XTextComponent> xEdit(m_xLastQueriedFocusWin->GetComponentInterface(), css::uno::UNO_QUERY); @@ -734,18 +746,18 @@ void BibFrameController_Impl::removeStatusListener( { // search listener array for given listener // for checking equality always "cast" to XInterface - if ( bDisposing ) + if ( m_bDisposing ) return; - sal_uInt16 nCount = aStatusListeners.size(); + sal_uInt16 nCount = m_aStatusListeners.size(); for ( sal_uInt16 n=0; n<nCount; n++ ) { - BibStatusDispatch *pObj = aStatusListeners[n].get(); + BibStatusDispatch *pObj = m_aStatusListeners[n].get(); bool bFlag=pObj->xListener.is(); if (!bFlag || (pObj->xListener == aObject && ( aURL.Complete.isEmpty() || pObj->aURL.Path == aURL.Path ))) { - aStatusListeners.erase( aStatusListeners.begin() + n ); + m_aStatusListeners.erase( m_aStatusListeners.begin() + n ); break; } } @@ -756,14 +768,14 @@ void BibFrameController_Impl::RemoveFilter() OUString aQuery; m_xDatMan->startQueryWith(aQuery); - sal_uInt16 nCount = aStatusListeners.size(); + sal_uInt16 nCount = m_aStatusListeners.size(); bool bRemoveFilter=false; bool bQueryText=false; for ( sal_uInt16 n=0; n<nCount; n++ ) { - BibStatusDispatch *pObj = aStatusListeners[n].get(); + BibStatusDispatch *pObj = m_aStatusListeners[n].get(); if ( pObj->aURL.Path == "Bib/removeFilter" ) { FeatureStateEvent aEvent; @@ -810,7 +822,7 @@ void BibFrameController_Impl::ChangeDataSource(const uno::Sequence< beans::Prope } else { - Reference<css::form::XLoadable> xLoadable(m_xDatMan.get()); + Reference<css::form::XLoadable> xLoadable(m_xDatMan); xLoadable->unload(); m_xDatMan->setActiveDataTable(aDBTableName); m_xDatMan->updateGridModel(); @@ -818,13 +830,13 @@ void BibFrameController_Impl::ChangeDataSource(const uno::Sequence< beans::Prope } - sal_uInt16 nCount = aStatusListeners.size(); + sal_uInt16 nCount = m_aStatusListeners.size(); bool bMenuFilter=false; bool bQueryText=false; for ( sal_uInt16 n=0; n<nCount; n++ ) { - BibStatusDispatch *pObj = aStatusListeners[n].get(); + BibStatusDispatch *pObj = m_aStatusListeners[n].get(); if (pObj->aURL.Path == "Bib/MenuFilter") { FeatureStateEvent aEvent; diff --git a/extensions/source/bibliography/framectr.hxx b/extensions/source/bibliography/framectr.hxx index 75c336c763f0..9aac2cee0dab 100644 --- a/extensions/source/bibliography/framectr.hxx +++ b/extensions/source/bibliography/framectr.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_FRAMECTR_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_FRAMECTR_HXX +#pragma once #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XController.hpp> @@ -28,6 +27,7 @@ #include <cppuhelper/implbase.hxx> #include <rtl/ref.hxx> #include <tools/link.hxx> +#include <utility> #include <vcl/window.hxx> #include <vector> #include <memory> @@ -45,9 +45,9 @@ class BibStatusDispatch public: css::util::URL aURL; css::uno::Reference< css::frame::XStatusListener > xListener; - BibStatusDispatch( const css::util::URL& rURL, const css::uno::Reference< css::frame::XStatusListener >& rRef ) - : aURL( rURL ) - , xListener( rRef ) + BibStatusDispatch( css::util::URL _aURL, css::uno::Reference< css::frame::XStatusListener > xRef ) + : aURL(std::move( _aURL )) + , xListener(std::move( xRef )) {} }; @@ -62,19 +62,19 @@ class BibFrameController_Impl : public cppu::WeakImplHelper < > { friend class BibFrameCtrl_Impl; - rtl::Reference<BibFrameCtrl_Impl> mxImpl; - BibStatusDispatchArr aStatusListeners; - css::uno::Reference< css::awt::XWindow > xWindow; - css::uno::Reference< css::frame::XFrame > xFrame; - bool bDisposing; + rtl::Reference<BibFrameCtrl_Impl> m_xImpl; + BibStatusDispatchArr m_aStatusListeners; + css::uno::Reference< css::awt::XWindow > m_xWindow; + css::uno::Reference< css::frame::XFrame > m_xFrame; + bool m_bDisposing; rtl::Reference<BibDataManager> m_xDatMan; - VclPtr<vcl::Window> m_xLastQueriedFocusWin; + VclPtr<vcl::Window> m_xLastQueriedFocusWin; DECL_LINK( DisposeHdl, void*, void ); static bool SaveModified(const css::uno::Reference< css::form::runtime::XFormController>& xController); public: - BibFrameController_Impl( const css::uno::Reference< css::awt::XWindow > & xComponent, + BibFrameController_Impl( css::uno::Reference< css::awt::XWindow > xComponent, BibDataManager* pDatMan); virtual ~BibFrameController_Impl() override; @@ -115,6 +115,4 @@ public: virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( ::sal_Int16 CommandGroup ) override; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx index 1d2f66517a10..92a4c6843ec1 100644 --- a/extensions/source/bibliography/general.cxx +++ b/extensions/source/bibliography/general.cxx @@ -18,18 +18,22 @@ */ #include <comphelper/processfactory.hxx> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/form/XBoundComponent.hpp> #include <com/sun/star/sdbc/XRowSet.hpp> #include <com/sun/star/sdb/XColumn.hpp> #include <com/sun/star/sdb/CommandType.hpp> -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <toolkit/helper/vclunohelper.hxx> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> + +#include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> +#include <sal/log.hxx> +#include <osl/diagnose.h> #include <cppuhelper/implbase.hxx> -#include <vcl/builder.hxx> -#include <vcl/scrbar.hxx> -#include <vcl/settings.hxx> -#include <vcl/fixed.hxx> +#include <utility> +#include <vcl/event.hxx> +#include <vcl/mnemonic.hxx> #include "general.hxx" #include "bibresid.hxx" #include "datman.hxx" @@ -37,187 +41,165 @@ #include <strings.hrc> #include "bibmod.hxx" #include <helpids.h> -#include <tools/debug.hxx> -#include <vcl/svapp.hxx> -#include <vcl/i18nhelp.hxx> -#include <vcl/mnemonic.hxx> #include <algorithm> -#include <tools/urlobj.hxx> +#include <sfx2/filedlghelper.hxx> +#include <sfx2/objsh.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::form; using namespace ::com::sun::star::sdb; -static OUString lcl_GetColumnName( const Mapping* pMapping, sal_uInt16 nIndexPos ) +namespace { - BibConfig* pBibConfig = BibModul::GetConfig(); - OUString sRet = pBibConfig->GetDefColumnName(nIndexPos); - if(pMapping) - for(const auto & aColumnPair : pMapping->aColumnPairs) - { - if(aColumnPair.sLogicalColumnName == sRet) - { - sRet = aColumnPair.sRealColumnName; - break; - } - } - return sRet; -} - -namespace { - -class BibPosListener :public cppu::WeakImplHelper <sdbc::XRowSetListener> +/// Tries to split rText into rURL and nPageNumber. +bool SplitUrlAndPage(const OUString& rText, OUString& rUrl, int& nPageNumber) { - VclPtr<BibGeneralPage> pParentPage; -public: - explicit BibPosListener(BibGeneralPage* pParent); - - //XPositioningListener - virtual void SAL_CALL cursorMoved(const lang::EventObject& event) override; - virtual void SAL_CALL rowChanged(const lang::EventObject& /*event*/) override { /* not interested in */ } - virtual void SAL_CALL rowSetChanged(const lang::EventObject& /*event*/) override { /* not interested in */ } - - //XEventListener - virtual void SAL_CALL disposing(const lang::EventObject& Source) override; + uno::Reference<uri::XUriReferenceFactory> xUriReferenceFactory + = uri::UriReferenceFactory::create(comphelper::getProcessComponentContext()); + uno::Reference<uri::XUriReference> xUriRef; + try + { + xUriRef = xUriReferenceFactory->parse(rText); + } + catch (const uno::Exception& rException) + { + SAL_WARN("extensions.biblio", + "SplitUrlAndPage: failed to parse url: " << rException.Message); + return false; + } -}; + OUString aPagePrefix("page="); + if (!xUriRef->getFragment().startsWith(aPagePrefix)) + { + return false; + } + nPageNumber = o3tl::toInt32(xUriRef->getFragment().subView(aPagePrefix.getLength())); + xUriRef->clearFragment(); + rUrl = xUriRef->getUriReference(); + return true; } -BibPosListener::BibPosListener(BibGeneralPage* pParent) : - pParentPage(pParent) +/// Merges rUrl and rPageSB to a URL string. +OUString MergeUrlAndPage(const OUString& rUrl, const weld::SpinButton& rPageSB) { -} + if (!rPageSB.get_sensitive()) + { + return rUrl; + } -void BibPosListener::cursorMoved(const lang::EventObject& /*aEvent*/) -{ + uno::Reference<uri::XUriReferenceFactory> xUriReferenceFactory + = uri::UriReferenceFactory::create(comphelper::getProcessComponentContext()); + uno::Reference<uri::XUriReference> xUriRef; try { - uno::Reference< form::XBoundComponent > xLstBox = pParentPage->GetTypeListBoxModel(); - uno::Reference< beans::XPropertySet > xPropSet(xLstBox, UNO_QUERY); - if(xPropSet.is()) - { - BibConfig* pBibConfig = BibModul::GetConfig(); - BibDataManager* pDatMan = pParentPage->GetDataManager(); - BibDBDescriptor aDesc; - aDesc.sDataSource = pDatMan->getActiveDataSource(); - aDesc.sTableOrQuery = pDatMan->getActiveDataTable(); - aDesc.nCommandType = CommandType::TABLE; - - const Mapping* pMapping = pBibConfig->GetMapping(aDesc); - OUString sTypeMapping = pBibConfig->GetDefColumnName(AUTHORITYTYPE_POS); - if(pMapping) - { - for(const auto & aColumnPair : pMapping->aColumnPairs) - { - if(aColumnPair.sLogicalColumnName == sTypeMapping) - { - sTypeMapping = aColumnPair.sRealColumnName; - break; - } - } - } - OUString uTypeMapping = sTypeMapping; - - uno::Reference< form::XForm > xForm = pDatMan->getForm(); - uno::Reference< sdbcx::XColumnsSupplier > xSupplyCols(xForm, UNO_QUERY); - uno::Reference< container::XNameAccess > xValueAcc; - if (xSupplyCols.is()) - xValueAcc = xSupplyCols->getColumns(); - - sal_Int16 nTempVal = -1; - if(xValueAcc.is() && xValueAcc->hasByName(uTypeMapping)) - { - uno::Any aVal = xValueAcc->getByName(uTypeMapping); - uno::Reference< sdb::XColumn > xCol(aVal, UNO_QUERY); - DBG_ASSERT(xCol.is(), "BibPosListener::cursorMoved : invalid column (no sdb::XColumn) !"); - if (xCol.is()) - { - nTempVal = xCol->getShort(); - // getShort returns zero if the value is not a number - if (!nTempVal || xCol->wasNull()) - { - OUString sTempVal = xCol->getString(); - if(sTempVal != "0") - nTempVal = -1; - } - } - } - if(nTempVal < 0 || nTempVal >= TYPE_COUNT) - { - uno::Any aSel; - uno::Sequence<sal_Int16> aSelSeq(1); - sal_Int16* pArr = aSelSeq.getArray(); - pArr[0] = TYPE_COUNT; - aSel <<= aSelSeq; - xPropSet->setPropertyValue("SelectedItems", aSel); - } - } + xUriRef = xUriReferenceFactory->parse(rUrl); } - catch(const Exception&) + catch (const uno::Exception& rException) { - OSL_FAIL("BibPosListener::cursorMoved: something went wrong !"); + SAL_WARN("extensions.biblio", + "MergeUrlAndPage: failed to parse url: " << rException.Message); + return rUrl; } + + OUString aFragment("page=" + OUString::number(rPageSB.get_value())); + xUriRef->setFragment(aFragment); + return xUriRef->getUriReference(); +} } -void BibPosListener::disposing(const lang::EventObject& /*Source*/) +static OUString lcl_GetColumnName( const Mapping* pMapping, sal_uInt16 nIndexPos ) { + BibConfig* pBibConfig = BibModul::GetConfig(); + OUString sRet = pBibConfig->GetDefColumnName(nIndexPos); + if(pMapping) + for(const auto & aColumnPair : pMapping->aColumnPairs) + { + if(aColumnPair.sLogicalColumnName == sRet) + { + sRet = aColumnPair.sRealColumnName; + break; + } + } + return sRet; } -BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan): - TabPage(pParent), - BibShortCutHandler( this ), - mxBibGeneralPageFocusListener(new BibGeneralPageFocusListener(this)), - pDatMan(pMan) +BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan) + : InterimItemWindow(pParent, "modules/sbibliography/ui/generalpage.ui", "GeneralPage") + , BibShortCutHandler(this) + , xScrolledWindow(m_xBuilder->weld_scrolled_window("scrolledwindow")) + , xGrid(m_xBuilder->weld_widget("grid")) + , xIdentifierFT(m_xBuilder->weld_label("shortname")) + , xIdentifierED(m_xBuilder->weld_entry("shortnamecontrol")) + , xAuthTypeFT(m_xBuilder->weld_label("authtype")) + , xAuthTypeLB(m_xBuilder->weld_combo_box("authtypecontrol")) + , xYearFT(m_xBuilder->weld_label("year")) + , xYearED(m_xBuilder->weld_entry("yearcontrol")) + , xAuthorFT(m_xBuilder->weld_label("authors")) + , xAuthorED(m_xBuilder->weld_entry("authorscontrol")) + , xTitleFT(m_xBuilder->weld_label("title")) + , xTitleED(m_xBuilder->weld_entry("titlecontrol")) + , xPublisherFT(m_xBuilder->weld_label("publisher")) + , xPublisherED(m_xBuilder->weld_entry("publishercontrol")) + , xAddressFT(m_xBuilder->weld_label("address")) + , xAddressED(m_xBuilder->weld_entry("addresscontrol")) + , xISBNFT(m_xBuilder->weld_label("isbn")) + , xISBNED(m_xBuilder->weld_entry("isbncontrol")) + , xChapterFT(m_xBuilder->weld_label("chapter")) + , xChapterED(m_xBuilder->weld_entry("chaptercontrol")) + , xPagesFT(m_xBuilder->weld_label("pages")) + , xPagesED(m_xBuilder->weld_entry("pagescontrol")) + , xEditorFT(m_xBuilder->weld_label("editor")) + , xEditorED(m_xBuilder->weld_entry("editorcontrol")) + , xEditionFT(m_xBuilder->weld_label("edition")) + , xEditionED(m_xBuilder->weld_entry("editioncontrol")) + , xBooktitleFT(m_xBuilder->weld_label("booktitle")) + , xBooktitleED(m_xBuilder->weld_entry("booktitlecontrol")) + , xVolumeFT(m_xBuilder->weld_label("volume")) + , xVolumeED(m_xBuilder->weld_entry("volumecontrol")) + , xHowpublishedFT(m_xBuilder->weld_label("publicationtype")) + , xHowpublishedED(m_xBuilder->weld_entry("publicationtypecontrol")) + , xOrganizationsFT(m_xBuilder->weld_label("organization")) + , xOrganizationsED(m_xBuilder->weld_entry("organizationcontrol")) + , xInstitutionFT(m_xBuilder->weld_label("institution")) + , xInstitutionED(m_xBuilder->weld_entry("institutioncontrol")) + , xSchoolFT(m_xBuilder->weld_label("university")) + , xSchoolED(m_xBuilder->weld_entry("universitycontrol")) + , xReportTypeFT(m_xBuilder->weld_label("reporttype")) + , xReportTypeED(m_xBuilder->weld_entry("reporttypecontrol")) + , xMonthFT(m_xBuilder->weld_label("month")) + , xMonthED(m_xBuilder->weld_entry("monthcontrol")) + , xJournalFT(m_xBuilder->weld_label("journal")) + , xJournalED(m_xBuilder->weld_entry("journalcontrol")) + , xNumberFT(m_xBuilder->weld_label("number")) + , xNumberED(m_xBuilder->weld_entry("numbercontrol")) + , xSeriesFT(m_xBuilder->weld_label("series")) + , xSeriesED(m_xBuilder->weld_entry("seriescontrol")) + , xAnnoteFT(m_xBuilder->weld_label("annotation")) + , xAnnoteED(m_xBuilder->weld_entry("annotationcontrol")) + , xNoteFT(m_xBuilder->weld_label("note")) + , xNoteED(m_xBuilder->weld_entry("notecontrol")) + , xURLFT(m_xBuilder->weld_label("url")) + , xURLED(m_xBuilder->weld_entry("urlcontrol")) + , xCustom1FT(m_xBuilder->weld_label("custom1")) + , xCustom1ED(m_xBuilder->weld_entry("custom1control")) + , xCustom2FT(m_xBuilder->weld_label("custom2")) + , xCustom2ED(m_xBuilder->weld_entry("custom2control")) + , xCustom3FT(m_xBuilder->weld_label("custom3")) + , xCustom3ED(m_xBuilder->weld_entry("custom3control")) + , xCustom4FT(m_xBuilder->weld_label("custom4")) + , xCustom4ED(m_xBuilder->weld_entry("custom4control")) + , xCustom5FT(m_xBuilder->weld_label("custom5")) + , xCustom5ED(m_xBuilder->weld_entry("custom5control")) + , m_xLocalURLFT(m_xBuilder->weld_label("localurl")) + , m_xLocalURLED(m_xBuilder->weld_entry("localurlcontrol")) + , m_xLocalBrowseButton(m_xBuilder->weld_button("localbrowse")) + , m_xLocalPageCB(m_xBuilder->weld_check_button("localpagecb")) + , m_xLocalPageSB(m_xBuilder->weld_spin_button("localpagesb")) + , pDatMan(pMan) { - m_pUIBuilder.reset(new VclBuilder(this, AllSettings::GetUIRootDir(), "modules/sbibliography/ui/generalpage.ui", "GeneralPage")); - set_hexpand(true); - set_vexpand(true); - set_expand(true); - - get(pIdentifierFT, "shortname"); - get(pAuthTypeFT, "authtype"); - get(pGrid, "grid"); - get(pScrolledWindow, "scrolledwindow"); - get(pYearFT, "year"); - get(pAuthorFT, "authors"); - get(pTitleFT, "title"); - get(pPublisherFT, "publisher"); - get(pAddressFT, "address"); - get(pISBNFT, "isbn"); - get(pChapterFT, "chapter"); - get(pPagesFT, "pages"); - get(pEditorFT, "editor"); - get(pEditionFT, "edition"); - get(pBooktitleFT, "booktitle"); - get(pVolumeFT, "volume"); - get(pHowpublishedFT, "publicationtype"); - get(pOrganizationsFT, "organization"); - get(pInstitutionFT, "institution"); - get(pSchoolFT, "university"); - get(pReportTypeFT, "reporttype"); - get(pMonthFT, "month"); - get(pJournalFT, "journal"); - get(pNumberFT, "number"); - get(pSeriesFT, "series"); - get(pAnnoteFT, "annotation"); - get(pNoteFT, "note"); - get(pURLFT, "url"); - get(pCustom1FT, "custom1"); - get(pCustom2FT, "custom2"); - get(pCustom3FT, "custom3"); - get(pCustom4FT, "custom4"); - get(pCustom5FT, "custom5"); - - InitFixedTexts(); - - sal_Int16* pMap = nFT2CtrlMap; - for( sal_uInt16 i = 0 ; i < FIELD_COUNT ; ++i, ++pMap ) - { - aControls[ i ] = nullptr; - *pMap = -1; - } + SetStyle(GetStyle() | WB_DIALOGCONTROL); BibConfig* pBibConfig = BibModul::GetConfig(); BibDBDescriptor aDesc; @@ -226,115 +208,140 @@ BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan): aDesc.nCommandType = CommandType::TABLE; const Mapping* pMapping = pBibConfig->GetMapping(aDesc); - xCtrlContnr = VCLUnoHelper::CreateControlContainer(pGrid); - - std::vector<vcl::Window*> aChildren; + xIdentifierED->connect_key_press(LINK(this, BibGeneralPage, FirstElementKeyInputHdl)); - AddControlWithError(lcl_GetColumnName(pMapping, IDENTIFIER_POS), *pIdentifierFT, - sTableErrorString, - HID_BIB_IDENTIFIER_POS, 0, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, IDENTIFIER_POS), + xIdentifierFT->get_label(), *xIdentifierED, + sTableErrorString, HID_BIB_IDENTIFIER_POS); - sTypeColumnName = lcl_GetColumnName(pMapping, AUTHORITYTYPE_POS); + AddControlWithError(lcl_GetColumnName(pMapping, AUTHORITYTYPE_POS), + xAuthTypeFT->get_label(), *xAuthTypeLB, + sTableErrorString, HID_BIB_AUTHORITYTYPE_POS); - AddControlWithError(sTypeColumnName, *pAuthTypeFT, sTableErrorString, - HID_BIB_AUTHORITYTYPE_POS, 1, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, YEAR_POS), + xYearFT->get_label(), *xYearED, + sTableErrorString, HID_BIB_YEAR_POS); - AddControlWithError(lcl_GetColumnName(pMapping, YEAR_POS), *pYearFT, - sTableErrorString, HID_BIB_YEAR_POS, 2, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, AUTHOR_POS), + xAuthorFT->get_label(), *xAuthorED, + sTableErrorString, HID_BIB_AUTHOR_POS); - AddControlWithError(lcl_GetColumnName(pMapping, AUTHOR_POS), *pAuthorFT, - sTableErrorString, HID_BIB_AUTHOR_POS, 3, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, TITLE_POS), + xTitleFT->get_label(), *xTitleED, + sTableErrorString, HID_BIB_TITLE_POS); - AddControlWithError(lcl_GetColumnName(pMapping, TITLE_POS), *pTitleFT, sTableErrorString, - HID_BIB_TITLE_POS, 4, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, PUBLISHER_POS), + xPublisherFT->get_label(), *xPublisherED, + sTableErrorString, HID_BIB_PUBLISHER_POS); - AddControlWithError(lcl_GetColumnName(pMapping, PUBLISHER_POS), *pPublisherFT, - sTableErrorString, HID_BIB_PUBLISHER_POS, 5, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, ADDRESS_POS), + xAddressFT->get_label(), *xAddressED, + sTableErrorString, HID_BIB_ADDRESS_POS); - AddControlWithError(lcl_GetColumnName(pMapping, ADDRESS_POS), *pAddressFT, - sTableErrorString, HID_BIB_ADDRESS_POS, 6, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, ISBN_POS), + xISBNFT->get_label(), *xISBNED, + sTableErrorString, HID_BIB_ISBN_POS); - AddControlWithError(lcl_GetColumnName(pMapping, ISBN_POS), *pISBNFT, - sTableErrorString, HID_BIB_ISBN_POS, 7, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, CHAPTER_POS), + xChapterFT->get_label(), *xChapterED, + sTableErrorString, HID_BIB_CHAPTER_POS); - AddControlWithError(lcl_GetColumnName(pMapping, CHAPTER_POS), *pChapterFT, - sTableErrorString, HID_BIB_CHAPTER_POS, 8, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, PAGES_POS), + xPagesFT->get_label(), *xPagesED, + sTableErrorString, HID_BIB_PAGES_POS); - AddControlWithError(lcl_GetColumnName(pMapping, PAGES_POS), *pPagesFT, - sTableErrorString, HID_BIB_PAGES_POS, 9, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, EDITOR_POS), + xEditorFT->get_label(), *xEditorED, + sTableErrorString, HID_BIB_EDITOR_POS); - AddControlWithError(lcl_GetColumnName(pMapping, EDITOR_POS), *pEditorFT, - sTableErrorString, HID_BIB_EDITOR_POS, 10, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, EDITION_POS), + xEditionFT->get_label(), *xEditionED, + sTableErrorString, HID_BIB_EDITION_POS); - AddControlWithError(lcl_GetColumnName(pMapping, EDITION_POS), *pEditionFT, - sTableErrorString, HID_BIB_EDITION_POS, 11, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, BOOKTITLE_POS), + xBooktitleFT->get_label(), *xBooktitleED, + sTableErrorString, HID_BIB_BOOKTITLE_POS); - AddControlWithError(lcl_GetColumnName(pMapping, BOOKTITLE_POS), *pBooktitleFT, - sTableErrorString, HID_BIB_BOOKTITLE_POS, 12, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, VOLUME_POS), + xVolumeFT->get_label(), *xVolumeED, + sTableErrorString, HID_BIB_VOLUME_POS); - AddControlWithError(lcl_GetColumnName(pMapping, VOLUME_POS), *pVolumeFT, - sTableErrorString, HID_BIB_VOLUME_POS, 13, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, HOWPUBLISHED_POS), + xHowpublishedFT->get_label(), *xHowpublishedED, + sTableErrorString, HID_BIB_HOWPUBLISHED_POS); - AddControlWithError(lcl_GetColumnName(pMapping, HOWPUBLISHED_POS), *pHowpublishedFT, - sTableErrorString, HID_BIB_HOWPUBLISHED_POS, 14, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, ORGANIZATIONS_POS), + xOrganizationsFT->get_label(), *xOrganizationsED, + sTableErrorString, HID_BIB_ORGANIZATIONS_POS); - AddControlWithError(lcl_GetColumnName(pMapping, ORGANIZATIONS_POS), *pOrganizationsFT, - sTableErrorString, HID_BIB_ORGANIZATIONS_POS, 15, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, INSTITUTION_POS), + xInstitutionFT->get_label(), *xInstitutionED, + sTableErrorString, HID_BIB_INSTITUTION_POS); - AddControlWithError(lcl_GetColumnName(pMapping, INSTITUTION_POS), *pInstitutionFT, - sTableErrorString, HID_BIB_INSTITUTION_POS, 16, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, SCHOOL_POS), + xSchoolFT->get_label(), *xSchoolED, + sTableErrorString, HID_BIB_SCHOOL_POS); - AddControlWithError(lcl_GetColumnName(pMapping, SCHOOL_POS), *pSchoolFT, - sTableErrorString, HID_BIB_SCHOOL_POS, 17, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, REPORTTYPE_POS), + xReportTypeFT->get_label(), *xReportTypeED, + sTableErrorString, HID_BIB_REPORTTYPE_POS); - AddControlWithError(lcl_GetColumnName(pMapping, REPORTTYPE_POS), *pReportTypeFT, - sTableErrorString, HID_BIB_REPORTTYPE_POS, 18, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, MONTH_POS), + xMonthFT->get_label(), *xMonthED, + sTableErrorString, HID_BIB_MONTH_POS); - AddControlWithError(lcl_GetColumnName(pMapping, MONTH_POS), *pMonthFT, - sTableErrorString, HID_BIB_MONTH_POS, 19, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, JOURNAL_POS), + xJournalFT->get_label(), *xJournalED, + sTableErrorString, HID_BIB_JOURNAL_POS); - AddControlWithError(lcl_GetColumnName(pMapping, JOURNAL_POS), *pJournalFT, - sTableErrorString, HID_BIB_JOURNAL_POS, 20, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, NUMBER_POS), + xNumberFT->get_label(), *xNumberED, + sTableErrorString, HID_BIB_NUMBER_POS); - AddControlWithError(lcl_GetColumnName(pMapping, NUMBER_POS), *pNumberFT, - sTableErrorString, HID_BIB_NUMBER_POS, 21, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, SERIES_POS), + xSeriesFT->get_label(), *xSeriesED, + sTableErrorString, HID_BIB_SERIES_POS); - AddControlWithError(lcl_GetColumnName(pMapping, SERIES_POS), *pSeriesFT, - sTableErrorString, HID_BIB_SERIES_POS, 22, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, ANNOTE_POS), + xAnnoteFT->get_label(), *xAnnoteED, + sTableErrorString, HID_BIB_ANNOTE_POS); - AddControlWithError(lcl_GetColumnName(pMapping, ANNOTE_POS), *pAnnoteFT, - sTableErrorString, HID_BIB_ANNOTE_POS, 23, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, NOTE_POS), + xNoteFT->get_label(), *xNoteED, + sTableErrorString, HID_BIB_NOTE_POS); - AddControlWithError(lcl_GetColumnName(pMapping, NOTE_POS),*pNoteFT, - sTableErrorString, HID_BIB_NOTE_POS, 24, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, URL_POS), + xURLFT->get_label(), *xURLED, + sTableErrorString, HID_BIB_URL_POS); - AddControlWithError(lcl_GetColumnName(pMapping, URL_POS), *pURLFT, - sTableErrorString, HID_BIB_URL_POS, 25, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM1_POS), + xCustom1FT->get_label(), *xCustom1ED, + sTableErrorString, HID_BIB_CUSTOM1_POS); - AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM1_POS), *pCustom1FT, - sTableErrorString, HID_BIB_CUSTOM1_POS, 26, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM2_POS), + xCustom2FT->get_label(), *xCustom2ED, + sTableErrorString, HID_BIB_CUSTOM2_POS); - AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM2_POS), *pCustom2FT, - sTableErrorString, HID_BIB_CUSTOM2_POS, 27, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM3_POS), + xCustom3FT->get_label(), *xCustom3ED, + sTableErrorString, HID_BIB_CUSTOM3_POS); - AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM3_POS), *pCustom3FT, - sTableErrorString, HID_BIB_CUSTOM3_POS, 28, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM4_POS), + xCustom4FT->get_label(), *xCustom4ED, + sTableErrorString, HID_BIB_CUSTOM4_POS); - AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM4_POS), *pCustom4FT, - sTableErrorString, HID_BIB_CUSTOM4_POS, 29, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM5_POS), + xCustom5FT->get_label(), *xCustom5ED, + sTableErrorString, HID_BIB_CUSTOM5_POS); - AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM5_POS), *pCustom5FT, - sTableErrorString, HID_BIB_CUSTOM5_POS, 30, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, LOCAL_URL_POS), + m_xLocalURLFT->get_label(), *m_xLocalURLED, + sTableErrorString, HID_BIB_LOCAL_URL_POS); - BuilderUtils::reorderWithinParent(aChildren, false); + m_xLocalBrowseButton->connect_clicked(LINK(this, BibGeneralPage, BrowseHdl)); + m_xLocalPageCB->connect_toggled(LINK(this, BibGeneralPage, PageNumHdl)); - xPosListener = new BibPosListener(this); - uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getForm(), UNO_QUERY); - if(xRowSet.is()) - xRowSet->addRowSetListener(xPosListener); - uno::Reference< form::runtime::XFormController > xFormCtrl = pDatMan->GetFormController(); - xFormCtrl->setContainer(xCtrlContnr); - xFormCtrl->activateTabOrder(); + m_xLocalURLED->connect_key_press(LINK(this, BibGeneralPage, LastElementKeyInputHdl)); if(!sTableErrorString.isEmpty()) sTableErrorString = BibResId(ST_ERROR_PREFIX) + sTableErrorString; @@ -345,369 +352,527 @@ BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan): set_height_request(aSize.Height()); } -BibGeneralPage::~BibGeneralPage() +IMPL_LINK_NOARG(BibGeneralPage, BrowseHdl, weld::Button&, void) { - disposeOnce(); + sfx2::FileDialogHelper aFileDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, + FileDialogFlags::NONE, GetFrameWeld()); + OUString aPath = m_xLocalURLED->get_text(); + if (!aPath.isEmpty()) + { + aFileDlg.SetDisplayDirectory(aPath); + } + else + { + OUString aBaseURL; + if (SfxObjectShell* pShell = SfxObjectShell::Current()) + { + aBaseURL = pShell->getDocumentBaseURL(); + } + if (!aBaseURL.isEmpty()) + { + aFileDlg.SetDisplayDirectory(aBaseURL); + } + } + + if (aFileDlg.Execute() != ERRCODE_NONE) + { + return; + } + + weld::Entry& rEntry = *m_xLocalURLED; + rEntry.set_text(aFileDlg.GetPath()); +}; + +IMPL_LINK(BibGeneralPage, PageNumHdl, weld::Toggleable&, rPageCB, void) +{ + weld::SpinButton& rPageSB = *m_xLocalPageSB; + if (rPageCB.get_active()) + { + rPageSB.set_sensitive(true); + rPageSB.set_value(1); + } + else + { + rPageSB.set_sensitive(false); + } } -void BibGeneralPage::dispose() +IMPL_LINK(BibGeneralPage, FirstElementKeyInputHdl, const KeyEvent&, rKeyEvent, bool) { - if (pDatMan && xPosListener.is()) + sal_uInt16 nCode = rKeyEvent.GetKeyCode().GetCode(); + bool bShift = rKeyEvent.GetKeyCode().IsShift(); + bool bCtrl = rKeyEvent.GetKeyCode().IsMod1(); + bool bAlt = rKeyEvent.GetKeyCode().IsMod2(); + if (KEY_TAB == nCode && bShift && !bCtrl && !bAlt) { - uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getForm(), UNO_QUERY); - if(xRowSet.is()) - xRowSet->removeRowSetListener(xPosListener); + SaveChanges(); + uno::Reference<sdbc::XRowSet> xRowSet(pDatMan->getForm(), UNO_QUERY); + if (xRowSet.is() && !xRowSet->isFirst()) + xRowSet->previous(); + m_xLocalURLED->grab_focus(); + m_xLocalURLED->select_region(0, -1); + GainFocusHdl(*m_xLocalURLED); + return true; } - pGrid.clear(); - pScrolledWindow.clear(); - pIdentifierFT.clear(); - pAuthTypeFT.clear(); - pYearFT.clear(); - pAuthorFT.clear(); - pTitleFT.clear(); - pPublisherFT.clear(); - pAddressFT.clear(); - pISBNFT.clear(); - pChapterFT.clear(); - pPagesFT.clear(); - pEditorFT.clear(); - pEditionFT.clear(); - pBooktitleFT.clear(); - pVolumeFT.clear(); - pHowpublishedFT.clear(); - pOrganizationsFT.clear(); - pInstitutionFT.clear(); - pSchoolFT.clear(); - pReportTypeFT.clear(); - pMonthFT.clear(); - pJournalFT.clear(); - pNumberFT.clear(); - pSeriesFT.clear(); - pAnnoteFT.clear(); - pNoteFT.clear(); - pURLFT.clear(); - pCustom1FT.clear(); - pCustom2FT.clear(); - pCustom3FT.clear(); - pCustom4FT.clear(); - pCustom5FT.clear(); - for (auto & a: aFixedTexts) a.clear(); - mxBibGeneralPageFocusListener.clear(); - disposeBuilder(); - TabPage::dispose(); + return false; } -void BibGeneralPage::RemoveListeners() +void BibGeneralPage::SaveChanges() { - for(uno::Reference<awt::XWindow> & aControl : aControls) + Reference< XForm > xForm = pDatMan->getForm(); + Reference< beans::XPropertySet > xProps( xForm, UNO_QUERY ); + Reference< sdbc::XResultSetUpdate > xResUpd( xProps, UNO_QUERY ); + if (!xResUpd.is() ) + return; + + Any aModified = xProps->getPropertyValue( "IsModified" ); + bool bFlag = false; + if ( !( aModified >>= bFlag ) || !bFlag ) + return; + + try { - if(aControl.is()) - { - aControl->removeFocusListener( mxBibGeneralPageFocusListener.get() ); - aControl = nullptr; - } + Any aNew = xProps->getPropertyValue( "IsNew" ); + aNew >>= bFlag; + if ( bFlag ) + xResUpd->insertRow(); + else + xResUpd->updateRow(); } + catch( const uno::Exception&) {} } -void BibGeneralPage::CommitActiveControl() +IMPL_LINK(BibGeneralPage, LastElementKeyInputHdl, const KeyEvent&, rKeyEvent, bool) { - uno::Reference< form::runtime::XFormController > xFormCtrl = pDatMan->GetFormController(); - uno::Reference< awt::XControl > xCurr = xFormCtrl->getCurrentControl(); - if(xCurr.is()) + sal_uInt16 nCode = rKeyEvent.GetKeyCode().GetCode(); + bool bShift = rKeyEvent.GetKeyCode().IsShift(); + bool bCtrl = rKeyEvent.GetKeyCode().IsMod1(); + bool bAlt = rKeyEvent.GetKeyCode().IsMod2(); + if (KEY_TAB != nCode || bShift || bCtrl || bAlt) + return false; + SaveChanges(); + uno::Reference<sdbc::XRowSet> xRowSet(pDatMan->getForm(), UNO_QUERY); + if (xRowSet.is()) { - uno::Reference< awt::XControlModel > xModel = xCurr->getModel(); - uno::Reference< form::XBoundComponent > xBound(xModel, UNO_QUERY); - if(xBound.is()) - xBound->commit(); + if (xRowSet->isLast()) + { + uno::Reference<sdbc::XResultSetUpdate> xUpdateCursor(xRowSet, UNO_QUERY); + if (xUpdateCursor.is()) + xUpdateCursor->moveToInsertRow(); + } + else + (void)xRowSet->next(); } + xIdentifierED->grab_focus(); + xIdentifierED->select_region(0, -1); + GainFocusHdl(*xIdentifierED); + return true; } -void BibGeneralPage::AddControlWithError( const OUString& rColumnName, FixedText &rLabel, - OUString& rErrorString, std::string_view sHelpId, sal_uInt16 nIndexInFTArray, std::vector<vcl::Window*> &rChildren) +BibGeneralPage::~BibGeneralPage() { - const OUString aColumnUIName(rLabel.GetText()); - // adds also the XControl and creates a map entry in nFT2CtrlMap[] for mapping between control and FT + disposeOnce(); +} - sal_Int16 nIndex = -1; - bool bSuccess = AddXControl(rColumnName, rLabel, sHelpId, nIndex, rChildren); - if (bSuccess) +class ChangeListener : public cppu::WeakImplHelper<css::beans::XPropertyChangeListener> +{ +public: + explicit ChangeListener(css::uno::Reference<css::beans::XPropertySet> xPropSet) + : m_xPropSet(std::move(xPropSet)) + , m_bSelfChanging(false) { - DBG_ASSERT( nIndexInFTArray < FIELD_COUNT, "*BibGeneralPage::AddControlWithError(): wrong array index!" ); - DBG_ASSERT( nFT2CtrlMap[ nIndexInFTArray ] < 0, "+BibGeneralPage::AddControlWithError(): index already in use!" ); - - nFT2CtrlMap[ nIndexInFTArray ] = nIndex; } - else + + virtual void SAL_CALL disposing(lang::EventObject const &) override { - if( !rErrorString.isEmpty() ) - rErrorString += "\n"; + } - rErrorString += MnemonicGenerator::EraseAllMnemonicChars( aColumnUIName ); + virtual void start() = 0; + virtual void stop() + { + WriteBack(); } -} -bool BibGeneralPage::AddXControl( - const OUString& rName, - FixedText& rLabel, std::string_view sHelpId, sal_Int16& rIndex, - std::vector<vcl::Window*>& rChildren) + virtual void WriteBack() = 0; + +protected: + css::uno::Reference<css::beans::XPropertySet> m_xPropSet; + bool m_bSelfChanging; +}; + +namespace { - uno::Reference< awt::XControlModel > xCtrModel; - try + class EntryChangeListener : public ChangeListener { - const bool bTypeListBox = sTypeColumnName == rName; - xCtrModel = pDatMan->loadControlModel(rName, bTypeListBox); - if ( xCtrModel.is() ) + public: + explicit EntryChangeListener(weld::Entry& rEntry, const css::uno::Reference<css::beans::XPropertySet>& rPropSet, + BibGeneralPage& rPage) + : ChangeListener(rPropSet) + , m_rEntry(rEntry) + , m_rPage(rPage) { - uno::Reference< beans::XPropertySet > xPropSet( xCtrModel, UNO_QUERY ); + rEntry.connect_focus_out(LINK(this, EntryChangeListener, LoseFocusHdl)); + setValue(rPropSet->getPropertyValue("Text")); + } - if( xPropSet.is()) - { - uno::Reference< beans::XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo(); + virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override + { + if (m_bSelfChanging) + return; + setValue(evt.NewValue); + } + + virtual void start() override + { + m_xPropSet->addPropertyChangeListener("Text", this); + } + + virtual void stop() override + { + m_xPropSet->removePropertyChangeListener("Text", this); + ChangeListener::stop(); + } - OUString aControlName; - if (bTypeListBox) + private: + weld::Entry& m_rEntry; + BibGeneralPage& m_rPage; + + DECL_LINK(LoseFocusHdl, weld::Widget&, void); + + /// Updates the UI widget(s) based on rValue. + void setValue(const css::uno::Any& rValue) + { + OUString sNewName; + rValue >>= sNewName; + if (&m_rEntry == &m_rPage.GetLocalURLED()) + { + OUString aUrl; + int nPageNumber; + if (SplitUrlAndPage(sNewName, aUrl, nPageNumber)) { - aControlName = "com.sun.star.form.control.ListBox"; - xLBModel.set(xCtrModel, UNO_QUERY); + m_rEntry.set_text(aUrl); + m_rPage.GetLocalPageCB().set_active(true); + m_rPage.GetLocalPageSB().set_sensitive(true); + m_rPage.GetLocalPageSB().set_value(nPageNumber); } else { - uno::Any aAny = xPropSet->getPropertyValue( "DefaultControl" ); - aAny >>= aControlName; - } - - OUString uProp("HelpURL"); - if(xPropInfo->hasPropertyByName(uProp)) - { - OUString sId( INET_HID_SCHEME ); - DBG_ASSERT( INetURLObject( OStringToOUString( sHelpId, RTL_TEXTENCODING_UTF8 ) ).GetProtocol() == INetProtocol::NotValid, "Wrong HelpId!" ); - sId += OStringToOUString( sHelpId, RTL_TEXTENCODING_UTF8 ); - xPropSet->setPropertyValue( uProp, makeAny( sId ) ); + m_rEntry.set_text(sNewName); + m_rPage.GetLocalPageCB().set_active(false); + m_rPage.GetLocalPageSB().set_sensitive(false); + m_rPage.GetLocalPageSB().set_value(0); } + } + else + { + m_rEntry.set_text(sNewName); + } - uno::Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); - uno::Reference< awt::XControl > xControl( xContext->getServiceManager()->createInstanceWithContext(aControlName, xContext), UNO_QUERY); - if ( xControl.is() ) - { - xControl->setModel( xCtrModel); - - // Peer as Child to the FrameWindow - xCtrlContnr->addControl(rName, xControl); - uno::Reference< awt::XWindow > xCtrWin(xControl, UNO_QUERY ); - xCtrWin->addFocusListener( mxBibGeneralPageFocusListener.get() ); - rIndex = -1; // -> implies, that not found - for(sal_uInt16 i = 0; i < FIELD_COUNT; i++) - if(!aControls[i].is()) - { - aControls[i] = xCtrWin; - rIndex = sal_Int16( i ); - break; - } - // initially switch on the design mode - switch it off _after_ loading the form - xCtrWin->setVisible( true ); - xControl->setDesignMode( true ); - - VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xControl->getPeer()); - pWindow->set_grid_top_attach(rLabel.get_grid_top_attach()); - pWindow->set_grid_left_attach(rLabel.get_grid_left_attach()+1); - pWindow->set_valign(VclAlign::Center); - rLabel.set_mnemonic_widget(pWindow); - if (&rLabel == pTitleFT) - pWindow->set_grid_width(3); - else - pWindow->set_hexpand(true); - rChildren.push_back(&rLabel); - rChildren.push_back(pWindow); - } + m_rEntry.save_value(); + if (&m_rEntry == &m_rPage.GetLocalURLED()) + { + m_rPage.GetLocalPageSB().save_value(); } } - } - catch(const Exception&) - { - OSL_FAIL("BibGeneralPage::AddXControl: something went wrong!"); - } - return xCtrModel.is(); -} -void BibGeneralPage::InitFixedTexts() -{ - aFixedTexts[0] = pIdentifierFT; - aFixedTexts[1] = pAuthTypeFT; - aFixedTexts[2] = pYearFT; - aFixedTexts[3] = pAuthorFT; - aFixedTexts[4] = pTitleFT; - aFixedTexts[5] = pPublisherFT; - aFixedTexts[6] = pAddressFT; - aFixedTexts[7] = pISBNFT; - aFixedTexts[8] = pChapterFT; - aFixedTexts[9] = pPagesFT; - - aFixedTexts[10] = pEditorFT; - aFixedTexts[11] = pEditionFT; - aFixedTexts[12] = pBooktitleFT; - aFixedTexts[13] = pVolumeFT; - aFixedTexts[14] = pHowpublishedFT; - aFixedTexts[15] = pOrganizationsFT; - aFixedTexts[16] = pInstitutionFT; - aFixedTexts[17] = pSchoolFT; - aFixedTexts[18] = pReportTypeFT; - aFixedTexts[19] = pMonthFT; - - aFixedTexts[20] = pJournalFT; - aFixedTexts[21] = pNumberFT; - aFixedTexts[22] = pSeriesFT; - aFixedTexts[23] = pAnnoteFT; - aFixedTexts[24] = pNoteFT; - aFixedTexts[25] = pURLFT; - - aFixedTexts[26] = pCustom1FT; - aFixedTexts[27] = pCustom2FT; - aFixedTexts[28] = pCustom3FT; - aFixedTexts[29] = pCustom4FT; - aFixedTexts[30] = pCustom5FT; - - int i; - - MnemonicGenerator aMnemonicGenerator; - - OUString aFixedStrings[ FIELD_COUNT ]; - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aFixedStrings[i] = aFixedTexts[i]->GetText(); - - // init mnemonics, first register all strings - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aMnemonicGenerator.RegisterMnemonic( aFixedStrings[ i ] ); - - // ... then get all strings - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aFixedStrings[i] = aMnemonicGenerator.CreateMnemonic(aFixedStrings[i]); - - // set texts - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aFixedTexts[ i ]->SetText( aFixedStrings[ i ] ); -} + /// Updates m_xPropSet based on the UI widget(s). + virtual void WriteBack() override + { + bool bLocalURL = &m_rEntry == &m_rPage.GetLocalURLED() + && m_rPage.GetLocalPageSB().get_value_changed_from_saved(); + if (!m_rEntry.get_value_changed_from_saved() && !bLocalURL) + return; -void BibGeneralPage::focusGained(const awt::FocusEvent& rEvent) -{ - Reference<awt::XWindow> xCtrWin(rEvent.Source, UNO_QUERY ); - if(!xCtrWin.is()) - return; + m_bSelfChanging = true; + + OUString aText; + if (&m_rEntry == &m_rPage.GetLocalURLED()) + { + aText = MergeUrlAndPage(m_rEntry.get_text(), m_rPage.GetLocalPageSB()); + } + else + { + aText = m_rEntry.get_text(); + } + m_xPropSet->setPropertyValue("Text", Any(aText)); + + css::uno::Reference<css::form::XBoundComponent> xBound(m_xPropSet, css::uno::UNO_QUERY); + if (xBound.is()) + xBound->commit(); + + m_bSelfChanging = false; + m_rEntry.save_value(); + if (&m_rEntry == &m_rPage.GetLocalURLED()) + { + m_rPage.GetLocalPageSB().save_value(); + } + } + + }; - ::Size aOutSize = pScrolledWindow->getVisibleChildSize(); - awt::Rectangle aRect = xCtrWin->getPosSize(); - Point aOffset(pGrid->GetPosPixel()); - tools::Long nX = aRect.X + aOffset.X(); - if (nX < 0 || nX > aOutSize.Width()) + IMPL_LINK_NOARG(EntryChangeListener, LoseFocusHdl, weld::Widget&, void) { - pScrolledWindow->getHorzScrollBar().DoScroll(aRect.X); + WriteBack(); } - tools::Long nY = aRect.Y + aOffset.Y(); - if (nY < 0 || nY > aOutSize.Height()) + class ComboBoxChangeListener : public ChangeListener { - pScrolledWindow->getVertScrollBar().DoScroll(aRect.Y); - } -} + public: + explicit ComboBoxChangeListener(weld::ComboBox& rComboBox, const css::uno::Reference<css::beans::XPropertySet>& rPropSet) + : ChangeListener(rPropSet) + , m_rComboBox(rComboBox) + { + rComboBox.connect_changed(LINK(this, ComboBoxChangeListener, ChangeHdl)); + setValue(rPropSet->getPropertyValue("SelectedItems")); + } -void BibGeneralPage::focusLost() -{ - CommitActiveControl(); -} + virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override + { + if (m_bSelfChanging) + return; + setValue(evt.NewValue); + } -void BibGeneralPage::GetFocus() -{ - Reference< awt::XWindow >* pxControl = aControls; + virtual void start() override + { + m_xPropSet->addPropertyChangeListener("SelectedItems", this); + } - for( int i = FIELD_COUNT ; i ; --i, ++pxControl ) - { - if( pxControl->is() ) + virtual void stop() override { - ( *pxControl )->setFocus(); - return; + m_xPropSet->removePropertyChangeListener("SelectedItems", this); + ChangeListener::stop(); } - } - // fallback - GrabFocus(); -} + private: + weld::ComboBox& m_rComboBox; -bool BibGeneralPage::HandleShortCutKey( const KeyEvent& rKeyEvent ) -{ - DBG_ASSERT( KEY_MOD2 == rKeyEvent.GetKeyCode().GetModifier(), "+BibGeneralPage::HandleShortCutKey(): this is not for me!" ); + DECL_LINK(ChangeHdl, weld::ComboBox&, void); + + void setValue(const css::uno::Any& rValue) + { + sal_Int16 nSelection = -1; + Sequence<sal_Int16> aSelection; + rValue >>= aSelection; + if (aSelection.hasElements()) + nSelection = aSelection[0]; + + m_rComboBox.set_active(nSelection); + m_rComboBox.save_value(); + } - const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); - const sal_Unicode c = rKeyEvent.GetCharCode(); - bool bHandled = false; + virtual void WriteBack() override + { + if (!m_rComboBox.get_value_changed_from_saved()) + return; + m_bSelfChanging = true; - sal_Int16 i; + Sequence<sal_Int16> aSelection{ o3tl::narrowing<sal_Int16>(m_rComboBox.get_active()) }; + m_xPropSet->setPropertyValue("SelectedItems", Any(aSelection)); - std::vector<sal_Int16>::size_type nFocused = 0xFFFF; // index of focused in vector, no one focused initial - DBG_ASSERT( nFocused > 0, "*BibGeneralPage::HandleShortCutKey(): size_type works not as expected!" ); + css::uno::Reference<css::form::XBoundComponent> xBound(m_xPropSet, css::uno::UNO_QUERY); + if (xBound.is()) + xBound->commit(); - std::vector<sal_Int16> aMatchList; + m_bSelfChanging = false; + m_rComboBox.save_value(); + } + }; - for( i = 0 ; i < FIELD_COUNT ; ++i ) + IMPL_LINK_NOARG(ComboBoxChangeListener, ChangeHdl, weld::ComboBox&, void) { - if( rI18nHelper.MatchMnemonic( aFixedTexts[ i ]->GetText(), c ) ) - { - bHandled = true; - sal_Int16 nCtrlIndex = nFT2CtrlMap[ i ]; + WriteBack(); + } +} + +void BibGeneralPage::dispose() +{ + for (auto& listener : maChangeListeners) + listener->stop(); + maChangeListeners.clear(); + + SaveChanges(); + + xScrolledWindow.reset(); + xGrid.reset(); + xIdentifierFT.reset(); + xIdentifierED.reset(); + xAuthTypeFT.reset(); + xAuthTypeLB.reset(); + xYearFT.reset(); + xYearED.reset(); + xAuthorFT.reset(); + xAuthorED.reset(); + xTitleFT.reset(); + xTitleED.reset(); + xPublisherFT.reset(); + xPublisherED.reset(); + xAddressFT.reset(); + xAddressED.reset(); + xISBNFT.reset(); + xISBNED.reset(); + xChapterFT.reset(); + xChapterED.reset(); + xPagesFT.reset(); + xPagesED.reset(); + xEditorFT.reset(); + xEditorED.reset(); + xEditionFT.reset(); + xEditionED.reset(); + xBooktitleFT.reset(); + xBooktitleED.reset(); + xVolumeFT.reset(); + xVolumeED.reset(); + xHowpublishedFT.reset(); + xHowpublishedED.reset(); + xOrganizationsFT.reset(); + xOrganizationsED.reset(); + xInstitutionFT.reset(); + xInstitutionED.reset(); + xSchoolFT.reset(); + xSchoolED.reset(); + xReportTypeFT.reset(); + xReportTypeED.reset(); + xMonthFT.reset(); + xMonthED.reset(); + xJournalFT.reset(); + xJournalED.reset(); + xNumberFT.reset(); + xNumberED.reset(); + xSeriesFT.reset(); + xSeriesED.reset(); + xAnnoteFT.reset(); + xAnnoteED.reset(); + xNoteFT.reset(); + xNoteED.reset(); + xURLFT.reset(); + xURLED.reset(); + xCustom1FT.reset(); + xCustom1ED.reset(); + xCustom2FT.reset(); + xCustom2ED.reset(); + xCustom3FT.reset(); + xCustom3ED.reset(); + xCustom4FT.reset(); + xCustom4ED.reset(); + xCustom5FT.reset(); + xCustom5ED.reset(); + m_xLocalURLFT.reset(); + m_xLocalURLED.reset(); + m_xLocalBrowseButton.reset(); + m_xLocalPageCB.reset(); + m_xLocalPageSB.reset(); + InterimItemWindow::dispose(); +} - if( nCtrlIndex >= 0 ) - { // store index of control - DBG_ASSERT( aControls[ nCtrlIndex ].is(), "-BibGeneralPage::HandleShortCutKey(): valid index and no control?" ); +weld::Entry& BibGeneralPage::GetLocalURLED() { return *m_xLocalURLED; } - uno::Reference< awt::XControl > xControl( aControls[ nCtrlIndex ], UNO_QUERY ); - DBG_ASSERT( xControl.is(), "-BibGeneralPage::HandleShortCutKey(): a control which is not a control!" ); +weld::CheckButton& BibGeneralPage::GetLocalPageCB() { return *m_xLocalPageCB; } - VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() ); +weld::SpinButton& BibGeneralPage::GetLocalPageSB() { return *m_xLocalPageSB; } - if( pWindow ) +bool BibGeneralPage::AddXControl(const OUString& rName, weld::Entry& rEntry) +{ + uno::Reference< awt::XControlModel > xCtrModel; + try + { + xCtrModel = pDatMan->loadControlModel(rName, false); + if ( xCtrModel.is() ) + { + uno::Reference< beans::XPropertySet > xPropSet( xCtrModel, UNO_QUERY ); + + if( xPropSet.is()) + { + maChangeListeners.emplace_back(new EntryChangeListener(rEntry, xPropSet, *this)); + maChangeListeners.back()->start(); + if (&rEntry == m_xLocalURLED.get()) { - aMatchList.push_back( nCtrlIndex ); - if( pWindow->HasChildPathFocus() ) - { // save focused control - DBG_ASSERT( nFocused == 0xFFFF, "+BibGeneralPage::HandleShortCutKey(): more than one with focus?!" ); - DBG_ASSERT( !aMatchList.empty(), "+BibGeneralPage::HandleShortCutKey(): push_back and no content?!" ); - nFocused = aMatchList.size() - 1; - } + m_aURLListener = maChangeListeners.back(); + m_xLocalPageSB->connect_focus_out(LINK(this, BibGeneralPage, LosePageFocusHdl)); } } } } - - if( bHandled ) + catch(const Exception&) { - DBG_ASSERT( !aMatchList.empty(), "*BibGeneralPage::HandleShortCutKey(): be prepared to crash..." ); - - if( nFocused >= ( aMatchList.size() - 1 ) ) - // >=... includes 0xFFFF - // no one or last focused, take first - nFocused = 0; - else - // take next one - nFocused++; - - aControls[ aMatchList[ nFocused ] ]->setFocus(); + OSL_FAIL("BibGeneralPage::AddXControl: something went wrong!"); } - - return bHandled; + return xCtrModel.is(); } -BibGeneralPageFocusListener::BibGeneralPageFocusListener(BibGeneralPage *pBibGeneralPage): mpBibGeneralPage(pBibGeneralPage) -{} +IMPL_LINK_NOARG(BibGeneralPage, LosePageFocusHdl, weld::Widget&, void) +{ + m_aURLListener->WriteBack(); +} -void BibGeneralPageFocusListener::focusGained( const css::awt::FocusEvent& e ) +IMPL_LINK(BibGeneralPage, GainFocusHdl, weld::Widget&, rWidget, void) { - mpBibGeneralPage->focusGained(e); + int x, y, width, height; + if (!rWidget.get_extents_relative_to(*xGrid, x, y, width, height)) + return; + + int bottom = y + height; + int nVScrollPos = xScrolledWindow->vadjustment_get_value(); + if (y < nVScrollPos || bottom > nVScrollPos + xScrolledWindow->vadjustment_get_page_size()) + xScrolledWindow->vadjustment_set_value(y); + + int right = x + width; + int nHScrollPos = xScrolledWindow->hadjustment_get_value(); + if (x < nHScrollPos || right > nHScrollPos + xScrolledWindow->hadjustment_get_page_size()) + xScrolledWindow->hadjustment_set_value(x); } -void BibGeneralPageFocusListener::focusLost( const css::awt::FocusEvent& ) +template<class Target> void BibGeneralPage::AddControlWithError(const OUString& rColumnName, const OUString& rColumnUIName, + Target& rWidget, OUString& rErrorString, const OUString& rHelpId) { - mpBibGeneralPage->focusLost(); + rWidget.set_help_id(rHelpId); + rWidget.connect_focus_in(LINK(this, BibGeneralPage, GainFocusHdl)); + bool bSuccess = AddXControl(rColumnName, rWidget); + if (!bSuccess) + { + if( !rErrorString.isEmpty() ) + rErrorString += "\n"; + + rErrorString += MnemonicGenerator::EraseAllMnemonicChars(rColumnUIName); + } } -void BibGeneralPageFocusListener::disposing( const css::lang::EventObject& ) -{} +bool BibGeneralPage::AddXControl(const OUString& rName, weld::ComboBox& rList) +{ + uno::Reference< awt::XControlModel > xCtrModel; + try + { + xCtrModel = pDatMan->loadControlModel(rName, true); + if ( xCtrModel.is() ) + { + uno::Reference< beans::XPropertySet > xPropSet( xCtrModel, UNO_QUERY ); + + if( xPropSet.is()) + { + css::uno::Sequence<OUString> aEntries; + xPropSet->getPropertyValue("StringItemList") >>= aEntries; + for (const OUString& rString : aEntries) + rList.append_text(rString); + + sal_Int16 nSelection = -1; + Sequence<sal_Int16> aSelection; + xPropSet->getPropertyValue("SelectedItems") >>= aSelection; + if (aSelection.hasElements()) + nSelection = aSelection[0]; + + rList.set_active(nSelection); + rList.save_value(); + + maChangeListeners.emplace_back(new ComboBoxChangeListener(rList, xPropSet)); + maChangeListeners.back()->start(); + } + } + } + catch(const Exception&) + { + OSL_FAIL("BibGeneralPage::AddXControl: something went wrong!"); + } + return xCtrModel.is(); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/general.hxx b/extensions/source/bibliography/general.hxx index 107f40fe2bc6..9708174ffa1f 100644 --- a/extensions/source/bibliography/general.hxx +++ b/extensions/source/bibliography/general.hxx @@ -17,21 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_GENERAL_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_GENERAL_HXX +#pragma once #include <sal/config.h> -#include <string_view> - -#include <com/sun/star/awt/XFocusListener.hpp> -#include <com/sun/star/awt/XControlContainer.hpp> -#include <com/sun/star/form/XBoundComponent.hpp> -#include <com/sun/star/sdbc/XRowSetListener.hpp> - -#include <vcl/layout.hxx> -#include <vcl/tabpage.hxx> -#include <cppuhelper/implbase1.hxx> +#include <vcl/InterimItemWindow.hxx> #include "bibshortcuthandler.hxx" @@ -39,158 +29,130 @@ class BibDataManager; #define TYPE_COUNT 22 #define FIELD_COUNT 31 -/** - * We need to split off the listener because both it and the vcl::Window baseclass are ref-counted - */ -class BibGeneralPage; -class BibGeneralPageFocusListener : public cppu::WeakAggImplHelper1 < css::awt::XFocusListener > -{ -private: - VclPtr<BibGeneralPage> mpBibGeneralPage; -public: - explicit BibGeneralPageFocusListener(BibGeneralPage *pBibGeneralPage); - virtual void SAL_CALL focusGained( const css::awt::FocusEvent& e ) override; - virtual void SAL_CALL focusLost( const css::awt::FocusEvent& e ) override; - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - -}; +class ChangeListener; -class BibGeneralPage : public TabPage - , public VclBuilderContainer +class BibGeneralPage : public InterimItemWindow , public BibShortCutHandler { - VclPtr<VclGrid> pGrid; - VclPtr<VclScrolledWindow> pScrolledWindow; - - VclPtr<FixedText> pIdentifierFT; - VclPtr<FixedText> pAuthTypeFT; - VclPtr<FixedText> pYearFT; - - VclPtr<FixedText> pAuthorFT; - VclPtr<FixedText> pTitleFT; - - VclPtr<FixedText> pPublisherFT; - VclPtr<FixedText> pAddressFT; - VclPtr<FixedText> pISBNFT; - - VclPtr<FixedText> pChapterFT; - VclPtr<FixedText> pPagesFT; - - VclPtr<FixedText> pEditorFT; - VclPtr<FixedText> pEditionFT; - - VclPtr<FixedText> pBooktitleFT; - VclPtr<FixedText> pVolumeFT; - VclPtr<FixedText> pHowpublishedFT; - - VclPtr<FixedText> pOrganizationsFT; - VclPtr<FixedText> pInstitutionFT; - VclPtr<FixedText> pSchoolFT; - - VclPtr<FixedText> pReportTypeFT; - VclPtr<FixedText> pMonthFT; - - VclPtr<FixedText> pJournalFT; - VclPtr<FixedText> pNumberFT; - VclPtr<FixedText> pSeriesFT; - - VclPtr<FixedText> pAnnoteFT; - VclPtr<FixedText> pNoteFT; - VclPtr<FixedText> pURLFT; - - VclPtr<FixedText> pCustom1FT; - VclPtr<FixedText> pCustom2FT; - VclPtr<FixedText> pCustom3FT; - VclPtr<FixedText> pCustom4FT; - VclPtr<FixedText> pCustom5FT; - - VclPtr<FixedText> aFixedTexts[ FIELD_COUNT ]; - sal_Int16 nFT2CtrlMap[ FIELD_COUNT ]; - - css::uno::Reference< css::awt::XWindow > - aControls[ FIELD_COUNT ]; + std::unique_ptr<weld::ScrolledWindow> xScrolledWindow; + std::unique_ptr<weld::Widget> xGrid; + + std::unique_ptr<weld::Label> xIdentifierFT; + std::unique_ptr<weld::Entry> xIdentifierED; + + std::unique_ptr<weld::Label> xAuthTypeFT; + std::unique_ptr<weld::ComboBox> xAuthTypeLB; + std::unique_ptr<weld::Label> xYearFT; + std::unique_ptr<weld::Entry> xYearED; + + std::unique_ptr<weld::Label> xAuthorFT; + std::unique_ptr<weld::Entry> xAuthorED; + std::unique_ptr<weld::Label> xTitleFT; + std::unique_ptr<weld::Entry> xTitleED; + + std::unique_ptr<weld::Label> xPublisherFT; + std::unique_ptr<weld::Entry> xPublisherED; + std::unique_ptr<weld::Label> xAddressFT; + std::unique_ptr<weld::Entry> xAddressED; + std::unique_ptr<weld::Label> xISBNFT; + std::unique_ptr<weld::Entry> xISBNED; + + std::unique_ptr<weld::Label> xChapterFT; + std::unique_ptr<weld::Entry> xChapterED; + std::unique_ptr<weld::Label> xPagesFT; + std::unique_ptr<weld::Entry> xPagesED; + + std::unique_ptr<weld::Label> xEditorFT; + std::unique_ptr<weld::Entry> xEditorED; + std::unique_ptr<weld::Label> xEditionFT; + std::unique_ptr<weld::Entry> xEditionED; + + std::unique_ptr<weld::Label> xBooktitleFT; + std::unique_ptr<weld::Entry> xBooktitleED; + std::unique_ptr<weld::Label> xVolumeFT; + std::unique_ptr<weld::Entry> xVolumeED; + std::unique_ptr<weld::Label> xHowpublishedFT; + std::unique_ptr<weld::Entry> xHowpublishedED; + + std::unique_ptr<weld::Label> xOrganizationsFT; + std::unique_ptr<weld::Entry> xOrganizationsED; + std::unique_ptr<weld::Label> xInstitutionFT; + std::unique_ptr<weld::Entry> xInstitutionED; + std::unique_ptr<weld::Label> xSchoolFT; + std::unique_ptr<weld::Entry> xSchoolED; + + std::unique_ptr<weld::Label> xReportTypeFT; + std::unique_ptr<weld::Entry> xReportTypeED; + std::unique_ptr<weld::Label> xMonthFT; + std::unique_ptr<weld::Entry> xMonthED; + + std::unique_ptr<weld::Label> xJournalFT; + std::unique_ptr<weld::Entry> xJournalED; + std::unique_ptr<weld::Label> xNumberFT; + std::unique_ptr<weld::Entry> xNumberED; + std::unique_ptr<weld::Label> xSeriesFT; + std::unique_ptr<weld::Entry> xSeriesED; + + std::unique_ptr<weld::Label> xAnnoteFT; + std::unique_ptr<weld::Entry> xAnnoteED; + std::unique_ptr<weld::Label> xNoteFT; + std::unique_ptr<weld::Entry> xNoteED; + std::unique_ptr<weld::Label> xURLFT; + std::unique_ptr<weld::Entry> xURLED; + + std::unique_ptr<weld::Label> xCustom1FT; + std::unique_ptr<weld::Entry> xCustom1ED; + std::unique_ptr<weld::Label> xCustom2FT; + std::unique_ptr<weld::Entry> xCustom2ED; + std::unique_ptr<weld::Label> xCustom3FT; + std::unique_ptr<weld::Entry> xCustom3ED; + std::unique_ptr<weld::Label> xCustom4FT; + std::unique_ptr<weld::Entry> xCustom4ED; + std::unique_ptr<weld::Label> xCustom5FT; + std::unique_ptr<weld::Entry> xCustom5ED; + std::unique_ptr<weld::Label> m_xLocalURLFT; + std::unique_ptr<weld::Entry> m_xLocalURLED; + std::unique_ptr<weld::Button> m_xLocalBrowseButton; + std::unique_ptr<weld::CheckButton> m_xLocalPageCB; + std::unique_ptr<weld::SpinButton> m_xLocalPageSB; OUString sTableErrorString; - OUString sTypeColumnName; - - css::uno::Reference< css::awt::XControlContainer > - xCtrlContnr; + std::vector<rtl::Reference<ChangeListener>> maChangeListeners; + rtl::Reference<ChangeListener> m_aURLListener; - css::uno::Reference< css::form::XBoundComponent > - xLBModel; - - css::uno::Reference< css::sdbc::XRowSetListener > - xPosListener; + BibDataManager* pDatMan; - rtl::Reference<BibGeneralPageFocusListener> mxBibGeneralPageFocusListener; + bool AddXControl(const OUString& rName, weld::Entry& rEntry); + bool AddXControl(const OUString& rName, weld::ComboBox& rList); - BibDataManager* pDatMan; + template<class Target> void AddControlWithError(const OUString& rColumnName, const OUString& rColumnUIName, + Target& rWidget, OUString& rErrorString, const OUString& rHelpId); - bool - AddXControl( const OUString& rName, FixedText& rLabel, std::string_view sHelpId, - sal_Int16& rIndex, std::vector<vcl::Window*>& rChildren ); + void SaveChanges(); - void AddControlWithError( const OUString& rColumnName, FixedText& rLabel, - OUString& rErrorString, - std::string_view sHelpId, sal_uInt16 nIndexInFTArray, std::vector<vcl::Window*>& rChildren ); + DECL_LINK(GainFocusHdl, weld::Widget&, void); -protected: - void InitFixedTexts(); // create mnemonics and set text an all fixed texts + DECL_LINK(FirstElementKeyInputHdl, const KeyEvent&, bool); + DECL_LINK(LastElementKeyInputHdl, const KeyEvent&, bool); + DECL_LINK(BrowseHdl, weld::Button&, void); + DECL_LINK(PageNumHdl, weld::Toggleable&, void); + DECL_LINK(LosePageFocusHdl, weld::Widget&, void); public: BibGeneralPage(vcl::Window* pParent, BibDataManager* pDatMan); virtual ~BibGeneralPage() override; virtual void dispose() override; - inline const OUString& GetErrorString() const; - - inline const css::uno::Reference< css::form::XBoundComponent >& - GetTypeListBoxModel() const; - inline const css::uno::Reference< css::awt::XControlContainer >& - GetControlContainer() const; - - inline BibDataManager* GetDataManager(); - - void CommitActiveControl(); - - void RemoveListeners(); - - virtual void GetFocus() override; - - virtual bool HandleShortCutKey( const KeyEvent& rKeyEvent ) override; // returns true, if key was handled - - /// @throws css::uno::RuntimeException - void focusGained(const css::awt::FocusEvent& rEvent); - /// @throws css::uno::RuntimeException - void focusLost(); + const OUString& GetErrorString() const + { + return sTableErrorString; + } + weld::Entry& GetLocalURLED(); + weld::CheckButton& GetLocalPageCB(); + weld::SpinButton& GetLocalPageSB(); }; -inline const OUString& BibGeneralPage::GetErrorString() const -{ - return sTableErrorString; -} - -inline const css::uno::Reference< css::form::XBoundComponent >& - BibGeneralPage::GetTypeListBoxModel() const -{ - return xLBModel; -} - -inline const css::uno::Reference< css::awt::XControlContainer >& - BibGeneralPage::GetControlContainer() const -{ - return xCtrlContnr; -} - -inline BibDataManager* BibGeneralPage::GetDataManager() -{ - return pDatMan; -} - -#endif - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/loadlisteneradapter.cxx b/extensions/source/bibliography/loadlisteneradapter.cxx index fecce24ae7b7..27f4ea2e5099 100644 --- a/extensions/source/bibliography/loadlisteneradapter.cxx +++ b/extensions/source/bibliography/loadlisteneradapter.cxx @@ -120,13 +120,13 @@ namespace bib } - void SAL_CALL OLoadListenerAdapter::acquire( ) throw () + void SAL_CALL OLoadListenerAdapter::acquire( ) noexcept { OLoadListenerAdapter_Base::acquire(); } - void SAL_CALL OLoadListenerAdapter::release( ) throw () + void SAL_CALL OLoadListenerAdapter::release( ) noexcept { OLoadListenerAdapter_Base::release(); } diff --git a/extensions/source/bibliography/loadlisteneradapter.hxx b/extensions/source/bibliography/loadlisteneradapter.hxx index 6cb578063bd3..1031dedca35a 100644 --- a/extensions/source/bibliography/loadlisteneradapter.hxx +++ b/extensions/source/bibliography/loadlisteneradapter.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_LOADLISTENERADAPTER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_LOADLISTENERADAPTER_HXX +#pragma once #include <osl/mutex.hxx> #include <com/sun/star/lang/XComponent.hpp> @@ -86,8 +85,8 @@ namespace bib void Init( OComponentListener* _pListener ); // base for ref-counting, implemented by OComponentAdapter - virtual void SAL_CALL acquire( ) throw () = 0; - virtual void SAL_CALL release( ) throw () = 0; + virtual void SAL_CALL acquire( ) noexcept = 0; + virtual void SAL_CALL release( ) noexcept = 0; /// dispose the object - stop listening and such void dispose(); @@ -130,8 +129,8 @@ namespace bib ); - virtual void SAL_CALL acquire( ) throw () override; - virtual void SAL_CALL release( ) throw () override; + virtual void SAL_CALL acquire( ) noexcept override; + virtual void SAL_CALL release( ) noexcept override; protected: // XEventListener @@ -149,6 +148,4 @@ namespace bib } // namespace bib -#endif // INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_LOADLISTENERADAPTER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index ae054801d8db..e4041c5a80f1 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -19,8 +19,7 @@ #include <sal/config.h> -#include <string_view> - +#include <comphelper/propertyvalue.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -32,11 +31,12 @@ #include <o3tl/any.hxx> #include <svtools/miscopt.hxx> #include <svtools/imgdef.hxx> +#include <utility> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> -#include <vcl/menu.hxx> #include <vcl/mnemonic.hxx> #include <vcl/event.hxx> +#include <vcl/weldutils.hxx> #include <bitmaps.hlst> #include "bibtools.hxx" @@ -49,9 +49,9 @@ using namespace ::com::sun::star::beans; // Constants -------------------------------------------------------------- -BibToolBarListener::BibToolBarListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId): +BibToolBarListener::BibToolBarListener(BibToolBar *pTB, OUString aStr, ToolBoxItemId nId): nIndex(nId), - aCommand(aStr), + aCommand(std::move(aStr)), pToolBar(pTB) { } @@ -77,7 +77,7 @@ void BibToolBarListener::statusChanged(const css::frame::FeatureStateEvent& rEvt }; -BibTBListBoxListener::BibTBListBoxListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId): +BibTBListBoxListener::BibTBListBoxListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId): BibToolBarListener(pTB,aStr,nId) { } @@ -115,7 +115,7 @@ void BibTBListBoxListener::statusChanged(const css::frame::FeatureStateEvent& rE pToolBar->SelectSourceEntry(rEvt.FeatureDescriptor); }; -BibTBQueryMenuListener::BibTBQueryMenuListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId): +BibTBQueryMenuListener::BibTBQueryMenuListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId): BibToolBarListener(pTB,aStr,nId) { } @@ -152,7 +152,7 @@ void BibTBQueryMenuListener::statusChanged(const frame::FeatureStateEvent& rEvt) } }; -BibTBEditListener::BibTBEditListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId): +BibTBEditListener::BibTBEditListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId): BibToolBarListener(pTB,aStr,nId) { } @@ -224,18 +224,18 @@ EditControl::~EditControl() BibToolBar::BibToolBar(vcl::Window* pParent, Link<void*,void> aLink) : ToolBox(pParent, "toolbar", "modules/sbibliography/ui/toolbar.ui") + , aIdle("BibToolBar") , xSource(VclPtr<ComboBoxControl>::Create(this)) , pLbSource(xSource->get_widget()) , xQuery(VclPtr<EditControl>::Create(this)) , pEdQuery(xQuery->get_widget()) - , pPopupMenu(VclPtr<PopupMenu>::Create()) + , xBuilder(Application::CreateBuilder(nullptr, "modules/sbibliography/ui/autofiltermenu.ui")) + , xPopupMenu(xBuilder->weld_menu("menu")) , nMenuId(0) - , nSelMenuItem(0) , aLayoutManager(aLink) , nSymbolsSize(SFX_SYMBOLS_SIZE_SMALL) { - SvtMiscOptions aSvtMiscOptions; - nSymbolsSize = aSvtMiscOptions.GetCurrentSymbolsSize(); + nSymbolsSize = SvtMiscOptions::GetCurrentSymbolsSize(); xSource->Show(); pLbSource->connect_changed(LINK( this, BibToolBar, SelHdl)); @@ -280,6 +280,8 @@ void BibToolBar::dispose() xQuery.disposeAndClear(); pLbSource = nullptr; xSource.disposeAndClear(); + xPopupMenu.reset(); + xBuilder.reset(); ToolBox::dispose(); } @@ -295,12 +297,12 @@ void BibToolBar::InitListener() util::URL aQueryURL; aQueryURL.Complete = ".uno:Bib/MenuFilter"; xTrans->parseStrict( aQueryURL); - BibToolBarListener* pQuery=new BibTBQueryMenuListener(this, aQueryURL.Complete, nTBC_BT_AUTOFILTER); - xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pQuery),aQueryURL); + rtl::Reference<BibToolBarListener> pQuery=new BibTBQueryMenuListener(this, aQueryURL.Complete, nTBC_BT_AUTOFILTER); + xDisp->addStatusListener(pQuery, aQueryURL); for(ToolBox::ImplToolItems::size_type nPos=0;nPos<nCount;nPos++) { - sal_uInt16 nId=GetItemId(nPos); + ToolBoxItemId nId=GetItemId(nPos); if (!nId) continue; @@ -339,7 +341,7 @@ void BibToolBar::SetXController(const uno::Reference< frame::XController > & xCt void BibToolBar::Select() { - sal_uInt16 nId=GetCurItemId(); + ToolBoxItemId nId=GetCurItemId(); if (nId != nTBC_BT_AUTOFILTER) { @@ -347,19 +349,16 @@ void BibToolBar::Select() } else { - Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); - pPropertyVal[0].Name="QueryText"; - OUString aSelection = pEdQuery->get_text(); - pPropertyVal[0].Value <<= aSelection; - - pPropertyVal[1].Name="QueryField"; - pPropertyVal[1].Value <<= aQueryField; + Sequence<PropertyValue> aPropVal + { + comphelper::makePropertyValue("QueryText", pEdQuery->get_text()), + comphelper::makePropertyValue("QueryField", aQueryField) + }; SendDispatch(nId,aPropVal); } } -void BibToolBar::SendDispatch(sal_uInt16 nId, const Sequence< PropertyValue >& rArgs) +void BibToolBar::SendDispatch(ToolBoxItemId nId, const Sequence< PropertyValue >& rArgs) { OUString aCommand = GetItemCommand(nId); @@ -387,7 +386,7 @@ void BibToolBar::SendDispatch(sal_uInt16 nId, const Sequence< PropertyValue >& r void BibToolBar::Click() { - sal_uInt16 nId = GetCurItemId(); + ToolBoxItemId nId = GetCurItemId(); vcl::Window* pWin = GetParent(); @@ -411,21 +410,23 @@ void BibToolBar::Click() void BibToolBar::ClearFilterMenu() { - pPopupMenu->Clear(); + xPopupMenu->clear(); nMenuId=0; } -sal_uInt16 BibToolBar::InsertFilterItem(const OUString& aMenuEntry) + +sal_uInt16 BibToolBar::InsertFilterItem(const OUString& rMenuEntry) { nMenuId++; - pPopupMenu->InsertItem(nMenuId,aMenuEntry); - + xPopupMenu->append_check(OUString::number(nMenuId), rMenuEntry); return nMenuId; } -void BibToolBar::SelectFilterItem(sal_uInt16 nId) + +void BibToolBar::SelectFilterItem(sal_uInt16 nId) { - pPopupMenu->CheckItem(nId); - nSelMenuItem=nId; - aQueryField = MnemonicGenerator::EraseAllMnemonicChars( pPopupMenu->GetItemText(nId) ); + OUString sId = OUString::number(nId); + xPopupMenu->set_active(sId, true); + sSelMenuItem = sId; + aQueryField = MnemonicGenerator::EraseAllMnemonicChars(xPopupMenu->get_label(sId)); } void BibToolBar::EnableSourceList(bool bFlag) @@ -470,20 +471,18 @@ bool BibToolBar::PreNotify( NotifyEvent& rNEvt ) { bool bResult = true; - MouseNotifyEvent nSwitch=rNEvt.GetType(); - if (pEdQuery && pEdQuery->has_focus() && nSwitch == MouseNotifyEvent::KEYINPUT) + NotifyEventType nSwitch=rNEvt.GetType(); + if (pEdQuery && pEdQuery->has_focus() && nSwitch == NotifyEventType::KEYINPUT) { const vcl::KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode(); sal_uInt16 nKey = aKeyCode.GetCode(); if(nKey == KEY_RETURN) { - Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); - pPropertyVal[0].Name = "QueryText"; - OUString aSelection = pEdQuery->get_text(); - pPropertyVal[0].Value <<= aSelection; - pPropertyVal[1].Name="QueryField"; - pPropertyVal[1].Value <<= aQueryField; + Sequence<PropertyValue> aPropVal + { + comphelper::makePropertyValue("QueryText", pEdQuery->get_text()), + comphelper::makePropertyValue("QueryField", aQueryField) + }; SendDispatch(nTBC_BT_AUTOFILTER, aPropVal); return bResult; } @@ -502,39 +501,38 @@ IMPL_LINK_NOARG( BibToolBar, SelHdl, weld::ComboBox&, void ) IMPL_LINK_NOARG( BibToolBar, SendSelHdl, Timer*, void ) { - Sequence<PropertyValue> aPropVal(1); - PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); - pPropertyVal[0].Name = "DataSourceName"; - OUString aEntry( MnemonicGenerator::EraseAllMnemonicChars( pLbSource->get_active_text() ) ); - pPropertyVal[0].Value <<= aEntry; + Sequence<PropertyValue> aPropVal + { + comphelper::makePropertyValue("DataSourceName", MnemonicGenerator::EraseAllMnemonicChars( pLbSource->get_active_text() )) + }; SendDispatch(nTBC_SOURCE, aPropVal); } -IMPL_LINK_NOARG( BibToolBar, MenuHdl, ToolBox*, void) +IMPL_LINK_NOARG(BibToolBar, MenuHdl, ToolBox*, void) { - sal_uInt16 nId=GetCurItemId(); + ToolBoxItemId nId = GetCurItemId(); if (nId != nTBC_BT_AUTOFILTER) return; EndSelection(); // before SetDropMode (SetDropMode calls SetItemImage) SetItemDown(nTBC_BT_AUTOFILTER, true); - nId = pPopupMenu->Execute(this, GetItemRect(nTBC_BT_AUTOFILTER)); + tools::Rectangle aRect(GetItemRect(nTBC_BT_AUTOFILTER)); + weld::Window* pParent = weld::GetPopupParent(*this, aRect); + OUString sId = xPopupMenu->popup_at_rect(pParent, aRect); - if(nId>0) + if (!sId.isEmpty()) { - pPopupMenu->CheckItem(nSelMenuItem,false); - pPopupMenu->CheckItem(nId); - nSelMenuItem=nId; - aQueryField = MnemonicGenerator::EraseAllMnemonicChars( pPopupMenu->GetItemText(nId) ); - Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); - pPropertyVal[0].Name = "QueryText"; - OUString aSelection = pEdQuery->get_text(); - pPropertyVal[0].Value <<= aSelection; - pPropertyVal[1].Name="QueryField"; - pPropertyVal[1].Value <<= aQueryField; + xPopupMenu->set_active(sSelMenuItem, false); + xPopupMenu->set_active(sId, true); + sSelMenuItem = sId; + aQueryField = MnemonicGenerator::EraseAllMnemonicChars(xPopupMenu->get_label(sId)); + Sequence<PropertyValue> aPropVal + { + comphelper::makePropertyValue("QueryText", pEdQuery->get_text()), + comphelper::makePropertyValue("QueryField", aQueryField) + }; SendDispatch(nTBC_BT_AUTOFILTER, aPropVal); } @@ -562,7 +560,7 @@ void BibToolBar::DataChanged( const DataChangedEvent& rDCEvt ) IMPL_LINK_NOARG( BibToolBar, OptionsChanged_Impl, LinkParamNone*, void ) { bool bRebuildToolBar = false; - sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize(); + sal_Int16 eSymbolsSize = SvtMiscOptions::GetCurrentSymbolsSize(); if ( nSymbolsSize != eSymbolsSize ) { nSymbolsSize = eSymbolsSize; @@ -576,7 +574,7 @@ IMPL_LINK_NOARG( BibToolBar, OptionsChanged_Impl, LinkParamNone*, void ) IMPL_LINK_NOARG( BibToolBar, SettingsChanged_Impl, VclSimpleEvent&, void ) { // Check if toolbar button size have changed and we have to use system settings - sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize(); + sal_Int16 eSymbolsSize = SvtMiscOptions::GetCurrentSymbolsSize(); if ( eSymbolsSize != nSymbolsSize ) { nSymbolsSize = eSymbolsSize; @@ -593,9 +591,9 @@ void BibToolBar::RebuildToolbar() void BibToolBar::ApplyImageList() { - SetItemImage(nTBC_BT_AUTOFILTER, Image(StockImage::Yes, nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ? OUString(RID_EXTBMP_AUTOFILTER_SC) : OUString(RID_EXTBMP_AUTOFILTER_LC))); - SetItemImage(nTBC_BT_FILTERCRIT, Image(StockImage::Yes, nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ? OUString(RID_EXTBMP_FILTERCRIT_SC) : OUString(RID_EXTBMP_FILTERCRIT_LC))); - SetItemImage(nTBC_BT_REMOVEFILTER, Image(StockImage::Yes, nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ? OUString(RID_EXTBMP_REMOVE_FILTER_SORT_SC) : OUString(RID_EXTBMP_REMOVE_FILTER_SORT_LC))); + SetItemImage(nTBC_BT_AUTOFILTER, Image(StockImage::Yes, nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ? RID_EXTBMP_AUTOFILTER_SC : RID_EXTBMP_AUTOFILTER_LC)); + SetItemImage(nTBC_BT_FILTERCRIT, Image(StockImage::Yes, nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ? RID_EXTBMP_FILTERCRIT_SC : RID_EXTBMP_FILTERCRIT_LC)); + SetItemImage(nTBC_BT_REMOVEFILTER, Image(StockImage::Yes, nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ? RID_EXTBMP_REMOVE_FILTER_SORT_SC : RID_EXTBMP_REMOVE_FILTER_SORT_LC)); AdjustToolBox(); } diff --git a/extensions/source/bibliography/toolbar.hxx b/extensions/source/bibliography/toolbar.hxx index afd1bd3ace38..d4e45b2e0b80 100644 --- a/extensions/source/bibliography/toolbar.hxx +++ b/extensions/source/bibliography/toolbar.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_TOOLBAR_HXX -#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_TOOLBAR_HXX +#pragma once #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XStatusListener.hpp> @@ -36,7 +35,7 @@ class BibToolBarListener: public cppu::WeakImplHelper < css::frame::XStatusListe { private: - sal_uInt16 nIndex; + ToolBoxItemId nIndex; OUString aCommand; protected: @@ -45,7 +44,7 @@ protected: public: - BibToolBarListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId); + BibToolBarListener(BibToolBar *pTB, OUString aStr, ToolBoxItemId nId); virtual ~BibToolBarListener() override; const OUString& GetCommand() const { return aCommand;} @@ -63,7 +62,7 @@ class BibTBListBoxListener: public BibToolBarListener { public: - BibTBListBoxListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId); + BibTBListBoxListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId); virtual ~BibTBListBoxListener() override; virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override; @@ -74,7 +73,7 @@ class BibTBEditListener: public BibToolBarListener { public: - BibTBEditListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId); + BibTBEditListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId); virtual ~BibTBEditListener() override; virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override; @@ -85,7 +84,7 @@ class BibTBQueryMenuListener: public BibToolBarListener { public: - BibTBQueryMenuListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId); + BibTBQueryMenuListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId); virtual ~BibTBQueryMenuListener() override; virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override; @@ -148,20 +147,21 @@ class BibToolBar: public ToolBox weld::ComboBox* pLbSource; VclPtr<EditControl> xQuery; weld::Entry* pEdQuery; - ScopedVclPtr<PopupMenu> pPopupMenu; + std::unique_ptr<weld::Builder> xBuilder; + std::unique_ptr<weld::Menu> xPopupMenu; sal_uInt16 nMenuId; - sal_uInt16 nSelMenuItem; + OUString sSelMenuItem; OUString aQueryField; Link<void*,void> aLayoutManager; sal_Int16 nSymbolsSize; - sal_uInt16 nTBC_SOURCE; - sal_uInt16 nTBC_QUERY; - sal_uInt16 nTBC_BT_AUTOFILTER; - sal_uInt16 nTBC_BT_COL_ASSIGN; - sal_uInt16 nTBC_BT_CHANGESOURCE; - sal_uInt16 nTBC_BT_FILTERCRIT; - sal_uInt16 nTBC_BT_REMOVEFILTER; + ToolBoxItemId nTBC_SOURCE; + ToolBoxItemId nTBC_QUERY; + ToolBoxItemId nTBC_BT_AUTOFILTER; + ToolBoxItemId nTBC_BT_COL_ASSIGN; + ToolBoxItemId nTBC_BT_CHANGESOURCE; + ToolBoxItemId nTBC_BT_FILTERCRIT; + ToolBoxItemId nTBC_BT_REMOVEFILTER; BibDataManager* pDatMan; DECL_LINK( SelHdl, weld::ComboBox&, void ); @@ -188,7 +188,7 @@ class BibToolBar: public ToolBox virtual ~BibToolBar() override; virtual void dispose() override; - sal_uInt16 GetChangeSourceId() const { return nTBC_BT_CHANGESOURCE; } + ToolBoxItemId GetChangeSourceId() const { return nTBC_BT_CHANGESOURCE; } void SetXController(const css::uno::Reference< css::frame::XController > &); @@ -210,10 +210,8 @@ class BibToolBar: public ToolBox void statusChanged(const css::frame::FeatureStateEvent& Event); void SetDatMan(BibDataManager& rDatMan) {pDatMan = &rDatMan;} - void SendDispatch(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue >& rArgs); + void SendDispatch(ToolBoxItemId nId, const css::uno::Sequence< css::beans::PropertyValue >& rArgs); }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx index f9f5f9545439..3e76f6faa9ce 100644 --- a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx +++ b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx @@ -11,14 +11,12 @@ #include <com/sun/star/beans/Optional.hpp> #include <comphelper/base64.hxx> -#include <comphelper/configurationhelper.hxx> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/container/XNameReplace.hpp> -#include <com/sun/star/util/XChangesBatch.hpp> +#include <comphelper/configuration.hxx> #include <cppuhelper/supportsservice.hxx> #include <map> #include <o3tl/char16_t2wchar_t.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> +#include <officecfg/UserProfile.hxx> #include <Iads.h> #include <Adshlp.h> @@ -26,6 +24,9 @@ #define SECURITY_WIN32 #include <Security.h> +#include <systools/win32/comtools.hxx> +#include <systools/win32/oleauto.hxx> + namespace extensions { namespace config @@ -60,23 +61,23 @@ public: namespace { -constexpr OUStringLiteral givenname(u"givenname"); -constexpr OUStringLiteral sn(u"sn"); -constexpr char fathersname[]("fathersname"); -constexpr OUStringLiteral initials(u"initials"); -constexpr OUStringLiteral street(u"street"); -constexpr OUStringLiteral l(u"l"); -constexpr OUStringLiteral st(u"st"); -constexpr char apartment[]("apartment"); -constexpr OUStringLiteral postalcode(u"postalcode"); -constexpr OUStringLiteral c(u"c"); -constexpr OUStringLiteral o(u"o"); -constexpr char position[]("position"); -constexpr OUStringLiteral title(u"title"); -constexpr OUStringLiteral homephone(u"homephone"); -constexpr OUStringLiteral telephonenumber(u"telephonenumber"); -constexpr OUStringLiteral facsimiletelephonenumber(u"facsimiletelephonenumber"); -constexpr OUStringLiteral mail(u"mail"); +constexpr OUString _givenname(u"givenname"_ustr); +constexpr OUString _sn(u"sn"_ustr); +constexpr char _fathersname[]("fathersname"); +constexpr OUString _initials(u"initials"_ustr); +constexpr OUString _street(u"street"_ustr); +constexpr OUString _l(u"l"_ustr); +constexpr OUString _st(u"st"_ustr); +constexpr char _apartment[]("apartment"); +constexpr OUString _postalcode(u"postalcode"_ustr); +constexpr OUString _c(u"c"_ustr); +constexpr OUString _o(u"o"_ustr); +constexpr char _position[]("position"); +constexpr OUString _title(u"title"_ustr); +constexpr OUString _homephone(u"homephone"_ustr); +constexpr OUString _telephonenumber(u"telephonenumber"_ustr); +constexpr OUString _facsimiletelephonenumber(u"facsimiletelephonenumber"_ustr); +constexpr OUString _mail(u"mail"_ustr); // Backend class implementing access to Active Directory user data. It caches its encoded data // in a configuration entry, to allow reusing it when user later doesn't have access to AD DC @@ -84,118 +85,85 @@ constexpr OUStringLiteral mail(u"mail"); class ADsUserAccess : public extensions::config::WinUserInfo::WinUserInfoBe_Impl { public: - ADsUserAccess(const css::uno::Reference<css::uno::XComponentContext>& xContext) + ADsUserAccess() { try { - struct CoInitializeGuard - { - CoInitializeGuard() - { - if (FAILED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED))) - throw css::uno::RuntimeException(); - } - ~CoInitializeGuard() { CoUninitialize(); } - } aCoInitializeGuard; - - IADsADSystemInfo* pADsys; - HRESULT hr = CoCreateInstance(CLSID_ADSystemInfo, nullptr, CLSCTX_INPROC_SERVER, - IID_IADsADSystemInfo, reinterpret_cast<void**>(&pADsys)); - if (FAILED(hr)) - throw css::uno::RuntimeException(); - CoIfPtr<IADsADSystemInfo> aADsysGuard(pADsys); + sal::systools::CoInitializeGuard aCoInitializeGuard(COINIT_APARTMENTTHREADED); - BSTR sUserDN; - hr = pADsys->get_UserName(&sUserDN); - if (FAILED(hr)) - throw css::uno::RuntimeException(); - BSTRGuard aUserNameGuard(sUserDN, SysFreeString); + sal::systools::COMReference<IADsADSystemInfo> pADsys(CLSID_ADSystemInfo, nullptr, + CLSCTX_INPROC_SERVER); + + sal::systools::BStr sUserDN; + sal::systools::ThrowIfFailed(pADsys->get_UserName(&sUserDN), "get_UserName failed"); // If this user is an AD user, then without an active connection to the domain, all the // above will succeed, and m_sUserDN will be correctly initialized, but the following // call to ADsGetObject will fail, and we will attempt reading cached values. - m_sUserDN = o3tl::toU(sUserDN); + m_sUserDN = sUserDN; OUString sLdapUserDN = "LDAP://" + m_sUserDN; - IADsUser* pUser; - hr = ADsGetObject(o3tl::toW(sLdapUserDN.getStr()), IID_IADsUser, - reinterpret_cast<void**>(&pUser)); - if (FAILED(hr)) - throw css::uno::RuntimeException(); - CoIfPtr<IADsUser> pUserGuard(pUser); + sal::systools::COMReference<IADsUser> pUser; + sal::systools::ThrowIfFailed(ADsGetObject(o3tl::toW(sLdapUserDN.getStr()), IID_IADsUser, + reinterpret_cast<void**>(&pUser)), + "ADsGetObject failed"); // Fetch all the required information right now, when we know to have access to AD // (later the connection may already be lost) - m_aMap[givenname] = Str(pUser, &IADsUser::get_FirstName); - m_aMap[sn] = Str(pUser, &IADsUser::get_LastName); - m_aMap[initials] = Str(pUser, L"initials"); - m_aMap[street] = Str(pUser, L"streetAddress"); - m_aMap[l] = Str(pUser, L"l"); - m_aMap[st] = Str(pUser, L"st"); - m_aMap[postalcode] = Str(pUser, L"postalCode"); - m_aMap[c] = Str(pUser, L"co"); - m_aMap[o] = Str(pUser, L"company"); - m_aMap[title] = Str(pUser, &IADsUser::get_Title); - m_aMap[homephone] = Str(pUser, L"homePhone"); - m_aMap[telephonenumber] = Str(pUser, L"TelephoneNumber"); - m_aMap[facsimiletelephonenumber] = Str(pUser, L"facsimileTelephoneNumber"); - m_aMap[mail] = Str(pUser, &IADsUser::get_EmailAddress); - - CacheData(xContext); + m_aMap[_givenname] = Str(pUser, &IADsUser::get_FirstName); + m_aMap[_sn] = Str(pUser, &IADsUser::get_LastName); + m_aMap[_initials] = Str(pUser, L"initials"); + m_aMap[_street] = Str(pUser, L"streetAddress"); + m_aMap[_l] = Str(pUser, L"l"); + m_aMap[_st] = Str(pUser, L"st"); + m_aMap[_postalcode] = Str(pUser, L"postalCode"); + m_aMap[_c] = Str(pUser, L"co"); + m_aMap[_o] = Str(pUser, L"company"); + m_aMap[_title] = Str(pUser, &IADsUser::get_Title); + m_aMap[_homephone] = Str(pUser, L"homePhone"); + m_aMap[_telephonenumber] = Str(pUser, L"TelephoneNumber"); + m_aMap[_facsimiletelephonenumber] = Str(pUser, L"facsimileTelephoneNumber"); + m_aMap[_mail] = Str(pUser, &IADsUser::get_EmailAddress); + + CacheData(); } - catch (css::uno::Exception&) + catch (sal::systools::ComError&) { // Maybe we temporarily lost connection to AD; try to get cached data - GetCachedData(xContext); + GetCachedData(); } } - virtual OUString GetGivenName() override { return m_aMap[givenname]; } - virtual OUString GetSn() override { return m_aMap[sn]; } - virtual OUString GetInitials() override { return m_aMap[initials]; } - virtual OUString GetStreet() override { return m_aMap[street]; } - virtual OUString GetCity() override { return m_aMap[l]; } - virtual OUString GetState() override { return m_aMap[st]; } - virtual OUString GetPostalCode() override { return m_aMap[postalcode]; } - virtual OUString GetCountry() override { return m_aMap[c]; } - virtual OUString GetOrganization() override { return m_aMap[o]; } - virtual OUString GetTitle() override { return m_aMap[title]; } - virtual OUString GetHomePhone() override { return m_aMap[homephone]; } - virtual OUString GetTelephoneNumber() override { return m_aMap[telephonenumber]; } - virtual OUString GetFaxNumber() override { return m_aMap[facsimiletelephonenumber]; } - virtual OUString GetMail() override { return m_aMap[mail]; } + virtual OUString GetGivenName() override { return m_aMap[_givenname]; } + virtual OUString GetSn() override { return m_aMap[_sn]; } + virtual OUString GetInitials() override { return m_aMap[_initials]; } + virtual OUString GetStreet() override { return m_aMap[_street]; } + virtual OUString GetCity() override { return m_aMap[_l]; } + virtual OUString GetState() override { return m_aMap[_st]; } + virtual OUString GetPostalCode() override { return m_aMap[_postalcode]; } + virtual OUString GetCountry() override { return m_aMap[_c]; } + virtual OUString GetOrganization() override { return m_aMap[_o]; } + virtual OUString GetTitle() override { return m_aMap[_title]; } + virtual OUString GetHomePhone() override { return m_aMap[_homephone]; } + virtual OUString GetTelephoneNumber() override { return m_aMap[_telephonenumber]; } + virtual OUString GetFaxNumber() override { return m_aMap[_facsimiletelephonenumber]; } + virtual OUString GetMail() override { return m_aMap[_mail]; } private: - static void ReleaseIUnknown(IUnknown* p) - { - if (p) - p->Release(); - } - template <class If> class CoIfPtr : public std::unique_ptr<If, decltype(&ReleaseIUnknown)> - { - public: - CoIfPtr(If* p = nullptr) - : std::unique_ptr<If, decltype(&ReleaseIUnknown)>(p, ReleaseIUnknown) - { - } - }; - typedef std::unique_ptr<OLECHAR, decltype(&SysFreeString)> BSTRGuard; - typedef HRESULT (__stdcall IADsUser::*getstrfunc)(BSTR*); static OUString Str(IADsUser* pUser, getstrfunc func) { - BSTR sBstr; + sal::systools::BStr sBstr; if (FAILED((pUser->*func)(&sBstr))) return ""; - BSTRGuard aBstrGuard(sBstr, SysFreeString); - return OUString(o3tl::toU(sBstr)); + return OUString(sBstr); } static OUString Str(IADsUser* pUser, const wchar_t* property) { - BSTRGuard sBstrProp(SysAllocString(property), SysFreeString); + sal::systools::BStr sBstrProp{ o3tl::toU(property) }; struct AutoVariant : public VARIANT { AutoVariant() { VariantInit(this); } ~AutoVariant() { VariantClear(this); } } varArr; - if (FAILED(pUser->GetEx(sBstrProp.get(), &varArr))) + if (FAILED(pUser->GetEx(sBstrProp, &varArr))) return ""; SAFEARRAY* sa = V_ARRAY(&varArr); LONG nStart, nEnd; @@ -213,41 +181,35 @@ private: return ""; } - void CacheData(const css::uno::Reference<css::uno::XComponentContext>& xContext) + void CacheData() { try { OUString sCachedData = "user=" + m_sUserDN // user DN - + "\0" + givenname + "=" + GetGivenName() // 1st name - + "\0" + sn + "=" + GetSn() // sn - + "\0" + initials + "=" + GetInitials() // initials - + "\0" + street + "=" + GetStreet() // street - + "\0" + l + "=" + GetCity() // l - + "\0" + st + "=" + GetState() // st - + "\0" + postalcode + "=" + GetPostalCode() // p.code - + "\0" + c + "=" + GetCountry() // c - + "\0" + o + "=" + GetOrganization() // o - + "\0" + title + "=" + GetTitle() // title - + "\0" + homephone + "=" + GetHomePhone() // h.phone - + "\0" + telephonenumber + "=" + GetTelephoneNumber() // tel - + "\0" + facsimiletelephonenumber + "=" + GetFaxNumber() // fax - + "\0" + mail + "=" + GetMail(); // mail + + "\0" + _givenname + "=" + GetGivenName() // 1st name + + "\0" + _sn + "=" + GetSn() // sn + + "\0" + _initials + "=" + GetInitials() // initials + + "\0" + _street + "=" + GetStreet() // street + + "\0" + _l + "=" + GetCity() // l + + "\0" + _st + "=" + GetState() // st + + "\0" + _postalcode + "=" + GetPostalCode() // p.code + + "\0" + _c + "=" + GetCountry() // c + + "\0" + _o + "=" + GetOrganization() // o + + "\0" + _title + "=" + GetTitle() // title + + "\0" + _homephone + "=" + GetHomePhone() // h.phone + + "\0" + _telephonenumber + "=" + GetTelephoneNumber() // tel + + "\0" + _facsimiletelephonenumber + "=" + GetFaxNumber() // fax + + "\0" + _mail + "=" + GetMail(); // mail const css::uno::Sequence<sal_Int8> seqCachedData( reinterpret_cast<const sal_Int8*>(sCachedData.getStr()), sCachedData.getLength() * sizeof(sal_Unicode)); OUStringBuffer sOutBuf; comphelper::Base64::encode(sOutBuf, seqCachedData); - auto xIface = comphelper::ConfigurationHelper::openConfig( - xContext, "org.openoffice.UserProfile/WinUserInfo", - comphelper::EConfigurationModes::Standard); - css::uno::Reference<css::container::XNameReplace> xNameReplace( - xIface, css::uno::UNO_QUERY_THROW); - xNameReplace->replaceByName("Cache", css::uno::makeAny(sOutBuf.makeStringAndClear())); - - css::uno::Reference<css::util::XChangesBatch> xChangesBatch(xIface, - css::uno::UNO_QUERY_THROW); - xChangesBatch->commitChanges(); + std::shared_ptr<comphelper::ConfigurationChanges> batch( + comphelper::ConfigurationChanges::create()); + officecfg::UserProfile::WinUserInfo::Cache::set(sOutBuf.makeStringAndClear(), batch); + batch->commit(); } catch (const css::uno::Exception&) { @@ -256,18 +218,13 @@ private: } } - void GetCachedData(const css::uno::Reference<css::uno::XComponentContext>& xContext) + void GetCachedData() { if (m_sUserDN.isEmpty()) throw css::uno::RuntimeException(); - auto xIface = comphelper::ConfigurationHelper::openConfig( - xContext, "org.openoffice.UserProfile/WinUserInfo", - comphelper::EConfigurationModes::ReadOnly); - css::uno::Reference<css::container::XNameAccess> xNameAccess(xIface, - css::uno::UNO_QUERY_THROW); - OUString sCache; - xNameAccess->getByName("Cache") >>= sCache; + OUString sCache = officecfg::UserProfile::WinUserInfo::Cache::get(); + if (sCache.isEmpty()) throw css::uno::RuntimeException(); @@ -346,13 +303,13 @@ namespace config { namespace WinUserInfo { -WinUserInfoBe::WinUserInfoBe(const css::uno::Reference<css::uno::XComponentContext>& xContext) +WinUserInfoBe::WinUserInfoBe() : WinUserInfoMutexHolder() , BackendBase(mMutex) { try { - m_pImpl.reset(new ADsUserAccess(xContext)); + m_pImpl.reset(new ADsUserAccess()); } catch (css::uno::RuntimeException&) { @@ -373,79 +330,79 @@ css::uno::Any WinUserInfoBe::getPropertyValue(OUString const& PropertyName) OUString sValue; // Only process the first argument of possibly multiple space- or comma-separated arguments OUString sToken = PropertyName.getToken(0, ' ').getToken(0, ','); - if (sToken == givenname) + if (sToken == _givenname) { sValue = m_pImpl->GetGivenName(); } - else if (sToken == sn) + else if (sToken == _sn) { sValue = m_pImpl->GetSn(); } - else if (sToken == fathersname) + else if (sToken == _fathersname) { sValue = m_pImpl->GetFathersname(); } - else if (sToken == initials) + else if (sToken == _initials) { sValue = m_pImpl->GetInitials(); } - else if (sToken == street) + else if (sToken == _street) { sValue = m_pImpl->GetStreet(); } - else if (sToken == l) + else if (sToken == _l) { sValue = m_pImpl->GetCity(); } - else if (sToken == st) + else if (sToken == _st) { sValue = m_pImpl->GetState(); } - else if (sToken == apartment) + else if (sToken == _apartment) { sValue = m_pImpl->GetApartment(); } - else if (sToken == postalcode) + else if (sToken == _postalcode) { sValue = m_pImpl->GetPostalCode(); } - else if (sToken == c) + else if (sToken == _c) { sValue = m_pImpl->GetCountry(); } - else if (sToken == o) + else if (sToken == _o) { sValue = m_pImpl->GetOrganization(); } - else if (sToken == position) + else if (sToken == _position) { sValue = m_pImpl->GetPosition(); } - else if (sToken == title) + else if (sToken == _title) { sValue = m_pImpl->GetTitle(); } - else if (sToken == homephone) + else if (sToken == _homephone) { sValue = m_pImpl->GetHomePhone(); } - else if (sToken == telephonenumber) + else if (sToken == _telephonenumber) { sValue = m_pImpl->GetTelephoneNumber(); } - else if (sToken == facsimiletelephonenumber) + else if (sToken == _facsimiletelephonenumber) { sValue = m_pImpl->GetFaxNumber(); } - else if (sToken == mail) + else if (sToken == _mail) { sValue = m_pImpl->GetMail(); } else throw css::beans::UnknownPropertyException(sToken, static_cast<cppu::OWeakObject*>(this)); - return css::uno::makeAny(css::beans::Optional<css::uno::Any>( - !sValue.isEmpty(), sValue.isEmpty() ? css::uno::Any() : css::uno::makeAny(sValue))); + return css::uno::Any(css::beans::Optional<css::uno::Any>( + !sValue.isEmpty(), sValue.isEmpty() ? css::uno::Any() : css::uno::Any(sValue))); } OUString SAL_CALL WinUserInfoBe::getImplementationName() @@ -467,10 +424,10 @@ css::uno::Sequence<OUString> SAL_CALL WinUserInfoBe::getSupportedServiceNames() } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* -extensions_WinUserInfoBe_get_implementation(css::uno::XComponentContext* context, +extensions_WinUserInfoBe_get_implementation(css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const&) { - return cppu::acquire(new extensions::config::WinUserInfo::WinUserInfoBe(context)); + return cppu::acquire(new extensions::config::WinUserInfo::WinUserInfoBe()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx b/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx index 4ebca2678a59..30ca088c3aca 100644 --- a/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx +++ b/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx @@ -7,8 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_CONFIG_WINUSERINFO_WINUSERINFOBE_HXX -#define INCLUDED_EXTENSIONS_SOURCE_CONFIG_WINUSERINFO_WINUSERINFOBE_HXX +#pragma once #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -52,7 +51,7 @@ struct WinUserInfoMutexHolder class WinUserInfoBe : private WinUserInfoMutexHolder, public BackendBase { public: - explicit WinUserInfoBe(const css::uno::Reference<css::uno::XComponentContext>& xContext); + explicit WinUserInfoBe(); virtual ~WinUserInfoBe() override; // XServiceInfo @@ -99,6 +98,4 @@ private: } } -#endif // INCLUDED_EXTENSIONS_SOURCE_CONFIG_WINUSERINFO_WINUSERINFOBE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/config/ldap/ldapaccess.hxx b/extensions/source/config/ldap/ldapaccess.hxx index 274cdb88009d..36a0708b1eb7 100644 --- a/extensions/source/config/ldap/ldapaccess.hxx +++ b/extensions/source/config/ldap/ldapaccess.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPACCESS_HXX -#define INCLUDED_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPACCESS_HXX +#pragma once #include <sal/config.h> @@ -131,6 +130,4 @@ private: }; } -#endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/config/ldap/ldapuserprofilebe.cxx b/extensions/source/config/ldap/ldapuserprofilebe.cxx index 8be633a4ca3e..a735b5fbd71a 100644 --- a/extensions/source/config/ldap/ldapuserprofilebe.cxx +++ b/extensions/source/config/ldap/ldapuserprofilebe.cxx @@ -21,7 +21,7 @@ #include "ldapaccess.hxx" #include "ldapuserprofilebe.hxx" #include <sal/log.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <rtl/instance.hxx> #include <com/sun/star/beans/NamedValue.hpp> @@ -35,8 +35,7 @@ namespace extensions::config::ldap { LdapUserProfileBe::LdapUserProfileBe( const uno::Reference<uno::XComponentContext>& xContext) -: LdapProfileMutexHolder(), - BackendBase(mMutex) +: BackendBase(m_aMutex) { LdapDefinition aDefinition; OUString loggedOnUser; @@ -47,7 +46,7 @@ LdapUserProfileBe::LdapUserProfileBe( const uno::Reference<uno::XComponentContex // the configuration for the backend would create another instance of the // backend, which would try and read the configuration which would... { - osl::Mutex & aInitMutex = rtl::Static< osl::Mutex, LdapUserProfileBe >::get(); + static osl::Mutex aInitMutex; osl::MutexGuard aInitGuard(aInitMutex); static bool bReentrantCall; // = false @@ -94,10 +93,9 @@ bool LdapUserProfileBe::readLdapConfiguration( uno::Reference< lang::XMultiServiceFactory > xCfgProvider( css::configuration::theDefaultProvider::get(context)); - css::beans::NamedValue aPath("nodepath", uno::makeAny(OUString("org.openoffice.LDAP/UserDirectory")) ); + css::beans::NamedValue aPath("nodepath", uno::Any(OUString("org.openoffice.LDAP/UserDirectory")) ); - uno::Sequence< uno::Any > aArgs(1); - aArgs[0] <<= aPath; + uno::Sequence< uno::Any > aArgs{ uno::Any(aPath) }; xIface = xCfgProvider->createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aArgs); @@ -174,16 +172,16 @@ css::uno::Any LdapUserProfileBe::getPropertyValue( } LdapData::iterator k(data_.find(PropertyName.copy(i, j - i))); if (k != data_.end()) { - return css::uno::makeAny( + return css::uno::Any( css::beans::Optional< css::uno::Any >( - true, css::uno::makeAny(k->second))); + true, css::uno::Any(k->second))); } if (j == PropertyName.getLength()) { break; } i = j + 1; } - return css::uno::makeAny(css::beans::Optional< css::uno::Any >()); + return css::uno::Any(css::beans::Optional< css::uno::Any >()); } diff --git a/extensions/source/config/ldap/ldapuserprofilebe.hxx b/extensions/source/config/ldap/ldapuserprofilebe.hxx index 634d0e848992..2f05365328db 100644 --- a/extensions/source/config/ldap/ldapuserprofilebe.hxx +++ b/extensions/source/config/ldap/ldapuserprofilebe.hxx @@ -17,13 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX -#define INCLUDED_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX +#pragma once #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> #include "ldapaccess.hxx" @@ -42,13 +42,12 @@ struct LdapDefinition; typedef cppu::WeakComponentImplHelper<css::beans::XPropertySet, lang::XServiceInfo> BackendBase ; -struct LdapProfileMutexHolder { osl::Mutex mMutex; }; /** Implements the PlatformBackend service, a specialization of the XPropertySet service for retrieving LDAP user profile configuration settings from an LDAP repository. */ -class LdapUserProfileBe : private LdapProfileMutexHolder, public BackendBase +class LdapUserProfileBe : private cppu::BaseMutex, public BackendBase { public: @@ -111,6 +110,4 @@ class LdapUserProfileBe : private LdapProfileMutexHolder, public BackendBase } -#endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/commonpagesdbp.cxx b/extensions/source/dbpilots/commonpagesdbp.cxx index 883f1a78536c..8bac5d09c42c 100644 --- a/extensions/source/dbpilots/commonpagesdbp.cxx +++ b/extensions/source/dbpilots/commonpagesdbp.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <comphelper/interaction.hxx> #include <connectivity/dbtools.hxx> #include <sfx2/docfilt.hxx> @@ -46,7 +46,6 @@ namespace dbp using namespace ::com::sun::star; using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; @@ -58,7 +57,6 @@ namespace dbp : OControlWizardPage(pPage, pWizard, "modules/sabpilot/ui/tableselectionpage.ui", "TableSelectionPage") , m_xTable(m_xBuilder->weld_tree_view("table")) , m_xDatasource(m_xBuilder->weld_tree_view("datasource")) - , m_xDatasourceLabel(m_xBuilder->weld_label("datasourcelabel")) , m_xSearchDatabase(m_xBuilder->weld_button("search")) , m_xSourceBox(m_xBuilder->weld_container("sourcebox")) { @@ -162,13 +160,13 @@ namespace dbp xOldConn = getFormConnection(); OUString sDataSource = m_xDatasource->get_selected_text(); - rContext.xForm->setPropertyValue("DataSourceName", makeAny( sDataSource ) ); + rContext.xForm->setPropertyValue("DataSourceName", Any( sDataSource ) ); } OUString sCommand = m_xTable->get_selected_text(); sal_Int32 nCommandType = m_xTable->get_selected_id().toInt32(); - rContext.xForm->setPropertyValue("Command", makeAny( sCommand ) ); - rContext.xForm->setPropertyValue("CommandType", makeAny( nCommandType ) ); + rContext.xForm->setPropertyValue("Command", Any( sCommand ) ); + rContext.xForm->setPropertyValue("CommandType", Any( nCommandType ) ); if ( !rContext.bEmbedded ) setFormConnection( xOldConn, false ); @@ -344,7 +342,7 @@ namespace dbp lcl_fillEntries(*m_xTable, aQueryNames, BMP_QUERY, CommandType::QUERY); } - OMaybeListSelectionPage::OMaybeListSelectionPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID) + OMaybeListSelectionPage::OMaybeListSelectionPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID) : OControlWizardPage(pPage, pWizard, rUIXMLDescription, rID) , m_pYes(nullptr) , m_pNo(nullptr) @@ -362,13 +360,15 @@ namespace dbp m_pNo = &_rNoButton; m_pList = &_rSelection; - m_pYes->connect_clicked(LINK(this, OMaybeListSelectionPage, OnRadioSelected)); - m_pNo->connect_clicked(LINK(this, OMaybeListSelectionPage, OnRadioSelected)); + m_pYes->connect_toggled(LINK(this, OMaybeListSelectionPage, OnRadioSelected)); + m_pNo->connect_toggled(LINK(this, OMaybeListSelectionPage, OnRadioSelected)); implEnableWindows(); } - IMPL_LINK_NOARG( OMaybeListSelectionPage, OnRadioSelected, weld::Button&, void ) + IMPL_LINK(OMaybeListSelectionPage, OnRadioSelected, weld::Toggleable&, rButton, void) { + if (!rButton.get_active()) + return; implEnableWindows(); } diff --git a/extensions/source/dbpilots/commonpagesdbp.hxx b/extensions/source/dbpilots/commonpagesdbp.hxx index 5d93b9301271..66115a14451c 100644 --- a/extensions/source/dbpilots/commonpagesdbp.hxx +++ b/extensions/source/dbpilots/commonpagesdbp.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_COMMONPAGESDBP_HXX -#define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_COMMONPAGESDBP_HXX +#pragma once #include "controlwizard.hxx" #include <vcl/weld.hxx> @@ -30,7 +29,6 @@ namespace dbp { std::unique_ptr<weld::TreeView> m_xTable; std::unique_ptr<weld::TreeView> m_xDatasource; - std::unique_ptr<weld::Label> m_xDatasourceLabel; std::unique_ptr<weld::Button> m_xSearchDatabase; std::unique_ptr<weld::Container> m_xSourceBox; @@ -67,11 +65,11 @@ namespace dbp weld::ComboBox* m_pList; public: - OMaybeListSelectionPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID); + OMaybeListSelectionPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID); virtual ~OMaybeListSelectionPage() override; protected: - DECL_LINK( OnRadioSelected, weld::Button&, void ); + DECL_LINK( OnRadioSelected, weld::Toggleable&, void ); // BuilderPage overridables void Activate() override; @@ -90,7 +88,6 @@ namespace dbp class ODBFieldPage : public OMaybeListSelectionPage { - protected: std::unique_ptr<weld::Label> m_xDescription; std::unique_ptr<weld::RadioButton> m_xStoreYes; std::unique_ptr<weld::RadioButton> m_xStoreNo; @@ -118,6 +115,4 @@ namespace dbp } // namespace dbp -#endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_COMMONPAGESDBP_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index b442aca3fdbe..1b0d3ceaf77c 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -19,7 +19,7 @@ #include "controlwizard.hxx" #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> @@ -50,7 +50,6 @@ namespace dbp { using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; @@ -72,7 +71,7 @@ namespace dbp OAccessRegulator() { } }; - OControlWizardPage::OControlWizardPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID) + OControlWizardPage::OControlWizardPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID) : OControlWizardPage_Base(pPage, pWizard, rUIXMLDescription, rID) , m_pDialog(pWizard) { @@ -150,7 +149,6 @@ namespace dbp m_xFormDatasource = m_xBuilder->weld_label("datasource"); m_xFormDatasourceLabel = m_xBuilder->weld_label("datasourcelabel"); m_xFormTable = m_xBuilder->weld_label("formtable"); - m_xFormTableLabel = m_xBuilder->weld_label("formtablelabel"); const OControlWizardContext& rContext = getContext(); if ( rContext.bEmbedded ) @@ -185,7 +183,7 @@ namespace dbp m_xFormDatasource->set_label(sDataSource); m_xFormTable->set_label(sCommand); - const char* pCommandTypeResourceId = nullptr; + TranslateId pCommandTypeResourceId; switch (nCommandType) { case CommandType::TABLE: @@ -411,7 +409,7 @@ namespace dbp } else { - m_aContext.xForm->setPropertyValue("ActiveConnection", makeAny( _rxConn ) ); + m_aContext.xForm->setPropertyValue("ActiveConnection", Any( _rxConn ) ); } } catch(const Exception&) @@ -527,7 +525,7 @@ namespace dbp // not interested in any results, only in the fields Reference< XPropertySet > xStatementProps(xStatement, UNO_QUERY); - xStatementProps->setPropertyValue("MaxRows", makeAny(sal_Int32(0))); + xStatementProps->setPropertyValue("MaxRows", Any(sal_Int32(0))); // TODO: think about handling local SQLExceptions here ... Reference< XColumnsSupplier > xSupplyCols(xStatement->executeQuery(), UNO_QUERY); @@ -576,16 +574,15 @@ namespace dbp { // an SQLException (or derivee) was thrown ... // prepend an extra SQLContext explaining what we were doing - SQLContext aContext; - aContext.Message = compmodule::ModuleRes(RID_STR_COULDNOTOPENTABLE); - aContext.NextException = aSQLException; + SQLContext aContext(compmodule::ModuleRes(RID_STR_COULDNOTOPENTABLE), {}, {}, 0, + aSQLException, {}); // create an interaction handler to display this exception Reference< XInteractionHandler > xHandler = getInteractionHandler(m_xAssistant.get()); if ( !xHandler.is() ) return false; - Reference< XInteractionRequest > xRequest = new OInteractionRequest(makeAny(aContext)); + Reference< XInteractionRequest > xRequest = new OInteractionRequest(Any(aContext)); try { xHandler->handle(xRequest); @@ -613,7 +610,7 @@ namespace dbp OUString sControlLabel(_pSettings->sControlLabel); m_aContext.xObjectModel->setPropertyValue( "Label", - makeAny(sControlLabel) + Any(sControlLabel) ); } } diff --git a/extensions/source/dbpilots/controlwizard.hxx b/extensions/source/dbpilots/controlwizard.hxx index 12835c1a6ce2..12138899f9dd 100644 --- a/extensions/source/dbpilots/controlwizard.hxx +++ b/extensions/source/dbpilots/controlwizard.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX -#define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX +#pragma once #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/form/FormComponentType.hpp> @@ -50,7 +49,6 @@ namespace dbp std::unique_ptr<weld::Label> m_xFormDatasource; std::unique_ptr<weld::Label> m_xFormContentTypeLabel; std::unique_ptr<weld::Label> m_xFormContentType; - std::unique_ptr<weld::Label> m_xFormTableLabel; std::unique_ptr<weld::Label> m_xFormTable; std::unique_ptr<weld::Frame> m_xFrame; @@ -63,7 +61,7 @@ namespace dbp css::uno::Reference< css::sdbc::XConnection > getFormConnection() const; public: - OControlWizardPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID); + OControlWizardPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID); virtual ~OControlWizardPage() override; protected: @@ -147,6 +145,4 @@ namespace dbp } // namespace dbp -#endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_CONTROLWIZARD_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/dbptools.hxx b/extensions/source/dbpilots/dbptools.hxx index 548949e8bfa9..d7577f18773c 100644 --- a/extensions/source/dbpilots/dbptools.hxx +++ b/extensions/source/dbpilots/dbptools.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_DBPTOOLS_HXX -#define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_DBPTOOLS_HXX +#pragma once #include <com/sun/star/container/XNameAccess.hpp> @@ -35,6 +34,4 @@ namespace dbp } // namespace dbp -#endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_DBPTOOLS_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/dbptypes.hxx b/extensions/source/dbpilots/dbptypes.hxx index 6832b5160a17..8b86fe506484 100644 --- a/extensions/source/dbpilots/dbptypes.hxx +++ b/extensions/source/dbpilots/dbptypes.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_DBPTYPES_HXX -#define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_DBPTYPES_HXX +#pragma once #include <sal/config.h> @@ -34,6 +33,4 @@ typedef std::map<sal_uInt32, OUString> MapInt2String; } // namespace dbp -#endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_DBPTYPES_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx index 1c5f568795e0..4b382e228264 100644 --- a/extensions/source/dbpilots/gridwizard.cxx +++ b/extensions/source/dbpilots/gridwizard.cxx @@ -40,7 +40,6 @@ namespace dbp using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; @@ -93,8 +92,8 @@ namespace dbp if (!xColumnFactory.is() || !xColumnContainer.is()) return; - static constexpr OUStringLiteral s_sMouseWheelBehavior = u"MouseWheelBehavior"; - static constexpr OUStringLiteral s_sEmptyString = u""; + static constexpr OUString s_sMouseWheelBehavior = u"MouseWheelBehavior"_ustr; + static constexpr OUString s_sEmptyString = u""_ustr; // collect "descriptors" for the to-be-created (grid)columns std::vector< OUString > aColumnServiceNames; // service names to be used with the XGridColumnFactory @@ -121,14 +120,14 @@ namespace dbp { case DataType::BIT: case DataType::BOOLEAN: - aColumnServiceNames.push_back(OUString("CheckBox")); + aColumnServiceNames.emplace_back("CheckBox"); aColumnLabelPostfixes.push_back(s_sEmptyString); break; case DataType::TINYINT: case DataType::SMALLINT: case DataType::INTEGER: - aColumnServiceNames.push_back(OUString("NumericField")); + aColumnServiceNames.emplace_back("NumericField"); aColumnLabelPostfixes.push_back(s_sEmptyString); break; @@ -137,31 +136,31 @@ namespace dbp case DataType::DOUBLE: case DataType::NUMERIC: case DataType::DECIMAL: - aColumnServiceNames.push_back(OUString("FormattedField")); + aColumnServiceNames.emplace_back("FormattedField"); aColumnLabelPostfixes.push_back(s_sEmptyString); break; case DataType::DATE: - aColumnServiceNames.push_back(OUString("DateField")); + aColumnServiceNames.emplace_back("DateField"); aColumnLabelPostfixes.push_back(s_sEmptyString); break; case DataType::TIME: - aColumnServiceNames.push_back(OUString("TimeField")); + aColumnServiceNames.emplace_back("TimeField"); aColumnLabelPostfixes.push_back(s_sEmptyString); break; case DataType::TIMESTAMP: - aColumnServiceNames.push_back(OUString("DateField")); + aColumnServiceNames.emplace_back("DateField"); aColumnLabelPostfixes.push_back(compmodule::ModuleRes(RID_STR_DATEPOSTFIX)); aFormFieldNames.push_back(*pSelectedFields); - aColumnServiceNames.push_back(OUString("TimeField")); + aColumnServiceNames.emplace_back("TimeField"); aColumnLabelPostfixes.push_back(compmodule::ModuleRes(RID_STR_TIMEPOSTFIX)); break; default: - aColumnServiceNames.push_back(OUString("TextField")); + aColumnServiceNames.emplace_back("TextField"); aColumnLabelPostfixes.push_back(s_sEmptyString); } } @@ -172,7 +171,7 @@ namespace dbp // now loop through the descriptions and create the (grid)columns out of th descriptors { - Reference< XNameAccess > xExistenceChecker(xColumnContainer.get()); + Reference< XNameAccess > xExistenceChecker(xColumnContainer); std::vector< OUString >::const_iterator pColumnLabelPostfix = aColumnLabelPostfixes.begin(); std::vector< OUString >::const_iterator pFormFieldName = aFormFieldNames.begin(); @@ -189,17 +188,17 @@ namespace dbp disambiguateName(xExistenceChecker, sColumnName); // the data field the column should be bound to - xColumn->setPropertyValue("DataField", makeAny(*pFormFieldName)); + xColumn->setPropertyValue("DataField", Any(*pFormFieldName)); // the label - xColumn->setPropertyValue("Label", makeAny(*pFormFieldName + *pColumnLabelPostfix)); + xColumn->setPropertyValue("Label", Any(*pFormFieldName + *pColumnLabelPostfix)); // the width (<void/> => column will be auto-sized) xColumn->setPropertyValue("Width", Any()); if ( xColumnPSI->hasPropertyByName( s_sMouseWheelBehavior ) ) - xColumn->setPropertyValue( s_sMouseWheelBehavior, makeAny( MouseWheelBehavior::SCROLL_DISABLED ) ); + xColumn->setPropertyValue( s_sMouseWheelBehavior, Any( MouseWheelBehavior::SCROLL_DISABLED ) ); // insert the column - xColumnContainer->insertByName(sColumnName, makeAny(xColumn)); + xColumnContainer->insertByName(sColumnName, Any(xColumn)); } catch(const Exception&) { @@ -216,7 +215,7 @@ namespace dbp std::unique_ptr<BuilderPage> OGridWizard::createPage(WizardState _nState) { - OString sIdent(OString::number(_nState)); + OUString sIdent(OUString::number(_nState)); weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); switch (_nState) diff --git a/extensions/source/dbpilots/gridwizard.hxx b/extensions/source/dbpilots/gridwizard.hxx index 5eb9732bd6fd..dc2c069e9f76 100644 --- a/extensions/source/dbpilots/gridwizard.hxx +++ b/extensions/source/dbpilots/gridwizard.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_GRIDWIZARD_HXX -#define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_GRIDWIZARD_HXX +#pragma once #include "controlwizard.hxx" #include "commonpagesdbp.hxx" @@ -61,7 +60,7 @@ namespace dbp class OGridPage : public OControlWizardPage { public: - OGridPage(weld::Container* pPage, OGridWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID) + OGridPage(weld::Container* pPage, OGridWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID) : OControlWizardPage(pPage, pWizard, rUIXMLDescription, rID) { } @@ -101,6 +100,4 @@ namespace dbp } // namespace dbp -#endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_GRIDWIZARD_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/groupboxwiz.cxx b/extensions/source/dbpilots/groupboxwiz.cxx index 9d74990ee0ac..37b79d8ed4e3 100644 --- a/extensions/source/dbpilots/groupboxwiz.cxx +++ b/extensions/source/dbpilots/groupboxwiz.cxx @@ -20,7 +20,7 @@ #include "groupboxwiz.hxx" #include "commonpagesdbp.hxx" #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include "optiongrouplayouter.hxx" #include <helpids.h> #include <o3tl/safeint.hxx> @@ -34,7 +34,6 @@ namespace dbp { using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::form; @@ -60,7 +59,7 @@ namespace dbp std::unique_ptr<BuilderPage> OGroupBoxWizard::createPage(::vcl::WizardTypes::WizardState _nState) { - OString sIdent(OString::number(_nState)); + OUString sIdent(OUString::number(_nState)); weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); switch (_nState) @@ -227,7 +226,7 @@ namespace dbp for (sal_Int32 i=0; i<m_xExistingRadios->n_children(); ++i) { rSettings.aLabels.push_back(m_xExistingRadios->get_text(i)); - rSettings.aValues.push_back(OUString::number((i + 1))); + rSettings.aValues.push_back(OUString::number(i + 1)); } return true; @@ -280,17 +279,21 @@ namespace dbp m_xMoveLeft->set_sensitive(bSelectedSome); m_xMoveRight->set_sensitive(bUnfinishedInput); - getDialog()->enableButtons(WizardButtonFlags::NEXT, bHaveSome); + OControlWizard* pDialogController = getDialog(); + + pDialogController->enableButtons(WizardButtonFlags::NEXT, bHaveSome); + + weld::Dialog* pDialog = pDialogController->getDialog(); if (bUnfinishedInput) { - if (!m_xMoveRight->get_has_default()) - getDialog()->defaultButton(m_xMoveRight.get()); + if (!pDialog->is_default_widget(m_xMoveRight.get())) + pDialogController->defaultButton(m_xMoveRight.get()); } else { - if (m_xMoveRight->get_has_default()) - getDialog()->defaultButton(WizardButtonFlags::NEXT); + if (pDialog->is_default_widget(m_xMoveRight.get())) + pDialogController->defaultButton(WizardButtonFlags::NEXT); } } diff --git a/extensions/source/dbpilots/groupboxwiz.hxx b/extensions/source/dbpilots/groupboxwiz.hxx index b9f375865323..73950ed36918 100644 --- a/extensions/source/dbpilots/groupboxwiz.hxx +++ b/extensions/source/dbpilots/groupboxwiz.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_GROUPBOXWIZ_HXX -#define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_GROUPBOXWIZ_HXX +#pragma once #include "controlwizard.hxx" #include "commonpagesdbp.hxx" @@ -66,7 +65,7 @@ namespace dbp class OGBWPage : public OControlWizardPage { public: - OGBWPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID) + OGBWPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID) : OControlWizardPage(pPage, pWizard, rUIXMLDescription, rID) { } @@ -178,6 +177,4 @@ namespace dbp } // namespace dbp -#endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_GROUPBOXWIZ_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/listcombowizard.cxx b/extensions/source/dbpilots/listcombowizard.cxx index cde03e22356e..1e90b3c33df9 100644 --- a/extensions/source/dbpilots/listcombowizard.cxx +++ b/extensions/source/dbpilots/listcombowizard.cxx @@ -25,7 +25,7 @@ #include <com/sun/star/form/ListSourceType.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <connectivity/dbtools.hxx> #include <helpids.h> #include <osl/diagnose.h> @@ -36,7 +36,6 @@ namespace dbp using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; @@ -83,7 +82,7 @@ namespace dbp std::unique_ptr<BuilderPage> OListComboWizard::createPage(WizardState _nState) { - OString sIdent(OString::number(_nState)); + OUString sIdent(OUString::number(_nState)); weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); switch (_nState) @@ -170,19 +169,20 @@ namespace dbp } // ListSourceType: SQL - getContext().xObjectModel->setPropertyValue("ListSourceType", makeAny(sal_Int32(ListSourceType_SQL))); + getContext().xObjectModel->setPropertyValue("ListSourceType", Any(sal_Int32(ListSourceType_SQL))); if (isListBox()) { // BoundColumn: 1 - getContext().xObjectModel->setPropertyValue("BoundColumn", makeAny(sal_Int16(1))); - - // build the statement to set as list source - OUString sStatement = "SELECT " + - getSettings().sListContentField + ", " + getSettings().sLinkedListField + - " FROM " + getSettings().sListContentTable; - Sequence< OUString > aListSource { sStatement }; - getContext().xObjectModel->setPropertyValue("ListSource", makeAny(aListSource)); + getContext().xObjectModel->setPropertyValue("BoundColumn", Any(sal_Int16(1))); + + Sequence< OUString > aListSource { + // build the statement to set as list source + OUString("SELECT " + + getSettings().sListContentField + ", " + getSettings().sLinkedListField + + " FROM " + getSettings().sListContentTable) + }; + getContext().xObjectModel->setPropertyValue("ListSource", Any(aListSource)); } else { @@ -190,11 +190,11 @@ namespace dbp OUString sStatement = "SELECT DISTINCT " + getSettings().sListContentField + " FROM " + getSettings().sListContentTable; - getContext().xObjectModel->setPropertyValue( "ListSource", makeAny(sStatement)); + getContext().xObjectModel->setPropertyValue( "ListSource", Any(sStatement)); } // the bound field - getContext().xObjectModel->setPropertyValue("DataField", makeAny(getSettings().sLinkedFormField)); + getContext().xObjectModel->setPropertyValue("DataField", Any(getSettings().sLinkedFormField)); } catch(const Exception&) { diff --git a/extensions/source/dbpilots/listcombowizard.hxx b/extensions/source/dbpilots/listcombowizard.hxx index 6fad3011006b..5e61296f89be 100644 --- a/extensions/source/dbpilots/listcombowizard.hxx +++ b/extensions/source/dbpilots/listcombowizard.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_LISTCOMBOWIZARD_HXX -#define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_LISTCOMBOWIZARD_HXX +#pragma once #include "controlwizard.hxx" #include "commonpagesdbp.hxx" @@ -78,7 +77,7 @@ namespace dbp class OLCPage : public OControlWizardPage { public: - OLCPage(weld::Container* pPage, OListComboWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID) + OLCPage(weld::Container* pPage, OListComboWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID) : OControlWizardPage(pPage, pWizard, rUIXMLDescription, rID) { } @@ -176,6 +175,4 @@ namespace dbp } // namespace dbp -#endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_LISTCOMBOWIZARD_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/optiongrouplayouter.cxx b/extensions/source/dbpilots/optiongrouplayouter.cxx index 14a67ada98f7..c35b0cefc8d7 100644 --- a/extensions/source/dbpilots/optiongrouplayouter.cxx +++ b/extensions/source/dbpilots/optiongrouplayouter.cxx @@ -28,7 +28,7 @@ #include <com/sun/star/view/XSelectionSupplier.hpp> #include "groupboxwiz.hxx" #include "dbptools.hxx" -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace dbp @@ -90,7 +90,7 @@ namespace dbp // shape collection (for grouping the shapes) Reference< XShapes > xButtonCollection( ShapeCollection::create(mxContext) ); // first member : the shape of the control - xButtonCollection->add(_rContext.xObjectShape.get()); + xButtonCollection->add(_rContext.xObjectShape); sal_Int32 nTempHeight = (aControlShapeSize.Height - BUTTON_HEIGHT/4) / (nRadioButtons + 1); @@ -116,20 +116,20 @@ namespace dbp UNO_QUERY); // the label - xRadioModel->setPropertyValue("Label", makeAny(*aLabelIter)); + xRadioModel->setPropertyValue("Label", Any(*aLabelIter)); // the value - xRadioModel->setPropertyValue("RefValue", makeAny(*aValueIter)); + xRadioModel->setPropertyValue("RefValue", Any(*aValueIter)); // default selection if (_rSettings.sDefaultField == *aLabelIter) - xRadioModel->setPropertyValue("DefaultState", makeAny(sal_Int16(1))); + xRadioModel->setPropertyValue("DefaultState", Any(sal_Int16(1))); // the connection to the database field if (!_rSettings.sDBField.isEmpty()) - xRadioModel->setPropertyValue("DataField", makeAny(_rSettings.sDBField)); + xRadioModel->setPropertyValue("DataField", Any(_rSettings.sDBField)); // the name for the model - xRadioModel->setPropertyValue("Name", makeAny(sElementsName)); + xRadioModel->setPropertyValue("Name", Any(sElementsName)); // create a shape for the radio button Reference< XControlShape > xRadioShape( @@ -158,13 +158,13 @@ namespace dbp // xShapeProperties->setPropertyValue("Name", makeAny(sElementsName)); // add to the page - xPageShapes->add(xRadioShape.get()); + xPageShapes->add(xRadioShape); // add to the collection (for the later grouping) - xButtonCollection->add(xRadioShape.get()); + xButtonCollection->add(xRadioShape); // set the GroupBox as "LabelControl" for the RadioButton // (_after_ having inserted the model into the page!) - xRadioModel->setPropertyValue("LabelControl", makeAny(_rContext.xObjectModel)); + xRadioModel->setPropertyValue("LabelControl", Any(_rContext.xObjectModel)); } // group the shapes @@ -176,7 +176,7 @@ namespace dbp Reference< XShapeGroup > xGroupedOptions = xGrouper->group(xButtonCollection); Reference< XSelectionSupplier > xSelector(_rContext.xDocumentModel->getCurrentController(), UNO_QUERY); if (xSelector.is()) - xSelector->select(makeAny(xGroupedOptions)); + xSelector->select(Any(xGroupedOptions)); } } catch(Exception&) @@ -189,12 +189,12 @@ namespace dbp void OOptionGroupLayouter::implAnchorShape(const Reference< XPropertySet >& _rxShapeProps) { - static constexpr OUStringLiteral s_sAnchorPropertyName = u"AnchorType"; + static constexpr OUString s_sAnchorPropertyName = u"AnchorType"_ustr; Reference< XPropertySetInfo > xPropertyInfo; if (_rxShapeProps.is()) xPropertyInfo = _rxShapeProps->getPropertySetInfo(); if (xPropertyInfo.is() && xPropertyInfo->hasPropertyByName(s_sAnchorPropertyName)) - _rxShapeProps->setPropertyValue(s_sAnchorPropertyName, makeAny(TextContentAnchorType_AT_PAGE)); + _rxShapeProps->setPropertyValue(s_sAnchorPropertyName, Any(TextContentAnchorType_AT_PAGE)); } diff --git a/extensions/source/dbpilots/optiongrouplayouter.hxx b/extensions/source/dbpilots/optiongrouplayouter.hxx index 7891f10d90c2..64a6998c176e 100644 --- a/extensions/source/dbpilots/optiongrouplayouter.hxx +++ b/extensions/source/dbpilots/optiongrouplayouter.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_OPTIONGROUPLAYOUTER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_OPTIONGROUPLAYOUTER_HXX +#pragma once #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -56,6 +55,4 @@ namespace dbp } // namespace dbp -#endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_OPTIONGROUPLAYOUTER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/unoautopilot.hxx b/extensions/source/dbpilots/unoautopilot.hxx index 9d201522c24b..ea6e886d2d13 100644 --- a/extensions/source/dbpilots/unoautopilot.hxx +++ b/extensions/source/dbpilots/unoautopilot.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_UNOAUTOPILOT_HXX -#define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_UNOAUTOPILOT_HXX +#pragma once #include <svtools/genericunodialog.hxx> #include <comphelper/processfactory.hxx> @@ -27,6 +26,7 @@ #include <cppuhelper/typeprovider.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <utility> #include <vcl/svapp.hxx> namespace dbp @@ -42,7 +42,7 @@ namespace dbp OUString aImplementationName, const css::uno::Sequence<OUString>& aSupportedServices) : OUnoAutoPilot_Base(_rxORB), - m_ImplementationName(aImplementationName), + m_ImplementationName(std::move(aImplementationName)), m_SupportedServices(aSupportedServices) { } @@ -114,6 +114,4 @@ namespace dbp } // namespace dbp -#endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_UNOAUTOPILOT_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/wizardcontext.hxx b/extensions/source/dbpilots/wizardcontext.hxx index 58cda7c209d0..65f4c1410f33 100644 --- a/extensions/source/dbpilots/wizardcontext.hxx +++ b/extensions/source/dbpilots/wizardcontext.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_WIZARDCONTEXT_HXX -#define INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_WIZARDCONTEXT_HXX +#pragma once #include <sal/config.h> @@ -80,6 +79,4 @@ namespace dbp } // namespace dbp -#endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_WIZARDCONTEXT_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/inc/componentmodule.cxx b/extensions/source/inc/componentmodule.cxx index 69d2234adbdb..e1b29b2ecef6 100644 --- a/extensions/source/inc/componentmodule.cxx +++ b/extensions/source/inc/componentmodule.cxx @@ -23,7 +23,7 @@ namespace compmodule { - OUString ModuleRes(const char* pId) + OUString ModuleRes(TranslateId pId) { return Translate::get(pId, Translate::Create("pcr")); } diff --git a/extensions/source/inc/componentmodule.hxx b/extensions/source/inc/componentmodule.hxx index 3b5d402578cd..24b5032cd98e 100644 --- a/extensions/source/inc/componentmodule.hxx +++ b/extensions/source/inc/componentmodule.hxx @@ -17,20 +17,18 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_INC_COMPONENTMODULE_HXX -#define INCLUDED_EXTENSIONS_SOURCE_INC_COMPONENTMODULE_HXX +#pragma once #include <rtl/ustring.hxx> +#include <unotools/resmgr.hxx> namespace compmodule { // specialized ResId, using the resource locale provided by the global module - OUString ModuleRes(const char* pId); + OUString ModuleRes(TranslateId pId); } // namespace compmodule -#endif // INCLUDED_EXTENSIONS_SOURCE_INC_COMPONENTMODULE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/csvformatter.cxx b/extensions/source/logging/csvformatter.cxx index 0d0ec6479c5e..a9ea13f208ca 100644 --- a/extensions/source/logging/csvformatter.cxx +++ b/extensions/source/logging/csvformatter.cxx @@ -28,6 +28,8 @@ #include <cppuhelper/supportsservice.hxx> #include <rtl/ustrbuf.hxx> +#include <sal/macros.h> +#include <sal/types.h> #include <stdio.h> #include <string_view> @@ -88,32 +90,34 @@ namespace { const sal_Unicode quote_char = '"'; const sal_Unicode comma_char = ','; - constexpr OUStringLiteral dos_newline = u"\r\n"; + constexpr OUString dos_newline = u"\r\n"_ustr; bool needsQuoting(std::u16string_view str) { return str.find_first_of(u"\",\n\r") != std::u16string_view::npos; }; - void appendEncodedString(OUStringBuffer& buf, const OUString& str) + void appendEncodedString(OUStringBuffer& buf, std::u16string_view str) { if(needsQuoting(str)) { // each double-quote will get replaced by two double-quotes buf.append(quote_char); const sal_Int32 buf_offset = buf.getLength(); - const sal_Int32 str_length = str.getLength(); + const size_t str_length = str.size(); buf.append(str); // special treatment for the last character if(quote_char==str[str_length-1]) buf.append(quote_char); // iterating backwards because the index at which we insert won't be shifted // when moving that way. - for(sal_Int32 i = str_length; i>=0; ) + for(size_t i = str_length;; ) { - i=str.lastIndexOf(quote_char, --i); - if(i!=-1) - buf.insert(buf_offset + i, quote_char); + --i; + i=str.substr(i).rfind(quote_char); + if(i==std::u16string_view::npos) + break; + buf.insert(buf_offset + i, quote_char); } buf.append(quote_char); } @@ -198,8 +202,7 @@ namespace logging sal_Int32 columns = m_Columnnames.getLength(); for(sal_Int32 i=0; i<columns; i++) { - buf.append(m_Columnnames[i]); - buf.append(comma_char); + buf.append(m_Columnnames[i] + OUStringChar(comma_char)); } buf.setLength(buf.getLength()-1); buf.append(dos_newline); @@ -212,14 +215,12 @@ namespace logging if(m_LogEventNo) { - aLogEntry.append( record.SequenceNumber ); - aLogEntry.append(comma_char); + aLogEntry.append(record.SequenceNumber + comma_char); } if(m_LogThread) { - aLogEntry.append( record.ThreadID ); - aLogEntry.append(comma_char); + aLogEntry.append(record.ThreadID + OUStringChar(comma_char)); } if(m_LogTimestamp) @@ -236,16 +237,16 @@ namespace logging } // ISO 8601 - char buffer[ 31 ]; + char buffer[ SAL_N_ELEMENTS("-32768-65535-65535T65535:65535:65535.4294967295") ]; const size_t buffer_size = sizeof( buffer ); - snprintf( buffer, buffer_size, "%04i-%02i-%02iT%02i:%02i:%02i.%09i", + snprintf( buffer, buffer_size, "%04i-%02u-%02uT%02u:%02u:%02u.%09" SAL_PRIuUINT32, static_cast<int>(record.LogTime.Year), - static_cast<int>(record.LogTime.Month), - static_cast<int>(record.LogTime.Day), - static_cast<int>(record.LogTime.Hours), - static_cast<int>(record.LogTime.Minutes), - static_cast<int>(record.LogTime.Seconds), - static_cast<int>(record.LogTime.NanoSeconds) ); + static_cast<unsigned int>(record.LogTime.Month), + static_cast<unsigned int>(record.LogTime.Day), + static_cast<unsigned int>(record.LogTime.Hours), + static_cast<unsigned int>(record.LogTime.Minutes), + static_cast<unsigned int>(record.LogTime.Seconds), + record.LogTime.NanoSeconds ); aLogEntry.appendAscii( buffer ); aLogEntry.append(comma_char); } diff --git a/extensions/source/logging/filehandler.cxx b/extensions/source/logging/filehandler.cxx index 222146b0b4d2..8108f7c6abf8 100644 --- a/extensions/source/logging/filehandler.cxx +++ b/extensions/source/logging/filehandler.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/util/PathSubstitution.hpp> #include <com/sun/star/util/XStringSubstitution.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/basemutex.hxx> @@ -130,8 +130,6 @@ namespace logging :FileHandler_Base( m_aMutex ) ,m_xContext( context ) ,m_aHandlerHelper( context, m_aMutex, rBHelper ) - ,m_sFileURL( ) - ,m_pFile( ) ,m_eFileValidity( eUnknown ) { ::osl::MutexGuard aGuard( m_aMutex ); diff --git a/extensions/source/logging/log.component b/extensions/source/logging/log.component index d4bda58c6900..ae221bb5768d 100644 --- a/extensions/source/logging/log.component +++ b/extensions/source/logging/log.component @@ -32,7 +32,8 @@ <service name="com.sun.star.logging.FileHandler"/> </implementation> <implementation name="com.sun.star.comp.extensions.LoggerPool" - constructor="com_sun_star_comp_extensions_LoggerPool"> + constructor="com_sun_star_comp_extensions_LoggerPool" + single-instance="true"> <singleton name="com.sun.star.logging.LoggerPool"/> </implementation> <implementation name="com.sun.star.comp.extensions.PlainTextFormatter" diff --git a/extensions/source/logging/logger.cxx b/extensions/source/logging/logger.cxx index 1770ca377175..4ae2f79362fc 100644 --- a/extensions/source/logging/logger.cxx +++ b/extensions/source/logging/logger.cxx @@ -32,8 +32,8 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/weakref.hxx> -#include <rtl/ref.hxx> #include <map> +#include <utility> namespace logging @@ -64,7 +64,7 @@ namespace logging // </attributes> public: - EventLogger( const Reference< XComponentContext >& _rxContext, const OUString& _rName ); + EventLogger( const Reference< XComponentContext >& _rxContext, OUString _aName ); // XLogger virtual OUString SAL_CALL getName() override; @@ -114,11 +114,11 @@ namespace logging } - EventLogger::EventLogger( const Reference< XComponentContext >& _rxContext, const OUString& _rName ) + EventLogger::EventLogger( const Reference< XComponentContext >& _rxContext, OUString _aName ) :m_aHandlers( m_aMutex ) ,m_nEventNumber( 0 ) ,m_nLogLevel( css::logging::LogLevel::OFF ) - ,m_sName( _rName ) + ,m_sName(std::move( _aName )) { osl_atomic_increment( &m_refCount ); { @@ -255,31 +255,12 @@ namespace logging } // namespace logging -namespace { - -struct Instance { - explicit Instance( - css::uno::Reference<css::uno::XComponentContext> const & context): - instance(static_cast<cppu::OWeakObject *>(new logging::LoggerPool(context))) - {} - - rtl::Reference<css::uno::XInterface> instance; -}; - -struct Singleton: - public rtl::StaticWithArg< - Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton> -{}; - -} - extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_extensions_LoggerPool( css::uno::XComponentContext *context, css::uno::Sequence<css::uno::Any> const &) { - return cppu::acquire(static_cast<cppu::OWeakObject *>( - Singleton::get(context).instance.get())); + return cppu::acquire(new logging::LoggerPool(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx index 4fd183099544..daf42859b833 100644 --- a/extensions/source/logging/loggerconfig.cxx +++ b/extensions/source/logging/loggerconfig.cxx @@ -34,7 +34,7 @@ #include <com/sun/star/logging/XLogHandler.hpp> #include <com/sun/star/logging/XLogFormatter.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <osl/process.h> #include <cppuhelper/component_context.hxx> @@ -54,7 +54,6 @@ namespace logging using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::uno::XInterface; using ::com::sun::star::util::XChangesBatch; - using ::com::sun::star::uno::makeAny; using ::com::sun::star::lang::NullPointerException; using ::com::sun::star::uno::Exception; using ::com::sun::star::lang::ServiceNotRegisteredException; @@ -105,22 +104,19 @@ namespace logging ::sal::static_int_cast< sal_Int16 >( aDateTime.NanoSeconds / 10000000 ) ); OUString sTime = OUString::createFromAscii( buffer ); - OUString sDateTime = sDate + "." + sTime; - oslProcessIdentifier aProcessId = 0; oslProcessInfo info; info.Size = sizeof (oslProcessInfo); if ( osl_getProcessInfo ( nullptr, osl_Process_IDENTIFIER, &info ) == osl_Process_E_None) aProcessId = info.Ident; - OUString aPID = OUString::number( aProcessId ); Variable const aVariables[] = { {std::u16string_view(u"$(loggername)"), sLoggerName}, {std::u16string_view(u"$(date)"), sDate}, {std::u16string_view(u"$(time)"), sTime}, - {std::u16string_view(u"$(datetime)"), sDateTime}, - {std::u16string_view(u"$(pid)"), aPID} + {std::u16string_view(u"$(datetime)"), sDate + "." + sTime }, + {std::u16string_view(u"$(pid)"), OUString::number(aProcessId)} }; for (Variable const & aVariable : aVariables) @@ -191,8 +187,7 @@ namespace logging bool bSuccess = false; if ( aSettings.hasElements() ) { - Sequence< Any > aConstructionArgs(1); - aConstructionArgs[0] <<= aSettings; + Sequence< Any > aConstructionArgs{ Any(aSettings) }; xInstance = _rContext->getServiceManager()->createInstanceWithArgumentsAndContext(sServiceName, aConstructionArgs, _rContext); bSuccess = xInstance.is(); } @@ -222,11 +217,8 @@ namespace logging css::configuration::theDefaultProvider::get(_rContext)); // write access to the "Settings" node (which includes settings for all loggers) - Sequence< Any > aArguments(1); - aArguments[0] <<= NamedValue( - "nodepath", - makeAny( OUString( "/org.openoffice.Office.Logging/Settings" ) ) - ); + Sequence<Any> aArguments{ Any(NamedValue( + "nodepath", Any(OUString("/org.openoffice.Office.Logging/Settings")))) }; Reference< XNameContainer > xAllSettings( xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", aArguments @@ -238,7 +230,7 @@ namespace logging // no node yet for this logger. Create default settings. Reference< XSingleServiceFactory > xNodeFactory( xAllSettings, UNO_QUERY_THROW ); Reference< XInterface > xLoggerSettings( xNodeFactory->createInstance(), css::uno::UNO_SET_THROW ); - xAllSettings->insertByName( sLoggerName, makeAny( xLoggerSettings ) ); + xAllSettings->insertByName( sLoggerName, Any( xLoggerSettings ) ); Reference< XChangesBatch > xChanges( xAllSettings, UNO_QUERY_THROW ); xChanges->commitChanges(); } diff --git a/extensions/source/logging/loggerconfig.hxx b/extensions/source/logging/loggerconfig.hxx index bc603135da2c..b08628cf16c0 100644 --- a/extensions/source/logging/loggerconfig.hxx +++ b/extensions/source/logging/loggerconfig.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOGGERCONFIG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOGGERCONFIG_HXX +#pragma once #include <com/sun/star/logging/XLogger.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -48,6 +47,4 @@ namespace logging } // namespace logging -#endif // INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOGGERCONFIG_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/loghandler.cxx b/extensions/source/logging/loghandler.cxx index afc33605b9fc..a398bd053acd 100644 --- a/extensions/source/logging/loghandler.cxx +++ b/extensions/source/logging/loghandler.cxx @@ -25,7 +25,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/logging/PlainTextFormatter.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <rtl/tencinfo.h> @@ -36,7 +36,6 @@ namespace logging using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::logging::LogRecord; - using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::logging::XLogFormatter; using ::com::sun::star::uno::Exception; using ::com::sun::star::lang::IllegalArgumentException; diff --git a/extensions/source/logging/loghandler.hxx b/extensions/source/logging/loghandler.hxx index 1e0feaa06c7c..02f4fb773761 100644 --- a/extensions/source/logging/loghandler.hxx +++ b/extensions/source/logging/loghandler.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOGHANDLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOGHANDLER_HXX +#pragma once #include <sal/config.h> @@ -140,6 +139,4 @@ namespace logging } // namespace logging -#endif // INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOGHANDLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/logrecord.hxx b/extensions/source/logging/logrecord.hxx index eb192f80fb68..ad6e350cfbeb 100644 --- a/extensions/source/logging/logrecord.hxx +++ b/extensions/source/logging/logrecord.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOGRECORD_HXX -#define INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOGRECORD_HXX +#pragma once #include <com/sun/star/logging/LogRecord.hpp> @@ -51,6 +50,4 @@ namespace logging } // namespace logging -#endif // INCLUDED_EXTENSIONS_SOURCE_LOGGING_LOGRECORD_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/methodguard.hxx b/extensions/source/logging/methodguard.hxx index 167b3a379617..189462eae667 100644 --- a/extensions/source/logging/methodguard.hxx +++ b/extensions/source/logging/methodguard.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_LOGGING_METHODGUARD_HXX -#define INCLUDED_EXTENSIONS_SOURCE_LOGGING_METHODGUARD_HXX +#pragma once namespace logging @@ -53,6 +52,4 @@ namespace logging } // namespace logging -#endif // INCLUDED_EXTENSIONS_SOURCE_LOGGING_METHODGUARD_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/plaintextformatter.cxx b/extensions/source/logging/plaintextformatter.cxx index 23392b61c491..2c534a2a2e8f 100644 --- a/extensions/source/logging/plaintextformatter.cxx +++ b/extensions/source/logging/plaintextformatter.cxx @@ -105,14 +105,11 @@ namespace logging if ( !(_rRecord.SourceClassName.isEmpty() || _rRecord.SourceMethodName.isEmpty()) ) { - aLogEntry.append( _rRecord.SourceClassName ); - aLogEntry.append( "::" ); - aLogEntry.append( _rRecord.SourceMethodName ); - aLogEntry.append( ": " ); + aLogEntry.append( _rRecord.SourceClassName + "::" + + _rRecord.SourceMethodName + ": " ); } - aLogEntry.append( _rRecord.Message ); - aLogEntry.append( "\n" ); + aLogEntry.append( _rRecord.Message + "\n" ); return aLogEntry.makeStringAndClear(); } diff --git a/extensions/source/logging/simpletextformatter.cxx b/extensions/source/logging/simpletextformatter.cxx index 83416e61c7d6..b54fea5a645b 100644 --- a/extensions/source/logging/simpletextformatter.cxx +++ b/extensions/source/logging/simpletextformatter.cxx @@ -27,8 +27,6 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> -#include <rtl/ustrbuf.hxx> - namespace logging { using css::logging::LogRecord; @@ -61,17 +59,14 @@ OUString SAL_CALL SimpleTextFormatter::getHead() { return OUString(); } OUString SAL_CALL SimpleTextFormatter::format(const LogRecord& _rRecord) { - OUStringBuffer aLogEntry; + OUString aLogEntry; // Highlight warnings if (_rRecord.Level == css::logging::LogLevel::SEVERE) - aLogEntry.append("ERROR: "); - if (_rRecord.Level == css::logging::LogLevel::WARNING) - aLogEntry.append("WARNING: "); - - aLogEntry.append(_rRecord.Message); - aLogEntry.append("\n"); + aLogEntry = "ERROR: "; + else if (_rRecord.Level == css::logging::LogLevel::WARNING) + aLogEntry = "WARNING: "; - return aLogEntry.makeStringAndClear(); + return aLogEntry + _rRecord.Message + "\n"; } OUString SAL_CALL SimpleTextFormatter::getTail() { return OUString(); } diff --git a/extensions/source/macosx/spotlight/GetMetadataForFile.h b/extensions/source/macosx/spotlight/GetMetadataForFile.h index e0447f082f5e..51086827ed24 100644 --- a/extensions/source/macosx/spotlight/GetMetadataForFile.h +++ b/extensions/source/macosx/spotlight/GetMetadataForFile.h @@ -17,13 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_MACOSX_SPOTLIGHT_GETMETADATAFORFILE_H -#define INCLUDED_EXTENSIONS_SOURCE_MACOSX_SPOTLIGHT_GETMETADATAFORFILE_H +#pragma once Boolean GetMetadataForFile( void * thisInterface, CFMutableDictionaryRef attributes, CFStringRef contentTypeUTI, CFStringRef pathToFile); -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/comifaces.hxx b/extensions/source/ole/comifaces.hxx index 87784161e8cd..51e955dd607f 100644 --- a/extensions/source/ole/comifaces.hxx +++ b/extensions/source/ole/comifaces.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_OLE_COMIFACES_HXX -#define INCLUDED_EXTENSIONS_SOURCE_OLE_COMIFACES_HXX +#pragma once #include <com/sun/star/uno/XInterface.hpp> @@ -60,6 +59,4 @@ protected: }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/jscriptclasses.hxx b/extensions/source/ole/jscriptclasses.hxx index 5d43b3a6b772..cef993ed04de 100644 --- a/extensions/source/ole/jscriptclasses.hxx +++ b/extensions/source/ole/jscriptclasses.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_OLE_JSCRIPTCLASSES_HXX -#define INCLUDED_EXTENSIONS_SOURCE_OLE_JSCRIPTCLASSES_HXX +#pragma once #include "wincrap.hxx" @@ -145,6 +144,4 @@ private: CComVariant m_varValue; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/ole2uno.hxx b/extensions/source/ole/ole2uno.hxx index 04e2823a7bc3..5fcf2fd96ad8 100644 --- a/extensions/source/ole/ole2uno.hxx +++ b/extensions/source/ole/ole2uno.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_OLE_OLE2UNO_HXX -#define INCLUDED_EXTENSIONS_SOURCE_OLE_OLE2UNO_HXX +#pragma once #include "wincrap.hxx" @@ -46,7 +45,6 @@ using namespace com::sun::star::registry; using namespace com::sun::star::reflection; using namespace com::sun::star::beans; using namespace osl; -using namespace std; VARTYPE getVarType(const Any& val); /* creates a Type object for a given type name. @@ -69,6 +67,4 @@ public: Mutex* getBridgeMutex(); -#endif // INCLUDED_EXTENSIONS_SOURCE_OLE_OLE2UNO_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/oledll.cxx b/extensions/source/ole/oledll.cxx index 1275f4dc60c5..9ed73a33042d 100644 --- a/extensions/source/ole/oledll.cxx +++ b/extensions/source/ole/oledll.cxx @@ -30,7 +30,6 @@ #pragma clang diagnostic ignored "-Winvalid-noreturn" #pragma clang diagnostic ignored "-Wmicrosoft" #pragma clang diagnostic ignored "-Wnon-pod-varargs" -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" #endif #include <atlbase.h> diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index 91f136a8a235..160b094acb64 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -26,6 +26,7 @@ #include <osl/thread.h> #include <memory> +#include <string_view> #include <com/sun/star/script/CannotConvertException.hpp> #include <com/sun/star/script/FailReason.hpp> #include <com/sun/star/beans/XMaterialHolder.hpp> @@ -46,7 +47,6 @@ #include "oleobjw.hxx" #include "unoobjw.hxx" #include <stdio.h> -using namespace std; using namespace osl; using namespace cppu; using namespace com::sun::star::script; @@ -1018,7 +1018,9 @@ Any IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName, if( outParameterCount && pMethod) { OutParamIndex.realloc( outParameterCount); + auto pOutParamIndex = OutParamIndex.getArray(); OutParam.realloc( outParameterCount); + auto pOutParam = OutParam.getArray(); sal_Int32 outIndex=0; int i = 0; try @@ -1027,13 +1029,13 @@ Any IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName, { if( pMethod->pParams[i].bOut ) { - OutParamIndex[outIndex]= static_cast<sal_Int16>(i); + pOutParamIndex[outIndex]= static_cast<sal_Int16>(i); Any outAny; if( !bJScriptObject) { variantToAny( &pVarParamsRef[outIndex], outAny, Type(pMethod->pParams[i].pTypeRef), false); - OutParam[outIndex++]= outAny; + pOutParam[outIndex++]= outAny; } else //JScriptObject { @@ -1047,7 +1049,7 @@ Any IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName, { variantToAny( &varOut, outAny, Type(pMethod->pParams[parameterCount - 1 - i].pTypeRef), false); - OutParam[outParameterCount - 1 - outIndex++]= outAny; + pOutParam[outParameterCount - 1 - outIndex++]= outAny; } else bConvRet= false; @@ -1427,8 +1429,8 @@ uno::Any SAL_CALL IUnknownWrapper::directInvoke( const OUString& aName, const un "DISP_E_BADVARTYPE.", nullptr); break; case DISP_E_EXCEPTION: - message = "[automation bridge]: " - + OUString(o3tl::toU(excepinfo.bstrDescription), + message = OUString::Concat("[automation bridge]: ") + + std::u16string_view(o3tl::toU(excepinfo.bstrDescription), ::SysStringLen(excepinfo.bstrDescription)); throw InvocationTargetException(message, Reference<XInterface>(), Any()); break; @@ -1548,7 +1550,7 @@ TypeDescription IUnknownWrapper::getInterfaceMemberDescOfCurrentCall(std::u16str { TypeDescription ret; - for( auto const & rType : std::as_const(m_seqTypes) ) + for (auto const& rType : m_seqTypes) { TypeDescription _curDesc( rType ); _curDesc.makeComplete(); @@ -1985,6 +1987,8 @@ Any IUnknownWrapper::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, // Convert out params if (outParamsCount) { + auto pOutParamIndex = OutParamIndex.getArray(); + auto pOutParam = OutParam.getArray(); int outParamIndex=0; for (int paramIndex = 0; paramIndex < nUnoArgs; paramIndex ++) { @@ -2021,8 +2025,8 @@ Any IUnknownWrapper::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, e.ArgumentIndex = paramIndex; throw; } - OutParam[outParamIndex] = outAny; - OutParamIndex[outParamIndex] = ::sal::static_int_cast< sal_Int16, int >( paramIndex ); + pOutParam[outParamIndex] = outAny; + pOutParamIndex[outParamIndex] = ::sal::static_int_cast< sal_Int16, int >( paramIndex ); outParamIndex++; } OutParam.realloc(outParamIndex); @@ -2049,8 +2053,8 @@ Any IUnknownWrapper::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, "DISP_E_BADVARTYPE.", nullptr); break; case DISP_E_EXCEPTION: - message = "[automation bridge]: " - + OUString(o3tl::toU(excepinfo.bstrDescription), + message = OUString::Concat("[automation bridge]: ") + + std::u16string_view(o3tl::toU(excepinfo.bstrDescription), ::SysStringLen(excepinfo.bstrDescription)); throw InvocationTargetException(message, Reference<XInterface>(), Any()); @@ -2192,9 +2196,9 @@ void IUnknownWrapper::getFuncDesc(const OUString & sFuncName, FUNCDESC ** pFuncD // maybe this is a property, if so we need // to store either both id's ( put/get ) or // just the get. Storing both is more consistent - pair<cit, cit> pItems = m_mapComFunc.equal_range( sRealName ); + std::pair<cit, cit> pItems = m_mapComFunc.equal_range( sRealName ); for ( ;pItems.first != pItems.second; ++pItems.first ) - m_mapComFunc.insert( TLBFuncIndexMap::value_type ( make_pair(sFuncName, pItems.first->second ) )); + m_mapComFunc.insert( TLBFuncIndexMap::value_type ( std::make_pair(sFuncName, pItems.first->second ) )); itIndex = m_mapComFunc.find( sFuncName ); } @@ -2204,7 +2208,7 @@ void IUnknownWrapper::getFuncDesc(const OUString & sFuncName, FUNCDESC ** pFuncD #if OSL_DEBUG_LEVEL >= 1 // There must only be one entry if sFuncName represents a function or two // if it is a property - pair<cit, cit> p = m_mapComFunc.equal_range(sFuncName.toAsciiLowerCase()); + std::pair<cit, cit> p = m_mapComFunc.equal_range(sFuncName.toAsciiLowerCase()); int numEntries = 0; for ( ;p.first != p.second; p.first ++, numEntries ++); OSL_ASSERT( ! (numEntries > 3) ); @@ -2236,7 +2240,7 @@ void IUnknownWrapper::getPropDesc(const OUString & sFuncName, FUNCDESC ** pFuncD OSL_ASSERT( * pFuncDescGet == nullptr && * pFuncDescPut == nullptr); buildComTlbIndex(); typedef TLBFuncIndexMap::const_iterator cit; - pair<cit, cit> p = m_mapComFunc.equal_range(sFuncName); + std::pair<cit, cit> p = m_mapComFunc.equal_range(sFuncName); if (p.first == m_mapComFunc.end()) { //try case insensitive with IDispatch::GetIDsOfNames diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx index b92039de4142..d1a1d0ed81fc 100644 --- a/extensions/source/ole/oleobjw.hxx +++ b/extensions/source/ole/oleobjw.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_OLE_OLEOBJW_HXX -#define INCLUDED_EXTENSIONS_SOURCE_OLE_OLEOBJW_HXX +#pragma once #include "ole2uno.hxx" #include "wincrap.hxx" @@ -42,12 +41,11 @@ #include "unoconversionutilities.hxx" #include "windata.hxx" using namespace cppu; -using namespace std; using namespace com::sun::star::lang; using namespace com::sun::star::bridge; using namespace com::sun::star::bridge::oleautomation; -typedef std::unordered_map<OUString, pair<DISPID, unsigned short>> DispIdMap; +typedef std::unordered_map<OUString, std::pair<DISPID, unsigned short>> DispIdMap; typedef std::unordered_multimap<OUString, unsigned int> TLBFuncIndexMap; @@ -243,6 +241,4 @@ protected: bool m_bHasDfltProperty; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/olethread.cxx b/extensions/source/ole/olethread.cxx index 74d7346516c5..503f8bc096c1 100644 --- a/extensions/source/ole/olethread.cxx +++ b/extensions/source/ole/olethread.cxx @@ -23,8 +23,6 @@ #include <osl/thread.hxx> #include <sal/log.hxx> -using namespace std; - void o2u_attachCurrentThread() { static osl::ThreadData oleThreadData; @@ -36,14 +34,17 @@ void o2u_attachCurrentThread() { // FIXME: is it a problem that this ends up in STA currently? assert(RPC_E_CHANGED_MODE == hr); // Let's find out explicitly what apartment mode we are in. - SAL_WARN("extensions.olebridge", "CoInitializeEx failed" - << (hr == RPC_E_CHANGED_MODE ? " (expectedly)" : "") - << ": " << WindowsErrorStringFromHRESULT(hr)); + if (hr == RPC_E_CHANGED_MODE) + SAL_INFO("extensions.olebridge", "CoInitializeEx failed (expectedly): " + << WindowsErrorStringFromHRESULT(hr)); + else + SAL_WARN("extensions.olebridge", + "CoInitializeEx failed: " << WindowsErrorStringFromHRESULT(hr)); APTTYPE nAptType; APTTYPEQUALIFIER nAptTypeQualifier; if (SUCCEEDED(CoGetApartmentType(&nAptType, &nAptTypeQualifier))) { - SAL_WARN("extensions.olebridge", + SAL_INFO("extensions.olebridge", " Thread is in a " << (nAptType == APTTYPE_STA ? OUString("single-threaded") : (nAptType == APTTYPE_MTA ? OUString("multi-threaded") : diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx index 1f14fa01032d..0c3920ccca11 100644 --- a/extensions/source/ole/servprov.cxx +++ b/extensions/source/ole/servprov.cxx @@ -33,6 +33,7 @@ #include <cppuhelper/supportsservice.hxx> #include <o3tl/any.hxx> #include <o3tl/char16_t2wchar_t.hxx> +#include <officecfg/Office/Common.hxx> #include <ooo/vba/XHelperInterface.hpp> #include <sal/log.hxx> @@ -137,17 +138,19 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP_(ULONG) OneInstanceOleWrapper::Release() return refCount; } -COM_DECLSPEC_NOTHROW STDMETHODIMP OneInstanceOleWrapper::CreateInstance(IUnknown FAR* punkOuter, - REFIID riid, - void FAR* FAR* ppv) +COM_DECLSPEC_NOTHROW STDMETHODIMP OneInstanceOleWrapper::CreateInstance(IUnknown*, + REFIID riid, void** ppv) { comphelper::Automation::AutomationInvokedZone aAutomationActive; SAL_INFO("extensions.olebridge", "OneInstanceOleWrapper::CreateInstance(" << riid << ")"); - HRESULT ret = ResultFromScode(E_UNEXPECTED); - punkOuter = nullptr; + if (officecfg::Office::Common::Security::Scripting::DisableOLEAutomation::get()) + { + return ResultFromScode(E_NOINTERFACE); + } + HRESULT ret = ResultFromScode(E_UNEXPECTED); const Reference<XInterface>& xInst = m_xInstFunction(); if (xInst.is()) { @@ -307,8 +310,7 @@ css::uno::Sequence<OUString> OleConverter::getSupportedServiceNames() "com.sun.star.bridge.OleBridgeSupplier2", "com.sun.star.bridge.oleautomation.BridgeSupplier"}; } - return css::uno::Sequence<OUString>{ - "com.sun.star.bridge.OleBridgeSupplierVar1"}; + return {"com.sun.star.bridge.OleBridgeSupplierVar1"}; } // XInitialize ------------------------------------------------------------------------------ diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx index 57debb03779a..8871f28cf7a0 100644 --- a/extensions/source/ole/servprov.hxx +++ b/extensions/source/ole/servprov.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_OLE_SERVPROV_HXX -#define INCLUDED_EXTENSIONS_SOURCE_OLE_SERVPROV_HXX +#pragma once #include <functional> @@ -31,7 +30,6 @@ using namespace com::sun::star::bridge; using namespace cppu; -using namespace std; /// @throws Exception Reference< XInterface> ConverterProvider_CreateInstance2( const Reference<XMultiServiceFactory> & xSMgr); @@ -70,7 +68,7 @@ public: STDMETHOD_(ULONG, Release)() override; /* IClassFactory methods */ - STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv) override; + STDMETHOD(CreateInstance)(IUnknown* punkOuter, REFIID riid, void** ppv) override; STDMETHOD(LockServer)(BOOL fLock) override; protected: @@ -177,12 +175,10 @@ public: protected: bool provideInstance(std::function<const Reference<XInterface>()> xInstFunction, GUID const * guid); - list< OneInstanceOleWrapper* > m_wrapperList; + std::list< OneInstanceOleWrapper* > m_wrapperList; Reference< XBridgeSupplier2 > m_bridgeSupplier; Reference<XMultiServiceFactory> m_smgr; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index c1616edc1111..a73a714abe55 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_OLE_UNOCONVERSIONUTILITIES_HXX -#define INCLUDED_EXTENSIONS_SOURCE_OLE_UNOCONVERSIONUTILITIES_HXX +#pragma once #include <memory> #include <com/sun/star/script/CannotConvertException.hpp> @@ -406,7 +405,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, { try { - Any anySeq = makeAny(unoSeq); + Any anySeq(unoSeq); Any convAny = conv->convertTo(anySeq, ptype); rAny = convAny; } @@ -1281,7 +1280,7 @@ void UnoConversionUtilities<T>::getElementCountAndTypeOfSequence( const Any& rS { sal_Int32 dimCount= (*static_cast<uno_Sequence* const *>(rSeq.getValue()))->nElements; if( dimCount > seqElementCounts[ dim-1]) - seqElementCounts[ dim-1]= dimCount; + seqElementCounts.getArray()[ dim-1]= dimCount; // we need the element type to construct the any that is // passed into getElementCountAndTypeOfSequence again @@ -1563,7 +1562,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny if (!getType(sName, type)) { throw CannotConvertException( - OUStringLiteral(u"[automation bridge]UnoConversionUtilities<T>::variantToAny \n" + OUString::Concat("[automation bridge]UnoConversionUtilities<T>::variantToAny \n" "A UNO type with the name: ") + o3tl::toU(LPCOLESTR(sName)) + "does not exist!", nullptr, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0); @@ -2109,7 +2108,6 @@ template<class T> Sequence<Any> UnoConversionUtilities<T>::createOleArrayWrapperOfDim(SAFEARRAY* pArray, unsigned int dimCount, unsigned int actDim, LONG* index, VARTYPE type, const Type& unotype) { - HRESULT hr= S_OK; LONG lBound; LONG uBound; LONG nCountElements; @@ -2159,7 +2157,7 @@ Sequence<Any> UnoConversionUtilities<T>::createOleArrayWrapperOfDim(SAFEARRAY* p SafeArrayGetElement(pArray, index, &V_DATE(&variant)); break; case VT_BSTR: - hr= SafeArrayGetElement(pArray, index, &V_BSTR(&variant)); + SafeArrayGetElement(pArray, index, &V_BSTR(&variant)); break; case VT_DISPATCH: SafeArrayGetElement(pArray, index, &V_DISPATCH(&variant)); @@ -2333,11 +2331,12 @@ Sequence<Type> UnoConversionUtilities<T>::getImplementedInterfaces(IUnknown* pUn if( anyNames >>= seqAny) { seqTypes.realloc( seqAny.getLength()); + auto pseqTypes = seqTypes.getArray(); for( sal_Int32 i=0; i < seqAny.getLength(); i++) { OUString typeName; seqAny[i] >>= typeName; - seqTypes[i]= Type( TypeClass_INTERFACE, typeName); + pseqTypes[i]= Type( TypeClass_INTERFACE, typeName); } } } @@ -2361,6 +2360,4 @@ Reference<XTypeConverter> UnoConversionUtilities<T>::getTypeConverter() return m_typeConverter; } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index ad411479401b..915ecd92f8fc 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -41,7 +41,6 @@ #pragma clang diagnostic ignored "-Winvalid-noreturn" #pragma clang diagnostic ignored "-Wmicrosoft" #pragma clang diagnostic ignored "-Wnon-pod-varargs" -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" #pragma clang diagnostic ignored "-Wnonportable-include-path" #pragma clang diagnostic ignored "-Wsequence-point" #pragma clang diagnostic ignored "-Wtypename-missing" @@ -57,13 +56,9 @@ #include <salhelper/simplereferenceobject.hxx> #include <rtl/ref.hxx> #include <rtl/ustring.hxx> -#include <tools/diagnose_ex.h> #include <sal/log.hxx> #include <com/sun/star/beans/MethodConcept.hpp> #include <com/sun/star/beans/PropertyConcept.hpp> -#include <com/sun/star/frame/Desktop.hpp> -#include <com/sun/star/frame/TerminationVetoException.hpp> -#include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/lang/NoSuchMethodException.hpp> #include <com/sun/star/script/CannotConvertException.hpp> #include <com/sun/star/script/FailReason.hpp> @@ -86,7 +81,6 @@ #include <osl/interlck.h> #include <com/sun/star/uno/genfunc.h> #include <comphelper/automationinvokedzone.hxx> -#include <comphelper/asyncquithandler.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/profilezone.hxx> #include <comphelper/windowsdebugoutput.hxx> @@ -101,7 +95,6 @@ #include "unoobjw.hxx" #include "servprov.hxx" -using namespace std; using namespace osl; using namespace cppu; using namespace com::sun::star::uno; @@ -117,65 +110,6 @@ static bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource); static bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource); static HRESULT mapCannotConvertException(const CannotConvertException &e, unsigned int * puArgErr); -namespace { - -class TerminationVetoer : public WeakImplHelper<css::frame::XTerminateListener> -{ -public: - int mnCount; - -private: - TerminationVetoer() - : mnCount(0) - { - try - { - Reference< css::frame::XDesktop > xDesktop = - css::frame::Desktop::create( comphelper::getProcessComponentContext() ); - xDesktop->addTerminateListener( this ); - } - catch ( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION("extensions.olebridge"); - } - } - -public: - static rtl::Reference< TerminationVetoer > get() - { - static TerminationVetoer* pInstance = new TerminationVetoer; - static rtl::Reference< TerminationVetoer > aInstance( pInstance ); - - return aInstance; - } - - // XTerminateListener - void SAL_CALL queryTermination( const EventObject& ) override - { - SAL_INFO("extensions.olebridge", "TerminationVetoer::queryTermination: count=" << mnCount); - // Always veto termination while an OLE object is active, except if it is an OLE object that - // has asked us to quit. - if (!AsyncQuitHandler::instance().IsForceQuit() && mnCount > 0) - { - SAL_INFO("extensions.olebridge", "TerminationVetoer::queryTermination: Throwing!"); - throw css::frame::TerminationVetoException(); - } - } - - void SAL_CALL notifyTermination( const EventObject& ) override - { - // ??? - } - - // XEventListener - void SAL_CALL disposing( const css::lang::EventObject& ) override - { - // ??? - } -}; - -} - /* Does not throw any exceptions. Param pInfo can be NULL. */ @@ -194,8 +128,6 @@ InterfaceOleWrapper::InterfaceOleWrapper( Reference<XMultiServiceFactory> const UnoConversionUtilities<InterfaceOleWrapper>( xFactory, unoWrapperClass, comWrapperClass), m_defaultValueType( 0) { - TerminationVetoer::get()->mnCount++; - SAL_INFO("extensions.olebridge", "InterfaceOleWrapper CTOR, count=" << TerminationVetoer::get()->mnCount); } InterfaceOleWrapper::~InterfaceOleWrapper() @@ -205,9 +137,6 @@ InterfaceOleWrapper::~InterfaceOleWrapper() auto it = UnoObjToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(m_xOrigin.get())); if(it != UnoObjToWrapperMap.end()) UnoObjToWrapperMap.erase(it); - - TerminationVetoer::get()->mnCount--; - SAL_INFO("extensions.olebridge", "InterfaceOleWrapper DTOR, count=" << TerminationVetoer::get()->mnCount); } COM_DECLSPEC_NOTHROW STDMETHODIMP InterfaceOleWrapper::QueryInterface(REFIID riid, void ** ppv) @@ -1571,7 +1500,7 @@ Any SAL_CALL InterfaceOleWrapper::createBridge(const Any& modelDepObject, if( pVar) { pVar->vt= VT_DISPATCH; - pVar->pdispVal= static_cast<IDispatch*>( this); + pVar->pdispVal= this; AddRef(); retAny<<= reinterpret_cast< sal_uIntPtr >( pVar); @@ -1732,7 +1661,7 @@ static bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource) else { // variantarg and variant must have same type - if ((V_VT(pDest) & oleTypeFlags) == oleTypeFlags) + if ((V_VT(pDest) & oleTypeFlags) == oleTypeFlags) { if ((oleTypeFlags & VT_ARRAY) != 0) { @@ -1888,7 +1817,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP InterfaceOleWrapper::Invoke(DISPID dispidMembe sParams += ","; std::stringstream aStringStream; aStringStream << pdispparams->rgvarg[i]; - sParams += OUString::createFromAscii(aStringStream.str().c_str()); + sParams += OUString::createFromAscii(aStringStream.str()); } sParams += "]"; #endif @@ -2396,6 +2325,7 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments ) aMethods.getLength() > 0); int nMemId = 1; + auto ArgumentsRange = asNonConstRange(Arguments); // Skip the three XInterface methods for (int i = 3; i < aMethods.getLength(); i++) { @@ -2444,9 +2374,7 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments ) aDispParams.rgvarg[j].vt |= VT_BYREF; break; case VT_BOOL: - // SAL_ DEBUG("===> VT_BOOL is initially " << (int)aDispParams.rgvarg[j].boolVal); aDispParams.rgvarg[j].byref = new VARIANT_BOOL(aDispParams.rgvarg[j].boolVal); - // SAL_ DEBUG(" byref=" << aDispParams.rgvarg[j].byref); aDispParams.rgvarg[j].vt |= VT_BYREF; break; default: @@ -2489,21 +2417,21 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments ) case VT_BYREF|VT_I2: { SHORT *pI = static_cast<SHORT*>(aDispParams.rgvarg[j].byref); - Arguments[nIncomingArgIndex] <<= static_cast<sal_Int16>(*pI); + ArgumentsRange[nIncomingArgIndex] <<= static_cast<sal_Int16>(*pI); delete pI; } break; case VT_BYREF|VT_I4: { LONG *pL = static_cast<LONG*>(aDispParams.rgvarg[j].byref); - Arguments[nIncomingArgIndex] <<= static_cast<sal_Int32>(*pL); + ArgumentsRange[nIncomingArgIndex] <<= static_cast<sal_Int32>(*pL); delete pL; } break; case VT_BYREF|VT_BSTR: { BSTR *pBstr = static_cast<BSTR*>(aDispParams.rgvarg[j].byref); - Arguments[nIncomingArgIndex] <<= OUString(o3tl::toU(*pBstr)); + ArgumentsRange[nIncomingArgIndex] <<= OUString(o3tl::toU(*pBstr)); // Undo SysAllocString() done in anyToVariant() SysFreeString(*pBstr); delete pBstr; @@ -2512,8 +2440,7 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments ) case VT_BYREF|VT_BOOL: { VARIANT_BOOL *pBool = static_cast<VARIANT_BOOL*>(aDispParams.rgvarg[j].byref); - // SAL_ DEBUG("===> VT_BOOL: byref is now " << aDispParams.rgvarg[j].byref << ", " << (int)*pBool); - Arguments[nIncomingArgIndex] <<= (*pBool != VARIANT_FALSE); + ArgumentsRange[nIncomingArgIndex] <<= (*pBool != VARIANT_FALSE); delete pBool; } break; @@ -2832,7 +2759,7 @@ HRESULT InterfaceOleWrapper::InvokeGeneral( DISPID dispidMember, unsigned short if( m_defaultValueType == VT_DISPATCH) { pvarResult->vt= VT_DISPATCH; - pvarResult->pdispVal= static_cast<IDispatch*>( this); + pvarResult->pdispVal= this; AddRef(); ret= S_OK; } @@ -2899,7 +2826,7 @@ HRESULT InterfaceOleWrapper::InvokeGeneral( DISPID dispidMember, unsigned short Type type; if (!getType(arg.bstrVal, type)) { - writeExcepinfo(pexcepinfo, OUStringLiteral(u"[automation bridge] A UNO type with the name ") + + writeExcepinfo(pexcepinfo, OUString::Concat("[automation bridge] A UNO type with the name ") + o3tl::toU(arg.bstrVal) + " does not exist!"); return DISP_E_EXCEPTION; } @@ -3164,7 +3091,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP UnoObjectWrapperRemoteOpt::GetIDsOfNames ( RE { // name has not been bad before( member exists typedef NameToIdMap::iterator ITnames; - pair< ITnames, bool > pair_id= m_nameToDispIdMap.emplace(name, m_currentId++); + std::pair< ITnames, bool > pair_id= m_nameToDispIdMap.emplace(name, m_currentId++); // new ID inserted ? if( pair_id.second ) {// yes, now create MemberInfo and ad to IdToMemberInfoMap diff --git a/extensions/source/ole/unoobjw.hxx b/extensions/source/ole/unoobjw.hxx index 603027fccdbf..845724d819ae 100644 --- a/extensions/source/ole/unoobjw.hxx +++ b/extensions/source/ole/unoobjw.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_OLE_UNOOBJW_HXX -#define INCLUDED_EXTENSIONS_SOURCE_OLE_UNOOBJW_HXX +#pragma once #include <com/sun/star/bridge/XBridgeSupplier2.hpp> #include <com/sun/star/beans/XExactName.hpp> @@ -41,7 +40,6 @@ #define DISPID_GET_STRUCT_FUNC -102 #define DISPID_CREATE_TYPE_FUNC -103 -using namespace std; using namespace cppu; using namespace com::sun::star::bridge; using namespace com::sun::star::script; @@ -197,7 +195,7 @@ protected: Reference<XExactName> m_xExactName; Reference<XInterface> m_xOrigin; NameToIdMap m_nameToDispIdMap; - vector<MemberInfo> m_MemberInfos; + std::vector<MemberInfo> m_MemberInfos; // This member is used to determine the default value // denoted by DISPID_VALUE (0). For proper results in JavaScript // we have to return the default value when we write an object @@ -267,6 +265,4 @@ protected: }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/unotypewrapper.hxx b/extensions/source/ole/unotypewrapper.hxx index 89e3dea432c3..a7515448c92f 100644 --- a/extensions/source/ole/unotypewrapper.hxx +++ b/extensions/source/ole/unotypewrapper.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_OLE_UNOTYPEWRAPPER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_OLE_UNOTYPEWRAPPER_HXX +#pragma once #include "wincrap.hxx" @@ -79,6 +78,4 @@ public: CComBSTR m_sName; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/wincrap.hxx b/extensions/source/ole/wincrap.hxx index 7bef1b12b7dd..3c8417cf929a 100644 --- a/extensions/source/ole/wincrap.hxx +++ b/extensions/source/ole/wincrap.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_OLE_WINCRAP_HXX -#define INCLUDED_EXTENSIONS_SOURCE_OLE_WINCRAP_HXX +#pragma once /* wrap all includes that need to be wrapped by prewin.h/postwin.h here */ @@ -44,7 +43,6 @@ #pragma clang diagnostic ignored "-Winvalid-noreturn" #pragma clang diagnostic ignored "-Wmicrosoft" #pragma clang diagnostic ignored "-Wnon-pod-varargs" -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" #endif // from oleobjw.hxx @@ -62,6 +60,4 @@ extern CComModule _Module; #include <postwin.h> -#endif // INCLUDED_EXTENSIONS_SOURCE_OLE_WINCRAP_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/windata.hxx b/extensions/source/ole/windata.hxx index ed673c465dc8..d9c4cb31436d 100644 --- a/extensions/source/ole/windata.hxx +++ b/extensions/source/ole/windata.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_OLE_WINDATA_HXX -#define INCLUDED_EXTENSIONS_SOURCE_OLE_WINDATA_HXX +#pragma once #include <oleidl.h> @@ -30,7 +29,6 @@ #pragma clang diagnostic ignored "-Winvalid-noreturn" #pragma clang diagnostic ignored "-Wmicrosoft" #pragma clang diagnostic ignored "-Wnon-pod-varargs" -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" #endif #include <atlbase.h> @@ -175,7 +173,7 @@ public: { OSL_ASSERT(pTypeInfo); } - ~TypeAttr() throw() + ~TypeAttr() noexcept { if (m_pTypeAttr != nullptr) { @@ -183,17 +181,15 @@ public: } } - TYPEATTR** operator&() throw() + TYPEATTR** operator&() noexcept { return &m_pTypeAttr; } - TYPEATTR* operator->() throw() + TYPEATTR* operator->() noexcept { return m_pTypeAttr; } }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx index 5f38856fc9c4..4f4e6d9a97f1 100644 --- a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx +++ b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx @@ -28,7 +28,6 @@ namespace pcr using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; MasterDetailLinkDialog::MasterDetailLinkDialog(const Reference< XComponentContext >& _rxContext ) diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.hxx b/extensions/source/propctrlr/MasterDetailLinkDialog.hxx index f196c755c093..97911436a1e6 100644 --- a/extensions/source/propctrlr/MasterDetailLinkDialog.hxx +++ b/extensions/source/propctrlr/MasterDetailLinkDialog.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_PROPCTRLR_MASTERDETAILLINKDIALOG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_MASTERDETAILLINKDIALOG_HXX +#pragma once #include <comphelper/proparrhlp.hxx> #include <svtools/genericunodialog.hxx> @@ -65,6 +64,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_MASTERDETAILLINKDIALOG_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx index 5f185c594243..f4619000dcf8 100644 --- a/extensions/source/propctrlr/browserline.cxx +++ b/extensions/source/propctrlr/browserline.cxx @@ -25,9 +25,11 @@ #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/string.hxx> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> +#include <utility> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> @@ -41,19 +43,17 @@ namespace pcr using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::inspection::XPropertyControl; using ::com::sun::star::inspection::XPropertyControlContext; - using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::Exception; using ::com::sun::star::graphic::GraphicProvider; using ::com::sun::star::graphic::XGraphicProvider; using ::com::sun::star::uno::Sequence; - using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::graphic::XGraphic; namespace PropertyLineElement = ::com::sun::star::inspection::PropertyLineElement; - OBrowserLine::OBrowserLine(const OUString& rEntryName, weld::Container* pParent, weld::SizeGroup* pLabelGroup, + OBrowserLine::OBrowserLine(OUString aEntryName, weld::Container* pParent, weld::SizeGroup* pLabelGroup, weld::Container* pInitialControlParent) - : m_sEntryName(rEntryName) + : m_sEntryName(std::move(aEntryName)) , m_xBuilder(Application::CreateBuilder(pParent, "modules/spropctrlr/ui/browserline.ui")) , m_xContainer(m_xBuilder->weld_container("BrowserLine")) , m_xFtTitle(m_xBuilder->weld_label("label")) @@ -88,7 +88,7 @@ namespace pcr } } - void OBrowserLine::SetComponentHelpIds(const OString& rHelpId) + void OBrowserLine::SetComponentHelpIds(const OUString& rHelpId) { if (m_pControlWindow) m_pControlWindow->set_help_id(rHelpId); @@ -178,7 +178,7 @@ namespace pcr OUStringBuffer aText(m_xFtTitle->get_label()); int n10DotsWidth = m_xFtTitle->get_pixel_size("..........").Width(); - int nTextWidth = m_xFtTitle->get_pixel_size(aText.toString()).Width(); + int nTextWidth = m_xFtTitle->get_pixel_size(OUString::unacquired(aText)).Width(); int nDiff = m_nNameWidth - nTextWidth; int nExtraChars = (nDiff * 10) / n10DotsWidth; for (int i = 0; i < nExtraChars; ++i) @@ -188,7 +188,7 @@ namespace pcr if (AllSettings::GetLayoutRTL()) { sal_Unicode const cRTL_mark = 0x200F; - aText.append( OUString(cRTL_mark) ); + aText.append( cRTL_mark ); } m_xFtTitle->set_label(aText.makeStringAndClear()); @@ -314,9 +314,7 @@ namespace pcr Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); Reference< XGraphicProvider > xGraphicProvider( GraphicProvider::create(xContext) ); - Sequence< PropertyValue > aMediaProperties(1); - aMediaProperties[0].Name = "URL"; - aMediaProperties[0].Value <<= rImageURL; + Sequence aMediaProperties{ comphelper::makePropertyValue("URL", rImageURL) }; xGraphic = Reference<XGraphic>(xGraphicProvider->queryGraphic(aMediaProperties), css::uno::UNO_SET_THROW); } @@ -346,6 +344,7 @@ namespace pcr if (m_pBrowseButton) { m_pBrowseButton->hide(); + m_pBrowseButton->connect_focus_in(Link<weld::Widget&, void>()); m_pBrowseButton = nullptr; } } @@ -354,6 +353,7 @@ namespace pcr if (m_pAdditionalBrowseButton) { m_pAdditionalBrowseButton->hide(); + m_pAdditionalBrowseButton->connect_focus_in(Link<weld::Widget&, void>()); m_pAdditionalBrowseButton = nullptr; } } diff --git a/extensions/source/propctrlr/browserline.hxx b/extensions/source/propctrlr/browserline.hxx index 346904415682..dfde2969f41f 100644 --- a/extensions/source/propctrlr/browserline.hxx +++ b/extensions/source/propctrlr/browserline.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERLINE_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERLINE_HXX +#pragma once #include <com/sun/star/inspection/XPropertyControl.hpp> #include <vcl/weld.hxx> @@ -69,7 +68,7 @@ namespace pcr bool m_bReadOnly; public: - OBrowserLine(const OUString& rEntryName, weld::Container* pParent, weld::SizeGroup* pLabelGroup, + OBrowserLine(OUString aEntryName, weld::Container* pParent, weld::SizeGroup* pLabelGroup, weld::Container* pInitialControlParent); ~OBrowserLine(); @@ -85,7 +84,7 @@ namespace pcr const OUString& GetEntryName() const { return m_sEntryName; } - void SetComponentHelpIds(const OString& rHelpId); + void SetComponentHelpIds(const OUString& rHelpId); void SetTitle(const OUString& rString ); void FullFillTitleString(); @@ -125,6 +124,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERLINE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index b30f4f3eeee5..b48fc7fa227e 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/inspection/PropertyControlType.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <comphelper/asyncnotification.hxx> #include <cppuhelper/implbase.hxx> #include <vcl/svapp.hxx> @@ -152,8 +152,8 @@ namespace pcr */ void setNotificationMode( NotificationMode _eMode ); - virtual void SAL_CALL acquire() throw() override; - virtual void SAL_CALL release() throw() override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; protected: virtual ~PropertyControlContext_Impl() override; @@ -251,12 +251,12 @@ namespace pcr impl_notify_throw( CurrentControl, ACTIVATE_NEXT ); } - void SAL_CALL PropertyControlContext_Impl::acquire() throw() + void SAL_CALL PropertyControlContext_Impl::acquire() noexcept { PropertyControlContext_Impl_Base::acquire(); } - void SAL_CALL PropertyControlContext_Impl::release() throw() + void SAL_CALL PropertyControlContext_Impl::release() noexcept { PropertyControlContext_Impl_Base::release(); } @@ -736,7 +736,7 @@ namespace pcr xControl = rLine.pLine->getControl(); if ( xControl.is() ) - xControl->setControlContext( m_pControlContextImpl.get() ); + xControl->setControlContext( m_pControlContextImpl ); // the initial property value if ( rPropertyData.bUnknownValue ) diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx index 67cc5286f245..fc1f35541208 100644 --- a/extensions/source/propctrlr/browserlistbox.hxx +++ b/extensions/source/propctrlr/browserlistbox.hxx @@ -17,13 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERLISTBOX_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERLISTBOX_HXX +#pragma once #include "browserline.hxx" #include <com/sun/star/inspection/XPropertyControl.hpp> #include <com/sun/star/inspection/XPropertyHandler.hpp> +#include <utility> #include <vcl/weld.hxx> #include <rtl/ref.hxx> @@ -54,10 +54,10 @@ namespace pcr css::uno::Reference< css::inspection::XPropertyHandler > xHandler; - ListBoxLine( const OUString& rName, const BrowserLinePointer& _pLine, const css::uno::Reference< css::inspection::XPropertyHandler >& _rxHandler ) - : aName( rName ), - pLine( _pLine ), - xHandler( _rxHandler ) + ListBoxLine( OUString _aName, BrowserLinePointer _pLine, css::uno::Reference< css::inspection::XPropertyHandler > _xHandler ) + : aName(std::move( _aName )), + pLine(std::move( _pLine )), + xHandler(std::move( _xHandler )) { } }; @@ -160,7 +160,5 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERLISTBOX_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserpage.hxx b/extensions/source/propctrlr/browserpage.hxx index 6ac48fd221aa..5f9220a7961f 100644 --- a/extensions/source/propctrlr/browserpage.hxx +++ b/extensions/source/propctrlr/browserpage.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERPAGE_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERPAGE_HXX +#pragma once #include <o3tl/deleter.hxx> #include "browserlistbox.hxx" @@ -38,7 +37,7 @@ namespace pcr explicit OBrowserPage(weld::Container* pParent, weld::Container* pContainer); ~OBrowserPage(); - void SetHelpId(const OString& rHelpId) { m_xContainer->set_help_id(rHelpId); } + void SetHelpId(const OUString& rHelpId) { m_xContainer->set_help_id(rHelpId); } OBrowserListBox& getListBox() { return *m_xListBox; } const OBrowserListBox& getListBox() const { return *m_xListBox; } @@ -59,6 +58,4 @@ namespace pcr }; } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERPAGE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserview.cxx b/extensions/source/propctrlr/browserview.cxx index df0c6693b9bd..3be48abe41a2 100644 --- a/extensions/source/propctrlr/browserview.cxx +++ b/extensions/source/propctrlr/browserview.cxx @@ -35,9 +35,9 @@ namespace pcr m_xPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation)); } - IMPL_LINK_NOARG(OPropertyBrowserView, OnPageActivation, LinkParamNone*, void) + IMPL_LINK(OPropertyBrowserView, OnPageActivation, const OUString&, rNewPage, void) { - m_nActivePage = m_xPropBox->GetCurPage(); + m_nActivePage = rNewPage.toUInt32(); m_aPageActivationHandler.Call(nullptr); } diff --git a/extensions/source/propctrlr/browserview.hxx b/extensions/source/propctrlr/browserview.hxx index 9ac3de1480b6..d64039813757 100644 --- a/extensions/source/propctrlr/browserview.hxx +++ b/extensions/source/propctrlr/browserview.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERVIEW_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERVIEW_HXX +#pragma once #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -49,11 +48,9 @@ namespace pcr css::awt::Size getMinimumSize() const; private: - DECL_LINK(OnPageActivation, LinkParamNone*, void); + DECL_LINK(OnPageActivation, const OUString&, void); }; } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BROWSERVIEW_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/buttonnavigationhandler.cxx b/extensions/source/propctrlr/buttonnavigationhandler.cxx index dc5b8d521c94..43ed02a952d6 100644 --- a/extensions/source/propctrlr/buttonnavigationhandler.cxx +++ b/extensions/source/propctrlr/buttonnavigationhandler.cxx @@ -29,10 +29,7 @@ namespace pcr using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::frame; using namespace ::com::sun::star::inspection; ButtonNavigationHandler::ButtonNavigationHandler( const Reference< XComponentContext >& _rxContext ) @@ -183,9 +180,7 @@ namespace pcr Sequence< OUString > SAL_CALL ButtonNavigationHandler::getActuatingProperties( ) { - Sequence< OUString > aActuating( 2 ); - aActuating[0] = PROPERTY_BUTTONTYPE; - aActuating[1] = PROPERTY_TARGET_URL; + Sequence< OUString > aActuating{ PROPERTY_BUTTONTYPE, PROPERTY_TARGET_URL }; return aActuating; } diff --git a/extensions/source/propctrlr/buttonnavigationhandler.hxx b/extensions/source/propctrlr/buttonnavigationhandler.hxx index 86a60c6ea75d..c5e01e1df293 100644 --- a/extensions/source/propctrlr/buttonnavigationhandler.hxx +++ b/extensions/source/propctrlr/buttonnavigationhandler.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BUTTONNAVIGATIONHANDLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BUTTONNAVIGATIONHANDLER_HXX +#pragma once #include "propertyhandler.hxx" @@ -69,6 +68,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_BUTTONNAVIGATIONHANDLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/cellbindinghandler.cxx b/extensions/source/propctrlr/cellbindinghandler.cxx index d73d8cfeeb8a..bd1628192eb8 100644 --- a/extensions/source/propctrlr/cellbindinghandler.cxx +++ b/extensions/source/propctrlr/cellbindinghandler.cxx @@ -27,7 +27,7 @@ #include <com/sun/star/table/CellAddress.hpp> #include <com/sun/star/inspection/XObjectInspectorUI.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr @@ -38,7 +38,6 @@ namespace pcr using namespace ::com::sun::star::table; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::inspection; using namespace ::com::sun::star::form::binding; @@ -81,10 +80,9 @@ namespace pcr Sequence< OUString > SAL_CALL CellBindingPropertyHandler::getActuatingProperties( ) { - Sequence< OUString > aInterestingProperties( 3 ); - aInterestingProperties[0] = PROPERTY_LIST_CELL_RANGE; - aInterestingProperties[1] = PROPERTY_BOUND_CELL; - aInterestingProperties[2] = PROPERTY_CONTROLSOURCE; + Sequence< OUString > aInterestingProperties{ PROPERTY_LIST_CELL_RANGE, + PROPERTY_BOUND_CELL, + PROPERTY_CONTROLSOURCE }; return aInterestingProperties; } @@ -130,7 +128,7 @@ namespace pcr // ensure that the "transfer selection as" property is reset. Since we can't remember // it at the object itself, but derive it from the binding only, we have to normalize // it now that there *is* no binding anymore. - setPropertyValue( PROPERTY_CELL_EXCHANGE_TYPE, makeAny( sal_Int16(0) ) ); + setPropertyValue( PROPERTY_CELL_EXCHANGE_TYPE, Any( sal_Int16(0) ) ); } } break; @@ -157,8 +155,8 @@ namespace pcr { if ( !xSource.is() ) { - setPropertyValue( PROPERTY_STRINGITEMLIST, makeAny( Sequence< OUString >() ) ); - setPropertyValue( PROPERTY_TYPEDITEMLIST, makeAny( Sequence< Any >() ) ); + setPropertyValue( PROPERTY_STRINGITEMLIST, Any( Sequence< OUString >() ) ); + setPropertyValue( PROPERTY_TYPEDITEMLIST, Any( Sequence< Any >() ) ); } } catch( const Exception& ) diff --git a/extensions/source/propctrlr/cellbindinghandler.hxx b/extensions/source/propctrlr/cellbindinghandler.hxx index 7e247e28a9b3..4e81b0624b8e 100644 --- a/extensions/source/propctrlr/cellbindinghandler.hxx +++ b/extensions/source/propctrlr/cellbindinghandler.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_CELLBINDINGHANDLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_CELLBINDINGHANDLER_HXX +#pragma once #include "propertyhandler.hxx" @@ -90,6 +89,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_CELLBINDINGHANDLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/cellbindinghelper.cxx b/extensions/source/propctrlr/cellbindinghelper.cxx index 4b93d048ddaa..bd2c6d41989c 100644 --- a/extensions/source/propctrlr/cellbindinghelper.cxx +++ b/extensions/source/propctrlr/cellbindinghelper.cxx @@ -32,10 +32,11 @@ #include <com/sun/star/sheet/XSpreadsheet.hpp> #include <unotools/transliterationwrapper.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include "formstrings.hxx" #include <algorithm> +#include <utility> namespace pcr @@ -51,7 +52,6 @@ namespace pcr using namespace ::com::sun::star::table; using namespace ::com::sun::star::form; using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::form::binding; namespace @@ -63,7 +63,7 @@ namespace pcr OUString m_sReference; public: - explicit StringCompare( const OUString& _rReference ) : m_sReference( _rReference ) { } + explicit StringCompare( OUString _aReference ) : m_sReference(std::move( _aReference )) { } bool operator()( std::u16string_view _rCompare ) { @@ -146,7 +146,7 @@ namespace pcr Any aAddress; return doConvertAddressRepresentations( PROPERTY_UI_REPRESENTATION, - makeAny( _rAddressDescription ), + Any( _rAddressDescription ), PROPERTY_ADDRESS, aAddress, false @@ -162,7 +162,7 @@ namespace pcr Reference< XPropertySet > xConverter( createDocumentDependentInstance( - _bIsRange ? OUString(SERVICE_RANGEADDRESS_CONVERSION) : OUString(SERVICE_ADDRESS_CONVERSION), + _bIsRange ? SERVICE_RANGEADDRESS_CONVERSION : SERVICE_ADDRESS_CONVERSION, OUString(), Any() ), @@ -174,7 +174,7 @@ namespace pcr try { Reference< XSpreadsheet > xSheet; - xConverter->setPropertyValue( PROPERTY_REFERENCE_SHEET, makeAny( static_cast<sal_Int32>(getControlSheetIndex( xSheet )) ) ); + xConverter->setPropertyValue( PROPERTY_REFERENCE_SHEET, Any( static_cast<sal_Int32>(getControlSheetIndex( xSheet )) ) ); xConverter->setPropertyValue( _rInputProperty, _rInputValue ); _rOutputValue = xConverter->getPropertyValue( _rOutputProperty ); bSuccess = true; @@ -195,7 +195,7 @@ namespace pcr Any aAddress; return doConvertAddressRepresentations( PROPERTY_UI_REPRESENTATION, - makeAny( _rAddressDescription ), + Any( _rAddressDescription ), PROPERTY_ADDRESS, aAddress, true @@ -207,9 +207,9 @@ namespace pcr Reference< XValueBinding > CellBindingHelper::createCellBindingFromAddress( const CellAddress& _rAddress, bool _bSupportIntegerExchange ) const { Reference< XValueBinding > xBinding( createDocumentDependentInstance( - _bSupportIntegerExchange ? OUString(SERVICE_SHEET_CELL_INT_BINDING) : OUString(SERVICE_SHEET_CELL_BINDING), + _bSupportIntegerExchange ? SERVICE_SHEET_CELL_INT_BINDING : SERVICE_SHEET_CELL_BINDING, PROPERTY_BOUND_CELL, - makeAny( _rAddress ) + Any( _rAddress ) ), UNO_QUERY ); return xBinding; @@ -244,7 +244,7 @@ namespace pcr xSource.set(createDocumentDependentInstance( SERVICE_SHEET_CELLRANGE_LISTSOURCE, PROPERTY_LIST_CELL_RANGE, - makeAny( aRangeAddress ) + Any( aRangeAddress ) ), css::uno::UNO_QUERY); return xSource; @@ -264,13 +264,7 @@ namespace pcr { if ( !_rArgumentName.isEmpty() ) { - NamedValue aArg; - aArg.Name = _rArgumentName; - aArg.Value = _rArgumentValue; - - Sequence< Any > aArgs( 1 ); - aArgs[ 0 ] <<= aArg; - + Sequence aArgs{ Any(NamedValue(_rArgumentName, _rArgumentValue)) }; xReturn = xDocumentFactory->createInstanceWithArguments( _rService, aArgs ); } else @@ -322,7 +316,7 @@ namespace pcr if ( getAddressFromCellBinding( _rxBinding, aAddress ) ) { Any aStringAddress; - doConvertAddressRepresentations( PROPERTY_ADDRESS, makeAny( aAddress ), + doConvertAddressRepresentations( PROPERTY_ADDRESS, Any( aAddress ), PROPERTY_UI_REPRESENTATION, aStringAddress, false ); aStringAddress >>= sAddress; @@ -351,7 +345,7 @@ namespace pcr xSourceProps->getPropertyValue( PROPERTY_LIST_CELL_RANGE ) >>= aRangeAddress; Any aStringAddress; - doConvertAddressRepresentations( PROPERTY_ADDRESS, makeAny( aRangeAddress ), + doConvertAddressRepresentations( PROPERTY_ADDRESS, Any( aRangeAddress ), PROPERTY_UI_REPRESENTATION, aStringAddress, true ); aStringAddress >>= sAddress; } @@ -375,15 +369,16 @@ namespace pcr Reference< XMultiServiceFactory > xDocumentFactory( m_xDocument, UNO_QUERY ); OSL_ENSURE( xDocumentFactory.is(), "CellBindingHelper::isSpreadsheetDocumentWhichSupplies: spreadsheet document, but no factory?" ); - Sequence< OUString > aAvailableServices; if ( xDocumentFactory.is() ) - aAvailableServices = xDocumentFactory->getAvailableServiceNames( ); + { + const Sequence<OUString> aAvailableServices = xDocumentFactory->getAvailableServiceNames( ); - bYesItIs = std::any_of( - aAvailableServices.begin(), - aAvailableServices.end(), - StringCompare( _rService ) - ); + bYesItIs = std::any_of( + aAvailableServices.begin(), + aAvailableServices.end(), + StringCompare( _rService ) + ); + } } return bYesItIs; @@ -477,19 +472,19 @@ namespace pcr bool CellBindingHelper::isCellBinding( const Reference< XValueBinding >& _rxBinding ) { - return doesComponentSupport( _rxBinding.get(), SERVICE_SHEET_CELL_BINDING ); + return doesComponentSupport( _rxBinding, SERVICE_SHEET_CELL_BINDING ); } bool CellBindingHelper::isCellIntegerBinding( const Reference< XValueBinding >& _rxBinding ) { - return doesComponentSupport( _rxBinding.get(), SERVICE_SHEET_CELL_INT_BINDING ); + return doesComponentSupport( _rxBinding, SERVICE_SHEET_CELL_INT_BINDING ); } bool CellBindingHelper::isCellRangeListSource( const Reference< XListEntrySource >& _rxSource ) { - return doesComponentSupport( _rxSource.get(), SERVICE_SHEET_CELLRANGE_LISTSOURCE ); + return doesComponentSupport( _rxSource, SERVICE_SHEET_CELLRANGE_LISTSOURCE ); } @@ -500,7 +495,6 @@ namespace pcr return bDoes; } - Reference< XValueBinding > CellBindingHelper::getCurrentBinding( ) const { Reference< XValueBinding > xBinding; @@ -510,17 +504,14 @@ namespace pcr return xBinding; } - Reference< XListEntrySource > CellBindingHelper::getCurrentListSource( ) const { - Reference< XListEntrySource > xSource; Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY ); - if ( xSink.is() ) - xSource = xSink->getListEntrySource(); - return xSource; + if (xSink.is()) + return xSink->getListEntrySource(); + return Reference<XListEntrySource>(); } - void CellBindingHelper::setBinding( const Reference< XValueBinding >& _rxBinding ) { Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY ); @@ -529,7 +520,6 @@ namespace pcr xBindable->setValueBinding( _rxBinding ); } - void CellBindingHelper::setListSource( const Reference< XListEntrySource >& _rxSource ) { Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY ); @@ -538,7 +528,6 @@ namespace pcr xSink->setListEntrySource( _rxSource ); } - } // namespace pcr diff --git a/extensions/source/propctrlr/cellbindinghelper.hxx b/extensions/source/propctrlr/cellbindinghelper.hxx index 0f1fb8b91fa6..a2c85cd65b58 100644 --- a/extensions/source/propctrlr/cellbindinghelper.hxx +++ b/extensions/source/propctrlr/cellbindinghelper.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_CELLBINDINGHELPER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_CELLBINDINGHELPER_HXX +#pragma once #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -270,6 +269,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_CELLBINDINGHELPER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/commoncontrol.cxx b/extensions/source/propctrlr/commoncontrol.cxx index 243bbd813b57..4f44f3e568ca 100644 --- a/extensions/source/propctrlr/commoncontrol.cxx +++ b/extensions/source/propctrlr/commoncontrol.cxx @@ -18,7 +18,7 @@ */ #include "commoncontrol.hxx" -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr diff --git a/extensions/source/propctrlr/commoncontrol.hxx b/extensions/source/propctrlr/commoncontrol.hxx index 919a7747c48c..746f2f56f600 100644 --- a/extensions/source/propctrlr/commoncontrol.hxx +++ b/extensions/source/propctrlr/commoncontrol.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_COMMONCONTROL_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_COMMONCONTROL_HXX +#pragma once #include <com/sun/star/inspection/XPropertyControl.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -206,6 +205,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_COMMONCONTROL_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/composeduiupdate.cxx b/extensions/source/propctrlr/composeduiupdate.cxx index 61c207341abd..247dd4ab3e71 100644 --- a/extensions/source/propctrlr/composeduiupdate.cxx +++ b/extensions/source/propctrlr/composeduiupdate.cxx @@ -389,7 +389,7 @@ namespace pcr ::rtl::Reference< CachedInspectorUI >& rUI = m_pCollectedUIs->aHandlers[ _rxHandler ]; if ( !rUI.is() ) rUI = new CachedInspectorUI( *this, &ComposedPropertyUIUpdate::callback_inspectorUIChanged_throw ); - return rUI.get(); + return rUI; } @@ -766,7 +766,7 @@ namespace pcr singleUI.second->dispose(); } m_pCollectedUIs.reset(); - m_xDelegatorUI.set( nullptr ); + m_xDelegatorUI.clear(); } diff --git a/extensions/source/propctrlr/composeduiupdate.hxx b/extensions/source/propctrlr/composeduiupdate.hxx index 0d25847c76bd..5e356af1f909 100644 --- a/extensions/source/propctrlr/composeduiupdate.hxx +++ b/extensions/source/propctrlr/composeduiupdate.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_COMPOSEDUIUPDATE_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_COMPOSEDUIUPDATE_HXX +#pragma once #include <com/sun/star/inspection/XObjectInspectorUI.hpp> #include <com/sun/star/inspection/XPropertyHandler.hpp> @@ -206,6 +205,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_COMPOSEDUIUPDATE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/controlfontdialog.cxx b/extensions/source/propctrlr/controlfontdialog.cxx index 26afa43a20bf..33da88b14ff4 100644 --- a/extensions/source/propctrlr/controlfontdialog.cxx +++ b/extensions/source/propctrlr/controlfontdialog.cxx @@ -19,8 +19,9 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> #include "controlfontdialog.hxx" + +#include <comphelper/propertyvalue.hxx> #include <vcl/svapp.hxx> #include "fontdialog.hxx" #include "formstrings.hxx" @@ -31,15 +32,13 @@ namespace pcr using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; OControlFontDialog::OControlFontDialog(const Reference< XComponentContext >& _rxContext ) - :OGenericUnoDialog( _rxContext ) - ,m_pItemPool(nullptr) - ,m_pItemPoolDefaults(nullptr) + : OGenericUnoDialog( _rxContext ) + , maFontList(Application::GetDefaultDevice()) { - registerProperty(PROPERTY_INTROSPECTEDOBJECT, OWN_PROPERTY_ID_INTROSPECTEDOBJECT, + registerProperty(PROPERTY_INTROSPECTEDOBJECT, static_cast<sal_Int32>(OwnPropertyId::INTROSPECTEDOBJECT), PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT, &m_xControlModel, cppu::UnoType<decltype(m_xControlModel)>::get()); } @@ -53,7 +52,7 @@ namespace pcr if (m_xDialog) { destroyDialog(); - ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults); + ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool); } } } @@ -81,11 +80,8 @@ namespace pcr Reference<XPropertySet> xGridModel; if (aArguments.getLength() == 1 && (aArguments[0] >>= xGridModel)) { - PropertyValue aArg; - aArg.Name = "IntrospectedObject"; - aArg.Value <<= xGridModel; - Sequence< Any > aNewArguments(1); - aNewArguments[0] <<= aArg; + Sequence aNewArguments{ Any(comphelper::makePropertyValue("IntrospectedObject", + xGridModel)) }; OControlFontDialog_DBase::initialize(aNewArguments); } else @@ -115,7 +111,7 @@ namespace pcr std::unique_ptr<weld::DialogController> OControlFontDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) { - ControlCharacterDialog::createItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults); + ControlCharacterDialog::createItemSet(m_pFontItems, m_pItemPool, maFontList); OSL_ENSURE(m_xControlModel.is(), "OControlFontDialog::createDialog: no introspectee set!"); if (m_xControlModel.is()) diff --git a/extensions/source/propctrlr/controlfontdialog.hxx b/extensions/source/propctrlr/controlfontdialog.hxx index 0f7dba0b1ed5..29dd95d2192a 100644 --- a/extensions/source/propctrlr/controlfontdialog.hxx +++ b/extensions/source/propctrlr/controlfontdialog.hxx @@ -17,15 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_CONTROLFONTDIALOG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_CONTROLFONTDIALOG_HXX +#pragma once #include <comphelper/proparrhlp.hxx> #include <svtools/genericunodialog.hxx> +#include <svtools/ctrltool.hxx> class SfxItemSet; class SfxItemPool; -class SfxPoolItem; namespace pcr { @@ -45,9 +44,8 @@ namespace pcr // </properties> std::unique_ptr<SfxItemSet> m_pFontItems; // item set for the dialog - SfxItemPool* m_pItemPool; // item pool for the item set for the dialog - std::vector<SfxPoolItem*>* - m_pItemPoolDefaults; // pool defaults + rtl::Reference<SfxItemPool> m_pItemPool; // item pool for the item set for the dialog + FontList maFontList; public: explicit OControlFontDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxContext); @@ -80,6 +78,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_CONTROLFONTDIALOG_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/controltype.hxx b/extensions/source/propctrlr/controltype.hxx index d3bf9cce0b98..89a400a76992 100644 --- a/extensions/source/propctrlr/controltype.hxx +++ b/extensions/source/propctrlr/controltype.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_PROPCTRLR_CONTROLTYPE_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_CONTROLTYPE_HXX +#pragma once #include <sal/types.h> @@ -33,6 +32,4 @@ namespace pcr::ControlType } // namespace pcr::ControlType -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_CONTROLTYPE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/defaultforminspection.cxx b/extensions/source/propctrlr/defaultforminspection.cxx index b3b0c82af496..3fa7fa5658a5 100644 --- a/extensions/source/propctrlr/defaultforminspection.cxx +++ b/extensions/source/propctrlr/defaultforminspection.cxx @@ -34,7 +34,6 @@ namespace pcr { - using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::XInterface; @@ -44,8 +43,7 @@ namespace pcr using ::com::sun::star::lang::IllegalArgumentException; DefaultFormComponentInspectorModel::DefaultFormComponentInspectorModel( bool _bUseFormFormComponentHandlers ) - :ImplInspectorModel() - ,m_bUseFormComponentHandlers( _bUseFormFormComponentHandlers ) + :m_bUseFormComponentHandlers( _bUseFormFormComponentHandlers ) ,m_bConstructed( false ) ,m_pInfoService( new OPropertyInfoService ) { @@ -131,9 +129,9 @@ namespace pcr static struct { const char* programmaticName; - const char* uiNameResId; - const char* helpId; - } const aCategories[] = { + TranslateId uiNameResId; + OUString helpId; + } constexpr aCategories[] = { { "General", RID_STR_PROPPAGE_DEFAULT, HID_FM_PROPDLG_TAB_GENERAL }, { "Data", RID_STR_PROPPAGE_DATA, HID_FM_PROPDLG_TAB_DATA }, { "Events", RID_STR_EVENTS, HID_FM_PROPDLG_TAB_EVT } diff --git a/extensions/source/propctrlr/defaultforminspection.hxx b/extensions/source/propctrlr/defaultforminspection.hxx index 454bbb58ed47..e118e9da674d 100644 --- a/extensions/source/propctrlr/defaultforminspection.hxx +++ b/extensions/source/propctrlr/defaultforminspection.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_PROPCTRLR_DEFAULTFORMINSPECTION_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_DEFAULTFORMINSPECTION_HXX +#pragma once #include "inspectormodelbase.hxx" @@ -64,6 +63,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_DEFAULTFORMINSPECTION_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/defaulthelpprovider.cxx b/extensions/source/propctrlr/defaulthelpprovider.cxx index 0d7792edd1d5..96c99af67e27 100644 --- a/extensions/source/propctrlr/defaulthelpprovider.cxx +++ b/extensions/source/propctrlr/defaulthelpprovider.cxx @@ -27,7 +27,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <vcl/window.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <cppuhelper/supportsservice.hxx> @@ -47,7 +47,6 @@ namespace pcr using ::com::sun::star::ucb::AlreadyInitializedException; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::awt::XWindow; DefaultHelpProvider::DefaultHelpProvider() @@ -145,7 +144,7 @@ namespace pcr try { Reference< XWindow > xControlWindow( _rxControl->getControlWindow(), css::uno::UNO_SET_THROW ); - pControlWindow = VCLUnoHelper::GetWindow( xControlWindow ).get(); + pControlWindow = VCLUnoHelper::GetWindow( xControlWindow ); } catch( const Exception& ) { diff --git a/extensions/source/propctrlr/defaulthelpprovider.hxx b/extensions/source/propctrlr/defaulthelpprovider.hxx index 66f4a8991d92..f647937dda98 100644 --- a/extensions/source/propctrlr/defaulthelpprovider.hxx +++ b/extensions/source/propctrlr/defaulthelpprovider.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_DEFAULTHELPPROVIDER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_DEFAULTHELPPROVIDER_HXX +#pragma once #include <com/sun/star/inspection/XPropertyControlObserver.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -76,6 +75,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_DEFAULTHELPPROVIDER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/editpropertyhandler.cxx b/extensions/source/propctrlr/editpropertyhandler.cxx index 72fc1042ab48..272e24428e20 100644 --- a/extensions/source/propctrlr/editpropertyhandler.cxx +++ b/extensions/source/propctrlr/editpropertyhandler.cxx @@ -23,13 +23,17 @@ #include <com/sun/star/inspection/XObjectInspectorUI.hpp> #include <com/sun/star/lang/NullPointerException.hpp> -#include <tools/diagnose_ex.h> - -#define TEXTTYPE_SINGLELINE 0 -#define TEXTTYPE_MULTILINE 1 -#define TEXTTYPE_RICHTEXT 2 - +#include <comphelper/diagnose_ex.hxx> +namespace +{ + enum class TextType + { + SINGLELINE = 0, + MULTILINE = 1, + RICHTEXT = 2 + }; +}; namespace pcr { @@ -37,8 +41,6 @@ namespace pcr using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::frame; using namespace ::com::sun::star::inspection; @@ -91,21 +93,21 @@ namespace pcr case PROPERTY_ID_TEXTTYPE: { - sal_Int32 nTextType = TEXTTYPE_SINGLELINE; + TextType nTextType = TextType::SINGLELINE; bool bRichText = false; OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_RICHTEXT ) >>= bRichText ); if ( bRichText ) - nTextType = TEXTTYPE_RICHTEXT; + nTextType = TextType::RICHTEXT; else { bool bMultiLine = false; OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_MULTILINE ) >>= bMultiLine ); if ( bMultiLine ) - nTextType = TEXTTYPE_MULTILINE; + nTextType = TextType::MULTILINE; else - nTextType = TEXTTYPE_SINGLELINE; + nTextType = TextType::SINGLELINE; } - aReturn <<= nTextType; + aReturn <<= static_cast<sal_Int32>(nTextType); } break; @@ -141,8 +143,8 @@ namespace pcr bool bHasVScroll = 0 != ( nScrollbars & 2 ); bool bHasHScroll = 0 != ( nScrollbars & 1 ); - m_xComponent->setPropertyValue( PROPERTY_VSCROLL, makeAny( bHasVScroll ) ); - m_xComponent->setPropertyValue( PROPERTY_HSCROLL, makeAny( bHasHScroll ) ); + m_xComponent->setPropertyValue( PROPERTY_VSCROLL, Any( bHasVScroll ) ); + m_xComponent->setPropertyValue( PROPERTY_HSCROLL, Any( bHasHScroll ) ); } break; @@ -150,19 +152,19 @@ namespace pcr { bool bMultiLine = false; bool bRichText = false; - sal_Int32 nTextType = TEXTTYPE_SINGLELINE; + sal_Int32 nTextType = static_cast<sal_Int32>(TextType::SINGLELINE); OSL_VERIFY( _rValue >>= nTextType ); - switch ( nTextType ) + switch ( static_cast<TextType>(nTextType) ) { - case TEXTTYPE_SINGLELINE: bMultiLine = bRichText = false; break; - case TEXTTYPE_MULTILINE: bMultiLine = true; bRichText = false; break; - case TEXTTYPE_RICHTEXT: bMultiLine = true; bRichText = true; break; + case TextType::SINGLELINE: bMultiLine = bRichText = false; break; + case TextType::MULTILINE: bMultiLine = true; bRichText = false; break; + case TextType::RICHTEXT: bMultiLine = true; bRichText = true; break; default: OSL_FAIL( "EditPropertyHandler::setPropertyValue: invalid text type!" ); } - m_xComponent->setPropertyValue( PROPERTY_MULTILINE, makeAny( bMultiLine ) ); - m_xComponent->setPropertyValue( PROPERTY_RICHTEXT, makeAny( bRichText ) ); + m_xComponent->setPropertyValue( PROPERTY_MULTILINE, Any( bMultiLine ) ); + m_xComponent->setPropertyValue( PROPERTY_RICHTEXT, Any( bRichText ) ); } break; @@ -261,21 +263,23 @@ namespace pcr { case PROPERTY_ID_TEXTTYPE: { - sal_Int32 nTextType = TEXTTYPE_SINGLELINE; - getPropertyValue( PROPERTY_TEXTTYPE ) >>= nTextType; + sal_Int32 nTextTypeInt = static_cast<sal_Int32>(TextType::SINGLELINE); + getPropertyValue( PROPERTY_TEXTTYPE ) >>= nTextTypeInt; + + TextType nTextType = static_cast<TextType>(nTextTypeInt); if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_WORDBREAK ) ) - _rxInspectorUI->enablePropertyUI( PROPERTY_WORDBREAK, nTextType == TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_MAXTEXTLEN, nTextType != TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_ECHO_CHAR, nTextType == TEXTTYPE_SINGLELINE ); - _rxInspectorUI->enablePropertyUI( PROPERTY_FONT, nTextType != TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_ALIGN, nTextType != TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_DEFAULT_TEXT, nTextType != TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_SHOW_SCROLLBARS, nTextType != TEXTTYPE_SINGLELINE ); - _rxInspectorUI->enablePropertyUI( PROPERTY_LINEEND_FORMAT, nTextType != TEXTTYPE_SINGLELINE ); - _rxInspectorUI->enablePropertyUI( PROPERTY_VERTICAL_ALIGN, nTextType == TEXTTYPE_SINGLELINE ); - - _rxInspectorUI->showCategory( "Data", nTextType != TEXTTYPE_RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_WORDBREAK, nTextType == TextType::RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_MAXTEXTLEN, nTextType != TextType::RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_ECHO_CHAR, nTextType == TextType::SINGLELINE ); + _rxInspectorUI->enablePropertyUI( PROPERTY_FONT, nTextType != TextType::RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_ALIGN, nTextType != TextType::RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_DEFAULT_TEXT, nTextType != TextType::RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_SHOW_SCROLLBARS, nTextType != TextType::SINGLELINE ); + _rxInspectorUI->enablePropertyUI( PROPERTY_LINEEND_FORMAT, nTextType != TextType::SINGLELINE ); + _rxInspectorUI->enablePropertyUI( PROPERTY_VERTICAL_ALIGN, nTextType == TextType::SINGLELINE ); + + _rxInspectorUI->showCategory( "Data", nTextType != TextType::RICHTEXT ); } break; diff --git a/extensions/source/propctrlr/editpropertyhandler.hxx b/extensions/source/propctrlr/editpropertyhandler.hxx index ccc3d19782c0..33ad8df98374 100644 --- a/extensions/source/propctrlr/editpropertyhandler.hxx +++ b/extensions/source/propctrlr/editpropertyhandler.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_EDITPROPERTYHANDLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_EDITPROPERTYHANDLER_HXX +#pragma once #include "propertyhandler.hxx" @@ -66,6 +65,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_EDITPROPERTYHANDLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/eformshelper.cxx b/extensions/source/propctrlr/eformshelper.cxx index 94f8e7a4b969..bcc0b25987c8 100644 --- a/extensions/source/propctrlr/eformshelper.cxx +++ b/extensions/source/propctrlr/eformshelper.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <memory> #include <string_view> #include "eformshelper.hxx" @@ -32,7 +31,7 @@ #include <com/sun/star/xforms/XFormsUIHelper1.hpp> #include <com/sun/star/xsd/DataTypeClass.hpp> #include <com/sun/star/form/binding/XListEntrySink.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <algorithm> #include <o3tl/functional.hxx> @@ -241,10 +240,10 @@ namespace pcr { if ( !_bDoListen ) { - std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > pListenerIterator = m_aPropertyListeners.createIterator(); - while ( pListenerIterator->hasMoreElements() ) + ::comphelper::OInterfaceIteratorHelper3 aListenerIterator(m_aPropertyListeners); + while ( aListenerIterator.hasMoreElements() ) { - PropertyEventTranslation* pTranslator = dynamic_cast< PropertyEventTranslation* >( pListenerIterator->next() ); + PropertyEventTranslation* pTranslator = dynamic_cast< PropertyEventTranslation* >( aListenerIterator.next().get() ); OSL_ENSURE( pTranslator, "EFormsHelper::impl_toggleBindingPropertyListening_throw: invalid listener element in my container!" ); if ( !pTranslator ) continue; @@ -255,7 +254,7 @@ namespace pcr if ( pTranslator->getDelegator() == _rxConcreteListenerOrNull ) { impl_switchBindingListening_throw( false, xEventSourceTranslator ); - m_aPropertyListeners.removeListener( xEventSourceTranslator ); + m_aPropertyListeners.removeInterface( xEventSourceTranslator ); break; } } @@ -270,17 +269,14 @@ namespace pcr if ( _rxConcreteListenerOrNull.is() ) { Reference< XPropertyChangeListener > xEventSourceTranslator( new PropertyEventTranslation( _rxConcreteListenerOrNull, m_xBindableControl ) ); - m_aPropertyListeners.addListener( xEventSourceTranslator ); + m_aPropertyListeners.addInterface( xEventSourceTranslator ); impl_switchBindingListening_throw( true, xEventSourceTranslator ); } else { - std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > pListenerIterator = m_aPropertyListeners.createIterator(); - while ( pListenerIterator->hasMoreElements() ) - { - Reference< XPropertyChangeListener > xListener( pListenerIterator->next(), UNO_QUERY ); - impl_switchBindingListening_throw( true, xListener ); - } + ::comphelper::OInterfaceIteratorHelper3 aListenerIterator(m_aPropertyListeners); + while ( aListenerIterator.hasMoreElements() ) + impl_switchBindingListening_throw( true, aListenerIterator.next() ); } } } @@ -305,7 +301,7 @@ namespace pcr OSL_ENSURE( xForms.is(), "EFormsHelper::getFormModelNames: invalid forms container!" ); if ( xForms.is() ) { - Sequence< OUString > aModelNames = xForms->getElementNames(); + const Sequence< OUString > aModelNames = xForms->getElementNames(); _rModelNames.resize( aModelNames.getLength() ); std::copy( aModelNames.begin(), aModelNames.end(), _rModelNames.begin() ); } @@ -329,7 +325,7 @@ namespace pcr OSL_ENSURE( xBindings.is(), "EFormsHelper::getBindingNames: invalid bindings container obtained from the model!" ); if ( xBindings.is() ) { - Sequence< OUString > aNames = xBindings->getElementNames(); + const Sequence< OUString > aNames = xBindings->getElementNames(); _rBindingNames.resize( aNames.getLength() ); std::copy( aNames.begin(), aNames.end(), _rBindingNames.begin() ); } @@ -378,7 +374,6 @@ namespace pcr return xModel; } - OUString EFormsHelper::getCurrentFormModelName() const { OUString sModelName; @@ -395,7 +390,6 @@ namespace pcr return sModelName; } - Reference< XPropertySet > EFormsHelper::getCurrentBinding() const { Reference< XPropertySet > xBinding; @@ -413,7 +407,6 @@ namespace pcr return xBinding; } - OUString EFormsHelper::getCurrentBindingName() const { OUString sBindingName; @@ -433,19 +426,18 @@ namespace pcr Reference< XListEntrySource > EFormsHelper::getCurrentListSourceBinding() const { - Reference< XListEntrySource > xReturn; try { Reference< XListEntrySink > xAsSink( m_xControlModel, UNO_QUERY ); OSL_ENSURE( xAsSink.is(), "EFormsHelper::getCurrentListSourceBinding: you should have used isListEntrySink before!" ); - if ( xAsSink.is() ) - xReturn = xAsSink->getListEntrySource(); + if (xAsSink.is()) + return xAsSink->getListEntrySource(); } catch( const Exception& ) { TOOLS_WARN_EXCEPTION( "extensions.propctrlr", "EFormsHelper::getCurrentListSourceBinding" ); } - return xReturn; + return Reference<XListEntrySource>(); } @@ -464,7 +456,6 @@ namespace pcr } } - void EFormsHelper::setBinding( const Reference< css::beans::XPropertySet >& _rxBinding ) { if ( !m_xBindableControl.is() ) @@ -529,8 +520,8 @@ namespace pcr xBinding = xModel->createBinding( ); if ( xBinding.is() ) { - xBinding->setPropertyValue( PROPERTY_BINDING_ID, makeAny( _rBindingName ) ); - xModel->getBindings()->insert( makeAny( xBinding ) ); + xBinding->setPropertyValue( PROPERTY_BINDING_ID, Any( _rBindingName ) ); + xModel->getBindings()->insert( Any( xBinding ) ); } } } @@ -551,7 +542,7 @@ namespace pcr Reference< XNamed > xName( xBinding, UNO_QUERY_THROW ); xName->setName( sNewName ); // and insert into the model - xModel->getBindings()->insert( makeAny( xBinding ) ); + xModel->getBindings()->insert( Any( xBinding ) ); } } } @@ -590,7 +581,7 @@ namespace pcr xInfo = _rxProps->getPropertySetInfo(); if ( xInfo.is() ) { - Sequence< Property > aProperties = xInfo->getProperties(); + const Sequence< Property > aProperties = xInfo->getProperties(); std::for_each( aProperties.begin(), aProperties.end(), PropertyBagInserter( _rBag ) ); @@ -678,7 +669,7 @@ namespace pcr xElement->getPropertyValue( PROPERTY_MODEL ) >>= xElementsModel; OSL_ENSURE( xElementsModel == xModel, "EFormsHelper::getAllElementUINames: inconsistency in the model-element relationship!" ); if ( xElementsModel != xModel ) - xElement->setPropertyValue( PROPERTY_MODEL, makeAny( xModel ) ); + xElement->setPropertyValue( PROPERTY_MODEL, Any( xModel ) ); } #endif OUString sElementName = ( _eType == Submission ) ? xHelper->getSubmissionName( xElement, true ) : xHelper->getBindingName( xElement, true ); @@ -702,7 +693,7 @@ namespace pcr void EFormsHelper::firePropertyChange( const OUString& _rName, const Any& _rOldValue, const Any& _rNewValue ) const { - if ( m_aPropertyListeners.empty() ) + if ( m_aPropertyListeners.getLength() == 0 ) return; if ( _rOldValue == _rNewValue ) @@ -717,7 +708,7 @@ namespace pcr aEvent.OldValue = _rOldValue; aEvent.NewValue = _rNewValue; - const_cast< EFormsHelper* >( this )->m_aPropertyListeners.notify( aEvent, &XPropertyChangeListener::propertyChange ); + const_cast< EFormsHelper* >( this )->m_aPropertyListeners.notifyEach( &XPropertyChangeListener::propertyChange, aEvent ); } catch( const Exception& ) { @@ -728,7 +719,7 @@ namespace pcr void EFormsHelper::firePropertyChanges( const Reference< XPropertySet >& _rxOldProps, const Reference< XPropertySet >& _rxNewProps, std::set< OUString >& _rFilter ) const { - if ( m_aPropertyListeners.empty() ) + if ( m_aPropertyListeners.getLength() == 0 ) return; try diff --git a/extensions/source/propctrlr/eformshelper.hxx b/extensions/source/propctrlr/eformshelper.hxx index 8ce00e446e25..e88cb7491d6c 100644 --- a/extensions/source/propctrlr/eformshelper.hxx +++ b/extensions/source/propctrlr/eformshelper.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_EFORMSHELPER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_EFORMSHELPER_HXX +#pragma once #include "pcrcommon.hxx" @@ -253,6 +252,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_EFORMSHELPER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/eformspropertyhandler.cxx b/extensions/source/propctrlr/eformspropertyhandler.cxx index bda8df5a0c05..68e8ebb4f423 100644 --- a/extensions/source/propctrlr/eformspropertyhandler.cxx +++ b/extensions/source/propctrlr/eformspropertyhandler.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/inspection/PropertyControlType.hpp> #include <com/sun/star/inspection/XObjectInspectorUI.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <sal/log.hxx> @@ -42,7 +42,6 @@ namespace pcr using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::xforms; - using namespace ::com::sun::star::script; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::form::binding; using namespace ::com::sun::star::inspection; @@ -178,7 +177,7 @@ namespace pcr OUString sOldBindingName = m_pHelper->getCurrentBindingName(); m_pHelper->setBinding( nullptr ); firePropertyChange( PROPERTY_BINDING_NAME, PROPERTY_ID_BINDING_NAME, - makeAny( sOldBindingName ), makeAny( OUString() ) ); + Any( sOldBindingName ), Any( OUString() ) ); } } break; @@ -211,7 +210,7 @@ namespace pcr // However, there's no such mechanism in place currently. m_bSimulatingModelChange = true; firePropertyChange( PROPERTY_XML_DATA_MODEL, PROPERTY_ID_XML_DATA_MODEL, - makeAny( OUString() ), makeAny( getModelNamePropertyValue() ) ); + Any( OUString() ), Any( getModelNamePropertyValue() ) ); m_bSimulatingModelChange = false; } } @@ -281,7 +280,7 @@ namespace pcr { if ( m_pHelper->canBindToAnyDataType() ) { - aProperties.reserve( 7 ); + aProperties.reserve(9); addStringPropertyDescription( aProperties, PROPERTY_XML_DATA_MODEL ); addStringPropertyDescription( aProperties, PROPERTY_BINDING_NAME ); addStringPropertyDescription( aProperties, PROPERTY_BIND_EXPRESSION ); @@ -445,10 +444,10 @@ namespace pcr switch ( nControlType ) { case PropertyControlType::ListBox: - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, true ); + aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, std::move(aListEntries), false, true ); break; case PropertyControlType::ComboBox: - aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, true ); + aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aListEntries), true ); break; default: aDescriptor.Control = _rxControlFactory->createPropertyControl( nControlType, false ); @@ -499,9 +498,9 @@ namespace pcr if ( !xModel.is() || !xBinding.is() || sFacetName.isEmpty() ) return InteractiveSelectionResult_Cancelled; - xDialogProps->setPropertyValue("FormModel", makeAny( xModel ) ); - xDialogProps->setPropertyValue("Binding", makeAny( xBinding ) ); - xDialogProps->setPropertyValue("FacetName", makeAny( sFacetName ) ); + xDialogProps->setPropertyValue("FormModel", Any( xModel ) ); + xDialogProps->setPropertyValue("Binding", Any( xBinding ) ); + xDialogProps->setPropertyValue("FacetName", Any( sFacetName ) ); if ( !xDialog->execute() ) // cancelled diff --git a/extensions/source/propctrlr/eformspropertyhandler.hxx b/extensions/source/propctrlr/eformspropertyhandler.hxx index 7233edb07cf2..8945c24f493e 100644 --- a/extensions/source/propctrlr/eformspropertyhandler.hxx +++ b/extensions/source/propctrlr/eformspropertyhandler.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_EFORMSPROPERTYHANDLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_EFORMSPROPERTYHANDLER_HXX +#pragma once #include "propertyhandler.hxx" @@ -93,6 +92,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_EFORMSPROPERTYHANDLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/enumrepresentation.hxx b/extensions/source/propctrlr/enumrepresentation.hxx index ef7a94596e34..b3ba04c9a1ec 100644 --- a/extensions/source/propctrlr/enumrepresentation.hxx +++ b/extensions/source/propctrlr/enumrepresentation.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_ENUMREPRESENTATION_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_ENUMREPRESENTATION_HXX +#pragma once #include <com/sun/star/uno/Any.hxx> #include <rtl/ustring.hxx> @@ -60,6 +59,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_ENUMREPRESENTATION_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index f20107448ccb..7e4ca0747cb4 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -51,6 +51,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <comphelper/evtmethodhelper.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <comphelper/types.hxx> #include <cppuhelper/implbase.hxx> @@ -58,12 +59,13 @@ #include <rtl/ref.hxx> #include <rtl/ustrbuf.hxx> #include <svx/svxdlg.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <map> #include <algorithm> #include <iterator> #include <string_view> +#include <utility> namespace pcr { @@ -97,7 +99,6 @@ namespace pcr using ::com::sun::star::form::runtime::FormController; using ::com::sun::star::form::runtime::XFormController; using ::com::sun::star::beans::UnknownPropertyException; - using ::com::sun::star::uno::makeAny; using ::com::sun::star::container::NoSuchElementException; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::container::XNameReplace; @@ -116,34 +117,28 @@ namespace pcr using com::sun::star::uri::UriReferenceFactory; using com::sun::star::uri::XUriReferenceFactory; using com::sun::star::uri::XVndSunStarScriptUrlReference; - using ::com::sun::star::lang::XEventListener; namespace PropertyControlType = css::inspection::PropertyControlType; namespace PropertyAttribute = css::beans::PropertyAttribute; namespace FormComponentType = css::form::FormComponentType; - EventDescription::EventDescription( EventId _nId, const char* _pListenerNamespaceAscii, const char* _pListenerClassAsciiName, - const char* _pListenerMethodAsciiName, const char* pDisplayNameResId, const OString& _sHelpId, const OString& _sUniqueBrowseId ) + EventDescription::EventDescription( EventId _nId, std::u16string_view listenerClassName, + std::u16string_view listenerMethodName, TranslateId pDisplayNameResId, OUString _sHelpId, OString _sUniqueBrowseId ) :sDisplayName(PcrRes( pDisplayNameResId )) - ,sListenerMethodName( OUString::createFromAscii( _pListenerMethodAsciiName ) ) - ,sHelpId( _sHelpId ) - ,sUniqueBrowseId( _sUniqueBrowseId ) + ,sListenerClassName( listenerClassName ) + ,sListenerMethodName( listenerMethodName ) + ,sHelpId(std::move( _sHelpId )) + ,sUniqueBrowseId(std::move( _sUniqueBrowseId )) ,nId( _nId ) { - OUStringBuffer aQualifiedListenerClass; - aQualifiedListenerClass.append( "com.sun.star." ); - aQualifiedListenerClass.appendAscii( _pListenerNamespaceAscii ); - aQualifiedListenerClass.append( "." ); - aQualifiedListenerClass.appendAscii( _pListenerClassAsciiName ); - sListenerClassName = aQualifiedListenerClass.makeStringAndClear(); } namespace { - #define DESCRIBE_EVENT( map, asciinamespace, asciilistener, asciimethod, id_postfix ) \ + #define DESCRIBE_EVENT( map, listener, method, id_postfix ) \ map.emplace( \ - asciimethod, \ - EventDescription( ++nEventId, asciinamespace, asciilistener, asciimethod, RID_STR_EVT_##id_postfix, HID_EVT_##id_postfix, UID_BRWEVT_##id_postfix ) ) + u"" method##_ustr, \ + EventDescription( ++nEventId, u"com.sun.star." listener, u"" method, RID_STR_EVT_##id_postfix, HID_EVT_##id_postfix, UID_BRWEVT_##id_postfix ) ) bool lcl_getEventDescriptionForMethod( const OUString& _rMethodName, EventDescription& _out_rDescription ) { @@ -151,39 +146,39 @@ namespace pcr EventMap aMap; sal_Int32 nEventId = 0; - DESCRIBE_EVENT(aMap, "form", "XApproveActionListener", "approveAction", APPROVEACTIONPERFORMED); - DESCRIBE_EVENT(aMap, "awt", "XActionListener", "actionPerformed", ACTIONPERFORMED); - DESCRIBE_EVENT(aMap, "form", "XChangeListener", "changed", CHANGED); - DESCRIBE_EVENT(aMap, "awt", "XTextListener", "textChanged", TEXTCHANGED); - DESCRIBE_EVENT(aMap, "awt", "XItemListener", "itemStateChanged", ITEMSTATECHANGED); - DESCRIBE_EVENT(aMap, "awt", "XFocusListener", "focusGained", FOCUSGAINED); - DESCRIBE_EVENT(aMap, "awt", "XFocusListener", "focusLost", FOCUSLOST); - DESCRIBE_EVENT(aMap, "awt", "XKeyListener", "keyPressed", KEYTYPED); - DESCRIBE_EVENT(aMap, "awt", "XKeyListener", "keyReleased", KEYUP); - DESCRIBE_EVENT(aMap, "awt", "XMouseListener", "mouseEntered", MOUSEENTERED); - DESCRIBE_EVENT(aMap, "awt", "XMouseMotionListener", "mouseDragged", MOUSEDRAGGED); - DESCRIBE_EVENT(aMap, "awt", "XMouseMotionListener", "mouseMoved", MOUSEMOVED); - DESCRIBE_EVENT(aMap, "awt", "XMouseListener", "mousePressed", MOUSEPRESSED); - DESCRIBE_EVENT(aMap, "awt", "XMouseListener", "mouseReleased", MOUSERELEASED); - DESCRIBE_EVENT(aMap, "awt", "XMouseListener", "mouseExited", MOUSEEXITED); - DESCRIBE_EVENT(aMap, "form", "XResetListener", "approveReset", APPROVERESETTED); - DESCRIBE_EVENT(aMap, "form", "XResetListener", "resetted", RESETTED); - DESCRIBE_EVENT(aMap, "form", "XSubmitListener", "approveSubmit", SUBMITTED); - DESCRIBE_EVENT(aMap, "form", "XUpdateListener", "approveUpdate", BEFOREUPDATE); - DESCRIBE_EVENT(aMap, "form", "XUpdateListener", "updated", AFTERUPDATE); - DESCRIBE_EVENT(aMap, "form", "XLoadListener", "loaded", LOADED); - DESCRIBE_EVENT(aMap, "form", "XLoadListener", "reloading", RELOADING); - DESCRIBE_EVENT(aMap, "form", "XLoadListener", "reloaded", RELOADED); - DESCRIBE_EVENT(aMap, "form", "XLoadListener", "unloading", UNLOADING); - DESCRIBE_EVENT(aMap, "form", "XLoadListener", "unloaded", UNLOADED); - DESCRIBE_EVENT(aMap, "form", "XConfirmDeleteListener", "confirmDelete", CONFIRMDELETE); - DESCRIBE_EVENT(aMap, "sdb", "XRowSetApproveListener", "approveRowChange", APPROVEROWCHANGE); - DESCRIBE_EVENT(aMap, "sdbc", "XRowSetListener", "rowChanged", ROWCHANGE); - DESCRIBE_EVENT(aMap, "sdb", "XRowSetApproveListener", "approveCursorMove", POSITIONING); - DESCRIBE_EVENT(aMap, "sdbc", "XRowSetListener", "cursorMoved", POSITIONED); - DESCRIBE_EVENT(aMap, "form", "XDatabaseParameterListener", "approveParameter", APPROVEPARAMETER); - DESCRIBE_EVENT(aMap, "sdb", "XSQLErrorListener", "errorOccured", ERROROCCURRED); - DESCRIBE_EVENT(aMap, "awt", "XAdjustmentListener", "adjustmentValueChanged", ADJUSTMENTVALUECHANGED); + DESCRIBE_EVENT(aMap, "form.XApproveActionListener", "approveAction", APPROVEACTIONPERFORMED); + DESCRIBE_EVENT(aMap, "awt.XActionListener", "actionPerformed", ACTIONPERFORMED); + DESCRIBE_EVENT(aMap, "form.XChangeListener", "changed", CHANGED); + DESCRIBE_EVENT(aMap, "awt.XTextListener", "textChanged", TEXTCHANGED); + DESCRIBE_EVENT(aMap, "awt.XItemListener", "itemStateChanged", ITEMSTATECHANGED); + DESCRIBE_EVENT(aMap, "awt.XFocusListener", "focusGained", FOCUSGAINED); + DESCRIBE_EVENT(aMap, "awt.XFocusListener", "focusLost", FOCUSLOST); + DESCRIBE_EVENT(aMap, "awt.XKeyListener", "keyPressed", KEYTYPED); + DESCRIBE_EVENT(aMap, "awt.XKeyListener", "keyReleased", KEYUP); + DESCRIBE_EVENT(aMap, "awt.XMouseListener", "mouseEntered", MOUSEENTERED); + DESCRIBE_EVENT(aMap, "awt.XMouseMotionListener", "mouseDragged", MOUSEDRAGGED); + DESCRIBE_EVENT(aMap, "awt.XMouseMotionListener", "mouseMoved", MOUSEMOVED); + DESCRIBE_EVENT(aMap, "awt.XMouseListener", "mousePressed", MOUSEPRESSED); + DESCRIBE_EVENT(aMap, "awt.XMouseListener", "mouseReleased", MOUSERELEASED); + DESCRIBE_EVENT(aMap, "awt.XMouseListener", "mouseExited", MOUSEEXITED); + DESCRIBE_EVENT(aMap, "form.XResetListener", "approveReset", APPROVERESETTED); + DESCRIBE_EVENT(aMap, "form.XResetListener", "resetted", RESETTED); + DESCRIBE_EVENT(aMap, "form.XSubmitListener", "approveSubmit", SUBMITTED); + DESCRIBE_EVENT(aMap, "form.XUpdateListener", "approveUpdate", BEFOREUPDATE); + DESCRIBE_EVENT(aMap, "form.XUpdateListener", "updated", AFTERUPDATE); + DESCRIBE_EVENT(aMap, "form.XLoadListener", "loaded", LOADED); + DESCRIBE_EVENT(aMap, "form.XLoadListener", "reloading", RELOADING); + DESCRIBE_EVENT(aMap, "form.XLoadListener", "reloaded", RELOADED); + DESCRIBE_EVENT(aMap, "form.XLoadListener", "unloading", UNLOADING); + DESCRIBE_EVENT(aMap, "form.XLoadListener", "unloaded", UNLOADED); + DESCRIBE_EVENT(aMap, "form.XConfirmDeleteListener", "confirmDelete", CONFIRMDELETE); + DESCRIBE_EVENT(aMap, "sdb.XRowSetApproveListener", "approveRowChange", APPROVEROWCHANGE); + DESCRIBE_EVENT(aMap, "sdbc.XRowSetListener", "rowChanged", ROWCHANGE); + DESCRIBE_EVENT(aMap, "sdb.XRowSetApproveListener", "approveCursorMove", POSITIONING); + DESCRIBE_EVENT(aMap, "sdbc.XRowSetListener", "cursorMoved", POSITIONED); + DESCRIBE_EVENT(aMap, "form.XDatabaseParameterListener", "approveParameter", APPROVEPARAMETER); + DESCRIBE_EVENT(aMap, "sdb.XSQLErrorListener", "errorOccured", ERROROCCURRED); + DESCRIBE_EVENT(aMap, "awt.XAdjustmentListener", "adjustmentValueChanged", ADJUSTMENTVALUECHANGED); return aMap; }(); @@ -236,11 +231,11 @@ namespace pcr sal_Int32 nPrefixLen = aScriptEvent.ScriptCode.indexOf( ':' ); OSL_ENSURE( nPrefixLen > 0, "lcl_getAssignedScriptEvent: illegal location!" ); - OUString sLocation = aScriptEvent.ScriptCode.copy( 0, nPrefixLen ); - OUString sMacroPath = aScriptEvent.ScriptCode.copy( nPrefixLen + 1 ); + std::u16string_view sLocation = aScriptEvent.ScriptCode.subView( 0, nPrefixLen ); + std::u16string_view sMacroPath = aScriptEvent.ScriptCode.subView( nPrefixLen + 1 ); aScriptEvent.ScriptCode = - "vnd.sun.star.script:" + + OUString::Concat("vnd.sun.star.script:") + sMacroPath + "?language=Basic&location=" + sLocation; @@ -274,9 +269,9 @@ namespace pcr OSL_PRECOND( _rxIntrospection.is(), "lcl_addListenerTypesFor_throw: this will crash!" ); Reference< XIntrospectionAccess > xIntrospectionAccess( - _rxIntrospection->inspect( makeAny( _rxComponent ) ), UNO_SET_THROW ); + _rxIntrospection->inspect( Any( _rxComponent ) ), UNO_SET_THROW ); - Sequence< Type > aListeners( xIntrospectionAccess->getSupportedListeners() ); + const Sequence< Type > aListeners( xIntrospectionAccess->getSupportedListeners() ); std::copy( aListeners.begin(), aListeners.end(), std::insert_iterator< TypeBag >( _out_rTypes, _out_rTypes.begin() ) ); @@ -375,13 +370,12 @@ namespace pcr { ScriptEventDescriptor aDescriptor( impl_getDescriptor_throw( _rName ) ); - Sequence< PropertyValue > aScriptDescriptor( 2 ); - aScriptDescriptor[0].Name = "EventType"; - aScriptDescriptor[0].Value <<= aDescriptor.ScriptType; - aScriptDescriptor[1].Name = "Script"; - aScriptDescriptor[1].Value <<= aDescriptor.ScriptCode; + Sequence< PropertyValue > aScriptDescriptor{ + comphelper::makePropertyValue("EventType", aDescriptor.ScriptType), + comphelper::makePropertyValue("Script", aDescriptor.ScriptCode) + }; - return makeAny( aScriptDescriptor ); + return Any( aScriptDescriptor ); } Sequence< OUString > SAL_CALL EventHolder::getElementNames( ) @@ -511,7 +505,7 @@ namespace pcr } } - return makeAny( aPropertyValue ); + return Any( aPropertyValue ); } void SAL_CALL EventHandler::setPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) @@ -541,7 +535,7 @@ namespace pcr aEvent.PropertyName = _rPropertyName; aEvent.OldValue <<= aOldScriptEvent; aEvent.NewValue <<= aNewScriptEvent; - m_aPropertyListeners.notify( aEvent, &XPropertyChangeListener::propertyChange ); + m_aPropertyListeners.notifyEach( &XPropertyChangeListener::propertyChange, aEvent ); } Any SAL_CALL EventHandler::convertToPropertyValue( const OUString& _rPropertyName, const Any& _rControlValue ) @@ -568,7 +562,7 @@ namespace pcr // there is no need for this code... aAssignedScript.ScriptCode = sNewScriptCode; - return makeAny( aAssignedScript ); + return Any( aAssignedScript ); } Any SAL_CALL EventHandler::convertToControlValue( const OUString& /*_rPropertyName*/, const Any& _rPropertyValue, const Type& _rControlValueType ) @@ -608,8 +602,7 @@ namespace pcr OSL_ENSURE( !sLocation.isEmpty(), "EventHandler::convertToControlValue: unexpected: no location!" ); if ( !sLocation.isEmpty() ) { - aComposeBuffer.append( sLocation ); - aComposeBuffer.append( ", " ); + aComposeBuffer.append( sLocation + ", " ); } // language @@ -629,7 +622,7 @@ namespace pcr } } - return makeAny( sScript ); + return Any( sScript ); } PropertyState SAL_CALL EventHandler::getPropertyState( const OUString& /*_rPropertyName*/ ) @@ -642,13 +635,13 @@ namespace pcr ::osl::MutexGuard aGuard( m_aMutex ); if ( !_rxListener.is() ) throw NullPointerException(); - m_aPropertyListeners.addListener( _rxListener ); + m_aPropertyListeners.addInterface( _rxListener ); } void SAL_CALL EventHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) { ::osl::MutexGuard aGuard( m_aMutex ); - m_aPropertyListeners.removeListener( _rxListener ); + m_aPropertyListeners.removeInterface( _rxListener ); } Sequence< Property > SAL_CALL EventHandler::getSupportedProperties() @@ -770,7 +763,7 @@ namespace pcr } // the initial selection in the dialog - Sequence< OUString > aNames( pEventHolder->getElementNames() ); + const Sequence< OUString > aNames( pEventHolder->getElementNames() ); const OUString* pChosenEvent = std::find( aNames.begin(), aNames.end(), rForEvent.sListenerMethodName ); sal_uInt16 nInitialSelection = static_cast<sal_uInt16>( pChosenEvent - aNames.begin() ); @@ -781,7 +774,7 @@ namespace pcr PropertyHandlerHelper::getDialogParentFrame( m_xContext ), impl_getContextFrame_nothrow(), m_bIsDialogElement, - pEventHolder.get(), + pEventHolder, nInitialSelection ) ); @@ -802,7 +795,7 @@ namespace pcr // set the new "property value" setPropertyValue( lcl_getEventPropertyName( event.second.sListenerClassName, event.second.sListenerMethodName ), - makeAny( aScriptDescriptor ) + Any( aScriptDescriptor ) ); } } @@ -973,14 +966,14 @@ namespace pcr namespace { - bool lcl_endsWith( const OUString& _rText, const OUString& _rCheck ) + bool lcl_endsWith( std::u16string_view _rText, std::u16string_view _rCheck ) { - sal_Int32 nTextLen = _rText.getLength(); - sal_Int32 nCheckLen = _rCheck.getLength(); + size_t nTextLen = _rText.size(); + size_t nCheckLen = _rCheck.size(); if ( nCheckLen > nTextLen ) return false; - return _rText.indexOf( _rCheck ) == ( nTextLen - nCheckLen ); + return _rText.find( _rCheck ) == ( nTextLen - nCheckLen ); } } diff --git a/extensions/source/propctrlr/eventhandler.hxx b/extensions/source/propctrlr/eventhandler.hxx index 911380be766f..4fa5c85d2ed5 100644 --- a/extensions/source/propctrlr/eventhandler.hxx +++ b/extensions/source/propctrlr/eventhandler.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_EVENTHANDLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_EVENTHANDLER_HXX +#pragma once #include "pcrcommon.hxx" @@ -29,6 +28,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/compbase.hxx> +#include <unotools/resmgr.hxx> #include <unordered_map> @@ -45,7 +45,7 @@ namespace pcr OUString sDisplayName; OUString sListenerClassName; OUString sListenerMethodName; - OString sHelpId; + OUString sHelpId; OString sUniqueBrowseId; EventId nId; @@ -56,12 +56,11 @@ namespace pcr EventDescription( EventId _nId, - const char* _pListenerNamespaceAscii, - const char* _pListenerClassAsciiName, - const char* _pListenerMethodAsciiName, - const char* pDisplayNameResId, - const OString& _sHelpId, - const OString& _sUniqueBrowseId ); + std::u16string_view listenerClassName, + std::u16string_view listenerMethodName, + TranslateId pDisplayNameResId, + OUString _sHelpId, + OString _sUniqueBrowseId ); }; typedef std::unordered_map< OUString, EventDescription > EventMap; @@ -238,6 +237,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_EVENTHANDLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx index af276592fc41..78dd50c8475d 100644 --- a/extensions/source/propctrlr/fontdialog.cxx +++ b/extensions/source/propctrlr/fontdialog.cxx @@ -32,7 +32,6 @@ #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/awt/FontStrikeout.hpp> #include "formstrings.hxx" -#include "fontitemids.hxx" #include <editeng/charreliefitem.hxx> #include <editeng/emphasismarkitem.hxx> #include <editeng/fontitem.hxx> @@ -49,7 +48,7 @@ #include <editeng/shdditem.hxx> #include <editeng/flstitem.hxx> #include <svtools/ctrltool.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <com/sun/star/beans/XPropertyState.hpp> #include <svx/svxids.hrc> #include <svx/svxdlg.hxx> @@ -67,6 +66,35 @@ namespace pcr //= OFontPropertyExtractor + namespace FontItemIds + { + constexpr sal_uInt16 CFID_FONT = 1; + constexpr sal_uInt16 CFID_HEIGHT = 2; + constexpr sal_uInt16 CFID_WEIGHT = 3; + constexpr sal_uInt16 CFID_POSTURE = 4; + constexpr sal_uInt16 CFID_LANGUAGE = 5; + constexpr sal_uInt16 CFID_UNDERLINE = 6; + constexpr sal_uInt16 CFID_STRIKEOUT = 7; + constexpr TypedWhichId<SvxWordLineModeItem> CFID_WORDLINEMODE(8); + constexpr sal_uInt16 CFID_CHARCOLOR = 9; + constexpr sal_uInt16 CFID_RELIEF = 10; + constexpr TypedWhichId<SvxEmphasisMarkItem> CFID_EMPHASIS(11); + + constexpr sal_uInt16 CFID_CJK_FONT = 12; + constexpr sal_uInt16 CFID_CJK_HEIGHT = 13; + constexpr sal_uInt16 CFID_CJK_WEIGHT = 14; + constexpr sal_uInt16 CFID_CJK_POSTURE = 15; + constexpr sal_uInt16 CFID_CJK_LANGUAGE = 16; + constexpr sal_uInt16 CFID_CASEMAP = 17; + constexpr TypedWhichId<SvxContourItem> CFID_CONTOUR(18); + constexpr TypedWhichId<SvxShadowedItem> CFID_SHADOWED(19); + + constexpr sal_uInt16 CFID_FONTLIST = 20; + + constexpr sal_uInt16 CFID_FIRST_ITEM_ID = CFID_FONT; + constexpr sal_uInt16 CFID_LAST_ITEM_ID = CFID_FONTLIST; + } + namespace { class OFontPropertyExtractor @@ -216,31 +244,32 @@ namespace pcr sal_Int32 nColor32 = aPropExtractor.getInt32FontProperty(PROPERTY_TEXTCOLOR, 0); // build SfxItems with the values - SvxFontItem aFontItem(static_cast<FontFamily>(nFontFamily), aFontName, aFontStyleName, PITCH_DONTKNOW, nFontCharset, CFID_FONT); + SvxFontItem aFontItem(static_cast<FontFamily>(nFontFamily), aFontName, aFontStyleName, PITCH_DONTKNOW, nFontCharset, FontItemIds::CFID_FONT); - nFontHeight = static_cast<float>(OutputDevice::LogicToLogic(Size(0, static_cast<sal_Int32>(nFontHeight)), MapMode(MapUnit::MapPoint), MapMode(MapUnit::MapTwip)).Height()); - SvxFontHeightItem aSvxFontHeightItem(static_cast<sal_uInt32>(nFontHeight),100,CFID_HEIGHT); + nFontHeight = static_cast<float>(o3tl::convert(nFontHeight, o3tl::Length::pt, o3tl::Length::twip)); + + SvxFontHeightItem aSvxFontHeightItem(static_cast<sal_uInt32>(nFontHeight),100,FontItemIds::CFID_HEIGHT); FontWeight eWeight=vcl::unohelper::ConvertFontWeight(nFontWeight); FontItalic eItalic=vcl::unohelper::ConvertFontSlant(nFontSlant); FontLineStyle eUnderline=static_cast<FontLineStyle>(nFontLineStyle); FontStrikeout eStrikeout=static_cast<FontStrikeout>(nFontStrikeout); - SvxWeightItem aWeightItem(eWeight,CFID_WEIGHT); - SvxPostureItem aPostureItem(eItalic,CFID_POSTURE); + SvxWeightItem aWeightItem(eWeight,FontItemIds::CFID_WEIGHT); + SvxPostureItem aPostureItem(eItalic,FontItemIds::CFID_POSTURE); - SvxCrossedOutItem aCrossedOutItem(eStrikeout,CFID_STRIKEOUT); - SvxWordLineModeItem aWordLineModeItem(bWordLineMode, CFID_WORDLINEMODE); + SvxCrossedOutItem aCrossedOutItem(eStrikeout,FontItemIds::CFID_STRIKEOUT); + SvxWordLineModeItem aWordLineModeItem(bWordLineMode, FontItemIds::CFID_WORDLINEMODE); - SvxUnderlineItem aUnderlineItem(eUnderline,CFID_UNDERLINE); + SvxUnderlineItem aUnderlineItem(eUnderline,FontItemIds::CFID_UNDERLINE); aUnderlineItem.SetColor(Color(ColorTransparency, nTextLineColor)); - SvxColorItem aSvxColorItem(Color(ColorTransparency, nColor32),CFID_CHARCOLOR); - SvxLanguageItem aLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), CFID_LANGUAGE); + SvxColorItem aSvxColorItem(Color(ColorTransparency, nColor32),FontItemIds::CFID_CHARCOLOR); + SvxLanguageItem aLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), FontItemIds::CFID_LANGUAGE); // the 2 CJK props - SvxCharReliefItem aFontReliefItem(static_cast<FontRelief>(nFontRelief), CFID_RELIEF); - SvxEmphasisMarkItem aEmphasisMarkitem(static_cast<FontEmphasisMark>(nFontEmphasisMark), CFID_EMPHASIS); + SvxCharReliefItem aFontReliefItem(static_cast<FontRelief>(nFontRelief), FontItemIds::CFID_RELIEF); + SvxEmphasisMarkItem aEmphasisMarkitem(static_cast<FontEmphasisMark>(nFontEmphasisMark), FontItemIds::CFID_EMPHASIS); _pSet->Put(aFontItem); _pSet->Put(aSvxFontHeightItem); @@ -254,16 +283,16 @@ namespace pcr _pSet->Put(aFontReliefItem); _pSet->Put(aEmphasisMarkitem); - aPropExtractor.invalidateItem(PROPERTY_FONT_NAME, CFID_FONT, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_FONT_HEIGHT, CFID_HEIGHT, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_FONT_WEIGHT, CFID_WEIGHT, *_pSet, css::awt::FontWeight::DONTKNOW == nFontWeight); - aPropExtractor.invalidateItem(PROPERTY_FONT_SLANT, CFID_POSTURE, *_pSet, css::awt::FontSlant_DONTKNOW == nFontSlant); - aPropExtractor.invalidateItem(PROPERTY_FONT_UNDERLINE, CFID_UNDERLINE, *_pSet, css::awt::FontUnderline::DONTKNOW == nFontLineStyle); - aPropExtractor.invalidateItem(PROPERTY_FONT_STRIKEOUT, CFID_STRIKEOUT, *_pSet, css::awt::FontStrikeout::DONTKNOW == nFontStrikeout); - aPropExtractor.invalidateItem(PROPERTY_WORDLINEMODE, CFID_WORDLINEMODE, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_TEXTCOLOR, CFID_CHARCOLOR, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_FONT_RELIEF, CFID_RELIEF, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_FONT_EMPHASIS_MARK, CFID_EMPHASIS, *_pSet); + aPropExtractor.invalidateItem(PROPERTY_FONT_NAME, FontItemIds::CFID_FONT, *_pSet); + aPropExtractor.invalidateItem(PROPERTY_FONT_HEIGHT, FontItemIds::CFID_HEIGHT, *_pSet); + aPropExtractor.invalidateItem(PROPERTY_FONT_WEIGHT, FontItemIds::CFID_WEIGHT, *_pSet, css::awt::FontWeight::DONTKNOW == nFontWeight); + aPropExtractor.invalidateItem(PROPERTY_FONT_SLANT, FontItemIds::CFID_POSTURE, *_pSet, css::awt::FontSlant_DONTKNOW == nFontSlant); + aPropExtractor.invalidateItem(PROPERTY_FONT_UNDERLINE, FontItemIds::CFID_UNDERLINE, *_pSet, css::awt::FontUnderline::DONTKNOW == nFontLineStyle); + aPropExtractor.invalidateItem(PROPERTY_FONT_STRIKEOUT, FontItemIds::CFID_STRIKEOUT, *_pSet, css::awt::FontStrikeout::DONTKNOW == nFontStrikeout); + aPropExtractor.invalidateItem(PROPERTY_WORDLINEMODE, FontItemIds::CFID_WORDLINEMODE, *_pSet); + aPropExtractor.invalidateItem(PROPERTY_TEXTCOLOR, FontItemIds::CFID_CHARCOLOR, *_pSet); + aPropExtractor.invalidateItem(PROPERTY_FONT_RELIEF, FontItemIds::CFID_RELIEF, *_pSet); + aPropExtractor.invalidateItem(PROPERTY_FONT_EMPHASIS_MARK, FontItemIds::CFID_EMPHASIS, *_pSet); } catch (const Exception&) { @@ -297,70 +326,70 @@ namespace pcr { // font name - SfxItemState eState = _rSet.GetItemState(CFID_FONT); + SfxItemState eState = _rSet.GetItemState(FontItemIds::CFID_FONT); if ( eState == SfxItemState::SET ) { const SvxFontItem& rFontItem = - static_cast<const SvxFontItem&>(_rSet.Get(CFID_FONT)); + static_cast<const SvxFontItem&>(_rSet.Get(FontItemIds::CFID_FONT)); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_NAME , makeAny(rFontItem.GetFamilyName())); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STYLENAME, makeAny(rFontItem.GetStyleName())); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_FAMILY , makeAny(static_cast<sal_Int16>(rFontItem.GetFamily()))); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_CHARSET , makeAny(static_cast<sal_Int16>(rFontItem.GetCharSet()))); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_NAME , Any(rFontItem.GetFamilyName())); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STYLENAME, Any(rFontItem.GetStyleName())); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_FAMILY , Any(static_cast<sal_Int16>(rFontItem.GetFamily()))); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_CHARSET , Any(static_cast<sal_Int16>(rFontItem.GetCharSet()))); } // font height - eState = _rSet.GetItemState(CFID_HEIGHT); + eState = _rSet.GetItemState(FontItemIds::CFID_HEIGHT); if ( eState == SfxItemState::SET ) { const SvxFontHeightItem& rSvxFontHeightItem = - static_cast<const SvxFontHeightItem&>(_rSet.Get(CFID_HEIGHT)); + static_cast<const SvxFontHeightItem&>(_rSet.Get(FontItemIds::CFID_HEIGHT)); - float nHeight = static_cast<float>(OutputDevice::LogicToLogic(Size(0, rSvxFontHeightItem.GetHeight()), MapMode(MapUnit::MapTwip), MapMode(MapUnit::MapPoint)).Height()); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_HEIGHT,makeAny(nHeight)); + float nHeight = static_cast<float>(o3tl::convert(rSvxFontHeightItem.GetHeight(), o3tl::Length::twip, o3tl::Length::pt)); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_HEIGHT,Any(nHeight)); } // font weight - eState = _rSet.GetItemState(CFID_WEIGHT); + eState = _rSet.GetItemState(FontItemIds::CFID_WEIGHT); if ( eState == SfxItemState::SET ) { const SvxWeightItem& rWeightItem = - static_cast<const SvxWeightItem&>(_rSet.Get(CFID_WEIGHT)); + static_cast<const SvxWeightItem&>(_rSet.Get(FontItemIds::CFID_WEIGHT)); float nWeight = vcl::unohelper::ConvertFontWeight(rWeightItem.GetWeight()); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_WEIGHT,makeAny(nWeight)); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_WEIGHT,Any(nWeight)); } // font slant - eState = _rSet.GetItemState(CFID_POSTURE); + eState = _rSet.GetItemState(FontItemIds::CFID_POSTURE); if ( eState == SfxItemState::SET ) { const SvxPostureItem& rPostureItem = - static_cast<const SvxPostureItem&>(_rSet.Get(CFID_POSTURE)); + static_cast<const SvxPostureItem&>(_rSet.Get(FontItemIds::CFID_POSTURE)); css::awt::FontSlant eSlant = vcl::unohelper::ConvertFontSlant(rPostureItem.GetPosture()); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_SLANT, makeAny(static_cast<sal_Int16>(eSlant))); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_SLANT, Any(static_cast<sal_Int16>(eSlant))); } // font underline - eState = _rSet.GetItemState(CFID_UNDERLINE); + eState = _rSet.GetItemState(FontItemIds::CFID_UNDERLINE); if ( eState == SfxItemState::SET ) { const SvxUnderlineItem& rUnderlineItem = - static_cast<const SvxUnderlineItem&>(_rSet.Get(CFID_UNDERLINE)); + static_cast<const SvxUnderlineItem&>(_rSet.Get(FontItemIds::CFID_UNDERLINE)); sal_Int16 nUnderline = static_cast<sal_Int16>(rUnderlineItem.GetLineStyle()); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_UNDERLINE,makeAny(nUnderline)); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_UNDERLINE,Any(nUnderline)); // the text line color is transported in this item, too Color nColor = rUnderlineItem.GetColor(); @@ -374,37 +403,37 @@ namespace pcr // font strikeout - eState = _rSet.GetItemState(CFID_STRIKEOUT); + eState = _rSet.GetItemState(FontItemIds::CFID_STRIKEOUT); if ( eState == SfxItemState::SET ) { const SvxCrossedOutItem& rCrossedOutItem = - static_cast<const SvxCrossedOutItem&>(_rSet.Get(CFID_STRIKEOUT)); + static_cast<const SvxCrossedOutItem&>(_rSet.Get(FontItemIds::CFID_STRIKEOUT)); sal_Int16 nStrikeout = static_cast<sal_Int16>(rCrossedOutItem.GetStrikeout()); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STRIKEOUT,makeAny(nStrikeout)); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STRIKEOUT,Any(nStrikeout)); } // font wordline mode - eState = _rSet.GetItemState(CFID_WORDLINEMODE); + eState = _rSet.GetItemState(FontItemIds::CFID_WORDLINEMODE); if ( eState == SfxItemState::SET ) { const SvxWordLineModeItem& rWordLineModeItem = - static_cast<const SvxWordLineModeItem&>(_rSet.Get(CFID_WORDLINEMODE)); + _rSet.Get(FontItemIds::CFID_WORDLINEMODE); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_WORDLINEMODE, css::uno::makeAny(rWordLineModeItem.GetValue())); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_WORDLINEMODE, css::uno::Any(rWordLineModeItem.GetValue())); } // text color - eState = _rSet.GetItemState(CFID_CHARCOLOR); + eState = _rSet.GetItemState(FontItemIds::CFID_CHARCOLOR); if ( eState == SfxItemState::SET ) { const SvxColorItem& rColorItem = - static_cast<const SvxColorItem&>(_rSet.Get(CFID_CHARCOLOR)); + static_cast<const SvxColorItem&>(_rSet.Get(FontItemIds::CFID_CHARCOLOR)); Color nColor = rColorItem.GetValue(); @@ -417,26 +446,25 @@ namespace pcr // font relief - eState = _rSet.GetItemState(CFID_RELIEF); + eState = _rSet.GetItemState(FontItemIds::CFID_RELIEF); if ( eState == SfxItemState::SET ) { const SvxCharReliefItem& rReliefItem = - static_cast<const SvxCharReliefItem&>(_rSet.Get(CFID_RELIEF)); + static_cast<const SvxCharReliefItem&>(_rSet.Get(FontItemIds::CFID_RELIEF)); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_RELIEF, makeAny(static_cast<sal_Int16>(rReliefItem.GetValue())) ); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_RELIEF, Any(static_cast<sal_Int16>(rReliefItem.GetValue())) ); } // font emphasis mark - eState = _rSet.GetItemState(CFID_EMPHASIS); + eState = _rSet.GetItemState(FontItemIds::CFID_EMPHASIS); if ( eState == SfxItemState::SET ) { - const SvxEmphasisMarkItem& rEmphMarkItem = - static_cast<const SvxEmphasisMarkItem&>(_rSet.Get(CFID_EMPHASIS)); + const SvxEmphasisMarkItem& rEmphMarkItem = _rSet.Get(FontItemIds::CFID_EMPHASIS); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_EMPHASIS_MARK, makeAny(static_cast<sal_Int16>(rEmphMarkItem.GetEmphasisMark())) ); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_EMPHASIS_MARK, Any(static_cast<sal_Int16>(rEmphMarkItem.GetEmphasisMark())) ); } } catch (const Exception& ) @@ -464,104 +492,89 @@ namespace pcr } } - void ControlCharacterDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults) + static ItemInfoPackage& getItemInfoPackageCntChrDlg() { - // just to be sure... - _rpSet = nullptr; - _rpPool = nullptr; - _rpDefaults = nullptr; - - // create and initialize the defaults - _rpDefaults = new std::vector<SfxPoolItem*>(CFID_LAST_ITEM_ID - CFID_FIRST_ITEM_ID + 1); - - vcl::Font aDefaultVCLFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont(); - - SfxPoolItem** pCounter = _rpDefaults->data(); // want to modify this without affecting the out param _rppDefaults - *pCounter++ = new SvxFontItem(aDefaultVCLFont.GetFamilyType(), aDefaultVCLFont.GetFamilyName(), aDefaultVCLFont.GetStyleName(), aDefaultVCLFont.GetPitch(), aDefaultVCLFont.GetCharSet(), CFID_FONT); - *pCounter++ = new SvxFontHeightItem(aDefaultVCLFont.GetFontHeight(), 100, CFID_HEIGHT); - *pCounter++ = new SvxWeightItem(aDefaultVCLFont.GetWeight(), CFID_WEIGHT); - *pCounter++ = new SvxPostureItem(aDefaultVCLFont.GetItalic(), CFID_POSTURE); - *pCounter++ = new SvxLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), CFID_LANGUAGE); - *pCounter++ = new SvxUnderlineItem(aDefaultVCLFont.GetUnderline(), CFID_UNDERLINE); - *pCounter++ = new SvxCrossedOutItem(aDefaultVCLFont.GetStrikeout(), CFID_STRIKEOUT); - *pCounter++ = new SvxWordLineModeItem(aDefaultVCLFont.IsWordLineMode(), CFID_WORDLINEMODE); - *pCounter++ = new SvxColorItem(aDefaultVCLFont.GetColor(), CFID_CHARCOLOR); - *pCounter++ = new SvxCharReliefItem(aDefaultVCLFont.GetRelief(), CFID_RELIEF); - *pCounter++ = new SvxEmphasisMarkItem(aDefaultVCLFont.GetEmphasisMark(), CFID_EMPHASIS); - - *pCounter++ = new SvxFontItem(aDefaultVCLFont.GetFamilyType(), aDefaultVCLFont.GetFamilyName(), aDefaultVCLFont.GetStyleName(), aDefaultVCLFont.GetPitch(), aDefaultVCLFont.GetCharSet(), CFID_CJK_FONT); - *pCounter++ = new SvxFontHeightItem(aDefaultVCLFont.GetFontHeight(), 100, CFID_CJK_HEIGHT); - *pCounter++ = new SvxWeightItem(aDefaultVCLFont.GetWeight(), CFID_CJK_WEIGHT); - *pCounter++ = new SvxPostureItem(aDefaultVCLFont.GetItalic(), CFID_CJK_POSTURE); - *pCounter++ = new SvxLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), CFID_CJK_LANGUAGE); - - *pCounter++ = new SvxCaseMapItem(SvxCaseMap::NotMapped, CFID_CASEMAP); - *pCounter++ = new SvxContourItem(false, CFID_CONTOUR); - *pCounter++ = new SvxShadowedItem(false, CFID_SHADOWED); - - *pCounter++ = new SvxFontListItem (new FontList(Application::GetDefaultDevice()), CFID_FONTLIST); - - // create the pool - static SfxItemInfo const aItemInfos[CFID_LAST_ITEM_ID - CFID_FIRST_ITEM_ID + 1] = + class ItemInfoPackageCntChrDlg : public ItemInfoPackage { - { SID_ATTR_CHAR_FONT, false }, - { SID_ATTR_CHAR_FONTHEIGHT, false }, - { SID_ATTR_CHAR_WEIGHT, false }, - { SID_ATTR_CHAR_POSTURE, false }, - { SID_ATTR_CHAR_LANGUAGE, false }, - { SID_ATTR_CHAR_UNDERLINE, false }, - { SID_ATTR_CHAR_STRIKEOUT, false }, - { SID_ATTR_CHAR_WORDLINEMODE, false }, - { SID_ATTR_CHAR_COLOR, false }, - { SID_ATTR_CHAR_RELIEF, false }, - { SID_ATTR_CHAR_EMPHASISMARK, false }, - { 0, false }, - { 0, false }, - { 0, false }, - { 0, false }, - { 0, false }, - { 0, false }, - { 0, false }, - { 0, false }, - { SID_ATTR_CHAR_FONTLIST, false } + vcl::Font maDefaultVCLFont{Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont()}; + typedef std::array<ItemInfoStatic, FontItemIds::CFID_LAST_ITEM_ID - FontItemIds::CFID_FIRST_ITEM_ID + 1> ItemInfoArrayCntChrDlg; + ItemInfoArrayCntChrDlg maItemInfos {{ + // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { FontItemIds::CFID_FONT, new SvxFontItem(maDefaultVCLFont.GetFamilyType(), maDefaultVCLFont.GetFamilyName(), maDefaultVCLFont.GetStyleName(), maDefaultVCLFont.GetPitch(), maDefaultVCLFont.GetCharSet(), FontItemIds::CFID_FONT), SID_ATTR_CHAR_FONT, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_HEIGHT, new SvxFontHeightItem(maDefaultVCLFont.GetFontHeight(), 100, FontItemIds::CFID_HEIGHT), SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_WEIGHT, new SvxWeightItem(maDefaultVCLFont.GetWeight(), FontItemIds::CFID_WEIGHT), SID_ATTR_CHAR_WEIGHT, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_POSTURE, new SvxPostureItem(maDefaultVCLFont.GetItalic(), FontItemIds::CFID_POSTURE), SID_ATTR_CHAR_POSTURE, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_LANGUAGE, new SvxLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), FontItemIds::CFID_LANGUAGE), SID_ATTR_CHAR_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_UNDERLINE, new SvxUnderlineItem(maDefaultVCLFont.GetUnderline(), FontItemIds::CFID_UNDERLINE), SID_ATTR_CHAR_UNDERLINE, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_STRIKEOUT, new SvxCrossedOutItem(maDefaultVCLFont.GetStrikeout(), FontItemIds::CFID_STRIKEOUT), SID_ATTR_CHAR_STRIKEOUT, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_WORDLINEMODE, new SvxWordLineModeItem(maDefaultVCLFont.IsWordLineMode(), FontItemIds::CFID_WORDLINEMODE), SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CHARCOLOR, new SvxColorItem(maDefaultVCLFont.GetColor(), FontItemIds::CFID_CHARCOLOR), SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_RELIEF, new SvxCharReliefItem(maDefaultVCLFont.GetRelief(), FontItemIds::CFID_RELIEF), SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_EMPHASIS, new SvxEmphasisMarkItem(maDefaultVCLFont.GetEmphasisMark(), FontItemIds::CFID_EMPHASIS), SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CJK_FONT, new SvxFontItem(maDefaultVCLFont.GetFamilyType(), maDefaultVCLFont.GetFamilyName(), maDefaultVCLFont.GetStyleName(), maDefaultVCLFont.GetPitch(), maDefaultVCLFont.GetCharSet(), FontItemIds::CFID_CJK_FONT), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CJK_HEIGHT, new SvxFontHeightItem(maDefaultVCLFont.GetFontHeight(), 100, FontItemIds::CFID_CJK_HEIGHT), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CJK_WEIGHT, new SvxWeightItem(maDefaultVCLFont.GetWeight(), FontItemIds::CFID_CJK_WEIGHT), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CJK_POSTURE, new SvxPostureItem(maDefaultVCLFont.GetItalic(), FontItemIds::CFID_CJK_POSTURE), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CJK_LANGUAGE, new SvxLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), FontItemIds::CFID_CJK_LANGUAGE), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CASEMAP, new SvxCaseMapItem(SvxCaseMap::NotMapped, FontItemIds::CFID_CASEMAP), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CONTOUR, new SvxContourItem(false, FontItemIds::CFID_CONTOUR), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_SHADOWED, new SvxShadowedItem(false, FontItemIds::CFID_SHADOWED), 0, SFX_ITEMINFOFLAG_NONE }, + + // SvxFontListItem has to be DynamicDefault. It is pool-dependent in the sense + // that it cannot/should not exist. Additionally SvxFontListItem has NO destructor + // and does not delete the contained/set FontList - this is done 'handish' in + // ControlCharacterDialog::destroyItemSet, see below... + { FontItemIds::CFID_FONTLIST, nullptr, SID_ATTR_CHAR_FONTLIST, SFX_ITEMINFOFLAG_NONE } + }}; + + virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; } + + public: + virtual size_t size() const override { return maItemInfos.size(); } + virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; } }; - _rpPool = new SfxItemPool("PCRControlFontItemPool", CFID_FIRST_ITEM_ID, CFID_LAST_ITEM_ID, - aItemInfos, _rpDefaults); - _rpPool->FreezeIdRanges(); + static std::unique_ptr<ItemInfoPackageCntChrDlg> g_aItemInfoPackageCntChrDlg; + if (!g_aItemInfoPackageCntChrDlg) + g_aItemInfoPackageCntChrDlg.reset(new ItemInfoPackageCntChrDlg); + return *g_aItemInfoPackageCntChrDlg; + } + + void ControlCharacterDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, FontList& rFontList) + { + // just to be sure... + _rpSet = nullptr; + _rpPool = nullptr; + _rpPool = new SfxItemPool("PCRControlFontItemPool"); + _rpPool->registerItemInfoPackage( + getItemInfoPackageCntChrDlg(), + [&rFontList](sal_uInt16 nWhich) + { + SfxPoolItem* pRetval(nullptr); + if (FontItemIds::CFID_FONTLIST == nWhich) + pRetval = new SvxFontListItem(&rFontList, FontItemIds::CFID_FONTLIST); + return pRetval; + }); // and, finally, the set _rpSet.reset(new SfxItemSet(*_rpPool)); } - void ControlCharacterDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults) + void ControlCharacterDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool) { - // from the pool, get and remember the font list (needs to be deleted) - const SvxFontListItem& rFontListItem = static_cast<const SvxFontListItem&>(_rpPool->GetDefaultItem(CFID_FONTLIST)); - const FontList* pFontList = rFontListItem.GetFontList(); - // _first_ delete the set (referring the pool) _rpSet.reset(); // delete the pool - _rpPool->ReleaseDefaults(true); - // the "true" means delete the items, too - SfxItemPool::Free(_rpPool); _rpPool = nullptr; - - // reset the defaults ptr - _rpDefaults = nullptr; - // no need to explicitly delete the defaults, this has been done by the ReleaseDefaults - - delete pFontList; } - void ControlCharacterDialog::PageCreated(const OString& rId, SfxTabPage& rPage) + void ControlCharacterDialog::PageCreated(const OUString& rId, SfxTabPage& rPage) { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); if (rId == "font") { - aSet.Put (static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST))); + aSet.Put (static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(FontItemIds::CFID_FONTLIST))); aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_HIDE_LANGUAGE)); rPage.PageCreated(aSet); } diff --git a/extensions/source/propctrlr/fontdialog.hxx b/extensions/source/propctrlr/fontdialog.hxx index c0fa45e33d84..07d72a600f4d 100644 --- a/extensions/source/propctrlr/fontdialog.hxx +++ b/extensions/source/propctrlr/fontdialog.hxx @@ -17,12 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FONTDIALOG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FONTDIALOG_HXX +#pragma once #include <sfx2/tabdlg.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <svtools/ctrltool.hxx> namespace pcr @@ -37,10 +37,10 @@ namespace pcr virtual ~ControlCharacterDialog() override; /// creates an item set to be used with this dialog - static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults); + static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, FontList& rFontList); /// destroys an item previously created with <method>createItemSet</method> - static void destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemPool*& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults); + static void destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool); /// fills the given item set with values obtained from the given property set static void translatePropertiesToItems( @@ -60,12 +60,10 @@ namespace pcr std::vector< css::beans::NamedValue >& _out_properties ); protected: - virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; + virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override; }; } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FONTDIALOG_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/fontitemids.hxx b/extensions/source/propctrlr/fontitemids.hxx deleted file mode 100644 index cc955dfcc750..000000000000 --- a/extensions/source/propctrlr/fontitemids.hxx +++ /dev/null @@ -1,51 +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_EXTENSIONS_SOURCE_PROPCTRLR_FONTITEMIDS_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FONTITEMIDS_HXX - -#define CFID_FONT 1 -#define CFID_HEIGHT 2 -#define CFID_WEIGHT 3 -#define CFID_POSTURE 4 -#define CFID_LANGUAGE 5 -#define CFID_UNDERLINE 6 -#define CFID_STRIKEOUT 7 -#define CFID_WORDLINEMODE 8 -#define CFID_CHARCOLOR 9 -#define CFID_RELIEF 10 -#define CFID_EMPHASIS 11 - -#define CFID_CJK_FONT 12 -#define CFID_CJK_HEIGHT 13 -#define CFID_CJK_WEIGHT 14 -#define CFID_CJK_POSTURE 15 -#define CFID_CJK_LANGUAGE 16 -#define CFID_CASEMAP 17 -#define CFID_CONTOUR 18 -#define CFID_SHADOWED 19 - -#define CFID_FONTLIST 20 - -#define CFID_FIRST_ITEM_ID CFID_FONT -#define CFID_LAST_ITEM_ID CFID_FONTLIST - -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FONTITEMIDS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formbrowsertools.hxx b/extensions/source/propctrlr/formbrowsertools.hxx index 7fede482d47f..707ae2bc6b02 100644 --- a/extensions/source/propctrlr/formbrowsertools.hxx +++ b/extensions/source/propctrlr/formbrowsertools.hxx @@ -17,14 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMBROWSERTOOLS_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMBROWSERTOOLS_HXX +#pragma once #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/beans/Property.hpp> #include <rtl/ustring.hxx> #include <set> +#include <utility> namespace pcr @@ -55,7 +55,7 @@ namespace pcr OUString m_sName; public: - explicit FindPropertyByName( const OUString& _rName ) : m_sName( _rName ) { } + explicit FindPropertyByName( OUString _aName ) : m_sName(std::move( _aName )) { } bool operator()( const css::beans::Property& _rProp ) const { return m_sName == _rProp.Name; @@ -87,6 +87,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMBROWSERTOOLS_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index c0f3cea4e51d..1b36dd64e387 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -90,6 +90,7 @@ #include <svl/filenotation.hxx> #include <svl/intitem.hxx> #include <svl/itemset.hxx> +#include <svl/numformat.hxx> #include <unotools/moduleoptions.hxx> #include <svl/numuno.hxx> #include <svl/urihelper.hxx> @@ -99,9 +100,10 @@ #include <svx/svxids.hrc> #include <vcl/graph.hxx> #include <vcl/unohelp.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <sal/macros.h> #include <sal/log.hxx> +#include <vcl/svapp.hxx> #include <limits> #include <memory> @@ -116,7 +118,6 @@ namespace pcr using namespace lang; using namespace beans; using namespace frame; - using namespace script; using namespace form; using namespace util; using namespace awt; @@ -191,14 +192,14 @@ namespace pcr namespace { - bool lcl_isLanguageDependentProperty( const OUString& aName ) + bool lcl_isLanguageDependentProperty( std::u16string_view aName ) { bool bRet = false; const LanguageDependentProp* pLangDepProp = aLanguageDependentProp; while( pLangDepProp->pPropName != nullptr ) { - if( aName.equalsAsciiL( pLangDepProp->pPropName, pLangDepProp->nPropNameLength )) + if( o3tl::equalsAscii( aName, std::string_view(pLangDepProp->pPropName, pLangDepProp->nPropNameLength) )) { bRet = true; break; @@ -209,7 +210,7 @@ namespace pcr } Reference< resource::XStringResourceResolver > lcl_getStringResourceResolverForProperty - ( const Reference< XPropertySet >& _xComponent, const OUString& _rPropertyName, + ( const Reference< XPropertySet >& _xComponent, std::u16string_view _rPropertyName, const Any& _rPropertyValue ) { Reference< resource::XStringResourceResolver > xRet; @@ -242,6 +243,10 @@ namespace pcr { const PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) ); + // tdf#117159 crash with chart in database report + if (!m_xComponent) + return Any(); + Any aPropertyValue( m_xComponent->getPropertyValue( _rPropertyName ) ); Reference< resource::XStringResourceResolver > xStringResourceResolver @@ -273,7 +278,7 @@ namespace pcr aResolvedStrings.reserve( aStrings.getLength() ); try { - for ( const OUString& rIdStr : std::as_const(aStrings) ) + for (const OUString& rIdStr : aStrings) { OUString aPureIdStr = rIdStr.copy( 1 ); if( xStringResourceResolver->hasEntryForId( aPureIdStr ) ) @@ -317,7 +322,7 @@ namespace pcr if ( PROPERTY_ID_IMAGE_URL == nPropId && ( _rValue >>= xGrfObj ) ) { DBG_ASSERT( xGrfObj.is(), "FormComponentPropertyHandler::setPropertyValue() xGrfObj is invalid"); - m_xComponent->setPropertyValue(PROPERTY_GRAPHIC, uno::makeAny(xGrfObj->getGraphic())); + m_xComponent->setPropertyValue(PROPERTY_GRAPHIC, uno::Any(xGrfObj->getGraphic())); } else if ( PROPERTY_ID_FONT == nPropId ) { @@ -326,7 +331,7 @@ namespace pcr if( ! (_rValue >>= aFontPropertyValues) ) SAL_WARN("extensions.propctrlr", "setPropertyValue: unable to get property " << PROPERTY_ID_FONT); - for ( const NamedValue& fontPropertyValue : std::as_const(aFontPropertyValues) ) + for (const NamedValue& fontPropertyValue : aFontPropertyValues) m_xComponent->setPropertyValue( fontPropertyValue.Name, fontPropertyValue.Value ); } else @@ -439,7 +444,7 @@ namespace pcr aValue <<= aNewIdStrings; // Remove old ids from resource for all locales - for( const OUString& rIdStr : std::as_const(aOldIdStrings) ) + for (const OUString& rIdStr : aOldIdStrings) { OUString aPureIdStr = rIdStr.copy( 1 ); for ( const Locale& rLocale : aLocaleSeq ) @@ -518,7 +523,7 @@ namespace pcr if( ! (_rControlValue >>= sControlValue) ) SAL_WARN("extensions.propctrlr", "convertToControlValue: unable to get property for Show/Hide"); - assert(SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2 && "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!"); + static_assert(SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2, "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!"); bool bShow = sControlValue == PcrRes(RID_RSC_ENUM_SHOWHIDE[1]); aPropertyValue <<= bShow; @@ -626,7 +631,7 @@ namespace pcr case PROPERTY_ID_SHOW_RECORDACTIONS: case PROPERTY_ID_SHOW_FILTERSORT: { - assert(SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2 && "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!"); + static_assert(SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2, "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!"); OUString sControlValue = ::comphelper::getBOOL(_rPropertyValue) ? PcrRes(RID_RSC_ENUM_SHOWHIDE[1]) : PcrRes(RID_RSC_ENUM_SHOWHIDE[0]); @@ -665,7 +670,7 @@ namespace pcr { OUString sLabel; if( ! (xSet->getPropertyValue( PROPERTY_LABEL) >>= sLabel) ) - SAL_WARN("extensions.propctrlr", "convertToPropertyValue: unable to get property " PROPERTY_LABEL); + SAL_WARN("extensions.propctrlr", "convertToPropertyValue: unable to get property " << PROPERTY_LABEL); sControlValue = "<" + sLabel + ">"; } @@ -716,7 +721,7 @@ namespace pcr break; } - aControlValue = PropertyHandlerComponent::convertToControlValue( _rPropertyName, makeAny( nNormalized ), _rControlValueType ); + aControlValue = PropertyHandlerComponent::convertToControlValue( _rPropertyName, Any( nNormalized ), _rControlValueType ); } break; @@ -734,12 +739,11 @@ namespace pcr else { // font name - displayName.append( aFont.Name ); - displayName.append( ", " ); + displayName.append( aFont.Name + ", " ); // font style ::FontWeight eWeight = vcl::unohelper::ConvertFontWeight( aFont.Weight ); - const char* pStyleResID = RID_STR_FONTSTYLE_REGULAR; + TranslateId pStyleResID = RID_STR_FONTSTYLE_REGULAR; if ( aFont.Slant == FontSlant_ITALIC ) { if ( eWeight > WEIGHT_NORMAL ) @@ -757,8 +761,7 @@ namespace pcr // font size if ( aFont.Height ) { - displayName.append( ", " ); - displayName.append( sal_Int32( aFont.Height ) ); + displayName.append( ", " + OUString::number( sal_Int32( aFont.Height ) ) ); } } @@ -813,7 +816,7 @@ namespace pcr PropertyId nPropId( 0 ); OUString sDisplayName; - for ( Property & rProperty : aAllProperties ) + for ( Property & rProperty : asNonConstRange(aAllProperties) ) { nPropId = m_pInfoService->getPropertyId( rProperty.Name ); if ( nPropId == -1 ) @@ -876,31 +879,31 @@ namespace pcr Sequence< OUString > SAL_CALL FormComponentPropertyHandler::getActuatingProperties( ) { - ::osl::MutexGuard aGuard( m_aMutex ); - std::vector< OUString > aInterestingProperties; - aInterestingProperties.push_back( PROPERTY_DATASOURCE ); - aInterestingProperties.push_back( PROPERTY_COMMAND ); - aInterestingProperties.push_back( PROPERTY_COMMANDTYPE ); - aInterestingProperties.push_back( PROPERTY_LISTSOURCE ); - aInterestingProperties.push_back( PROPERTY_LISTSOURCETYPE ); - aInterestingProperties.push_back( PROPERTY_SUBMIT_ENCODING ); - aInterestingProperties.push_back( PROPERTY_REPEAT ); - aInterestingProperties.push_back( PROPERTY_TABSTOP ); - aInterestingProperties.push_back( PROPERTY_BORDER ); - aInterestingProperties.push_back( PROPERTY_CONTROLSOURCE ); - aInterestingProperties.push_back( PROPERTY_DROPDOWN ); - aInterestingProperties.push_back( PROPERTY_IMAGE_URL ); - aInterestingProperties.push_back( PROPERTY_TARGET_URL ); - aInterestingProperties.push_back( PROPERTY_STRINGITEMLIST ); - aInterestingProperties.push_back( PROPERTY_BUTTONTYPE ); - aInterestingProperties.push_back( PROPERTY_ESCAPE_PROCESSING ); - aInterestingProperties.push_back( PROPERTY_TRISTATE ); - aInterestingProperties.push_back( PROPERTY_DECIMAL_ACCURACY ); - aInterestingProperties.push_back( PROPERTY_SHOWTHOUSANDSEP ); - aInterestingProperties.push_back( PROPERTY_FORMATKEY ); - aInterestingProperties.push_back( PROPERTY_EMPTY_IS_NULL ); - aInterestingProperties.push_back( PROPERTY_TOGGLE ); - return comphelper::containerToSequence(aInterestingProperties); + return + { + PROPERTY_DATASOURCE, + PROPERTY_COMMAND, + PROPERTY_COMMANDTYPE, + PROPERTY_LISTSOURCE, + PROPERTY_LISTSOURCETYPE, + PROPERTY_SUBMIT_ENCODING, + PROPERTY_REPEAT, + PROPERTY_TABSTOP, + PROPERTY_BORDER, + PROPERTY_CONTROLSOURCE, + PROPERTY_DROPDOWN, + PROPERTY_IMAGE_URL, + PROPERTY_TARGET_URL, + PROPERTY_STRINGITEMLIST, + PROPERTY_BUTTONTYPE, + PROPERTY_ESCAPE_PROCESSING, + PROPERTY_TRISTATE, + PROPERTY_DECIMAL_ACCURACY, + PROPERTY_SHOWTHOUSANDSEP, + PROPERTY_FORMATKEY, + PROPERTY_EMPTY_IS_NULL, + PROPERTY_TOGGLE + }; } LineDescriptor SAL_CALL FormComponentPropertyHandler::describePropertyLine( const OUString& _rPropertyName, @@ -992,13 +995,13 @@ namespace pcr { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/urlcontrol.ui", m_xContext)); auto pURLBox = std::make_unique<SvtURLBox>(xBuilder->weld_combo_box("urlcontrol")); - auto pControl = new OFileUrlControl(std::move(pURLBox), std::move(xBuilder), false); + rtl::Reference<OFileUrlControl> pControl = new OFileUrlControl(std::move(pURLBox), std::move(xBuilder), false); pControl->SetModifyHandler(); aDescriptor.Control = pControl; aDescriptor.PrimaryButtonId = PROPERTY_ID_TARGET_URL == nPropId - ? std::u16string_view(u"" UID_PROP_DLG_ATTR_TARGET_URL) - : std::u16string_view(u"" UID_PROP_DLG_IMAGE_URL); + ? UID_PROP_DLG_ATTR_TARGET_URL + : UID_PROP_DLG_IMAGE_URL; break; } @@ -1083,9 +1086,7 @@ namespace pcr { Reference< XUnoTunnel > xTunnel(xSupplier,UNO_QUERY); DBG_ASSERT(xTunnel.is(), "FormComponentPropertyHandler::describePropertyLine : xTunnel is invalid!"); - SvNumberFormatsSupplierObj* pSupplier = reinterpret_cast<SvNumberFormatsSupplierObj*>(xTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId())); - - if (pSupplier != nullptr) + if (auto pSupplier = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xTunnel)) { bool bIsFormatKey = (PROPERTY_ID_FORMATKEY == nPropId); @@ -1095,7 +1096,7 @@ namespace pcr { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/formattedsample.ui", m_xContext)); auto pContainer = xBuilder->weld_container("formattedsample"); - auto pControl = new OFormatSampleControl(std::move(pContainer), std::move(xBuilder), false); + rtl::Reference<OFormatSampleControl> pControl = new OFormatSampleControl(std::move(pContainer), std::move(xBuilder), false); pControl->SetModifyHandler(); pControl->SetFormatSupplier(pSupplier); @@ -1108,9 +1109,7 @@ namespace pcr { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/formattedcontrol.ui", m_xContext)); auto pSpinButton = xBuilder->weld_formatted_spin_button("formattedcontrol"); - // for ui-testing try and distinguish different instances of this formatted control - pSpinButton->set_buildable_name(pSpinButton->get_buildable_name() + "-" + aDescriptor.DisplayName.toUtf8()); - auto pControl = new OFormattedNumericControl(std::move(pSpinButton), std::move(xBuilder), false); + rtl::Reference<OFormattedNumericControl> pControl = new OFormattedNumericControl(std::move(pSpinButton), std::move(xBuilder), false); pControl->SetModifyHandler(); FormatDescription aDesc; @@ -1149,9 +1148,7 @@ namespace pcr { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/formattedcontrol.ui", m_xContext)); auto pSpinButton = xBuilder->weld_formatted_spin_button("formattedcontrol"); - // for ui-testing try and distinguish different instances of this formatted control - pSpinButton->set_buildable_name(pSpinButton->get_buildable_name() + "-" + aDescriptor.DisplayName.toUtf8()); - auto pControl = new OFormattedNumericControl(std::move(pSpinButton), std::move(xBuilder), false); + rtl::Reference<OFormattedNumericControl> pControl = new OFormattedNumericControl(std::move(pSpinButton), std::move(xBuilder), false); pControl->SetModifyHandler(); aDescriptor.Control = pControl; @@ -1212,7 +1209,6 @@ namespace pcr break; } - if ( eType == TypeClass_SEQUENCE ) nControlType = PropertyControlType::StringListField; @@ -1270,10 +1266,10 @@ namespace pcr // create the control if ( PROPERTY_ID_TARGET_FRAME == nPropId ) - aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, false ); + aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aListEntries), false ); else { - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, false ); + aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, std::move(aListEntries), false, false ); bNeedDefaultStringIfVoidAllowed = true; } } @@ -1285,7 +1281,7 @@ namespace pcr { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/numericfield.ui", m_xContext)); auto pSpinButton = xBuilder->weld_metric_spin_button("numericfield", FieldUnit::MILLISECOND); - auto pControl = new ONumericControl(std::move(pSpinButton), std::move(xBuilder), bReadOnly); + rtl::Reference<ONumericControl> pControl = new ONumericControl(std::move(pSpinButton), std::move(xBuilder), bReadOnly); pControl->SetModifyHandler(); pControl->setMinValue( Optional< double >( true, 0 ) ); pControl->setMaxValue( Optional< double >( true, std::numeric_limits< double >::max() ) ); @@ -1335,11 +1331,11 @@ namespace pcr std::vector< OUString > aListEntries; Reference< XDatabaseContext > xDatabaseContext = sdb::DatabaseContext::create( m_xContext ); - Sequence< OUString > aDatasources = xDatabaseContext->getElementNames(); + const Sequence< OUString > aDatasources = xDatabaseContext->getElementNames(); aListEntries.resize( aDatasources.getLength() ); std::copy( aDatasources.begin(), aDatasources.end(), aListEntries.begin() ); aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( - _rxControlFactory, aListEntries, true ); + _rxControlFactory, std::move(aListEntries), true ); } break; @@ -1348,7 +1344,7 @@ namespace pcr std::vector< OUString > aFieldNames; impl_initFieldList_nothrow( aFieldNames ); aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( - _rxControlFactory, aFieldNames, false ); + _rxControlFactory, std::move(aFieldNames), false ); } break; @@ -1489,7 +1485,7 @@ namespace pcr OSL_PRECOND( _rxInspectorUI.is(), "lcl_rebuildAndResetCommand: invalid BrowserUI!" ); OSL_PRECOND( _rxHandler.is(), "lcl_rebuildAndResetCommand: invalid handler!" ); _rxInspectorUI->rebuildPropertyUI( PROPERTY_COMMAND ); - _rxHandler->setPropertyValue( PROPERTY_COMMAND, makeAny( OUString() ) ); + _rxHandler->setPropertyValue( PROPERTY_COMMAND, Any( OUString() ) ); } } @@ -1675,7 +1671,7 @@ namespace pcr // ----- TriState ----- case PROPERTY_ID_TRISTATE: if ( !_bFirstTimeInit ) - _rxInspectorUI->rebuildPropertyUI( m_eComponentClass == eFormControl ? OUString(PROPERTY_DEFAULT_STATE) : OUString(PROPERTY_STATE) ); + _rxInspectorUI->rebuildPropertyUI( m_eComponentClass == eFormControl ? PROPERTY_DEFAULT_STATE : PROPERTY_STATE ); break; // case PROPERTY_ID_TRISTATE // ----- DecimalAccuracy ----- @@ -1698,7 +1694,7 @@ namespace pcr } // propagate the changes to the min/max/default fields - OUString aAffectedProps[] = { OUString(PROPERTY_VALUE), OUString(PROPERTY_DEFAULT_VALUE), OUString(PROPERTY_VALUEMIN), OUString(PROPERTY_VALUEMAX) }; + OUString aAffectedProps[] = { PROPERTY_VALUE, PROPERTY_DEFAULT_VALUE, PROPERTY_VALUEMIN, PROPERTY_VALUEMAX }; for (const OUString & aAffectedProp : aAffectedProps) { Reference< XPropertyControl > xControl; @@ -1743,7 +1739,7 @@ namespace pcr // give each control which has to know this an own copy of the description OUString aFormattedPropertyControls[] = { - OUString(PROPERTY_EFFECTIVE_MIN), OUString(PROPERTY_EFFECTIVE_MAX), OUString(PROPERTY_EFFECTIVE_DEFAULT), OUString(PROPERTY_EFFECTIVE_VALUE) + PROPERTY_EFFECTIVE_MIN, PROPERTY_EFFECTIVE_MAX, PROPERTY_EFFECTIVE_DEFAULT, PROPERTY_EFFECTIVE_VALUE }; for (const OUString & aFormattedPropertyControl : aFormattedPropertyControls) { @@ -1800,7 +1796,7 @@ namespace pcr { ListSourceType eLSType = ListSourceType_VALUELIST; if( ! (impl_getPropertyValue_throw( PROPERTY_LISTSOURCETYPE ) >>= eLSType) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_LISTSOURCETYPE); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_LISTSOURCETYPE); OUString sListSource; { @@ -1813,7 +1809,7 @@ namespace pcr } else if( ! (aListSourceValue >>= sListSource) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_LISTSOURCE); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_LISTSOURCE); } bool bIsEnabled = ( ( eLSType == ListSourceType_VALUELIST ) @@ -1835,7 +1831,7 @@ namespace pcr { ListSourceType eLSType = ListSourceType_VALUELIST; if( ! (impl_getPropertyValue_throw( PROPERTY_LISTSOURCETYPE ) >>= eLSType) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_LISTSOURCETYPE); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_LISTSOURCETYPE); _rxInspectorUI->enablePropertyUI( PROPERTY_BOUNDCOLUMN, ( eLSType != ListSourceType_VALUELIST ) @@ -1865,13 +1861,13 @@ namespace pcr { OUString sControlSource; if( ! (impl_getPropertyValue_throw( PROPERTY_CONTROLSOURCE ) >>= sControlSource) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_CONTROLSOURCE); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_CONTROLSOURCE); bool bEmptyIsNULL = false; bool bHasEmptyIsNULL = impl_componentHasProperty_throw( PROPERTY_EMPTY_IS_NULL ); if ( bHasEmptyIsNULL ) if( ! (impl_getPropertyValue_throw( PROPERTY_EMPTY_IS_NULL ) >>= bEmptyIsNULL) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_EMPTY_IS_NULL); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_EMPTY_IS_NULL); // if the control is not bound to a DB field, there is no sense in having the "Input required" // property @@ -1912,7 +1908,7 @@ namespace pcr if ( 0 != m_nClassId ) { if( ! (impl_getPropertyValue_throw( PROPERTY_BUTTONTYPE ) >>= eButtonType) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_BUTTONTYPE); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_BUTTONTYPE); } // if m_nClassId is 0, then we're inspecting a form. In this case, eButtonType is always // FormButtonType_URL here @@ -1954,7 +1950,7 @@ namespace pcr { sal_Int32 nCommandType( CommandType::COMMAND ); if( ! (impl_getPropertyValue_throw( PROPERTY_COMMANDTYPE ) >>= nCommandType) ) - SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " PROPERTY_COMMANDTYPE); + SAL_WARN("extensions.propctrlr", "impl_updateDependentProperty_nothrow: unable to get property " << PROPERTY_COMMANDTYPE); impl_ensureRowsetConnection_nothrow(); Reference< XConnection > xConnection = m_xRowSetConnection.getTyped(); @@ -2088,7 +2084,7 @@ namespace pcr if ( impl_componentHasProperty_throw( PROPERTY_CLASSID ) ) { if( ! (m_xComponent->getPropertyValue( PROPERTY_CLASSID ) >>= m_nClassId) ) - SAL_WARN("extensions.propctrlr", "impl_classifyControlModel_throw: unable to get property " PROPERTY_CLASSID); + SAL_WARN("extensions.propctrlr", "impl_classifyControlModel_throw: unable to get property " << PROPERTY_CLASSID); } else if ( eDialogControl == m_eComponentClass ) { @@ -2274,7 +2270,7 @@ namespace pcr break; case PROPERTY_ID_WRITING_MODE: - if ( !SvtCTLOptions().IsCTLFontEnabled() ) + if ( !SvtCTLOptions::IsCTLFontEnabled() ) return true; break; } @@ -2353,20 +2349,19 @@ namespace pcr OUString sObjectName; if( ! (xFormSet->getPropertyValue( PROPERTY_COMMAND ) >>= sObjectName) ) - SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " PROPERTY_COMMAND); + SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " << PROPERTY_COMMAND); // when there is no command we don't need to ask for columns if ( !sObjectName.isEmpty() && impl_ensureRowsetConnection_nothrow() ) { OUString aDatabaseName; if( ! (xFormSet->getPropertyValue( PROPERTY_DATASOURCE ) >>= aDatabaseName) ) - SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " PROPERTY_DATASOURCE); + SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " << PROPERTY_DATASOURCE); sal_Int32 nObjectType = CommandType::COMMAND; if( ! (xFormSet->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nObjectType) ) - SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " PROPERTY_COMMANDTYPE); + SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " << PROPERTY_COMMANDTYPE); const Sequence<OUString> aNames = ::dbtools::getFieldNamesByCommandDescriptor( m_xRowSetConnection, nObjectType, sObjectName ); - for ( const OUString& rField : aNames ) - _rFieldNames.push_back( rField ); + _rFieldNames.insert( _rFieldNames.end(), aNames.begin(), aNames.end() ); } } catch (const Exception&) @@ -2427,9 +2422,7 @@ namespace pcr if ( aParser.GetProtocol() != INetProtocol::NotValid ) sDataSourceName = aParser.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset ); OUString sInfo(PcrRes(RID_STR_UNABLETOCONNECT).replaceAll("$name$", sDataSourceName)); - SQLContext aContext; - aContext.Message = sInfo; - aContext.NextException = aError.get(); + SQLContext aContext(sInfo, {}, {}, 0, aError.get(), {}); impl_displaySQLError_nothrow( aContext ); } @@ -2467,7 +2460,7 @@ namespace pcr else impl_fillQueryNames_throw( aNames ); } - _out_rProperty.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aNames, true ); + _out_rProperty.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aNames), true ); } break; @@ -2497,8 +2490,7 @@ namespace pcr return; const Sequence<OUString> aNames = xTableNames->getElementNames(); - for ( const OUString& rTableName : aNames ) - _out_rNames.push_back( rTableName ); + _out_rNames.insert( _out_rNames.end(), aNames.begin(), aNames.end() ); } @@ -2516,13 +2508,13 @@ namespace pcr } } - void FormComponentPropertyHandler::impl_fillQueryNames_throw( const Reference< XNameAccess >& _xQueryNames,std::vector< OUString >& _out_rNames,const OUString& _sName ) const + void FormComponentPropertyHandler::impl_fillQueryNames_throw( const Reference< XNameAccess >& _xQueryNames,std::vector< OUString >& _out_rNames,std::u16string_view _sName ) const { DBG_ASSERT( _xQueryNames.is(), "FormComponentPropertyHandler::impl_fillQueryNames_throw: no way to obtain the queries of the connection!" ); if ( !_xQueryNames.is() ) return; - bool bAdd = !_sName.isEmpty(); + bool bAdd = !_sName.empty(); const Sequence<OUString> aQueryNames =_xQueryNames->getElementNames(); for ( const OUString& rQueryName : aQueryNames ) @@ -2530,13 +2522,12 @@ namespace pcr OUStringBuffer sTemp; if ( bAdd ) { - sTemp.append(_sName); - sTemp.append("/"); + sTemp.append(OUString::Concat(_sName) + "/"); } sTemp.append(rQueryName); Reference< XNameAccess > xSubQueries(_xQueryNames->getByName(rQueryName),UNO_QUERY); if ( xSubQueries.is() ) - impl_fillQueryNames_throw(xSubQueries,_out_rNames,sTemp.makeStringAndClear()); + impl_fillQueryNames_throw(xSubQueries,_out_rNames,sTemp); else _out_rNames.push_back( sTemp.makeStringAndClear() ); } @@ -2578,7 +2569,7 @@ namespace pcr else impl_fillTableNames_throw( aListEntries ); } - _out_rDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, false ); + _out_rDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, std::move(aListEntries), false ); } break; case ListSourceType_SQL: @@ -2636,11 +2627,11 @@ namespace pcr // initialize the dialog Reference< XPropertySet > xDialogProps( xDialog, UNO_QUERY_THROW ); - xDialogProps->setPropertyValue("QueryComposer", makeAny( xComposer ) ); - xDialogProps->setPropertyValue("RowSet", makeAny( m_xComponent ) ); + xDialogProps->setPropertyValue("QueryComposer", Any( xComposer ) ); + xDialogProps->setPropertyValue("RowSet", Any( m_xComponent ) ); if (auto pTopLevel = impl_getDefaultDialogFrame_nothrow()) - xDialogProps->setPropertyValue("ParentWindow", makeAny(pTopLevel->GetXWindow())); - xDialogProps->setPropertyValue("Title", makeAny( sPropertyUIName ) ); + xDialogProps->setPropertyValue("ParentWindow", Any(pTopLevel->GetXWindow())); + xDialogProps->setPropertyValue("Title", Any( sPropertyUIName ) ); _rClearBeforeDialog.clear(); bSuccess = ( xDialog->execute() != 0 ); @@ -2685,7 +2676,7 @@ namespace pcr SfxItemSet aCoreSet( SfxGetpApp()->GetPool(), svl::Items< - SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO>{}); + SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO>); // ripped this somewhere ... don't understand it :( // get the number formats supplier @@ -2722,18 +2713,15 @@ namespace pcr { const SfxItemSet* pResult = aDialog.GetOutputItemSet(); - const SfxPoolItem* pItem = pResult->GetItem( SID_ATTR_NUMBERFORMAT_INFO ); - const SvxNumberInfoItem* pInfoItem = dynamic_cast< const SvxNumberInfoItem* >( pItem ); - if (pInfoItem) + if (const SvxNumberInfoItem* pInfoItem = pResult->GetItem( SID_ATTR_NUMBERFORMAT_INFO )) { for (sal_uInt32 key : pInfoItem->GetDelFormats()) pFormatter->DeleteEntry(key); } - pItem = nullptr; - if ( SfxItemState::SET == pResult->GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, false, &pItem ) ) + if ( const SfxUInt32Item* pItem = pResult->GetItemIfSet( SID_ATTR_NUMBERFORMAT_VALUE, false ) ) { - _out_rNewValue <<= static_cast<sal_Int32>( static_cast< const SfxUInt32Item* >( pItem )->GetValue() ); + _out_rNewValue <<= static_cast<sal_Int32>( pItem->GetValue() ); bChanged = true; } } @@ -2754,7 +2742,7 @@ namespace pcr ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, FileDialogFlags::Graphic, pWin); - + aFileDlg.SetContext(sfx2::FileDialogHelper::FormsInsertImage); aFileDlg.SetTitle(aStrTrans); // non-linked images ( e.g. those located in the document // stream ) only if document is available @@ -2784,7 +2772,7 @@ namespace pcr OUString sCurValue; if( ! (impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sCurValue) ) - SAL_WARN("extensions.propctrlr", "impl_browseForImage_nothrow: unable to get property " PROPERTY_IMAGE_URL); + SAL_WARN("extensions.propctrlr", "impl_browseForImage_nothrow: unable to get property " << PROPERTY_IMAGE_URL); if (!sCurValue.isEmpty()) { aFileDlg.SetDisplayDirectory( sCurValue ); @@ -2825,7 +2813,7 @@ namespace pcr OUString sURL; if( ! (impl_getPropertyValue_throw( PROPERTY_TARGET_URL ) >>= sURL) ) - SAL_WARN("extensions.propctrlr", "impl_browseForTargetURL_nothrow: unable to get property " PROPERTY_TARGET_URL); + SAL_WARN("extensions.propctrlr", "impl_browseForTargetURL_nothrow: unable to get property " << PROPERTY_TARGET_URL); INetURLObject aParser( sURL ); if ( INetProtocol::File == aParser.GetProtocol() ) // set the initial directory only for file-URLs. Everything else @@ -2845,9 +2833,9 @@ namespace pcr // create an item set for use with the dialog std::unique_ptr<SfxItemSet> pSet; - SfxItemPool* pPool = nullptr; - std::vector<SfxPoolItem*>* pDefaults = nullptr; - ControlCharacterDialog::createItemSet(pSet, pPool, pDefaults); + rtl::Reference<SfxItemPool> pPool; + FontList aFontList(Application::GetDefaultDevice()); + ControlCharacterDialog::createItemSet(pSet, pPool, aFontList); ControlCharacterDialog::translatePropertiesToItems(m_xComponent, pSet.get()); { // do this in an own block. The dialog needs to be destroyed before we call @@ -2867,7 +2855,7 @@ namespace pcr } } - ControlCharacterDialog::destroyItemSet(pSet, pPool, pDefaults); + ControlCharacterDialog::destroyItemSet(pSet, pPool); return bSuccess; } @@ -2881,7 +2869,7 @@ namespace pcr OUString sDataSource; if( ! (impl_getPropertyValue_throw( PROPERTY_DATASOURCE ) >>= sDataSource) ) - SAL_WARN("extensions.propctrlr", "impl_browseForDatabaseDocument_throw: unable to get property " PROPERTY_DATASOURCE); + SAL_WARN("extensions.propctrlr", "impl_browseForDatabaseDocument_throw: unable to get property " << PROPERTY_DATASOURCE); INetURLObject aParser( sDataSource ); if ( INetProtocol::File == aParser.GetProtocol() ) // set the initial directory only for file-URLs. Everything else @@ -3016,7 +3004,7 @@ namespace pcr { OUString sCommand; if( ! (m_xObject->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand) ) - SAL_WARN("extensions.propctrlr", "getSQLCommand: unable to get property " PROPERTY_COMMAND); + SAL_WARN("extensions.propctrlr", "getSQLCommand: unable to get property " << PROPERTY_COMMAND); return sCommand; } @@ -3025,30 +3013,30 @@ namespace pcr { bool bEscapeProcessing( false ); if( ! (m_xObject->getPropertyValue( PROPERTY_ESCAPE_PROCESSING ) >>= bEscapeProcessing) ) - SAL_WARN("extensions.propctrlr", "getSQLCommand: unable to get property " PROPERTY_ESCAPE_PROCESSING); + SAL_WARN("extensions.propctrlr", "getSQLCommand: unable to get property " << PROPERTY_ESCAPE_PROCESSING); return bEscapeProcessing; } void FormSQLCommandUI::setSQLCommand( const OUString& _rCommand ) const { - m_xObject->setPropertyValue( PROPERTY_COMMAND, makeAny( _rCommand ) ); + m_xObject->setPropertyValue( PROPERTY_COMMAND, Any( _rCommand ) ); } void FormSQLCommandUI::setEscapeProcessing( const bool _bEscapeProcessing ) const { - m_xObject->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, makeAny( _bEscapeProcessing ) ); + m_xObject->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, Any( _bEscapeProcessing ) ); } OUString* FormSQLCommandUI::getPropertiesToDisable() { static OUString s_aCommandProps[] = { - OUString(PROPERTY_DATASOURCE), - OUString(PROPERTY_COMMAND), - OUString(PROPERTY_COMMANDTYPE), - OUString(PROPERTY_ESCAPE_PROCESSING), + PROPERTY_DATASOURCE, + PROPERTY_COMMAND, + PROPERTY_COMMANDTYPE, + PROPERTY_ESCAPE_PROCESSING, OUString() }; return s_aCommandProps; @@ -3112,7 +3100,7 @@ namespace pcr { ListSourceType eType = ListSourceType_SQL; if( ! (m_xObject->getPropertyValue( PROPERTY_LISTSOURCETYPE ) >>= eType) ) - SAL_WARN("extensions.propctrlr", "getEscapeProcessing: unable to get property " PROPERTY_LISTSOURCETYPE); + SAL_WARN("extensions.propctrlr", "getEscapeProcessing: unable to get property " << PROPERTY_LISTSOURCETYPE); OSL_ENSURE( ( eType == ListSourceType_SQL ) || ( eType == ListSourceType_SQLPASSTHROUGH ), "ValueListCommandUI::getEscapeProcessing: unexpected list source type!" ); return ( eType == ListSourceType_SQL ); @@ -3132,7 +3120,7 @@ namespace pcr void ValueListCommandUI::setEscapeProcessing( const bool _bEscapeProcessing ) const { - m_xObject->setPropertyValue( PROPERTY_LISTSOURCETYPE, makeAny( + m_xObject->setPropertyValue( PROPERTY_LISTSOURCETYPE, Any( _bEscapeProcessing ? ListSourceType_SQL : ListSourceType_SQLPASSTHROUGH ) ); } @@ -3140,8 +3128,8 @@ namespace pcr OUString* ValueListCommandUI::getPropertiesToDisable() { static OUString s_aListSourceProps[] = { - OUString(PROPERTY_LISTSOURCETYPE), - OUString(PROPERTY_LISTSOURCE), + PROPERTY_LISTSOURCETYPE, + PROPERTY_LISTSOURCE, OUString() }; return s_aListSourceProps; @@ -3161,7 +3149,7 @@ namespace pcr return true; } m_xCommandDesigner->dispose(); - m_xCommandDesigner.set( nullptr ); + m_xCommandDesigner.clear(); } if ( !impl_ensureRowsetConnection_nothrow() ) @@ -3183,7 +3171,7 @@ namespace pcr return false; } - m_xCommandDesigner.set( new SQLCommandDesigner( m_xContext, xCommandUI.get(), m_xRowSetConnection, LINK( this, FormComponentPropertyHandler, OnDesignerClosed ) ) ); + m_xCommandDesigner.set( new SQLCommandDesigner( m_xContext, xCommandUI, m_xRowSetConnection, LINK( this, FormComponentPropertyHandler, OnDesignerClosed ) ) ); DBG_ASSERT( _rxInspectorUI.is(), "FormComponentPropertyHandler::OnDesignerClosed: no access to the property browser ui!" ); if ( m_xCommandDesigner->isActive() && _rxInspectorUI.is() ) diff --git a/extensions/source/propctrlr/formcomponenthandler.hxx b/extensions/source/propctrlr/formcomponenthandler.hxx index 8359cdbccc04..bc7367abbeae 100644 --- a/extensions/source/propctrlr/formcomponenthandler.hxx +++ b/extensions/source/propctrlr/formcomponenthandler.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMCOMPONENTHANDLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMCOMPONENTHANDLER_HXX +#pragma once #include <memory> #include "propertyhandler.hxx" @@ -219,7 +218,7 @@ namespace pcr */ void impl_fillQueryNames_throw( const css::uno::Reference< css::container::XNameAccess >& _xQueryNames ,std::vector< OUString >& _out_rNames - ,const OUString& _sName = OUString() ) const; + ,std::u16string_view _sName = std::u16string_view() ) const; /** describes the UI for selecting a ListSource (for list-like form controls) @precond @@ -256,7 +255,7 @@ namespace pcr */ bool impl_dialogFilterOrSort_nothrow( bool _bFilter, OUString& _out_rSelectedClause, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; - /** executes a dialog which allows the user to chose the columns linking + /** executes a dialog which allows the user to choose the columns linking a sub to a master form, and sets the respective MasterFields / SlaveFields properties at the form. @precond @@ -433,6 +432,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMCOMPONENTHANDLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formcontroller.cxx b/extensions/source/propctrlr/formcontroller.cxx index e6be69492f2c..f2daf2dbd329 100644 --- a/extensions/source/propctrlr/formcontroller.cxx +++ b/extensions/source/propctrlr/formcontroller.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/util/VetoException.hpp> #include <cppuhelper/typeprovider.hxx> +#include <utility> namespace pcr @@ -56,12 +57,12 @@ namespace pcr FormController::FormController( const Reference< XComponentContext >& _rxContext, - const OUString& sImplementationName, + OUString sImplementationName, const css::uno::Sequence<OUString>& aSupportedServiceNames, bool _bUseFormFormComponentHandlers ) :OPropertyBrowserController( _rxContext ) ,FormController_PropertyBase1( m_aBHelper ) - ,m_sImplementationName( sImplementationName ) + ,m_sImplementationName(std::move( sImplementationName )) ,m_aSupportedServiceNames( aSupportedServiceNames ) { osl_atomic_increment( &m_refCount ); @@ -108,7 +109,7 @@ namespace pcr { Sequence< OUString > aSupported( m_aSupportedServiceNames ); aSupported.realloc( aSupported.getLength() + 1 ); - aSupported[ aSupported.getLength() - 1 ] = "com.sun.star.inspection.ObjectInspector"; + aSupported.getArray()[ aSupported.getLength() - 1 ] = "com.sun.star.inspection.ObjectInspector"; return aSupported; } @@ -127,35 +128,38 @@ namespace pcr ::cppu::IPropertyArrayHelper* FormController::createArrayHelper( ) const { - Sequence< Property > aProps( 2 ); - aProps[0] = Property( - PROPERTY_CURRENTPAGE, - OWN_PROPERTY_ID_CURRENTPAGE, - ::cppu::UnoType<OUString>::get(), - PropertyAttribute::TRANSIENT - ); - aProps[1] = Property( - PROPERTY_INTROSPECTEDOBJECT, - OWN_PROPERTY_ID_INTROSPECTEDOBJECT, - cppu::UnoType<XPropertySet>::get(), - PropertyAttribute::TRANSIENT | PropertyAttribute::CONSTRAINED - ); + Sequence< Property > aProps{ + Property( + PROPERTY_CURRENTPAGE, + static_cast<sal_Int32>(OwnPropertyId::CURRENTPAGE), + ::cppu::UnoType<OUString>::get(), + PropertyAttribute::TRANSIENT + ), + Property( + PROPERTY_INTROSPECTEDOBJECT, + static_cast<sal_Int32>(OwnPropertyId::INTROSPECTEDOBJECT), + cppu::UnoType<XPropertySet>::get(), + PropertyAttribute::TRANSIENT | PropertyAttribute::CONSTRAINED + ) + }; return new ::cppu::OPropertyArrayHelper( aProps ); } sal_Bool SAL_CALL FormController::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) { - switch ( nHandle ) + switch ( static_cast<OwnPropertyId>(nHandle) ) { - case OWN_PROPERTY_ID_INTROSPECTEDOBJECT: + case OwnPropertyId::INTROSPECTEDOBJECT: if ( rValue.getValueTypeClass() != TypeClass_INTERFACE ) throw IllegalArgumentException(); break; - case OWN_PROPERTY_ID_CURRENTPAGE: + case OwnPropertyId::CURRENTPAGE: if ( rValue.getValueTypeClass() != TypeClass_STRING ) throw IllegalArgumentException(); break; + default: + break; } getFastPropertyValue( rOldValue, nHandle ); @@ -166,9 +170,9 @@ namespace pcr void SAL_CALL FormController::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) { - switch ( _nHandle ) + switch ( static_cast<OwnPropertyId>(_nHandle) ) { - case OWN_PROPERTY_ID_INTROSPECTEDOBJECT: + case OwnPropertyId::INTROSPECTEDOBJECT: { Reference< XObjectInspectorModel > xModel( getInspectorModel() ); if ( xModel.is() ) @@ -179,8 +183,7 @@ namespace pcr Sequence< Reference< XInterface > > aObjects; if ( m_xCurrentInspectee.is() ) { - aObjects.realloc( 1 ); - aObjects[0] = m_xCurrentInspectee; + aObjects = { m_xCurrentInspectee }; } Reference< XObjectInspector > xInspector( *this, UNO_QUERY_THROW ); @@ -193,24 +196,28 @@ namespace pcr } } break; - case OWN_PROPERTY_ID_CURRENTPAGE: + case OwnPropertyId::CURRENTPAGE: restoreViewData( _rValue ); break; + default: + break; } } void SAL_CALL FormController::getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const { - switch ( nHandle ) + switch ( static_cast<OwnPropertyId>(nHandle) ) { - case OWN_PROPERTY_ID_INTROSPECTEDOBJECT: + case OwnPropertyId::INTROSPECTEDOBJECT: rValue <<= m_xCurrentInspectee; break; - case OWN_PROPERTY_ID_CURRENTPAGE: + case OwnPropertyId::CURRENTPAGE: rValue = const_cast< FormController* >( this )->getViewData(); break; + default: + break; } } diff --git a/extensions/source/propctrlr/formcontroller.hxx b/extensions/source/propctrlr/formcontroller.hxx index ddf689df8eef..f3415057fc80 100644 --- a/extensions/source/propctrlr/formcontroller.hxx +++ b/extensions/source/propctrlr/formcontroller.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_PROPCTRLR_FORMCONTROLLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMCONTROLLER_HXX +#pragma once #include "propcontroller.hxx" @@ -53,7 +52,7 @@ namespace pcr public: FormController( const css::uno::Reference< css::uno::XComponentContext >& _rxContext, - const OUString& sImplementName, + OUString sImplementName, const css::uno::Sequence<OUString>& aSupportedServiceNames, bool _bUseFormFormComponentHandlers ); @@ -101,6 +100,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formgeometryhandler.cxx b/extensions/source/propctrlr/formgeometryhandler.cxx index 8f7c04677538..b07cd7eb145e 100644 --- a/extensions/source/propctrlr/formgeometryhandler.cxx +++ b/extensions/source/propctrlr/formgeometryhandler.cxx @@ -41,9 +41,11 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/componentbase.hxx> #include <rtl/ref.hxx> -#include <tools/diagnose_ex.h> +#include <utility> +#include <comphelper/diagnose_ex.hxx> namespace pcr { @@ -57,7 +59,6 @@ namespace pcr using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::beans::Property; @@ -134,7 +135,6 @@ namespace pcr ShapeGeometryChangeNotifier( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rParentMutex, const Reference< XShape >& _shape ) :BroadcastHelperBase( _rParentMutex ) ,ShapeGeometryChangeNotifier_CBase( BroadcastHelperBase::getBroadcastHelper(), ::comphelper::ComponentBase::NoInitializationNeeded() ) - ,ShapeGeometryChangeNotifier_IBase() ,m_rParent( _rParent ) ,m_aPropertyChangeListeners( _rParentMutex ) ,m_xShape( _shape ) @@ -161,12 +161,12 @@ namespace pcr } // XInterface - virtual void SAL_CALL acquire( ) throw () override + virtual void SAL_CALL acquire( ) noexcept override { m_rParent.acquire(); } - virtual void SAL_CALL release( ) throw () override + virtual void SAL_CALL release( ) noexcept override { m_rParent.release(); } @@ -306,7 +306,7 @@ namespace pcr Reference< XMap > xControlMap; Any any = m_xContext->getValueByName( "ControlShapeAccess" ); any >>= xControlMap; - m_xAssociatedShape.set( xControlMap->get( makeAny( xControlModel ) ), UNO_QUERY_THROW ); + m_xAssociatedShape.set( xControlMap->get( Any( xControlModel ) ), UNO_QUERY_THROW ); m_xShapeProperties.set( m_xAssociatedShape, UNO_QUERY_THROW ); } } @@ -317,7 +317,7 @@ namespace pcr } if ( m_xAssociatedShape.is() ) - m_xChangeNotifier = new ShapeGeometryChangeNotifier( *this, m_aMutex, m_xAssociatedShape.get() ); + m_xChangeNotifier = new ShapeGeometryChangeNotifier( *this, m_aMutex, m_xAssociatedShape ); } @@ -640,7 +640,7 @@ namespace pcr continue; sal_Int32 nHeightOrWidth( 0 ); - OSL_VERIFY( xRowOrColumn->getPropertyValue( _bRows ? OUString(PROPERTY_HEIGHT) : OUString(PROPERTY_WIDTH) ) >>= nHeightOrWidth ); + OSL_VERIFY( xRowOrColumn->getPropertyValue( _bRows ? PROPERTY_HEIGHT : PROPERTY_WIDTH ) >>= nHeightOrWidth ); if ( nAccumulated + nHeightOrWidth > rRelativePos ) break; @@ -671,7 +671,7 @@ namespace pcr if ( xSheet.is() ) { css::awt::Point aPreservePosition( m_xAssociatedShape->getPosition() ); - m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR, makeAny( xSheet ) ); + m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR, Any( xSheet ) ); m_xAssociatedShape->setPosition( aPreservePosition ); } break; @@ -689,10 +689,10 @@ namespace pcr css::awt::Point aRelativePosition( m_xAssociatedShape->getPosition() ); Reference< XTableColumns > xCols( xColsRows->getColumns(), UNO_SET_THROW ); - sal_Int32 nNewAnchorCol = lcl_getLowerBoundRowOrColumn( xCols.get(), false, aRelativePosition ); + sal_Int32 nNewAnchorCol = lcl_getLowerBoundRowOrColumn( xCols, false, aRelativePosition ); Reference< XTableRows > xRows( xColsRows->getRows(), UNO_SET_THROW ); - sal_Int32 nNewAnchorRow = lcl_getLowerBoundRowOrColumn( xRows.get(), true, aRelativePosition ); + sal_Int32 nNewAnchorRow = lcl_getLowerBoundRowOrColumn( xRows, true, aRelativePosition ); Any aNewAnchorCell( xSheet->getCellByPosition( nNewAnchorCol, nNewAnchorRow ) ); m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR, aNewAnchorCell ); @@ -720,9 +720,9 @@ namespace pcr OUString sPropertyName; Any aNewPropertyValue; - EventTranslation( const OUString& _propertyName, const Any& _newPropertyValue ) - :sPropertyName( _propertyName ) - ,aNewPropertyValue( _newPropertyValue ) + EventTranslation( OUString _propertyName, Any _newPropertyValue ) + :sPropertyName(std::move( _propertyName )) + ,aNewPropertyValue(std::move( _newPropertyValue )) { } }; @@ -739,22 +739,22 @@ namespace pcr if ( _event.PropertyName == "Position" ) { css::awt::Point aPos = m_xShape->getPosition(); - aEventTranslations.push_back( EventTranslation( PROPERTY_POSITIONX, makeAny( aPos.X ) ) ); - aEventTranslations.push_back( EventTranslation( PROPERTY_POSITIONY, makeAny( aPos.Y ) ) ); + aEventTranslations.emplace_back(PROPERTY_POSITIONX, Any( aPos.X )); + aEventTranslations.emplace_back(PROPERTY_POSITIONY, Any( aPos.Y )); } else if ( _event.PropertyName == "Size" ) { css::awt::Size aSize = m_xShape->getSize(); - aEventTranslations.push_back( EventTranslation( PROPERTY_WIDTH, makeAny( aSize.Width ) ) ); - aEventTranslations.push_back( EventTranslation( PROPERTY_HEIGHT, makeAny( aSize.Height ) ) ); + aEventTranslations.emplace_back(PROPERTY_WIDTH, Any( aSize.Width )); + aEventTranslations.emplace_back(PROPERTY_HEIGHT, Any( aSize.Height )); } else if ( _event.PropertyName == PROPERTY_ANCHOR_TYPE ) { - aEventTranslations.push_back( EventTranslation( PROPERTY_TEXT_ANCHOR_TYPE, _event.NewValue ) ); + aEventTranslations.emplace_back(PROPERTY_TEXT_ANCHOR_TYPE, _event.NewValue); } else if ( _event.PropertyName == PROPERTY_ANCHOR ) { - aEventTranslations.push_back( EventTranslation( PROPERTY_SHEET_ANCHOR_TYPE, _event.NewValue ) ); + aEventTranslations.emplace_back(PROPERTY_SHEET_ANCHOR_TYPE, _event.NewValue); } PropertyChangeEvent aTranslatedEvent( _event ); diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx index 7f2d794b4010..605837c5d1b3 100644 --- a/extensions/source/propctrlr/formlinkdialog.cxx +++ b/extensions/source/propctrlr/formlinkdialog.cxx @@ -24,7 +24,8 @@ #include <strings.hrc> #include "formstrings.hxx" #include <sal/log.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> +#include <utility> #include <vcl/svapp.hxx> #include <connectivity/dbtools.hxx> #include <connectivity/dbexception.hxx> @@ -45,7 +46,6 @@ namespace pcr using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; @@ -136,14 +136,14 @@ namespace pcr FormLinkDialog::FormLinkDialog(weld::Window* _pParent, const Reference< XPropertySet >& _rxDetailForm, const Reference< XPropertySet >& _rxMasterForm, const Reference< XComponentContext >& _rxContext, const OUString& _sExplanation, - const OUString& _sDetailLabel, - const OUString& _sMasterLabel) + OUString _sDetailLabel, + OUString _sMasterLabel) : GenericDialogController(_pParent, "modules/spropctrlr/ui/formlinksdialog.ui", "FormLinks") , m_xContext ( _rxContext ) , m_xDetailForm( _rxDetailForm ) , m_xMasterForm( _rxMasterForm ) - , m_sDetailLabel(_sDetailLabel) - , m_sMasterLabel(_sMasterLabel) + , m_sDetailLabel(std::move(_sDetailLabel)) + , m_sMasterLabel(std::move(_sMasterLabel)) , m_xExplanation(m_xBuilder->weld_label("explanationLabel")) , m_xDetailLabel(m_xBuilder->weld_label("detailLabel")) , m_xMasterLabel(m_xBuilder->weld_label("masterLabel")) @@ -209,8 +209,8 @@ namespace pcr { if ( m_xDetailForm.is() ) { - m_xDetailForm->setPropertyValue( PROPERTY_DETAILFIELDS, makeAny( Sequence< OUString >( aDetailFields.data(), aDetailFields.size() ) ) ); - m_xDetailForm->setPropertyValue( PROPERTY_MASTERFIELDS, makeAny( Sequence< OUString >( aMasterFields.data(), aMasterFields.size() ) ) ); + m_xDetailForm->setPropertyValue( PROPERTY_DETAILFIELDS, Any( Sequence< OUString >( aDetailFields.data(), aDetailFields.size() ) ) ); + m_xDetailForm->setPropertyValue( PROPERTY_MASTERFIELDS, Any( Sequence< OUString >( aMasterFields.data(), aMasterFields.size() ) ) ); } } catch( const Exception& ) @@ -413,9 +413,7 @@ namespace pcr sErrorMessage = sErrorMessage.replaceFirst("#", sCommand); } - SQLContext aContext; - aContext.Message = sErrorMessage; - aContext.NextException = aErrorInfo.get(); + SQLContext aContext(sErrorMessage, {}, {}, 0, aErrorInfo.get(), {}); ::dbtools::showError(aContext, m_xDialog->GetXWindow(), m_xContext); } diff --git a/extensions/source/propctrlr/formlinkdialog.hxx b/extensions/source/propctrlr/formlinkdialog.hxx index fe1c64b0159f..58e9fe27dea0 100644 --- a/extensions/source/propctrlr/formlinkdialog.hxx +++ b/extensions/source/propctrlr/formlinkdialog.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX +#pragma once #include <vcl/weld.hxx> @@ -68,8 +67,8 @@ namespace pcr const css::uno::Reference< css::beans::XPropertySet >& _rxMasterForm, const css::uno::Reference< css::uno::XComponentContext >& _rxContext, const OUString& _sExplanation = OUString(), - const OUString& _sDetailLabel = OUString(), - const OUString& _sMasterLabel = OUString() + OUString _sDetailLabel = OUString(), + OUString _sMasterLabel = OUString() ); virtual ~FormLinkDialog() override; @@ -125,6 +124,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx index 3fd9e92b3a0f..c6e1e0d6020e 100644 --- a/extensions/source/propctrlr/formmetadata.cxx +++ b/extensions/source/propctrlr/formmetadata.cxx @@ -25,9 +25,10 @@ #include <strings.hrc> #include <stringarrays.hrc> #include <comphelper/extract.hxx> +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> -#include <sal/macros.h> #include <algorithm> +#include <utility> namespace pcr { @@ -40,26 +41,26 @@ namespace pcr { OUString sName; OUString sTranslation; - OString sHelpId; + OUString sHelpId; sal_Int32 nId; sal_uInt16 nPos; sal_uInt32 nUIFlags; OPropertyInfoImpl( - const OUString& rName, + OUString aName, sal_Int32 _nId, - const OUString& aTranslation, + OUString aTranslation, sal_uInt16 nPosId, - const OString&, + OUString , sal_uInt32 _nUIFlags); }; - OPropertyInfoImpl::OPropertyInfoImpl(const OUString& _rName, sal_Int32 _nId, - const OUString& aString, sal_uInt16 nP, const OString& sHid, sal_uInt32 _nUIFlags) - :sName(_rName) - ,sTranslation(aString) - ,sHelpId(sHid) + OPropertyInfoImpl::OPropertyInfoImpl(OUString _aName, sal_Int32 _nId, + OUString aString, sal_uInt16 nP, OUString sHid, sal_uInt32 _nUIFlags) + :sName(std::move(_aName)) + ,sTranslation(std::move(aString)) + ,sHelpId(std::move(sHid)) ,nId(_nId) ,nPos(nP) ,nUIFlags(_nUIFlags) @@ -97,7 +98,7 @@ namespace pcr #define DEF_INFO_4( ident, uinameres, pos, helpid, flag1, flag2, flag3, flag4 ) \ DEF_INFO( ident, uinameres, pos, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 | PROP_FLAG_##flag4 ) - sal_uInt16 OPropertyInfoService::s_nCount = 0; + std::size_t OPropertyInfoService::s_nCount = 0; OPropertyInfoImpl* OPropertyInfoService::s_pPropertyInfos = nullptr; const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo() @@ -358,7 +359,7 @@ namespace pcr }; s_pPropertyInfos = aPropertyInfos; - s_nCount = SAL_N_ELEMENTS(aPropertyInfos); + s_nCount = std::size(aPropertyInfos); // sort std::sort( s_pPropertyInfos, s_pPropertyInfos + s_nCount, PropertyInfoLessByName() ); @@ -387,10 +388,10 @@ namespace pcr return pInfo ? pInfo->sTranslation : OUString(); } - OString OPropertyInfoService::getPropertyHelpId(sal_Int32 _nId) const + OUString OPropertyInfoService::getPropertyHelpId(sal_Int32 _nId) const { const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return pInfo ? pInfo->sHelpId : OString(); + return pInfo ? pInfo->sHelpId : OUString(); } sal_Int16 OPropertyInfoService::getPropertyPos(sal_Int32 _nId) const @@ -410,131 +411,131 @@ namespace pcr OSL_ENSURE( ( ( getPropertyUIFlags( _nId ) & PROP_FLAG_ENUM ) != 0 ) || ( _nId == PROPERTY_ID_TARGET_FRAME ), "OPropertyInfoService::getPropertyEnumRepresentations: this is no enum property!" ); - const char** pStringItemsResId = nullptr; - int nElements = 0; + if (_nId == PROPERTY_ID_SUBMIT_METHOD) + { + return { "Get", "Post" }; + } + const TranslateId* pStringItemsResId = nullptr; + std::size_t nElements = 0; switch ( _nId ) { case PROPERTY_ID_IMAGEPOSITION: pStringItemsResId = RID_RSC_ENUM_IMAGE_POSITION; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_IMAGE_POSITION); + nElements = std::size(RID_RSC_ENUM_IMAGE_POSITION); break; case PROPERTY_ID_BORDER: pStringItemsResId = RID_RSC_ENUM_BORDER_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_BORDER_TYPE); + nElements = std::size(RID_RSC_ENUM_BORDER_TYPE); break; case PROPERTY_ID_ICONSIZE: pStringItemsResId = RID_RSC_ENUM_ICONSIZE_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_ICONSIZE_TYPE); + nElements = std::size(RID_RSC_ENUM_ICONSIZE_TYPE); break; case PROPERTY_ID_COMMANDTYPE: pStringItemsResId = RID_RSC_ENUM_COMMAND_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_COMMAND_TYPE); + nElements = std::size(RID_RSC_ENUM_COMMAND_TYPE); break; case PROPERTY_ID_LISTSOURCETYPE: pStringItemsResId = RID_RSC_ENUM_LISTSOURCE_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_LISTSOURCE_TYPE); + nElements = std::size(RID_RSC_ENUM_LISTSOURCE_TYPE); break; case PROPERTY_ID_ALIGN: pStringItemsResId = RID_RSC_ENUM_ALIGNMENT; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_ALIGNMENT); + nElements = std::size(RID_RSC_ENUM_ALIGNMENT); break; case PROPERTY_ID_VERTICAL_ALIGN: pStringItemsResId = RID_RSC_ENUM_VERTICAL_ALIGN; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_VERTICAL_ALIGN); + nElements = std::size(RID_RSC_ENUM_VERTICAL_ALIGN); break; case PROPERTY_ID_BUTTONTYPE: pStringItemsResId = RID_RSC_ENUM_BUTTONTYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_BUTTONTYPE); + nElements = std::size(RID_RSC_ENUM_BUTTONTYPE); break; case PROPERTY_ID_PUSHBUTTONTYPE: pStringItemsResId = RID_RSC_ENUM_PUSHBUTTONTYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_PUSHBUTTONTYPE); - break; - case PROPERTY_ID_SUBMIT_METHOD: - pStringItemsResId = RID_RSC_ENUM_SUBMIT_METHOD; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SUBMIT_METHOD); + nElements = std::size(RID_RSC_ENUM_PUSHBUTTONTYPE); break; case PROPERTY_ID_SUBMIT_ENCODING: pStringItemsResId = RID_RSC_ENUM_SUBMIT_ENCODING; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SUBMIT_ENCODING); + nElements = std::size(RID_RSC_ENUM_SUBMIT_ENCODING); break; case PROPERTY_ID_DATEFORMAT: pStringItemsResId = RID_RSC_ENUM_DATEFORMAT_LIST; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_DATEFORMAT_LIST); + nElements = std::size(RID_RSC_ENUM_DATEFORMAT_LIST); break; case PROPERTY_ID_TIMEFORMAT: pStringItemsResId = RID_RSC_ENUM_TIMEFORMAT_LIST; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_TIMEFORMAT_LIST); + nElements = std::size(RID_RSC_ENUM_TIMEFORMAT_LIST); break; case PROPERTY_ID_DEFAULT_STATE: case PROPERTY_ID_STATE: pStringItemsResId = RID_RSC_ENUM_CHECKED; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_CHECKED); + nElements = std::size(RID_RSC_ENUM_CHECKED); break; case PROPERTY_ID_CYCLE: pStringItemsResId = RID_RSC_ENUM_CYCLE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_CYCLE); + nElements = std::size(RID_RSC_ENUM_CYCLE); break; case PROPERTY_ID_NAVIGATION: pStringItemsResId = RID_RSC_ENUM_NAVIGATION; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_NAVIGATION); + nElements = std::size(RID_RSC_ENUM_NAVIGATION); break; case PROPERTY_ID_TARGET_FRAME: pStringItemsResId = RID_RSC_ENUM_SUBMIT_TARGET; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SUBMIT_TARGET); + nElements = std::size(RID_RSC_ENUM_SUBMIT_TARGET); break; case PROPERTY_ID_ORIENTATION: pStringItemsResId = RID_RSC_ENUM_ORIENTATION; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_ORIENTATION); + nElements = std::size(RID_RSC_ENUM_ORIENTATION); break; case PROPERTY_ID_CELL_EXCHANGE_TYPE: pStringItemsResId = RID_RSC_ENUM_CELL_EXCHANGE_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_CELL_EXCHANGE_TYPE); + nElements = std::size(RID_RSC_ENUM_CELL_EXCHANGE_TYPE); break; case PROPERTY_ID_SHOW_SCROLLBARS: pStringItemsResId = RID_RSC_ENUM_SCROLLBARS; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SCROLLBARS); + nElements = std::size(RID_RSC_ENUM_SCROLLBARS); break; case PROPERTY_ID_VISUALEFFECT: pStringItemsResId = RID_RSC_ENUM_VISUALEFFECT; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_VISUALEFFECT); + nElements = std::size(RID_RSC_ENUM_VISUALEFFECT); break; case PROPERTY_ID_TEXTTYPE: pStringItemsResId = RID_RSC_ENUM_TEXTTYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_TEXTTYPE); + nElements = std::size(RID_RSC_ENUM_TEXTTYPE); break; case PROPERTY_ID_LINEEND_FORMAT: pStringItemsResId = RID_RSC_ENUM_LINEEND_FORMAT; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_LINEEND_FORMAT); + nElements = std::size(RID_RSC_ENUM_LINEEND_FORMAT); break; case PROPERTY_ID_XSD_WHITESPACES: pStringItemsResId = RID_RSC_ENUM_WHITESPACE_HANDLING; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_WHITESPACE_HANDLING); + nElements = std::size(RID_RSC_ENUM_WHITESPACE_HANDLING); break; case PROPERTY_ID_SELECTION_TYPE: case PROPERTY_ID_SELECTIONMODEL: pStringItemsResId = RID_RSC_ENUM_SELECTION_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SELECTION_TYPE); + nElements = std::size(RID_RSC_ENUM_SELECTION_TYPE); break; case PROPERTY_ID_SCALE_MODE: pStringItemsResId = RID_RSC_ENUM_SCALE_MODE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SCALE_MODE); + nElements = std::size(RID_RSC_ENUM_SCALE_MODE); break; case PROPERTY_ID_WRITING_MODE: pStringItemsResId = RID_RSC_ENUM_WRITING_MODE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_WRITING_MODE); + nElements = std::size(RID_RSC_ENUM_WRITING_MODE); break; case PROPERTY_ID_WHEEL_BEHAVIOR: pStringItemsResId = RID_RSC_ENUM_WHEEL_BEHAVIOR; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_WHEEL_BEHAVIOR); + nElements = std::size(RID_RSC_ENUM_WHEEL_BEHAVIOR); break; case PROPERTY_ID_TEXT_ANCHOR_TYPE: pStringItemsResId = RID_RSC_ENUM_TEXT_ANCHOR_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_TEXT_ANCHOR_TYPE); + nElements = std::size(RID_RSC_ENUM_TEXT_ANCHOR_TYPE); break; case PROPERTY_ID_SHEET_ANCHOR_TYPE: pStringItemsResId = RID_RSC_ENUM_SHEET_ANCHOR_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SHEET_ANCHOR_TYPE); + nElements = std::size(RID_RSC_ENUM_SHEET_ANCHOR_TYPE); break; default: OSL_FAIL( "OPropertyInfoService::getPropertyEnumRepresentations: unknown enum property!" ); @@ -544,7 +545,7 @@ namespace pcr std::vector< OUString > aReturn; aReturn.reserve(nElements); - for (int i = 0; i < nElements; ++i) + for (std::size_t i = 0; i < nElements; ++i) { aReturn.push_back(PcrRes(pStringItemsResId[i])); } @@ -590,7 +591,7 @@ namespace pcr getPropertyInfo(); // TODO: a real structure which allows quick access by name as well as by id - for (sal_uInt16 i = 0; i < s_nCount; i++) + for (std::size_t i = 0; i < s_nCount; ++i) if (s_pPropertyInfos[i].nId == _nId) return &s_pPropertyInfos[i]; @@ -675,7 +676,7 @@ namespace pcr --nIntValue; std::vector< OUString > aEnumStrings = m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId ); - if ( ( nIntValue >= 0 ) && ( nIntValue < static_cast<sal_Int32>(aEnumStrings.size()) ) ) + if ( ( nIntValue >= 0 ) && ( o3tl::make_unsigned(nIntValue) < aEnumStrings.size() ) ) { sReturn = aEnumStrings[ nIntValue ]; } diff --git a/extensions/source/propctrlr/formmetadata.hxx b/extensions/source/propctrlr/formmetadata.hxx index f72266712eab..c2c297740b01 100644 --- a/extensions/source/propctrlr/formmetadata.hxx +++ b/extensions/source/propctrlr/formmetadata.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMMETADATA_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMMETADATA_HXX +#pragma once #include "propertyinfo.hxx" #include "enumrepresentation.hxx" @@ -36,7 +35,7 @@ namespace pcr class OPropertyInfoService final :public IPropertyInfoService { - static sal_uInt16 s_nCount; + static std::size_t s_nCount; static OPropertyInfoImpl* s_pPropertyInfos; // TODO: a real structure which allows quick access by name as well as by id @@ -44,7 +43,7 @@ namespace pcr // IPropertyInfoService virtual sal_Int32 getPropertyId(const OUString& _rName) const override; virtual OUString getPropertyTranslation(sal_Int32 _nId) const override; - virtual OString getPropertyHelpId(sal_Int32 _nId) const override; + virtual OUString getPropertyHelpId(sal_Int32 _nId) const override; virtual sal_Int16 getPropertyPos(sal_Int32 _nId) const override; virtual sal_uInt32 getPropertyUIFlags(sal_Int32 _nId) const override; virtual std::vector< OUString > getPropertyEnumRepresentations(sal_Int32 _nId) const override; @@ -343,6 +342,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMMETADATA_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formstrings.hxx b/extensions/source/propctrlr/formstrings.hxx index 33a554f05790..41deed74c8fb 100644 --- a/extensions/source/propctrlr/formstrings.hxx +++ b/extensions/source/propctrlr/formstrings.hxx @@ -17,299 +17,286 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMSTRINGS_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMSTRINGS_HXX +#pragma once +#include <rtl/ustring.hxx> -namespace pcr -{ +inline constexpr OUString PROPERTY_DEFAULTCONTROL = u"DefaultControl"_ustr; +inline constexpr OUString PROPERTY_INTROSPECTEDOBJECT = u"IntrospectedObject"_ustr; +inline constexpr OUString PROPERTY_CURRENTPAGE = u"CurrentPage"_ustr; +inline constexpr OUString PROPERTY_CONTROLCONTEXT = u"ControlContext"_ustr; +// properties +inline constexpr OUString PROPERTY_CLASSID = u"ClassId"_ustr; +inline constexpr OUString PROPERTY_CONTROLLABEL = u"LabelControl"_ustr; +inline constexpr OUString PROPERTY_LABEL = u"Label"_ustr; +inline constexpr OUString PROPERTY_TABINDEX = u"TabIndex"_ustr; +inline constexpr OUString PROPERTY_WHEEL_BEHAVIOR = u"MouseWheelBehavior"_ustr; +inline constexpr OUString PROPERTY_TAG = u"Tag"_ustr; +inline constexpr OUString PROPERTY_NAME = u"Name"_ustr; +inline constexpr OUString PROPERTY_GROUP_NAME = u"GroupName"_ustr; +inline constexpr OUString PROPERTY_VALUE = u"Value"_ustr; +inline constexpr OUString PROPERTY_TEXT = u"Text"_ustr; +inline constexpr OUString PROPERTY_NAVIGATION = u"NavigationBarMode"_ustr; +inline constexpr OUString PROPERTY_CYCLE = u"Cycle"_ustr; +inline constexpr OUString PROPERTY_CONTROLSOURCE = u"DataField"_ustr; +inline constexpr OUString PROPERTY_INPUT_REQUIRED = u"InputRequired"_ustr; +inline constexpr OUString PROPERTY_ENABLED = u"Enabled"_ustr; +inline constexpr OUString PROPERTY_ENABLE_VISIBLE = u"EnableVisible"_ustr; +inline constexpr OUString PROPERTY_READONLY = u"ReadOnly"_ustr; +inline constexpr OUString PROPERTY_FILTER = u"Filter"_ustr; +inline constexpr OUString PROPERTY_WIDTH = u"Width"_ustr; +inline constexpr OUString PROPERTY_MULTILINE = u"MultiLine"_ustr; +inline constexpr OUString PROPERTY_WORDBREAK = u"WordBreak"_ustr; +inline constexpr OUString PROPERTY_TARGET_URL = u"TargetURL"_ustr; +inline constexpr OUString PROPERTY_TARGET_FRAME = u"TargetFrame"_ustr; +inline constexpr OUString PROPERTY_MAXTEXTLEN = u"MaxTextLen"_ustr; +inline constexpr OUString PROPERTY_EDITMASK = u"EditMask"_ustr; +inline constexpr OUString PROPERTY_SPIN = u"Spin"_ustr; +inline constexpr OUString PROPERTY_TRISTATE = u"TriState"_ustr; +inline constexpr OUString PROPERTY_HIDDEN_VALUE = u"HiddenValue"_ustr; +inline constexpr OUString PROPERTY_BUTTONTYPE = u"ButtonType"_ustr; +inline constexpr OUString PROPERTY_XFORMS_BUTTONTYPE = u"XFormsButtonType"_ustr; +inline constexpr OUString PROPERTY_STRINGITEMLIST = u"StringItemList"_ustr; +inline constexpr OUString PROPERTY_TYPEDITEMLIST = u"TypedItemList"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_TEXT = u"DefaultText"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_STATE = u"DefaultState"_ustr; +inline constexpr OUString PROPERTY_FORMATKEY = u"FormatKey"_ustr; +inline constexpr OUString PROPERTY_FORMATSSUPPLIER = u"FormatsSupplier"_ustr; +inline constexpr OUString PROPERTY_SUBMIT_ACTION = u"SubmitAction"_ustr; +inline constexpr OUString PROPERTY_SUBMIT_TARGET = u"SubmitTarget"_ustr; +inline constexpr OUString PROPERTY_SUBMIT_METHOD = u"SubmitMethod"_ustr; +inline constexpr OUString PROPERTY_SUBMIT_ENCODING = u"SubmitEncoding"_ustr; +inline constexpr OUString PROPERTY_IMAGE_URL = u"ImageURL"_ustr; +inline constexpr OUString PROPERTY_GRAPHIC = u"Graphic"_ustr; +inline constexpr OUString PROPERTY_EMPTY_IS_NULL = u"ConvertEmptyToNull"_ustr; +inline constexpr OUString PROPERTY_LISTSOURCETYPE = u"ListSourceType"_ustr; +inline constexpr OUString PROPERTY_LISTSOURCE = u"ListSource"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_SELECT_SEQ = u"DefaultSelection"_ustr; +inline constexpr OUString PROPERTY_MULTISELECTION = u"MultiSelection"_ustr; +inline constexpr OUString PROPERTY_ALIGN = u"Align"_ustr; +inline constexpr OUString PROPERTY_VERTICAL_ALIGN = u"VerticalAlign"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_DATE = u"DefaultDate"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_TIME = u"DefaultTime"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_VALUE = u"DefaultValue"_ustr; +inline constexpr OUString PROPERTY_DECIMAL_ACCURACY = u"DecimalAccuracy"_ustr; +inline constexpr OUString PROPERTY_REFVALUE = u"RefValue"_ustr; +inline constexpr OUString PROPERTY_UNCHECKEDREFVALUE = u"SecondaryRefValue"_ustr; +inline constexpr OUString PROPERTY_VALUEMIN = u"ValueMin"_ustr; +inline constexpr OUString PROPERTY_VALUEMAX = u"ValueMax"_ustr; +inline constexpr OUString PROPERTY_STRICTFORMAT = u"StrictFormat"_ustr; +inline constexpr OUString PROPERTY_ALLOWADDITIONS = u"AllowInserts"_ustr; +inline constexpr OUString PROPERTY_ALLOWEDITS = u"AllowUpdates"_ustr; +inline constexpr OUString PROPERTY_ALLOWDELETIONS = u"AllowDeletes"_ustr; +inline constexpr OUString PROPERTY_MASTERFIELDS = u"MasterFields"_ustr; +inline constexpr OUString PROPERTY_LITERALMASK = u"LiteralMask"_ustr; +inline constexpr OUString PROPERTY_VALUESTEP = u"ValueStep"_ustr; +inline constexpr OUString PROPERTY_SHOWTHOUSANDSEP = u"ShowThousandsSeparator"_ustr; +inline constexpr OUString PROPERTY_CURRENCYSYMBOL = u"CurrencySymbol"_ustr; +inline constexpr OUString PROPERTY_DATEFORMAT = u"DateFormat"_ustr; +inline constexpr OUString PROPERTY_DATEMIN = u"DateMin"_ustr; +inline constexpr OUString PROPERTY_DATEMAX = u"DateMax"_ustr; +inline constexpr OUString PROPERTY_TIMEFORMAT = u"TimeFormat"_ustr; +inline constexpr OUString PROPERTY_TIMEMIN = u"TimeMin"_ustr; +inline constexpr OUString PROPERTY_TIMEMAX = u"TimeMax"_ustr; +inline constexpr OUString PROPERTY_LINECOUNT = u"LineCount"_ustr; +inline constexpr OUString PROPERTY_BOUNDCOLUMN = u"BoundColumn"_ustr; +inline constexpr OUString PROPERTY_BACKGROUNDCOLOR = u"BackgroundColor"_ustr; +inline constexpr OUString PROPERTY_FILLCOLOR = u"FillColor"_ustr; +inline constexpr OUString PROPERTY_TEXTCOLOR = u"TextColor"_ustr; +inline constexpr OUString PROPERTY_LINECOLOR = u"LineColor"_ustr; +inline constexpr OUString PROPERTY_BORDER = u"Border"_ustr; +inline constexpr OUString PROPERTY_ICONSIZE = u"IconSize"_ustr; +inline constexpr OUString PROPERTY_DROPDOWN = u"Dropdown"_ustr; +inline constexpr OUString PROPERTY_HSCROLL = u"HScroll"_ustr; +inline constexpr OUString PROPERTY_VSCROLL = u"VScroll"_ustr; +inline constexpr OUString PROPERTY_SHOW_SCROLLBARS = u"ShowScrollbars"_ustr; +inline constexpr OUString PROPERTY_TABSTOP = u"Tabstop"_ustr; +inline constexpr OUString PROPERTY_AUTOCOMPLETE = u"Autocomplete"_ustr; +inline constexpr OUString PROPERTY_PRINTABLE = u"Printable"_ustr; +inline constexpr OUString PROPERTY_ECHO_CHAR = u"EchoChar"_ustr; +inline constexpr OUString PROPERTY_ROWHEIGHT = u"RowHeight"_ustr; +inline constexpr OUString PROPERTY_HELPTEXT = u"HelpText"_ustr; +inline constexpr OUString PROPERTY_FONT = u"FontDescriptor"_ustr; +inline constexpr OUString PROPERTY_FONT_NAME = u"FontName"_ustr; +inline constexpr OUString PROPERTY_FONT_STYLENAME = u"FontStyleName"_ustr; +inline constexpr OUString PROPERTY_FONT_FAMILY = u"FontFamily"_ustr; +inline constexpr OUString PROPERTY_FONT_CHARSET = u"FontCharset"_ustr; +inline constexpr OUString PROPERTY_FONT_HEIGHT = u"FontHeight"_ustr; +inline constexpr OUString PROPERTY_FONT_WEIGHT = u"FontWeight"_ustr; +inline constexpr OUString PROPERTY_FONT_SLANT = u"FontSlant"_ustr; +inline constexpr OUString PROPERTY_FONT_UNDERLINE = u"FontUnderline"_ustr; +inline constexpr OUString PROPERTY_FONT_STRIKEOUT = u"FontStrikeout"_ustr; +inline constexpr OUString PROPERTY_FONT_RELIEF = u"FontRelief"_ustr; +inline constexpr OUString PROPERTY_FONT_EMPHASIS_MARK = u"FontEmphasisMark"_ustr; +inline constexpr OUString PROPERTY_TEXTLINECOLOR = u"TextLineColor"_ustr; +inline constexpr OUString PROPERTY_HELPURL = u"HelpURL"_ustr; +inline constexpr OUString PROPERTY_RECORDMARKER = u"HasRecordMarker"_ustr; +inline constexpr OUString PROPERTY_EFFECTIVE_DEFAULT = u"EffectiveDefault"_ustr; +inline constexpr OUString PROPERTY_EFFECTIVE_MIN = u"EffectiveMin"_ustr; +inline constexpr OUString PROPERTY_EFFECTIVE_MAX = u"EffectiveMax"_ustr; +inline constexpr OUString PROPERTY_FILTERPROPOSAL = u"UseFilterValueProposal"_ustr; +inline constexpr OUString PROPERTY_CURRSYM_POSITION = u"PrependCurrencySymbol"_ustr; +inline constexpr OUString PROPERTY_COMMAND = u"Command"_ustr; +inline constexpr OUString PROPERTY_COMMANDTYPE = u"CommandType"_ustr; +inline constexpr OUString PROPERTY_INSERTONLY = u"IgnoreResult"_ustr; +inline constexpr OUString PROPERTY_ESCAPE_PROCESSING = u"EscapeProcessing"_ustr; +inline constexpr OUString PROPERTY_TITLE = u"Title"_ustr; +inline constexpr OUString PROPERTY_SORT = u"Order"_ustr; +inline constexpr OUString PROPERTY_DATASOURCE = u"DataSourceName"_ustr; +inline constexpr OUString PROPERTY_DETAILFIELDS = u"DetailFields"_ustr; +inline constexpr OUString PROPERTY_DEFAULTBUTTON = u"DefaultButton"_ustr; +inline constexpr OUString PROPERTY_LISTINDEX = u"ListIndex"_ustr; +inline constexpr OUString PROPERTY_HEIGHT = u"Height"_ustr; +inline constexpr OUString PROPERTY_HASNAVIGATION = u"HasNavigationBar"_ustr; +inline constexpr OUString PROPERTY_POSITIONX = u"PositionX"_ustr; +inline constexpr OUString PROPERTY_POSITIONY = u"PositionY"_ustr; +inline constexpr OUString PROPERTY_AUTOGROW = u"AutoGrow"_ustr; +inline constexpr OUString PROPERTY_STEP = u"Step"_ustr; +inline constexpr OUString PROPERTY_WORDLINEMODE = u"FontWordLineMode"_ustr; +inline constexpr OUString PROPERTY_PROGRESSVALUE = u"ProgressValue"_ustr; +inline constexpr OUString PROPERTY_PROGRESSVALUE_MIN = u"ProgressValueMin"_ustr; +inline constexpr OUString PROPERTY_PROGRESSVALUE_MAX = u"ProgressValueMax"_ustr; +inline constexpr OUString PROPERTY_SCROLLVALUE = u"ScrollValue"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_SCROLLVALUE = u"DefaultScrollValue"_ustr; +inline constexpr OUString PROPERTY_SCROLLVALUE_MIN = u"ScrollValueMin"_ustr; +inline constexpr OUString PROPERTY_SCROLLVALUE_MAX = u"ScrollValueMax"_ustr; +inline constexpr OUString PROPERTY_SCROLL_WIDTH = u"ScrollWidth"_ustr; +inline constexpr OUString PROPERTY_SCROLL_HEIGHT = u"ScrollHeight"_ustr; +inline constexpr OUString PROPERTY_SCROLL_TOP = u"ScrollTop"_ustr; +inline constexpr OUString PROPERTY_SCROLL_LEFT = u"ScrollLeft"_ustr; +inline constexpr OUString PROPERTY_LINEINCREMENT = u"LineIncrement"_ustr; +inline constexpr OUString PROPERTY_BLOCKINCREMENT = u"BlockIncrement"_ustr; +inline constexpr OUString PROPERTY_VISIBLESIZE = u"VisibleSize"_ustr; +inline constexpr OUString PROPERTY_ORIENTATION = u"Orientation"_ustr; +inline constexpr OUString PROPERTY_IMAGEPOSITION = u"ImagePosition"_ustr; +inline constexpr OUString PROPERTY_ACTIVE_CONNECTION = u"ActiveConnection"_ustr; +inline constexpr OUString PROPERTY_ACTIVECOMMAND = u"ActiveCommand"_ustr; +inline constexpr OUString PROPERTY_DATE = u"Date"_ustr; +inline constexpr OUString PROPERTY_STATE = u"State"_ustr; +inline constexpr OUString PROPERTY_TIME = u"Time"_ustr; +inline constexpr OUString PROPERTY_SCALEIMAGE = u"ScaleImage"_ustr; +inline constexpr OUString PROPERTY_SCALE_MODE = u"ScaleMode"_ustr; +inline constexpr OUString PROPERTY_PUSHBUTTONTYPE = u"PushButtonType"_ustr; +inline constexpr OUString PROPERTY_EFFECTIVE_VALUE = u"EffectiveValue"_ustr; +inline constexpr OUString PROPERTY_SELECTEDITEMS = u"SelectedItems"_ustr; +inline constexpr OUString PROPERTY_REPEAT = u"Repeat"_ustr; +inline constexpr OUString PROPERTY_REPEAT_DELAY = u"RepeatDelay"_ustr; +inline constexpr OUString PROPERTY_SYMBOLCOLOR = u"SymbolColor"_ustr; +inline constexpr OUString PROPERTY_SPINVALUE = u"SpinValue"_ustr; +inline constexpr OUString PROPERTY_SPINVALUE_MIN = u"SpinValueMin"_ustr; +inline constexpr OUString PROPERTY_SPINVALUE_MAX = u"SpinValueMax"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_SPINVALUE = u"DefaultSpinValue"_ustr; +inline constexpr OUString PROPERTY_SPININCREMENT = u"SpinIncrement"_ustr; +inline constexpr OUString PROPERTY_SHOW_POSITION = u"ShowPosition"_ustr; +inline constexpr OUString PROPERTY_SHOW_NAVIGATION = u"ShowNavigation"_ustr; +inline constexpr OUString PROPERTY_SHOW_RECORDACTIONS = u"ShowRecordActions"_ustr; +inline constexpr OUString PROPERTY_SHOW_FILTERSORT = u"ShowFilterSort"_ustr; +inline constexpr OUString PROPERTY_LINEEND_FORMAT = u"LineEndFormat"_ustr; +inline constexpr OUString PROPERTY_DECORATION = u"Decoration"_ustr; +inline constexpr OUString PROPERTY_NOLABEL = u"NoLabel"_ustr; +inline constexpr OUString PROPERTY_URL = u"URL"_ustr; - #define PROPERTY_DEFAULTCONTROL "DefaultControl" - #define PROPERTY_INTROSPECTEDOBJECT "IntrospectedObject" - #define PROPERTY_CURRENTPAGE "CurrentPage" - #define PROPERTY_CONTROLCONTEXT "ControlContext" +inline constexpr OUString PROPERTY_SELECTION_TYPE = u"SelectionType"_ustr; +inline constexpr OUString PROPERTY_ROOT_DISPLAYED = u"RootDisplayed"_ustr; +inline constexpr OUString PROPERTY_SHOWS_HANDLES = u"ShowsHandles"_ustr; +inline constexpr OUString PROPERTY_SHOWS_ROOT_HANDLES = u"ShowsRootHandles"_ustr; +inline constexpr OUString PROPERTY_EDITABLE = u"Editable"_ustr; +inline constexpr OUString PROPERTY_INVOKES_STOP_NOT_EDITING = u"InvokesStopNodeEditing"_ustr; - // properties - #define PROPERTY_CLASSID "ClassId" - #define PROPERTY_CONTROLLABEL "LabelControl" - #define PROPERTY_LABEL "Label" - #define PROPERTY_TABINDEX "TabIndex" - #define PROPERTY_WHEEL_BEHAVIOR "MouseWheelBehavior" - #define PROPERTY_TAG "Tag" - #define PROPERTY_NAME "Name" - #define PROPERTY_GROUP_NAME "GroupName" - #define PROPERTY_VALUE "Value" - #define PROPERTY_TEXT "Text" - #define PROPERTY_NAVIGATION "NavigationBarMode" - #define PROPERTY_CYCLE "Cycle" - #define PROPERTY_CONTROLSOURCE "DataField" - #define PROPERTY_INPUT_REQUIRED "InputRequired" - #define PROPERTY_ENABLED "Enabled" - #define PROPERTY_ENABLE_VISIBLE "EnableVisible" - #define PROPERTY_READONLY "ReadOnly" - #define PROPERTY_ISREADONLY "IsReadOnly" - #define PROPERTY_FILTER "Filter" - #define PROPERTY_WIDTH "Width" - #define PROPERTY_MULTILINE "MultiLine" - #define PROPERTY_WORDBREAK "WordBreak" - #define PROPERTY_TARGET_URL "TargetURL" - #define PROPERTY_TARGET_FRAME "TargetFrame" - #define PROPERTY_MAXTEXTLEN "MaxTextLen" - #define PROPERTY_EDITMASK "EditMask" - #define PROPERTY_SPIN "Spin" - #define PROPERTY_TRISTATE "TriState" - #define PROPERTY_HIDDEN_VALUE "HiddenValue" - #define PROPERTY_BUTTONTYPE "ButtonType" - #define PROPERTY_XFORMS_BUTTONTYPE "XFormsButtonType" - #define PROPERTY_STRINGITEMLIST "StringItemList" - #define PROPERTY_TYPEDITEMLIST "TypedItemList" - #define PROPERTY_DEFAULT_TEXT "DefaultText" - #define PROPERTY_DEFAULT_STATE "DefaultState" - #define PROPERTY_FORMATKEY "FormatKey" - #define PROPERTY_FORMATSSUPPLIER "FormatsSupplier" - #define PROPERTY_SUBMIT_ACTION "SubmitAction" - #define PROPERTY_SUBMIT_TARGET "SubmitTarget" - #define PROPERTY_SUBMIT_METHOD "SubmitMethod" - #define PROPERTY_SUBMIT_ENCODING "SubmitEncoding" - #define PROPERTY_IMAGE_URL "ImageURL" - #define PROPERTY_GRAPHIC "Graphic" - #define PROPERTY_EMPTY_IS_NULL "ConvertEmptyToNull" - #define PROPERTY_LISTSOURCETYPE "ListSourceType" - #define PROPERTY_LISTSOURCE "ListSource" - #define PROPERTY_DEFAULT_SELECT_SEQ "DefaultSelection" - #define PROPERTY_MULTISELECTION "MultiSelection" - #define PROPERTY_ALIGN "Align" - #define PROPERTY_VERTICAL_ALIGN "VerticalAlign" - #define PROPERTY_DEFAULT_DATE "DefaultDate" - #define PROPERTY_DEFAULT_TIME "DefaultTime" - #define PROPERTY_DEFAULT_VALUE "DefaultValue" - #define PROPERTY_DECIMAL_ACCURACY "DecimalAccuracy" - #define PROPERTY_REFVALUE "RefValue" - #define PROPERTY_UNCHECKEDREFVALUE "SecondaryRefValue" - #define PROPERTY_VALUEMIN "ValueMin" - #define PROPERTY_VALUEMAX "ValueMax" - #define PROPERTY_STRICTFORMAT "StrictFormat" - #define PROPERTY_ALLOWADDITIONS "AllowInserts" - #define PROPERTY_ALLOWEDITS "AllowUpdates" - #define PROPERTY_ALLOWDELETIONS "AllowDeletes" - #define PROPERTY_MASTERFIELDS "MasterFields" - #define PROPERTY_LITERALMASK "LiteralMask" - #define PROPERTY_VALUESTEP "ValueStep" - #define PROPERTY_SHOWTHOUSANDSEP "ShowThousandsSeparator" - #define PROPERTY_CURRENCYSYMBOL "CurrencySymbol" - #define PROPERTY_DATEFORMAT "DateFormat" - #define PROPERTY_DATEMIN "DateMin" - #define PROPERTY_DATEMAX "DateMax" - #define PROPERTY_TIMEFORMAT "TimeFormat" - #define PROPERTY_TIMEMIN "TimeMin" - #define PROPERTY_TIMEMAX "TimeMax" - #define PROPERTY_LINECOUNT "LineCount" - #define PROPERTY_BOUNDCOLUMN "BoundColumn" - #define PROPERTY_BACKGROUNDCOLOR "BackgroundColor" - #define PROPERTY_FILLCOLOR "FillColor" - #define PROPERTY_TEXTCOLOR "TextColor" - #define PROPERTY_LINECOLOR "LineColor" - #define PROPERTY_BORDER "Border" - #define PROPERTY_ICONSIZE "IconSize" - #define PROPERTY_DROPDOWN "Dropdown" - #define PROPERTY_HSCROLL "HScroll" - #define PROPERTY_VSCROLL "VScroll" - #define PROPERTY_SHOW_SCROLLBARS "ShowScrollbars" - #define PROPERTY_TABSTOP "Tabstop" - #define PROPERTY_AUTOCOMPLETE "Autocomplete" - #define PROPERTY_PRINTABLE "Printable" - #define PROPERTY_ECHO_CHAR "EchoChar" - #define PROPERTY_ROWHEIGHT "RowHeight" - #define PROPERTY_HELPTEXT "HelpText" - #define PROPERTY_FONT "FontDescriptor" - #define PROPERTY_FONT_NAME "FontName" - #define PROPERTY_FONT_STYLENAME "FontStyleName" - #define PROPERTY_FONT_FAMILY "FontFamily" - #define PROPERTY_FONT_CHARSET "FontCharset" - #define PROPERTY_FONT_HEIGHT "FontHeight" - #define PROPERTY_FONT_WEIGHT "FontWeight" - #define PROPERTY_FONT_SLANT "FontSlant" - #define PROPERTY_FONT_UNDERLINE "FontUnderline" - #define PROPERTY_FONT_STRIKEOUT "FontStrikeout" - #define PROPERTY_FONT_RELIEF "FontRelief" - #define PROPERTY_FONT_EMPHASIS_MARK "FontEmphasisMark" - #define PROPERTY_TEXTLINECOLOR "TextLineColor" - #define PROPERTY_HELPURL "HelpURL" - #define PROPERTY_RECORDMARKER "HasRecordMarker" - #define PROPERTY_EFFECTIVE_DEFAULT "EffectiveDefault" - #define PROPERTY_EFFECTIVE_MIN "EffectiveMin" - #define PROPERTY_EFFECTIVE_MAX "EffectiveMax" - #define PROPERTY_FILTERPROPOSAL "UseFilterValueProposal" - #define PROPERTY_CURRSYM_POSITION "PrependCurrencySymbol" - #define PROPERTY_COMMAND "Command" - #define PROPERTY_COMMANDTYPE "CommandType" - #define PROPERTY_INSERTONLY "IgnoreResult" - #define PROPERTY_ESCAPE_PROCESSING "EscapeProcessing" - #define PROPERTY_TITLE "Title" - #define PROPERTY_SORT "Order" - #define PROPERTY_DATASOURCE "DataSourceName" - #define PROPERTY_DETAILFIELDS "DetailFields" - #define PROPERTY_DEFAULTBUTTON "DefaultButton" - #define PROPERTY_LISTINDEX "ListIndex" - #define PROPERTY_HEIGHT "Height" - #define PROPERTY_HASNAVIGATION "HasNavigationBar" - #define PROPERTY_POSITIONX "PositionX" - #define PROPERTY_POSITIONY "PositionY" - #define PROPERTY_AUTOGROW "AutoGrow" - #define PROPERTY_STEP "Step" - #define PROPERTY_WORDLINEMODE "FontWordLineMode" - #define PROPERTY_PROGRESSVALUE "ProgressValue" - #define PROPERTY_PROGRESSVALUE_MIN "ProgressValueMin" - #define PROPERTY_PROGRESSVALUE_MAX "ProgressValueMax" - #define PROPERTY_SCROLLVALUE "ScrollValue" - #define PROPERTY_DEFAULT_SCROLLVALUE "DefaultScrollValue" - #define PROPERTY_SCROLLVALUE_MIN "ScrollValueMin" - #define PROPERTY_SCROLLVALUE_MAX "ScrollValueMax" - #define PROPERTY_SCROLL_WIDTH "ScrollWidth" - #define PROPERTY_SCROLL_HEIGHT "ScrollHeight" - #define PROPERTY_SCROLL_TOP "ScrollTop" - #define PROPERTY_SCROLL_LEFT "ScrollLeft" - #define PROPERTY_LINEINCREMENT "LineIncrement" - #define PROPERTY_BLOCKINCREMENT "BlockIncrement" - #define PROPERTY_VISIBLESIZE "VisibleSize" - #define PROPERTY_ORIENTATION "Orientation" - #define PROPERTY_IMAGEPOSITION "ImagePosition" - #define PROPERTY_ACTIVE_CONNECTION "ActiveConnection" - #define PROPERTY_ACTIVECOMMAND "ActiveCommand" - #define PROPERTY_DATE "Date" - #define PROPERTY_STATE "State" - #define PROPERTY_TIME "Time" - #define PROPERTY_SCALEIMAGE "ScaleImage" - #define PROPERTY_SCALE_MODE "ScaleMode" - #define PROPERTY_PUSHBUTTONTYPE "PushButtonType" - #define PROPERTY_EFFECTIVE_VALUE "EffectiveValue" - #define PROPERTY_SELECTEDITEMS "SelectedItems" - #define PROPERTY_REPEAT "Repeat" - #define PROPERTY_REPEAT_DELAY "RepeatDelay" - #define PROPERTY_SYMBOLCOLOR "SymbolColor" - #define PROPERTY_SPINVALUE "SpinValue" - #define PROPERTY_SPINVALUE_MIN "SpinValueMin" - #define PROPERTY_SPINVALUE_MAX "SpinValueMax" - #define PROPERTY_DEFAULT_SPINVALUE "DefaultSpinValue" - #define PROPERTY_SPININCREMENT "SpinIncrement" - #define PROPERTY_SHOW_POSITION "ShowPosition" - #define PROPERTY_SHOW_NAVIGATION "ShowNavigation" - #define PROPERTY_SHOW_RECORDACTIONS "ShowRecordActions" - #define PROPERTY_SHOW_FILTERSORT "ShowFilterSort" - #define PROPERTY_LINEEND_FORMAT "LineEndFormat" - #define PROPERTY_DECORATION "Decoration" - #define PROPERTY_NOLABEL "NoLabel" - #define PROPERTY_URL "URL" +inline constexpr OUString PROPERTY_TOGGLE = u"Toggle"_ustr; +inline constexpr OUString PROPERTY_FOCUSONCLICK = u"FocusOnClick"_ustr; +inline constexpr OUString PROPERTY_HIDEINACTIVESELECTION = u"HideInactiveSelection"_ustr; +inline constexpr OUString PROPERTY_VISUALEFFECT = u"VisualEffect"_ustr; +inline constexpr OUString PROPERTY_BORDERCOLOR = u"BorderColor"_ustr; - #define PROPERTY_SELECTION_TYPE "SelectionType" - #define PROPERTY_ROOT_DISPLAYED "RootDisplayed" - #define PROPERTY_SHOWS_HANDLES "ShowsHandles" - #define PROPERTY_SHOWS_ROOT_HANDLES "ShowsRootHandles" - #define PROPERTY_EDITABLE "Editable" - #define PROPERTY_INVOKES_STOP_NOT_EDITING "InvokesStopNodeEditing" +inline constexpr OUString PROPERTY_ADDRESS = u"Address"_ustr; +inline constexpr OUString PROPERTY_REFERENCE_SHEET = u"ReferenceSheet"_ustr; +inline constexpr OUString PROPERTY_UI_REPRESENTATION = u"UserInterfaceRepresentation"_ustr; - #define PROPERTY_HARDLINEBREAKS "HardLineBreaks" +inline constexpr OUString PROPERTY_XML_DATA_MODEL = u"XMLDataModel"_ustr; +inline constexpr OUString PROPERTY_BINDING_NAME = u"BindingName"_ustr; +inline constexpr OUString PROPERTY_BIND_EXPRESSION = u"BindingExpression"_ustr; +inline constexpr OUString PROPERTY_LIST_BINDING = u"ListBinding"_ustr; +inline constexpr OUString PROPERTY_XSD_REQUIRED = u"RequiredExpression"_ustr; +inline constexpr OUString PROPERTY_XSD_RELEVANT = u"RelevantExpression"_ustr; +inline constexpr OUString PROPERTY_XSD_READONLY = u"ReadonlyExpression"_ustr; +inline constexpr OUString PROPERTY_XSD_CONSTRAINT = u"ConstraintExpression"_ustr; +inline constexpr OUString PROPERTY_XSD_CALCULATION = u"CalculateExpression"_ustr; +inline constexpr OUString PROPERTY_XSD_DATA_TYPE = u"Type"_ustr; +inline constexpr OUString PROPERTY_XSD_WHITESPACES = u"WhiteSpace"_ustr; +inline constexpr OUString PROPERTY_XSD_PATTERN = u"Pattern"_ustr; +inline constexpr OUString PROPERTY_XSD_LENGTH = u"Length"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_LENGTH = u"MinLength"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_LENGTH = u"MaxLength"_ustr; +inline constexpr OUString PROPERTY_XSD_TOTAL_DIGITS = u"TotalDigits"_ustr; +inline constexpr OUString PROPERTY_XSD_FRACTION_DIGITS = u"FractionDigits"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_INCLUSIVE_INT = u"MaxInclusiveInt"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_EXCLUSIVE_INT = u"MaxExclusiveInt"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_INCLUSIVE_INT = u"MinInclusiveInt"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_EXCLUSIVE_INT = u"MinExclusiveInt"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE = u"MaxInclusiveDouble"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE = u"MaxExclusiveDouble"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE = u"MinInclusiveDouble"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE = u"MinExclusiveDouble"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_INCLUSIVE_DATE = u"MaxInclusiveDate"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_EXCLUSIVE_DATE = u"MaxExclusiveDate"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_INCLUSIVE_DATE = u"MinInclusiveDate"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_EXCLUSIVE_DATE = u"MinExclusiveDate"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_INCLUSIVE_TIME = u"MaxInclusiveTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_EXCLUSIVE_TIME = u"MaxExclusiveTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_INCLUSIVE_TIME = u"MinInclusiveTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_EXCLUSIVE_TIME = u"MinExclusiveTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME = u"MaxInclusiveDateTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME = u"MaxExclusiveDateTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME = u"MinInclusiveDateTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME = u"MinExclusiveDateTime"_ustr; +inline constexpr OUString PROPERTY_SUBMISSION_ID = u"SubmissionID"_ustr; +inline constexpr OUString PROPERTY_BINDING_ID = u"BindingID"_ustr; +inline constexpr OUString PROPERTY_WRITING_MODE = u"WritingMode"_ustr; +inline constexpr OUString PROPERTY_TEXT_ANCHOR_TYPE = u"TextAnchorType"_ustr; +inline constexpr OUString PROPERTY_SHEET_ANCHOR_TYPE = u"SheetAnchorType"_ustr; +inline constexpr OUString PROPERTY_ANCHOR_TYPE = u"AnchorType"_ustr; +inline constexpr OUString PROPERTY_ANCHOR = u"Anchor"_ustr; +inline constexpr OUString PROPERTY_IS_VISIBLE = u"IsVisible"_ustr; - #define PROPERTY_TOGGLE "Toggle" - #define PROPERTY_FOCUSONCLICK "FocusOnClick" - #define PROPERTY_HIDEINACTIVESELECTION "HideInactiveSelection" - #define PROPERTY_VISUALEFFECT "VisualEffect" - #define PROPERTY_BORDERCOLOR "BorderColor" +inline constexpr OUString PROPERTY_MODEL = u"Model"_ustr; - #define PROPERTY_ADDRESS "Address" - #define PROPERTY_REFERENCE_SHEET "ReferenceSheet" - #define PROPERTY_UI_REPRESENTATION "UserInterfaceRepresentation" +inline constexpr OUString PROPERTY_CELL_EXCHANGE_TYPE = u"ExchangeSelectionIndex"_ustr; +inline constexpr OUString PROPERTY_BOUND_CELL = u"BoundCell"_ustr; +inline constexpr OUString PROPERTY_LIST_CELL_RANGE = u"CellRange"_ustr; +inline constexpr OUString PROPERTY_TEXTTYPE = u"TextType"_ustr; +inline constexpr OUString PROPERTY_RICHTEXT = u"RichText"_ustr; +inline constexpr OUString PROPERTY_ROWSET = u"RowSet"_ustr; +inline constexpr OUString PROPERTY_SELECTIONMODEL = u"SelectionModel"_ustr; +inline constexpr OUString PROPERTY_USEGRIDLINE = u"UseGridLines"_ustr; +inline constexpr OUString PROPERTY_GRIDLINECOLOR = u"GridLineColor"_ustr; +inline constexpr OUString PROPERTY_SHOWCOLUMNHEADER = u"ShowColumnHeader"_ustr; +inline constexpr OUString PROPERTY_SHOWROWHEADER = u"ShowRowHeader"_ustr; +inline constexpr OUString PROPERTY_HEADERBACKGROUNDCOLOR = u"HeaderBackgroundColor"_ustr; +inline constexpr OUString PROPERTY_HEADERTEXTCOLOR = u"HeaderTextColor"_ustr; +inline constexpr OUString PROPERTY_ACTIVESELECTIONBACKGROUNDCOLOR = u"ActiveSelectionBackgroundColor"_ustr; +inline constexpr OUString PROPERTY_ACTIVESELECTIONTEXTCOLOR = u"ActiveSelectionTextColor"_ustr; +inline constexpr OUString PROPERTY_INACTIVESELECTIONBACKGROUNDCOLOR = u"InactiveSelectionBackgroundColor"_ustr; +inline constexpr OUString PROPERTY_INACTIVESELECTIONTEXTCOLOR = u"InactiveSelectionTextColor"_ustr; - #define PROPERTY_XML_DATA_MODEL "XMLDataModel" - #define PROPERTY_BINDING_NAME "BindingName" - #define PROPERTY_BIND_EXPRESSION "BindingExpression" - #define PROPERTY_LIST_BINDING "ListBinding" - #define PROPERTY_XSD_REQUIRED "RequiredExpression" - #define PROPERTY_XSD_RELEVANT "RelevantExpression" - #define PROPERTY_XSD_READONLY "ReadonlyExpression" - #define PROPERTY_XSD_CONSTRAINT "ConstraintExpression" - #define PROPERTY_XSD_CALCULATION "CalculateExpression" - #define PROPERTY_XSD_DATA_TYPE "Type" - #define PROPERTY_XSD_WHITESPACES "WhiteSpace" - #define PROPERTY_XSD_PATTERN "Pattern" - #define PROPERTY_XSD_LENGTH "Length" - #define PROPERTY_XSD_MIN_LENGTH "MinLength" - #define PROPERTY_XSD_MAX_LENGTH "MaxLength" - #define PROPERTY_XSD_TOTAL_DIGITS "TotalDigits" - #define PROPERTY_XSD_FRACTION_DIGITS "FractionDigits" - #define PROPERTY_XSD_MAX_INCLUSIVE_INT "MaxInclusiveInt" - #define PROPERTY_XSD_MAX_EXCLUSIVE_INT "MaxExclusiveInt" - #define PROPERTY_XSD_MIN_INCLUSIVE_INT "MinInclusiveInt" - #define PROPERTY_XSD_MIN_EXCLUSIVE_INT "MinExclusiveInt" - #define PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE "MaxInclusiveDouble" - #define PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE "MaxExclusiveDouble" - #define PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE "MinInclusiveDouble" - #define PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE "MinExclusiveDouble" - #define PROPERTY_XSD_MAX_INCLUSIVE_DATE "MaxInclusiveDate" - #define PROPERTY_XSD_MAX_EXCLUSIVE_DATE "MaxExclusiveDate" - #define PROPERTY_XSD_MIN_INCLUSIVE_DATE "MinInclusiveDate" - #define PROPERTY_XSD_MIN_EXCLUSIVE_DATE "MinExclusiveDate" - #define PROPERTY_XSD_MAX_INCLUSIVE_TIME "MaxInclusiveTime" - #define PROPERTY_XSD_MAX_EXCLUSIVE_TIME "MaxExclusiveTime" - #define PROPERTY_XSD_MIN_INCLUSIVE_TIME "MinInclusiveTime" - #define PROPERTY_XSD_MIN_EXCLUSIVE_TIME "MinExclusiveTime" - #define PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME "MaxInclusiveDateTime" - #define PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME "MaxExclusiveDateTime" - #define PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME "MinInclusiveDateTime" - #define PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME "MinExclusiveDateTime" - #define PROPERTY_SUBMISSION_ID "SubmissionID" - #define PROPERTY_BINDING_ID "BindingID" - #define PROPERTY_ID "ID" - #define PROPERTY_WRITING_MODE "WritingMode" - #define PROPERTY_TEXT_ANCHOR_TYPE "TextAnchorType" - #define PROPERTY_SHEET_ANCHOR_TYPE "SheetAnchorType" - #define PROPERTY_ANCHOR_TYPE "AnchorType" - #define PROPERTY_ANCHOR "Anchor" - #define PROPERTY_IS_VISIBLE "IsVisible" +// services +inline constexpr OUString SERVICE_COMPONENT_GROUPBOX = u"com.sun.star.form.component.GroupBox"_ustr; +inline constexpr OUString SERVICE_COMPONENT_FIXEDTEXT = u"com.sun.star.form.component.FixedText"_ustr; +inline constexpr OUString SERVICE_COMPONENT_FORMATTEDFIELD = u"com.sun.star.form.component.FormattedField"_ustr; - #define PROPERTY_MODEL "Model" +inline constexpr OUString SERVICE_TEXT_DOCUMENT = u"com.sun.star.text.TextDocument"_ustr; +inline constexpr OUString SERVICE_WEB_DOCUMENT = u"com.sun.star.text.WebDocument"_ustr; +inline constexpr OUString SERVICE_SPREADSHEET_DOCUMENT = u"com.sun.star.sheet.SpreadsheetDocument"_ustr; +inline constexpr OUString SERVICE_DRAWING_DOCUMENT = u"com.sun.star.drawing.DrawingDocument"_ustr; +inline constexpr OUString SERVICE_PRESENTATION_DOCUMENT = u"com.sun.star.presentation.PresentationDocument"_ustr; - #define PROPERTY_CELL_EXCHANGE_TYPE "ExchangeSelectionIndex" - #define PROPERTY_BOUND_CELL "BoundCell" - #define PROPERTY_LIST_CELL_RANGE "CellRange" - #define PROPERTY_AUTOLINEBREAK "AutomaticLineBreak" - #define PROPERTY_TEXTTYPE "TextType" - #define PROPERTY_RICHTEXT "RichText" - #define PROPERTY_ROWSET "RowSet" - #define PROPERTY_SELECTIONMODEL "SelectionModel" - #define PROPERTY_USEGRIDLINE "UseGridLines" - #define PROPERTY_GRIDLINECOLOR "GridLineColor" - #define PROPERTY_SHOWCOLUMNHEADER "ShowColumnHeader" - #define PROPERTY_SHOWROWHEADER "ShowRowHeader" - #define PROPERTY_HEADERBACKGROUNDCOLOR "HeaderBackgroundColor" - #define PROPERTY_HEADERTEXTCOLOR "HeaderTextColor" - #define PROPERTY_ACTIVESELECTIONBACKGROUNDCOLOR "ActiveSelectionBackgroundColor" - #define PROPERTY_ACTIVESELECTIONTEXTCOLOR "ActiveSelectionTextColor" - #define PROPERTY_INACTIVESELECTIONBACKGROUNDCOLOR "InactiveSelectionBackgroundColor" - #define PROPERTY_INACTIVESELECTIONTEXTCOLOR "InactiveSelectionTextColor" +inline constexpr OUString SERVICE_SHEET_CELL_BINDING = u"com.sun.star.table.CellValueBinding"_ustr; +inline constexpr OUString SERVICE_SHEET_CELL_INT_BINDING = u"com.sun.star.table.ListPositionCellBinding"_ustr; +inline constexpr OUString SERVICE_SHEET_CELLRANGE_LISTSOURCE = u"com.sun.star.table.CellRangeListSource"_ustr; +inline constexpr OUString SERVICE_ADDRESS_CONVERSION = u"com.sun.star.table.CellAddressConversion"_ustr; +inline constexpr OUString SERVICE_RANGEADDRESS_CONVERSION = u"com.sun.star.table.CellRangeAddressConversion"_ustr; - // services - #define SERVICE_COMPONENT_GROUPBOX "com.sun.star.form.component.GroupBox" - #define SERVICE_COMPONENT_FIXEDTEXT "com.sun.star.form.component.FixedText" - #define SERVICE_COMPONENT_FORMATTEDFIELD "com.sun.star.form.component.FormattedField" - #define SERVICE_TEXT_DOCUMENT "com.sun.star.text.TextDocument" - #define SERVICE_WEB_DOCUMENT "com.sun.star.text.WebDocument" - #define SERVICE_SPREADSHEET_DOCUMENT "com.sun.star.sheet.SpreadsheetDocument" - #define SERVICE_DRAWING_DOCUMENT "com.sun.star.drawing.DrawingDocument" - #define SERVICE_PRESENTATION_DOCUMENT "com.sun.star.presentation.PresentationDocument" - - #define SERVICE_SHEET_CELL_BINDING "com.sun.star.table.CellValueBinding" - #define SERVICE_SHEET_CELL_INT_BINDING "com.sun.star.table.ListPositionCellBinding" - #define SERVICE_SHEET_CELLRANGE_LISTSOURCE "com.sun.star.table.CellRangeListSource" - #define SERVICE_ADDRESS_CONVERSION "com.sun.star.table.CellAddressConversion" - #define SERVICE_RANGEADDRESS_CONVERSION "com.sun.star.table.CellRangeAddressConversion" - - -} // namespace pcr - - -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMSTRINGS_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index 984f951dfd58..322bc3405143 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -36,10 +36,12 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/extract.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <comphelper/types.hxx> +#include <o3tl/safeint.hxx> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <algorithm> @@ -116,7 +118,7 @@ namespace pcr TOOLS_WARN_EXCEPTION( "extensions.propctrlr", "EnumRepresentation::getDescriptions" ); } - return std::vector< OUString >( aNames.begin(), aNames.end() ); + return std::vector< OUString >( std::cbegin(aNames), std::cend(aNames) ); } void EnumRepresentation::impl_getValues( Sequence< sal_Int32 >& _out_rValues ) const @@ -162,10 +164,10 @@ namespace pcr Sequence< sal_Int32 > aValues; impl_getValues( aValues ); - sal_Int32 index = std::find( aValues.begin(), aValues.end(), nAsInt ) - aValues.begin(); + sal_Int32 index = std::find( std::cbegin(aValues), std::cend(aValues), nAsInt ) - std::cbegin(aValues); std::vector< OUString > aDescriptions( getDescriptions() ); - if ( ( index >= 0 ) && ( index < static_cast<sal_Int32>(aDescriptions.size()) ) ) + if ( ( index >= 0 ) && ( o3tl::make_unsigned(index) < aDescriptions.size() ) ) sDescription = aDescriptions[ index ]; else { @@ -248,9 +250,7 @@ namespace pcr Reference< XDesktop2 > xDispProv = Desktop::create( m_xContext ); Reference< XDispatch > xDispatch( xDispProv->queryDispatch( aURL, OUString(), 0 ), UNO_SET_THROW ); - Sequence< PropertyValue > aDispatchArgs(1); - aDispatchArgs[0].Name = "URL"; - aDispatchArgs[0].Value <<= _rURL; + Sequence aDispatchArgs{ comphelper::makePropertyValue("URL", _rURL) }; xDispatch->dispatch( aURL, aDispatchArgs ); } @@ -304,7 +304,7 @@ namespace pcr // create an introspection adapter for the component Reference< XIntrospection > xIntrospection = theIntrospection::get( m_xContext ); - Reference< XIntrospectionAccess > xIntrospectionAccess( xIntrospection->inspect( makeAny( _rxIntrospectee ) ) ); + Reference< XIntrospectionAccess > xIntrospectionAccess( xIntrospection->inspect( Any( _rxIntrospectee ) ) ); if ( !xIntrospectionAccess.is() ) throw RuntimeException("The introspection service could not handle the given component.", *this ); @@ -458,7 +458,7 @@ namespace pcr aProperties = xPSI->getProperties(); DBG_ASSERT( aProperties.hasElements(), "GenericPropertyHandler::getSupportedProperties: no properties!" ); - for ( auto const & property : std::as_const(aProperties) ) + for (auto const& property : aProperties) { switch ( property.Type.getTypeClass() ) { @@ -605,7 +605,22 @@ namespace pcr // at this handler instance } - IMPLEMENT_FORWARD_XCOMPONENT( GenericPropertyHandler, GenericPropertyHandler_Base ); + void SAL_CALL GenericPropertyHandler::dispose( ) + { + GenericPropertyHandler_Base::WeakComponentImplHelperBase::dispose(); + m_xComponentIntrospectionAccess.clear(); + m_xComponent.clear(); + m_xTypeConverter.clear(); + m_xPropertyState.clear(); + } + void SAL_CALL GenericPropertyHandler::addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) + { + GenericPropertyHandler_Base::WeakComponentImplHelperBase::addEventListener( Listener ); + } + void SAL_CALL GenericPropertyHandler::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) + { + GenericPropertyHandler_Base::WeakComponentImplHelperBase::removeEventListener( Listener ); + } } // namespace pcr diff --git a/extensions/source/propctrlr/genericpropertyhandler.hxx b/extensions/source/propctrlr/genericpropertyhandler.hxx index c5c676f9c235..b2114be3cc5e 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.hxx +++ b/extensions/source/propctrlr/genericpropertyhandler.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_GENERICPROPERTYHANDLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_GENERICPROPERTYHANDLER_HXX +#pragma once #include "pcrcommontypes.hxx" #include "pcrcommon.hxx" @@ -30,6 +29,7 @@ #include <com/sun/star/inspection/XPropertyHandler.hpp> #include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/compbase.hxx> #include <rtl/ref.hxx> @@ -136,6 +136,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_GENERICPROPERTYHANDLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/handlerhelper.cxx b/extensions/source/propctrlr/handlerhelper.cxx index eb2d5f627d47..77743c622ad7 100644 --- a/extensions/source/propctrlr/handlerhelper.cxx +++ b/extensions/source/propctrlr/handlerhelper.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/inspection/PropertyControlType.hpp> #include <com/sun/star/inspection/XStringListControl.hpp> #include <com/sun/star/inspection/XNumericControl.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <vcl/weldutils.hxx> @@ -109,7 +109,7 @@ namespace pcr { Reference< XPropertyControl > lcl_implCreateListLikeControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - const std::vector< OUString >& _rInitialListEntries, + std::vector< OUString >&& _rInitialListEntries, bool _bReadOnlyControl, bool _bSorted, bool _bTrueIfListBoxFalseIfComboBox @@ -122,35 +122,34 @@ namespace pcr UNO_QUERY_THROW ); - std::vector< OUString > aInitialEntries( _rInitialListEntries ); if ( _bSorted ) - std::sort( aInitialEntries.begin(), aInitialEntries.end() ); + std::sort( _rInitialListEntries.begin(), _rInitialListEntries.end() ); - for (auto const& initialEntry : aInitialEntries) + for (auto const& initialEntry : _rInitialListEntries) xListControl->appendListEntry(initialEntry); - return xListControl.get(); + return xListControl; } } Reference< XPropertyControl > PropertyHandlerHelper::createListBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - const std::vector< OUString >& _rInitialListEntries, bool _bReadOnlyControl, bool _bSorted ) + std::vector< OUString >&& _rInitialListEntries, bool _bReadOnlyControl, bool _bSorted ) { - return lcl_implCreateListLikeControl(_rxControlFactory, _rInitialListEntries, _bReadOnlyControl, _bSorted, true); + return lcl_implCreateListLikeControl(_rxControlFactory, std::move(_rInitialListEntries), _bReadOnlyControl, _bSorted, true); } Reference< XPropertyControl > PropertyHandlerHelper::createListBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - const char** pTransIds, size_t nElements, bool _bReadOnlyControl ) + const TranslateId* pTransIds, size_t nElements, bool _bReadOnlyControl ) { std::vector<OUString> aInitialListEntries; for (size_t i = 0; i < nElements; ++i) aInitialListEntries.push_back(PcrRes(pTransIds[i])); - return lcl_implCreateListLikeControl(_rxControlFactory, aInitialListEntries, _bReadOnlyControl, /*_bSorted*/false, true); + return lcl_implCreateListLikeControl(_rxControlFactory, std::move(aInitialListEntries), _bReadOnlyControl, /*_bSorted*/false, true); } Reference< XPropertyControl > PropertyHandlerHelper::createComboBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - const std::vector< OUString >& _rInitialListEntries, bool _bSorted ) + std::vector< OUString >&& _rInitialListEntries, bool _bSorted ) { - return lcl_implCreateListLikeControl( _rxControlFactory, _rInitialListEntries, /*_bReadOnlyControl*/false, _bSorted, false ); + return lcl_implCreateListLikeControl( _rxControlFactory, std::move(_rInitialListEntries), /*_bReadOnlyControl*/false, _bSorted, false ); } @@ -166,7 +165,7 @@ namespace pcr xNumericControl->setMinValue( _rMinValue ); xNumericControl->setMaxValue( _rMaxValue ); - return xNumericControl.get(); + return xNumericControl; } @@ -293,14 +292,14 @@ namespace pcr { Reference<XWindow> xWindow(rContext->getValueByName("BuilderParent"), UNO_QUERY_THROW); weld::TransportAsXWindow& rTunnel = dynamic_cast<weld::TransportAsXWindow&>(*xWindow); - return std::unique_ptr<weld::Builder>(Application::CreateBuilder(rTunnel.getWidget(), rUIFile)); + return Application::CreateBuilder(rTunnel.getWidget(), rUIFile); } void PropertyHandlerHelper::setBuilderParent(const css::uno::Reference<css::uno::XComponentContext>& rContext, weld::Widget* pParent) { Reference<css::container::XNameContainer> xName(rContext, UNO_QUERY_THROW); Reference<XWindow> xWindow(new weld::TransportAsXWindow(pParent)); - xName->insertByName("BuilderParent", makeAny(xWindow)); + xName->insertByName("BuilderParent", Any(xWindow)); } void PropertyHandlerHelper::clearBuilderParent(const css::uno::Reference<css::uno::XComponentContext>& rContext) diff --git a/extensions/source/propctrlr/handlerhelper.hxx b/extensions/source/propctrlr/handlerhelper.hxx index 9e40dab0a79d..555b8ee825e8 100644 --- a/extensions/source/propctrlr/handlerhelper.hxx +++ b/extensions/source/propctrlr/handlerhelper.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_HANDLERHELPER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_HANDLERHELPER_HXX +#pragma once #include <com/sun/star/beans/Property.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -26,7 +25,9 @@ #include <com/sun/star/inspection/XPropertyControlFactory.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/Optional.hpp> +#include <unotools/resmgr.hxx> +#include <memory> #include <vector> namespace weld { class Builder; class Widget; class Window; } @@ -91,7 +92,7 @@ namespace pcr static css::uno::Reference< css::inspection::XPropertyControl > createListBoxControl( const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory, - const std::vector< OUString >& _rInitialListEntries, + std::vector< OUString >&& _rInitialListEntries, bool _bReadOnlyControl, bool _bSorted ); @@ -117,7 +118,7 @@ namespace pcr static css::uno::Reference< css::inspection::XPropertyControl > createListBoxControl( const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory, - const char** pTransIds, size_t nElements, + const TranslateId* pTransIds, size_t nElements, bool _bReadOnlyControl ); @@ -139,7 +140,7 @@ namespace pcr static css::uno::Reference< css::inspection::XPropertyControl > createComboBoxControl( const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory, - const std::vector< OUString >& _rInitialListEntries, + std::vector< OUString >&& _rInitialListEntries, bool _bSorted ); @@ -227,6 +228,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_HANDLERHELPER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/inspectorhelpwindow.hxx b/extensions/source/propctrlr/inspectorhelpwindow.hxx index af9bae304f5a..98b8efbab2fc 100644 --- a/extensions/source/propctrlr/inspectorhelpwindow.hxx +++ b/extensions/source/propctrlr/inspectorhelpwindow.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_PROPCTRLR_INSPECTORHELPWINDOW_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_INSPECTORHELPWINDOW_HXX +#pragma once #include <vcl/weld.hxx> @@ -42,6 +41,4 @@ namespace pcr } // namespace pcr -#endif // HELPWINDOW_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/inspectormodelbase.cxx b/extensions/source/propctrlr/inspectormodelbase.cxx index 1fdc8a0b5dfc..aaa994e94abd 100644 --- a/extensions/source/propctrlr/inspectormodelbase.cxx +++ b/extensions/source/propctrlr/inspectormodelbase.cxx @@ -28,18 +28,20 @@ namespace pcr { - - -#define MODEL_PROPERTY_ID_HAS_HELP_SECTION 2000 -#define MODEL_PROPERTY_ID_MIN_HELP_TEXT_LINES 2001 -#define MODEL_PROPERTY_ID_MAX_HELP_TEXT_LINES 2002 -#define MODEL_PROPERTY_ID_IS_READ_ONLY 2003 - + namespace + { + enum class ModelPropertyId + { + HAS_HELP_SECTION = 2000, + MIN_HELP_TEXT_LINES = 2001, + MAX_HELP_TEXT_LINES = 2002, + IS_READ_ONLY = 2003 + }; + }; using ::com::sun::star::uno::Reference; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::makeAny; using ::com::sun::star::beans::Property; namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute; @@ -95,25 +97,25 @@ namespace pcr { registerProperty( "HasHelpSection", - MODEL_PROPERTY_ID_HAS_HELP_SECTION, + static_cast<sal_Int32>(ModelPropertyId::HAS_HELP_SECTION), PropertyAttribute::READONLY, &m_bHasHelpSection, cppu::UnoType<decltype(m_bHasHelpSection)>::get() ); registerProperty( "MinHelpTextLines", - MODEL_PROPERTY_ID_MIN_HELP_TEXT_LINES, + static_cast<sal_Int32>(ModelPropertyId::MIN_HELP_TEXT_LINES), PropertyAttribute::READONLY, &m_nMinHelpTextLines, cppu::UnoType<decltype(m_nMinHelpTextLines)>::get() ); registerProperty( "MaxHelpTextLines", - MODEL_PROPERTY_ID_MAX_HELP_TEXT_LINES, + static_cast<sal_Int32>(ModelPropertyId::MAX_HELP_TEXT_LINES), PropertyAttribute::READONLY, &m_nMaxHelpTextLines, cppu::UnoType<decltype(m_nMaxHelpTextLines)>::get() ); registerProperty( "IsReadOnly", - MODEL_PROPERTY_ID_IS_READ_ONLY, + static_cast<sal_Int32>(ModelPropertyId::IS_READ_ONLY), PropertyAttribute::BOUND, &m_bIsReadOnly, cppu::UnoType<decltype(m_bIsReadOnly)>::get() ); @@ -226,7 +228,7 @@ namespace pcr void SAL_CALL ImplInspectorModel::setIsReadOnly( sal_Bool IsReadOnly ) { - setFastPropertyValue( MODEL_PROPERTY_ID_IS_READ_ONLY, makeAny( IsReadOnly ) ); + setFastPropertyValue( static_cast<sal_Int32>(ModelPropertyId::IS_READ_ONLY), Any( IsReadOnly ) ); } sal_Bool SAL_CALL ImplInspectorModel::supportsService( const OUString& ServiceName ) diff --git a/extensions/source/propctrlr/inspectormodelbase.hxx b/extensions/source/propctrlr/inspectormodelbase.hxx index 09a4901681a2..527668b2fd8c 100644 --- a/extensions/source/propctrlr/inspectormodelbase.hxx +++ b/extensions/source/propctrlr/inspectormodelbase.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_INSPECTORMODELBASE_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_INSPECTORMODELBASE_HXX +#pragma once #include <com/sun/star/inspection/XObjectInspectorModel.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -91,6 +90,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_INSPECTORMODELBASE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/linedescriptor.hxx b/extensions/source/propctrlr/linedescriptor.hxx index 04b1b23b78b9..a73eda7cf25e 100644 --- a/extensions/source/propctrlr/linedescriptor.hxx +++ b/extensions/source/propctrlr/linedescriptor.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_PROPCTRLR_LINEDESCRIPTOR_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_LINEDESCRIPTOR_HXX +#pragma once #include <com/sun/star/inspection/LineDescriptor.hpp> #include <com/sun/star/inspection/XPropertyHandler.hpp> @@ -49,6 +48,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_LINEDESCRIPTOR_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/listselectiondlg.cxx b/extensions/source/propctrlr/listselectiondlg.cxx index 3dec4d7a79d3..521afdf449fa 100644 --- a/extensions/source/propctrlr/listselectiondlg.cxx +++ b/extensions/source/propctrlr/listselectiondlg.cxx @@ -21,7 +21,8 @@ #include "formstrings.hxx" #include <comphelper/sequence.hxx> -#include <tools/diagnose_ex.h> +#include <utility> +#include <comphelper/diagnose_ex.hxx> namespace pcr { @@ -29,10 +30,10 @@ namespace pcr using namespace ::com::sun::star::beans; ListSelectionDialog::ListSelectionDialog(weld::Window* pParent, const Reference< XPropertySet >& _rxListBox, - const OUString& _rPropertyName, const OUString& _rPropertyUIName) + OUString _sPropertyName, const OUString& _rPropertyUIName) : GenericDialogController(pParent, "modules/spropctrlr/ui/listselectdialog.ui", "ListSelectDialog") , m_xListBox ( _rxListBox ) - , m_sPropertyName( _rPropertyName ) + , m_sPropertyName(std::move( _sPropertyName )) , m_xFrame(m_xBuilder->weld_frame("frame")) , m_xEntries(m_xBuilder->weld_tree_view("treeview")) { @@ -99,7 +100,7 @@ namespace pcr try { - m_xListBox->setPropertyValue( m_sPropertyName, makeAny( comphelper::containerToSequence(aSelection) ) ); + m_xListBox->setPropertyValue( m_sPropertyName, Any( comphelper::containerToSequence(aSelection) ) ); } catch( const Exception& ) { diff --git a/extensions/source/propctrlr/listselectiondlg.hxx b/extensions/source/propctrlr/listselectiondlg.hxx index 395b698ffdd4..368e9e9aac94 100644 --- a/extensions/source/propctrlr/listselectiondlg.hxx +++ b/extensions/source/propctrlr/listselectiondlg.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_LISTSELECTIONDLG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_LISTSELECTIONDLG_HXX +#pragma once #include <vcl/weld.hxx> @@ -38,7 +37,7 @@ namespace pcr ListSelectionDialog( weld::Window* _pParent, const css::uno::Reference< css::beans::XPropertySet >& _rxListBox, - const OUString& _rPropertyName, + OUString _sPropertyName, const OUString& _rPropertyUIName ); virtual ~ListSelectionDialog() override; @@ -58,6 +57,4 @@ namespace pcr } // namespacepcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_LISTSELECTIONDLG_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/modulepcr.cxx b/extensions/source/propctrlr/modulepcr.cxx index 74d4b5daff7c..da8336e10991 100644 --- a/extensions/source/propctrlr/modulepcr.cxx +++ b/extensions/source/propctrlr/modulepcr.cxx @@ -23,7 +23,7 @@ namespace pcr { -OUString PcrRes(const char* pId) { return Translate::get(pId, Translate::Create("pcr")); } +OUString PcrRes(TranslateId aId) { return Translate::get(aId, Translate::Create("pcr")); } } // namespace pcr diff --git a/extensions/source/propctrlr/modulepcr.hxx b/extensions/source/propctrlr/modulepcr.hxx index ba23a795cb2c..d0b854893ea2 100644 --- a/extensions/source/propctrlr/modulepcr.hxx +++ b/extensions/source/propctrlr/modulepcr.hxx @@ -17,16 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_MODULEPCR_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_MODULEPCR_HXX +#pragma once #include <rtl/ustring.hxx> +#include <unotools/resmgr.hxx> namespace pcr { -OUString PcrRes(const char* pId); +OUString PcrRes(TranslateId pId); } // namespace pcr -#endif // _ INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_MODULEPCR_HXX_ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/newdatatype.cxx b/extensions/source/propctrlr/newdatatype.cxx index 09c774d3aa42..b2399d680668 100644 --- a/extensions/source/propctrlr/newdatatype.cxx +++ b/extensions/source/propctrlr/newdatatype.cxx @@ -26,7 +26,7 @@ namespace pcr //= NewDataTypeDialog - NewDataTypeDialog::NewDataTypeDialog(weld::Window* pParent, const OUString& _rNameBase, const std::vector< OUString >& _rProhibitedNames) + NewDataTypeDialog::NewDataTypeDialog(weld::Window* pParent, std::u16string_view _rNameBase, const std::vector< OUString >& _rProhibitedNames) : GenericDialogController(pParent, "modules/spropctrlr/ui/datatypedialog.ui", "DataTypeDialog") , m_aProhibitedNames( _rProhibitedNames.begin(), _rProhibitedNames.end() ) , m_xName(m_xBuilder->weld_entry("entry")) @@ -36,7 +36,7 @@ namespace pcr // find an initial name // for this, first remove trailing digits - sal_Int32 nStripUntil = _rNameBase.getLength(); + sal_Int32 nStripUntil = _rNameBase.size(); while ( nStripUntil > 0 ) { sal_Unicode nChar = _rNameBase[ --nStripUntil ]; @@ -48,7 +48,7 @@ namespace pcr } } - OUString sNameBase = OUString::Concat(_rNameBase.subView( 0, nStripUntil ? nStripUntil + 1 : 0 )) + " "; + OUString sNameBase = OUString::Concat(_rNameBase.substr( 0, nStripUntil ? nStripUntil + 1 : 0 )) + " "; OUString sInitialName; sal_Int32 nPostfixNumber = 1; do diff --git a/extensions/source/propctrlr/newdatatype.hxx b/extensions/source/propctrlr/newdatatype.hxx index 19a88f31c75f..ba4b6fa38269 100644 --- a/extensions/source/propctrlr/newdatatype.hxx +++ b/extensions/source/propctrlr/newdatatype.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_NEWDATATYPE_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_NEWDATATYPE_HXX +#pragma once #include <vcl/weld.hxx> @@ -37,7 +36,7 @@ namespace pcr std::unique_ptr<weld::Entry> m_xName; std::unique_ptr<weld::Button> m_xOK; public: - NewDataTypeDialog(weld::Window* _pParent, const OUString& _rNameBase, + NewDataTypeDialog(weld::Window* _pParent, std::u16string_view _rNameBase, const std::vector< OUString >& _rProhibitedNames ); virtual ~NewDataTypeDialog() override; @@ -51,6 +50,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_NEWDATATYPE_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/objectinspectormodel.cxx b/extensions/source/propctrlr/objectinspectormodel.cxx index e320a0f8f24b..a05d9347f979 100644 --- a/extensions/source/propctrlr/objectinspectormodel.cxx +++ b/extensions/source/propctrlr/objectinspectormodel.cxx @@ -29,7 +29,6 @@ namespace pcr { - using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; @@ -79,7 +78,6 @@ namespace pcr //= ObjectInspectorModel ObjectInspectorModel::ObjectInspectorModel() - :ImplInspectorModel() { } @@ -153,8 +151,7 @@ namespace pcr void ObjectInspectorModel::createDefault() { - m_aFactories.realloc( 1 ); - m_aFactories[0] <<= OUString( "com.sun.star.inspection.GenericPropertyHandler" ); + m_aFactories = { Any(OUString( "com.sun.star.inspection.GenericPropertyHandler" )) }; } diff --git a/extensions/source/propctrlr/pcrcommon.cxx b/extensions/source/propctrlr/pcrcommon.cxx index b6c826b61a5e..6b0cee5c7ca8 100644 --- a/extensions/source/propctrlr/pcrcommon.cxx +++ b/extensions/source/propctrlr/pcrcommon.cxx @@ -28,30 +28,26 @@ namespace pcr { - using namespace ::com::sun::star::util; - - //= HelpIdUrl - OString HelpIdUrl::getHelpId( const OUString& _rHelpURL ) + OUString HelpIdUrl::getHelpId( std::u16string_view _rHelpURL ) { INetURLObject aHID( _rHelpURL ); if ( aHID.GetProtocol() == INetProtocol::Hid ) - return OUStringToOString( aHID.GetURLPath(), RTL_TEXTENCODING_UTF8 ); + return aHID.GetURLPath(); else - return OUStringToOString( _rHelpURL, RTL_TEXTENCODING_UTF8 ); + return OUString(_rHelpURL); } - OUString HelpIdUrl::getHelpURL( std::string_view sHelpId ) + OUString HelpIdUrl::getHelpURL( std::u16string_view sHelpId ) { OUStringBuffer aBuffer; - OUString aTmp( OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8) ); - INetURLObject aHID( aTmp ); + INetURLObject aHID( sHelpId ); if ( aHID.GetProtocol() == INetProtocol::NotValid ) aBuffer.append( INET_HID_SCHEME ); - aBuffer.append( aTmp ); + aBuffer.append( sHelpId ); return aBuffer.makeStringAndClear(); } diff --git a/extensions/source/propctrlr/pcrcommon.hxx b/extensions/source/propctrlr/pcrcommon.hxx index ccaa39136a15..f2a8b847c000 100644 --- a/extensions/source/propctrlr/pcrcommon.hxx +++ b/extensions/source/propctrlr/pcrcommon.hxx @@ -17,37 +17,32 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMON_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMON_HXX +#pragma once #define EDITOR_LIST_APPEND (SAL_MAX_UINT16) #define EDITOR_LIST_ENTRY_NOTFOUND (SAL_MAX_UINT16) #include <sal/config.h> -#include <string_view> - #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/XPropertyChangeListener.hpp> -#include <com/sun/star/beans/PropertyChangeEvent.hpp> - -#include <comphelper/listenernotification.hxx> - +#include <comphelper/interfacecontainer3.hxx> namespace pcr { - - #define OWN_PROPERTY_ID_INTROSPECTEDOBJECT 0x0010 - #define OWN_PROPERTY_ID_CURRENTPAGE 0x0011 - #define OWN_PROPERTY_ID_CONTROLCONTEXT 0x0012 - #define OWN_PROPERTY_ID_TABBINGMODEL 0x0013 + enum class OwnPropertyId + { + INTROSPECTEDOBJECT = 0x0010, + CURRENTPAGE = 0x0011, + CONTROLCONTEXT = 0x0012, + TABBINGMODEL = 0x0013 + }; //= types - typedef ::comphelper::OSimpleListenerContainer < css::beans::XPropertyChangeListener - , css::beans::PropertyChangeEvent + typedef ::comphelper::OInterfaceContainerHelper3 < css::beans::XPropertyChangeListener > PropertyChangeListeners; @@ -68,8 +63,8 @@ namespace pcr class HelpIdUrl { public: - static OString getHelpId( const OUString& _rHelpURL ); - static OUString getHelpURL( std::string_view ); + static OUString getHelpId( std::u16string_view _rHelpURL ); + static OUString getHelpURL( std::u16string_view ); }; @@ -125,6 +120,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMON_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrcommontypes.hxx b/extensions/source/propctrlr/pcrcommontypes.hxx index aebb3d47f420..e2aa3570ece0 100644 --- a/extensions/source/propctrlr/pcrcommontypes.hxx +++ b/extensions/source/propctrlr/pcrcommontypes.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMONTYPES_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMONTYPES_HXX +#pragma once #include <com/sun/star/beans/Property.hpp> #include <rtl/ustring.hxx> @@ -31,6 +30,4 @@ typedef std::unordered_map<OUString, css::beans::Property> PropertyMap; } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMONTYPES_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrstrings.hxx b/extensions/source/propctrlr/pcrstrings.hxx index ec4cab753d2d..3e9ac3ea55e6 100644 --- a/extensions/source/propctrlr/pcrstrings.hxx +++ b/extensions/source/propctrlr/pcrstrings.hxx @@ -17,21 +17,19 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRSTRINGS_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRSTRINGS_HXX +#pragma once +#include <rtl/ustring.hxx> namespace pcr { // properties - #define PROPERTY_TABBINGMODEL "TabbingModel" + constexpr OUString PROPERTY_TABBINGMODEL = u"TabbingModel"_ustr; } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRSTRINGS_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrunodialogs.cxx b/extensions/source/propctrlr/pcrunodialogs.cxx index 2c6113647855..f36aedf39d76 100644 --- a/extensions/source/propctrlr/pcrunodialogs.cxx +++ b/extensions/source/propctrlr/pcrunodialogs.cxx @@ -35,7 +35,6 @@ namespace pcr using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; @@ -45,11 +44,11 @@ namespace pcr OTabOrderDialog::OTabOrderDialog( const Reference< XComponentContext >& _rxContext ) :OGenericUnoDialog( _rxContext ) { - registerProperty( PROPERTY_CONTROLCONTEXT, OWN_PROPERTY_ID_CONTROLCONTEXT, + registerProperty( PROPERTY_CONTROLCONTEXT, static_cast<sal_Int32>(OwnPropertyId::CONTROLCONTEXT), PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT, &m_xControlContext, cppu::UnoType<decltype(m_xControlContext)>::get() ); - registerProperty( PROPERTY_TABBINGMODEL, OWN_PROPERTY_ID_TABBINGMODEL, + registerProperty( PROPERTY_TABBINGMODEL, static_cast<sal_Int32>(OwnPropertyId::TABBINGMODEL), PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT, &m_xTabbingModel, cppu::UnoType<decltype(m_xTabbingModel)>::get() ); } @@ -111,19 +110,20 @@ namespace pcr Reference<css::awt::XWindow> xParentWindow; if (aArguments.getLength() == 3 && (aArguments[0] >>= xTabbingModel) && (aArguments[1] >>= xControlContext) && (aArguments[2] >>= xParentWindow)) { - Sequence< Any > aNewArguments( 3 ); - aNewArguments[0] <<= NamedValue( - "TabbingModel", - makeAny( xTabbingModel ) - ); - aNewArguments[1] <<= NamedValue( - "ControlContext", - makeAny( xControlContext ) - ); - aNewArguments[2] <<= NamedValue( - "ParentWindow", - makeAny( xParentWindow ) - ); + Sequence< Any > aNewArguments{ + Any(NamedValue( + "TabbingModel", + Any( xTabbingModel ) + )), + Any(NamedValue( + "ControlContext", + Any( xControlContext ) + )), + Any(NamedValue( + "ParentWindow", + Any( xParentWindow ) + )) + }; OTabOrderDialog_DBase::initialize(aNewArguments); } else diff --git a/extensions/source/propctrlr/pcrunodialogs.hxx b/extensions/source/propctrlr/pcrunodialogs.hxx index 2d6c0cb813e2..87c99db35753 100644 --- a/extensions/source/propctrlr/pcrunodialogs.hxx +++ b/extensions/source/propctrlr/pcrunodialogs.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_PROPCTRLR_PCRUNODIALOGS_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRUNODIALOGS_HXX +#pragma once #include <svtools/genericunodialog.hxx> #include <com/sun/star/awt/XTabControllerModel.hpp> @@ -77,6 +76,4 @@ namespace pcr } // namespacepcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRUNODIALOGS_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 4f3365e6b099..f6a37893a11b 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -37,8 +37,8 @@ #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/util/VetoException.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> -#include <toolkit/awt/vclxwindow.hxx> +#include <comphelper/diagnose_ex.hxx> +#include <toolkit/helper/vclunohelper.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <vcl/weldutils.hxx> @@ -55,9 +55,7 @@ namespace pcr using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::container; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::util; using namespace ::com::sun::star::inspection; @@ -208,7 +206,7 @@ namespace pcr // inspect again, if we already have inspectees if ( !m_aInspectedObjects.empty() ) - impl_rebindToInspectee_nothrow( m_aInspectedObjects ); + impl_rebindToInspectee_nothrow( std::vector(m_aInspectedObjects) ); } @@ -340,15 +338,14 @@ namespace pcr if (weld::TransportAsXWindow* pTunnel = dynamic_cast<weld::TransportAsXWindow*>(xContainerWindow.get())) { - xBuilder.reset(Application::CreateBuilder(pTunnel->getWidget(), sUIFile)); + xBuilder = Application::CreateBuilder(pTunnel->getWidget(), sUIFile); } else { - VCLXWindow* pContainerWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>(xContainerWindow); - VclPtr<vcl::Window> pParentWin = pContainerWindow ? pContainerWindow->GetWindow() : VclPtr<vcl::Window>(); + VclPtr<vcl::Window> pParentWin = VCLUnoHelper::GetWindow(xContainerWindow); if (!pParentWin) throw RuntimeException("The frame is invalid. Unable to extract the container window.",*this); - xBuilder.reset(Application::CreateInterimBuilder(pParentWin, sUIFile, true)); + xBuilder = Application::CreateInterimBuilder(pParentWin, sUIFile, true); } Construct(xContainerWindow, std::move(xBuilder)); @@ -444,7 +441,7 @@ namespace pcr Any SAL_CALL OPropertyBrowserController::getViewData( ) { - return makeAny( m_sPageSelection ); + return Any( m_sPageSelection ); } @@ -491,6 +488,9 @@ namespace pcr m_aInspectedObjects.clear(); impl_bindToNewModel_nothrow( nullptr ); + m_xModel.clear(); + m_xInteractiveHandler.clear(); + m_xFrame.clear(); } void SAL_CALL OPropertyBrowserController::addEventListener( const Reference< XEventListener >& _rxListener ) @@ -644,7 +644,7 @@ namespace pcr // Even if they had an API for this, we do not know whether they were // originally created read-only, or if they are read-only just because // the model was. - impl_rebindToInspectee_nothrow( m_aInspectedObjects ); + impl_rebindToInspectee_nothrow( std::vector(m_aInspectedObjects) ); return; } @@ -693,7 +693,7 @@ namespace pcr bool bMultiLineTextField = ControlType == PropertyControlType::MultiLineTextField; std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/multiline.ui", m_xContext)); auto pContainer = xBuilder->weld_container("multiline"); - auto pControl = new OMultilineEditControl(std::move(pContainer), std::move(xBuilder), + rtl::Reference<OMultilineEditControl> pControl = new OMultilineEditControl(std::move(pContainer), std::move(xBuilder), bMultiLineTextField ? eMultiLineText : eStringList, bCreateReadOnly); pControl->SetModifyHandler(); xControl = pControl; @@ -704,7 +704,7 @@ namespace pcr { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/listbox.ui", m_xContext)); auto pComboBox = xBuilder->weld_combo_box("listbox"); - auto pControl = new OListboxControl(std::move(pComboBox), std::move(xBuilder), bCreateReadOnly); + rtl::Reference<OListboxControl> pControl = new OListboxControl(std::move(pComboBox), std::move(xBuilder), bCreateReadOnly); pControl->SetModifyHandler(); xControl = pControl; break; @@ -714,7 +714,7 @@ namespace pcr { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/combobox.ui", m_xContext)); auto pComboBox = xBuilder->weld_combo_box("combobox"); - auto pControl = new OComboboxControl(std::move(pComboBox), std::move(xBuilder), bCreateReadOnly); + rtl::Reference<OComboboxControl> pControl = new OComboboxControl(std::move(pComboBox), std::move(xBuilder), bCreateReadOnly); pControl->SetModifyHandler(); xControl = pControl; break; @@ -726,7 +726,7 @@ namespace pcr bool bCharacterField = ControlType == PropertyControlType::CharacterField; std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/textfield.ui", m_xContext)); auto pEntry = xBuilder->weld_entry("textfield"); - auto pControl = new OEditControl(std::move(pEntry), std::move(xBuilder), bCharacterField, bCreateReadOnly); + rtl::Reference<OEditControl> pControl = new OEditControl(std::move(pEntry), std::move(xBuilder), bCharacterField, bCreateReadOnly); pControl->SetModifyHandler(); xControl = pControl; break; @@ -736,7 +736,7 @@ namespace pcr { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/numericfield.ui", m_xContext)); auto pSpinButton = xBuilder->weld_metric_spin_button("numericfield", FieldUnit::NONE); - auto pControl = new ONumericControl(std::move(pSpinButton), std::move(xBuilder), bCreateReadOnly); + rtl::Reference<ONumericControl> pControl = new ONumericControl(std::move(pSpinButton), std::move(xBuilder), bCreateReadOnly); pControl->SetModifyHandler(); xControl = pControl; break; @@ -746,7 +746,7 @@ namespace pcr { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/datetimefield.ui", m_xContext)); auto pContainer = xBuilder->weld_container("datetimefield"); - auto pControl = new ODateTimeControl(std::move(pContainer), std::move(xBuilder), bCreateReadOnly); + rtl::Reference<ODateTimeControl> pControl = new ODateTimeControl(std::move(pContainer), std::move(xBuilder), bCreateReadOnly); pControl->SetModifyHandler(); xControl = pControl; break; @@ -755,8 +755,8 @@ namespace pcr case PropertyControlType::DateField: { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/datefield.ui", m_xContext)); - auto pMenuButton = xBuilder->weld_menu_button("datefield"); - auto pControl = new ODateControl(std::make_unique<SvtCalendarBox>(std::move(pMenuButton)), std::move(xBuilder), bCreateReadOnly); + auto pContainer = xBuilder->weld_container("datefield"); + rtl::Reference<ODateControl> pControl = new ODateControl(std::move(pContainer), std::move(xBuilder), bCreateReadOnly); pControl->SetModifyHandler(); xControl = pControl; break; @@ -766,7 +766,7 @@ namespace pcr { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/timefield.ui", m_xContext)); auto pTimeSpinButton = xBuilder->weld_formatted_spin_button("timefield"); - auto pControl = new OTimeControl(std::move(pTimeSpinButton), std::move(xBuilder), bCreateReadOnly); + rtl::Reference<OTimeControl> pControl = new OTimeControl(std::move(pTimeSpinButton), std::move(xBuilder), bCreateReadOnly); pControl->SetModifyHandler(); xControl = pControl; break; @@ -774,10 +774,10 @@ namespace pcr case PropertyControlType::ColorListBox: { - weld::Window* pTopLevel = PropertyHandlerHelper::getDialogParentFrame(m_xContext); + auto lambda = [this]{ return PropertyHandlerHelper::getDialogParentFrame(m_xContext); }; std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/colorlistbox.ui", m_xContext)); auto pMenuButton = xBuilder->weld_menu_button("colorlistbox"); - auto pControl = new OColorControl(std::make_unique<ColorListBox>(std::move(pMenuButton), pTopLevel), std::move(xBuilder), bCreateReadOnly); + rtl::Reference<OColorControl> pControl = new OColorControl(std::make_unique<ColorListBox>(std::move(pMenuButton), lambda), std::move(xBuilder), bCreateReadOnly); pControl->SetModifyHandler(); xControl = pControl; break; @@ -787,7 +787,7 @@ namespace pcr { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/hyperlinkfield.ui", m_xContext)); auto pContainer = xBuilder->weld_container("hyperlinkfield"); - auto pControl = new OHyperlinkControl(std::move(pContainer), std::move(xBuilder), bCreateReadOnly); + rtl::Reference<OHyperlinkControl> pControl = new OHyperlinkControl(std::move(pContainer), std::move(xBuilder), bCreateReadOnly); pControl->SetModifyHandler(); xControl = pControl; break; @@ -908,7 +908,7 @@ namespace pcr } - void OPropertyBrowserController::impl_rebindToInspectee_nothrow( const InterfaceArray& _rObjects ) + void OPropertyBrowserController::impl_rebindToInspectee_nothrow( InterfaceArray&& _rObjects ) { try { @@ -916,7 +916,7 @@ namespace pcr stopInspection( true ); // inspect the new object(s) - m_aInspectedObjects = _rObjects; + m_aInspectedObjects = std::move(_rObjects); doInspection(); // update the user interface @@ -957,17 +957,17 @@ namespace pcr } // append these properties to our "all properties" array - aProperties.reserve( aProperties.size() + aThisHandlersProperties.size() ); - for (const auto & aThisHandlersPropertie : aThisHandlersProperties) + aProperties.reserve( std::max<size_t>(aProperties.size() + aThisHandlersProperties.size(), aProperties.size() * 2) ); + for (const auto & aThisHandlersProperty : aThisHandlersProperties) { auto noPrevious = std::none_of( aProperties.begin(), aProperties.end(), - FindPropertyByName( aThisHandlersPropertie.Name ) + FindPropertyByName( aThisHandlersProperty.Name ) ); if ( noPrevious ) { - aProperties.push_back( aThisHandlersPropertie ); + aProperties.push_back( aThisHandlersProperty ); continue; } @@ -980,7 +980,7 @@ namespace pcr // which means it can give it a completely different meaning than the previous // handler for this property is prepared for. std::pair< PropertyHandlerMultiRepository::iterator, PropertyHandlerMultiRepository::iterator > - aDepHandlers = m_aDependencyHandlers.equal_range( aThisHandlersPropertie.Name ); + aDepHandlers = m_aDependencyHandlers.equal_range( aThisHandlersProperty.Name ); m_aDependencyHandlers.erase( aDepHandlers.first, aDepHandlers.second ); } @@ -1004,9 +1004,9 @@ namespace pcr // remember this handler for every of the properties which it is responsible // for - for (const auto & aThisHandlersPropertie : aThisHandlersProperties) + for (const auto & aThisHandlersProperty : aThisHandlersProperties) { - m_aPropertyHandlers[ aThisHandlersPropertie.Name ] = *aHandler; + m_aPropertyHandlers[ aThisHandlersProperty.Name ] = *aHandler; // note that this implies that if two handlers support the same property, // the latter wins } @@ -1105,6 +1105,16 @@ namespace pcr } _rDescriptor.bReadOnly = impl_isReadOnlyModel_throw(); + + // for ui-testing try and distinguish different instances of the controls + auto xWindow = _rDescriptor.Control->getControlWindow(); + if (weld::TransportAsXWindow* pTunnel = dynamic_cast<weld::TransportAsXWindow*>(xWindow.get())) + { + weld::Widget* m_pControlWindow = pTunnel->getWidget(); + if (m_pControlWindow) + m_pControlWindow->set_buildable_name(m_pControlWindow->get_buildable_name() + "-" + _rDescriptor.DisplayName); + } + } catch( const Exception& ) { @@ -1169,7 +1179,7 @@ namespace pcr // this category does not yet exist. This is allowed, as an inspector model might be lazy, and not provide // any category information of its own. In this case, we have a fallback ... m_aPageIds[ aDescriptor.Category ] = - getPropertyBox().AppendPage( aDescriptor.Category, OString() ); + getPropertyBox().AppendPage(aDescriptor.Category, {}); nTargetPageId = impl_getPageIdForCategory_nothrow( aDescriptor.Category ); } @@ -1389,7 +1399,7 @@ namespace pcr if ( m_xModel.is() ) aHandlerFactories = m_xModel->getHandlerFactories(); - for ( auto const & handlerFactory : std::as_const(aHandlerFactories) ) + for (auto const& handlerFactory : aHandlerFactories) { if ( _rObjects.size() == 1 ) { // we're inspecting only one object -> one handler @@ -1419,7 +1429,7 @@ namespace pcr // then create a handler which composes information out of those single handlers if ( !aSingleHandlers.empty() ) - _rHandlers.push_back( new PropertyComposer( aSingleHandlers ) ); + _rHandlers.push_back( new PropertyComposer( std::move(aSingleHandlers) ) ); } } diff --git a/extensions/source/propctrlr/propcontroller.hxx b/extensions/source/propctrlr/propcontroller.hxx index 182c7d1da1a1..a149d7ff2338 100644 --- a/extensions/source/propctrlr/propcontroller.hxx +++ b/extensions/source/propctrlr/propcontroller.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPCONTROLLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPCONTROLLER_HXX +#pragma once #include "composeduiupdate.hxx" #include "proplinelistener.hxx" @@ -77,10 +76,7 @@ namespace pcr typedef std::vector< css::uno::Reference< css::uno::XInterface > > InterfaceArray; - protected: css::uno::Reference< css::uno::XComponentContext > m_xContext; - - private: css::uno::Reference< css::frame::XFrame > m_xFrame; css::uno::Reference< css::awt::XWindow > m_xView; @@ -224,7 +220,7 @@ namespace pcr void doInspection(); // bind the browser to m_xIntrospecteeAsProperty - void impl_rebindToInspectee_nothrow( const InterfaceArray& _rObjects ); + void impl_rebindToInspectee_nothrow( InterfaceArray&& _rObjects ); /** retrieves special property handlers for our introspectee */ @@ -366,6 +362,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPCONTROLLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propcontrolobserver.hxx b/extensions/source/propctrlr/propcontrolobserver.hxx index 8b448adc0d96..93e11053dae3 100644 --- a/extensions/source/propctrlr/propcontrolobserver.hxx +++ b/extensions/source/propctrlr/propcontrolobserver.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_PROPCTRLR_PROPCONTROLOBSERVER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPCONTROLOBSERVER_HXX +#pragma once #include <com/sun/star/inspection/XPropertyControl.hpp> @@ -44,6 +43,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPCONTROLOBSERVER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertycomposer.cxx b/extensions/source/propctrlr/propertycomposer.cxx index c5b5d32e341c..869cba77c7fe 100644 --- a/extensions/source/propctrlr/propertycomposer.cxx +++ b/extensions/source/propctrlr/propertycomposer.cxx @@ -23,10 +23,11 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <comphelper/sequence.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <algorithm> #include <iterator> +#include <utility> namespace pcr @@ -48,7 +49,7 @@ namespace pcr { OUString sPropertyName; const Any& rValue; - SetPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) : sPropertyName( _rPropertyName ), rValue( _rValue ) { } + SetPropertyValue( OUString _aPropertyName, const Any& _rValue ) : sPropertyName(std::move( _aPropertyName )), rValue( _rValue ) { } void operator()( const Reference< XPropertyHandler >& _rHandler ) { _rHandler->setPropertyValue( sPropertyName, rValue ); @@ -82,9 +83,9 @@ namespace pcr // of supported properties per handler). Shouldn't we cache this? So that it is O( log k )? - PropertyComposer::PropertyComposer( const std::vector< Reference< XPropertyHandler > >& _rSlaveHandlers ) + PropertyComposer::PropertyComposer( std::vector< Reference< XPropertyHandler > >&& _rSlaveHandlers ) :PropertyComposer_Base ( m_aMutex ) - ,m_aSlaveHandlers ( _rSlaveHandlers ) + ,m_aSlaveHandlers ( std::move(_rSlaveHandlers) ) ,m_aPropertyListeners ( m_aMutex ) ,m_bSupportedPropertiesAreKnown ( false ) { @@ -186,14 +187,14 @@ namespace pcr void SAL_CALL PropertyComposer::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) { MethodGuard aGuard( *this ); - m_aPropertyListeners.addListener( _rxListener ); + m_aPropertyListeners.addInterface( _rxListener ); } void SAL_CALL PropertyComposer::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) { MethodGuard aGuard( *this ); - m_aPropertyListeners.removeListener( _rxListener ); + m_aPropertyListeners.removeInterface( _rxListener ); } @@ -432,14 +433,14 @@ namespace pcr { DBG_UNHANDLED_EXCEPTION("extensions.propctrlr"); } - m_aPropertyListeners.notify( aTranslatedEvent, &XPropertyChangeListener::propertyChange ); + m_aPropertyListeners.notifyEach( &XPropertyChangeListener::propertyChange, aTranslatedEvent ); } void SAL_CALL PropertyComposer::disposing( const EventObject& Source ) { MethodGuard aGuard( *this ); - m_aPropertyListeners.disposing( Source ); + m_aPropertyListeners.disposeAndClear( Source ); } diff --git a/extensions/source/propctrlr/propertycomposer.hxx b/extensions/source/propctrlr/propertycomposer.hxx index 7b43a809b4fa..5bcc58e23faf 100644 --- a/extensions/source/propctrlr/propertycomposer.hxx +++ b/extensions/source/propctrlr/propertycomposer.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX +#pragma once #include "pcrcommon.hxx" #include "composeduiupdate.hxx" @@ -68,7 +67,7 @@ namespace pcr @param _rSlaveHandlers the set of slave handlers to invoke. Must not be <NULL/> */ - explicit PropertyComposer( const std::vector< css::uno::Reference< css::inspection::XPropertyHandler > >& _rSlaveHandlers ); + explicit PropertyComposer( std::vector< css::uno::Reference< css::inspection::XPropertyHandler > >&& _rSlaveHandlers ); public: // XPropertyHandler overridables @@ -140,6 +139,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertycontrolextender.cxx b/extensions/source/propctrlr/propertycontrolextender.cxx index 142e288ddeb9..f2854f447a17 100644 --- a/extensions/source/propctrlr/propertycontrolextender.cxx +++ b/extensions/source/propctrlr/propertycontrolextender.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/awt/KeyFunction.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr @@ -33,7 +33,6 @@ namespace pcr using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::Any; - using ::com::sun::star::awt::XWindow; using ::com::sun::star::awt::KeyEvent; using ::com::sun::star::inspection::XPropertyControl; using ::com::sun::star::lang::EventObject; @@ -42,26 +41,16 @@ namespace pcr namespace KeyFunction = ::com::sun::star::awt::KeyFunction; - //= PropertyControlExtender_Data - - struct PropertyControlExtender_Data - { - Reference< XPropertyControl > xControl; - Reference< XWindow > xControlWindow; - }; - - //= PropertyControlExtender PropertyControlExtender::PropertyControlExtender( const Reference< XPropertyControl >& _rxObservedControl ) - :m_pData( new PropertyControlExtender_Data ) { try { - m_pData->xControl.set( _rxObservedControl, UNO_SET_THROW ); - m_pData->xControlWindow.set( m_pData->xControl->getControlWindow(), UNO_SET_THROW ); - m_pData->xControlWindow->addKeyListener( this ); + mxControl.set( _rxObservedControl, UNO_SET_THROW ); + mxControlWindow.set( mxControl->getControlWindow(), UNO_SET_THROW ); + mxControlWindow->addKeyListener( this ); } catch( const Exception& ) { @@ -77,7 +66,7 @@ namespace pcr void SAL_CALL PropertyControlExtender::keyPressed( const KeyEvent& _event ) { - OSL_ENSURE( _event.Source == m_pData->xControlWindow, "PropertyControlExtender::keyPressed: where does this come from?" ); + OSL_ENSURE( _event.Source == mxControlWindow, "PropertyControlExtender::keyPressed: where does this come from?" ); if ( ( _event.KeyFunc != KeyFunction::DELETE ) || ( _event.Modifiers != 0 ) ) @@ -85,7 +74,7 @@ namespace pcr try { - Reference< XPropertyControl > xControl( m_pData->xControl, UNO_SET_THROW ); + Reference< XPropertyControl > xControl( mxControl, UNO_SET_THROW ); // reset the value xControl->setValue( Any() ); @@ -112,10 +101,10 @@ namespace pcr void SAL_CALL PropertyControlExtender::disposing( const EventObject& Source ) { - OSL_ENSURE( Source.Source == m_pData->xControlWindow, "PropertyControlExtender::disposing: where does this come from?" ); + OSL_ENSURE( Source.Source == mxControlWindow, "PropertyControlExtender::disposing: where does this come from?" ); (void)Source.Source; - m_pData->xControlWindow.clear(); - m_pData->xControl.clear(); + mxControlWindow.clear(); + mxControl.clear(); } diff --git a/extensions/source/propctrlr/propertycontrolextender.hxx b/extensions/source/propctrlr/propertycontrolextender.hxx index 9c1bee8dbfd3..e376223ebf35 100644 --- a/extensions/source/propctrlr/propertycontrolextender.hxx +++ b/extensions/source/propctrlr/propertycontrolextender.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCONTROLEXTENDER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCONTROLEXTENDER_HXX +#pragma once #include <com/sun/star/awt/XKeyListener.hpp> #include <com/sun/star/inspection/XPropertyControl.hpp> @@ -54,13 +53,12 @@ namespace pcr virtual ~PropertyControlExtender() override; private: - std::unique_ptr< PropertyControlExtender_Data > m_pData; + css::uno::Reference< css::inspection::XPropertyControl > mxControl; + css::uno::Reference< css::awt::XWindow > mxControlWindow; }; } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCONTROLEXTENDER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertyeditor.cxx b/extensions/source/propctrlr/propertyeditor.cxx index 36131848c403..1e026c5b5bb4 100644 --- a/extensions/source/propctrlr/propertyeditor.cxx +++ b/extensions/source/propctrlr/propertyeditor.cxx @@ -23,6 +23,7 @@ #include "linedescriptor.hxx" #include <tools/debug.hxx> +#include <utility> #include <osl/diagnose.h> namespace pcr @@ -64,7 +65,7 @@ namespace pcr int nCount = m_xTabControl->get_n_pages(); for (int i = nCount - 1; i >= 0; --i) { - OString sID = m_xTabControl->get_page_ident(i); + OUString sID = m_xTabControl->get_page_ident(i); m_xTabControl->remove_page(sID); } @@ -79,7 +80,7 @@ namespace pcr void OPropertyEditor::CommitModified() { // commit all of my pages, if necessary - for (auto& page : m_aShownPages) + for (const auto& page : m_aShownPages) { OBrowserPage* pPage = page.second.xPage.get(); if (pPage && pPage->getListBox().IsModified() ) @@ -115,12 +116,12 @@ namespace pcr return const_cast<OPropertyEditor*>(this)->getPage(rPageId); } - sal_uInt16 OPropertyEditor::AppendPage(const OUString& rText, const OString& rHelpId) + sal_uInt16 OPropertyEditor::AppendPage(const OUString& rText, const OUString& rHelpId) { // obtain a new id sal_uInt16 nId = m_nNextId++; // insert the id - OString sIdent = OString::number(nId); + OUString sIdent = OUString::number(nId); m_xTabControl->append_page(sIdent, rText); // create a new page @@ -139,7 +140,7 @@ namespace pcr return nId; } - void OPropertyEditor::SetHelpId( const OString& rHelpId ) + void OPropertyEditor::SetHelpId( const OUString& rHelpId ) { m_xTabControl->set_help_id(rHelpId); } @@ -151,13 +152,13 @@ namespace pcr return; m_aShownPages.erase(aPagePos); - OString sIdent(OString::number(nID)); + OUString sIdent(OUString::number(nID)); m_xTabControl->remove_page(sIdent); } void OPropertyEditor::SetPage(sal_uInt16 nId) { - m_xTabControl->set_current_page(OString::number(nId)); + m_xTabControl->set_current_page(OUString::number(nId)); } sal_uInt16 OPropertyEditor::GetCurPage() const @@ -289,7 +290,7 @@ namespace pcr { assert((m_aHiddenPages.find(nPageId) != m_aHiddenPages.end() || m_aShownPages.find(nPageId) != m_aShownPages.end()) && "page doesn't exist"); - OString sIdent(OString::number(nPageId)); + OUString sIdent(OUString::number(nPageId)); if (!bShow) { auto aPagePos = m_aShownPages.find(nPageId); @@ -318,7 +319,7 @@ namespace pcr void OPropertyEditor::EnablePropertyControls( const OUString& rEntryName, sal_Int16 nControls, bool bEnable ) { - for (auto& rPage : m_aShownPages) + for (const auto& rPage : m_aShownPages) { OBrowserPage* pPage = rPage.second.xPage.get(); if (pPage) @@ -328,7 +329,7 @@ namespace pcr void OPropertyEditor::EnablePropertyLine( const OUString& rEntryName, bool bEnable ) { - for (auto& rPage : m_aShownPages) + for (const auto& rPage : m_aShownPages) { OBrowserPage* pPage = rPage.second.xPage.get(); if (pPage) @@ -346,12 +347,12 @@ namespace pcr return xControl; } - IMPL_LINK_NOARG(OPropertyEditor, OnPageActivate, const OString&, void) + IMPL_LINK(OPropertyEditor, OnPageActivate, const OUString&, rNewPage, void) { - m_aPageActivationHandler.Call(nullptr); + m_aPageActivationHandler.Call(rNewPage); } - IMPL_LINK(OPropertyEditor, OnPageDeactivate, const OString&, rIdent, bool) + IMPL_LINK(OPropertyEditor, OnPageDeactivate, const OUString&, rIdent, bool) { // commit the data on the current (to-be-deactivated) tab page // (79404) @@ -370,8 +371,8 @@ namespace pcr { } - OPropertyEditor::PropertyPage::PropertyPage(sal_uInt16 nPagePos, const OUString& rLabel, std::unique_ptr<OBrowserPage> pPage) - : nPos(nPagePos), sLabel(rLabel), xPage(std::move(pPage)) + OPropertyEditor::PropertyPage::PropertyPage(sal_uInt16 nPagePos, OUString aLabel, std::unique_ptr<OBrowserPage> pPage) + : nPos(nPagePos), sLabel(std::move(aLabel)), xPage(std::move(pPage)) { } diff --git a/extensions/source/propctrlr/propertyeditor.hxx b/extensions/source/propctrlr/propertyeditor.hxx index 6b20d6ce232e..96199b31af4c 100644 --- a/extensions/source/propctrlr/propertyeditor.hxx +++ b/extensions/source/propctrlr/propertyeditor.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYEDITOR_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYEDITOR_HXX +#pragma once #include "browserpage.hxx" #include "pcrcommon.hxx" @@ -47,7 +46,7 @@ namespace pcr OUString sLabel; std::unique_ptr<OBrowserPage> xPage; PropertyPage(); - PropertyPage(sal_uInt16 nPagePos, const OUString& rLabel, std::unique_ptr<OBrowserPage> pPage); + PropertyPage(sal_uInt16 nPagePos, OUString aLabel, std::unique_ptr<OBrowserPage> pPage); }; std::unique_ptr<weld::Container> m_xContainer; @@ -58,7 +57,7 @@ namespace pcr IPropertyLineListener* m_pListener; IPropertyControlObserver* m_pObserver; sal_uInt16 m_nNextId; - Link<LinkParamNone*,void> m_aPageActivationHandler; + Link<const OUString&,void> m_aPageActivationHandler; bool m_bHasHelpSection; MapStringToPageId m_aPropertyPageIds; @@ -76,8 +75,8 @@ namespace pcr bool HasHelpSection() const { return m_bHasHelpSection; } void SetHelpText( const OUString& _rHelpText ); - void SetHelpId( const OString& sHelpId ); - sal_uInt16 AppendPage( const OUString& r, const OString& _rHelpId ); + void SetHelpId( const OUString& sHelpId ); + sal_uInt16 AppendPage( const OUString& r, const OUString& _rHelpId ); void SetPage( sal_uInt16 ); void RemovePage(sal_uInt16 nID); sal_uInt16 GetCurPage() const; @@ -96,11 +95,11 @@ namespace pcr void RemoveEntry( const OUString& _rName ); void ChangeEntry( const OLineDescriptor& ); - void setPageActivationHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aPageActivationHandler = _rHdl; } + void setPageActivationHandler(const Link<const OUString&,void>& _rHdl) { m_aPageActivationHandler = _rHdl; } Size get_preferred_size() const; - weld::Container* getWidget() const { return m_xTabControl.get(); } + weld::Widget* getWidget() const { return m_xTabControl.get(); } void Show() { m_xTabControl->show(); } void Hide() { m_xTabControl->hide(); } @@ -123,15 +122,13 @@ namespace pcr void enableHelpSection( OBrowserPage& _rPage, const void* ); static void setHelpSectionText( OBrowserPage& _rPage, const void* _pPointerToOUString ); - DECL_LINK(OnPageDeactivate, const OString&, bool); - DECL_LINK(OnPageActivate, const OString&, void); + DECL_LINK(OnPageDeactivate, const OUString&, bool); + DECL_LINK(OnPageActivate, const OUString&, void); }; } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYEDITOR_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx index e30c38020444..bd6ba2af7407 100644 --- a/extensions/source/propctrlr/propertyhandler.cxx +++ b/extensions/source/propctrlr/propertyhandler.cxx @@ -34,6 +34,7 @@ #include <unotools/localedatawrapper.hxx> #include <unotools/syslocale.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <rtl/ref.hxx> #include <algorithm> @@ -41,7 +42,6 @@ namespace pcr { using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::script; using namespace ::com::sun::star::lang; @@ -78,19 +78,19 @@ namespace pcr return; // remove all old property change listeners - std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > removeListener = m_aPropertyListeners.createIterator(); - std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > readdListener = m_aPropertyListeners.createIterator(); // will copy the container as needed - while ( removeListener->hasMoreElements() ) - removePropertyChangeListener( static_cast< XPropertyChangeListener* >( removeListener->next() ) ); - OSL_ENSURE( m_aPropertyListeners.empty(), "PropertyHandler::inspect: derived classes are expected to forward the removePropertyChangeListener call to their base class (me)!" ); + ::comphelper::OInterfaceIteratorHelper3 removeListener(m_aPropertyListeners); + ::comphelper::OInterfaceIteratorHelper3 readdListener(m_aPropertyListeners); // will copy the container as needed + while ( removeListener.hasMoreElements() ) + removePropertyChangeListener( removeListener.next() ); + OSL_ENSURE( m_aPropertyListeners.getLength() == 0, "PropertyHandler::inspect: derived classes are expected to forward the removePropertyChangeListener call to their base class (me)!" ); // remember the new component, and give derived classes the chance to react on it m_xComponent = xNewComponent; onNewComponent(); // add the listeners, again - while ( readdListener->hasMoreElements() ) - addPropertyChangeListener( static_cast< XPropertyChangeListener* >( readdListener->next() ) ); + while ( readdListener.hasMoreElements() ) + addPropertyChangeListener( readdListener.next() ); } void PropertyHandler::onNewComponent() @@ -163,7 +163,7 @@ namespace pcr ::rtl::Reference< IPropertyEnumRepresentation > aEnumConversion( new DefaultEnumRepresentation( *m_pInfoService, _rPropertyValue.getValueType(), nPropId ) ); // TODO/UNOize: cache those converters? - return makeAny( aEnumConversion->getDescriptionForValue( _rPropertyValue ) ); + return Any( aEnumConversion->getDescriptionForValue( _rPropertyValue ) ); } return PropertyHandlerHelper::convertToControlValue( @@ -227,13 +227,13 @@ namespace pcr ::osl::MutexGuard aGuard( m_aMutex ); if ( !_rxListener.is() ) throw NullPointerException(); - m_aPropertyListeners.addListener( _rxListener ); + m_aPropertyListeners.addInterface( _rxListener ); } void SAL_CALL PropertyHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) { ::osl::MutexGuard aGuard( m_aMutex ); - m_aPropertyListeners.removeListener( _rxListener ); + m_aPropertyListeners.removeInterface( _rxListener ); } sal_Bool SAL_CALL PropertyHandler::suspend( sal_Bool /*_bSuspend*/ ) @@ -241,7 +241,22 @@ namespace pcr return true; } - IMPLEMENT_FORWARD_XCOMPONENT( PropertyHandler, PropertyHandler_Base ) + void SAL_CALL PropertyHandler::dispose( ) + { + PropertyHandler_Base::WeakComponentImplHelperBase::dispose(); + m_xComponent.clear(); + m_xComponentPropertyInfo.clear(); + m_xTypeConverter.clear(); + } + void SAL_CALL PropertyHandler::addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) + { + PropertyHandler_Base::WeakComponentImplHelperBase::addEventListener( Listener ); + } + void SAL_CALL PropertyHandler::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) + { + PropertyHandler_Base::WeakComponentImplHelperBase::removeEventListener( Listener ); + } + void SAL_CALL PropertyHandler::disposing() { @@ -259,7 +274,7 @@ namespace pcr aEvent.PropertyName = _rPropName; aEvent.OldValue = _rOldValue; aEvent.NewValue = _rNewValue; - m_aPropertyListeners.notify( aEvent, &XPropertyChangeListener::propertyChange ); + m_aPropertyListeners.notifyEach( &XPropertyChangeListener::propertyChange, aEvent ); } const Property* PropertyHandler::impl_getPropertyFromId_nothrow( PropertyId _nPropId ) const diff --git a/extensions/source/propctrlr/propertyhandler.hxx b/extensions/source/propctrlr/propertyhandler.hxx index 21a59303cc27..3491a89be338 100644 --- a/extensions/source/propctrlr/propertyhandler.hxx +++ b/extensions/source/propctrlr/propertyhandler.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYHANDLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYHANDLER_HXX +#pragma once #include "pcrcommon.hxx" @@ -50,7 +49,6 @@ namespace com::sun::star { } } -namespace vcl { class Window; } namespace weld { class Window; } namespace pcr @@ -368,6 +366,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYHANDLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertyinfo.hxx b/extensions/source/propctrlr/propertyinfo.hxx index ff6a83dc03b4..592557c2a315 100644 --- a/extensions/source/propctrlr/propertyinfo.hxx +++ b/extensions/source/propctrlr/propertyinfo.hxx @@ -17,12 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYINFO_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYINFO_HXX +#pragma once #include <sal/types.h> #include <rtl/ustring.hxx> -#include <rtl/string.hxx> #include <vector> @@ -37,7 +35,7 @@ namespace pcr public: virtual sal_Int32 getPropertyId(const OUString& _rName) const = 0; virtual OUString getPropertyTranslation(sal_Int32 _nId) const = 0; - virtual OString getPropertyHelpId(sal_Int32 _nId) const = 0; + virtual OUString getPropertyHelpId(sal_Int32 _nId) const = 0; virtual sal_Int16 getPropertyPos(sal_Int32 _nId) const = 0; virtual sal_uInt32 getPropertyUIFlags(sal_Int32 _nId) const = 0; virtual std::vector< OUString > getPropertyEnumRepresentations(sal_Int32 _nId) const = 0; @@ -49,6 +47,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYINFO_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propeventtranslation.hxx b/extensions/source/propctrlr/propeventtranslation.hxx index cddedaa080a6..43155b8c67f9 100644 --- a/extensions/source/propctrlr/propeventtranslation.hxx +++ b/extensions/source/propctrlr/propeventtranslation.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPEVENTTRANSLATION_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPEVENTTRANSLATION_HXX +#pragma once #include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <cppuhelper/implbase.hxx> @@ -68,6 +67,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPEVENTTRANSLATION_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/proplinelistener.hxx b/extensions/source/propctrlr/proplinelistener.hxx index f0558b8735c0..6931a1f33b17 100644 --- a/extensions/source/propctrlr/proplinelistener.hxx +++ b/extensions/source/propctrlr/proplinelistener.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPLINELISTENER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPLINELISTENER_HXX +#pragma once #include <rtl/ustring.hxx> #include <com/sun/star/uno/Any.hxx> @@ -41,6 +40,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPLINELISTENER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pushbuttonnavigation.cxx b/extensions/source/propctrlr/pushbuttonnavigation.cxx index 3d1bf748c712..130cf322d15d 100644 --- a/extensions/source/propctrlr/pushbuttonnavigation.cxx +++ b/extensions/source/propctrlr/pushbuttonnavigation.cxx @@ -22,8 +22,9 @@ #include "formstrings.hxx" #include <comphelper/extract.hxx> #include <comphelper/property.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr @@ -53,12 +54,12 @@ namespace pcr nullptr }; - sal_Int32 lcl_getNavigationURLIndex( const OUString& _rNavURL ) + sal_Int32 lcl_getNavigationURLIndex( std::u16string_view _rNavURL ) { const char** pLookup = pNavigationURLs; while ( *pLookup ) { - if ( _rNavURL.equalsAscii( *pLookup ) ) + if ( o3tl::equalsAscii( _rNavURL, *pLookup ) ) return pLookup - pNavigationURLs; ++pLookup; } @@ -157,8 +158,8 @@ namespace pcr nButtonType = sal_Int32(FormButtonType_URL); } - m_xControlModel->setPropertyValue( PROPERTY_BUTTONTYPE, makeAny( static_cast< FormButtonType >( nButtonType ) ) ); - m_xControlModel->setPropertyValue( PROPERTY_TARGET_URL, makeAny( sTargetURL ) ); + m_xControlModel->setPropertyValue( PROPERTY_BUTTONTYPE, Any( static_cast< FormButtonType >( nButtonType ) ) ); + m_xControlModel->setPropertyValue( PROPERTY_TARGET_URL, Any( sTargetURL ) ); } catch( const Exception& ) { diff --git a/extensions/source/propctrlr/pushbuttonnavigation.hxx b/extensions/source/propctrlr/pushbuttonnavigation.hxx index 1b93c1475288..7248fb27d4bf 100644 --- a/extensions/source/propctrlr/pushbuttonnavigation.hxx +++ b/extensions/source/propctrlr/pushbuttonnavigation.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PUSHBUTTONNAVIGATION_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PUSHBUTTONNAVIGATION_HXX +#pragma once #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyState.hpp> @@ -96,6 +95,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PUSHBUTTONNAVIGATION_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/selectlabeldialog.cxx b/extensions/source/propctrlr/selectlabeldialog.cxx index 9cefcb72b273..706e6eb3c807 100644 --- a/extensions/source/propctrlr/selectlabeldialog.cxx +++ b/extensions/source/propctrlr/selectlabeldialog.cxx @@ -19,8 +19,6 @@ #include <sal/config.h> -#include <string_view> - #include "selectlabeldialog.hxx" #include <strings.hrc> #include <bitmaps.hlst> @@ -37,7 +35,6 @@ #include <comphelper/types.hxx> #include <sal/log.hxx> #include <tools/debug.hxx> -#include <rtl/ustrbuf.hxx> namespace pcr @@ -73,7 +70,7 @@ namespace pcr nClassID = ::comphelper::getINT16(m_xControlModel->getPropertyValue(PROPERTY_CLASSID)); sDescription = sDescription.replaceAll("$controlclass$", - GetUIHeadlineName(nClassID, makeAny(m_xControlModel))); + GetUIHeadlineName(nClassID, Any(m_xControlModel))); OUString sName = ::comphelper::getString(m_xControlModel->getPropertyValue(PROPERTY_NAME)); sDescription = sDescription.replaceAll("$controlname$", sName); m_xMainDesc->set_label(sDescription); @@ -95,8 +92,8 @@ namespace pcr // check which service the allowed components must support sal_Int16 nClassId = 0; try { nClassId = ::comphelper::getINT16(m_xControlModel->getPropertyValue(PROPERTY_CLASSID)); } catch(...) { } - m_sRequiredService = (FormComponentType::RADIOBUTTON == nClassId) ? std::u16string_view(u"" SERVICE_COMPONENT_GROUPBOX) : std::u16string_view(u"" SERVICE_COMPONENT_FIXEDTEXT); - m_aRequiredControlImage = (FormComponentType::RADIOBUTTON == nClassId) ? OUStringLiteral(u"" RID_EXTBMP_GROUPBOX) : OUStringLiteral(u"" RID_EXTBMP_FIXEDTEXT); + m_sRequiredService = (FormComponentType::RADIOBUTTON == nClassId) ? SERVICE_COMPONENT_GROUPBOX : SERVICE_COMPONENT_FIXEDTEXT; + m_aRequiredControlImage = (FormComponentType::RADIOBUTTON == nClassId) ? RID_EXTBMP_GROUPBOX : RID_EXTBMP_FIXEDTEXT; // calc the currently set label control (so InsertEntries can calc m_xInitialSelection) Any aCurrentLabelControl( m_xControlModel->getPropertyValue(PROPERTY_CONTROLLABEL) ); @@ -149,7 +146,7 @@ namespace pcr { } - sal_Int32 OSelectLabelDialog::InsertEntries(const Reference< XInterface > & _xContainer, weld::TreeIter& rContainerEntry) + sal_Int32 OSelectLabelDialog::InsertEntries(const Reference< XInterface > & _xContainer, const weld::TreeIter& rContainerEntry) { Reference< XIndexAccess > xContainer(_xContainer, UNO_QUERY); if (!xContainer.is()) @@ -205,14 +202,13 @@ namespace pcr if (!::comphelper::hasProperty(PROPERTY_LABEL, xAsSet)) continue; - OUString sDisplayName = OUStringBuffer( - ::comphelper::getString(xAsSet->getPropertyValue(PROPERTY_LABEL))). - append(" (").append(sName).append(')'). - makeStringAndClear(); + OUString sDisplayName = + ::comphelper::getString(xAsSet->getPropertyValue(PROPERTY_LABEL)) + + " (" + sName + ")"; // all requirements met -> insert m_xUserData.emplace_back(new Reference<XPropertySet>(xAsSet)); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_xUserData.back().get()))); + OUString sId(weld::toId(m_xUserData.back().get())); m_xControlTree->insert(&rContainerEntry, -1, &sDisplayName, &sId, nullptr, nullptr, false, m_xScratchIter.get()); m_xControlTree->set_image(*m_xScratchIter, m_aRequiredControlImage); @@ -236,11 +232,11 @@ namespace pcr bool bSelected = m_xControlTree->get_selected(xIter.get()); OUString sData = bSelected ? m_xControlTree->get_id(*xIter) : OUString(); if (!sData.isEmpty()) - m_xSelectedControl.set(*reinterpret_cast<Reference<XPropertySet>*>(sData.toInt64())); + m_xSelectedControl.set(*weld::fromId<Reference<XPropertySet>*>(sData)); m_xNoAssignment->set_active(sData.isEmpty()); } - IMPL_LINK(OSelectLabelDialog, OnNoAssignmentClicked, weld::ToggleButton&, rButton, void) + IMPL_LINK(OSelectLabelDialog, OnNoAssignmentClicked, weld::Toggleable&, rButton, void) { DBG_ASSERT(&rButton == m_xNoAssignment.get(), "OSelectLabelDialog::OnNoAssignmentClicked : where did this come from ?"); diff --git a/extensions/source/propctrlr/selectlabeldialog.hxx b/extensions/source/propctrlr/selectlabeldialog.hxx index 217ac30209cd..9affa3512aa1 100644 --- a/extensions/source/propctrlr/selectlabeldialog.hxx +++ b/extensions/source/propctrlr/selectlabeldialog.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SELECTLABELDIALOG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SELECTLABELDIALOG_HXX +#pragma once #include <vcl/weld.hxx> #include <com/sun/star/beans/XPropertySet.hpp> @@ -53,13 +52,11 @@ namespace pcr css::uno::Reference< css::beans::XPropertySet > GetSelected() const { return m_xNoAssignment->get_active() ? css::uno::Reference< css::beans::XPropertySet > () : m_xSelectedControl; } private: - sal_Int32 InsertEntries(const css::uno::Reference< css::uno::XInterface >& _xContainer, weld::TreeIter& rContainerEntry); + sal_Int32 InsertEntries(const css::uno::Reference< css::uno::XInterface >& _xContainer, const weld::TreeIter& rContainerEntry); DECL_LINK(OnEntrySelected, weld::TreeView&, void); - DECL_LINK(OnNoAssignmentClicked, weld::ToggleButton&, void); + DECL_LINK(OnNoAssignmentClicked, weld::Toggleable&, void); }; } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SELECTLABELDIALOG_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/sqlcommanddesign.cxx b/extensions/source/propctrlr/sqlcommanddesign.cxx index c5bd8a34c749..d98b2a569234 100644 --- a/extensions/source/propctrlr/sqlcommanddesign.cxx +++ b/extensions/source/propctrlr/sqlcommanddesign.cxx @@ -37,7 +37,9 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/sdb/CommandType.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/propertyvalue.hxx> +#include <utility> +#include <comphelper/diagnose_ex.hxx> #include <osl/diagnose.h> @@ -89,9 +91,9 @@ namespace pcr SQLCommandDesigner::SQLCommandDesigner( const Reference< XComponentContext >& _rxContext, const ::rtl::Reference< ISQLCommandAdapter >& _rxPropertyAdapter, - const ::dbtools::SharedConnection& _rConnection, const Link<SQLCommandDesigner&,void>& _rCloseLink ) + ::dbtools::SharedConnection _aConnection, const Link<SQLCommandDesigner&,void>& _rCloseLink ) :m_xContext( _rxContext ) - ,m_xConnection( _rConnection ) + ,m_xConnection(std::move( _aConnection )) ,m_xObjectAdapter( _rxPropertyAdapter ) ,m_aCloseLink( _rCloseLink ) { @@ -161,6 +163,8 @@ namespace pcr m_xConnection.clear(); m_xContext.clear(); m_xORB.clear(); + m_xDesigner.clear(); + m_xObjectAdapter.clear(); } @@ -221,19 +225,14 @@ namespace pcr // thus, we create a blank frame at the desktop, remove it from the desktop's frame list // immediately, and then load the component into this blank (and now parent-less) frame Reference< XComponentLoader > xLoader( impl_createEmptyParentlessTask_nothrow(), UNO_QUERY_THROW ); - Sequence< PropertyValue > aArgs( 5 ); - aArgs[0].Name = PROPERTY_ACTIVE_CONNECTION; - aArgs[0].Value <<= m_xConnection.getTyped(); - - aArgs[1].Name = PROPERTY_COMMAND; - aArgs[1].Value <<= m_xObjectAdapter->getSQLCommand(); - aArgs[2].Name = PROPERTY_COMMANDTYPE; - aArgs[2].Value <<= sal_Int32(CommandType::COMMAND); - aArgs[3].Name = PROPERTY_ESCAPE_PROCESSING; - aArgs[3].Value <<= m_xObjectAdapter->getEscapeProcessing(); - - aArgs[4].Name = "GraphicalDesign"; - aArgs[4].Value <<= m_xObjectAdapter->getEscapeProcessing(); + const bool bEscapeProcessing = m_xObjectAdapter->getEscapeProcessing(); + Sequence< PropertyValue > aArgs{ + comphelper::makePropertyValue(PROPERTY_ACTIVE_CONNECTION, m_xConnection.getTyped()), + comphelper::makePropertyValue(PROPERTY_COMMAND, m_xObjectAdapter->getSQLCommand()), + comphelper::makePropertyValue(PROPERTY_COMMANDTYPE, CommandType::COMMAND), + comphelper::makePropertyValue(PROPERTY_ESCAPE_PROCESSING, bEscapeProcessing), + comphelper::makePropertyValue("GraphicalDesign", bEscapeProcessing) + }; Reference< XComponent > xQueryDesign = xLoader->loadComponentFromURL( ".component:DB/QueryDesign", diff --git a/extensions/source/propctrlr/sqlcommanddesign.hxx b/extensions/source/propctrlr/sqlcommanddesign.hxx index 5048f183a0aa..767506eca7bf 100644 --- a/extensions/source/propctrlr/sqlcommanddesign.hxx +++ b/extensions/source/propctrlr/sqlcommanddesign.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SQLCOMMANDDESIGN_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SQLCOMMANDDESIGN_HXX +#pragma once #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/beans/XPropertyChangeListener.hpp> @@ -73,7 +72,7 @@ namespace pcr SQLCommandDesigner( const css::uno::Reference< css::uno::XComponentContext >& _rxContext, const ::rtl::Reference< ISQLCommandAdapter >& _rxPropertyAdapter, - const ::dbtools::SharedConnection& _rConnection, + ::dbtools::SharedConnection _aConnection, const Link<SQLCommandDesigner&,void>& _rCloseLink ); @@ -191,6 +190,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SQLCOMMANDDESIGN_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index c20f6287fe8d..ad978253b076 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -38,6 +38,7 @@ #include <tools/datetime.hxx> #include <unotools/datetime.hxx> +#include <o3tl/string_view.hxx> #include <limits> #include <memory> @@ -90,9 +91,31 @@ namespace pcr } //= ODateControl - ODateControl::ODateControl(std::unique_ptr<SvtCalendarBox> xWidget, std::unique_ptr<weld::Builder> xBuilder, bool bReadOnly) + ODateControl::ODateControl(std::unique_ptr<weld::Container> xWidget, std::unique_ptr<weld::Builder> xBuilder, bool bReadOnly) : ODateControl_Base(PropertyControlType::DateField, std::move(xBuilder), std::move(xWidget), bReadOnly) + , m_xEntry(m_xBuilder->weld_entry("entry")) + , m_xCalendarBox(std::make_unique<SvtCalendarBox>(m_xBuilder->weld_menu_button("button"), false)) { + m_xEntryFormatter.reset(new weld::DateFormatter(*m_xEntry)); + + m_xEntryFormatter->SetStrictFormat(true); + m_xEntryFormatter->SetMin(::Date(1, 1, 1600)); + m_xEntryFormatter->SetMax(::Date(1, 1, 9999)); + + m_xEntryFormatter->SetExtDateFormat(ExtDateFieldFormat::SystemShortYYYY); + m_xEntryFormatter->EnableEmptyField(true); + + m_xCalendarBox->connect_activated(LINK(this, ODateControl, ActivateHdl)); + + m_xCalendarBox->get_button().connect_toggled(LINK(this, ODateControl, ToggleHdl)); + } + + void SAL_CALL ODateControl::disposing() + { + m_xEntryFormatter.reset(); + m_xEntry.reset(); + m_xCalendarBox.reset(); + ODateControl_Base::disposing(); } void SAL_CALL ODateControl::setValue( const Any& _rValue ) @@ -100,21 +123,43 @@ namespace pcr util::Date aUNODate; if ( !( _rValue >>= aUNODate ) ) { - getTypedControlWindow()->set_date(::Date(::Date::SYSTEM)); + m_xEntry->set_text(OUString()); } else { ::Date aDate( aUNODate.Day, aUNODate.Month, aUNODate.Year ); - getTypedControlWindow()->set_date(aDate); + m_xEntryFormatter->SetDate(aDate); } } + IMPL_LINK_NOARG(ODateControl, ActivateHdl, SvtCalendarBox&, void) + { + m_xEntryFormatter->SetDate(m_xCalendarBox->get_date()); + setModified(); + m_xEntry->grab_focus(); + } + + IMPL_LINK(ODateControl, ToggleHdl, weld::Toggleable&, rToggle, void) + { + if (!rToggle.get_active()) + return; + ::Date aDate = m_xEntryFormatter->GetDate(); + if (aDate.IsEmpty()) + { + // with an empty date preselect today in the calendar + aDate = ::Date(::Date::SYSTEM); + } + m_xCalendarBox->set_date(aDate); + } + Any SAL_CALL ODateControl::getValue() { Any aPropValue; - ::Date aDate(getTypedControlWindow()->get_date()); - if (!aDate.IsEmpty()) + if (!m_xEntry->get_text().isEmpty()) + { + ::Date aDate(m_xEntryFormatter->GetDate()); aPropValue <<= aDate.GetUNODate(); + } return aPropValue; } @@ -185,18 +230,16 @@ namespace pcr notifyModifiedValue(); } - static int ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) + static sal_Int64 ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) { double n = nValue; for ( sal_uInt16 d = 0; d < nDigits; ++d ) n *= 10; - if ( !o3tl::convertsToAtMost(n, std::numeric_limits<int>::max()) ) - return std::numeric_limits<int>::max(); - return static_cast<int>(n); + return o3tl::saturating_cast<sal_Int64>(n); } - static double ImplCalcDoubleValue( int nValue, sal_uInt16 nDigits ) + static double ImplCalcDoubleValue(sal_Int64 nValue, sal_uInt16 nDigits ) { double n = nValue; for ( sal_uInt16 d = 0; d < nDigits; ++d ) @@ -271,7 +314,7 @@ namespace pcr Any SAL_CALL OHyperlinkControl::getValue() { OUString sText = m_xEntry->get_text(); - return makeAny( sText ); + return Any( sText ); } void SAL_CALL OHyperlinkControl::setValue( const Any& _value ) @@ -334,7 +377,7 @@ namespace pcr void SAL_CALL ONumericControl::setDecimalDigits( ::sal_Int16 decimaldigits ) { weld::MetricSpinButton* pControlWindow = getTypedControlWindow(); - int min, max; + sal_Int64 min, max; pControlWindow->get_range(min, max, FieldUnit::NONE); pControlWindow->set_digits(decimaldigits); pControlWindow->set_range(min, max, FieldUnit::NONE); @@ -344,8 +387,8 @@ namespace pcr { Optional< double > aReturn( true, 0 ); - int minValue = getTypedControlWindow()->get_min(FieldUnit::NONE); - if ( minValue == std::numeric_limits<int>::min() ) + sal_Int64 minValue = getTypedControlWindow()->get_min(FieldUnit::NONE); + if ( minValue == std::numeric_limits<sal_Int64>::min() ) aReturn.IsPresent = false; else aReturn.Value = static_cast<double>(minValue); @@ -356,7 +399,7 @@ namespace pcr void SAL_CALL ONumericControl::setMinValue( const Optional< double >& _minvalue ) { if ( !_minvalue.IsPresent ) - getTypedControlWindow()->set_min( std::numeric_limits<int>::min(), FieldUnit::NONE ); + getTypedControlWindow()->set_min( std::numeric_limits<sal_Int64>::min(), FieldUnit::NONE ); else getTypedControlWindow()->set_min( impl_apiValueToFieldValue_nothrow( _minvalue.Value ) , m_eValueUnit); } @@ -365,8 +408,8 @@ namespace pcr { Optional< double > aReturn( true, 0 ); - int maxValue = getTypedControlWindow()->get_max(FieldUnit::NONE); - if ( maxValue == std::numeric_limits<int>::max() ) + sal_Int64 maxValue = getTypedControlWindow()->get_max(FieldUnit::NONE); + if ( maxValue == std::numeric_limits<sal_Int64>::max() ) aReturn.IsPresent = false; else aReturn.Value = static_cast<double>(maxValue); @@ -377,7 +420,7 @@ namespace pcr void SAL_CALL ONumericControl::setMaxValue( const Optional< double >& _maxvalue ) { if ( !_maxvalue.IsPresent ) - getTypedControlWindow()->set_max( std::numeric_limits<int>::max(), FieldUnit::NONE ); + getTypedControlWindow()->set_max( std::numeric_limits<sal_Int64>::max(), FieldUnit::NONE ); else getTypedControlWindow()->set_max( impl_apiValueToFieldValue_nothrow( _maxvalue.Value ), m_eValueUnit ); } @@ -436,14 +479,14 @@ namespace pcr } } - int ONumericControl::impl_apiValueToFieldValue_nothrow( double _nApiValue ) const + sal_Int64 ONumericControl::impl_apiValueToFieldValue_nothrow( double _nApiValue ) const { - int nControlValue = ImplCalcLongValue( _nApiValue, getTypedControlWindow()->get_digits() ); + sal_Int64 nControlValue = ImplCalcLongValue( _nApiValue, getTypedControlWindow()->get_digits() ); nControlValue /= m_nFieldToUNOValueFactor; return nControlValue; } - double ONumericControl::impl_fieldValueToApiValue_nothrow( int nFieldValue ) const + double ONumericControl::impl_fieldValueToApiValue_nothrow(sal_Int64 nFieldValue) const { double nApiValue = ImplCalcDoubleValue( nFieldValue, getTypedControlWindow()->get_digits() ); nApiValue *= m_nFieldToUNOValueFactor; @@ -456,7 +499,8 @@ namespace pcr if ( !getTypedControlWindow()->get_text().isEmpty() ) { double nValue = impl_fieldValueToApiValue_nothrow( getTypedControlWindow()->get_value( m_eValueUnit ) ); - aPropValue <<= nValue; + if (nValue) + aPropValue <<= nValue; } return aPropValue; } @@ -595,7 +639,7 @@ namespace pcr Any SAL_CALL OComboboxControl::getValue() { - return makeAny( getTypedControlWindow()->get_active_text() ); + return Any( getTypedControlWindow()->get_active_text() ); } Type SAL_CALL OComboboxControl::getValueType() @@ -638,7 +682,7 @@ namespace pcr namespace { - StlSyntaxSequence< OUString > lcl_convertMultiLineToList( const OUString& _rCompsedTextWithLineBreaks ) + StlSyntaxSequence< OUString > lcl_convertMultiLineToList( std::u16string_view _rCompsedTextWithLineBreaks ) { sal_Int32 nLines = comphelper::string::getTokenCount(_rCompsedTextWithLineBreaks, '\n'); StlSyntaxSequence< OUString > aStrings( nLines ); @@ -648,7 +692,7 @@ namespace pcr sal_Int32 nIdx {0}; do { - *stringItem = _rCompsedTextWithLineBreaks.getToken( 0, '\n', nIdx ); + *stringItem = o3tl::getToken(_rCompsedTextWithLineBreaks, 0, '\n', nIdx ); ++stringItem; } while (nIdx>0); @@ -681,9 +725,7 @@ namespace pcr { if ( strings != _rStrings.begin() ) aComposed.append( ';' ); - aComposed.append( '\"' ); - aComposed.append( *strings ); - aComposed.append( '\"' ); + aComposed.append( "\"" + *strings + "\"" ); } return aComposed.makeStringAndClear(); } @@ -741,7 +783,16 @@ namespace pcr IMPL_LINK_NOARG(OMultilineEditControl, TextViewModifiedHdl, weld::TextView&, void) { - m_xEntry->set_text(m_xTextView->get_text()); + // tdf#139070 during editing update the entry to look like how it will + // look once editing is finished so that the default behaviour of vcl + // to strip newlines and the default behaviour of gtk to show a newline + // symbol is suppressed + OUString sText = m_xTextView->get_text(); + auto aSeq = lcl_convertMultiLineToList(sText); + if (aSeq.getLength() > 1) + m_xEntry->set_text(lcl_convertListToDisplayText(aSeq)); + else + m_xEntry->set_text(sText); CheckEntryTextViewMisMatch(); setModified(); } diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx index ead1f26bfb6e..fcd194886a1a 100644 --- a/extensions/source/propctrlr/standardcontrol.hxx +++ b/extensions/source/propctrlr/standardcontrol.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_STANDARDCONTROL_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_STANDARDCONTROL_HXX +#pragma once #include "commoncontrol.hxx" #include "pcrcommon.hxx" @@ -27,6 +26,7 @@ #include <com/sun/star/inspection/XStringListControl.hpp> #include <com/sun/star/inspection/XHyperlinkControl.hpp> #include <com/sun/star/uno/Sequence.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <svtools/ctrlbox.hxx> #include <svx/colorbox.hxx> @@ -61,11 +61,18 @@ namespace pcr }; //= ODateControl - typedef CommonBehaviourControl<css::inspection::XPropertyControl, SvtCalendarBox> ODateControl_Base; + typedef CommonBehaviourControl<css::inspection::XPropertyControl, weld::Container> ODateControl_Base; class ODateControl : public ODateControl_Base { + std::unique_ptr<weld::Entry> m_xEntry; + std::unique_ptr<SvtCalendarBox> m_xCalendarBox; + std::unique_ptr<weld::DateFormatter> m_xEntryFormatter; + + DECL_LINK(ActivateHdl, SvtCalendarBox&, void); + DECL_LINK(ToggleHdl, weld::Toggleable&, void); + public: - ODateControl(std::unique_ptr<SvtCalendarBox> xWidget, std::unique_ptr<weld::Builder> xBuilder, bool bReadOnly); + ODateControl(std::unique_ptr<weld::Container> xWidget, std::unique_ptr<weld::Builder> xBuilder, bool bReadOnly); // XPropertyControl virtual css::uno::Any SAL_CALL getValue() override; @@ -75,10 +82,18 @@ namespace pcr virtual void SetModifyHandler() override { ODateControl_Base::SetModifyHandler(); - getTypedControlWindow()->connect_selected( LINK( this, CommonBehaviourControlHelper, DateModifiedHdl ) ); + + m_xEntry->connect_focus_in( LINK( this, CommonBehaviourControlHelper, GetFocusHdl ) ); + m_xEntryFormatter->connect_focus_out( LINK( this, CommonBehaviourControlHelper, LoseFocusHdl ) ); + m_xCalendarBox->connect_focus_in( LINK( this, CommonBehaviourControlHelper, GetFocusHdl ) ); + m_xCalendarBox->connect_focus_out( LINK( this, CommonBehaviourControlHelper, LoseFocusHdl ) ); + + m_xEntryFormatter->connect_changed(LINK(this, CommonBehaviourControlHelper, EditModifiedHdl)); } - virtual weld::Widget* getWidget() override { return &getTypedControlWindow()->get_button(); } + virtual void SAL_CALL disposing() override; + + virtual weld::Widget* getWidget() override { return getTypedControlWindow(); } }; //= OEditControl @@ -218,7 +233,9 @@ namespace pcr virtual void SetModifyHandler() override { ONumericControl_Base::SetModifyHandler(); - getTypedControlWindow()->connect_value_changed( LINK( this, CommonBehaviourControlHelper, MetricModifiedHdl ) ); + weld::MetricSpinButton* pSpinButton = getTypedControlWindow(); + pSpinButton->connect_value_changed( LINK( this, CommonBehaviourControlHelper, MetricModifiedHdl ) ); + pSpinButton->get_widget().connect_changed( LINK( this, CommonBehaviourControlHelper, EditModifiedHdl ) ); } private: @@ -229,12 +246,12 @@ namespace pcr The conversion respects our decimal digits as well as our value factor (<member>m_nFieldToUNOValueFactor</member>). */ - int impl_apiValueToFieldValue_nothrow( double nApiValue ) const; + sal_Int64 impl_apiValueToFieldValue_nothrow( double nApiValue ) const; /** converts a control value, as obtained from our Numeric field, into a value which can passed to outer callers via our UNO API. */ - double impl_fieldValueToApiValue_nothrow( int nFieldValue ) const; + double impl_fieldValueToApiValue_nothrow(sal_Int64 nFieldValue) const; }; //= OColorControl @@ -392,6 +409,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_STANDARDCONTROL_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx index 3e28295d7348..6f40c09c9d84 100644 --- a/extensions/source/propctrlr/stringrepresentation.cxx +++ b/extensions/source/propctrlr/stringrepresentation.cxx @@ -37,8 +37,10 @@ #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> #include <sal/log.hxx> +#include <utility> #include <yesno.hrc> #include <comphelper/types.hxx> +#include <o3tl/string_view.hxx> #include "modulepcr.hxx" #include <algorithm> @@ -57,7 +59,7 @@ class StringRepresentation: lang::XInitialization> { public: - explicit StringRepresentation(uno::Reference< uno::XComponentContext > const & context); + explicit StringRepresentation(uno::Reference< uno::XComponentContext > context); StringRepresentation (const StringRepresentation&) = delete; StringRepresentation& operator=(const StringRepresentation&) = delete; @@ -127,8 +129,8 @@ private: } -StringRepresentation::StringRepresentation(uno::Reference< uno::XComponentContext > const & context) : - m_xContext(context) +StringRepresentation::StringRepresentation(uno::Reference< uno::XComponentContext > context) : + m_xContext(std::move(context)) {} // com.sun.star.uno.XServiceInfo: @@ -255,7 +257,8 @@ void SAL_CALL StringRepresentation::initialize(const uno::Sequence< uno::Any > & uno::Sequence< uno::Reference< reflection::XConstantTypeDescription > > cs(m_xTypeDescription->getConstants()); - std::sort(cs.begin(), cs.end(), CompareConstants()); + auto [begin, end] = asNonConstRange(cs); + std::sort(begin, end, CompareConstants()); m_aConstants = cs; } @@ -303,9 +306,9 @@ namespace { return OUString::number( _rIntValue ); } - sal_Int32 operator()( const OUString& _rStringValue ) const + sal_Int32 operator()( std::u16string_view _rStringValue ) const { - return _rStringValue.toInt32(); + return o3tl::toInt32(_rStringValue); } }; @@ -326,8 +329,7 @@ namespace // (separated by a line break) for (const auto& rElement : _rElements) { - sCompose.append(OUString(_rTransformer(rElement))); - sCompose.append("\n"); + sCompose.append(OUString(_rTransformer(rElement)) + "\n"); } sCompose.stripEnd('\n'); @@ -335,16 +337,16 @@ namespace } template < class ElementType, class Transformer > - void splitComposedStringToSequence( const OUString& _rComposed, Sequence< ElementType >& _out_SplitUp, const Transformer& _rTransformer ) + void splitComposedStringToSequence( std::u16string_view _rComposed, Sequence< ElementType >& _out_SplitUp, const Transformer& _rTransformer ) { _out_SplitUp.realloc( 0 ); - if ( _rComposed.isEmpty() ) + if ( _rComposed.empty() ) return; sal_Int32 tokenPos = 0; do { _out_SplitUp.realloc( _out_SplitUp.getLength() + 1 ); - _out_SplitUp[ _out_SplitUp.getLength() - 1 ] = static_cast<ElementType>(_rTransformer( _rComposed.getToken( 0, '\n', tokenPos ) )); + _out_SplitUp.getArray()[ _out_SplitUp.getLength() - 1 ] = static_cast<ElementType>(_rTransformer( OUString(o3tl::getToken(_rComposed, 0, '\n', tokenPos )) )); } while ( tokenPos != -1 ); } @@ -415,10 +417,6 @@ bool StringRepresentation::convertGenericValueToString( const uno::Any& _rValue, } break; case uno::TypeClass_CONSTANT: - { - int i = 0; - ++i; - } break; // some structs @@ -481,7 +479,7 @@ uno::Any StringRepresentation::convertStringToSimple( const OUString& _rValue,co } if ( !aReturn.hasValue() ) - aReturn = m_xTypeConverter->convertToSimpleType( makeAny( _rValue ), _ePropertyType ); + aReturn = m_xTypeConverter->convertToSimpleType( Any( _rValue ), _ePropertyType ); } catch( const script::CannotConvertException& ) { } catch( const lang::IllegalArgumentException& ) { } diff --git a/extensions/source/propctrlr/submissionhandler.cxx b/extensions/source/propctrlr/submissionhandler.cxx index 66aeddecc19f..05e25e4d71a8 100644 --- a/extensions/source/propctrlr/submissionhandler.cxx +++ b/extensions/source/propctrlr/submissionhandler.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/inspection/XObjectInspectorUI.hpp> #include <com/sun/star/lang/NullPointerException.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr @@ -41,10 +41,8 @@ namespace pcr using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; using namespace ::com::sun::star::form; using namespace ::com::sun::star::xforms; - using namespace ::com::sun::star::container; using namespace ::com::sun::star::inspection; @@ -216,10 +214,9 @@ namespace pcr if (!m_pHelper) return Sequence< OUString >(); - Sequence< OUString > aReturn( 3 ); - aReturn[ 0 ] = PROPERTY_TARGET_URL; - aReturn[ 1 ] = PROPERTY_TARGET_FRAME; - aReturn[ 2 ] = PROPERTY_BUTTONTYPE; + Sequence< OUString > aReturn{ PROPERTY_TARGET_URL, + PROPERTY_TARGET_FRAME, + PROPERTY_BUTTONTYPE }; return aReturn; } @@ -295,7 +292,7 @@ namespace pcr } LineDescriptor aDescriptor; - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, true ); + aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, std::move(aListEntries), false, true ); aDescriptor.DisplayName = m_pInfoService->getPropertyTranslation( nPropId ); aDescriptor.Category = "General"; aDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nPropId ) ); diff --git a/extensions/source/propctrlr/submissionhandler.hxx b/extensions/source/propctrlr/submissionhandler.hxx index bfa9c4d06eff..f263041b2134 100644 --- a/extensions/source/propctrlr/submissionhandler.hxx +++ b/extensions/source/propctrlr/submissionhandler.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SUBMISSIONHANDLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SUBMISSIONHANDLER_HXX +#pragma once #include <memory> #include "propertyhandler.hxx" @@ -108,6 +107,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SUBMISSIONHANDLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx index d41018a833b3..af7b9ced7480 100644 --- a/extensions/source/propctrlr/taborder.cxx +++ b/extensions/source/propctrlr/taborder.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/form/runtime/FormController.hpp> #include <osl/diagnose.h> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr { @@ -180,7 +180,7 @@ namespace pcr aName = ::comphelper::getString( xControl->getPropertyValue( PROPERTY_NAME ) ); // TODO: do Basic controls have a name? aImage = GetImage( xControl ); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(xControl.get()))); + OUString sId(weld::toId(xControl.get())); m_xLB_Controls->append(sId, aName, aImage); } } @@ -243,7 +243,7 @@ namespace pcr for (int i = 0; i < nEntryCount; ++i) { - XPropertySet* pEntry = reinterpret_cast<XPropertySet*>(m_xLB_Controls->get_id(i).toInt64()); + XPropertySet* pEntry = weld::fromId<XPropertySet*>(m_xLB_Controls->get_id(i)); for( auto const& rControlModel : aControlModels ) { Reference< XPropertySet > xSet(rControlModel, UNO_QUERY); diff --git a/extensions/source/propctrlr/taborder.hxx b/extensions/source/propctrlr/taborder.hxx index 4ce5a664943b..e43f010e8282 100644 --- a/extensions/source/propctrlr/taborder.hxx +++ b/extensions/source/propctrlr/taborder.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HXX +#pragma once #include <com/sun/star/awt/XTabControllerModel.hpp> #include <com/sun/star/awt/XControlContainer.hpp> @@ -72,6 +71,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/unourl.cxx b/extensions/source/propctrlr/unourl.cxx index 88c9630129e4..dba37915e647 100644 --- a/extensions/source/propctrlr/unourl.cxx +++ b/extensions/source/propctrlr/unourl.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <comphelper/processfactory.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr diff --git a/extensions/source/propctrlr/unourl.hxx b/extensions/source/propctrlr/unourl.hxx index d85a6935dbad..824c865ea943 100644 --- a/extensions/source/propctrlr/unourl.hxx +++ b/extensions/source/propctrlr/unourl.hxx @@ -16,8 +16,7 @@ * 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_EXTENSIONS_SOURCE_PROPCTRLR_UNOURL_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_UNOURL_HXX +#pragma once #include <rtl/ustring.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -48,6 +47,4 @@ namespace pcr } // namespacepcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_UNOURL_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/usercontrol.cxx b/extensions/source/propctrlr/usercontrol.cxx index 74390e1fcde2..8cccb48e84b5 100644 --- a/extensions/source/propctrlr/usercontrol.cxx +++ b/extensions/source/propctrlr/usercontrol.cxx @@ -24,6 +24,7 @@ #include <vcl/GraphicObject.hxx> #include <vcl/event.hxx> #include <tools/debug.hxx> +#include <svl/numformat.hxx> #include <svl/zformat.hxx> #include <connectivity/dbconversion.hxx> #include "modulepcr.hxx" @@ -241,18 +242,14 @@ namespace pcr { } - void SAL_CALL OFileUrlControl::setValue( const Any& _rValue ) + void SAL_CALL OFileUrlControl::setValue(const Any& rValue) { OUString sURL; - if ( _rValue >>= sURL ) - { - if (GraphicObject::isGraphicObjectUniqueIdURL(sURL)) - getTypedControlWindow()->set_entry_text(getTypedControlWindow()->GetPlaceHolder()); - else - getTypedControlWindow()->set_entry_text(sURL); - } - else - getTypedControlWindow()->set_entry_text( "" ); + SvtURLBox* pControlWindow = getTypedControlWindow(); + bool bSuccess = rValue >>= sURL; + if (bSuccess && GraphicObject::isGraphicObjectUniqueIdURL(sURL)) + sURL = pControlWindow->GetPlaceHolder(); + pControlWindow->set_entry_text(sURL); } Any SAL_CALL OFileUrlControl::getValue() @@ -268,6 +265,11 @@ namespace pcr return ::cppu::UnoType<OUString>::get(); } + IMPL_LINK_NOARG(OFileUrlControl, URLModifiedHdl, weld::ComboBox&, void) + { + editChanged(); + } + } // namespace pcr diff --git a/extensions/source/propctrlr/usercontrol.hxx b/extensions/source/propctrlr/usercontrol.hxx index facc2621707f..86b53e7f122e 100644 --- a/extensions/source/propctrlr/usercontrol.hxx +++ b/extensions/source/propctrlr/usercontrol.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_USERCONTROL_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_USERCONTROL_HXX +#pragma once #include "commoncontrol.hxx" #include <svtools/inettbc.hxx> @@ -119,6 +118,8 @@ namespace pcr typedef CommonBehaviourControl<css::inspection::XPropertyControl, SvtURLBox> OFileUrlControl_Base; class OFileUrlControl : public OFileUrlControl_Base { + private: + DECL_LINK(URLModifiedHdl, weld::ComboBox&, void); public: OFileUrlControl(std::unique_ptr<SvtURLBox> xWidget, std::unique_ptr<weld::Builder> xBuilder, bool bReadOnly); @@ -130,7 +131,10 @@ namespace pcr virtual void SetModifyHandler() override { OFileUrlControl_Base::SetModifyHandler(); - getTypedControlWindow()->connect_changed(LINK(this, CommonBehaviourControlHelper, ModifiedHdl)); + SvtURLBox* pControlWindow = getTypedControlWindow(); + // tdf#140239 and tdf#141084 don't notify that the control has changed content until focus-out + pControlWindow->connect_focus_out(LINK(this, CommonBehaviourControlHelper, LoseFocusHdl)); + pControlWindow->connect_changed(LINK(this, OFileUrlControl, URLModifiedHdl)); } virtual weld::Widget* getWidget() override { return getTypedControlWindow()->getWidget(); } @@ -141,6 +145,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_USERCONTROL_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/xsddatatypes.cxx b/extensions/source/propctrlr/xsddatatypes.cxx index fdaea8e21fc8..25af46895adb 100644 --- a/extensions/source/propctrlr/xsddatatypes.cxx +++ b/extensions/source/propctrlr/xsddatatypes.cxx @@ -24,7 +24,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <tools/debug.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr diff --git a/extensions/source/propctrlr/xsddatatypes.hxx b/extensions/source/propctrlr/xsddatatypes.hxx index aff845cbed95..0413d0250eee 100644 --- a/extensions/source/propctrlr/xsddatatypes.hxx +++ b/extensions/source/propctrlr/xsddatatypes.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_XSDDATATYPES_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_XSDDATATYPES_HXX +#pragma once #include <com/sun/star/uno/Reference.hxx> #include <rtl/ref.hxx> @@ -87,6 +86,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_XSDDATATYPES_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/xsdvalidationhelper.cxx b/extensions/source/propctrlr/xsdvalidationhelper.cxx index 12197e87d0b3..5580a8ec3a4f 100644 --- a/extensions/source/propctrlr/xsdvalidationhelper.cxx +++ b/extensions/source/propctrlr/xsdvalidationhelper.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/xforms/XDataTypeRepository.hpp> #include <unotools/syslocale.hxx> #include <i18nlangtag/languagetag.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr @@ -83,12 +83,13 @@ namespace pcr try { Reference< XDataTypeRepository > xRepository = getDataTypeRepository(); - Sequence< OUString > aElements; if ( xRepository.is() ) - aElements = xRepository->getElementNames(); + { + const Sequence<OUString> aElements = xRepository->getElementNames(); - _rNames.resize( aElements.getLength() ); - std::copy( aElements.begin(), aElements.end(), _rNames.begin() ); + _rNames.resize( aElements.getLength() ); + std::copy( aElements.begin(), aElements.end(), _rNames.begin() ); + } } catch( const Exception& ) { @@ -256,7 +257,7 @@ namespace pcr } catch( const Exception& ) { } // set the new data type name - xBinding->setPropertyValue( PROPERTY_XSD_DATA_TYPE, makeAny( _rName ) ); + xBinding->setPropertyValue( PROPERTY_XSD_DATA_TYPE, Any( _rName ) ); // retrieve the new data type object Reference< XPropertySet > xNewType = getDataType( _rName ); @@ -268,7 +269,7 @@ namespace pcr // fire the change in the Data Type property OUString sNewDataTypeName; OSL_VERIFY( xBinding->getPropertyValue( PROPERTY_XSD_DATA_TYPE ) >>= sNewDataTypeName ); - firePropertyChange( PROPERTY_XSD_DATA_TYPE, makeAny( sOldDataTypeName ), makeAny( sNewDataTypeName ) ); + firePropertyChange( PROPERTY_XSD_DATA_TYPE, Any( sOldDataTypeName ), Any( sNewDataTypeName ) ); } } catch( const Exception& ) @@ -360,7 +361,7 @@ namespace pcr sal_Int32 nDesiredFormat = xFormatTypes->getStandardFormat( nNumberFormatType, SvtSysLocale().GetLanguageTag().getLocale() ); // set this at the introspectee - m_xControlModel->setPropertyValue( PROPERTY_FORMATKEY, makeAny( nDesiredFormat ) ); + m_xControlModel->setPropertyValue( PROPERTY_FORMATKEY, Any( nDesiredFormat ) ); } } catch( const Exception& ) diff --git a/extensions/source/propctrlr/xsdvalidationhelper.hxx b/extensions/source/propctrlr/xsdvalidationhelper.hxx index 017c939a4934..2a77ff584ea0 100644 --- a/extensions/source/propctrlr/xsdvalidationhelper.hxx +++ b/extensions/source/propctrlr/xsdvalidationhelper.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX +#pragma once #include "eformshelper.hxx" #include "xsddatatypes.hxx" @@ -135,6 +134,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx index 190029bd8866..29bc09a65a7f 100644 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx +++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx @@ -56,9 +56,7 @@ namespace pcr using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::xforms; using namespace ::com::sun::star::xsd; - using namespace ::com::sun::star::script; using namespace ::com::sun::star::inspection; using ::com::sun::star::beans::PropertyAttribute::MAYBEVOID; @@ -102,9 +100,9 @@ namespace pcr switch ( nPropId ) { // common facets - case PROPERTY_ID_XSD_DATA_TYPE: aReturn = pType.is() ? pType->getFacet( PROPERTY_NAME ) : makeAny( OUString() ); break; - case PROPERTY_ID_XSD_WHITESPACES:aReturn = pType.is() ? pType->getFacet( PROPERTY_XSD_WHITESPACES ) : makeAny( WhiteSpaceTreatment::Preserve ); break; - case PROPERTY_ID_XSD_PATTERN: aReturn = pType.is() ? pType->getFacet( PROPERTY_XSD_PATTERN ) : makeAny( OUString() ); break; + case PROPERTY_ID_XSD_DATA_TYPE: aReturn = pType.is() ? pType->getFacet( PROPERTY_NAME ) : Any( OUString() ); break; + case PROPERTY_ID_XSD_WHITESPACES:aReturn = pType.is() ? pType->getFacet( PROPERTY_XSD_WHITESPACES ) : Any( WhiteSpaceTreatment::Preserve ); break; + case PROPERTY_ID_XSD_PATTERN: aReturn = pType.is() ? pType->getFacet( PROPERTY_XSD_PATTERN ) : Any( OUString() ); break; // all other properties are simply forwarded, if they exist at the given type default: @@ -171,7 +169,7 @@ namespace pcr if ( bAllowBinding ) { - aProperties.reserve( 12 ); + aProperties.reserve( 28 ); addStringPropertyDescription( aProperties, PROPERTY_XSD_DATA_TYPE ); addInt16PropertyDescription ( aProperties, PROPERTY_XSD_WHITESPACES ); @@ -221,27 +219,27 @@ namespace pcr std::vector< OUString > aSuperfluous; if (m_pHelper) { - aSuperfluous.push_back( OUString(PROPERTY_CONTROLSOURCE) ); - aSuperfluous.push_back( OUString(PROPERTY_EMPTY_IS_NULL) ); - aSuperfluous.push_back( OUString(PROPERTY_FILTERPROPOSAL) ); - aSuperfluous.push_back( OUString(PROPERTY_LISTSOURCETYPE) ); - aSuperfluous.push_back( OUString(PROPERTY_LISTSOURCE) ); - aSuperfluous.push_back( OUString(PROPERTY_BOUNDCOLUMN) ); + aSuperfluous.push_back( PROPERTY_CONTROLSOURCE ); + aSuperfluous.push_back( PROPERTY_EMPTY_IS_NULL ); + aSuperfluous.push_back( PROPERTY_FILTERPROPOSAL ); + aSuperfluous.push_back( PROPERTY_LISTSOURCETYPE ); + aSuperfluous.push_back( PROPERTY_LISTSOURCE ); + aSuperfluous.push_back( PROPERTY_BOUNDCOLUMN ); bool bAllowBinding = m_pHelper->canBindToAnyDataType(); if ( bAllowBinding ) { - aSuperfluous.push_back( OUString(PROPERTY_MAXTEXTLEN) ); - aSuperfluous.push_back( OUString(PROPERTY_VALUEMIN) ); - aSuperfluous.push_back( OUString(PROPERTY_VALUEMAX) ); - aSuperfluous.push_back( OUString(PROPERTY_DECIMAL_ACCURACY) ); - aSuperfluous.push_back( OUString(PROPERTY_TIMEMIN) ); - aSuperfluous.push_back( OUString(PROPERTY_TIMEMAX) ); - aSuperfluous.push_back( OUString(PROPERTY_DATEMIN) ); - aSuperfluous.push_back( OUString(PROPERTY_DATEMAX) ); - aSuperfluous.push_back( OUString(PROPERTY_EFFECTIVE_MIN) ); - aSuperfluous.push_back( OUString(PROPERTY_EFFECTIVE_MAX) ); + aSuperfluous.push_back( PROPERTY_MAXTEXTLEN ); + aSuperfluous.push_back( PROPERTY_VALUEMIN ); + aSuperfluous.push_back( PROPERTY_VALUEMAX ); + aSuperfluous.push_back( PROPERTY_DECIMAL_ACCURACY ); + aSuperfluous.push_back( PROPERTY_TIMEMIN ); + aSuperfluous.push_back( PROPERTY_TIMEMAX ); + aSuperfluous.push_back( PROPERTY_DATEMIN ); + aSuperfluous.push_back( PROPERTY_DATEMAX ); + aSuperfluous.push_back( PROPERTY_EFFECTIVE_MIN ); + aSuperfluous.push_back( PROPERTY_EFFECTIVE_MAX ); } } @@ -255,8 +253,8 @@ namespace pcr std::vector< OUString > aInterestedInActuations; if (m_pHelper) { - aInterestedInActuations.push_back( OUString(PROPERTY_XSD_DATA_TYPE) ); - aInterestedInActuations.push_back( OUString(PROPERTY_XML_DATA_MODEL) ); + aInterestedInActuations.push_back( PROPERTY_XSD_DATA_TYPE ); + aInterestedInActuations.push_back( PROPERTY_XML_DATA_MODEL ); } return comphelper::containerToSequence( aInterestedInActuations ); } @@ -391,7 +389,7 @@ namespace pcr switch ( nControlType ) { case PropertyControlType::ListBox: - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, false ); + aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, std::move(aListEntries), false, false ); break; case PropertyControlType::NumericField: aDescriptor.Control = PropertyHandlerHelper::createNumericControl( _rxControlFactory, 0, aMinValue, aMaxValue ); @@ -575,29 +573,29 @@ namespace pcr // show the facets which are available at the data type OUString aFacets[] = { - OUString(PROPERTY_XSD_WHITESPACES), OUString(PROPERTY_XSD_PATTERN), - OUString(PROPERTY_XSD_LENGTH), OUString(PROPERTY_XSD_MIN_LENGTH), OUString(PROPERTY_XSD_MAX_LENGTH), OUString(PROPERTY_XSD_TOTAL_DIGITS), - OUString(PROPERTY_XSD_FRACTION_DIGITS), - OUString(PROPERTY_XSD_MAX_INCLUSIVE_INT), - OUString(PROPERTY_XSD_MAX_EXCLUSIVE_INT), - OUString(PROPERTY_XSD_MIN_INCLUSIVE_INT), - OUString(PROPERTY_XSD_MIN_EXCLUSIVE_INT), - OUString(PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE), - OUString(PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE), - OUString(PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE), - OUString(PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE), - OUString(PROPERTY_XSD_MAX_INCLUSIVE_DATE), - OUString(PROPERTY_XSD_MAX_EXCLUSIVE_DATE), - OUString(PROPERTY_XSD_MIN_INCLUSIVE_DATE), - OUString(PROPERTY_XSD_MIN_EXCLUSIVE_DATE), - OUString(PROPERTY_XSD_MAX_INCLUSIVE_TIME), - OUString(PROPERTY_XSD_MAX_EXCLUSIVE_TIME), - OUString(PROPERTY_XSD_MIN_INCLUSIVE_TIME), - OUString(PROPERTY_XSD_MIN_EXCLUSIVE_TIME), - OUString(PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME), - OUString(PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME), - OUString(PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME), - OUString(PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME) + PROPERTY_XSD_WHITESPACES, PROPERTY_XSD_PATTERN, + PROPERTY_XSD_LENGTH, PROPERTY_XSD_MIN_LENGTH, PROPERTY_XSD_MAX_LENGTH, PROPERTY_XSD_TOTAL_DIGITS, + PROPERTY_XSD_FRACTION_DIGITS, + PROPERTY_XSD_MAX_INCLUSIVE_INT, + PROPERTY_XSD_MAX_EXCLUSIVE_INT, + PROPERTY_XSD_MIN_INCLUSIVE_INT, + PROPERTY_XSD_MIN_EXCLUSIVE_INT, + PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE, + PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE, + PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE, + PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE, + PROPERTY_XSD_MAX_INCLUSIVE_DATE, + PROPERTY_XSD_MAX_EXCLUSIVE_DATE, + PROPERTY_XSD_MIN_INCLUSIVE_DATE, + PROPERTY_XSD_MIN_EXCLUSIVE_DATE, + PROPERTY_XSD_MAX_INCLUSIVE_TIME, + PROPERTY_XSD_MAX_EXCLUSIVE_TIME, + PROPERTY_XSD_MIN_INCLUSIVE_TIME, + PROPERTY_XSD_MIN_EXCLUSIVE_TIME, + PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME, + PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME, + PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME, + PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME }; size_t i=0; diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.hxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.hxx index d15952c55ccf..32803b215692 100644 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.hxx +++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONPROPERTYHANDLER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONPROPERTYHANDLER_HXX +#pragma once #include "propertyhandler.hxx" @@ -86,6 +85,4 @@ namespace pcr } // namespace pcr -#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONPROPERTYHANDLER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx index 38046f67b7d2..7d87010ea152 100644 --- a/extensions/source/scanner/grid.cxx +++ b/extensions/source/scanner/grid.cxx @@ -18,10 +18,9 @@ */ #include <sal/config.h> +#include <o3tl/sprintf.hxx> #include <osl/thread.h> -#include <cstdio> -#include <math.h> -#include <boost/math/special_functions/expm1.hpp> +#include <rtl/math.hxx> #include <bitmaps.hlst> #include <cmath> @@ -66,7 +65,7 @@ class GridWindow : public weld::CustomWidgetController { const Point aOffset(rWin.PixelToLogic(Point(mnOffX, mnOffY))); const tools::Rectangle aTarget(maPos - aOffset, maPos + aOffset); - return aTarget.IsInside(rPos); + return aTarget.Contains(rPos); } }; @@ -155,7 +154,6 @@ GridWindow::GridWindow() , m_BmOffX(0) , m_BmOffY(0) , m_bCutValues(false) - , m_aHandles() , m_nDragIndex(npos) { } @@ -208,7 +206,6 @@ void GridWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) GridDialog::GridDialog(weld::Window* pParent, double* pXValues, double* pYValues, int nValues) : GenericDialogController(pParent, "modules/scanner/ui/griddialog.ui", "GridDialog") - , m_xOKButton(m_xBuilder->weld_button("ok")) , m_xResetTypeBox(m_xBuilder->weld_combo_box("resetTypeCombobox")) , m_xResetButton(m_xBuilder->weld_button("resetButton")) , m_xGridWindow(new GridWindow) @@ -448,7 +445,7 @@ void GridWindow::drawGrid(vcl::RenderContext& rRenderContext) drawLine(rRenderContext, fX, m_fMinY, fX, m_fMaxY); // draw tickmarks Point aPt = transform(fX, m_fMinY); - std::sprintf(pBuf, "%g", fX); + o3tl::sprintf(pBuf, "%g", fX); OUString aMark(pBuf, strlen(pBuf), osl_getThreadTextEncoding()); Size aTextSize(rRenderContext.GetTextWidth(aMark), rRenderContext.GetTextHeight()); aPt.AdjustX( -(aTextSize.Width() / 2) ); @@ -461,7 +458,7 @@ void GridWindow::drawGrid(vcl::RenderContext& rRenderContext) drawLine(rRenderContext, m_fMinX, fY, m_fMaxX, fY); // draw tickmarks Point aPt = transform(m_fMinX, fY); - std::sprintf(pBuf, "%g", fY); + o3tl::sprintf(pBuf, "%g", fY); OUString aMark(pBuf, strlen(pBuf), osl_getThreadTextEncoding()); Size aTextSize(rRenderContext.GetTextWidth(aMark), rRenderContext.GetTextHeight()); aPt.AdjustX( -(aTextSize.Width() + 2) ); @@ -525,32 +522,32 @@ void GridWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl bool GridWindow::MouseMove( const MouseEvent& rEvt ) { - if( rEvt.GetButtons() == MOUSE_LEFT && m_nDragIndex != npos ) - { - Point aPoint( rEvt.GetPosPixel() ); + if( rEvt.GetButtons() != MOUSE_LEFT || m_nDragIndex == npos ) + return false; - if( m_nDragIndex == 0 || m_nDragIndex == m_aHandles.size() - 1) - { - aPoint.setX( m_aHandles[m_nDragIndex].maPos.X() ); - } - else - { - if(aPoint.X() < m_aGridArea.Left()) - aPoint.setX( m_aGridArea.Left() ); - else if(aPoint.X() > m_aGridArea.Right()) - aPoint.setX( m_aGridArea.Right() ); - } + Point aPoint( rEvt.GetPosPixel() ); + + if( m_nDragIndex == 0 || m_nDragIndex == m_aHandles.size() - 1) + { + aPoint.setX( m_aHandles[m_nDragIndex].maPos.X() ); + } + else + { + if(aPoint.X() < m_aGridArea.Left()) + aPoint.setX( m_aGridArea.Left() ); + else if(aPoint.X() > m_aGridArea.Right()) + aPoint.setX( m_aGridArea.Right() ); + } - if( aPoint.Y() < m_aGridArea.Top() ) - aPoint.setY( m_aGridArea.Top() ); - else if( aPoint.Y() > m_aGridArea.Bottom() ) - aPoint.setY( m_aGridArea.Bottom() ); + if( aPoint.Y() < m_aGridArea.Top() ) + aPoint.setY( m_aGridArea.Top() ); + else if( aPoint.Y() > m_aGridArea.Bottom() ) + aPoint.setY( m_aGridArea.Bottom() ); - if( aPoint != m_aHandles[m_nDragIndex].maPos ) - { - m_aHandles[m_nDragIndex].maPos = aPoint; - Invalidate( m_aGridArea ); - } + if( aPoint != m_aHandles[m_nDragIndex].maPos ) + { + m_aHandles[m_nDragIndex].maPos = aPoint; + Invalidate( m_aGridArea ); } return false; @@ -650,7 +647,7 @@ void GridWindow::ChangeMode(ResetType nType) { for( int i = 0; i < m_nValues; i++ ) { - m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)*(boost::math::expm1((m_pXValues[i]-m_fMinX)/(m_fMaxX-m_fMinX)))/(M_E-1.0); + m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)*(std::expm1((m_pXValues[i]-m_fMinX)/(m_fMaxX-m_fMinX)))/(M_E-1.0); } } break; diff --git a/extensions/source/scanner/grid.hxx b/extensions/source/scanner/grid.hxx index 86f1a521c6e1..319de77129d7 100644 --- a/extensions/source/scanner/grid.hxx +++ b/extensions/source/scanner/grid.hxx @@ -33,7 +33,6 @@ enum class ResetType class GridDialog : public weld::GenericDialogController { - std::unique_ptr<weld::Button> m_xOKButton; std::unique_ptr<weld::ComboBox> m_xResetTypeBox; std::unique_ptr<weld::Button> m_xResetButton; std::unique_ptr<GridWindow> m_xGridWindow; diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index 839602458e6e..0e92a8796433 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -169,6 +169,7 @@ Sane::~Sane() void Sane::Init() { +#ifndef DISABLE_DYNLOADING OUString sSaneLibName( "libsane" SAL_DLLEXTENSION ); pSaneLib = osl_loadModule( sSaneLibName.pData, SAL_LOADMODULE_LAZY ); if( ! pSaneLib ) @@ -183,7 +184,7 @@ void Sane::Init() osl_getFileURLFromSystemPath( sSaneLibSystemPath.pData, &sSaneLibName.pData ); pSaneLib = osl_loadModule( sSaneLibName.pData, SAL_LOADMODULE_LAZY ); } - +#endif if( pSaneLib ) { bSaneSymbolLoadFailed = false; @@ -243,7 +244,9 @@ void Sane::DeInit() if( pSaneLib ) { p_exit(); +#ifndef DISABLE_DYNLOADING osl_unloadModule( pSaneLib ); +#endif pSaneLib = nullptr; } } @@ -695,7 +698,7 @@ bool Sane::Start( BitmapTransporter& rBitmap ) if( nStatus != SANE_STATUS_GOOD ) bSynchronousRead = true; } - utl::TempFile aFrame; + utl::TempFileNamed aFrame; aFrame.EnableKillingFile(); FILE* pFrame = fopen(OUStringToOString(aFrame.GetFileName(), osl_getThreadTextEncoding()).getStr(), "w+b"); if( ! pFrame ) diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 197da88d94fd..b4f5e9a36cb7 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -17,13 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <stdio.h> #include <stdlib.h> +#include <o3tl/sprintf.hxx> #include <tools/config.hxx> #include <unotools/resmgr.hxx> #include <vcl/bitmapex.hxx> #include <vcl/customweld.hxx> #include <vcl/dibtools.hxx> +#include <vcl/lineinfo.hxx> #include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <vcl/event.hxx> @@ -43,28 +44,52 @@ namespace { -void DrawRectangles(vcl::RenderContext& rRenderContext, Point const & rUL, Point const & rBR) +void DrawRect(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) { - int nMiddleX, nMiddleY; - Point aBL, aUR; + tools::Rectangle aRect(rRect); + rRenderContext.SetFillColor(COL_BLACK); + rRenderContext.SetLineColor(); + rRenderContext.DrawRect(aRect); + aRect.Move(1, 1); + aRect.AdjustRight(-2); + aRect.AdjustBottom(-2); + rRenderContext.SetFillColor(); + rRenderContext.SetLineColor(COL_WHITE); + rRenderContext.DrawRect(aRect); +} - aUR = Point(rBR.X(), rUL.Y()); - aBL = Point(rUL.X(), rBR.Y()); - nMiddleX = (rBR.X() - rUL.X()) / 2 + rUL.X(); - nMiddleY = (rBR.Y() - rUL.Y()) / 2 + rUL.Y(); +void DrawRectangles(vcl::RenderContext& rRenderContext, Point const & rUL, Point const & rBR) +{ + Point aUR(rBR.X(), rUL.Y()); + Point aBL(rUL.X(), rBR.Y()); + int nMiddleX = (rBR.X() - rUL.X()) / 2 + rUL.X(); + int nMiddleY = (rBR.Y() - rUL.Y()) / 2 + rUL.Y(); + rRenderContext.SetLineColor(COL_WHITE); rRenderContext.DrawLine(rUL, aBL); rRenderContext.DrawLine(aBL, rBR); rRenderContext.DrawLine(rBR, aUR); rRenderContext.DrawLine(aUR, rUL); - rRenderContext.DrawRect(tools::Rectangle(rUL, Size(RECT_SIZE_PIX,RECT_SIZE_PIX))); - rRenderContext.DrawRect(tools::Rectangle(aBL, Size(RECT_SIZE_PIX, -RECT_SIZE_PIX))); - rRenderContext.DrawRect(tools::Rectangle(rBR, Size(-RECT_SIZE_PIX, -RECT_SIZE_PIX))); - rRenderContext.DrawRect(tools::Rectangle(aUR, Size(-RECT_SIZE_PIX, RECT_SIZE_PIX ))); - rRenderContext.DrawRect(tools::Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rUL.Y()), Size(RECT_SIZE_PIX, RECT_SIZE_PIX))); - rRenderContext.DrawRect(tools::Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rBR.Y()), Size(RECT_SIZE_PIX, -RECT_SIZE_PIX))); - rRenderContext.DrawRect(tools::Rectangle(Point(rUL.X(), nMiddleY - RECT_SIZE_PIX / 2), Size(RECT_SIZE_PIX, RECT_SIZE_PIX))); - rRenderContext.DrawRect(tools::Rectangle(Point(rBR.X(), nMiddleY - RECT_SIZE_PIX / 2), Size(-RECT_SIZE_PIX, RECT_SIZE_PIX))); + + rRenderContext.SetLineColor(COL_BLACK); + LineInfo aInfo(LineStyle::Dash, 1); + aInfo.SetDistance(8); + aInfo.SetDotLen(4); + aInfo.SetDotCount(1); + rRenderContext.DrawLine(rUL, aBL, aInfo); + rRenderContext.DrawLine(aBL, rBR, aInfo); + rRenderContext.DrawLine(rBR, aUR, aInfo); + rRenderContext.DrawLine(aUR, rUL, aInfo); + + Size aSize(RECT_SIZE_PIX, RECT_SIZE_PIX); + DrawRect(rRenderContext, tools::Rectangle(rUL, aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(aBL.X(), aBL.Y() - RECT_SIZE_PIX), aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(rBR.X() - RECT_SIZE_PIX, rBR.Y() - RECT_SIZE_PIX), aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(aUR.X() - RECT_SIZE_PIX, aUR.Y()), aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rUL.Y()), aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rBR.Y() - RECT_SIZE_PIX), aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(rUL.X(), nMiddleY - RECT_SIZE_PIX / 2), aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(rBR.X() - RECT_SIZE_PIX, nMiddleY - RECT_SIZE_PIX / 2), aSize)); } } @@ -77,13 +102,11 @@ private: BitmapEx maPreviewBitmapEx; tools::Rectangle maPreviewRect; - Point maLastUL, maLastBR; Point maTopLeft, maBottomRight; Point maMinTopLeft, maMaxBottomRight; SaneDlg* mpParentDialog; DragDirection meDragDirection; bool mbDragEnable; - bool mbDragDrawn; bool mbIsDragging; public: @@ -92,7 +115,6 @@ public: , mpParentDialog(nullptr) , meDragDirection(TopLeft) , mbDragEnable(false) - , mbDragDrawn(false) , mbIsDragging(false) { } @@ -250,7 +272,7 @@ SaneDlg::SaneDlg(weld::Window* pParent, Sane& rSane, bool bScanEnabled) mxDeviceBox->connect_changed( LINK( this, SaneDlg, SelectHdl ) ); mxOptionBox->connect_changed( LINK( this, SaneDlg, OptionsBoxSelectHdl ) ); mxCancelButton->connect_clicked( LINK( this, SaneDlg, ClickBtnHdl ) ); - mxBoolCheckBox->connect_clicked( LINK( this, SaneDlg, ClickBtnHdl ) ); + mxBoolCheckBox->connect_toggled( LINK( this, SaneDlg, ToggleBtnHdl ) ); mxStringEdit->connect_changed( LINK( this, SaneDlg, ModifyHdl ) ); mxNumericEdit->connect_changed( LINK( this, SaneDlg, ModifyHdl ) ); mxVectorBox->connect_changed( LINK( this, SaneDlg, ModifyHdl ) ); @@ -261,7 +283,7 @@ SaneDlg::SaneDlg(weld::Window* pParent, Sane& rSane, bool bScanEnabled) mxRightField->connect_value_changed( LINK( this, SaneDlg, MetricValueModifyHdl) ); mxTopField->connect_value_changed( LINK( this, SaneDlg, MetricValueModifyHdl) ); mxBottomField->connect_value_changed( LINK( this, SaneDlg, MetricValueModifyHdl) ); - mxAdvancedBox->connect_clicked( LINK( this, SaneDlg, ClickBtnHdl ) ); + mxAdvancedBox->connect_toggled( LINK( this, SaneDlg, ToggleBtnHdl ) ); maOldLink = mrSane.SetReloadOptionsHdl( LINK( this, SaneDlg, ReloadSaneOptionsHdl ) ); } @@ -273,9 +295,9 @@ SaneDlg::~SaneDlg() namespace { -OUString SaneResId(const char *pID) +OUString SaneResId(TranslateId aID) { - return Translate::get(pID, Translate::Create("pcr")); + return Translate::get(aID, Translate::Create("pcr")); } } @@ -568,11 +590,6 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, weld::Button&, rButton, void ) } else if( &rButton == mxPreviewButton.get() ) AcquirePreview(); - else if( &rButton == mxBoolCheckBox.get() ) - { - mrSane.SetOptionValue( mnCurrentOption, - mxBoolCheckBox->get_active() ); - } else if( &rButton == mxButtonOption.get() ) { @@ -605,10 +622,6 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, weld::Button&, rButton, void ) break; } } - else if( &rButton == mxAdvancedBox.get() ) - { - ReloadSaneOptionsHdl( mrSane ); - } } if (&rButton == mxScanButton.get()) { @@ -626,6 +639,22 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, weld::Button&, rButton, void ) } } +IMPL_LINK( SaneDlg, ToggleBtnHdl, weld::Toggleable&, rButton, void ) +{ + if( mrSane.IsOpen() ) + { + if( &rButton == mxBoolCheckBox.get() ) + { + mrSane.SetOptionValue( mnCurrentOption, + mxBoolCheckBox->get_active() ); + } + else if( &rButton == mxAdvancedBox.get() ) + { + ReloadSaneOptionsHdl( mrSane ); + } + } +} + IMPL_LINK( SaneDlg, SelectHdl, weld::ComboBox&, rListBox, void ) { if( &rListBox == mxDeviceBox.get() && Sane::IsSane() && Sane::CountDevices() ) @@ -738,7 +767,7 @@ IMPL_LINK(SaneDlg, ModifyHdl, weld::Entry&, rEdit, void) fValue = mfMin; else if( fValue > mfMax ) fValue = mfMax; - sprintf( pBuf, "%g", fValue ); + o3tl::sprintf( pBuf, "%g", fValue ); mxNumericEdit->set_text( OUString( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ) ); } mrSane.SetOptionValue( mnCurrentOption, fValue, mnCurrentElement ); @@ -750,7 +779,7 @@ IMPL_LINK(SaneDlg, ModifyHdl, weld::Entry&, rEdit, void) if( mrSane.GetOptionValue( mnCurrentOption, fValue, mnCurrentElement )) { char pBuf[256]; - sprintf( pBuf, "%g", fValue ); + o3tl::sprintf( pBuf, "%g", fValue ); OUString aValue( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ); mxNumericEdit->set_text( aValue ); mxQuantumRangeBox->set_active_text( aValue ); @@ -864,8 +893,7 @@ void SaneDlg::AcquirePreview() else { #if OSL_DEBUG_LEVEL > 0 - xTransporter->getStream().Seek( STREAM_SEEK_TO_END ); - SAL_INFO("extensions.scanner", "Previewbitmapstream contains " << xTransporter->getStream().Tell() << "bytes"); + SAL_INFO("extensions.scanner", "Previewbitmapstream contains " << xTransporter->getStream().TellEnd() << "bytes"); #endif xTransporter->getStream().Seek( STREAM_SEEK_TO_BEGIN ); mxPreview->SetBitmap(xTransporter->getStream()); @@ -918,7 +946,6 @@ void ScanPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang // check for sane values rRenderContext.DrawBitmapEx(maPreviewRect.TopLeft(), maPreviewRect.GetSize(), maPreviewBitmapEx); - mbDragDrawn = false; DrawDrag(rRenderContext); } @@ -996,18 +1023,18 @@ void SaneDlg::EstablishQuantumRange() mfMax = mpRange[ nValues-1 ]; for( int i = 0; i < nValues; i++ ) { - sprintf( pBuf, "%g", mpRange[ i ] ); + o3tl::sprintf( pBuf, "%g", mpRange[ i ] ); mxQuantumRangeBox->append_text( OUString( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ) ); } double fValue; if( mrSane.GetOptionValue( mnCurrentOption, fValue, mnCurrentElement ) ) { - sprintf( pBuf, "%g", fValue ); + o3tl::sprintf( pBuf, "%g", fValue ); mxQuantumRangeBox->set_active_text( OUString( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ) ); } mxQuantumRangeBox->show(); - OUString aText( mrSane.GetOptionName( mnCurrentOption ) + " " ); - aText += mrSane.GetOptionUnitName( mnCurrentOption ); + OUString aText = mrSane.GetOptionName( mnCurrentOption ) + " " + + mrSane.GetOptionUnitName( mnCurrentOption ); mxOptionDescTxt->set_label(aText); mxOptionDescTxt->show(); } @@ -1023,16 +1050,16 @@ void SaneDlg::EstablishNumericOption() return; char pBuf[256]; - OUString aText( mrSane.GetOptionName( mnCurrentOption ) + " " ); - aText += mrSane.GetOptionUnitName( mnCurrentOption ); + OUString aText = mrSane.GetOptionName( mnCurrentOption ) + " " + + mrSane.GetOptionUnitName( mnCurrentOption ); if( mfMin != mfMax ) { - sprintf( pBuf, " < %g ; %g >", mfMin, mfMax ); + o3tl::sprintf( pBuf, " < %g ; %g >", mfMin, mfMax ); aText += OUString( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ); } mxOptionDescTxt->set_label( aText ); mxOptionDescTxt->show(); - sprintf( pBuf, "%g", fValue ); + o3tl::sprintf( pBuf, "%g", fValue ); mxNumericEdit->set_text( OUString( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ) ); mxNumericEdit->show(); } @@ -1046,46 +1073,46 @@ void SaneDlg::EstablishButtonOption() bool ScanPreview::MouseMove(const MouseEvent& rMEvt) { - if( mbIsDragging ) + if( !mbIsDragging ) + return false; + + Point aMousePos = rMEvt.GetPosPixel(); + // move into valid area + Point aLogicPos = GetLogicPos( aMousePos ); + aMousePos = GetPixelPos( aLogicPos ); + switch( meDragDirection ) { - Point aMousePos = rMEvt.GetPosPixel(); - // move into valid area - Point aLogicPos = GetLogicPos( aMousePos ); - aMousePos = GetPixelPos( aLogicPos ); - switch( meDragDirection ) - { - case TopLeft: maTopLeft = aMousePos; break; - case Top: maTopLeft.setY( aMousePos.Y() ); break; - case TopRight: - maTopLeft.setY( aMousePos.Y() ); - maBottomRight.setX( aMousePos.X() ); - break; - case Right: maBottomRight.setX( aMousePos.X() ); break; - case BottomRight: maBottomRight = aMousePos; break; - case Bottom: maBottomRight.setY( aMousePos.Y() ); break; - case BottomLeft: - maTopLeft.setX( aMousePos.X() ); - maBottomRight.setY( aMousePos.Y() ); - break; - case Left: maTopLeft.setX( aMousePos.X() ); break; - default: break; - } - int nSwap; - if( maTopLeft.X() > maBottomRight.X() ) - { - nSwap = maTopLeft.X(); - maTopLeft.setX( maBottomRight.X() ); - maBottomRight.setX( nSwap ); - } - if( maTopLeft.Y() > maBottomRight.Y() ) - { - nSwap = maTopLeft.Y(); - maTopLeft.setY( maBottomRight.Y() ); - maBottomRight.setY( nSwap ); - } - Invalidate(); - mpParentDialog->UpdateScanArea(false); + case TopLeft: maTopLeft = aMousePos; break; + case Top: maTopLeft.setY( aMousePos.Y() ); break; + case TopRight: + maTopLeft.setY( aMousePos.Y() ); + maBottomRight.setX( aMousePos.X() ); + break; + case Right: maBottomRight.setX( aMousePos.X() ); break; + case BottomRight: maBottomRight = aMousePos; break; + case Bottom: maBottomRight.setY( aMousePos.Y() ); break; + case BottomLeft: + maTopLeft.setX( aMousePos.X() ); + maBottomRight.setY( aMousePos.Y() ); + break; + case Left: maTopLeft.setX( aMousePos.X() ); break; + default: break; + } + int nSwap; + if( maTopLeft.X() > maBottomRight.X() ) + { + nSwap = maTopLeft.X(); + maTopLeft.setX( maBottomRight.X() ); + maBottomRight.setX( nSwap ); } + if( maTopLeft.Y() > maBottomRight.Y() ) + { + nSwap = maTopLeft.Y(); + maTopLeft.setY( maBottomRight.Y() ); + maBottomRight.setY( nSwap ); + } + Invalidate(); + mpParentDialog->UpdateScanArea(false); return false; } @@ -1179,19 +1206,10 @@ void ScanPreview::DrawDrag(vcl::RenderContext& rRenderContext) if (!mbDragEnable) return; - RasterOp eROP = rRenderContext.GetRasterOp(); - rRenderContext.SetRasterOp(RasterOp::Invert); rRenderContext.SetMapMode(MapMode(MapUnit::MapPixel)); - if (mbDragDrawn) - DrawRectangles(rRenderContext, maLastUL, maLastBR); - - maLastUL = maTopLeft; - maLastBR = maBottomRight; DrawRectangles(rRenderContext, maTopLeft, maBottomRight); - mbDragDrawn = true; - rRenderContext.SetRasterOp(eROP); rRenderContext.SetMapMode(MapMode(MapUnit::MapAppFont)); } @@ -1265,8 +1283,8 @@ bool SaneDlg::LoadState() if( ! aConfig.HasGroup( "SANE" ) ) return false; - aConfig.SetGroup( "SANE" ); - OString aString = aConfig.ReadKey( "SO_LastSaneDevice" ); + aConfig.SetGroup( "SANE"_ostr ); + OString aString = aConfig.ReadKey( "SO_LastSaneDevice"_ostr ); for( i = 0; i < Sane::CountDevices() && aString != OUStringToOString(Sane::GetName(i), osl_getThreadTextEncoding()); i++ ) ; if( i == Sane::CountDevices() ) return false; @@ -1338,8 +1356,8 @@ void SaneDlg::SaveState() Config aConfig( aFileName ); aConfig.DeleteGroup( "SANE" ); - aConfig.SetGroup( "SANE" ); - aConfig.WriteKey( "SO_LastSANEDevice", + aConfig.SetGroup( "SANE"_ostr ); + aConfig.WriteKey( "SO_LastSANEDevice"_ostr, OUStringToOString(mxDeviceBox->get_active_text(), RTL_TEXTENCODING_UTF8) ); static char const* pSaveOptions[] = { @@ -1392,7 +1410,7 @@ void SaneDlg::SaveState() break; if( n > 0 ) aString.append(':'); - sprintf( buf, "%lg", fValue ); + o3tl::sprintf( buf, "%lg", fValue ); aString.append(buf); } if( n >= mrSane.GetOptionElements( nOption ) ) diff --git a/extensions/source/scanner/sanedlg.hxx b/extensions/source/scanner/sanedlg.hxx index ad87667bf13a..e9ba1540dab5 100644 --- a/extensions/source/scanner/sanedlg.hxx +++ b/extensions/source/scanner/sanedlg.hxx @@ -75,6 +75,7 @@ private: std::unique_ptr<weld::CustomWeld> mxPreviewWnd; DECL_LINK( ClickBtnHdl, weld::Button&, void ); + DECL_LINK( ToggleBtnHdl, weld::Toggleable&, void ); DECL_LINK( SelectHdl, weld::ComboBox&, void ); DECL_LINK( ModifyHdl, weld::Entry&, void ); DECL_LINK( MetricValueModifyHdl, weld::MetricSpinButton&, void ); diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx index 6a81f5fbf6e3..0db920c4c951 100644 --- a/extensions/source/scanner/scanunx.cxx +++ b/extensions/source/scanner/scanunx.cxx @@ -22,6 +22,7 @@ #include <o3tl/safeint.hxx> #include <osl/thread.hxx> #include <sal/log.hxx> +#include <utility> #include <vcl/svapp.hxx> #include <memory> @@ -129,7 +130,7 @@ public: virtual void SAL_CALL run() override; virtual void SAL_CALL onTerminated() override { delete this; } public: - ScannerThread( const std::shared_ptr<SaneHolder>& pHolder, + ScannerThread( std::shared_ptr<SaneHolder> pHolder, const Reference< css::lang::XEventListener >& listener, ScannerManager* pManager ); virtual ~ScannerThread() override; @@ -137,10 +138,10 @@ public: } -ScannerThread::ScannerThread(const std::shared_ptr<SaneHolder>& pHolder, +ScannerThread::ScannerThread(std::shared_ptr<SaneHolder> pHolder, const Reference< css::lang::XEventListener >& listener, ScannerManager* pManager) - : m_pHolder( pHolder ), m_xListener( listener ), m_pManager( pManager ) + : m_pHolder(std::move( pHolder )), m_xListener( listener ), m_pManager( pManager ) { SAL_INFO("extensions.scanner", "ScannerThread"); } @@ -157,10 +158,9 @@ void ScannerThread::run() osl_setThreadName("ScannerThread"); osl::MutexGuard aGuard( m_pHolder->m_aProtector ); - BitmapTransporter* pTransporter = new BitmapTransporter; - Reference< XInterface > aIf( static_cast< OWeakObject* >( pTransporter ) ); + rtl::Reference<BitmapTransporter> pTransporter = new BitmapTransporter; - m_pHolder->m_xBitmap.set( aIf, UNO_QUERY ); + m_pHolder->m_xBitmap = pTransporter; m_pHolder->m_bBusy = true; if( m_pHolder->m_aSane.IsOpen() ) @@ -225,9 +225,7 @@ Sequence< ScannerContext > ScannerManager::getAvailableScanners() if( Sane::IsSane() ) { - Sequence< ScannerContext > aRet(1); - aRet[0].ScannerName = "SANE"; - aRet[0].InternalData = 0; + Sequence< ScannerContext > aRet{ { /* ScannerName */ "SANE", /* InternalData */ 0 } }; return aRet; } diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx index bfe4c3c37006..198b092846cd 100644 --- a/extensions/source/scanner/scanwin.cxx +++ b/extensions/source/scanner/scanwin.cxx @@ -253,9 +253,10 @@ void Twain::ShimListenerThread::execute() ThrowLastError("DuplicateHandle"); // we will not need our copy as soon as shim has its own inherited one ScopedHANDLE hScopedDup(hDup); - DWORD nDup = static_cast<DWORD>(reinterpret_cast<sal_uIntPtr>(hDup)); - if (reinterpret_cast<HANDLE>(nDup) != hDup) - throw std::exception("HANDLE does not fit to 32 bit - cannot pass to shim!"); + sal_uIntPtr nDup = reinterpret_cast<sal_uIntPtr>(hDup); + if constexpr (sizeof(sal_uIntPtr) > 4) + if (nDup > 0xFFFFFFFF) + throw std::exception("HANDLE does not fit to 32 bit - cannot pass to shim!"); // Send this thread handle as the first parameter sCmdLine = "\"" + sCmdLine + "\" " + OUString::number(nDup); @@ -342,7 +343,7 @@ bool Twain::InitializeNewShim(ScannerManager& rMgr, const VclPtr<vcl::Window>& x return false; // Have a shim for another task already! // hold reference to ScannerManager, to prevent premature death - mxMgr.set(static_cast<OWeakObject*>(mpCurMgr = &rMgr), css::uno::UNO_QUERY); + mxMgr = mpCurMgr = &rMgr; mpThread.set(new ShimListenerThread(xTopWindow)); mpThread->launch(); diff --git a/extensions/source/scanner/twain32shim.cxx b/extensions/source/scanner/twain32shim.cxx index 0a34fa13ce7e..6e0be8149471 100644 --- a/extensions/source/scanner/twain32shim.cxx +++ b/extensions/source/scanner/twain32shim.cxx @@ -28,17 +28,16 @@ */ #include "twain32shim.hxx" +#include <systools/win32/comtools.hxx> #include <tools/helpers.hxx> #include <twain/twain.h> +#include <o3tl/unit_conversion.hxx> #define WM_TWAIN_FALLBACK (WM_SHIM_INTERNAL + 0) namespace { -TW_INT32 FixToInt32(const TW_FIX32& rFix) -{ - return static_cast<TW_INT32>(floor(rFix.Whole + rFix.Frac / 65536. + 0.5)); -} +double FixToDouble(const TW_FIX32& rFix) { return rFix.Whole + rFix.Frac / 65536.; } const wchar_t sTwainWndClass[] = L"TwainClass"; @@ -169,26 +168,21 @@ HANDLE GetProcOfThread(HANDLE hThread) } ImpTwain::ImpTwain(HANDLE hParentThread) - : m_nParentThreadId(GetThreadId(hParentThread)) + : m_aAppId{ /* Id */ 0, + { /* Version.MajorNum */ 1, + /* Version.MinorNum */ 0, + /* Version.Language */ TWLG_USA, + /* Version.Country */ TWCY_USA, + /* Version.Info */ "8.0" }, + /* ProtocolMajor */ TWON_PROTOCOLMAJOR, + /* ProtocolMinor */ TWON_PROTOCOLMINOR, + /* SupportedGroups */ DG_IMAGE | DG_CONTROL, + /* Manufacturer */ "Sun Microsystems", + /* ProductFamily */ "Office", + /* ProductName */ "Office" } + , m_nParentThreadId(GetThreadId(hParentThread)) , m_hProc(GetProcOfThread(hParentThread)) { - m_aAppId.Id = 0; - m_aAppId.Version.MajorNum = 1; - m_aAppId.Version.MinorNum = 0; - m_aAppId.Version.Language = TWLG_USA; - m_aAppId.Version.Country = TWCY_USA; - m_aAppId.ProtocolMajor = TWON_PROTOCOLMAJOR; - m_aAppId.ProtocolMinor = TWON_PROTOCOLMINOR; - m_aAppId.SupportedGroups = DG_IMAGE | DG_CONTROL; - strncpy(m_aAppId.Version.Info, "8.0", 32); - m_aAppId.Version.Info[32] = m_aAppId.Version.Info[33] = 0; - strncpy(m_aAppId.Manufacturer, "Sun Microsystems", 32); - m_aAppId.Manufacturer[32] = m_aAppId.Manufacturer[33] = 0; - strncpy(m_aAppId.ProductFamily, "Office", 32); - m_aAppId.ProductFamily[32] = m_aAppId.ProductFamily[33] = 0; - strncpy(m_aAppId.ProductName, "Office", 32); - m_aAppId.ProductName[32] = m_aAppId.ProductName[33] = 0; - WNDCLASSW aWc = { 0, &WndProc, 0, sizeof(WNDCLASSW), GetModuleHandleW(nullptr), nullptr, nullptr, nullptr, nullptr, sTwainWndClass }; if (!RegisterClassW(&aWc)) @@ -258,11 +252,10 @@ void ImpTwain::ImplOpenSourceManager() if (!m_hMod) { // Windows directory might not be in DLL search path sometimes, so try the full path - PWSTR sPath; + sal::systools::CoTaskMemAllocated<wchar_t> sPath; if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Windows, 0, nullptr, &sPath))) { - std::wstring sPathAndFile = sPath; - CoTaskMemFree(sPath); + std::wstring sPathAndFile(sPath); sPathAndFile += L"\\TWAIN_32.DLL"; m_hMod = LoadLibraryW(sPathAndFile.c_str()); } @@ -387,17 +380,15 @@ void ImpTwain::ImplXfer() { TW_IMAGEINFO aInfo; HANDLE hDIB = nullptr; - TW_INT32 nWidth, nHeight, nXRes, nYRes; + double nXRes, nYRes; if (m_pDSM(&m_aAppId, &m_aSrcId, DG_IMAGE, DAT_IMAGEINFO, MSG_GET, &aInfo) == TWRC_SUCCESS) { - nWidth = aInfo.ImageWidth; - nHeight = aInfo.ImageLength; - nXRes = FixToInt32(aInfo.XResolution); - nYRes = FixToInt32(aInfo.YResolution); + nXRes = FixToDouble(aInfo.XResolution); + nYRes = FixToDouble(aInfo.YResolution); } else - nWidth = nHeight = nXRes = nYRes = -1; + nXRes = nYRes = -1; switch (m_pDSM(&m_aAppId, &m_aSrcId, DG_IMAGE, DAT_IMAGENATIVEXFER, MSG_GET, &hDIB)) { @@ -417,14 +408,15 @@ void ImpTwain::ImplXfer() { if (LPVOID pBmpMem = GlobalLock(hGlob)) { - if ((nXRes != -1) && (nYRes != -1) && (nWidth != -1) && (nHeight != -1)) + if ((nXRes > 0) && (nYRes > 0)) { // set resolution of bitmap BITMAPINFOHEADER* pBIH = static_cast<BITMAPINFOHEADER*>(pBmpMem); - static const double fFactor = 100.0 / 2.54; - pBIH->biXPelsPerMeter = FRound(fFactor * nXRes); - pBIH->biYPelsPerMeter = FRound(fFactor * nYRes); + const auto[m, d] + = getConversionMulDiv(o3tl::Length::in, o3tl::Length::m); + pBIH->biXPelsPerMeter = std::round(o3tl::convert(nXRes, d, m)); + pBIH->biYPelsPerMeter = std::round(o3tl::convert(nYRes, d, m)); } HANDLE hMap = CreateFileMappingW(INVALID_HANDLE_VALUE, nullptr, diff --git a/extensions/source/update/check/actionlistener.hxx b/extensions/source/update/check/actionlistener.hxx index 6253d7e643e1..63c5ac1cb019 100644 --- a/extensions/source/update/check/actionlistener.hxx +++ b/extensions/source/update/check/actionlistener.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_ACTIONLISTENER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_ACTIONLISTENER_HXX +#pragma once #include <salhelper/simplereferenceobject.hxx> @@ -28,7 +27,6 @@ class IActionListener : public virtual salhelper::SimpleReferenceObject virtual void cancel() = 0; virtual void download() = 0; - virtual void install() = 0; virtual void pause() = 0; virtual void resume() = 0; virtual void closeAfterFailure() = 0; @@ -37,6 +35,4 @@ protected: virtual ~IActionListener() override {} }; -#endif // INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_ACTIONLISTENER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/download.cxx b/extensions/source/update/check/download.cxx index 3e8ad4e2c09c..f96d6ecd495e 100644 --- a/extensions/source/update/check/download.cxx +++ b/extensions/source/update/check/download.cxx @@ -23,6 +23,9 @@ #include <curl/curl.h> +#include <systools/curlinit.hxx> + +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <osl/file.h> #include <com/sun/star/beans/PropertyValue.hpp> @@ -59,8 +62,8 @@ static void openFile( OutData& out ) char * effective_url; curl_easy_getinfo(out.curl, CURLINFO_EFFECTIVE_URL, &effective_url); - double fDownloadSize; - curl_easy_getinfo(out.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fDownloadSize); + curl_off_t nDownloadSize; + curl_easy_getinfo(out.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &nDownloadSize); OString aURL(effective_url); @@ -93,7 +96,7 @@ static void openFile( OutData& out ) } while( osl_File_E_EXIST == rc ); if( osl_File_E_None == rc ) - out.Handler->downloadStarted(out.File, static_cast<sal_Int64>(fDownloadSize)); + out.Handler->downloadStarted(out.File, static_cast<sal_Int64>(nDownloadSize)); } } @@ -139,7 +142,7 @@ write_function( void *ptr, size_t size, size_t nmemb, void *stream ) static int -progress_callback( void *clientp, double dltotal, double dlnow, SAL_UNUSED_PARAMETER double, SAL_UNUSED_PARAMETER double ) +progress_callback( void *clientp, curl_off_t dltotal, curl_off_t dlnow, SAL_UNUSED_PARAMETER curl_off_t, SAL_UNUSED_PARAMETER curl_off_t) { OutData *out = static_cast < OutData * > (clientp); @@ -147,7 +150,7 @@ progress_callback( void *clientp, double dltotal, double dlnow, SAL_UNUSED_PARAM if (out && !out->StopCondition.check()) { - double fPercent = 0; + float fPercent = 0; if ( dltotal + out->Offset ) fPercent = (dlnow + out->Offset) * 100 / (dltotal + out->Offset); if( fPercent < 0 ) @@ -168,7 +171,7 @@ progress_callback( void *clientp, double dltotal, double dlnow, SAL_UNUSED_PARAM void -Download::getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort) const +Download::getProxyForURL(std::u16string_view rURL, OString& rHost, sal_Int32& rPort) const { uno::Reference< lang::XMultiServiceFactory > xConfigProvider( css::configuration::theDefaultProvider::get( m_xContext ) ); @@ -177,8 +180,7 @@ Download::getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort) aProperty.Name = "nodepath"; aProperty.Value <<= OUString("org.openoffice.Inet/Settings"); - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] <<= aProperty; + uno::Sequence< uno::Any > aArgumentList{ uno::Any(aProperty) }; uno::Reference< container::XNameAccess > xNameAccess( xConfigProvider->createInstanceWithArguments( @@ -191,21 +193,16 @@ Download::getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort) sal_Int32 nProxyType = aValue.get< sal_Int32 >(); if( 0 != nProxyType ) // type 0 means "direct connection to the internet { - if( rURL.startsWith("http:") ) + if( o3tl::starts_with(rURL, u"http:") ) { rHost = getStringValue(xNameAccess, "ooInetHTTPProxyName"); rPort = getInt32Value(xNameAccess, "ooInetHTTPProxyPort"); } - else if( rURL.startsWith("https:") ) + else if( o3tl::starts_with(rURL, u"https:") ) { rHost = getStringValue(xNameAccess, "ooInetHTTPSProxyName"); rPort = getInt32Value(xNameAccess, "ooInetHTTPSProxyPort"); } - else if( rURL.startsWith("ftp:") ) - { - rHost = getStringValue(xNameAccess, "ooInetFTPProxyName"); - rPort = getInt32Value(xNameAccess, "ooInetFTPProxyPort"); - } } } @@ -222,40 +219,46 @@ static bool curl_run(std::u16string_view rURL, OutData& out, const OString& aPro if( nullptr != pCURL ) { + ::InitCurl_easy(pCURL); + out.curl = pCURL; OString aURL(OUStringToOString(rURL, RTL_TEXTENCODING_UTF8)); - curl_easy_setopt(pCURL, CURLOPT_URL, aURL.getStr()); + (void)curl_easy_setopt(pCURL, CURLOPT_URL, aURL.getStr()); // abort on http errors - curl_easy_setopt(pCURL, CURLOPT_FAILONERROR, 1); + (void)curl_easy_setopt(pCURL, CURLOPT_FAILONERROR, 1); // enable redirection - curl_easy_setopt(pCURL, CURLOPT_FOLLOWLOCATION, 1); - // only allow redirect to http:// and https:// - curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); + (void)curl_easy_setopt(pCURL, CURLOPT_FOLLOWLOCATION, 1); + // only allow redirect to https:// +#if (LIBCURL_VERSION_MAJOR > 7) || (LIBCURL_VERSION_MAJOR == 7 && LIBCURL_VERSION_MINOR >= 85) + (void)curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS_STR, "https"); +#else + (void)curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS); +#endif // write function - curl_easy_setopt(pCURL, CURLOPT_WRITEDATA, &out); - curl_easy_setopt(pCURL, CURLOPT_WRITEFUNCTION, &write_function); + (void)curl_easy_setopt(pCURL, CURLOPT_WRITEDATA, &out); + (void)curl_easy_setopt(pCURL, CURLOPT_WRITEFUNCTION, &write_function); // progress handler - Condition::check unfortunately is not defined const - curl_easy_setopt(pCURL, CURLOPT_NOPROGRESS, 0); - curl_easy_setopt(pCURL, CURLOPT_PROGRESSFUNCTION, &progress_callback); - curl_easy_setopt(pCURL, CURLOPT_PROGRESSDATA, &out); + (void)curl_easy_setopt(pCURL, CURLOPT_NOPROGRESS, 0); + (void)curl_easy_setopt(pCURL, CURLOPT_XFERINFOFUNCTION, &progress_callback); + (void)curl_easy_setopt(pCURL, CURLOPT_PROGRESSDATA, &out); // proxy - curl_easy_setopt(pCURL, CURLOPT_PROXY, aProxyHost.getStr()); - curl_easy_setopt(pCURL, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); + (void)curl_easy_setopt(pCURL, CURLOPT_PROXY, aProxyHost.getStr()); + (void)curl_easy_setopt(pCURL, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); if( -1 != nProxyPort ) - curl_easy_setopt(pCURL, CURLOPT_PROXYPORT, nProxyPort); + (void)curl_easy_setopt(pCURL, CURLOPT_PROXYPORT, nProxyPort); if( out.Offset > 0 ) { // curl_off_t offset = nOffset; libcurl seems to be compiled with large // file support (and we not) .. sal_Int64 offset = static_cast<sal_Int64>(out.Offset); - curl_easy_setopt(pCURL, CURLOPT_RESUME_FROM_LARGE, offset); + (void)curl_easy_setopt(pCURL, CURLOPT_RESUME_FROM_LARGE, offset); } CURLcode cc = curl_easy_perform(pCURL); @@ -274,9 +277,9 @@ static bool curl_run(std::u16string_view rURL, OutData& out, const OString& aPro { // this sometimes happens, when a user throws away his user data, but has already // completed the download of an update. - double fDownloadSize; - curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fDownloadSize ); - if ( -1 == fDownloadSize ) + curl_off_t nDownloadSize; + curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &nDownloadSize ); + if ( -1 == nDownloadSize ) { out.Handler->downloadFinished(out.File); ret = true; @@ -290,7 +293,7 @@ static bool curl_run(std::u16string_view rURL, OutData& out, const OString& aPro // Only report errors when not stopped else { - OString aMessage("Unknown error"); + OString aMessage("Unknown error"_ostr); const char * error_message = curl_easy_strerror(cc); if( nullptr != error_message ) diff --git a/extensions/source/update/check/download.hxx b/extensions/source/update/check/download.hxx index 9762a567fc5c..12a11ddde091 100644 --- a/extensions/source/update/check/download.hxx +++ b/extensions/source/update/check/download.hxx @@ -17,8 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_DOWNLOAD_HXX -#define INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_DOWNLOAD_HXX +#pragma once + +#include <sal/config.h> + +#include <string_view> #include <com/sun/star/uno/XComponentContext.hpp> @@ -66,7 +69,7 @@ public: protected: // Determines the appropriate proxy settings for the given URL. Returns true if a proxy should be used - void getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort) const; + void getProxyForURL(std::u16string_view rURL, OString& rHost, sal_Int32& rPort) const; private: osl::Condition m_aCondition; @@ -74,6 +77,4 @@ private: const rtl::Reference<DownloadInteractionHandler> m_aHandler; }; -#endif // INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_DOWNLOAD_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/onlinecheck.hxx b/extensions/source/update/check/onlinecheck.hxx index 5b3cd74d2aa8..fcfedcf48066 100644 --- a/extensions/source/update/check/onlinecheck.hxx +++ b/extensions/source/update/check/onlinecheck.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_ONLINECHECK_HXX -#define INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_ONLINECHECK_HXX +#pragma once #include <sal/config.h> @@ -26,6 +25,4 @@ extern "C" bool WNT_hasInternetConnection(); #endif -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index 4a8017a2d805..66409b32f8b3 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -42,7 +42,7 @@ #include <osl/file.hxx> #include <sal/macros.h> #include <sal/log.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #ifdef _WIN32 #include <o3tl/safeCoInitUninit.hxx> @@ -55,17 +55,16 @@ namespace beans = com::sun::star::beans ; namespace deployment = com::sun::star::deployment ; -namespace frame = com::sun::star::frame ; namespace lang = com::sun::star::lang ; namespace c3s = com::sun::star::system ; namespace task = com::sun::star::task ; namespace uno = com::sun::star::uno ; -#define PROPERTY_TITLE "BubbleHeading" -#define PROPERTY_TEXT "BubbleText" -#define PROPERTY_SHOW_BUBBLE "BubbleVisible" -#define PROPERTY_CLICK_HDL "MenuClickHDL" -#define PROPERTY_SHOW_MENUICON "MenuIconVisible" +constexpr OUStringLiteral PROPERTY_TITLE = u"BubbleHeading"; +constexpr OUStringLiteral PROPERTY_TEXT = u"BubbleText"; +constexpr OUStringLiteral PROPERTY_SHOW_BUBBLE = u"BubbleVisible"; +constexpr OUStringLiteral PROPERTY_CLICK_HDL = u"MenuClickHDL"; +constexpr OUString PROPERTY_SHOW_MENUICON = u"MenuIconVisible"_ustr; // Returns the URL of the release note for the given position OUString getReleaseNote(const UpdateInfo& rInfo, sal_uInt8 pos, bool autoDownloadEnabled) @@ -96,16 +95,6 @@ OUString getBuildId() } -#if (defined LINUX || defined __sun) -OUString getBaseInstallation() -{ - OUString aPathVal("$BRAND_BASE_DIR"); - rtl::Bootstrap::expandMacros(aPathVal); - return aPathVal; -} -#endif - - bool isObsoleteUpdateInfo(std::u16string_view rBuildId) { return rBuildId != getBuildId() && !rBuildId.empty(); @@ -206,7 +195,7 @@ uno::Reference< beans::XPropertySet > createMenuBarUI( xServiceManager->createInstanceWithContext( "com.sun.star.setup.UpdateCheckUI", xContext ), uno::UNO_QUERY_THROW); - xMenuBarUI->setPropertyValue( PROPERTY_CLICK_HDL, uno::makeAny( xJob ) ); + xMenuBarUI->setPropertyValue( PROPERTY_CLICK_HDL, uno::Any( xJob ) ); return xMenuBarUI; } @@ -325,22 +314,6 @@ private: }; -class ShutdownThread : public osl::Thread -{ -public: - explicit ShutdownThread(const uno::Reference<uno::XComponentContext>& xContext); - - virtual void SAL_CALL run() override; - virtual void SAL_CALL onTerminated() override; - -protected: - virtual ~ShutdownThread() override; - -private: - osl::Condition m_aCondition; - const uno::Reference<uno::XComponentContext> m_xContext; -}; - UpdateCheckThread::UpdateCheckThread( osl::Condition& rCondition, const uno::Reference<uno::XComponentContext>& xContext, @@ -542,7 +515,7 @@ UpdateCheckThread::run() // Increase next by 15, 60, .. minutes static const sal_Int32 nRetryInterval[] = { 900, 3600, 14400, 86400 }; - if( n < SAL_N_ELEMENTS(nRetryInterval) ) + if( n < std::size(nRetryInterval) ) ++n; tv.Seconds = nRetryInterval[n-1]; @@ -650,15 +623,14 @@ DownloadThread::run() if( ! m_aDownload.start(m_aURL, aLocalFile, aDownloadDest ) ) { // retry every 15s unless the dialog is not visible - TimeValue tv; - tv.Seconds = 15; + TimeValue tv(15, 0); if( ! UpdateCheck::get()->isDialogShowing() ) { // Increase next by 1, 5, 15, 60, .. minutes static const sal_Int16 nRetryInterval[] = { 60, 300, 900, 3600 }; - if( n < SAL_N_ELEMENTS(nRetryInterval) ) + if( n < std::size(nRetryInterval) ) ++n; tv.Seconds = nRetryInterval[n-1]; @@ -700,45 +672,6 @@ void SAL_CALL DownloadThread::onTerminated() } -ShutdownThread::ShutdownThread( const uno::Reference<uno::XComponentContext>& xContext) : - m_xContext( xContext ) -{ - create(); -} - - -ShutdownThread::~ShutdownThread() -{ -} - - -void SAL_CALL -ShutdownThread::run() -{ - osl_setThreadName("ShutdownThread"); - - TimeValue tv = { 0, 250 }; - - m_aCondition.wait(&tv); - - // Tell QuickStarter not to veto .. - uno::Reference< css::beans::XFastPropertySet > xQuickStarter = css::office::Quickstart::createDefault(m_xContext); - - xQuickStarter->setFastPropertyValue(0, uno::makeAny(false)); - - // Shutdown the office - uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_xContext); - - xDesktop->terminate(); -} - - -void SAL_CALL ShutdownThread::onTerminated() -{ - delete this; -} - - } // anonymous namespace UpdateCheck::UpdateCheck() @@ -814,7 +747,7 @@ UpdateCheck::initialize(const uno::Sequence< beans::NamedValue >& rValues, bool downloadPaused = aModel.isDownloadPaused(); enableDownload(true, downloadPaused); - // coverity[lock_order : FALSE] - incorrect report of lock older error with std::recursive_mutex + // coverity[lock_order : FALSE] - incorrect report of lock order error with std::recursive_mutex setUIState(downloadPaused ? UPDATESTATE_DOWNLOAD_PAUSED : UPDATESTATE_DOWNLOADING); } @@ -909,50 +842,6 @@ UpdateCheck::download() void -UpdateCheck::install() -{ - std::scoped_lock aGuard(m_aMutex); - - const uno::Reference< c3s::XSystemShellExecute > xShellExecute = c3s::SystemShellExecute::create( m_xContext ); - - try { - // Construct install command ?? - - // Store release note for position 3 and 4 - OUString aURL(getReleaseNote(m_aUpdateInfo, 3)); - storeReleaseNote(1, aURL); - - aURL = getReleaseNote(m_aUpdateInfo, 4); - storeReleaseNote(2, aURL); - - OUString aInstallImage(m_aImageName); - osl::FileBase::getSystemPathFromFileURL(aInstallImage, aInstallImage); - - sal_Int32 nFlags; -#if (defined LINUX || defined __sun) - nFlags = 42; - OUString aParameter = getBaseInstallation(); - if( !aParameter.isEmpty() ) - osl::FileBase::getSystemPathFromFileURL(aParameter, aParameter); - - aParameter += " &"; -#else - nFlags = c3s::SystemShellExecuteFlags::DEFAULTS; - OUString const aParameter; -#endif - - rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get( m_xContext ); - rModel->clearLocalFileName(); - - xShellExecute->execute(aInstallImage, aParameter, nFlags); - new ShutdownThread( m_xContext ); - } catch(const uno::Exception&) { - m_aUpdateHandler->setErrorMessage( m_aUpdateHandler->getDefaultInstErrMsg() ); - } -} - - -void UpdateCheck::pause() { std::unique_lock aGuard(m_aMutex); @@ -1390,18 +1279,18 @@ void UpdateCheck::handleMenuBarUI( const rtl::Reference< UpdateHandler >& rUpdat { if( UPDATESTATE_NO_UPDATE_AVAIL == eState ) { - xMenuBarUI->setPropertyValue( PROPERTY_SHOW_MENUICON, uno::makeAny(false) ); + xMenuBarUI->setPropertyValue( PROPERTY_SHOW_MENUICON, uno::Any(false) ); } else { - xMenuBarUI->setPropertyValue( PROPERTY_TITLE, uno::makeAny(rUpdateHandler->getBubbleTitle(eState)) ); - xMenuBarUI->setPropertyValue( PROPERTY_TEXT, uno::makeAny(rUpdateHandler->getBubbleText(eState)) ); + xMenuBarUI->setPropertyValue( PROPERTY_TITLE, uno::Any(rUpdateHandler->getBubbleTitle(eState)) ); + xMenuBarUI->setPropertyValue( PROPERTY_TEXT, uno::Any(rUpdateHandler->getBubbleText(eState)) ); if( ! suppressBubble && ( ! rUpdateHandler->isVisible() || rUpdateHandler->isMinimized() ) ) - xMenuBarUI->setPropertyValue( PROPERTY_SHOW_BUBBLE, uno::makeAny( true ) ); + xMenuBarUI->setPropertyValue( PROPERTY_SHOW_BUBBLE, uno::Any( true ) ); if( UPDATESTATE_CHECKING != eState ) - xMenuBarUI->setPropertyValue( PROPERTY_SHOW_MENUICON, uno::makeAny(true) ); + xMenuBarUI->setPropertyValue( PROPERTY_SHOW_MENUICON, uno::Any(true) ); } } } @@ -1517,7 +1406,7 @@ UpdateCheck::storeReleaseNote(sal_Int8 nNum, const OUString &rURL) rc = aFile.open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create ); if ( rc != osl::FileBase::E_None ) return false; - OString aLineBuf("[InternetShortcut]\r\n"); + OString aLineBuf("[InternetShortcut]\r\n"_ostr); sal_uInt64 nWritten = 0; OUString aURL( rURL ); diff --git a/extensions/source/update/check/updatecheck.hxx b/extensions/source/update/check/updatecheck.hxx index fbadbe82a03e..7af355bc41ea 100644 --- a/extensions/source/update/check/updatecheck.hxx +++ b/extensions/source/update/check/updatecheck.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATECHECK_HXX -#define INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATECHECK_HXX +#pragma once #include <sal/config.h> @@ -118,7 +117,6 @@ public: // IActionListener void cancel() override; void download() override; - void install() override; void pause() override; void resume() override; void closeAfterFailure() override; @@ -165,7 +163,6 @@ private: mutable std::recursive_mutex m_aMutex; WorkerThread *m_pThread; osl::Condition m_aCondition; - osl::Condition m_NotInWaitState; UpdateInfo m_aUpdateInfo; OUString m_aImageName; @@ -188,6 +185,4 @@ UpdateCheckInitData::operator() () const return rtl::Reference< UpdateCheck > (new UpdateCheck()); } -#endif // INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATECHECK_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx index b76284ff759b..52deb59528fb 100644 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ b/extensions/source/update/check/updatecheckconfig.cxx @@ -75,10 +75,6 @@ const char * const aUpdateEntryProperties[] = { const sal_uInt32 nUpdateEntryProperties = SAL_N_ELEMENTS(aUpdateEntryProperties); -NamedValueByNameAccess::~NamedValueByNameAccess() -{ -} - css::uno::Any NamedValueByNameAccess::getValue(const char * pName) { const sal_Int32 nLen = m_rValues.getLength(); @@ -143,14 +139,14 @@ UpdateCheckROModel::getUpdateEntry(UpdateInfo& rInfo) const bool isDirectDownload = false; m_aNameAccess.getValue(IS_DIRECT_DOWNLOAD) >>= isDirectDownload; - rInfo.Sources.push_back( DownloadSource( isDirectDownload, getStringValue(DOWNLOAD_URL) ) ); + rInfo.Sources.emplace_back(isDirectDownload, getStringValue(DOWNLOAD_URL)); for(sal_Int32 n=1; n < 6; ++n ) { OUString aUStr = getStringValue( - OString(OStringLiteral(RELEASE_NOTE) + OString::number(n)).getStr()); + OString(OString::Concat(RELEASE_NOTE) + OString::number(n)).getStr()); if( !aUStr.isEmpty() ) - rInfo.ReleaseNotes.push_back(ReleaseNote(static_cast<sal_Int8>(n), aUStr)); + rInfo.ReleaseNotes.emplace_back(static_cast<sal_Int8>(n), aUStr); } } @@ -187,13 +183,13 @@ OUString UpdateCheckConfig::getAllUsersDirectory() OUString aRet; #ifdef _WIN32 - WCHAR szPath[MAX_PATH]; - - if (TRUE == SHGetSpecialFolderPathW(nullptr, szPath, CSIDL_COMMON_DOCUMENTS, true)) + PWSTR szPath = nullptr; + if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_PublicDocuments, KF_FLAG_CREATE, nullptr, &szPath))) { aRet = o3tl::toU(szPath); osl::FileBase::getFileURLFromSystemPath( aRet, aRet ); } + CoTaskMemFree(szPath); #else osl::FileBase::getTempDirURL(aRet); #endif @@ -226,8 +222,7 @@ UpdateCheckConfig::get( aProperty.Name = "nodepath"; aProperty.Value <<= OUString("org.openoffice.Office.Jobs/Jobs/UpdateCheck/Arguments"); - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] <<= aProperty; + uno::Sequence< uno::Any > aArgumentList{ uno::Any(aProperty) }; uno::Reference< container::XNameContainer > xContainer( xConfigProvider->createInstanceWithArguments( @@ -235,11 +230,11 @@ UpdateCheckConfig::get( uno::UNO_QUERY_THROW ); aProperty.Value <<= OUString("/org.openoffice.Office.ExtensionManager/ExtensionUpdateData/IgnoredUpdates"); - aArgumentList[0] <<= aProperty; + aArgumentList = { uno::Any(aProperty) }; uno::Reference< container::XNameContainer > xIgnoredExt( xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", aArgumentList ), uno::UNO_QUERY_THROW ); aProperty.Value <<= OUString("/org.openoffice.Office.ExtensionManager/ExtensionUpdateData/AvailableUpdates"); - aArgumentList[0] <<= aProperty; + aArgumentList = { uno::Any(aProperty) }; uno::Reference< container::XNameContainer > xUpdateAvail( xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", aArgumentList ), uno::UNO_QUERY_THROW ); return new UpdateCheckConfig( xContainer, xUpdateAvail, xIgnoredExt, rListener ); @@ -321,7 +316,7 @@ UpdateCheckConfig::storeLocalFileName(const OUString& rLocalFileName, sal_Int64 { const sal_uInt8 nItems = 2; const OUString aNameList[nItems] = { OUString(LOCAL_FILE), OUString(DOWNLOAD_SIZE) }; - const uno::Any aValueList[nItems] = { uno::makeAny(rLocalFileName), uno::makeAny(nFileSize) }; + const uno::Any aValueList[nItems] = { uno::Any(rLocalFileName), uno::Any(nFileSize) }; for( sal_uInt8 i=0; i < nItems; ++i ) { @@ -352,7 +347,7 @@ UpdateCheckConfig::clearLocalFileName() void UpdateCheckConfig::storeDownloadPaused(bool paused) { - replaceByName(DOWNLOAD_PAUSED , uno::makeAny(paused)); + replaceByName(DOWNLOAD_PAUSED , uno::Any(paused)); commitChanges(); } @@ -364,7 +359,7 @@ UpdateCheckConfig::updateLastChecked() sal_Int64 lastCheck = systime.Seconds; - replaceByName(LAST_CHECK, uno::makeAny(lastCheck)); + replaceByName(LAST_CHECK, uno::Any(lastCheck)); } void @@ -375,17 +370,17 @@ UpdateCheckConfig::storeUpdateFound( const UpdateInfo& rInfo, const OUString& aC uno::Any aValues[nUpdateEntryProperties] = { - uno::makeAny(rInfo.Version), - uno::makeAny(rInfo.BuildId), - uno::makeAny(rInfo.Description), - uno::makeAny(rInfo.Sources[0].URL), - uno::makeAny(rInfo.Sources[0].IsDirect), - uno::makeAny(getReleaseNote(rInfo, 1, autoDownloadEnabled) ), - uno::makeAny(getReleaseNote(rInfo, 2, autoDownloadEnabled) ), - uno::makeAny(getReleaseNote(rInfo, 3, autoDownloadEnabled) ), - uno::makeAny(getReleaseNote(rInfo, 4, autoDownloadEnabled) ), - uno::makeAny(getReleaseNote(rInfo, 5, autoDownloadEnabled) ), - uno::makeAny(aCurrentBuild) + uno::Any(rInfo.Version), + uno::Any(rInfo.BuildId), + uno::Any(rInfo.Description), + uno::Any(rInfo.Sources[0].URL), + uno::Any(rInfo.Sources[0].IsDirect), + uno::Any(getReleaseNote(rInfo, 1, autoDownloadEnabled) ), + uno::Any(getReleaseNote(rInfo, 2, autoDownloadEnabled) ), + uno::Any(getReleaseNote(rInfo, 3, autoDownloadEnabled) ), + uno::Any(getReleaseNote(rInfo, 4, autoDownloadEnabled) ), + uno::Any(getReleaseNote(rInfo, 5, autoDownloadEnabled) ), + uno::Any(aCurrentBuild) }; OUString aName; @@ -407,9 +402,9 @@ UpdateCheckConfig::clearUpdateFound() { OUString aName; - for(const char* aUpdateEntryPropertie : aUpdateEntryProperties) + for(const char* aUpdateEntryProperty : aUpdateEntryProperties) { - aName = OUString::createFromAscii(aUpdateEntryPropertie); + aName = OUString::createFromAscii(aUpdateEntryProperty); try { if( m_xContainer->hasByName(aName) ) @@ -417,7 +412,7 @@ UpdateCheckConfig::clearUpdateFound() } catch(const lang::WrappedTargetException& ) { // Can not remove value, probably in share layer OSL_ASSERT(false); - m_xContainer->replaceByName(aName, uno::makeAny(OUString())); + m_xContainer->replaceByName(aName, uno::Any(OUString())); } } diff --git a/extensions/source/update/check/updatecheckconfig.hxx b/extensions/source/update/check/updatecheckconfig.hxx index 3c6232ea8a93..a9836c624822 100644 --- a/extensions/source/update/check/updatecheckconfig.hxx +++ b/extensions/source/update/check/updatecheckconfig.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATECHECKCONFIG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATECHECKCONFIG_HXX +#pragma once #include <cppuhelper/implbase.hxx> #include <com/sun/star/beans/NamedValue.hpp> @@ -41,8 +40,6 @@ public: const css::uno::Sequence< css::beans::NamedValue >& rValues) : m_rValues(rValues) {} ; - ~NamedValueByNameAccess(); - css::uno::Any getValue(const char * pName); }; @@ -205,6 +202,4 @@ T getValue( const css::uno::Sequence< css::beans::NamedValue >& rNamedValues, co return T(); } -#endif // INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATECHECKCONFIG_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatecheckconfiglistener.hxx b/extensions/source/update/check/updatecheckconfiglistener.hxx index b251220de44e..903200f68c16 100644 --- a/extensions/source/update/check/updatecheckconfiglistener.hxx +++ b/extensions/source/update/check/updatecheckconfiglistener.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATECHECKCONFIGLISTENER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATECHECKCONFIGLISTENER_HXX +#pragma once #include <salhelper/simplereferenceobject.hxx> @@ -35,6 +34,4 @@ protected: virtual ~UpdateCheckConfigListener() override {} }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatecheckjob.cxx b/extensions/source/update/check/updatecheckjob.cxx index 977e7fbaa12f..b79c438108ee 100644 --- a/extensions/source/update/check/updatecheckjob.cxx +++ b/extensions/source/update/check/updatecheckjob.cxx @@ -30,7 +30,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> @@ -97,6 +97,8 @@ public: private: uno::Reference<uno::XComponentContext> m_xContext; + + std::mutex m_mutex; uno::Reference< frame::XDesktop2 > m_xDesktop; std::unique_ptr< InitUpdateCheckJobThread > m_pInitThread; @@ -205,10 +207,13 @@ UpdateCheckJob::execute(const uno::Sequence<beans::NamedValue>& namedValues) OUString aEventName = getValue< OUString > (aEnvironment, "EventName"); - m_pInitThread.reset( - new InitUpdateCheckJobThread( - m_xContext, aConfig, - aEventName != "onFirstVisibleTask")); + auto thread = std::make_unique<InitUpdateCheckJobThread >( + m_xContext, aConfig, + aEventName != "onFirstVisibleTask"); + { + std::scoped_lock l(m_mutex); + m_pInitThread = std::move(thread); + } return uno::Any(); } @@ -274,13 +279,18 @@ UpdateCheckJob::supportsService( OUString const & serviceName ) // XEventListener void SAL_CALL UpdateCheckJob::disposing( lang::EventObject const & rEvt ) { - bool shutDown = ( rEvt.Source == m_xDesktop ); + css::uno::Reference<css::frame::XDesktop2> desktop; + { + std::scoped_lock l(m_mutex); + if ( rEvt.Source == m_xDesktop ) { + std::swap(m_xDesktop, desktop); + } + } - if ( shutDown && m_xDesktop.is() ) + if ( desktop.is() ) { terminateAndJoinThread(); - m_xDesktop->removeTerminateListener( this ); - m_xDesktop.clear(); + desktop->removeTerminateListener( this ); } } @@ -292,11 +302,15 @@ void SAL_CALL UpdateCheckJob::queryTermination( lang::EventObject const & ) void UpdateCheckJob::terminateAndJoinThread() { - if (m_pInitThread != nullptr) + std::unique_ptr<InitUpdateCheckJobThread> thread; + { + std::scoped_lock l(m_mutex); + std::swap(m_pInitThread, thread); + } + if (thread != nullptr) { - m_pInitThread->setTerminating(); - m_pInitThread->join(); - m_pInitThread.reset(); + thread->setTerminating(); + thread->join(); } } @@ -314,7 +328,7 @@ extensions_update_UpdateCheckJob_get_implementation( css::uno::Reference<css::frame::XDesktop2> desktop( css::frame::Desktop::create(context)); rtl::Reference<UpdateCheckJob> job(new UpdateCheckJob(context, desktop)); - desktop->addTerminateListener(job.get()); + desktop->addTerminateListener(job); return cppu::acquire(job.get()); } diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index e2d95bc8e84e..a5c6429aee69 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstddef> #include "updatehdl.hxx" #include <helpids.h> @@ -59,22 +62,22 @@ #include <strings.hrc> #include <unotools/resmgr.hxx> #include <tools/urlobj.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> -#define COMMAND_CLOSE "close" +constexpr OUString COMMAND_CLOSE = u"close"_ustr; -#define CTRL_THROBBER "throbber" -#define CTRL_PROGRESS "progress" +constexpr OUString CTRL_THROBBER = u"throbber"_ustr; +constexpr OUString CTRL_PROGRESS = u"progress"_ustr; -#define TEXT_STATUS "text_status" -#define TEXT_PERCENT "text_percent" -#define TEXT_DESCRIPTION "text_description" +constexpr OUString TEXT_STATUS = u"text_status"_ustr; +constexpr OUString TEXT_PERCENT = u"text_percent"_ustr; +constexpr OUString TEXT_DESCRIPTION = u"text_description"_ustr; -#define FIXED_LINE_MODEL "com.sun.star.awt.UnoControlFixedLineModel" -#define FIXED_TEXT_MODEL "com.sun.star.awt.UnoControlFixedTextModel" -#define EDIT_FIELD_MODEL "com.sun.star.awt.UnoControlEditModel" -#define BUTTON_MODEL "com.sun.star.awt.UnoControlButtonModel" -#define GROUP_BOX_MODEL "com.sun.star.awt.UnoControlGroupBoxModel" +constexpr OUStringLiteral FIXED_LINE_MODEL = u"com.sun.star.awt.UnoControlFixedLineModel"; +constexpr OUString FIXED_TEXT_MODEL = u"com.sun.star.awt.UnoControlFixedTextModel"_ustr; +constexpr OUString EDIT_FIELD_MODEL = u"com.sun.star.awt.UnoControlEditModel"_ustr; +constexpr OUString BUTTON_MODEL = u"com.sun.star.awt.UnoControlButtonModel"_ustr; +constexpr OUString GROUP_BOX_MODEL = u"com.sun.star.awt.UnoControlGroupBoxModel"_ustr; using namespace com::sun::star; @@ -142,7 +145,7 @@ void UpdateHandler::setDownloadBtnLabel( bool bAppendDots ) aLabel += "..."; setControlProperty( msButtonIDs[DOWNLOAD_BUTTON], "Label", uno::Any( aLabel ) ); - setControlProperty( msButtonIDs[DOWNLOAD_BUTTON], "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME HID_CHECK_FOR_UPD_DOWNLOAD2 ) ); + setControlProperty( msButtonIDs[DOWNLOAD_BUTTON], "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DOWNLOAD2 )) ); mbDownloadBtnHasDots = bAppendDots; } @@ -240,13 +243,13 @@ void UpdateHandler::setErrorMessage( const OUString& rErrorMsg ) } -void UpdateHandler::setDownloadFile( const OUString& rFilePath ) +void UpdateHandler::setDownloadFile( std::u16string_view rFilePath ) { - sal_Int32 nLast = rFilePath.lastIndexOf( '/' ); - if ( nLast != -1 ) + std::size_t nLast = rFilePath.rfind( '/' ); + if ( nLast != std::u16string_view::npos ) { - msDownloadFile = rFilePath.copy( nLast+1 ); - const OUString aDownloadURL = rFilePath.copy( 0, nLast ); + msDownloadFile = rFilePath.substr( nLast+1 ); + const OUString aDownloadURL(rFilePath.substr( 0, nLast )); osl::FileBase::getSystemPathFromFileURL( aDownloadURL, msDownloadPath ); } } @@ -284,15 +287,6 @@ OUString UpdateHandler::getBubbleTitle( UpdateState eState ) } -OUString UpdateHandler::getDefaultInstErrMsg() -{ - osl::MutexGuard aGuard( maMutex ); - - loadStrings(); - - return substVariables( msInstallError ); -} - // XActionListener void SAL_CALL UpdateHandler::disposing( const lang::EventObject& rEvt ) @@ -347,10 +341,6 @@ void SAL_CALL UpdateHandler::actionPerformed( awt::ActionEvent const & rEvent ) case DOWNLOAD_BUTTON: mxActionListener->download(); break; - case INSTALL_BUTTON: - if ( showWarning( msInstallMessage ) ) - mxActionListener->install(); - break; case PAUSE_BUTTON: mxActionListener->pause(); break; @@ -570,10 +560,8 @@ void UpdateHandler::updateState( UpdateState eState ) break; case UPDATESTATE_DOWNLOAD_AVAIL: showControls( 0 ); - enableControls( (1<<CLOSE_BUTTON) + (1<<INSTALL_BUTTON) ); setControlProperty( TEXT_STATUS, "Text", uno::Any( substVariables(msReady2Install) ) ); setControlProperty( TEXT_DESCRIPTION, "Text", uno::Any( substVariables(msDownloadDescr) ) ); - focusControl( INSTALL_BUTTON ); break; case UPDATESTATE_AUTO_START: case UPDATESTATES_COUNT: @@ -585,7 +573,7 @@ void UpdateHandler::updateState( UpdateState eState ) } OUString UpdateHandler::loadString(const std::locale& rLocale, - const char* pResourceId) + TranslateId pResourceId) { return Translate::get(pResourceId, rLocale); } @@ -624,8 +612,6 @@ void UpdateHandler::loadStrings() msDownloading = loadString( loc, RID_UPDATE_STR_DOWNLOADING ); msReady2Install = loadString( loc, RID_UPDATE_STR_READY_INSTALL ); msCancelMessage = loadString( loc, RID_UPDATE_STR_CANCEL_DOWNLOAD ); - msInstallMessage = loadString( loc, RID_UPDATE_STR_BEGIN_INSTALL ); - msInstallError = loadString( loc, RID_UPDATE_STR_INSTALL_ERROR ); msOverwriteWarning = loadString( loc, RID_UPDATE_STR_OVERWRITE_WARNING ); msPercent = loadString( loc, RID_UPDATE_STR_PERCENT ); msReloadWarning = loadString( loc, RID_UPDATE_STR_RELOAD_WARNING ); @@ -637,12 +623,11 @@ void UpdateHandler::loadStrings() msClose = loadString( loc, RID_UPDATE_BTN_CLOSE ); msDownload = loadString( loc, RID_UPDATE_BTN_DOWNLOAD ); - msInstall = loadString( loc, RID_UPDATE_BTN_INSTALL ); msPauseBtn = loadString( loc, RID_UPDATE_BTN_PAUSE ); msResumeBtn = loadString( loc, RID_UPDATE_BTN_RESUME ); msCancelBtn = loadString( loc, RID_UPDATE_BTN_CANCEL ); - std::pair<const char*, const char*> RID_UPDATE_BUBBLE[] = + std::pair<TranslateId, TranslateId> RID_UPDATE_BUBBLE[] = { { RID_UPDATE_BUBBLE_UPDATE_AVAIL, RID_UPDATE_BUBBLE_T_UPDATE_AVAIL }, { RID_UPDATE_BUBBLE_UPDATE_NO_DOWN, RID_UPDATE_BUBBLE_T_UPDATE_NO_DOWN }, @@ -782,8 +767,7 @@ void UpdateHandler::setFullVersion( OUString& rString ) aProperty.Name = "nodepath"; aProperty.Value <<= OUString("org.openoffice.Setup/Product"); - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] <<= aProperty; + uno::Sequence< uno::Any > aArgumentList{ uno::Any(aProperty) }; uno::Reference< uno::XInterface > xConfigAccess = xConfigurationProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aArgumentList ); @@ -881,7 +865,7 @@ bool UpdateHandler::showWarning( const OUString &rWarningText, { uno::Sequence< uno::Reference< awt::XWindow > > xChildren = xMsgBoxCtrls->getWindows(); - for ( uno::Reference< awt::XWindow > const & child : std::as_const(xChildren) ) + for (uno::Reference<awt::XWindow> const& child : xChildren) { uno::Reference< awt::XVclWindowPeer > xMsgBoxCtrl( child, uno::UNO_QUERY ); if ( xMsgBoxCtrl.is() ) @@ -1033,7 +1017,7 @@ void UpdateHandler::createDialog() xPropSet->setPropertyValue( "PositionY", uno::Any(sal_Int32( 100 )) ); xPropSet->setPropertyValue( "Width", uno::Any(sal_Int32( DIALOG_WIDTH )) ); xPropSet->setPropertyValue( "Height", uno::Any(sal_Int32( DIALOG_HEIGHT )) ); - xPropSet->setPropertyValue( "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME HID_CHECK_FOR_UPD_DLG ) ); + xPropSet->setPropertyValue( "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DLG )) ); } { // Label (fixed text) <status> uno::Sequence< beans::NamedValue > aProps { { "Label", uno::Any( msStatusFL ) } }; @@ -1058,7 +1042,7 @@ void UpdateHandler::createDialog() { "MultiLine", uno::Any( true ) }, { "ReadOnly", uno::Any( true ) }, { "AutoVScroll", uno::Any( true ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME HID_CHECK_FOR_UPD_STATUS ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_STATUS )) } }; insertControlModel( xControlModel, EDIT_FIELD_MODEL, TEXT_STATUS, @@ -1071,7 +1055,7 @@ void UpdateHandler::createDialog() { // Text (edit) <percent> uno::Sequence< beans::NamedValue > aProps { - { "Text", uno::Any( msPercent ) }, + { "Text", uno::Any( substVariables(msPercent) ) }, { "Border", uno::Any( sal_Int16( 0 ) ) }, { "PaintTransparent", uno::Any( true ) }, { "ReadOnly", uno::Any( true ) }, @@ -1091,7 +1075,7 @@ void UpdateHandler::createDialog() { "Enabled", uno::Any( true ) }, { "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) }, { "Label", uno::Any( msPauseBtn ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME HID_CHECK_FOR_UPD_PAUSE ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_PAUSE )) } }; insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[PAUSE_BUTTON], @@ -1105,7 +1089,7 @@ void UpdateHandler::createDialog() { "Enabled", uno::Any( true ) }, { "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) }, { "Label", uno::Any( msResumeBtn ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME HID_CHECK_FOR_UPD_RESUME ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_RESUME )) } }; insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[RESUME_BUTTON], @@ -1122,7 +1106,7 @@ void UpdateHandler::createDialog() { "Enabled", uno::Any( true ) }, { "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) }, { "Label", uno::Any( msCancelBtn ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME HID_CHECK_FOR_UPD_CANCEL ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_CANCEL )) } }; insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[CANCEL_BUTTON], @@ -1155,7 +1139,7 @@ void UpdateHandler::createDialog() { "MultiLine", uno::Any( true ) }, { "ReadOnly", uno::Any( true ) }, { "AutoVScroll", uno::Any( true ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME HID_CHECK_FOR_UPD_DESCRIPTION ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DESCRIPTION )) } }; insertControlModel( xControlModel, EDIT_FIELD_MODEL, TEXT_DESCRIPTION, @@ -1184,27 +1168,13 @@ void UpdateHandler::createDialog() // setProperty( aProps, 2, "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_CANCEL) ) ); // [property] string Label // only if PushButtonType_STANDARD { "Label", uno::Any( msClose ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME HID_CHECK_FOR_UPD_CLOSE ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_CLOSE )) } }; insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[ CLOSE_BUTTON ], awt::Rectangle( CLOSE_BTN_X, BUTTON_Y_POS, BUTTON_WIDTH, BUTTON_HEIGHT ), aProps ); } - { // install button - uno::Sequence< beans::NamedValue > aProps - { - { "DefaultButton", uno::Any( false ) }, - { "Enabled", uno::Any( true ) }, - { "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) }, - { "Label", uno::Any( msInstall ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME HID_CHECK_FOR_UPD_INSTALL ) } - }; - - insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[INSTALL_BUTTON], - awt::Rectangle( INSTALL_BTN_X, BUTTON_Y_POS, BUTTON_WIDTH, BUTTON_HEIGHT ), - aProps ); - } { // download button uno::Sequence< beans::NamedValue > aProps { @@ -1212,7 +1182,7 @@ void UpdateHandler::createDialog() { "Enabled", uno::Any( true ) }, { "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) }, { "Label", uno::Any( msDownload ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME HID_CHECK_FOR_UPD_DOWNLOAD ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DOWNLOAD )) } }; insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[DOWNLOAD_BUTTON], diff --git a/extensions/source/update/check/updatehdl.hxx b/extensions/source/update/check/updatehdl.hxx index 71d59a97edd5..aa4e16fc765b 100644 --- a/extensions/source/update/check/updatehdl.hxx +++ b/extensions/source/update/check/updatehdl.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATEHDL_HXX -#define INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATEHDL_HXX +#pragma once #include <sal/config.h> @@ -37,6 +36,7 @@ #include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> #include <cppuhelper/implbase.hxx> +#include <unotools/resmgr.hxx> #include <rtl/ref.hxx> #include "actionlistener.hxx" @@ -46,7 +46,6 @@ enum DialogControls CANCEL_BUTTON = 0, PAUSE_BUTTON, RESUME_BUTTON, - INSTALL_BUTTON, DOWNLOAD_BUTTON, CLOSE_BUTTON, HELP_BUTTON, @@ -111,8 +110,6 @@ private: OUString msDownloading; // RID_UPDATE_STR_DOWNLOADING OUString msReady2Install; // RID_UPDATE_STR_READY_INSTALL OUString msCancelMessage; // RID_UPDATE_STR_CANCEL_DOWNLOAD - OUString msInstallMessage; // RID_UPDATE_STR_BEGIN_INSTALL - OUString msInstallError; // RID_UPDATE_STR_INSTALL_ERROR OUString msOverwriteWarning; // RID_UPDATE_STR_OVERWRITE_WARNING OUString msPercent; // RID_UPDATE_STR_PERCENT OUString msReloadWarning; // RID_UPDATE_STR_OVERWRITE_WARNING @@ -122,7 +119,6 @@ private: OUString msDescription; // RID_UPDATE_FT_DESCRIPTION OUString msClose; // RID_UPDATE_BTN_CLOSE OUString msDownload; // RID_UPDATE_BTN_DOWNLOAD - OUString msInstall; // RID_UPDATE_BTN_INSTALL OUString msPauseBtn; // RID_UPDATE_BTN_PAUSE OUString msResumeBtn; // RID_UPDATE_BTN_RESUME OUString msCancelBtn; // RID_UPDATE_BTN_CANCEL @@ -143,7 +139,7 @@ private: void setDownloadBtnLabel( bool bAppendDots ); void loadStrings(); static OUString loadString(const std::locale& rLocale, - const char* pResourceId); + TranslateId pResourceId); OUString substVariables( const OUString &rSource ) const; static void insertControlModel( css::uno::Reference< css::awt::XControlModel > const & rxDialogModel, OUString const & rServiceName, @@ -166,14 +162,13 @@ public: void setProgress( sal_Int32 nPercent ); void setNextVersion( const OUString &rNextVersion ) { msNextVersion = rNextVersion; } void setDownloadPath( const OUString &rPath ) { msDownloadPath = rPath; } - void setDownloadFile( const OUString &rPath ); + void setDownloadFile( std::u16string_view rPath ); void setErrorMessage( const OUString &rErrorMsg ); void setDescription( const OUString &rDescription ){ msDescriptionMsg = rDescription; } void setState( UpdateState eState ); OUString getBubbleText( UpdateState eState ); OUString getBubbleTitle( UpdateState eState ); - OUString getDefaultInstErrMsg(); bool showWarning( const OUString &rWarning ) const; bool showWarning( const OUString &rWarning, const OUString& rBtnText_1, const OUString& rBtnText_2 ) const; bool showOverwriteWarning( std::u16string_view rFileName ) const; @@ -204,6 +199,4 @@ public: virtual void SAL_CALL notifyTermination( const css::lang::EventObject& e ) override; }; -#endif // INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATEHDL_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updateinfo.hxx b/extensions/source/update/check/updateinfo.hxx index a63e2332a546..79387b3585e7 100644 --- a/extensions/source/update/check/updateinfo.hxx +++ b/extensions/source/update/check/updateinfo.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATEINFO_HXX -#define INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATEINFO_HXX +#pragma once #include <rtl/ustring.hxx> #include <vector> @@ -59,6 +58,4 @@ struct UpdateInfo // Returns the URL of the release note for the given position OUString getReleaseNote(const UpdateInfo& rInfo, sal_uInt8 pos, bool autoDownloadEnabled=false); -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updateprotocol.cxx b/extensions/source/update/check/updateprotocol.cxx index 4417565c4752..2fb6be85286a 100644 --- a/extensions/source/update/check/updateprotocol.cxx +++ b/extensions/source/update/check/updateprotocol.cxx @@ -61,8 +61,7 @@ getBootstrapData( if( !aValue.isEmpty() ) { - rRepositoryList.realloc(1); - rRepositoryList[0] = aValue; + rRepositoryList = { aValue }; } return true; @@ -144,7 +143,7 @@ checkForUpdates( if( aUpdateInfoEnumeration->nextElement() >>= aEntry ) { - uno::Reference< xml::dom::XNode > xNode( aEntry.UpdateDocument.get() ); + uno::Reference< xml::dom::XNode > xNode( aEntry.UpdateDocument ); uno::Reference< xml::dom::XNodeList > xNodeList; try { xNodeList = xXPath->selectNodeList(xNode, aXPathExpression @@ -164,7 +163,7 @@ checkForUpdates( OUString aType = xParent->getAttribute("type"); bool bIsDirect = !aType.equalsIgnoreAsciiCase("text/html"); - o_rUpdateInfo.Sources.push_back( DownloadSource(bIsDirect, xNode2->getNodeValue()) ); + o_rUpdateInfo.Sources.emplace_back(bIsDirect, xNode2->getNodeValue()); } } diff --git a/extensions/source/update/check/updateprotocol.hxx b/extensions/source/update/check/updateprotocol.hxx index 248fe2b2a389..4dedeb0d6cfd 100644 --- a/extensions/source/update/check/updateprotocol.hxx +++ b/extensions/source/update/check/updateprotocol.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATEPROTOCOL_HXX -#define INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATEPROTOCOL_HXX +#pragma once #include <sal/config.h> @@ -66,6 +65,4 @@ bool storeExtensionUpdateInfos( const css::uno::Sequence< css::uno::Sequence< OUString > > &rUpdateInfos ); -#endif // INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_UPDATEPROTOCOL_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx index 153233bbb67c..556955b7123c 100644 --- a/extensions/source/update/feed/updatefeed.cxx +++ b/extensions/source/update/feed/updatefeed.cxx @@ -53,6 +53,7 @@ #include <sal/log.hxx> #include <osl/diagnose.h> #include <osl/conditn.hxx> +#include <utility> #include <vcl/svapp.hxx> namespace beans = com::sun::star::beans ; @@ -69,7 +70,7 @@ namespace xml = com::sun::star::xml ; namespace { -#ifdef DEBUG +#if OSL_DEBUG_LEVEL >= 2 class InputStreamWrapper : public ::cppu::WeakImplHelper< io::XInputStream > { @@ -159,10 +160,10 @@ public: virtual sal_Bool SAL_CALL supportsService(OUString const & serviceName) override; virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - UpdateInformationProvider(const uno::Reference<uno::XComponentContext>& xContext, - const uno::Reference< ucb::XUniversalContentBroker >& xUniversalContentBroker, - const uno::Reference< xml::dom::XDocumentBuilder >& xDocumentBuilder, - const uno::Reference< xml::xpath::XXPathAPI >& xXPathAPI); + UpdateInformationProvider(uno::Reference<uno::XComponentContext> xContext, + uno::Reference< ucb::XUniversalContentBroker > xUniversalContentBroker, + uno::Reference< xml::dom::XDocumentBuilder > xDocumentBuilder, + uno::Reference< xml::xpath::XXPathAPI > xXPathAPI); protected: @@ -199,8 +200,8 @@ class UpdateInformationEnumeration : public ::cppu::WeakImplHelper< container::X { public: UpdateInformationEnumeration(const uno::Reference< xml::dom::XNodeList >& xNodeList, - const rtl::Reference< UpdateInformationProvider >& xUpdateInformationProvider) : - m_xUpdateInformationProvider(xUpdateInformationProvider), + rtl::Reference< UpdateInformationProvider > xUpdateInformationProvider) : + m_xUpdateInformationProvider(std::move(xUpdateInformationProvider)), m_xNodeList(xNodeList), m_nNodes(xNodeList.is() ? xNodeList->getLength() : 0), m_nCount(0) @@ -236,7 +237,7 @@ public: if( xContentNode.is() ) aEntry.UpdateDocument = m_xUpdateInformationProvider->getDocumentRoot(xContentNode); - return uno::makeAny(aEntry); + return uno::Any(aEntry); } catch( ucb::CommandAbortedException const &) { @@ -279,7 +280,7 @@ public: throw container::NoSuchElementException(OUString::number(m_nCount), *this); ++m_nCount; - return uno::makeAny(m_aEntry); + return uno::Any(m_aEntry); }; private: @@ -288,22 +289,23 @@ private: }; UpdateInformationProvider::UpdateInformationProvider( - const uno::Reference<uno::XComponentContext>& xContext, - const uno::Reference< ucb::XUniversalContentBroker >& xUniversalContentBroker, - const uno::Reference< xml::dom::XDocumentBuilder >& xDocumentBuilder, - const uno::Reference< xml::xpath::XXPathAPI >& xXPathAPI) - : m_xContext(xContext) - , m_xUniversalContentBroker(xUniversalContentBroker) - , m_xDocumentBuilder(xDocumentBuilder) - , m_xXPathAPI(xXPathAPI) + uno::Reference<uno::XComponentContext> xContext, + uno::Reference< ucb::XUniversalContentBroker > xUniversalContentBroker, + uno::Reference< xml::dom::XDocumentBuilder > xDocumentBuilder, + uno::Reference< xml::xpath::XXPathAPI > xXPathAPI) + : m_xContext(std::move(xContext)) + , m_xUniversalContentBroker(std::move(xUniversalContentBroker)) + , m_xDocumentBuilder(std::move(xDocumentBuilder)) + , m_xXPathAPI(std::move(xXPathAPI)) , m_aRequestHeaderList(2) , m_nCommandId(0) { uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider( css::configuration::theDefaultProvider::get(m_xContext)); - m_aRequestHeaderList[0].First = "Accept-Language"; - m_aRequestHeaderList[0].Second = getConfigurationItem( xConfigurationProvider, "org.openoffice.Setup/L10N", "ooLocale" ); + auto pRequestHeaderList = m_aRequestHeaderList.getArray(); + pRequestHeaderList[0].First = "Accept-Language"; + pRequestHeaderList[0].Second = getConfigurationItem( xConfigurationProvider, "org.openoffice.Setup/L10N", "ooLocale" ); } bool @@ -363,7 +365,9 @@ OUString UpdateInformationProvider::getUserAgent(bool bExtended) aUserAgent = aUserAgent.replaceAll("<PRODUCT>", product); aUserAgent = aUserAgent.replaceAll("<OPTIONAL_OS_HW_DATA>", aExtended); SAL_INFO("extensions.update", "UpdateUserAgent: " << aUserAgent); - + // if you want to debug online updates from a dev version, then uncommenting this (adjust for platform) + // might be helpful + // return "LibreOffice 7.3.5.2 (184fe81b8c8c30d8b5082578aee2fed2ea847c01; Linux; X86_64; )"; return aUserAgent; } @@ -385,8 +389,9 @@ uno::Sequence< beans::StringPair > SAL_CALL UpdateInformationProvider::getUserRe aPair.realloc(1); else { - aPair[1].First = "User-Agent"; - aPair[1].Second = aUserAgent; + auto pPair = aPair.getArray(); + pPair[1].First = "User-Agent"; + pPair[1].Second = aUserAgent; } return aPair; @@ -403,9 +408,7 @@ UpdateInformationProvider::getConfigurationItemAny(uno::Reference<lang::XMultiSe aProperty.Name = "nodepath"; aProperty.Value <<= node; - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] <<= aProperty; - + uno::Sequence< uno::Any > aArgumentList{ uno::Any(aProperty) }; uno::Reference< container::XNameAccess > xNameAccess( configurationProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", @@ -446,15 +449,13 @@ UpdateInformationProvider::load(const OUString& rURL) uno::Reference< ucb::XCommandProcessor > xCommandProcessor(m_xUniversalContentBroker->queryContent(xId), uno::UNO_QUERY_THROW); rtl::Reference< ActiveDataSink > aSink(new ActiveDataSink()); - // Disable KeepAlive in webdav - don't want millions of office - // instances phone home & clog up servers - uno::Sequence< beans::NamedValue > aProps { { "KeepAlive", uno::makeAny(false) } }; - ucb::OpenCommandArgument3 aOpenArgument; aOpenArgument.Mode = ucb::OpenMode::DOCUMENT; aOpenArgument.Priority = 32768; aOpenArgument.Sink = *aSink; - aOpenArgument.OpeningFlags = aProps; + // Disable KeepAlive in webdav - don't want millions of office + // instances phone home & clog up servers + aOpenArgument.OpeningFlags = { { "KeepAlive", uno::Any(false) } }; ucb::Command aCommand; aCommand.Name = "open"; @@ -524,7 +525,7 @@ UpdateInformationProvider::getDocumentRoot(const uno::Reference< xml::dom::XNode * seems to evaluate expression always relative to the root node. */ uno::Reference< xml::dom::XDocument > xUpdateXML = m_xDocumentBuilder->newDocument(); - xUpdateXML->appendChild( xUpdateXML->importNode(xChildElement.get(), true ) ); + xUpdateXML->appendChild( xUpdateXML->importNode(xChildElement, true ) ); return xUpdateXML->getDocumentElement(); } } @@ -582,7 +583,7 @@ UpdateInformationProvider::getUpdateInformationEnumeration( uno::Reference< xml::dom::XNodeList > xNodeList; try { - xNodeList = m_xXPathAPI->selectNodeList(xDocument.get(), + xNodeList = m_xXPathAPI->selectNodeList(xDocument, aXPathExpression); } catch (const xml::xpath::XPathException &) { // ignore diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index b34821ff936f..492cb92669ab 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -29,28 +29,22 @@ #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/task/XJob.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <unotools/resmgr.hxx> -#include <vcl/window.hxx> -#include <vcl/floatwin.hxx> -#include <vcl/timer.hxx> -#include <vcl/idle.hxx> -#include <vcl/lineinfo.hxx> -#include <vcl/menu.hxx> -#include <vcl/outdev.hxx> -#include <vcl/weld.hxx> -#include <vcl/settings.hxx> +#include <vcl/image.hxx> +#include <vcl/menubarupdateicon.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <sfx2/strings.hrc> -#include <rtl/ustrbuf.hxx> #include <bitmaps.hlst> -#define PROPERTY_TITLE "BubbleHeading" -#define PROPERTY_TEXT "BubbleText" -#define PROPERTY_IMAGE "BubbleImageURL" -#define PROPERTY_SHOW_BUBBLE "BubbleVisible" -#define PROPERTY_CLICK_HDL "MenuClickHDL" -#define PROPERTY_SHOW_MENUICON "MenuIconVisible" +constexpr OUString PROPERTY_TITLE = u"BubbleHeading"_ustr; +constexpr OUString PROPERTY_TEXT = u"BubbleText"_ustr; +constexpr OUString PROPERTY_IMAGE = u"BubbleImageURL"_ustr; +constexpr OUString PROPERTY_SHOW_BUBBLE = u"BubbleVisible"_ustr; +constexpr OUString PROPERTY_CLICK_HDL = u"MenuClickHDL"_ustr; +constexpr OUString PROPERTY_SHOW_MENUICON = u"MenuIconVisible"_ustr; using namespace ::com::sun::star; @@ -58,93 +52,22 @@ using namespace ::com::sun::star; namespace { -Image GetMenuBarIcon( MenuBar const * pMBar ) -{ - OUString sResID; - vcl::Window *pMBarWin = pMBar->GetWindow(); - sal_uInt32 nMBarHeight = 20; - - if ( pMBarWin ) - nMBarHeight = pMBarWin->GetOutputSizePixel().getHeight(); - - if (nMBarHeight >= 35) - sResID = RID_UPDATE_AVAILABLE_26; - else - sResID = RID_UPDATE_AVAILABLE_16; - - return Image(StockImage::Yes, sResID); -} - -class BubbleWindow : public FloatingWindow -{ - Point maTipPos; - vcl::Region maBounds; - tools::Polygon maRectPoly; - tools::Polygon maTriPoly; - OUString maBubbleTitle; - OUString maBubbleText; - Image maBubbleImage; - Size maMaxTextSize; - tools::Rectangle maTitleRect; - tools::Rectangle maTextRect; - tools::Long mnTipOffset; - -private: - void RecalcTextRects(); - -public: - BubbleWindow( vcl::Window* pParent, const OUString& rTitle, - const OUString& rText, const Image& rImage ); - - virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; - virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; - void Resize() override; - void Show( bool bVisible = true ); - void SetTipPosPixel( const Point& rTipPos ) { maTipPos = rTipPos; } - void SetTitleAndText( const OUString& rTitle, const OUString& rText, - const Image& rImage ); -}; - - class UpdateCheckUI : public ::cppu::WeakImplHelper < lang::XServiceInfo, document::XDocumentEventListener, beans::XPropertySet > { uno::Reference< uno::XComponentContext > m_xContext; uno::Reference< task::XJob > mrJob; - OUString maBubbleTitle; - OUString maBubbleText; OUString maBubbleImageURL; - Image maBubbleImage; - VclPtr<BubbleWindow> mpBubbleWin; - VclPtr<SystemWindow> mpIconSysWin; - VclPtr<MenuBar> mpIconMBar; + MenuBarUpdateIconManager maBubbleManager; std::locale maSfxLocale; - Idle maWaitIdle; - Timer maTimeoutTimer; - Link<VclWindowEvent&,void> maWindowEventHdl; - Link<VclSimpleEvent&,void> maApplicationEventHdl; - bool mbShowBubble; - bool mbShowMenuIcon; - bool mbBubbleChanged; - sal_uInt16 mnIconID; private: - DECL_LINK(ClickHdl, MenuBar::MenuBarButtonCallbackArg&, bool); - DECL_LINK(HighlightHdl, MenuBar::MenuBarButtonCallbackArg&, bool); - DECL_LINK(WaitTimeOutHdl, Timer *, void); - DECL_LINK(TimeOutHdl, Timer *, void); - DECL_LINK(UserEventHdl, void *, void); - DECL_LINK(WindowEventHdl, VclWindowEvent&, void); - DECL_LINK(ApplicationEventHdl, VclSimpleEvent&, void); - - VclPtr<BubbleWindow> GetBubbleWindow(); - void RemoveBubbleWindow( bool bRemoveIcon ); - void AddMenuBarIcon( SystemWindow* pSysWin, bool bAddEventHdl ); + DECL_LINK(ClickHdl, LinkParamNone*, void); + Image GetBubbleImage( OUString const &rURL ); public: explicit UpdateCheckUI(const uno::Reference<uno::XComponentContext>&); - virtual ~UpdateCheckUI() override; // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; @@ -169,36 +92,18 @@ public: const uno::Reference< beans::XVetoableChangeListener > & aListener) override; }; -UpdateCheckUI::UpdateCheckUI(const uno::Reference<uno::XComponentContext>& xContext) : - m_xContext(xContext) - , mpIconMBar( nullptr ) - , mbShowBubble( false ) - , mbShowMenuIcon( false ) - , mbBubbleChanged( false ) - , mnIconID( 0 ) +UpdateCheckUI::UpdateCheckUI(const uno::Reference<uno::XComponentContext>& xContext) + : m_xContext(xContext) { maSfxLocale = Translate::Create("sfx"); - maBubbleImage = GetBubbleImage( maBubbleImageURL ); - - maWaitIdle.SetPriority( TaskPriority::LOWEST ); - maWaitIdle.SetInvokeHandler( LINK( this, UpdateCheckUI, WaitTimeOutHdl ) ); - - maTimeoutTimer.SetTimeout( 10000 ); - maTimeoutTimer.SetInvokeHandler( LINK( this, UpdateCheckUI, TimeOutHdl ) ); - uno::Reference< document::XDocumentEventBroadcaster > xBroadcaster( frame::theGlobalEventBroadcaster::get(m_xContext) ); xBroadcaster->addDocumentEventListener( this ); - maWindowEventHdl = LINK( this, UpdateCheckUI, WindowEventHdl ); - maApplicationEventHdl = LINK( this, UpdateCheckUI, ApplicationEventHdl ); - Application::AddEventListener( maApplicationEventHdl ); -} + SolarMutexGuard aGuard; -UpdateCheckUI::~UpdateCheckUI() -{ - Application::RemoveEventListener( maApplicationEventHdl ); - RemoveBubbleWindow( true ); + maBubbleManager.SetBubbleImage(GetBubbleImage(maBubbleImageURL)); + maBubbleManager.SetClickHdl(LINK(this, UpdateCheckUI, ClickHdl)); } OUString SAL_CALL @@ -234,10 +139,8 @@ Image UpdateCheckUI::GetBubbleImage( OUString const &rURL ) try { uno::Reference< graphic::XGraphicProvider > xGraphProvider(graphic::GraphicProvider::create(xContext)); - uno::Sequence< beans::PropertyValue > aMediaProps( 1 ); - aMediaProps[0].Name = "URL"; - aMediaProps[0].Value <<= rURL; - + uno::Sequence< beans::PropertyValue > aMediaProps{ comphelper::makePropertyValue("URL", + rURL) }; uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( aMediaProps ); if ( xGraphic.is() ) { @@ -255,83 +158,23 @@ Image UpdateCheckUI::GetBubbleImage( OUString const &rURL ) return aImage; } - -void UpdateCheckUI::AddMenuBarIcon( SystemWindow *pSysWin, bool bAddEventHdl ) -{ - if ( ! mbShowMenuIcon ) - return; - - SolarMutexGuard aGuard; - - MenuBar *pActiveMBar = pSysWin->GetMenuBar(); - if ( ( pSysWin != mpIconSysWin ) || ( pActiveMBar != mpIconMBar ) ) - { - if ( bAddEventHdl && mpIconSysWin ) - mpIconSysWin->RemoveEventListener( maWindowEventHdl ); - - RemoveBubbleWindow( true ); - - if ( pActiveMBar ) - { - OUStringBuffer aBuf; - if( !maBubbleTitle.isEmpty() ) - aBuf.append( maBubbleTitle ); - if( !maBubbleText.isEmpty() ) - { - if( !maBubbleTitle.isEmpty() ) - aBuf.append( "\n\n" ); - aBuf.append( maBubbleText ); - } - - Image aImage = GetMenuBarIcon( pActiveMBar ); - mnIconID = pActiveMBar->AddMenuBarButton( aImage, - LINK( this, UpdateCheckUI, ClickHdl ), - aBuf.makeStringAndClear() - ); - pActiveMBar->SetMenuBarButtonHighlightHdl( mnIconID, - LINK( this, UpdateCheckUI, HighlightHdl ) ); - } - mpIconMBar = pActiveMBar; - mpIconSysWin = pSysWin; - if ( bAddEventHdl && mpIconSysWin ) - mpIconSysWin->AddEventListener( maWindowEventHdl ); - } - - if ( mbShowBubble && pActiveMBar ) - { - mpBubbleWin = GetBubbleWindow(); - if ( mpBubbleWin ) - { - mpBubbleWin->Show(); - maTimeoutTimer.Start(); - } - mbShowBubble = false; - } -} - - void SAL_CALL UpdateCheckUI::documentEventOccured(const document::DocumentEvent& rEvent) { SolarMutexGuard aGuard; if( rEvent.EventName == "OnPrepareViewClosing" ) - { - RemoveBubbleWindow( true ); - } + maBubbleManager.RemoveBubbleWindow(); } - void SAL_CALL UpdateCheckUI::disposing(const lang::EventObject&) { } - uno::Reference< beans::XPropertySetInfo > UpdateCheckUI::getPropertySetInfo() { return nullptr; } - void UpdateCheckUI::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue) { @@ -341,32 +184,23 @@ void UpdateCheckUI::setPropertyValue(const OUString& rPropertyName, if( rPropertyName == PROPERTY_TITLE ) { rValue >>= aString; - if ( aString != maBubbleTitle ) { - maBubbleTitle = aString; - mbBubbleChanged = true; - } + maBubbleManager.SetBubbleTitle(aString); } else if( rPropertyName == PROPERTY_TEXT ) { rValue >>= aString; - if ( aString != maBubbleText ) { - maBubbleText = aString; - mbBubbleChanged = true; - } + maBubbleManager.SetBubbleText(aString); } else if( rPropertyName == PROPERTY_IMAGE ) { rValue >>= aString; if ( aString != maBubbleImageURL ) { maBubbleImageURL = aString; - maBubbleImage = GetBubbleImage( maBubbleImageURL ); - mbBubbleChanged = true; + maBubbleManager.SetBubbleImage(GetBubbleImage(maBubbleImageURL)); } } else if( rPropertyName == PROPERTY_SHOW_BUBBLE ) { - rValue >>= mbShowBubble; - if ( mbShowBubble ) - Application::PostUserEvent( LINK( this, UpdateCheckUI, UserEventHdl ) ); - else if ( mpBubbleWin ) - mpBubbleWin->Show( false ); + bool bShowBubble= false; + rValue >>= bShowBubble; + maBubbleManager.SetShowBubble(bShowBubble); } else if( rPropertyName == PROPERTY_CLICK_HDL ) { uno::Reference< task::XJob > aJob; @@ -378,23 +212,12 @@ void UpdateCheckUI::setPropertyValue(const OUString& rPropertyName, else if (rPropertyName == PROPERTY_SHOW_MENUICON ) { bool bShowMenuIcon = false; rValue >>= bShowMenuIcon; - if ( bShowMenuIcon != mbShowMenuIcon ) - { - mbShowMenuIcon = bShowMenuIcon; - if ( bShowMenuIcon ) - Application::PostUserEvent( LINK( this, UpdateCheckUI, UserEventHdl ) ); - else - RemoveBubbleWindow( true ); - } + maBubbleManager.SetShowMenuIcon(bShowMenuIcon); } else throw beans::UnknownPropertyException(rPropertyName); - - if ( mbBubbleChanged && mpBubbleWin ) - mpBubbleWin->Show( false ); } - uno::Any UpdateCheckUI::getPropertyValue(const OUString& rPropertyName) { SolarMutexGuard aGuard; @@ -402,17 +225,17 @@ uno::Any UpdateCheckUI::getPropertyValue(const OUString& rPropertyName) uno::Any aRet; if( rPropertyName == PROPERTY_TITLE ) - aRet <<= maBubbleTitle; + aRet <<= maBubbleManager.GetBubbleTitle(); else if( rPropertyName == PROPERTY_TEXT ) - aRet <<= maBubbleText; + aRet <<= maBubbleManager.GetBubbleText(); else if( rPropertyName == PROPERTY_SHOW_BUBBLE ) - aRet <<= mbShowBubble; + aRet <<= maBubbleManager.GetShowBubble(); else if( rPropertyName == PROPERTY_IMAGE ) aRet <<= maBubbleImageURL; else if( rPropertyName == PROPERTY_CLICK_HDL ) aRet <<= mrJob; else if( rPropertyName == PROPERTY_SHOW_MENUICON ) - aRet <<= mbShowMenuIcon; + aRet <<= maBubbleManager.GetShowMenuIcon(); else throw beans::UnknownPropertyException(rPropertyName); @@ -433,91 +256,22 @@ void UpdateCheckUI::removePropertyChangeListener( const OUString& /*aPropertyNam //no bound properties } - void UpdateCheckUI::addVetoableChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) { //no vetoable properties } - void UpdateCheckUI::removeVetoableChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) { //no vetoable properties } - -VclPtr<BubbleWindow> UpdateCheckUI::GetBubbleWindow() -{ - if ( !mpIconSysWin ) - return nullptr; - - tools::Rectangle aIconRect = mpIconMBar->GetMenuBarButtonRectPixel( mnIconID ); - if( aIconRect.IsEmpty() ) - return nullptr; - - auto pBubbleWin = mpBubbleWin; - - if ( !pBubbleWin ) { - pBubbleWin = VclPtr<BubbleWindow>::Create( mpIconSysWin, maBubbleTitle, - maBubbleText, maBubbleImage ); - mbBubbleChanged = false; - } - else if ( mbBubbleChanged ) { - pBubbleWin->SetTitleAndText( maBubbleTitle, maBubbleText, - maBubbleImage ); - mbBubbleChanged = false; - } - - Point aWinPos = aIconRect.BottomCenter(); - - pBubbleWin->SetTipPosPixel( aWinPos ); - - return pBubbleWin; -} - - -void UpdateCheckUI::RemoveBubbleWindow( bool bRemoveIcon ) +IMPL_LINK_NOARG(UpdateCheckUI, ClickHdl, LinkParamNone*, void) { SolarMutexGuard aGuard; - maWaitIdle.Stop(); - maTimeoutTimer.Stop(); - - if ( mpBubbleWin ) - { - mpBubbleWin.disposeAndClear(); - } - - if ( bRemoveIcon ) - { - try { - if ( mpIconMBar && ( mnIconID != 0 ) ) - { - mpIconMBar->RemoveMenuBarButton( mnIconID ); - mpIconMBar = nullptr; - mnIconID = 0; - } - } - catch ( ... ) { - mpIconMBar = nullptr; - mnIconID = 0; - } - - mpIconSysWin = nullptr; - } -} - - -IMPL_LINK_NOARG(UpdateCheckUI, ClickHdl, MenuBar::MenuBarButtonCallbackArg&, bool) -{ - SolarMutexGuard aGuard; - - maWaitIdle.Stop(); - if ( mpBubbleWin ) - mpBubbleWin->Show( false ); - if ( mrJob.is() ) { try { @@ -531,349 +285,8 @@ IMPL_LINK_NOARG(UpdateCheckUI, ClickHdl, MenuBar::MenuBarButtonCallbackArg&, boo xErrorBox->run(); } } - - return false; -} - - -IMPL_LINK( UpdateCheckUI, HighlightHdl, MenuBar::MenuBarButtonCallbackArg&, rData, bool ) -{ - if ( rData.bHighlight ) - maWaitIdle.Start(); - else - RemoveBubbleWindow( false ); - - return false; -} - - -IMPL_LINK_NOARG(UpdateCheckUI, WaitTimeOutHdl, Timer *, void) -{ - SolarMutexGuard aGuard; - - mpBubbleWin = GetBubbleWindow(); - - if ( mpBubbleWin ) - { - mpBubbleWin->Show(); - } -} - - -IMPL_LINK_NOARG(UpdateCheckUI, TimeOutHdl, Timer *, void) -{ - RemoveBubbleWindow( false ); -} - - -IMPL_LINK_NOARG(UpdateCheckUI, UserEventHdl, void*, void) -{ - SolarMutexGuard aGuard; - - vcl::Window *pTopWin = Application::GetFirstTopLevelWindow(); - vcl::Window *pActiveWin = Application::GetActiveTopWindow(); - SystemWindow *pActiveSysWin = nullptr; - - vcl::Window *pBubbleWin = nullptr; - if ( mpBubbleWin ) - pBubbleWin = mpBubbleWin; - - if ( pActiveWin && ( pActiveWin != pBubbleWin ) && pActiveWin->IsTopWindow() ) - pActiveSysWin = pActiveWin->GetSystemWindow(); - - if ( pActiveWin == pBubbleWin ) - pActiveSysWin = nullptr; - - while ( !pActiveSysWin && pTopWin ) - { - if ( ( pTopWin != pBubbleWin ) && pTopWin->IsTopWindow() ) - pActiveSysWin = pTopWin->GetSystemWindow(); - if ( !pActiveSysWin ) - pTopWin = Application::GetNextTopLevelWindow( pTopWin ); - } - - if ( pActiveSysWin ) - AddMenuBarIcon( pActiveSysWin, true ); -} - - -IMPL_LINK( UpdateCheckUI, WindowEventHdl, VclWindowEvent&, rEvent, void ) -{ - VclEventId nEventID = rEvent.GetId(); - - if ( VclEventId::ObjectDying == nEventID ) - { - SolarMutexGuard aGuard; - if ( mpIconSysWin == rEvent.GetWindow() ) - { - mpIconSysWin->RemoveEventListener( maWindowEventHdl ); - RemoveBubbleWindow( true ); - } - } - else if ( VclEventId::WindowMenubarAdded == nEventID ) - { - SolarMutexGuard aGuard; - vcl::Window *pWindow = rEvent.GetWindow(); - if ( pWindow ) - { - SystemWindow *pSysWin = pWindow->GetSystemWindow(); - if ( pSysWin ) - { - AddMenuBarIcon( pSysWin, false ); - } - } - } - else if ( VclEventId::WindowMenubarRemoved == nEventID ) - { - SolarMutexGuard aGuard; - MenuBar *pMBar = static_cast<MenuBar*>(rEvent.GetData()); - if ( pMBar && ( pMBar == mpIconMBar ) ) - RemoveBubbleWindow( true ); - } - else if ( ( nEventID == VclEventId::WindowMove ) || - ( nEventID == VclEventId::WindowResize ) ) - { - SolarMutexGuard aGuard; - if ( ( mpIconSysWin == rEvent.GetWindow() ) && - mpBubbleWin && ( mpIconMBar != nullptr ) ) - { - tools::Rectangle aIconRect = mpIconMBar->GetMenuBarButtonRectPixel( mnIconID ); - Point aWinPos = aIconRect.BottomCenter(); - mpBubbleWin->SetTipPosPixel( aWinPos ); - if ( mpBubbleWin->IsVisible() ) - mpBubbleWin->Show(); // This will recalc the screen position of the bubble - } - } } - -IMPL_LINK( UpdateCheckUI, ApplicationEventHdl, VclSimpleEvent&, rEvent, void) -{ - switch (rEvent.GetId()) - { - case VclEventId::WindowShow: - case VclEventId::WindowActivate: - case VclEventId::WindowGetFocus: { - SolarMutexGuard aGuard; - - vcl::Window *pWindow = static_cast< VclWindowEvent * >(&rEvent)->GetWindow(); - if ( pWindow && pWindow->IsTopWindow() ) - { - SystemWindow *pSysWin = pWindow->GetSystemWindow(); - MenuBar *pMBar = pSysWin ? pSysWin->GetMenuBar() : nullptr; - if (pMBar) - { - AddMenuBarIcon( pSysWin, true ); - } - } - break; - } - default: break; - } -} - - -#define TIP_HEIGHT 15 -#define TIP_WIDTH 7 -#define TIP_RIGHT_OFFSET 18 -#define BUBBLE_BORDER 10 -#define TEXT_MAX_WIDTH 300 -#define TEXT_MAX_HEIGHT 200 - - -BubbleWindow::BubbleWindow( vcl::Window* pParent, const OUString& rTitle, - const OUString& rText, const Image& rImage ) - : FloatingWindow( pParent, WB_SYSTEMWINDOW - | WB_OWNERDRAWDECORATION - | WB_NOBORDER - ) - , maBubbleTitle( rTitle ) - , maBubbleText( rText ) - , maBubbleImage( rImage ) - , maMaxTextSize( TEXT_MAX_WIDTH, TEXT_MAX_HEIGHT ) - , mnTipOffset( 0 ) -{ - SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetHelpColor() ) ); -} - -void BubbleWindow::Resize() -{ - SolarMutexGuard aGuard; - - FloatingWindow::Resize(); - - Size aSize = GetSizePixel(); - - if ( ( aSize.Height() < 20 ) || ( aSize.Width() < 60 ) ) - return; - - tools::Rectangle aRect( 0, TIP_HEIGHT, aSize.Width(), aSize.Height() - TIP_HEIGHT ); - maRectPoly = tools::Polygon( aRect, 6, 6 ); - vcl::Region aRegion( maRectPoly ); - tools::Long nTipOffset = aSize.Width() - TIP_RIGHT_OFFSET + mnTipOffset; - - Point aPointArr[4]; - aPointArr[0] = Point( nTipOffset, TIP_HEIGHT ); - aPointArr[1] = Point( nTipOffset, 0 ); - aPointArr[2] = Point( nTipOffset + TIP_WIDTH , TIP_HEIGHT ); - aPointArr[3] = Point( nTipOffset, TIP_HEIGHT ); - maTriPoly = tools::Polygon( 4, aPointArr ); - vcl::Region aTriRegion( maTriPoly ); - - aRegion.Union( aTriRegion); - maBounds = aRegion; - - SetWindowRegionPixel( maBounds ); -} - - -void BubbleWindow::SetTitleAndText( const OUString& rTitle, - const OUString& rText, - const Image& rImage ) -{ - maBubbleTitle = rTitle; - maBubbleText = rText; - maBubbleImage = rImage; - - Resize(); -} - - -void BubbleWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& /*rRect*/) -{ - SolarMutexGuard aGuard; - - LineInfo aThickLine( LineStyle::Solid, 2 ); - - DrawPolyLine( maRectPoly, aThickLine ); - DrawPolyLine( maTriPoly ); - - Color aOldLine = GetLineColor(); - Size aSize = GetSizePixel(); - tools::Long nTipOffset = aSize.Width() - TIP_RIGHT_OFFSET + mnTipOffset; - - SetLineColor( GetSettings().GetStyleSettings().GetHelpColor() ); - DrawLine( Point( nTipOffset+2, TIP_HEIGHT ), - Point( nTipOffset + TIP_WIDTH -1 , TIP_HEIGHT ), - aThickLine ); - SetLineColor( aOldLine ); - - Size aImgSize = maBubbleImage.GetSizePixel(); - - DrawImage( Point( BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT ), maBubbleImage ); - - vcl::Font aOldFont = GetFont(); - vcl::Font aBoldFont = aOldFont; - aBoldFont.SetWeight( WEIGHT_BOLD ); - - SetFont( aBoldFont ); - tools::Rectangle aTitleRect = maTitleRect; - aTitleRect.Move( aImgSize.Width(), 0 ); - DrawText( aTitleRect, maBubbleTitle, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); - - SetFont( aOldFont ); - tools::Rectangle aTextRect = maTextRect; - aTextRect.Move( aImgSize.Width(), 0 ); - DrawText( aTextRect, maBubbleText, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); -} - - -void BubbleWindow::MouseButtonDown( const MouseEvent& ) -{ - Show( false ); -} - - -void BubbleWindow::Show( bool bVisible ) -{ - SolarMutexGuard aGuard; - - if ( !bVisible ) - { - FloatingWindow::Show( bVisible ); - return; - } - - // don't show bubbles without a text - if ( ( maBubbleTitle.isEmpty() ) && ( maBubbleText.isEmpty() ) ) - return; - - Size aWindowSize = GetSizePixel(); - - Size aImgSize = maBubbleImage.GetSizePixel(); - - RecalcTextRects(); - - aWindowSize.setHeight( maTitleRect.GetHeight() * 7 / 4+ maTextRect.GetHeight() + - 3 * BUBBLE_BORDER + TIP_HEIGHT ); - - if ( maTitleRect.GetWidth() > maTextRect.GetWidth() ) - aWindowSize.setWidth( maTitleRect.GetWidth() ); - else - aWindowSize.setWidth( maTextRect.GetWidth() ); - - aWindowSize.setWidth( aWindowSize.Width() + 3 * BUBBLE_BORDER + aImgSize.Width() ); - - if ( aWindowSize.Height() < aImgSize.Height() + TIP_HEIGHT + 2 * BUBBLE_BORDER ) - aWindowSize.setHeight( aImgSize.Height() + TIP_HEIGHT + 2 * BUBBLE_BORDER ); - - Point aPos; - aPos.setX( maTipPos.X() - aWindowSize.Width() + TIP_RIGHT_OFFSET ); - aPos.setY( maTipPos.Y() ); - Point aScreenPos = GetParent()->OutputToAbsoluteScreenPixel( aPos ); - if ( aScreenPos.X() < 0 ) - { - mnTipOffset = aScreenPos.X(); - aPos.AdjustX( -mnTipOffset ); - } - SetPosSizePixel( aPos, aWindowSize ); - - FloatingWindow::Show( bVisible, ShowFlags::NoActivate ); -} - - -void BubbleWindow::RecalcTextRects() -{ - Size aTotalSize; - bool bFinished = false; - vcl::Font aOldFont = GetFont(); - vcl::Font aBoldFont = aOldFont; - - aBoldFont.SetWeight( WEIGHT_BOLD ); - - while ( !bFinished ) - { - SetFont( aBoldFont ); - - maTitleRect = GetTextRect( tools::Rectangle( Point( 0, 0 ), maMaxTextSize ), - maBubbleTitle, - DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); - - SetFont( aOldFont ); - maTextRect = GetTextRect( tools::Rectangle( Point( 0, 0 ), maMaxTextSize ), - maBubbleText, - DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); - - if ( maTextRect.GetHeight() < 10 ) - maTextRect.setHeight( 10 ); - - aTotalSize.setHeight( maTitleRect.GetHeight() + - aBoldFont.GetFontHeight() * 3 / 4 + - maTextRect.GetHeight() + - 3 * BUBBLE_BORDER + TIP_HEIGHT ); - if ( aTotalSize.Height() > maMaxTextSize.Height() ) - { - maMaxTextSize.setWidth( maMaxTextSize.Width() * 3 / 2 ); - maMaxTextSize.setHeight( maMaxTextSize.Height() * 3 / 2 ); - } - else - bFinished = true; - } - maTitleRect.Move( 2*BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT ); - maTextRect.Move( 2*BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT + maTitleRect.GetHeight() + aBoldFont.GetFontHeight() * 3 / 4 ); -} - - } // anonymous namespace diff --git a/extensions/test/ole/AxTestComponents/Basic.cpp b/extensions/test/ole/AxTestComponents/Basic.cpp index 8aad56e8af52..6195aba0a6f0 100644 --- a/extensions/test/ole/AxTestComponents/Basic.cpp +++ b/extensions/test/ole/AxTestComponents/Basic.cpp @@ -116,34 +116,26 @@ STDMETHODIMP CBasic::inObject(IDispatch *val) STDMETHODIMP CBasic::inoutBool(VARIANT_BOOL* val) { - VARIANT_BOOL aBool = *val; - *val = m_bool; - m_bool = aBool; + std::swap(*val, m_bool); return S_OK; } STDMETHODIMP CBasic::inoutByte(unsigned char* val) { - unsigned char aByte = *val; - *val = m_byte; - m_byte = aByte; + std::swap(*val, m_byte); return S_OK; } STDMETHODIMP CBasic::inoutShort(short *val) { - short aShort = *val; - *val = m_short; - m_short = aShort; + std::swap(*val, m_short); return S_OK; } STDMETHODIMP CBasic::inoutLong(long *val) { - long aLong = *val; - *val = m_long; - m_long = aLong; + std::swap(*val, m_long); return S_OK; } @@ -159,17 +151,13 @@ STDMETHODIMP CBasic::inoutString(BSTR *val) STDMETHODIMP CBasic::inoutFloat(float *val) { - float aFloat = *val; - *val = m_float; - m_float = aFloat; + std::swap(*val, m_float); return S_OK; } STDMETHODIMP CBasic::inoutDouble(double *val) { - double aDouble = *val; - *val = m_double; - m_double = aDouble; + std::swap(*val, m_double); return S_OK; } @@ -1033,9 +1021,7 @@ STDMETHODIMP CBasic::outCurrency(CY* val) STDMETHODIMP CBasic::inoutCurrency(CY* val) { - CY tmp = *val; - *val = m_cy; - m_cy = tmp; + std::swap(*val, m_cy); return S_OK; } @@ -1053,9 +1039,7 @@ STDMETHODIMP CBasic::outDate(DATE* val) STDMETHODIMP CBasic::inoutDate(DATE* val) { - DATE tmp = *val; - *val = m_date; - m_date = tmp; + std::swap(*val, m_date); return S_OK; } @@ -1098,10 +1082,7 @@ STDMETHODIMP CBasic::outDecimal(DECIMAL* val) STDMETHODIMP CBasic::inoutDecimal(DECIMAL* val) { - DECIMAL tmp; - tmp = * val; - * val = m_decimal; - m_decimal = tmp; + std::swap(*val, m_decimal); return S_OK; } @@ -1131,9 +1112,7 @@ STDMETHODIMP CBasic::outScode(SCODE* val) STDMETHODIMP CBasic::inoutSCode(SCODE* val) { - SCODE tmp = *val; - * val = m_scode; - m_scode = tmp; + std::swap(*val, m_scode); return S_OK; } @@ -1302,9 +1281,7 @@ STDMETHODIMP CBasic::prpMultiArg2GetValues(VARIANT* val1, VARIANT* valProperty) STDMETHODIMP CBasic::get_prpMultiArg3(LONG* val1, LONG* pVal) { - long aLong = *val1; - *val1 = m_long; - m_long = aLong; + std::swap(*val1, m_long); * pVal = m_long2; return S_OK; @@ -1312,9 +1289,7 @@ STDMETHODIMP CBasic::get_prpMultiArg3(LONG* val1, LONG* pVal) STDMETHODIMP CBasic::put_prpMultiArg3(LONG* val1, LONG newVal) { - long aLong = *val1; - *val1 = m_long; - m_long = aLong; + std::swap(*val1, m_long); m_long2 = newVal; return S_OK; diff --git a/extensions/test/ole/AxTestComponents/Foo.h b/extensions/test/ole/AxTestComponents/Foo.h index b46cbd3436aa..3d0dc5bb5c82 100644 --- a/extensions/test/ole/AxTestComponents/Foo.h +++ b/extensions/test/ole/AxTestComponents/Foo.h @@ -18,8 +18,7 @@ */ // Basic.h : Declaration of the CBasic -#ifndef INCLUDED_EXTENSIONS_TEST_OLE_AXTESTCOMPONENTS_FOO_H -#define INCLUDED_EXTENSIONS_TEST_OLE_AXTESTCOMPONENTS_FOO_H +#pragma once #include "resource.h" #import "AxTestComponents.tlb" no_namespace no_implementation raw_interfaces_only named_guids @@ -52,6 +51,4 @@ STDMETHOD(Foo)(IUnknown* val); public: }; -#endif //__BASIC_H_ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h index c84b2354525e..6705864dbd7d 100644 --- a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h +++ b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h @@ -18,8 +18,7 @@ */ // EvtListener.h : Declaration of CEvtListener -#ifndef INCLUDED_EXTENSIONS_TEST_OLE_EVENTLISTENERSAMPLE_EVENTLISTENER_EVTLISTENER_H -#define INCLUDED_EXTENSIONS_TEST_OLE_EVENTLISTENERSAMPLE_EVENTLISTENER_EVTLISTENER_H +#pragma once #include "resource.h" @@ -50,6 +49,4 @@ public: STDMETHOD(disposing)(IDispatch* source); }; -#endif // INCLUDED_EXTENSIONS_TEST_OLE_EVENTLISTENERSAMPLE_EVENTLISTENER_EVTLISTENER_H - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/MfcControl.cpp b/extensions/test/ole/MfcControl/MfcControl.cpp index cb7f723e399b..7ae701349996 100644 --- a/extensions/test/ole/MfcControl/MfcControl.cpp +++ b/extensions/test/ole/MfcControl/MfcControl.cpp @@ -27,7 +27,7 @@ static char THIS_FILE[] = __FILE__; #endif -CMfcControlApp NEAR theApp; +CMfcControlApp theApp; const GUID CDECL BASED_CODE _tlid = { 0xac221fb3, 0xa0d8, 0x11d4, { 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4 } }; diff --git a/extensions/test/ole/MfcControl/MfcControlCtl.cpp b/extensions/test/ole/MfcControl/MfcControlCtl.cpp index 402c0ccbf81e..e64ed65705c9 100644 --- a/extensions/test/ole/MfcControl/MfcControlCtl.cpp +++ b/extensions/test/ole/MfcControl/MfcControlCtl.cpp @@ -256,7 +256,7 @@ double CMfcControlCtrl::inDouble(double val) return val+1; } -VARIANT CMfcControlCtrl::inVariant(const VARIANT FAR& val) +VARIANT CMfcControlCtrl::inVariant(const VARIANT& val) { VARIANT vaResult; VariantInit(&vaResult); @@ -305,7 +305,7 @@ void CMfcControlCtrl::outLong(long* val) *val= 1234; } -void CMfcControlCtrl::outString(BSTR FAR* val) +void CMfcControlCtrl::outString(BSTR* val) { *val= SysAllocString(L"A string from CMfcControlCtrl::outString "); } @@ -320,14 +320,14 @@ void CMfcControlCtrl::outDouble(double* val) *val= 3.145; } -void CMfcControlCtrl::outVariant(VARIANT FAR* val) +void CMfcControlCtrl::outVariant(VARIANT* val) { VariantInit( val); val->vt= VT_BSTR; val->bstrVal= SysAllocString( L"a string in a VARIANT"); } -void CMfcControlCtrl::outObject(LPDISPATCH FAR* val) +void CMfcControlCtrl::outObject(LPDISPATCH* val) { //{BFE10EBE-8584-11D4-005004526AB4} HRESULT hr= S_OK; diff --git a/extensions/test/ole/MfcControl/MfcControlCtl.h b/extensions/test/ole/MfcControl/MfcControlCtl.h index 865085467ece..b1d74270b993 100644 --- a/extensions/test/ole/MfcControl/MfcControlCtl.h +++ b/extensions/test/ole/MfcControl/MfcControlCtl.h @@ -68,15 +68,15 @@ protected: afx_msg BSTR inString(BSTR* val); afx_msg float inFloat(float val); afx_msg double inDouble(double val); - afx_msg VARIANT inVariant(const VARIANT FAR& val); + afx_msg VARIANT inVariant(const VARIANT& val); afx_msg LPDISPATCH inObject(LPDISPATCH val); afx_msg void outShort(short* val); afx_msg void outLong(long* val); - afx_msg void outString(BSTR FAR* val); + afx_msg void outString(BSTR* val); afx_msg void outFloat(float* val); afx_msg void outDouble(double* val); - afx_msg void outVariant(VARIANT FAR* val); - afx_msg void outObject(LPDISPATCH FAR* val); + afx_msg void outVariant(VARIANT* val); + afx_msg void outObject(LPDISPATCH* val); //}}AFX_DISPATCH DECLARE_DISPATCH_MAP() diff --git a/extensions/test/ole/OleClient/axhost.hxx b/extensions/test/ole/OleClient/axhost.hxx index 759b6eff4bba..68a9069fb518 100644 --- a/extensions/test/ole/OleClient/axhost.hxx +++ b/extensions/test/ole/OleClient/axhost.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_EXTENSIONS_TEST_OLE_OLECLIENT_AXHOST_HXX -#define INCLUDED_EXTENSIONS_TEST_OLE_OLECLIENT_AXHOST_HXX +#pragma once #include <atlbase.h> extern CComModule _Module; @@ -47,7 +46,6 @@ public: LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); }; -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/OleConverterVar1/smartarray.h b/extensions/test/ole/OleConverterVar1/smartarray.h index 424fdb9c45e2..1c8fbd6e6e92 100644 --- a/extensions/test/ole/OleConverterVar1/smartarray.h +++ b/extensions/test/ole/OleConverterVar1/smartarray.h @@ -16,8 +16,7 @@ * 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_EXTENSIONS_TEST_OLE_OLECONVERTERVAR1_SMARTARRAY_H -#define INCLUDED_EXTENSIONS_TEST_OLE_OLECONVERTERVAR1_SMARTARRAY_H +#pragma once template< class sourceType> @@ -219,6 +218,5 @@ template <> SmartArray <IUnknown*>::SmartArray(sourceType * parParams, int count } SafeArrayUnaccessData( m_array); }; -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/VisualBasic/Module1.vb b/extensions/test/ole/VisualBasic/Module1.vb index 63b8bbdeb17f..56b83beb3cea 100644 --- a/extensions/test/ole/VisualBasic/Module1.vb +++ b/extensions/test/ole/VisualBasic/Module1.vb @@ -477,14 +477,14 @@ Public Sub Main() objOleTest2.AttrAny2 = "VBString "
'testinout_methodXInterfaces substitutes the argument with the object set in in_methodXInterface
- objOleTest.AttrAny2 = "VBString this string was written in the UNO component to the inout pararmeter"
+ objOleTest.AttrAny2 = "VBString this string was written in the UNO component to the inout parameter"
objOleTest.in_methodXInterface(objOleTest)
objOleTest.testinout_methodXInterface2(objOleTest2)
Dim tmpVar As Object
tmpVar = System.DBNull.Value
tmpVar = objOleTest2.AttrAny2
Debug.Print("in: Uno out: the same object // " & CStr(tmpVar))
- If tmpVar <> "VBString this string was written in the UNO component to the inout pararmeter" Then
+ If tmpVar <> "VBString this string was written in the UNO component to the inout parameter" Then
MsgBox("error")
End If
diff --git a/extensions/test/ole/cpnt/cpnt.cxx b/extensions/test/ole/cpnt/cpnt.cxx index 3369e03d644b..ec7bac088b59 100644 --- a/extensions/test/ole/cpnt/cpnt.cxx +++ b/extensions/test/ole/cpnt/cpnt.cxx @@ -25,7 +25,7 @@ #include <stdio.h> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/registry/XRegistryKey.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <uno/environment.h> #include <comphelper/processfactory.hxx> #include <cppuhelper/factory.hxx> @@ -390,88 +390,88 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( Sequence<sal_Int8> SAL_CALL OComponent::methodByte(const Sequence< sal_Int8 >& aSeq) throw( RuntimeException ) { sal_Int8 _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; + for( const auto& i : aSeq.getConstArray() ){ + _x= i; } return aSeq; } Sequence<float> SAL_CALL OComponent::methodFloat(const Sequence< float>& aSeq) throw( RuntimeException ) { float _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; + for( const auto& i : aSeq.getConstArray() ){ + _x= i; } return aSeq; } Sequence<double> SAL_CALL OComponent::methodDouble(const Sequence< double >& aSeq) throw( RuntimeException) { double _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; + for( const auto& i : aSeq.getConstArray() ){ + _x= i; } return aSeq; } Sequence< sal_Bool > SAL_CALL OComponent::methodBool(const Sequence< sal_Bool >& aSeq) throw( RuntimeException) { sal_Bool _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; + for( const auto& i : aSeq.getConstArray() ){ + _x= i; } return aSeq; } Sequence< sal_Int16 > SAL_CALL OComponent::methodShort(const Sequence< sal_Int16 >& aSeq) throw( RuntimeException ) { sal_Int16 _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; + for( const auto& i : aSeq.getConstArray() ){ + _x= i; } return aSeq; } Sequence< sal_uInt16 > SAL_CALL OComponent::methodUShort(const Sequence< sal_uInt16 >& aSeq) throw( RuntimeException ) { sal_uInt16 _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; + for( const auto& i : aSeq.getConstArray() ){ + _x= i; } return aSeq; } Sequence< sal_Int32 > SAL_CALL OComponent::methodLong(const Sequence< sal_Int32 >& aSeq) throw( RuntimeException) { sal_Int32 _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++) { - _x= aSeq.getConstArray()[i]; + for( const auto& i : aSeq.getConstArray() ){ + _x= i; } return aSeq; } Sequence< sal_uInt32 > SAL_CALL OComponent::methodULong(const Sequence< sal_uInt32 >& aSeq) throw( RuntimeException) { sal_uInt32 _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; + for( const auto& i : aSeq.getConstArray() ){ + _x= i; } return aSeq; } Sequence< OUString > SAL_CALL OComponent::methodString(const Sequence< OUString >& aSeq) throw( RuntimeException) { OUString _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++) { - _x= aSeq.getConstArray()[i]; + for( const auto& i : aSeq.getConstArray() ){ + _x= i; } return aSeq; } Sequence< sal_Unicode > SAL_CALL OComponent::methodChar(const Sequence< sal_Unicode >& aSeq) throw( RuntimeException) { sal_Unicode _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; + for( const auto& i : aSeq.getConstArray() ){ + _x= i; } return aSeq; } Sequence< Any > SAL_CALL OComponent::methodAny(const Sequence< Any >& aSeq) throw( RuntimeException) { Any _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; + for( const auto& i : aSeq.getConstArray() ){ + _x= i; TypeClass _t= _x.getValueTypeClass(); if( _t== TypeClass_STRING) OUString s(* (rtl_uString**)_x.getValue()); @@ -483,8 +483,8 @@ Sequence< Any > SAL_CALL OComponent::methodAny(const Sequence< Any >& aSeq) thro Sequence< Type > SAL_CALL OComponent::methodType(const Sequence< Type >& aSeq) throw( RuntimeException ) { Type _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; + for( const auto& i : aSeq.getConstArray() ){ + _x= i; } return aSeq; } @@ -1076,93 +1076,61 @@ void SAL_CALL OComponent::in_methodAll( // INOUT ----------------------------------------------------------------------------------- void SAL_CALL OComponent::testinout_methodByte(sal_Int8& rOut) throw( RuntimeException ) { - sal_Int8 tmp = rOut; - rOut = m_int8; - m_int8 = tmp; + std::swap( m_int8, rOut ); } void SAL_CALL OComponent::testinout_methodFloat(float& rOut) throw( RuntimeException ) { - float tmp = rOut; - rOut = m_float; - m_float = tmp; + std::swap( m_float, rOut ); } - void SAL_CALL OComponent::testinout_methodDouble(double& rOut) throw( RuntimeException ) { - double tmp = rOut; - rOut = m_double; - m_double = tmp; + std::swap( m_double, rOut ); } void SAL_CALL OComponent::testinout_methodBool(sal_Bool& rOut) throw( RuntimeException ) { - sal_Bool tmp = rOut; - rOut = m_bool; - m_bool = tmp; + std::swap( m_bool, rOut ); } void SAL_CALL OComponent::testinout_methodShort(sal_Int16& rOut) throw( RuntimeException ) { - sal_Int16 tmp= rOut; - rOut = m_int16; - m_int16 = tmp; + std::swap( m_int16, rOut ); } void SAL_CALL OComponent::testinout_methodUShort(sal_uInt16& rOut) throw( RuntimeException ) { - sal_uInt16 tmp = rOut; - rOut = m_uint16; - m_uint16 = tmp; + std::swap( m_uint16, rOut ); } void SAL_CALL OComponent::testinout_methodLong(sal_Int32& rOut) throw( RuntimeException ) { - sal_Int32 tmp = rOut; - rOut = m_int32; - m_int32 = tmp; + std::swap( m_int32, rOut ); } void SAL_CALL OComponent::testinout_methodULong(sal_uInt32& rOut) throw( RuntimeException ) { - sal_uInt32 tmp = rOut; - rOut = m_uint32; - m_uint32 = tmp; + std::swap( m_uint32, rOut ); } void SAL_CALL OComponent::testinout_methodHyper(sal_Int64& rOut) throw( RuntimeException ) { - sal_Int64 tmp = rOut; - rOut = m_int64; - m_int64 = tmp; + std::swap( m_int64, rOut ); } - void SAL_CALL OComponent::testinout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException ) { - sal_uInt64 tmp = rOut; - rOut = m_uint64; - m_uint64 = tmp; + std::swap( m_uint64, rOut ); } - void SAL_CALL OComponent::testinout_methodString(OUString& rOut) throw( RuntimeException ) { - OUString tmp = rOut; - rOut = m_string; - m_string = tmp; + std::swap( m_string, rOut ); } void SAL_CALL OComponent::testinout_methodChar(sal_Unicode& rOut) throw( RuntimeException) { - sal_Unicode tmp = rOut; - rOut = m_char; - m_char = tmp; + std::swap( m_char, rOut ); } void SAL_CALL OComponent::testinout_methodAny(Any& rOut) throw( RuntimeException) { - Any tmp = rOut; - rOut = m_any; - m_any = tmp; + std::swap( m_any, rOut ); } void SAL_CALL OComponent::testinout_methodType(Type& rOut) throw( RuntimeException) { - Type tmp = rOut; - rOut = m_type; - m_type = tmp; + std::swap( m_type, rOut ); } - void SAL_CALL OComponent::testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException) { diff --git a/extensions/test/ole/idl/oletest.idl b/extensions/test/ole/idl/oletest.idl index b23f20b21a65..a004fc84b3b6 100644 --- a/extensions/test/ole/idl/oletest.idl +++ b/extensions/test/ole/idl/oletest.idl @@ -17,11 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <com/sun/star/uno/XInterface.idl> -#include <com/sun/star/script/XInvocation.idl> -#include <com/sun/star/beans/XPropertySet.idl> -#include <com/sun/star/lang/XEventListener.idl> - module oletest { diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h index 810c1a8964c1..941d1202fcb8 100644 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h @@ -18,8 +18,7 @@ */ // Callback.h : Declaration of the CCallback -#ifndef INCLUDED_EXTENSIONS_TEST_OLE_UNOTOCOMCALLS_XCALLBACK_IMPL_CALLBACK_H -#define INCLUDED_EXTENSIONS_TEST_OLE_UNOTOCOMCALLS_XCALLBACK_IMPL_CALLBACK_H +#pragma once #include "resource.h" @@ -123,7 +122,5 @@ public: STDMETHOD(func1)(); }; -#endif // INCLUDED_EXTENSIONS_TEST_OLE_UNOTOCOMCALLS_XCALLBACK_IMPL_CALLBACK_H - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h index cf140245e969..8abe5627078c 100644 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h @@ -18,8 +18,7 @@ */ // Simple.h : Declaration of the CSimple -#ifndef INCLUDED_EXTENSIONS_TEST_OLE_UNOTOCOMCALLS_XCALLBACK_IMPL_SIMPLE_H -#define INCLUDED_EXTENSIONS_TEST_OLE_UNOTOCOMCALLS_XCALLBACK_IMPL_SIMPLE_H +#pragma once #include "resource.h" @@ -53,6 +52,4 @@ public: STDMETHOD(func)( BSTR message); }; -#endif // INCLUDED_EXTENSIONS_TEST_OLE_UNOTOCOMCALLS_XCALLBACK_IMPL_SIMPLE_H - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/uiconfig/sabpilot/ui/datasourcepage.ui b/extensions/uiconfig/sabpilot/ui/datasourcepage.ui index 942653057d24..3a5ef24196e6 100644 --- a/extensions/uiconfig/sabpilot/ui/datasourcepage.ui +++ b/extensions/uiconfig/sabpilot/ui/datasourcepage.ui @@ -131,7 +131,7 @@ Now, just enter the name under which you want to register the data source in %PR <property name="draw_indicator">True</property> <child internal-child="accessible"> <object class="AtkObject" id="available-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="datasourcepage|extended_tip|available">Registers the newly created database file in %PRODUCTNAME. The database will then be listed in the Data sources pane (Ctrl+Shift+F4). If this check box is cleared, the database will be available only by opening the database file.</property> + <property name="AtkObject::accessible-description" translatable="yes" context="datasourcepage|extended_tip|available">Registers the newly created database file in the office suite. The database will then be listed in the Data sources pane (Ctrl+Shift+F4). If this check box is cleared, the database will be available only by opening the database file.</property> </object> </child> </object> diff --git a/extensions/uiconfig/sabpilot/ui/defaultfieldselectionpage.ui b/extensions/uiconfig/sabpilot/ui/defaultfieldselectionpage.ui index 140b926eb98c..f244af27ec56 100644 --- a/extensions/uiconfig/sabpilot/ui/defaultfieldselectionpage.ui +++ b/extensions/uiconfig/sabpilot/ui/defaultfieldselectionpage.ui @@ -81,7 +81,6 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="active">True</property> <property name="draw_indicator">True</property> <property name="group">defaultselectionyes</property> </object> diff --git a/extensions/uiconfig/sabpilot/ui/selecttablepage.ui b/extensions/uiconfig/sabpilot/ui/selecttablepage.ui index 0ef0e0f8ef11..55fbb5e9c6c5 100644 --- a/extensions/uiconfig/sabpilot/ui/selecttablepage.ui +++ b/extensions/uiconfig/sabpilot/ui/selecttablepage.ui @@ -74,7 +74,7 @@ Please select the one you mainly want to work with:</property> </child> <child internal-child="accessible"> <object class="AtkObject" id="table-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="selecttablepage|extended_tip|table">Specifies the table that is to serve as the address book for the %PRODUCTNAME templates.</property> + <property name="AtkObject::accessible-description" translatable="yes" context="selecttablepage|extended_tip|table">Specifies the table that is to serve as the address book for the office suite templates.</property> </object> </child> </object> @@ -87,7 +87,7 @@ Please select the one you mainly want to work with:</property> </child> <child internal-child="accessible"> <object class="AtkObject" id="SelectTablePage-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="selecttablepage|extended_tip|SelectTablePage">Specifies a table from the Seamonkey / Netscape address book source that is used as the address book in %PRODUCTNAME.</property> + <property name="AtkObject::accessible-description" translatable="yes" context="selecttablepage|extended_tip|SelectTablePage">Specifies a table from the Seamonkey / Netscape address book source that is used as the address book in the office suite.</property> </object> </child> </object> diff --git a/extensions/uiconfig/sabpilot/ui/selecttypepage.ui b/extensions/uiconfig/sabpilot/ui/selecttypepage.ui index fe48c96d9cfc..5627482afac8 100644 --- a/extensions/uiconfig/sabpilot/ui/selecttypepage.ui +++ b/extensions/uiconfig/sabpilot/ui/selecttypepage.ui @@ -1,51 +1,51 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.36.0 --> +<!-- Generated with glade 3.38.2 --> <interface domain="pcr"> <requires lib="gtk+" version="3.20"/> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=1 n-rows=2 --> <object class="GtkGrid" id="SelectTypePage"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">6</property> - <property name="row_spacing">12</property> + <property name="can-focus">False</property> + <property name="border-width">6</property> + <property name="row-spacing">12</property> <child> <object class="GtkLabel" id="label2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="selecttypepage|label2">%PRODUCTNAME lets you access address data already present in your system. To do this, a %PRODUCTNAME data source will be created in which your address data is available in tabular form. This wizard helps you create the data source.</property> <property name="wrap">True</property> - <property name="width_chars">70</property> - <property name="max_width_chars">70</property> + <property name="width-chars">70</property> + <property name="max-width-chars">70</property> <property name="xalign">0</property> <property name="yalign">0</property> <child internal-child="accessible"> <object class="AtkObject" id="label2-atkobject"> - <property name="AtkObject::accessible-role" translatable="no">static</property> + <property name="AtkObject::accessible-role">static</property> </object> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> <child> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=1 n-rows=9 --> <object class="GtkGrid" id="grid1"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> + <property name="can-focus">False</property> + <property name="row-spacing">6</property> <child> <object class="GtkRadioButton" id="evolution"> <property name="label" translatable="yes" context="selecttypepage|evolution">Evolution</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> <property name="active">True</property> - <property name="draw_indicator">True</property> + <property name="draw-indicator">True</property> <child internal-child="accessible"> <object class="AtkObject" id="evolution-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="selecttypepage|extended_tip|evolution">Select this option if you already use an address book in Evolution.</property> @@ -53,18 +53,18 @@ This wizard helps you create the data source.</property> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkRadioButton" id="groupwise"> <property name="label" translatable="yes" context="selecttypepage|groupwise">Groupwise</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> <property name="group">evolution</property> <child internal-child="accessible"> <object class="AtkObject" id="groupwise-atkobject"> @@ -73,18 +73,18 @@ This wizard helps you create the data source.</property> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkRadioButton" id="evoldap"> <property name="label" translatable="yes" context="selecttypepage|evoldap">Evolution LDAP</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> <property name="group">evolution</property> <child internal-child="accessible"> <object class="AtkObject" id="evoldap-atkobject"> @@ -93,18 +93,18 @@ This wizard helps you create the data source.</property> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left-attach">0</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkRadioButton" id="thunderbird"> <property name="label" translatable="yes" context="selecttypepage|thunderbird">Thunderbird</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> <property name="group">evolution</property> <child internal-child="accessible"> <object class="AtkObject" id="thunderbird-atkobject"> @@ -113,38 +113,38 @@ This wizard helps you create the data source.</property> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> + <property name="left-attach">0</property> + <property name="top-attach">5</property> </packing> </child> <child> <object class="GtkRadioButton" id="kde"> <property name="label" translatable="yes" context="selecttypepage|kde">KDE address book</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> <property name="group">evolution</property> <child internal-child="accessible"> <object class="AtkObject" id="kde-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="selecttypepage|extended_tip|kde">Select this option if you already use an address book in KDE Address book.</property> + <property name="AtkObject::accessible-description" translatable="yes" context="selecttypepage|extended_tip|kde">Select this option if you already use an address book in KDE Address book (KAddressBook).</property> </object> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">6</property> + <property name="left-attach">0</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkRadioButton" id="macosx"> - <property name="label" translatable="yes" context="selecttypepage|macosx">Mac OS X address book</property> + <property name="label" translatable="yes" context="selecttypepage|macosx">macOS address book</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> <property name="group">evolution</property> <child internal-child="accessible"> <object class="AtkObject" id="macosx-atkobject"> @@ -153,55 +153,58 @@ This wizard helps you create the data source.</property> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">7</property> + <property name="left-attach">0</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkRadioButton" id="other"> <property name="label" translatable="yes" context="selecttypepage|other">Other external data source</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> <property name="group">evolution</property> <child internal-child="accessible"> <object class="AtkObject" id="other-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="selecttypepage|extended_tip|other">Select this option if you want to register another data source as address book in %PRODUCTNAME.</property> + <property name="AtkObject::accessible-description" translatable="yes" context="selecttypepage|extended_tip|other">Select this option if you want to register another data source as address book in the office suite.</property> </object> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">8</property> + <property name="left-attach">0</property> + <property name="top-attach">8</property> </packing> </child> <child> <object class="GtkLabel" id="label1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="selecttypepage|label1">Select the type of your external address book:</property> <child internal-child="accessible"> <object class="AtkObject" id="label1-atkobject"> - <property name="AtkObject::accessible-role" translatable="no">static</property> + <property name="AtkObject::accessible-role">static</property> </object> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> + <child> + <placeholder/> + </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child internal-child="accessible"> <object class="AtkObject" id="SelectTypePage-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="selecttypepage|extended_tip|SelectTypePage">This wizard registers an existing address book as a data source in %PRODUCTNAME.</property> + <property name="AtkObject::accessible-description" translatable="yes" context="selecttypepage|extended_tip|SelectTypePage">This wizard registers an existing address book as a data source in the office suite.</property> </object> </child> </object> diff --git a/extensions/uiconfig/sbibliography/menubar/menubar.xml b/extensions/uiconfig/sbibliography/menubar/menubar.xml index 3604c1b760a1..9b449072ac32 100644 --- a/extensions/uiconfig/sbibliography/menubar/menubar.xml +++ b/extensions/uiconfig/sbibliography/menubar/menubar.xml @@ -39,10 +39,9 @@ <menu:menuseparator/> <menu:menuitem menu:id=".uno:MacroSignature"/> <menu:menuitem menu:id=".uno:MacroOrganizer?TabId:short=1"/> - <menu:menuseparator/> - <menu:menuitem menu:id=".uno:OpenXMLFilterSettings"/> </menu:menupopup> </menu:menu> + <menu:menuitem menu:id=".uno:OpenXMLFilterSettings"/> <menu:menuitem menu:id="service:com.sun.star.deployment.ui.PackageManagerDialog" menu:style="text"/> <menu:menuitem menu:id=".uno:ConfigureDialog" menu:style="text"/> <menu:menuitem menu:id=".uno:OptionsTreeDialog"/> diff --git a/extensions/uiconfig/sbibliography/ui/autofiltermenu.ui b/extensions/uiconfig/sbibliography/ui/autofiltermenu.ui new file mode 100644 index 000000000000..aa496513f25e --- /dev/null +++ b/extensions/uiconfig/sbibliography/ui/autofiltermenu.ui @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.38.2 --> +<interface domain="pcr"> + <requires lib="gtk+" version="3.20"/> + <object class="GtkMenu" id="menu"> + <property name="visible">True</property> + <property name="can-focus">False</property> + </object> +</interface> diff --git a/extensions/uiconfig/sbibliography/ui/generalpage.ui b/extensions/uiconfig/sbibliography/ui/generalpage.ui index dc22f8702019..4c0ebf76d188 100644 --- a/extensions/uiconfig/sbibliography/ui/generalpage.ui +++ b/extensions/uiconfig/sbibliography/ui/generalpage.ui @@ -1,588 +1,985 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.36.0 --> +<!-- Generated with glade 3.38.2 --> <interface domain="pcr"> <requires lib="gtk+" version="3.20"/> + <object class="GtkAdjustment" id="adjustment2"> + <property name="upper">55535</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkBox" id="GeneralPage"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="orientation">vertical</property> <child> <object class="GtkScrolledWindow" id="scrolledwindow"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="shadow_type">in</property> + <property name="shadow-type">in</property> <child> - <object class="GtkViewport" id="viewport2"> + <object class="GtkViewport" id="viewport"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">6</property> + <property name="can-focus">False</property> + <property name="border-width">6</property> <child> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=6 n-rows=15 --> <object class="GtkGrid" id="grid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> + <property name="can-focus">False</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> <child> <object class="GtkLabel" id="shortname"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="generalpage|shortname">_Short name</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">shortnamecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="authtype"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|authtype">_Type</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">authtypecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> + <property name="left-attach">2</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="authors"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|authors">Author(s)</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">authorscontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="publisher"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|publisher">_Publisher</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">publishercontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="chapter"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|chapter">_Chapter</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">chaptercontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left-attach">0</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="title"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|title">Tit_le</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">titlecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">1</property> + <property name="left-attach">2</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="address"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|address">A_ddress</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">addresscontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">2</property> + <property name="left-attach">2</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="pages"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|pages">Pa_ge(s)</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">pagescontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">3</property> + <property name="left-attach">2</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="year"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|year">_Year</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">yearcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">0</property> + <property name="left-attach">4</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="isbn"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|isbn">_ISBN</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">isbncontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">2</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box1"> - <property name="width_request">12</property> - <property name="height_request">12</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> + <property name="left-attach">4</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="editor"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|editor">Editor</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">editorcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> + <property name="left-attach">0</property> + <property name="top-attach">5</property> </packing> </child> <child> <object class="GtkLabel" id="booktitle"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|booktitle">_Book title</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">booktitlecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">6</property> + <property name="left-attach">0</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkLabel" id="edition"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|edition">Ed_ition</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">editioncontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">5</property> + <property name="left-attach">2</property> + <property name="top-attach">5</property> </packing> </child> <child> <object class="GtkLabel" id="volume"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|volume">Volume</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">volumecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">6</property> + <property name="left-attach">2</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkLabel" id="institution"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|institution">Instit_ution</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">institutioncontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">7</property> + <property name="left-attach">2</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkLabel" id="month"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|month">_Month</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">monthcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">8</property> + <property name="left-attach">2</property> + <property name="top-attach">8</property> </packing> </child> <child> <object class="GtkLabel" id="publicationtype"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|publicationtype">Publication t_ype</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">publicationtypecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">6</property> + <property name="left-attach">4</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkLabel" id="university"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|university">University</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">universitycontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">7</property> + <property name="left-attach">4</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkLabel" id="reporttype"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|reporttype">Type of re_port</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">reporttypecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">8</property> + <property name="left-attach">0</property> + <property name="top-attach">8</property> </packing> </child> <child> <object class="GtkLabel" id="organization"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|organization">Organi_zation</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">organizationcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">7</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box2"> - <property name="width_request">12</property> - <property name="height_request">12</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">9</property> + <property name="left-attach">0</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkLabel" id="journal"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|journal">_Journal</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">journalcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">10</property> + <property name="left-attach">0</property> + <property name="top-attach">10</property> </packing> </child> <child> <object class="GtkLabel" id="annotation"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|annotation">Ann_otation</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">annotationcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">11</property> + <property name="left-attach">0</property> + <property name="top-attach">11</property> </packing> </child> <child> <object class="GtkLabel" id="number"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|number">Numb_er</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">numbercontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">10</property> + <property name="left-attach">2</property> + <property name="top-attach">10</property> </packing> </child> <child> <object class="GtkLabel" id="note"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|note">_Note</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">notecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">11</property> + <property name="left-attach">2</property> + <property name="top-attach">11</property> </packing> </child> <child> <object class="GtkLabel" id="series"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|series">Se_ries</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">seriescontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">10</property> + <property name="left-attach">4</property> + <property name="top-attach">10</property> </packing> </child> <child> <object class="GtkLabel" id="url"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|url">URL</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">urlcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">11</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box3"> - <property name="width_request">12</property> - <property name="height_request">12</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">12</property> + <property name="left-attach">4</property> + <property name="top-attach">11</property> </packing> </child> <child> <object class="GtkLabel" id="custom1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|custom1">User-defined field _1</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom1control</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">13</property> + <property name="left-attach">0</property> + <property name="top-attach">13</property> </packing> </child> <child> <object class="GtkLabel" id="custom4"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|custom4">User-defined field _4</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom4control</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">14</property> + <property name="left-attach">0</property> + <property name="top-attach">14</property> </packing> </child> <child> <object class="GtkLabel" id="custom2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|custom2">User-defined field _2</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom2control</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">13</property> + <property name="left-attach">2</property> + <property name="top-attach">13</property> </packing> </child> <child> <object class="GtkLabel" id="custom5"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|custom5">User-defined field _5</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom5control</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">14</property> + <property name="left-attach">2</property> + <property name="top-attach">14</property> </packing> </child> <child> <object class="GtkLabel" id="custom3"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|custom3">User-defined field _3</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom3control</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">13</property> + <property name="left-attach">4</property> + <property name="top-attach">13</property> </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="shortnamecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">0</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="titlecontrol"> + <property name="visible">True</property> + <property name="truncate-multiline">True</property> + <property name="can-focus">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">1</property> + <property name="width">3</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="yearcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">0</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="authorscontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">1</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="publishercontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">2</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="addresscontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">2</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="isbncontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">2</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkComboBoxText" id="authtypecontrol"> + <property name="visible">True</property> + <property name="can-focus">False</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">0</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="chaptercontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">3</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="pagescontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">3</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="editorcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">5</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="editioncontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">5</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="booktitlecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">6</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="volumecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">6</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="publicationtypecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">6</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="organizationcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">7</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="institutioncontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">7</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="universitycontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">7</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="reporttypecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">8</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="monthcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">8</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="journalcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">10</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="annotationcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">11</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="numbercontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">10</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="notecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">11</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="seriescontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">10</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="urlcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">11</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="custom1control"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">13</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="custom4control"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">14</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="custom2control"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">13</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="custom5control"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">14</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="custom3control"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">13</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="valign">center</property> + <property name="vexpand">False</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">4</property> + <property name="width">6</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="valign">center</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">12</property> + <property name="width">6</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="valign">center</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">9</property> + <property name="width">6</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkLabel" id="localurl"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="generalpage|localurl">Local copy</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">localurlcontrol</property> + <property name="xalign">1</property> + </object> + <packing> + <property name="left-attach">4</property> + <property name="top-attach">14</property> + </packing> + </child> + <child> + <object class="GtkBox" id="localvbox"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkBox" id="localhbox"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <child> + <object class="GtkEntry" id="localurlcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="truncate-multiline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="localbrowse"> + <property name="label" translatable="yes" context="generalpage|browse">Browse...</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives_default">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="localhbox2"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <child> + <object class="GtkCheckButton" id="localpagecb"> + <property name="label" translatable="yes" context="generalpage|localpagecb">Page</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + <accessibility> + <relation type="label-for" target="localpagesb"/> + </accessibility> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="localpagesb"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="adjustment">adjustment2</property> + <accessibility> + <relation type="labelled-by" target="localpagecb"/> + </accessibility> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">14</property> + </packing> </child> <child> <placeholder/> diff --git a/extensions/uiconfig/sbibliography/ui/mappingdialog.ui b/extensions/uiconfig/sbibliography/ui/mappingdialog.ui index 3b19ce48aa16..b4053eeb7741 100644 --- a/extensions/uiconfig/sbibliography/ui/mappingdialog.ui +++ b/extensions/uiconfig/sbibliography/ui/mappingdialog.ui @@ -1,34 +1,34 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.36.0 --> +<!-- Generated with glade 3.38.2 --> <interface domain="pcr"> <requires lib="gtk+" version="3.20"/> <object class="GtkDialog" id="MappingDialog"> - <property name="can_focus">False</property> - <property name="border_width">6</property> + <property name="can-focus">False</property> + <property name="border-width">6</property> <property name="title" translatable="yes" context="mappingdialog|MappingDialog">Column Layout for Table “%1”</property> <property name="modal">True</property> - <property name="default_width">0</property> - <property name="default_height">0</property> - <property name="type_hint">dialog</property> + <property name="default-width">0</property> + <property name="default-height">0</property> + <property name="type-hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="orientation">vertical</property> <property name="spacing">12</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> - <property name="can_focus">False</property> - <property name="layout_style">end</property> + <property name="can-focus">False</property> + <property name="layout-style">end</property> <child> <object class="GtkButton" id="ok"> <property name="label" translatable="yes" context="stock">_OK</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="has-default">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -41,8 +41,8 @@ <object class="GtkButton" id="cancel"> <property name="label" translatable="yes" context="stock">_Cancel</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -55,8 +55,8 @@ <object class="GtkButton" id="help"> <property name="label" translatable="yes" context="stock">_Help</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -70,882 +70,908 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> + <property name="pack-type">end</property> <property name="position">1</property> </packing> </child> <child> <object class="GtkFrame" id="frame1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> <child> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=6 n-rows=15 --> <object class="GtkGrid" id="grid1"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> + <property name="can-focus">False</property> <property name="margin-start">12</property> <property name="margin-top">6</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> <child> <object class="GtkLabel" id="label2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label2">_Short name</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">identifierCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">identifierCombobox</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="label3"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label3">_Author(s)</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">authorCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">authorCombobox</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="label4"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label4">_Publisher</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">publisherCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">publisherCombobox</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="label5"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label5">_Chapter</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">chapterCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">chapterCombobox</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left-attach">0</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="label6"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label6">Editor</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">editorCombobox</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> + <property name="left-attach">0</property> + <property name="top-attach">5</property> </packing> </child> <child> <object class="GtkComboBoxText" id="authorCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="left-attach">1</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkComboBoxText" id="publisherCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> + <property name="left-attach">1</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkComboBoxText" id="chapterCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="left-attach">1</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkComboBoxText" id="editorCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">5</property> + <property name="left-attach">1</property> + <property name="top-attach">5</property> </packing> </child> <child> <object class="GtkLabel" id="label7"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label7">_Type</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">authorityTypeCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">authorityTypeCombobox</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> + <property name="left-attach">2</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="label8"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label8">_Year</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">yearCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">yearCombobox</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">0</property> + <property name="left-attach">4</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="label9"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label9">Tit_le</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">titleCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">titleCombobox</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">1</property> + <property name="left-attach">2</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkComboBoxText" id="authorityTypeCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">0</property> + <property name="left-attach">3</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkComboBoxText" id="yearCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">5</property> - <property name="top_attach">0</property> + <property name="left-attach">5</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkComboBoxText" id="titleCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">1</property> + <property name="left-attach">3</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="label10"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label10">A_ddress</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">addressCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">addressCombobox</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">2</property> + <property name="left-attach">2</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="label11"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label11">_ISBN</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">ISBNCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">ISBNCombobox</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">2</property> + <property name="left-attach">4</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="label12"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label12">Pa_ge(s)</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">pagesCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">pagesCombobox</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">3</property> + <property name="left-attach">2</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkComboBoxText" id="addressCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">2</property> + <property name="left-attach">3</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkComboBoxText" id="ISBNCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">5</property> - <property name="top_attach">2</property> + <property name="left-attach">5</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkComboBoxText" id="pagesCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">3</property> + <property name="left-attach">3</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="label13"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label13">Ed_ition</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">editionCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">editionCombobox</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">5</property> + <property name="left-attach">2</property> + <property name="top-attach">5</property> </packing> </child> <child> <object class="GtkComboBoxText" id="editionCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">5</property> + <property name="left-attach">3</property> + <property name="top-attach">5</property> </packing> </child> <child> <object class="GtkLabel" id="label14"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label14">_Book title</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">bookTitleCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">bookTitleCombobox</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">6</property> + <property name="left-attach">0</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkLabel" id="label15"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label15">Volume</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">volumeCombobox</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">6</property> + <property name="left-attach">2</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkLabel" id="label16"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label16">Publication t_ype</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">howPublishedCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">howPublishedCombobox</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">6</property> + <property name="left-attach">4</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkComboBoxText" id="bookTitleCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">6</property> + <property name="left-attach">1</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkComboBoxText" id="volumeCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">6</property> + <property name="left-attach">3</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkComboBoxText" id="howPublishedCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">5</property> - <property name="top_attach">6</property> + <property name="left-attach">5</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkLabel" id="label17"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label17">Organi_zation</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">organizationCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">organizationCombobox</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">7</property> + <property name="left-attach">0</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkLabel" id="label18"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label18">Instit_ution</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">institutionCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">institutionCombobox</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">7</property> + <property name="left-attach">2</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkLabel" id="label19"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label19">Uni_versity</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">schoolCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">schoolCombobox</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">7</property> + <property name="left-attach">4</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkComboBoxText" id="organizationCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">7</property> + <property name="left-attach">1</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkComboBoxText" id="institutionCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">7</property> + <property name="left-attach">3</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkComboBoxText" id="schoolCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">5</property> - <property name="top_attach">7</property> + <property name="left-attach">5</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkLabel" id="label20"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label20">Type of re_port</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">reportTypeCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">reportTypeCombobox</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">8</property> + <property name="left-attach">0</property> + <property name="top-attach">8</property> </packing> </child> <child> <object class="GtkLabel" id="label21"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label21">_Month</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">monthCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">monthCombobox</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">8</property> + <property name="left-attach">2</property> + <property name="top-attach">8</property> </packing> </child> <child> <object class="GtkComboBoxText" id="reportTypeCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">8</property> + <property name="left-attach">1</property> + <property name="top-attach">8</property> </packing> </child> <child> <object class="GtkComboBoxText" id="monthCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">8</property> + <property name="left-attach">3</property> + <property name="top-attach">8</property> </packing> </child> <child> <object class="GtkLabel" id="label22"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label22">_Journal</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">journalCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">journalCombobox</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">10</property> + <property name="left-attach">0</property> + <property name="top-attach">10</property> </packing> </child> <child> <object class="GtkLabel" id="label23"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label23">Numb_er</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">numberCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">numberCombobox</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">10</property> + <property name="left-attach">2</property> + <property name="top-attach">10</property> </packing> </child> <child> <object class="GtkLabel" id="label24"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label24">Se_ries</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">seriesCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">seriesCombobox</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">10</property> + <property name="left-attach">4</property> + <property name="top-attach">10</property> </packing> </child> <child> <object class="GtkComboBoxText" id="journalCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">10</property> + <property name="left-attach">1</property> + <property name="top-attach">10</property> </packing> </child> <child> <object class="GtkComboBoxText" id="numberCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">10</property> + <property name="left-attach">3</property> + <property name="top-attach">10</property> </packing> </child> <child> <object class="GtkComboBoxText" id="seriesCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">5</property> - <property name="top_attach">10</property> + <property name="left-attach">5</property> + <property name="top-attach">10</property> </packing> </child> <child> <object class="GtkLabel" id="label25"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label25">Ann_otation</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">annoteCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">annoteCombobox</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">11</property> + <property name="left-attach">0</property> + <property name="top-attach">11</property> </packing> </child> <child> <object class="GtkLabel" id="label26"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label26">_Note</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">noteCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">noteCombobox</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">11</property> + <property name="left-attach">2</property> + <property name="top-attach">11</property> </packing> </child> <child> <object class="GtkLabel" id="label27"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label27">URL</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">URLCombobox</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">11</property> + <property name="left-attach">4</property> + <property name="top-attach">11</property> </packing> </child> <child> <object class="GtkComboBoxText" id="annoteCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">11</property> + <property name="left-attach">1</property> + <property name="top-attach">11</property> </packing> </child> <child> <object class="GtkComboBoxText" id="noteCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">11</property> + <property name="left-attach">3</property> + <property name="top-attach">11</property> </packing> </child> <child> <object class="GtkComboBoxText" id="URLCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">5</property> - <property name="top_attach">11</property> + <property name="left-attach">5</property> + <property name="top-attach">11</property> </packing> </child> <child> <object class="GtkLabel" id="label28"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label28">User-defined field _1</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">custom1Combobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom1Combobox</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">13</property> + <property name="left-attach">0</property> + <property name="top-attach">13</property> </packing> </child> <child> <object class="GtkLabel" id="label29"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label29">User-defined field _2</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">custom2Combobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom2Combobox</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">13</property> + <property name="left-attach">2</property> + <property name="top-attach">13</property> </packing> </child> <child> <object class="GtkLabel" id="label30"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label30">User-defined field _3</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">custom3Combobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom3Combobox</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">13</property> + <property name="left-attach">4</property> + <property name="top-attach">13</property> </packing> </child> <child> <object class="GtkLabel" id="label31"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label31">User-defined field _4</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">custom4Combobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom4Combobox</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">14</property> + <property name="left-attach">0</property> + <property name="top-attach">14</property> </packing> </child> <child> <object class="GtkLabel" id="label32"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mappingdialog|label32">User-defined field _5</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">custom5Combobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom5Combobox</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">14</property> + <property name="left-attach">2</property> + <property name="top-attach">14</property> </packing> </child> <child> <object class="GtkComboBoxText" id="custom1Combobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">13</property> + <property name="left-attach">1</property> + <property name="top-attach">13</property> </packing> </child> <child> <object class="GtkComboBoxText" id="custom2Combobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">13</property> + <property name="left-attach">3</property> + <property name="top-attach">13</property> </packing> </child> <child> <object class="GtkComboBoxText" id="custom3Combobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">5</property> - <property name="top_attach">13</property> + <property name="left-attach">5</property> + <property name="top-attach">13</property> </packing> </child> <child> <object class="GtkComboBoxText" id="custom4Combobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">14</property> + <property name="left-attach">1</property> + <property name="top-attach">14</property> </packing> </child> <child> <object class="GtkComboBoxText" id="custom5Combobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">14</property> + <property name="left-attach">3</property> + <property name="top-attach">14</property> </packing> </child> <child> <object class="GtkComboBoxText" id="identifierCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="hexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="left-attach">1</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkBox" id="box3"> - <property name="width_request">12</property> - <property name="height_request">12</property> + <property name="width-request">12</property> + <property name="height-request">12</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <child> <placeholder/> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">12</property> + <property name="left-attach">0</property> + <property name="top-attach">12</property> </packing> </child> <child> <object class="GtkBox" id="box2"> - <property name="width_request">12</property> - <property name="height_request">12</property> + <property name="width-request">12</property> + <property name="height-request">12</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <child> <placeholder/> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">9</property> + <property name="left-attach">0</property> + <property name="top-attach">9</property> </packing> </child> <child> <object class="GtkBox" id="box1"> - <property name="width_request">12</property> - <property name="height_request">12</property> + <property name="width-request">12</property> + <property name="height-request">12</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <child> <placeholder/> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> + <property name="left-attach">0</property> + <property name="top-attach">4</property> </packing> </child> <child> - <placeholder/> + <object class="GtkLabel" id="label33"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">end</property> + <property name="label" translatable="yes" context="mappingdialog|label33">Local copy</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">LocalURLCombobox</property> + </object> + <packing> + <property name="left_attach">4</property> + <property name="top_attach">14</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkComboBoxText" id="LocalURLCombobox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left_attach">5</property> + <property name="top_attach">14</property> + </packing> </child> <child> <placeholder/> @@ -1021,7 +1047,7 @@ <child type="label"> <object class="GtkLabel" id="label1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="mappingdialog|label1">Column Names</property> <attributes> <attribute name="weight" value="bold"/> @@ -1042,9 +1068,6 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> - <child type="titlebar"> - <placeholder/> - </child> <child internal-child="accessible"> <object class="AtkObject" id="MappingDialog-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="mappingdialog|extended_tip|MappingDialog">Lets you map the column headings to data fields from a different data source. To define a different data source for your bibliography, click the Data Source button on the record's Object bar.</property> diff --git a/extensions/uiconfig/sbibliography/ui/toolbar.ui b/extensions/uiconfig/sbibliography/ui/toolbar.ui index bdd87be9ec03..81e60b5fbf84 100644 --- a/extensions/uiconfig/sbibliography/ui/toolbar.ui +++ b/extensions/uiconfig/sbibliography/ui/toolbar.ui @@ -4,12 +4,11 @@ <requires lib="gtk+" version="3.20"/> <object class="GtkToolbar" id="toolbar"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="show_arrow">False</property> <child> <object class="GtkToolButton" id="TBC_SOURCE"> <property name="visible">True</property> - <property name="can_focus">False</property> <property name="action_name">.uno:Bib/source</property> <property name="use_underline">True</property> </object> @@ -21,7 +20,6 @@ <child> <object class="GtkToolButton" id="TBC_BT_CHANGESOURCE"> <property name="visible">True</property> - <property name="can_focus">False</property> <property name="action_name">.uno:Bib/sdbsource</property> <property name="label" translatable="yes" context="toolbar|TBC_BT_CHANGESOURCE">Data Source</property> <property name="use_underline">True</property> @@ -44,7 +42,6 @@ <child> <object class="GtkToolButton" id="TBC_QUERY"> <property name="visible">True</property> - <property name="can_focus">False</property> <property name="action_name">.uno:Bib/query</property> <property name="use_underline">True</property> </object> @@ -66,7 +63,6 @@ <child> <object class="GtkMenuToolButton" id="TBC_BT_AUTOFILTER"> <property name="visible">True</property> - <property name="can_focus">False</property> <property name="action_name">.uno:Bib/autoFilter</property> <property name="label" translatable="yes" context="toolbar|TBC_BT_AUTOFILTER">AutoFilter</property> <property name="use_underline">True</property> @@ -79,7 +75,6 @@ <child> <object class="GtkToolButton" id="TBC_BT_FILTERCRIT"> <property name="visible">True</property> - <property name="can_focus">False</property> <property name="action_name">.uno:Bib/standardFilter</property> <property name="label" translatable="yes" context="toolbar|TBC_BT_FILTERCRIT">Standard Filter</property> <property name="use_underline">True</property> @@ -92,7 +87,6 @@ <child> <object class="GtkToolButton" id="TBC_BT_REMOVEFILTER"> <property name="visible">True</property> - <property name="can_focus">False</property> <property name="action_name">.uno:Bib/removeFilter</property> <property name="label" translatable="yes" context="toolbar|TBC_BT_REMOVEFILTER">Reset Filter</property> <property name="use_underline">True</property> @@ -105,7 +99,6 @@ <child> <object class="GtkToolButton" id="TBC_BT_COL_ASSIGN"> <property name="visible">True</property> - <property name="can_focus">False</property> <property name="action_name">.uno:Bib/Mapping</property> <property name="label" translatable="yes" context="toolbar|TBC_BT_COL_ASSIGN">Column Arrangement</property> <property name="use_underline">True</property> diff --git a/extensions/uiconfig/scanner/ui/sanedialog.ui b/extensions/uiconfig/scanner/ui/sanedialog.ui index 2fedc52925f4..da4cd68664e8 100644 --- a/extensions/uiconfig/scanner/ui/sanedialog.ui +++ b/extensions/uiconfig/scanner/ui/sanedialog.ui @@ -1,36 +1,36 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> +<!-- Generated with glade 3.38.2 --> <interface domain="pcr"> <requires lib="gtk+" version="3.20"/> <object class="GtkAdjustment" id="adjustment1"> <property name="upper">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> </object> <object class="GtkAdjustment" id="adjustment2"> <property name="upper">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> </object> <object class="GtkAdjustment" id="adjustment3"> <property name="upper">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> </object> <object class="GtkAdjustment" id="adjustment4"> <property name="upper">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> </object> <object class="GtkAdjustment" id="adjustment5"> <property name="upper">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> </object> <object class="GtkAdjustment" id="adjustment6"> <property name="upper">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> </object> <object class="GtkTreeStore" id="liststore2"> <columns> @@ -41,99 +41,126 @@ </columns> </object> <object class="GtkDialog" id="SaneDialog"> - <property name="can_focus">False</property> - <property name="border_width">6</property> + <property name="can-focus">False</property> + <property name="border-width">6</property> <property name="title" translatable="yes" context="sanedialog|SaneDialog">Scanner</property> <property name="modal">True</property> - <property name="default_width">0</property> - <property name="default_height">0</property> - <property name="type_hint">dialog</property> - <child> - <placeholder/> - </child> + <property name="default-width">0</property> + <property name="default-height">0</property> + <property name="type-hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">12</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="homogeneous">True</property> - <property name="layout_style">end</property> + <property name="layout-style">end</property> + <child> + <object class="GtkButton" id="help"> + <property name="label" translatable="yes" context="stock">_Help</property> + <property name="use-action-appearance">True</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> <child> <object class="GtkButton" id="deviceInfoButton"> <property name="label" translatable="yes" context="sanedialog|deviceInfoButton">About Dev_ice</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="deviceInfoButton-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="sanedialog|extended_tip|deviceInfoButton">Displays a popup window with information obtained from the scanner driver.</property> + </object> + </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> <child> <object class="GtkButton" id="previewButton"> <property name="label" translatable="yes" context="sanedialog|previewButton">Create Previe_w</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="previewButton-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="sanedialog|extended_tip|previewButton">Scans and displays the document in the preview area.</property> + </object> + </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> <object class="GtkButton" id="ok"> <property name="label" translatable="yes" context="sanedialog|scanButton">_Scan</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="ok-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="sanedialog|extended_tip|ok">Scans an image, and then inserts the result into the document and closes the dialog.</property> + </object> + </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> <child> <object class="GtkButton" id="cancel"> <property name="label" translatable="yes" context="stock">_Cancel</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> + <property name="pack-type">end</property> <property name="position">1</property> </packing> </child> <child> <object class="GtkBox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="spacing">12</property> <child> <object class="GtkBox" id="box1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="orientation">vertical</property> @@ -141,128 +168,148 @@ <child> <object class="GtkFrame" id="frame1"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> + <property name="can-focus">False</property> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> <child> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=2 n-rows=4 --> <object class="GtkGrid" id="grid1"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> + <property name="can-focus">False</property> <property name="margin-start">12</property> <property name="margin-top">6</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> <child> <object class="GtkLabel" id="label3"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="sanedialog|label3">_Left:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">leftSpinbutton</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">leftSpinbutton</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="label4"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="sanedialog|label4">To_p:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">topSpinbutton</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">topSpinbutton</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="label5"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="sanedialog|label5">_Right:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">rightSpinbutton</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">rightSpinbutton</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="label6"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="sanedialog|label6">_Bottom:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">bottomSpinbutton</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">bottomSpinbutton</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left-attach">0</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkSpinButton" id="topSpinbutton"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> <property name="adjustment">adjustment2</property> + <child internal-child="accessible"> + <object class="AtkObject" id="topSpinbutton-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="sanedialog|extended_tip|topSpinbutton">Set the top margin of the scan area.</property> + </object> + </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="left-attach">1</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkSpinButton" id="rightSpinbutton"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> <property name="adjustment">adjustment3</property> + <child internal-child="accessible"> + <object class="AtkObject" id="rightSpinbutton-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="sanedialog|extended_tip|rightSpinbutton">Set the right margin of the scan area.</property> + </object> + </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> + <property name="left-attach">1</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkSpinButton" id="bottomSpinbutton"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> <property name="adjustment">adjustment4</property> + <child internal-child="accessible"> + <object class="AtkObject" id="bottomSpinbutton-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="sanedialog|extended_tip|bottomSpinbutton">Set the bottom margin of the scan area.</property> + </object> + </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="left-attach">1</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkSpinButton" id="leftSpinbutton"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="activates_default">True</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> <property name="adjustment">adjustment1</property> + <child internal-child="accessible"> + <object class="AtkObject" id="leftSpinbutton-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="sanedialog|extended_tip|leftSpinbutton">Set the left margin of the scan area.</property> + </object> + </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="left-attach">1</property> + <property name="top-attach">0</property> </packing> </child> </object> @@ -270,7 +317,7 @@ <child type="label"> <object class="GtkLabel" id="label1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="sanedialog|label1">Scan Area</property> <property name="xalign">0</property> </object> @@ -285,35 +332,40 @@ <child> <object class="GtkFrame" id="frame2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> <child> <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="halign">center</property> <property name="valign">start</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="hscrollbar_policy">never</property> - <property name="vscrollbar_policy">never</property> - <property name="shadow_type">in</property> <property name="margin-start">12</property> <property name="margin-top">6</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="hscrollbar-policy">never</property> + <property name="vscrollbar-policy">never</property> + <property name="shadow-type">in</property> <child> <object class="GtkViewport"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <child> <object class="GtkDrawingArea" id="preview"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> <property name="hexpand">True</property> <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="preview-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="sanedialog|extended_tip|preview">Displays a preview of the scanned image. The preview area contains eight handles. Drag the handles to adjust the scan area or enter a value in the corresponding margin spin box.</property> + </object> + </child> </object> </child> </object> @@ -323,7 +375,7 @@ <child type="label"> <object class="GtkLabel" id="label2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="sanedialog|label2">Preview</property> </object> </child> @@ -344,70 +396,80 @@ <child> <object class="GtkBox" id="box2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">12</property> <child> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=2 n-rows=2 --> <object class="GtkGrid" id="grid2"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> + <property name="can-focus">False</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> <child> <object class="GtkLabel" id="label7"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="sanedialog|label7">Device _used</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">deviceCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">deviceCombobox</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="label8"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="sanedialog|label8">Resolution [_DPI]</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">reslCombobox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">reslCombobox</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkComboBoxText" id="deviceCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="deviceCombobox-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="sanedialog|extended_tip|deviceCombobox">Displays a list of available scanners detected in your system.</property> + </object> + </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="left-attach">1</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkComboBoxText" id="reslCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="has_entry">True</property> + <property name="can-focus">False</property> + <property name="has-entry">True</property> <child internal-child="entry"> <object class="GtkEntry"> + <property name="can-focus">True</property> <property name="truncate-multiline">True</property> - <property name="can_focus">True</property> + </object> + </child> + <child internal-child="accessible"> + <object class="AtkObject" id="reslCombobox-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="sanedialog|extended_tip|reslCombobox">Select the resolution in dots per inch for the scan job.</property> </object> </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="left-attach">1</property> + <property name="top-attach">1</property> </packing> </child> </object> @@ -420,7 +482,7 @@ <child> <object class="GtkBox" id="box4"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="orientation">vertical</property> @@ -429,11 +491,15 @@ <object class="GtkCheckButton" id="advancedCheckbutton"> <property name="label" translatable="yes" context="sanedialog|advancedCheckbutton">Show advanced options</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="image_position">right</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="advancedCheckbutton-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="sanedialog|extended_tip|advancedcheckbutton">Mark this checkbox to display more configuration options for the scanner device.</property> + </object> + </child> </object> <packing> <property name="expand">False</property> @@ -444,48 +510,47 @@ <child> <object class="GtkBox" id="box3"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">12</property> <property name="homogeneous">True</property> <child> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=1 n-rows=2 --> <object class="GtkGrid" id="grid3"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> + <property name="can-focus">False</property> + <property name="row-spacing">6</property> <child> <object class="GtkLabel" id="label10"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="sanedialog|label10">Options:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">optionSvTreeListBox</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">optionSvTreeListBox</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="shadow_type">in</property> + <property name="shadow-type">in</property> <child> <object class="GtkTreeView" id="optionSvTreeListBox"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="model">liststore2</property> - <property name="headers_visible">False</property> - <property name="search_column">0</property> - <property name="show_expanders">True</property> + <property name="headers-visible">False</property> + <property name="search-column">0</property> <child internal-child="selection"> <object class="GtkTreeSelection"/> </child> @@ -499,12 +564,17 @@ </child> </object> </child> + <child internal-child="accessible"> + <object class="AtkObject" id="optionSvTreeListBox-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="sanedialog\extended_tip|optionSvTreeListBox">Displays the list of available scanner driver advanced options. Double click an option to display its contents just below.</property> + </object> + </child> </object> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> </object> @@ -515,137 +585,137 @@ </packing> </child> <child> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=1 n-rows=10 --> <object class="GtkGrid" id="grid4"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> + <property name="can-focus">False</property> + <property name="row-spacing">6</property> <child> <object class="GtkLabel" id="optionsDescLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">start</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkButton" id="optionsButton"> <property name="label" translatable="yes" context="sanedialog|optionsButton">Se_t</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkComboBoxText" id="quantumRangeCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left-attach">0</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkComboBoxText" id="stringRangeCombobox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> + <property name="left-attach">0</property> + <property name="top-attach">4</property> </packing> </child> <child> <object class="GtkCheckButton" id="boolCheckbutton"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> + <property name="left-attach">0</property> + <property name="top-attach">5</property> </packing> </child> <child> <object class="GtkEntry" id="stringEntry"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> - <property name="activates_default">True</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">6</property> + <property name="left-attach">0</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkEntry" id="numericEntry"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> - <property name="activates_default">True</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">7</property> + <property name="left-attach">0</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkLabel" id="vectorLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">start</property> <property name="label" translatable="yes" context="sanedialog|vectorLabel">Vector element</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">vectorSpinbutton</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">vectorSpinbutton</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">8</property> + <property name="left-attach">0</property> + <property name="top-attach">8</property> </packing> </child> <child> <object class="GtkSpinButton" id="vectorSpinbutton"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="activates_default">True</property> + <property name="can-focus">True</property> + <property name="activates-default">True</property> <property name="truncate-multiline">True</property> <property name="adjustment">adjustment5</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">9</property> + <property name="left-attach">0</property> + <property name="top-attach">9</property> </packing> </child> <child> <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="hscrollbar_policy">never</property> - <property name="vscrollbar_policy">never</property> - <property name="shadow_type">in</property> + <property name="hscrollbar-policy">never</property> + <property name="vscrollbar-policy">never</property> + <property name="shadow-type">in</property> <child> <object class="GtkViewport"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <child> <object class="GtkLabel" id="optionTitleLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">start</property> <property name="valign">start</property> <property name="xalign">0</property> @@ -656,8 +726,8 @@ </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> </object> @@ -698,6 +768,7 @@ </object> </child> <action-widgets> + <action-widget response="-11">help</action-widget> <action-widget response="101">deviceInfoButton</action-widget> <action-widget response="102">previewButton</action-widget> <action-widget response="-5">ok</action-widget> diff --git a/extensions/uiconfig/spropctrlr/ui/colorlistbox.ui b/extensions/uiconfig/spropctrlr/ui/colorlistbox.ui index 7361e0d11947..40ae63eac62a 100644 --- a/extensions/uiconfig/spropctrlr/ui/colorlistbox.ui +++ b/extensions/uiconfig/spropctrlr/ui/colorlistbox.ui @@ -5,6 +5,7 @@ <object class="GtkMenuButton" id="colorlistbox"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="focus-on-click">True</property> <property name="receives_default">True</property> <property name="hexpand">True</property> <property name="draw_indicator">True</property> diff --git a/extensions/uiconfig/spropctrlr/ui/datefield.ui b/extensions/uiconfig/spropctrlr/ui/datefield.ui index 6ca77af072ee..2369cd25bf2a 100644 --- a/extensions/uiconfig/spropctrlr/ui/datefield.ui +++ b/extensions/uiconfig/spropctrlr/ui/datefield.ui @@ -1,16 +1,45 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> +<!-- Generated with glade 3.38.2 --> <interface domain="pcr"> <requires lib="gtk+" version="3.20"/> - <object class="GtkMenuButton" id="datefield"> + <object class="GtkImage" id="image7"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> + <property name="can_focus">False</property> + <property name="icon_name">x-office-calendar</property> + <property name="icon_size">2</property> + </object> + <object class="GtkBox" id="datefield"> + <property name="visible">True</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> - <property name="draw_indicator">True</property> - <property name="label" translatable="no"></property> + <property name="spacing">6</property> + <child> + <object class="GtkEntry" id="entry"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="truncate-multiline">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> <child> - <placeholder/> + <object class="GtkMenuButton" id="button"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="image">image7</property> + <property name="margin-start">1</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> </child> </object> </interface> diff --git a/extensions/uiconfig/spropctrlr/ui/datetimefield.ui b/extensions/uiconfig/spropctrlr/ui/datetimefield.ui index aed958450b1e..f736a8e63221 100644 --- a/extensions/uiconfig/spropctrlr/ui/datetimefield.ui +++ b/extensions/uiconfig/spropctrlr/ui/datetimefield.ui @@ -16,6 +16,7 @@ <object class="GtkMenuButton" id="datefield"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="focus-on-click">True</property> <property name="receives_default">False</property> <property name="hexpand">True</property> <property name="draw_indicator">True</property> diff --git a/extensions/uiconfig/spropctrlr/ui/formattedcontrol.ui b/extensions/uiconfig/spropctrlr/ui/formattedcontrol.ui index 657542e7c23f..be3bd8857d52 100644 --- a/extensions/uiconfig/spropctrlr/ui/formattedcontrol.ui +++ b/extensions/uiconfig/spropctrlr/ui/formattedcontrol.ui @@ -13,7 +13,6 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="activates_default">True</property> - <property name="caps_lock_warning">False</property> <property name="adjustment">adjustmentForwardBackward</property> <property name="truncate-multiline">True</property> <property name="digits">2</property> diff --git a/extensions/uiconfig/spropctrlr/ui/formattedsample.ui b/extensions/uiconfig/spropctrlr/ui/formattedsample.ui index 63ee0ea6bc68..60fb76e8397e 100644 --- a/extensions/uiconfig/spropctrlr/ui/formattedsample.ui +++ b/extensions/uiconfig/spropctrlr/ui/formattedsample.ui @@ -31,7 +31,6 @@ <property name="no_show_all">True</property> <property name="hexpand">True</property> <property name="activates_default">True</property> - <property name="caps_lock_warning">False</property> <property name="adjustment">adjustmentForwardBackward</property> <property name="truncate-multiline">True</property> <property name="digits">2</property> diff --git a/extensions/uiconfig/spropctrlr/ui/labelselectiondialog.ui b/extensions/uiconfig/spropctrlr/ui/labelselectiondialog.ui index 00c5c8fd160c..4a7c53da1bec 100644 --- a/extensions/uiconfig/spropctrlr/ui/labelselectiondialog.ui +++ b/extensions/uiconfig/spropctrlr/ui/labelselectiondialog.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> +<!-- Generated with glade 3.40.0 --> <interface domain="pcr"> <requires lib="gtk+" version="3.20"/> <object class="GtkTreeStore" id="liststore1"> @@ -13,34 +13,31 @@ </columns> </object> <object class="GtkDialog" id="LabelSelectionDialog"> - <property name="can_focus">False</property> - <property name="border_width">6</property> + <property name="can-focus">False</property> + <property name="border-width">6</property> <property name="title" translatable="yes" context="labelselectiondialog|LabelSelectionDialog">Label Field Selection</property> <property name="modal">True</property> - <property name="default_width">0</property> - <property name="type_hint">dialog</property> - <child> - <placeholder/> - </child> + <property name="default-width">0</property> + <property name="type-hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> - <property name="can_focus">False</property> - <property name="layout_style">end</property> + <property name="can-focus">False</property> + <property name="layout-style">end</property> <child> <object class="GtkButton" id="ok"> <property name="label" translatable="yes" context="stock">_OK</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="has-default">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -53,8 +50,8 @@ <object class="GtkButton" id="cancel"> <property name="label" translatable="yes" context="stock">_Cancel</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -67,8 +64,8 @@ <object class="GtkButton" id="help"> <property name="label" translatable="yes" context="stock">_Help</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> <property name="use-underline">True</property> </object> <packing> @@ -82,14 +79,14 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> + <property name="pack-type">end</property> <property name="position">0</property> </packing> </child> <child> <object class="GtkBox" id="box1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="orientation">vertical</property> @@ -97,14 +94,14 @@ <child> <object class="GtkLabel" id="label"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">start</property> <property name="label" translatable="yes" context="labelselectiondialog|label">These are control fields that can be used as label fields for the $controlclass$ $controlname$.</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <property name="wrap">True</property> - <property name="mnemonic_widget">control</property> - <property name="width_chars">60</property> - <property name="max_width_chars">60</property> + <property name="mnemonic-widget">control</property> + <property name="width-chars">60</property> + <property name="max-width-chars">60</property> <property name="xalign">0</property> <property name="yalign">0</property> </object> @@ -117,21 +114,20 @@ <child> <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="shadow_type">in</property> + <property name="shadow-type">in</property> <child> <object class="GtkTreeView" id="control"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="model">liststore1</property> - <property name="headers_visible">False</property> - <property name="search_column">1</property> - <property name="show_expanders">True</property> - <property name="enable_tree_lines">True</property> + <property name="headers-visible">False</property> + <property name="search-column">1</property> + <property name="enable-tree-lines">True</property> <child internal-child="selection"> <object class="GtkTreeSelection" id="Macro Library List-selection1"/> </child> @@ -165,11 +161,15 @@ <object class="GtkCheckButton" id="noassignment"> <property name="label" translatable="yes" context="labelselectiondialog|noassignment">_No assignment</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="image_position">right</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="noassignment-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="labelselectiondialog|extended_tip|noassignment">Check the “No assignment” box to remove the link between a control and the assigned label field.</property> + </object> + </child> </object> <packing> <property name="expand">False</property> @@ -191,5 +191,10 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child internal-child="accessible"> + <object class="AtkObject" id="LabelSelectionDialog-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="labelselectiondialog|extended_tip|LabelSelectionDialog">Specifies the source for the label of the control.</property> + </object> + </child> </object> </interface> diff --git a/extensions/uiconfig/spropctrlr/ui/multiline.ui b/extensions/uiconfig/spropctrlr/ui/multiline.ui index a17e7bb7d609..d9570489a972 100644 --- a/extensions/uiconfig/spropctrlr/ui/multiline.ui +++ b/extensions/uiconfig/spropctrlr/ui/multiline.ui @@ -5,6 +5,7 @@ <object class="GtkPopover" id="popover"> <property name="can_focus">False</property> <property name="no_show_all">True</property> + <property name="constrain-to">none</property> <child> <object class="GtkBox" id="container"> <property name="visible">True</property> |