diff options
Diffstat (limited to 'fpicker')
44 files changed, 324 insertions, 364 deletions
diff --git a/fpicker/inc/bitmaps.hlst b/fpicker/inc/bitmaps.hlst index 5771d6134b05..201eb0580063 100644 --- a/fpicker/inc/bitmaps.hlst +++ b/fpicker/inc/bitmaps.hlst @@ -9,8 +9,8 @@ #pragma once -inline constexpr OUStringLiteral BMP_FILEDLG_PLACE_LOCAL = u"fpicker/res/fp015.png"; -inline constexpr OUStringLiteral BMP_FILEDLG_PLACE_REMOTE = u"fpicker/res/fp016.png"; -inline constexpr OUStringLiteral RID_BMP_FOLDER = u"svtools/res/folder.png"; +inline constexpr OUString BMP_FILEDLG_PLACE_LOCAL = u"fpicker/res/fp015.png"_ustr; +inline constexpr OUString BMP_FILEDLG_PLACE_REMOTE = u"fpicker/res/fp016.png"_ustr; +inline constexpr OUString RID_BMP_FOLDER = u"svtools/res/folder.png"_ustr; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/fpicker/inc/fpsofficeResMgr.hxx b/fpicker/inc/fpsofficeResMgr.hxx deleted file mode 100644 index a86a91509c38..000000000000 --- a/fpicker/inc/fpsofficeResMgr.hxx +++ /dev/null @@ -1,15 +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/. - */ -#pragma once - -#include <unotools/resmgr.hxx> - -inline OUString FpsResId(TranslateId aId) { return Translate::get(aId, Translate::Create("fps")); }; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/inc/strings.hrc b/fpicker/inc/strings.hrc index 042ea35c44ce..bb5f553f5067 100644 --- a/fpicker/inc/strings.hrc +++ b/fpicker/inc/strings.hrc @@ -19,7 +19,7 @@ #pragma once -#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) +#define NC_(Context, String) TranslateId(Context, u8##String) #define STR_EXPLORERFILE_OPEN NC_("STR_EXPLORERFILE_OPEN", "Open") #define STR_EXPLORERFILE_SAVE NC_("STR_EXPLORERFILE_SAVE", "Save as") diff --git a/fpicker/source/aqua/ControlHelper.hxx b/fpicker/source/aqua/ControlHelper.hxx index 5da540df61ec..ede5d0b0d574 100644 --- a/fpicker/source/aqua/ControlHelper.hxx +++ b/fpicker/source/aqua/ControlHelper.hxx @@ -69,6 +69,7 @@ public: enum ToggleType { AUTOEXTENSION, //but autoextension is handled differently on MacOSX PASSWORD, + GPGENCRYPTION, FILTEROPTIONS, READONLY, LINK, diff --git a/fpicker/source/aqua/ControlHelper.mm b/fpicker/source/aqua/ControlHelper.mm index 88f0b655cb58..46c8c549035f 100644 --- a/fpicker/source/aqua/ControlHelper.mm +++ b/fpicker/source/aqua/ControlHelper.mm @@ -184,10 +184,12 @@ void ControlHelper::initialize( sal_Int16 nTemplateId ) case FILESAVE_AUTOEXTENSION_PASSWORD: m_bToggleVisibility[AUTOEXTENSION] = true; m_bToggleVisibility[PASSWORD] = true; + m_bToggleVisibility[GPGENCRYPTION] = true; break; case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS: m_bToggleVisibility[AUTOEXTENSION] = true; m_bToggleVisibility[PASSWORD] = true; + m_bToggleVisibility[GPGENCRYPTION] = true; m_bToggleVisibility[FILTEROPTIONS] = true; break; case FILESAVE_AUTOEXTENSION_SELECTION: @@ -602,6 +604,7 @@ int ControlHelper::getControlElementName(const Class aClazz, const int nControlI switch (nControlId) { TOGGLE_ELEMENT( AUTOEXTENSION ); TOGGLE_ELEMENT( PASSWORD ); + TOGGLE_ELEMENT( GPGENCRYPTION ); TOGGLE_ELEMENT( FILTEROPTIONS ); TOGGLE_ELEMENT( READONLY ); TOGGLE_ELEMENT( LINK ); @@ -725,6 +728,7 @@ case ExtendedFilePickerElementIds::LISTBOX_##elem##_LABEL: \ { MAP_TOGGLE( AUTOEXTENSION ); MAP_TOGGLE( PASSWORD ); + MAP_TOGGLE( GPGENCRYPTION ); MAP_TOGGLE( FILTEROPTIONS ); MAP_TOGGLE( READONLY ); MAP_TOGGLE( LINK ); diff --git a/fpicker/source/aqua/FilterHelper.hxx b/fpicker/source/aqua/FilterHelper.hxx index 6cf4aec5996e..56463126c945 100644 --- a/fpicker/source/aqua/FilterHelper.hxx +++ b/fpicker/source/aqua/FilterHelper.hxx @@ -27,6 +27,7 @@ #include <com/sun/star/uno/RuntimeException.hpp> #include <list> +#include <string_view> #include <vector> #include <premac.h> @@ -38,7 +39,7 @@ typedef css::uno::Sequence< UnoFilterEntry > UnoFilterList; // can be transpo typedef ::std::list<NSString *> NSStringList; typedef ::std::list<OUString> OUStringList; -struct FilterEntry +struct AquaFilterEntry { protected: OUString m_sTitle; @@ -46,13 +47,13 @@ protected: UnoFilterList m_aSubFilters; public: - FilterEntry( const OUString& _rTitle, const OUStringList _rFilter ) + AquaFilterEntry( const OUString& _rTitle, const OUStringList _rFilter ) : m_sTitle( _rTitle ) , m_sFilterSuffixList( _rFilter ) { } - FilterEntry( const OUString& _rTitle, const UnoFilterList& _rSubFilters ); + AquaFilterEntry( const OUString& _rTitle, const UnoFilterList& _rSubFilters ); OUString const & getTitle() const { return m_sTitle; } OUStringList const & getFilterSuffixList() const { return m_sFilterSuffixList; } @@ -71,7 +72,7 @@ public: const UnoFilterEntry* endSubFilters() const { return m_aSubFilters.getConstArray() + m_aSubFilters.getLength(); } }; -typedef ::std::vector < FilterEntry > FilterList; +typedef ::std::vector < AquaFilterEntry > FilterList; class FilterHelper { @@ -82,7 +83,7 @@ public: //XFilterManager delegates /// @throws css::lang::IllegalArgumentException /// @throws css::uno::RuntimeException - void appendFilter( const OUString& aTitle, const OUString& aFilter ); + void appendFilter( const OUString& aTitle, std::u16string_view aFilter ); /// @throws css::lang::IllegalArgumentException /// @throws css::uno::RuntimeException diff --git a/fpicker/source/aqua/FilterHelper.mm b/fpicker/source/aqua/FilterHelper.mm index fc6bca998755..98c27b720728 100644 --- a/fpicker/source/aqua/FilterHelper.mm +++ b/fpicker/source/aqua/FilterHelper.mm @@ -21,6 +21,9 @@ #include <sal/log.hxx> #include <algorithm> +#include <cstddef> +#include <string_view> +#include <o3tl/string_view.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> @@ -31,12 +34,12 @@ namespace { -void fillSuffixList(OUStringList& aSuffixList, const OUString& suffixString) { - sal_Int32 nIndex = 0; +void fillSuffixList(OUStringList& aSuffixList, std::u16string_view suffixString) { + std::size_t nIndex = 0; do { - OUString aToken = suffixString.getToken( 0, ';', nIndex ); - aSuffixList.push_back(aToken.copy(1)); - } while ( nIndex >= 0 ); + std::u16string_view aToken = o3tl::getToken( suffixString, u';', nIndex ); + aSuffixList.push_back(OUString(aToken.substr(1))); + } while ( nIndex != std::u16string_view::npos ); } } @@ -45,14 +48,14 @@ void fillSuffixList(OUStringList& aSuffixList, const OUString& suffixString) { #pragma mark FilterEntry -FilterEntry::FilterEntry( const OUString& _rTitle, const UnoFilterList& _rSubFilters ) +AquaFilterEntry::AquaFilterEntry( const OUString& _rTitle, const UnoFilterList& _rSubFilters ) :m_sTitle( _rTitle ) ,m_aSubFilters( _rSubFilters ) { } -bool FilterEntry::hasSubFilters() const +bool AquaFilterEntry::hasSubFilters() const { bool bReturn = ( 0 < m_aSubFilters.getLength() ); @@ -60,7 +63,7 @@ bool FilterEntry::hasSubFilters() const } -sal_Int32 FilterEntry::getSubFilters( UnoFilterList& _rSubFilterList ) +sal_Int32 AquaFilterEntry::getSubFilters( UnoFilterList& _rSubFilterList ) { _rSubFilterList = m_aSubFilters; sal_Int32 nReturn = m_aSubFilters.getLength(); @@ -70,24 +73,22 @@ sal_Int32 FilterEntry::getSubFilters( UnoFilterList& _rSubFilterList ) #pragma mark statics static bool -isFilterString( const OUString& rFilterString, const char *pMatch ) +isFilterString( std::u16string_view rFilterString, std::u16string_view pMatch ) { - sal_Int32 nIndex = 0; - OUString aToken; + std::size_t nIndex = 0; + std::u16string_view aToken; bool bIsFilter = true; - OUString aMatch(OUString::createFromAscii(pMatch)); - do { - aToken = rFilterString.getToken( 0, ';', nIndex ); - if( !aToken.match( aMatch ) ) + aToken = o3tl::getToken( rFilterString, u';', nIndex ); + if( !o3tl::starts_with( aToken, pMatch ) ) { bIsFilter = false; break; } } - while( nIndex >= 0 ); + while( nIndex != std::u16string_view::npos ); return bIsFilter; } @@ -109,11 +110,11 @@ shrinkFilterName( const OUString& aFilterName, bool bAllowNoStar = false ) sal_Int32 nBracketLen = nBracketEnd - i; if( nBracketEnd <= 0 ) continue; - if( isFilterString( aFilterName.copy( i + 1, nBracketLen - 1 ), "*." ) ) + if( isFilterString( aFilterName.subView( i + 1, nBracketLen - 1 ), u"*." ) ) aRealName = aRealName.replaceAt( i, nBracketLen + 1, u"" ); else if (bAllowNoStar) { - if( isFilterString( aFilterName.copy( i + 1, nBracketLen - 1 ), ".") ) + if( isFilterString( aFilterName.subView( i + 1, nBracketLen - 1 ), u".") ) aRealName = aRealName.replaceAt( i, nBracketLen + 1, u"" ); } } @@ -134,7 +135,7 @@ public: FilterTitleMatch( const OUString& _rTitle ) : rTitle( _rTitle ) { } - bool operator () ( const FilterEntry& _rEntry ) + bool operator () ( const AquaFilterEntry& _rEntry ) { bool bMatch; if( !_rEntry.hasSubFilters() ) { @@ -259,7 +260,7 @@ void FilterHelper::SetFilters() } } -void FilterHelper::appendFilter(const OUString& aTitle, const OUString& aFilterString) +void FilterHelper::appendFilter(const OUString& aTitle, std::u16string_view aFilterString) { SolarMutexGuard aGuard; @@ -273,7 +274,7 @@ void FilterHelper::appendFilter(const OUString& aTitle, const OUString& aFilterS // append the filter OUStringList suffixList; fillSuffixList(suffixList, aFilterString); - m_pFilterList->push_back(FilterEntry( aTitle, suffixList ) ); + m_pFilterList->push_back(AquaFilterEntry( aTitle, suffixList ) ); } void FilterHelper::setCurrentFilter( const OUString& aTitle ) @@ -304,7 +305,7 @@ void FilterHelper::appendFilterGroup( const css::uno::Sequence< css::beans::Stri // append the filter if (bPrependSeparator) { OUStringList emptyList; - m_pFilterList->push_back(FilterEntry("-", emptyList)); + m_pFilterList->push_back(AquaFilterEntry("-", emptyList)); } const css::beans::StringPair* pSubFilters = aFilters.getConstArray(); @@ -390,7 +391,7 @@ void FilterHelper::SetFilterAtIndex(unsigned index) if (m_pFilterList->size() <= index) { index = 0; } - FilterEntry entry = m_pFilterList->at(index); + AquaFilterEntry entry = m_pFilterList->at(index); SetCurFilter(entry.getTitle()); } diff --git a/fpicker/source/aqua/NSString_OOoAdditions.mm b/fpicker/source/aqua/NSString_OOoAdditions.mm index 23ae6bc5c853..5721674f8121 100644 --- a/fpicker/source/aqua/NSString_OOoAdditions.mm +++ b/fpicker/source/aqua/NSString_OOoAdditions.mm @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <memory> + #include "NSString_OOoAdditions.hxx" @implementation NSString (OOoAdditions) @@ -32,14 +36,14 @@ { unsigned int nFileNameLength = [self length]; - UniChar unichars[nFileNameLength+1]; + auto const unichars = std::make_unique<UniChar[]>(nFileNameLength+1); //'close' the string buffer correctly unichars[nFileNameLength] = '\0'; - [self getCharacters:unichars]; + [self getCharacters:unichars.get()]; - return OUString(reinterpret_cast<sal_Unicode *>(unichars)); + return OUString(reinterpret_cast<sal_Unicode *>(unichars.get())); } @end diff --git a/fpicker/source/aqua/SalAquaFolderPicker.mm b/fpicker/source/aqua/SalAquaFolderPicker.mm index 3dabf488a365..00021a487398 100644 --- a/fpicker/source/aqua/SalAquaFolderPicker.mm +++ b/fpicker/source/aqua/SalAquaFolderPicker.mm @@ -79,7 +79,7 @@ sal_Int16 SAL_CALL SalAquaFolderPicker::execute() break; default: - throw uno::RuntimeException("The dialog returned with an unknown result!", static_cast< cppu::OWeakObject * >( this )); + throw uno::RuntimeException("The dialog returned with an unknown result!", getXWeak()); break; } @@ -117,7 +117,7 @@ OUString SAL_CALL SalAquaFolderPicker::getDirectory() SAL_INFO("fpicker.aqua", "# of items: " << nFiles); if (nFiles < 1) { - throw uno::RuntimeException("no directory selected", static_cast< cppu::OWeakObject * >( this )); + throw uno::RuntimeException("no directory selected", getXWeak()); } OUString aDirectory; diff --git a/fpicker/source/aqua/resourceprovider.mm b/fpicker/source/aqua/resourceprovider.mm index 34b0359a231d..e3aa23a6f64e 100644 --- a/fpicker/source/aqua/resourceprovider.mm +++ b/fpicker/source/aqua/resourceprovider.mm @@ -29,7 +29,7 @@ #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include "NSString_OOoAdditions.hxx" -#include <fpsofficeResMgr.hxx> +#include <fpicker/fpsofficeResMgr.hxx> #include "resourceprovider.hxx" using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds; @@ -50,6 +50,7 @@ struct Entry Entry const CtrlIdToResIdTable[] = { { CHECKBOX_AUTOEXTENSION, STR_SVT_FILEPICKER_AUTO_EXTENSION }, { CHECKBOX_PASSWORD, STR_SVT_FILEPICKER_PASSWORD }, + { CHECKBOX_GPGENCRYPTION, STR_SVT_FILEPICKER_GPGENCRYPT }, { CHECKBOX_FILTEROPTIONS, STR_SVT_FILEPICKER_FILTER_OPTIONS }, { CHECKBOX_READONLY, STR_SVT_FILEPICKER_READONLY }, { CHECKBOX_LINK, STR_SVT_FILEPICKER_INSERT_AS_LINK }, diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx index 1ffb35fbf842..6cde40fb48cd 100644 --- a/fpicker/source/office/OfficeControlAccess.cxx +++ b/fpicker/source/office/OfficeControlAccess.cxx @@ -31,6 +31,7 @@ #include <tools/debug.hxx> #include <algorithm> +#include <utility> namespace svt @@ -139,8 +140,8 @@ namespace svt struct ControlPropertyLookup { OUString m_sLookup; - explicit ControlPropertyLookup(const OUString& rLookup) - : m_sLookup(rLookup) + explicit ControlPropertyLookup(OUString aLookup) + : m_sLookup(std::move(aLookup)) { } @@ -149,13 +150,6 @@ namespace svt return m_sLookup.equalsAscii(rProp.pPropertyName); } }; - - - void lcl_throwIllegalArgumentException( ) - { - throw IllegalArgumentException(); - // TODO: error message in the exception - } } OControlAccess::OControlAccess(IFilePickerController* pController, SvtFileView* pFileView) @@ -181,20 +175,19 @@ namespace svt if (aHID.GetProtocol() == INetProtocol::Hid) sHelpID = aHID.GetURLPath(); - // URLs should always be UTF8 encoded and escaped - OString sID( OUStringToOString( sHelpID, RTL_TEXTENCODING_UTF8 ) ); + // URLs should always be escaped if (IsFileViewWidget(pControl)) { // the file view "overrides" the SetHelpId - m_pFileView->set_help_id(sID); + m_pFileView->set_help_id(sHelpID); } else - pControl->set_help_id(sID); + pControl->set_help_id(sHelpID); } OUString OControlAccess::getHelpURL(weld::Widget const * pControl) const { - OString aHelpId = pControl->get_help_id(); + OUString aHelpId = pControl->get_help_id(); if (IsFileViewWidget(pControl)) { // the file view "overrides" the SetHelpId @@ -202,11 +195,10 @@ namespace svt } OUString sHelpURL; - OUString aTmp( OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ) ); - INetURLObject aHID( aTmp ); + INetURLObject aHID(aHelpId); if ( aHID.GetProtocol() == INetProtocol::NotValid ) sHelpURL = INET_HID_SCHEME; - sHelpURL += aTmp; + sHelpURL += aHelpId; return sHelpURL; } @@ -222,11 +214,11 @@ namespace svt ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( rControlProperty ) ); if ( aPropDesc == s_pPropertiesEnd ) // it's a completely unknown property - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); if ( !( nPropertyMask & aPropDesc->nPropertyId ) ) // it's a property which is known, but not allowed for this control - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); return implGetControlProperty( pControl, aPropDesc->nPropertyId ); } @@ -248,7 +240,7 @@ namespace svt // if not found 'til here, the name is invalid, or we do not have the control in the current mode if ( !pControl ) - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); // out parameters and outta here if ( _pId ) @@ -269,7 +261,7 @@ namespace svt // look up the property ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( rControlProperty ) ); if ( aPropDesc == s_pPropertiesEnd ) - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); // set the property implSetControlProperty( nControlId, pControl, aPropDesc->nPropertyId, rValue, false ); @@ -508,7 +500,7 @@ namespace svt if ( aTemplateList.hasElements() ) { - for ( const OUString& s : std::as_const(aTemplateList) ) + for (const OUString& s : aTemplateList) pListbox->append_text( s ); } } @@ -555,7 +547,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -569,7 +561,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -583,7 +575,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -597,7 +589,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -614,7 +606,7 @@ namespace svt pComboBox->clear(); // add the new ones - for (auto const & item : std::as_const(aItems)) + for (auto const& item : aItems) { pComboBox->append_text(item); } @@ -622,7 +614,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -639,7 +631,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -656,7 +648,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -673,7 +665,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 49a00f429fb2..c0ba40632a0c 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -23,6 +23,7 @@ #include "iodlg.hxx" #include "RemoteFilesDialog.hxx" +#include <utility> #include <vector> #include <algorithm> #include <sal/log.hxx> @@ -44,7 +45,6 @@ using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::awt; -using namespace ::utl; struct FilterEntry @@ -56,13 +56,13 @@ protected: UnoFilterList m_aSubFilters; public: - FilterEntry( const OUString& _rTitle, const OUString& _rFilter ) - :m_sTitle( _rTitle ) - ,m_sFilter( _rFilter ) + FilterEntry( OUString _aTitle, OUString _aFilter ) + :m_sTitle(std::move( _aTitle )) + ,m_sFilter(std::move( _aFilter )) { } - FilterEntry( const OUString& _rTitle, const UnoFilterList& _rSubFilters ); + FilterEntry( OUString _aTitle, const UnoFilterList& _rSubFilters ); const OUString& getTitle() const { return m_sTitle; } const OUString& getFilter() const { return m_sFilter; } @@ -80,8 +80,8 @@ public: }; -FilterEntry::FilterEntry( const OUString& _rTitle, const UnoFilterList& _rSubFilters ) - :m_sTitle( _rTitle ) +FilterEntry::FilterEntry( OUString _aTitle, const UnoFilterList& _rSubFilters ) + :m_sTitle(std::move( _aTitle )) ,m_aSubFilters( _rSubFilters ) { } @@ -424,7 +424,7 @@ sal_Int16 SvtFilePicker::implExecutePicker( ) // now we are ready to execute the dialog sal_Int16 nRet = m_xDlg->run(); - // the execution of the dialog yields, so it is possible the at this point the window or the dialog is closed + // coverity[check_after_deref] - the execution of the dialog yields, so it is possible the at this point the window or the dialog is closed if (m_xDlg) m_xDlg->SetFileCallback( nullptr ); @@ -463,7 +463,15 @@ IMPLEMENT_FORWARD_XINTERFACE3( SvtRemoteFilePicker, SvtFilePicker, OCommonPicker // disambiguate XTypeProvider -IMPLEMENT_FORWARD_XTYPEPROVIDER3( SvtRemoteFilePicker, SvtFilePicker, OCommonPicker, SvtFilePicker_Base ) +css::uno::Sequence< css::uno::Type > SAL_CALL SvtRemoteFilePicker::getTypes( ) +{ + return ::comphelper::concatSequences( + SvtFilePicker::getTypes(), + OCommonPicker::getTypes(), + SvtFilePicker_Base::getTypes() + ); +} +IMPLEMENT_GET_IMPLEMENTATION_ID( SvtRemoteFilePicker ) // XExecutableDialog functions @@ -872,7 +880,7 @@ void SAL_CALL SvtFilePicker::appendFilterGroup( const OUString& sGroupTitle, if ( FilterNameExists( aFilters ) ) throw IllegalArgumentException( "filter name exists", - static_cast< OWeakObject * >(this), 1); + getXWeak(), 1); // ensure that we have a filter list OUString sInitialCurrentFilter; diff --git a/fpicker/source/office/OfficeFolderPicker.cxx b/fpicker/source/office/OfficeFolderPicker.cxx index c941d6cb63c3..779bbffda7ad 100644 --- a/fpicker/source/office/OfficeFolderPicker.cxx +++ b/fpicker/source/office/OfficeFolderPicker.cxx @@ -30,7 +30,6 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; SvtFolderPicker::SvtFolderPicker() { diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx index 050cee39c113..86bd505179a3 100644 --- a/fpicker/source/office/PlacesListBox.cxx +++ b/fpicker/source/office/PlacesListBox.cxx @@ -29,6 +29,7 @@ PlacesListBox::PlacesListBox(std::unique_ptr<weld::TreeView> xControl, mxImpl->connect_changed( LINK( this, PlacesListBox, Selection ) ); mxImpl->connect_row_activated( LINK( this, PlacesListBox, DoubleClick ) ) ; + mxImpl->connect_query_tooltip(LINK(this, PlacesListBox, QueryTooltipHdl)); } PlacesListBox::~PlacesListBox( ) @@ -136,6 +137,17 @@ IMPL_LINK_NOARG( PlacesListBox, DoubleClick, weld::TreeView&, bool ) return true; } +IMPL_LINK(PlacesListBox, QueryTooltipHdl, const weld::TreeIter&, rIter, OUString) +{ + const OUString sText = mxImpl->get_text(rIter); + for (const auto& pPlace : maPlaces) + { + if (pPlace->GetName() == sText) + return pPlace->GetUrlObject().GetMainURL(INetURLObject::DecodeMechanism::Unambiguous); + } + return OUString(); +} + void PlacesListBox::updateView( ) { sal_uInt32 nSelected = mxImpl->get_cursor_index(); diff --git a/fpicker/source/office/PlacesListBox.hxx b/fpicker/source/office/PlacesListBox.hxx index ca507e06ae3a..934126072d53 100644 --- a/fpicker/source/office/PlacesListBox.hxx +++ b/fpicker/source/office/PlacesListBox.hxx @@ -52,7 +52,7 @@ public: void SetDelEnabled( bool enabled ); void updateView( ); - void set_help_id(const OString& rHelpId) { mxImpl->set_help_id(rHelpId); } + void set_help_id(const OUString& rHelpId) { mxImpl->set_help_id(rHelpId); } private: @@ -60,6 +60,7 @@ private: DECL_LINK( Selection, weld::TreeView&, void ); DECL_LINK( DoubleClick, weld::TreeView&, bool ); + DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 64dccd911941..ad23cc0dd888 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -12,7 +12,7 @@ #include "fpsmartcontent.hxx" #include "QueryFolderName.hxx" #include "RemoteFilesDialog.hxx" -#include <fpsofficeResMgr.hxx> +#include <fpicker/fpsofficeResMgr.hxx> #include <fpicker/strings.hrc> #include <strings.hrc> #include <comphelper/docpasswordrequest.hxx> @@ -124,7 +124,7 @@ RemoteFilesDialog::~RemoteFilesDialog() if( !m_sIniKey.isEmpty() ) { SvtViewOptions aDlgOpt( EViewType::Dialog, m_sIniKey ); - aDlgOpt.SetWindowState(OStringToOUString(m_xDialog->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_UTF8)); + aDlgOpt.SetWindowState(m_xDialog->get_window_state(vcl::WindowDataMask::All)); Size aSize(m_xDialog->get_size()); @@ -133,11 +133,11 @@ RemoteFilesDialog::~RemoteFilesDialog() OUString sUserData = m_xFileView->GetConfigString(); aDlgOpt.SetUserItem( "UserData", - makeAny( sSize + sUserData ) ); + Any( sSize + sUserData ) ); } // save services - std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create( m_xContext ) ); + std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() ); officecfg::Office::Common::Misc::FilePickerLastService::set( m_sLastServiceUrl, batch ); @@ -195,8 +195,6 @@ static OUString lcl_GetServiceType( const ServicePtr& pService ) INetProtocol aProtocol = pService->GetUrlObject().GetProtocol(); switch( aProtocol ) { - case INetProtocol::Ftp: - return "FTP"; case INetProtocol::Cmis: { OUString sHost = pService->GetUrlObject().GetHost( INetURLObject::DecodeMechanism::WithCharset ); @@ -236,7 +234,7 @@ void RemoteFilesDialog::InitSize() if( !aDlgOpt.Exists() ) return; - m_xDialog->set_window_state(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_UTF8)); + m_xDialog->set_window_state(aDlgOpt.GetWindowState()); Any aUserData = aDlgOpt.GetUserItem( "UserData" ); OUString sCfgStr; @@ -248,7 +246,7 @@ void RemoteFilesDialog::InitSize() sal_Int32 nPos2{ sCfgStr.indexOf('|', nPos1+1 ) }; if (nPos2<0) return; - m_xFileView->SetConfigString( sCfgStr.copy(nPos2+1) ); + m_xFileView->SetConfigString( sCfgStr.subView(nPos2+1) ); } } @@ -258,13 +256,13 @@ void RemoteFilesDialog::FillServicesListbox() m_aServices.clear(); // Load from user settings - Sequence< OUString > placesUrlsList( officecfg::Office::Common::Misc::FilePickerPlacesUrls::get( m_xContext ) ); - Sequence< OUString > placesNamesList( officecfg::Office::Common::Misc::FilePickerPlacesNames::get( m_xContext ) ); + Sequence< OUString > placesUrlsList( officecfg::Office::Common::Misc::FilePickerPlacesUrls::get() ); + Sequence< OUString > placesNamesList( officecfg::Office::Common::Misc::FilePickerPlacesNames::get() ); unsigned int nPos = 0; unsigned int i = 0; - m_sLastServiceUrl = officecfg::Office::Common::Misc::FilePickerLastService::get( m_xContext ); + m_sLastServiceUrl = officecfg::Office::Common::Misc::FilePickerLastService::get(); for( sal_Int32 nPlace = 0; nPlace < placesUrlsList.getLength() && nPlace < placesNamesList.getLength(); ++nPlace ) { @@ -566,9 +564,9 @@ IMPL_LINK_NOARG( RemoteFilesDialog, SelectServiceHdl, weld::ComboBox&, void ) } } -IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, const OString&, rIdent, void ) +IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, const OUString&, rIdent, void ) { - OString sIdent(rIdent); + OUString sIdent(rIdent); if( sIdent == "edit_service" && m_xServices_lb->get_count() > 0 ) { int nSelected = m_xServices_lb->get_active(); @@ -686,8 +684,7 @@ IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, const OString&, rIdent, void if ( pPasswordRequest->isPassword() ) { - OUString aNewPass = pPasswordRequest->getPassword(); - Sequence<OUString> aPasswd { aNewPass }; + Sequence<OUString> aPasswd { pPasswordRequest->getPassword() }; m_xMasterPasswd->addPersistent( sUrl, sUserName, aPasswd, xInteractionHandler ); diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx index 3dfb4e1dc9aa..8c4fa0a4cbb3 100644 --- a/fpicker/source/office/RemoteFilesDialog.hxx +++ b/fpicker/source/office/RemoteFilesDialog.hxx @@ -161,7 +161,7 @@ private: void AddService(); DECL_LINK ( SelectServiceHdl, weld::ComboBox&, void ); - DECL_LINK ( EditServiceMenuHdl, const OString&, void ); + DECL_LINK ( EditServiceMenuHdl, const OUString&, void ); DECL_LINK( DoubleClickHdl, SvtFileView*, bool ); DECL_LINK( SelectHdl, SvtFileView*, void ); diff --git a/fpicker/source/office/autocmpledit.cxx b/fpicker/source/office/autocmpledit.cxx index 5a31c7bdc501..89a2d0b0c245 100644 --- a/fpicker/source/office/autocmpledit.cxx +++ b/fpicker/source/office/autocmpledit.cxx @@ -7,21 +7,44 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <vcl/event.hxx> #include "autocmpledit.hxx" AutocompleteEdit::AutocompleteEdit(std::unique_ptr<weld::Entry> xEntry) : m_xEntry(std::move(xEntry)) , m_aChangedIdle("fpicker::AutocompleteEdit m_aChangedIdle") + , m_nLastCharCode(0) { m_xEntry->connect_changed(LINK(this, AutocompleteEdit, ChangedHdl)); + m_xEntry->connect_key_press(LINK(this, AutocompleteEdit, KeyInputHdl)); m_aChangedIdle.SetInvokeHandler(LINK(this, AutocompleteEdit, TryAutoComplete)); } +IMPL_LINK(AutocompleteEdit, KeyInputHdl, const KeyEvent&, rKEvt, bool) +{ + m_nLastCharCode = rKEvt.GetKeyCode().GetCode(); + return false; +} + IMPL_LINK_NOARG(AutocompleteEdit, ChangedHdl, weld::Entry&, void) { m_aChangeHdl.Call(*m_xEntry); - m_aChangedIdle.Start(); //launch this to happen on idle after cursor position will have been set + + switch (m_nLastCharCode) + { + case css::awt::Key::DELETE_WORD_BACKWARD: + case css::awt::Key::DELETE_WORD_FORWARD: + case css::awt::Key::DELETE_TO_BEGIN_OF_LINE: + case css::awt::Key::DELETE_TO_END_OF_LINE: + case KEY_BACKSPACE: + case KEY_DELETE: + m_aChangedIdle.Stop(); + break; + default: + m_aChangedIdle.Start(); //launch this to happen on idle after cursor position will have been set + break; + } } void AutocompleteEdit::AddEntry( const OUString& rEntry ) diff --git a/fpicker/source/office/autocmpledit.hxx b/fpicker/source/office/autocmpledit.hxx index bfb2ee096a63..3eb79eb14aa6 100644 --- a/fpicker/source/office/autocmpledit.hxx +++ b/fpicker/source/office/autocmpledit.hxx @@ -22,7 +22,9 @@ private: std::vector<OUString> m_aMatching; Idle m_aChangedIdle; Link<weld::Entry&, void> m_aChangeHdl; + sal_uInt16 m_nLastCharCode; + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); DECL_LINK(ChangedHdl, weld::Entry&, void); DECL_LINK(TryAutoComplete, Timer*, void); diff --git a/fpicker/source/office/commonpicker.cxx b/fpicker/source/office/commonpicker.cxx index 29ae5d08b6c9..8b7f2827df4a 100644 --- a/fpicker/source/office/commonpicker.cxx +++ b/fpicker/source/office/commonpicker.cxx @@ -452,7 +452,7 @@ namespace svt DBG_ASSERT( bKnownSetting, OString( "OCommonPicker::initialize: unknown argument \"" - + OString(sSettingName.getStr(), sSettingName.getLength(), osl_getThreadTextEncoding()) + + OUStringToOString(sSettingName, osl_getThreadTextEncoding()) + "\"!").getStr() ); } } diff --git a/fpicker/source/office/contentenumeration.cxx b/fpicker/source/office/contentenumeration.cxx index 737808e10b62..2a5b0156480a 100644 --- a/fpicker/source/office/contentenumeration.cxx +++ b/fpicker/source/office/contentenumeration.cxx @@ -32,7 +32,7 @@ #include <vcl/svapp.hxx> #include <osl/mutex.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <tools/urlobj.hxx> namespace svt @@ -63,9 +63,6 @@ namespace svt using ::com::sun::star::ucb::CommandAbortedException; using ::com::sun::star::ucb::XContentAccess; using ::com::sun::star::ucb::XCommandEnvironment; - using ::com::sun::star::beans::PropertyValue; - using ::com::sun::star::document::DocumentProperties; - using ::ucbhelper::ResultSetInclude; using ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS; @@ -92,7 +89,7 @@ namespace svt void FileViewContentEnumerator::cancel() { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); m_bCancelled = true; m_pResultHandler = nullptr; m_aFolder.aContent = ::ucbhelper::Content(); @@ -105,7 +102,7 @@ namespace svt const css::uno::Sequence< OUString >& rDenyList ) { { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); m_aFolder = _rFolder; m_pResultHandler = nullptr; m_rDenyList = rDenyList; @@ -117,7 +114,7 @@ namespace svt void FileViewContentEnumerator::enumerateFolderContent( const FolderDescriptor& _rFolder, IEnumerationResultHandler* _pResultHandler ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); m_aFolder = _rFolder; m_pResultHandler = _pResultHandler; @@ -157,7 +154,7 @@ namespace svt { FolderDescriptor aFolder; { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); aFolder = m_aFolder; xEnvironment = m_xCommandEnv; } @@ -165,7 +162,7 @@ namespace svt { aFolder.aContent = ::ucbhelper::Content( aFolder.sURL, xEnvironment, comphelper::getProcessComponentContext() ); { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); m_aFolder.aContent = aFolder.aContent; } } @@ -215,7 +212,7 @@ namespace svt // check for restrictions { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if ( /* m_rDenyList.hasElements() && */ URLOnDenyList ( sRealURL ) ) continue; } @@ -251,7 +248,6 @@ namespace svt if ( pData->mbIsFolder ) { - SolarMutexGuard aGuard; ::svtools::VolumeInfo aVolInfo( pData->mbIsVolume, pData->mbIsRemote, pData->mbIsRemoveable, pData->mbIsFloppy, pData->mbIsCompactDisc ); @@ -268,7 +264,7 @@ namespace svt } { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); bCancelled = m_bCancelled; } } @@ -287,7 +283,7 @@ namespace svt IEnumerationResultHandler* pHandler = nullptr; { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); pHandler = m_pResultHandler; if ( m_bCancelled ) return EnumerationResult::ERROR; @@ -306,9 +302,9 @@ namespace svt } - bool FileViewContentEnumerator::URLOnDenyList ( const OUString& sRealURL ) + bool FileViewContentEnumerator::URLOnDenyList ( std::u16string_view sRealURL ) { - OUString entryName = sRealURL.copy( sRealURL.lastIndexOf( '/' ) + 1 ); + std::u16string_view entryName = sRealURL.substr( sRealURL.rfind( '/' ) + 1 ); return comphelper::findValue(m_rDenyList, entryName) != -1; } diff --git a/fpicker/source/office/contentenumeration.hxx b/fpicker/source/office/contentenumeration.hxx index bc2180c53c47..d15db4d7a55f 100644 --- a/fpicker/source/office/contentenumeration.hxx +++ b/fpicker/source/office/contentenumeration.hxx @@ -22,12 +22,14 @@ #include <sal/config.h> #include <memory> +#include <mutex> #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <salhelper/thread.hxx> #include <ucbhelper/content.hxx> #include <rtl/ustring.hxx> #include <tools/datetime.hxx> +#include <utility> namespace svt { @@ -132,8 +134,8 @@ namespace svt FolderDescriptor() { } - explicit FolderDescriptor( const OUString& _rURL ) - :sURL( _rURL ) + explicit FolderDescriptor( OUString _aURL ) + :sURL(std::move( _aURL )) { } }; @@ -162,7 +164,7 @@ namespace svt ContentData& m_rContent; ::osl::Mutex& m_rContentMutex; - mutable ::osl::Mutex m_aMutex; + mutable std::mutex m_aMutex; FolderDescriptor m_aFolder; css::uno::Reference< css::ucb::XCommandEnvironment > @@ -172,7 +174,7 @@ namespace svt css::uno::Sequence< OUString > m_rDenyList; - bool URLOnDenyList ( const OUString& sRealURL ); + bool URLOnDenyList ( std::u16string_view sRealURL ); public: /** constructs an enumerator instance diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx index 7086d17597a9..6a77f9154ac8 100644 --- a/fpicker/source/office/fileview.cxx +++ b/fpicker/source/office/fileview.cxx @@ -47,6 +47,7 @@ #include <rtl/math.hxx> #include <o3tl/safeint.hxx> #include <o3tl/typed_flags_set.hxx> +#include <o3tl/string_view.hxx> #include <osl/mutex.hxx> #include <osl/conditn.hxx> #include <salhelper/timer.hxx> @@ -63,7 +64,6 @@ #include <memory> #include "fileview.hxx" -using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::task; using namespace ::com::sun::star::ucb; @@ -192,8 +192,8 @@ public: void grab_focus() { mxTreeView->grab_focus(); } bool has_focus() const { return mxTreeView->has_focus(); } - void set_help_id(const OString& rHelpId) { mxTreeView->set_help_id(rHelpId); } - OString get_help_id() const { return mxTreeView->get_help_id(); } + void set_help_id(const OUString& rHelpId) { mxTreeView->set_help_id(rHelpId); } + OUString get_help_id() const { return mxTreeView->get_help_id(); } bool IsEditingActive() const { return mbEditing; } @@ -228,7 +228,7 @@ public: DECL_LINK(EditedEntryHdl, const IterString&, bool); DECL_LINK(KeyInputHdl, const KeyEvent&, bool); - void ExecuteContextMenuAction(std::string_view rSelectedPopentry); + void ExecuteContextMenuAction(std::u16string_view rSelectedPopentry); }; } @@ -286,7 +286,7 @@ public: void Clear(); FileViewResult GetFolderContent_Impl( - const OUString& rFolder, + std::u16string_view rFolder, const FileViewAsyncAction* pAsyncDescriptor, const css::uno::Sequence< OUString >& rDenyList ); @@ -294,7 +294,7 @@ public: const FolderDescriptor& _rFolder, const FileViewAsyncAction* pAsyncDescriptor, const css::uno::Sequence< OUString >& rDenyList ); - void FilterFolderContent_Impl( const OUString &rFilter ); + void FilterFolderContent_Impl( std::u16string_view rFilter ); void CancelRunningAsyncAction(); void OpenFolder_Impl(); @@ -408,10 +408,11 @@ namespace nDec = 3; } - OUString aSizeStr( ::rtl::math::doubleToUString( fSize, + OUString aSizeStr = + ::rtl::math::doubleToUString( fSize, rtl_math_StringFormat_F, nDec, - SvtSysLocale().GetLocaleData().getNumDecimalSep()[0]) ); - aSizeStr += aUnitStr; + SvtSysLocale().GetLocaleData().getNumDecimalSep()[0]) + + aUnitStr; return aSizeStr; } @@ -509,8 +510,8 @@ IMPL_LINK(ViewTabListBox_Impl, CommandHdl, const CommandEvent&, rCEvt, bool) ::ucbhelper::Content aCnt; try { - OUString aURL(reinterpret_cast<SvtContentEntry*>( - mxTreeView->get_id(rEntry).toInt64())->maURL); + OUString aURL(weld::fromId<SvtContentEntry*>( + mxTreeView->get_id(rEntry))->maURL); aCnt = ::ucbhelper::Content( aURL, mxCmdEnv, comphelper::getProcessComponentContext() ); } catch( Exception const & ) @@ -569,18 +570,18 @@ IMPL_LINK(ViewTabListBox_Impl, CommandHdl, const CommandEvent&, rCEvt, bool) auto xContextMenu = xBuilder->weld_menu("menu"); xContextMenu->set_visible("delete", bEnableDelete); xContextMenu->set_visible("rename", bEnableRename); - OString sCommand(xContextMenu->popup_at_rect(mxTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)))); + OUString sCommand(xContextMenu->popup_at_rect(mxTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)))); ExecuteContextMenuAction(sCommand); } return true; } -void ViewTabListBox_Impl::ExecuteContextMenuAction(std::string_view rSelectedPopupEntry) +void ViewTabListBox_Impl::ExecuteContextMenuAction(std::u16string_view rSelectedPopupEntry) { - if (rSelectedPopupEntry == "delete") + if (rSelectedPopupEntry == u"delete") DeleteEntries(); - else if (rSelectedPopupEntry == "rename") + else if (rSelectedPopupEntry == u"rename") { std::unique_ptr<weld::TreeIter> xEntry = mxTreeView->make_iterator(); if (mxTreeView->get_selected(xEntry.get())) @@ -602,7 +603,7 @@ void ViewTabListBox_Impl::DeleteEntries() mxTreeView->selected_foreach([this, &eResult](weld::TreeIter& rCurEntry){ OUString aURL; if (!mxTreeView->get_id(rCurEntry).isEmpty()) - aURL = reinterpret_cast<SvtContentEntry*>(mxTreeView->get_id(rCurEntry).toInt64())->maURL; + aURL = weld::fromId<SvtContentEntry*>(mxTreeView->get_id(rCurEntry))->maURL; if (aURL.isEmpty()) { mxTreeView->unselect(rCurEntry); @@ -677,7 +678,7 @@ IMPL_LINK(ViewTabListBox_Impl, EditedEntryHdl, const IterString&, rIterString, b bool bRet = false; OUString aURL; - SvtContentEntry* pData = reinterpret_cast<SvtContentEntry*>(mxTreeView->get_id(rEntry).toInt64()); + SvtContentEntry* pData = weld::fromId<SvtContentEntry*>(mxTreeView->get_id(rEntry)); if ( pData ) aURL = pData->maURL; @@ -719,7 +720,7 @@ IMPL_LINK(ViewTabListBox_Impl, EditedEntryHdl, const IterString&, rIterString, b if (pData) pData->maURL = aURL; - mxTreeView->set_id(rEntry, OUString::number(reinterpret_cast<sal_Int64>(pData))); + mxTreeView->set_id(rEntry, weld::toId(pData)); bRet = true; } @@ -770,7 +771,7 @@ bool ViewTabListBox_Impl::Kill( const OUString& rContent ) try { ::ucbhelper::Content aCnt( rContent, mxCmdEnv, comphelper::getProcessComponentContext() ); - aCnt.executeCommand( "delete", makeAny( true ) ); + aCnt.executeCommand( "delete", Any( true ) ); } catch( css::ucb::CommandAbortedException const & ) { @@ -831,9 +832,9 @@ OUString SvtFileView::GetURL(const weld::TreeIter& rEntry) const { SvtContentEntry* pEntry; if (mpImpl->mxView->get_visible()) - pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxView->get_id(rEntry).toInt64()); + pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxView->get_id(rEntry)); else - pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxIconView->get_id(rEntry).toInt64()); + pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxIconView->get_id(rEntry)); if (pEntry) return pEntry->maURL; return OUString(); @@ -847,13 +848,13 @@ OUString SvtFileView::GetCurrentURL() const { std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator(); if (mpImpl->mxView->get_selected(xEntry.get())) - pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry).toInt64()); + pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry)); } else { std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxIconView->make_iterator(); if (mpImpl->mxIconView->get_selected(xEntry.get())) - pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry).toInt64()); + pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry)); } if (pEntry) aURL = pEntry->maURL; @@ -865,7 +866,7 @@ void SvtFileView::CreatedFolder( const OUString& rUrl, const OUString& rNewFolde const SortingData_Impl& rEntry = mpImpl->FolderInserted( rUrl, rNewFolder ); mpImpl->maEntries.emplace_back(std::make_unique<SvtContentEntry>(rUrl, true)); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(mpImpl->maEntries.back().get()))); + OUString sId(weld::toId(mpImpl->maEntries.back().get())); std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator(); mpImpl->mxView->insert(rEntry.maDisplayName, sId, mpImpl->maFolderImage, *xEntry); @@ -913,12 +914,12 @@ bool SvtFileView::GetParentURL( OUString& rParentURL ) const return bRet; } -OString SvtFileView::get_help_id() const +OUString SvtFileView::get_help_id() const { return mpImpl->mxView->get_help_id(); } -void SvtFileView::set_help_id(const OString& rHelpId) +void SvtFileView::set_help_id(const OUString& rHelpId) { mpImpl->mxView->set_help_id(rHelpId); } @@ -1006,14 +1007,14 @@ SvtContentEntry* SvtFileView::FirstSelected() const SvtContentEntry* pRet = nullptr; std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator(); if (mpImpl->mxView->get_selected(xEntry.get())) - pRet = reinterpret_cast<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry).toInt64()); + pRet = weld::fromId<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry)); return pRet; } SvtContentEntry* pRet = nullptr; std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxIconView->make_iterator(); if (mpImpl->mxIconView->get_selected(xEntry.get())) - pRet = reinterpret_cast<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry).toInt64()); + pRet = weld::fromId<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry)); return pRet; } @@ -1098,19 +1099,19 @@ OUString SvtFileView::GetConfigString() const return aContent; } -void SvtFileView::SetConfigString(const OUString& rCfgStr) +void SvtFileView::SetConfigString(std::u16string_view rCfgStr) { sal_Int32 nIdx = 0; - sal_uInt16 nSortColumn = static_cast<sal_uInt16>(rCfgStr.getToken( 0, ';', nIdx ).toInt32()); - bool bAscending = static_cast<bool>(static_cast<sal_uInt16>(rCfgStr.getToken( 0, ';', nIdx ).toInt32())); + sal_uInt16 nSortColumn = static_cast<sal_uInt16>(o3tl::toInt32(o3tl::getToken(rCfgStr, 0, ';', nIdx ))); + bool bAscending = static_cast<bool>(static_cast<sal_uInt16>(o3tl::toInt32(o3tl::getToken(rCfgStr, 0, ';', nIdx )))); std::vector<int> aWidths(mpImpl->mxView->TypeColumnVisible() ? 4 : 3, -1); while ( nIdx != -1 ) { - sal_uInt16 nItemId = static_cast<sal_uInt16>(rCfgStr.getToken( 0, ';', nIdx ).toInt32()); + sal_uInt16 nItemId = static_cast<sal_uInt16>(o3tl::toInt32(o3tl::getToken(rCfgStr, 0, ';', nIdx ))); - int nWidth = rCfgStr.getToken( 0, ';', nIdx ).toInt32(); + int nWidth = o3tl::toInt32(o3tl::getToken(rCfgStr, 0, ';', nIdx )); // skip "TYPE" if (!mpImpl->mxView->TypeColumnVisible() && nItemId != COLUMN_TITLE) @@ -1171,7 +1172,7 @@ void SvtFileView_Impl::Clear() } FileViewResult SvtFileView_Impl::GetFolderContent_Impl( - const OUString& rFolder, + std::u16string_view rFolder, const FileViewAsyncAction* pAsyncDescriptor, const css::uno::Sequence< OUString >& rDenyList ) { @@ -1285,9 +1286,9 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl( return eFailure; } -void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter ) +void SvtFileView_Impl::FilterFolderContent_Impl( std::u16string_view rFilter ) { - if ( rFilter.isEmpty() || ( rFilter == ALL_FILES_FILTER ) ) + if ( rFilter.empty() || ( rFilter == ALL_FILES_FILTER ) ) // when replacing names, there is always something to filter (no view of ".nametranslation.table") return; @@ -1302,7 +1303,7 @@ void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter ) // do the filtering - maContent.erase(std::remove_if(maContent.begin(), maContent.end(), + std::erase_if(maContent, [&aFilters](const std::unique_ptr<SortingData_Impl>& rxContent) { if (rxContent->mbIsFolder) return false; @@ -1310,8 +1311,7 @@ void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter ) // 91872 - 11.09.2001 - frank.schoenheit@sun.com OUString sCompareString = rxContent->GetFileName(); // filter works on file name, not on title! return std::none_of(aFilters.begin(), aFilters.end(), FilterMatch(sCompareString)); - }), - maContent.end()); + }); } IMPL_LINK_NOARG(SvtFileView_Impl, ChangedHdl, weld::TreeView&, void) @@ -1369,7 +1369,7 @@ void SvtFileView_Impl::OpenFolder_Impl() // insert entry and set user data maEntries.emplace_back(std::make_unique<SvtContentEntry>(elem->maTargetURL, elem->mbIsFolder)); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(maEntries.back().get()))); + OUString sId(weld::toId(maEntries.back().get())); mxView->append(sId, elem->maDisplayName, elem->maType, elem->maDisplaySize, elem->maDisplayDate, elem->maImage); mxIconView->append(sId, elem->maDisplayName, elem->maImage); } @@ -1490,22 +1490,13 @@ void SvtFileView_Impl::implEnumerationSuccess() OUString SvtFileView_Impl::ReplaceTabWithString(const OUString& rValue) { - OUString const aTab( "\t" ); - OUString const aTabString( "%09" ); - - sal_Int32 iPos; - OUString aValue(rValue); - while ( ( iPos = aValue.indexOf( aTab ) ) >= 0 ) - aValue = aValue.replaceAt( iPos, 1, aTabString ); - return aValue; + return rValue.replaceAll(u"\t", u"%09"); } void SvtFileView_Impl::CreateDisplayText_Impl() { ::osl::MutexGuard aGuard( maMutex ); - OUString const aDateSep( ", " ); - for (auto const& elem : maContent) { // title, type, size, date @@ -1519,7 +1510,7 @@ void SvtFileView_Impl::CreateDisplayText_Impl() SvtSysLocale aSysLocale; const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData(); elem->maDisplayDate = rLocaleData.getDate( elem->maModDate ) - + aDateSep + + ", " + rLocaleData.getTime( elem->maModDate, false ); } @@ -1553,7 +1544,7 @@ void SvtFileView_Impl::Resort_Impl( sal_Int16 nColumn, bool bAscending ) OUString aEntryURL; if (bEntry && !mxView->get_id(*xEntry).isEmpty()) - aEntryURL = reinterpret_cast<SvtContentEntry*>(mxView->get_id(*xEntry).toInt64())->maURL; + aEntryURL = weld::fromId<SvtContentEntry*>(mxView->get_id(*xEntry))->maURL; mnSortColumn = nColumn; mbAscending = bAscending; diff --git a/fpicker/source/office/fileview.hxx b/fpicker/source/office/fileview.hxx index d86ee93900e1..a19c2095507f 100644 --- a/fpicker/source/office/fileview.hxx +++ b/fpicker/source/office/fileview.hxx @@ -20,6 +20,7 @@ #include <memory> #include <com/sun/star/uno/Sequence.h> +#include <utility> #include <vcl/weld.hxx> #include <rtl/ustring.hxx> @@ -81,8 +82,8 @@ public: bool GetParentURL( OUString& _rParentURL ) const; void CreatedFolder( const OUString& rUrl, const OUString& rNewFolder ); - void set_help_id(const OString& rHelpId); - OString get_help_id() const; + void set_help_id(const OUString& rHelpId); + OUString get_help_id() const; void grab_focus(); bool has_focus() const; @@ -162,7 +163,7 @@ public: // save and load column size and sort order OUString GetConfigString() const; - void SetConfigString( const OUString& rCfgStr ); + void SetConfigString( std::u16string_view rCfgStr ); void EndInplaceEditing(); @@ -176,8 +177,8 @@ struct SvtContentEntry bool mbIsFolder; OUString maURL; - SvtContentEntry( const OUString& rURL, bool bIsFolder ) : - mbIsFolder( bIsFolder ), maURL( rURL ) {} + SvtContentEntry( OUString aURL, bool bIsFolder ) : + mbIsFolder( bIsFolder ), maURL(std::move( aURL )) {} }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/foldertree.cxx b/fpicker/source/office/foldertree.cxx index 2c37f25677f2..9b704d6c41d8 100644 --- a/fpicker/source/office/foldertree.cxx +++ b/fpicker/source/office/foldertree.cxx @@ -126,7 +126,7 @@ void FolderTree::FillTreeEntry( const OUString & rUrl, const ::std::vector< std: m_xTreeView->expand_row(*xParent); } -void FolderTree::SetTreePath( OUString const & sUrl ) +void FolderTree::SetTreePath( std::u16string_view sUrl ) { INetURLObject aUrl( sUrl ); aUrl.setFinalSlash(); diff --git a/fpicker/source/office/foldertree.hxx b/fpicker/source/office/foldertree.hxx index 02381fc0bd58..e1ba25699c3b 100644 --- a/fpicker/source/office/foldertree.hxx +++ b/fpicker/source/office/foldertree.hxx @@ -41,7 +41,7 @@ public: void InsertRootEntry(const OUString& rId, const OUString& rRootLabel); void FillTreeEntry(const weld::TreeIter& rEntry); void FillTreeEntry(const OUString & rUrl, const ::std::vector< std::pair< OUString, OUString > >& rFolders); - void SetTreePath(OUString const & sUrl); + void SetTreePath(std::u16string_view sUrl); void SetDenyList(const css::uno::Sequence< OUString >& rDenyList); }; diff --git a/fpicker/source/office/fpdialogbase.hxx b/fpicker/source/office/fpdialogbase.hxx index 20ab362971f4..60205695b719 100644 --- a/fpicker/source/office/fpdialogbase.hxx +++ b/fpicker/source/office/fpdialogbase.hxx @@ -52,14 +52,14 @@ namespace o3tl { template<> struct typed_flags<PickerFlags> : is_typed_flags<PickerFlags, 0x00ffff> {}; } -inline constexpr OUStringLiteral FILEDIALOG_FILTER_ALL = u"*.*"; +inline constexpr OUString FILEDIALOG_FILTER_ALL = u"*.*"_ustr; // SvtFileDialog_Base class SvtFileDialog_Base : public weld::GenericDialogController, public ::svt::IFilePickerController { public: - SvtFileDialog_Base(weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID) + SvtFileDialog_Base(weld::Window* pParent, const OUString& rUIXMLDescription, const OUString& rID) : weld::GenericDialogController(pParent, rUIXMLDescription, rID) { } diff --git a/fpicker/source/office/fpinteraction.cxx b/fpicker/source/office/fpinteraction.cxx index 16ea3368ae08..9d3591d7586b 100644 --- a/fpicker/source/office/fpinteraction.cxx +++ b/fpicker/source/office/fpinteraction.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/task/XInteractionRetry.hpp> #include <sal/log.hxx> +#include <utility> namespace svt @@ -34,8 +35,8 @@ namespace svt using namespace ::com::sun::star::task; using namespace ::com::sun::star::ucb; - OFilePickerInteractionHandler::OFilePickerInteractionHandler( const css::uno::Reference< css::task::XInteractionHandler >& _rxMaster ) - :m_xMaster( _rxMaster ) + OFilePickerInteractionHandler::OFilePickerInteractionHandler( css::uno::Reference< css::task::XInteractionHandler > _xMaster ) + :m_xMaster(std::move( _xMaster )) ,m_bUsed( false ) ,m_eInterceptions( OFilePickerInteractionHandler::E_NOINTERCEPTION ) { diff --git a/fpicker/source/office/fpinteraction.hxx b/fpicker/source/office/fpinteraction.hxx index 6aac9c18dcb6..84f4a43d60a4 100644 --- a/fpicker/source/office/fpinteraction.hxx +++ b/fpicker/source/office/fpinteraction.hxx @@ -55,7 +55,7 @@ namespace svt EInterceptedInteractions m_eInterceptions; // enable/disable interception of some special interactions public: - explicit OFilePickerInteractionHandler( const css::uno::Reference< css::task::XInteractionHandler >& _rxMaster ); + explicit OFilePickerInteractionHandler( css::uno::Reference< css::task::XInteractionHandler > _xMaster ); // some generic functions void enableInterceptions( EInterceptedInteractions eInterceptions ); diff --git a/fpicker/source/office/fpsmartcontent.cxx b/fpicker/source/office/fpsmartcontent.cxx index 3f9cad855509..66f531ec5732 100644 --- a/fpicker/source/office/fpsmartcontent.cxx +++ b/fpicker/source/office/fpsmartcontent.cxx @@ -28,7 +28,7 @@ #include <comphelper/processfactory.hxx> #include <ucbhelper/commandenvironment.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace svt @@ -38,7 +38,6 @@ namespace svt using namespace ::com::sun::star::uno; using namespace ::com::sun::star::task; using namespace ::com::sun::star::ucb; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; @@ -129,7 +128,7 @@ namespace svt // nothing to do, regardless of the state return; - m_pContent.reset(); + m_oContent.reset(); m_eState = INVALID; // default to INVALID m_sURL = _rURL; @@ -137,7 +136,7 @@ namespace svt { try { - m_pContent.reset( new ::ucbhelper::Content( _rURL, m_xCmdEnv, comphelper::getProcessComponentContext() ) ); + m_oContent.emplace( _rURL, m_xCmdEnv, comphelper::getProcessComponentContext() ); m_eState = UNKNOWN; // from now on, the state is unknown -> we cannot know for sure if the content // is really valid (some UCP's only tell this when asking for properties, not upon @@ -177,7 +176,7 @@ namespace svt if ( isInvalid() || !isBound() ) return false; - assert( m_pContent && "SmartContent::implIs: inconsistence!" ); + assert( m_oContent && "SmartContent::implIs: inconsistence!" ); // if, after a bindTo, we don't have a content, then we should be INVALID, or at least // NOT_BOUND (the latter happens, for example, if somebody tries to ask for an empty URL) @@ -185,9 +184,9 @@ namespace svt try { if ( Folder == _eType ) - bIs = m_pContent->isFolder(); + bIs = m_oContent->isFolder(); else - bIs = m_pContent->isDocument(); + bIs = m_oContent->isDocument(); // from here on, we definitely know that the content is valid m_eState = VALID; @@ -209,7 +208,7 @@ namespace svt try { OUString sTitle; - m_pContent->getPropertyValue("Title") >>= sTitle; + m_oContent->getPropertyValue("Title") >>= sTitle; _rTitle = sTitle; // from here on, we definitely know that the content is valid @@ -231,14 +230,14 @@ namespace svt bool bRet = false; try { - Reference< XChild > xChild( m_pContent->get(), UNO_QUERY ); + Reference< XChild > xChild( m_oContent->get(), UNO_QUERY ); if ( xChild.is() ) { Reference< XContent > xParent( xChild->getParent(), UNO_QUERY ); if ( xParent.is() ) { const OUString aParentURL( xParent->getIdentifier()->getContentIdentifier() ); - bRet = ( !aParentURL.isEmpty() && aParentURL != m_pContent->getURL() ); + bRet = ( !aParentURL.isEmpty() && aParentURL != m_oContent->getURL() ); // now we're definitely valid m_eState = VALID; @@ -262,7 +261,7 @@ namespace svt bool bRet = false; try { - const css::uno::Sequence<css::ucb::ContentInfo> aContentsInfo = m_pContent->queryCreatableContentsInfo(); + const css::uno::Sequence<css::ucb::ContentInfo> aContentsInfo = m_oContent->queryCreatableContentsInfo(); for ( auto const& rInfo : aContentsInfo ) { // Simply look for the first KIND_FOLDER... @@ -291,7 +290,7 @@ namespace svt { OUString sFolderType; - const css::uno::Sequence<css::ucb::ContentInfo> aContentsInfo = m_pContent->queryCreatableContentsInfo(); + const css::uno::Sequence<css::ucb::ContentInfo> aContentsInfo = m_oContent->queryCreatableContentsInfo(); for ( auto const& rInfo : aContentsInfo ) { // Simply look for the first KIND_FOLDER... @@ -307,7 +306,7 @@ namespace svt ucbhelper::Content aCreated; Sequence< OUString > aNames { "Title" }; Sequence< Any > aValues { Any(_rTitle) }; - m_pContent->insertNewContent( sFolderType, aNames, aValues, aCreated ); + m_oContent->insertNewContent( sFolderType, aNames, aValues, aCreated ); aCreatedUrl = aCreated.getURL(); } diff --git a/fpicker/source/office/fpsmartcontent.hxx b/fpicker/source/office/fpsmartcontent.hxx index 5f9d4e32fa92..ef3329320b85 100644 --- a/fpicker/source/office/fpsmartcontent.hxx +++ b/fpicker/source/office/fpsmartcontent.hxx @@ -25,6 +25,7 @@ #include <ucbhelper/content.hxx> #include <rtl/ref.hxx> #include <memory> +#include <optional> namespace svt @@ -49,7 +50,7 @@ namespace svt private: OUString m_sURL; - std::unique_ptr<::ucbhelper::Content> m_pContent; + std::optional<::ucbhelper::Content> m_oContent; State m_eState; css::uno::Reference < css::ucb::XCommandEnvironment > m_xCmdEnv; rtl::Reference<::svt::OFilePickerInteractionHandler> m_xOwnInteraction; @@ -129,7 +130,7 @@ namespace svt /** returns the URL of the content */ - OUString const & getURL() const { return m_pContent ? m_pContent->getURL() : m_sURL; } + OUString const & getURL() const { return m_oContent ? m_oContent->getURL() : m_sURL; } /** (re)creates the content for the given URL diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 33f42647e308..801bf0080917 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -25,9 +25,9 @@ #include <svtools/PlaceEditDialog.hxx> #include "OfficeControlAccess.hxx" #include "PlacesListBox.hxx" -#include <fpsofficeResMgr.hxx> +#include <fpicker/fpsofficeResMgr.hxx> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <tools/stream.hxx> #include <tools/urlobj.hxx> #include <vcl/errinf.hxx> @@ -70,6 +70,7 @@ #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> #include "fpinteraction.hxx" #include <osl/process.h> +#include <o3tl/string_view.hxx> #include <officecfg/Office/Common.hxx> @@ -80,7 +81,6 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::container; using namespace ::com::sun::star::task; @@ -126,18 +126,18 @@ namespace } - OUString GetFsysExtension_Impl( const OUString& rFile, const OUString& rLastFilterExt ) + OUString GetFsysExtension_Impl( std::u16string_view rFile, const OUString& rLastFilterExt ) { - sal_Int32 nDotPos = rFile.lastIndexOf( '.' ); - if ( nDotPos != -1 ) + size_t nDotPos = rFile.rfind( '.' ); + if ( nDotPos != std::u16string_view::npos ) { if ( !rLastFilterExt.isEmpty() ) { - if ( rFile.copy( nDotPos + 1 ).equalsIgnoreAsciiCase( rLastFilterExt ) ) + if ( o3tl::equalsIgnoreAsciiCase(rFile.substr( nDotPos + 1 ), rLastFilterExt ) ) return rLastFilterExt; } else - return rFile.copy( nDotPos ); + return OUString(rFile.substr( nDotPos )); } return OUString(); } @@ -235,7 +235,7 @@ namespace if ( xProviderProps.is() ) { Reference< XPropertySetInfo > xPropInfo = xProviderProps->getPropertySetInfo(); - static const OUStringLiteral sHomeDirPropertyName( u"HomeDirectory" ); + static constexpr OUString sHomeDirPropertyName( u"HomeDirectory"_ustr ); if ( !xPropInfo.is() || xPropInfo->hasPropertyByName( sHomeDirPropertyName ) ) { OUString sHomeDirectory; @@ -252,7 +252,7 @@ namespace } #endif - OUString lcl_ensureFinalSlash( const OUString& _rDir ) + OUString lcl_ensureFinalSlash( std::u16string_view _rDir ) { INetURLObject aWorkPathObj( _rDir, INetProtocol::File ); aWorkPathObj.setFinalSlash(); @@ -288,7 +288,6 @@ SvtFileDialog::SvtFileDialog(weld::Window* pParent, PickerFlags nStyle) , m_bIsInExecute(false) , m_bInExecuteAsync(false) , m_bHasFilename(false) - , m_xContext(comphelper::getProcessComponentContext()) { m_xImpl->m_xCbOptions = m_xBuilder->weld_check_button("options"); m_xImpl->m_xFtFileName = m_xBuilder->weld_label("file_name_label"); @@ -467,10 +466,10 @@ SvtFileDialog::~SvtFileDialog() { // save window state SvtViewOptions aDlgOpt( EViewType::Dialog, m_xImpl->m_aIniKey ); - aDlgOpt.SetWindowState(OStringToOUString(m_xDialog->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_UTF8)); + aDlgOpt.SetWindowState(m_xDialog->get_window_state(vcl::WindowDataMask::All)); OUString sUserData = m_xFileView->GetConfigString(); aDlgOpt.SetUserItem( "UserData", - makeAny( sUserData ) ); + Any( sUserData ) ); } m_xFileView->SetSelectHdl(Link<SvtFileView*,void>()); @@ -494,7 +493,7 @@ SvtFileDialog::~SvtFileDialog() } } - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_xContext)); + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Misc::FilePickerPlacesUrls::set(placesUrlsList, batch); officecfg::Office::Common::Misc::FilePickerPlacesNames::set(placesNamesList, batch); batch->commit(); @@ -1270,7 +1269,7 @@ bool implIsInvalid( const OUString & rURL ) } -OUString SvtFileDialog::implGetInitialURL( const OUString& _rPath, const OUString& _rFallback ) +OUString SvtFileDialog::implGetInitialURL( const OUString& _rPath, std::u16string_view _rFallback ) { // a URL parser for the fallback INetURLObject aURLParser; @@ -1403,7 +1402,7 @@ void SvtFileDialog::displayIOException( const OUString& _rURL, IOErrorCode _eCod // let and interaction handler handle this exception rtl::Reference<::comphelper::OInteractionRequest> pRequest = - new ::comphelper::OInteractionRequest( makeAny( aException ) ); + new ::comphelper::OInteractionRequest( Any( aException ) ); pRequest->addContinuation( new ::comphelper::OInteractionAbort( ) ); Reference< XInteractionHandler2 > xHandler( @@ -1783,7 +1782,7 @@ void SvtFileDialog::InitSize() if ( aDlgOpt.Exists() ) { - m_xDialog->set_window_state(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_UTF8)); + m_xDialog->set_window_state(aDlgOpt.GetWindowState()); Any aUserData = aDlgOpt.GetUserItem( "UserData"); OUString sCfgStr; @@ -2267,10 +2266,10 @@ void SvtFileDialog::appendDefaultExtension(OUString& rFileName, { if (nPos+1<aType.getLength() && aType[nPos]=='*') // take care of a leading * ++nPos; - const OUString aExt(aType.getToken( 0, FILEDIALOG_DEF_EXTSEP, nPos )); - if (aExt.isEmpty()) + const std::u16string_view aExt(o3tl::getToken(aType, 0, FILEDIALOG_DEF_EXTSEP, nPos )); + if (aExt.empty()) continue; - if (aTemp.endsWith(aExt)) + if (o3tl::ends_with(aTemp, aExt)) return; } while (nPos>=0); @@ -2284,8 +2283,8 @@ void SvtFileDialog::initDefaultPlaces( ) m_xImpl->m_xPlaces->AppendPlace( pRootPlace ); // Load from user settings - Sequence< OUString > placesUrlsList(officecfg::Office::Common::Misc::FilePickerPlacesUrls::get(m_xContext)); - Sequence< OUString > placesNamesList(officecfg::Office::Common::Misc::FilePickerPlacesNames::get(m_xContext)); + Sequence< OUString > placesUrlsList(officecfg::Office::Common::Misc::FilePickerPlacesUrls::get()); + Sequence< OUString > placesNamesList(officecfg::Office::Common::Misc::FilePickerPlacesNames::get()); for(sal_Int32 nPlace = 0; nPlace < placesUrlsList.getLength() && nPlace < placesNamesList.getLength(); ++nPlace) { diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index 3578ae883de6..9de9261af2d7 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -77,8 +77,6 @@ private: m_pCurrentAsyncAction; bool m_bInExecuteAsync; bool m_bHasFilename; - css::uno::Reference < css::uno::XComponentContext > - m_xContext; DECL_LINK( FilterSelectHdl_Impl, weld::ComboBox&, void ); DECL_LINK( FilterSelectTimerHdl_Impl, Timer*, void ); @@ -232,7 +230,7 @@ private: virtual void enableControl( sal_Int16 _nControlId, bool _bEnable ) override; virtual OUString getCurFilter( ) const override; - OUString implGetInitialURL( const OUString& _rPath, const OUString& _rFallback ); + OUString implGetInitialURL( const OUString& _rPath, std::u16string_view _rFallback ); /// executes a certain FileView action asynchronously void executeAsync( diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx index 1b651cbdd3fe..1802d9c8d65b 100644 --- a/fpicker/source/office/iodlgimp.cxx +++ b/fpicker/source/office/iodlgimp.cxx @@ -30,14 +30,13 @@ #include <svtools/imagemgr.hxx> #include <svl/svlresid.hxx> #include <svl/svl.hrc> +#include <utility> using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::utl; -SvtFileDialogFilter_Impl::SvtFileDialogFilter_Impl( const OUString& rName, const OUString& rType ) - : m_aName( rName ) - , m_aType( rType ) +SvtFileDialogFilter_Impl::SvtFileDialogFilter_Impl( OUString aName, OUString aType ) + : m_aName(std::move( aName )) + , m_aType(std::move( aType )) { m_aType = m_aType.toAsciiLowerCase(); } @@ -100,7 +99,7 @@ void SvtUpButton_Impl::FillURLMenu() } } -IMPL_LINK(SvtUpButton_Impl, SelectHdl, const OString&, rId, void) +IMPL_LINK(SvtUpButton_Impl, SelectHdl, const OUString&, rId, void) { sal_uInt32 nId = rId.toUInt32(); if (nId) @@ -112,7 +111,7 @@ IMPL_LINK(SvtUpButton_Impl, SelectHdl, const OString&, rId, void) } } -IMPL_LINK_NOARG(SvtUpButton_Impl, ClickHdl, const OString&, void) +IMPL_LINK_NOARG(SvtUpButton_Impl, ClickHdl, const OUString&, void) { m_pDlg->PrevLevel_Impl(); } @@ -161,7 +160,7 @@ void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl const * pFilter, void SvtExpFileDlg_Impl::InsertFilterListEntry(const SvtFileDialogFilter_Impl* pFilterDesc) { // insert and set user data - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pFilterDesc))); + OUString sId(weld::toId(pFilterDesc)); OUString sName = pFilterDesc->GetName(); if (pFilterDesc->isGroupSeparator()) m_xLbFilter->append_separator(sId); diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx index 7300ab16e5e3..3a02dbbee641 100644 --- a/fpicker/source/office/iodlgimp.hxx +++ b/fpicker/source/office/iodlgimp.hxx @@ -48,7 +48,7 @@ private: OUString m_aType; // filter wildcard - if empty, the entry marks a group public: - SvtFileDialogFilter_Impl( const OUString& rName, const OUString& rType ); + SvtFileDialogFilter_Impl( OUString aName, OUString aType ); ~SvtFileDialogFilter_Impl(); const OUString& GetName() const { return m_aName; } @@ -86,7 +86,7 @@ public: std::unique_ptr<weld::Menu> xMenu, SvtFileDialog* pDlg); - void set_help_id(const OString& rHelpId) { m_xToolbar->set_help_id(rHelpId); } + void set_help_id(const OUString& rHelpId) { m_xToolbar->set_help_id(rHelpId); } void show() { m_xToolbar->show(); } void FillURLMenu(); @@ -95,8 +95,8 @@ public: private: - DECL_LINK(SelectHdl, const OString&, void); - DECL_LINK(ClickHdl, const OString&, void); + DECL_LINK(SelectHdl, const OUString&, void); + DECL_LINK(ClickHdl, const OUString&, void); }; class SvtURLBox; @@ -185,7 +185,7 @@ public: SvtFileDialogFilter_Impl* GetSelectedFilterEntry( OUString& rDisplayName ) const { rDisplayName = m_xLbFilter->get_active_text(); - return reinterpret_cast<SvtFileDialogFilter_Impl*>(m_xLbFilter->get_active_id().toInt64()); + return weld::fromId<SvtFileDialogFilter_Impl*>(m_xLbFilter->get_active_id()); } // access to the current filter via methods only - need to care for consistency between m_pCurFilter and m_sCurrentFilterDisplayName diff --git a/fpicker/source/win32/VistaFilePicker.cxx b/fpicker/source/win32/VistaFilePicker.cxx index dbd50307391c..743dcda5d080 100644 --- a/fpicker/source/win32/VistaFilePicker.cxx +++ b/fpicker/source/win32/VistaFilePicker.cxx @@ -22,7 +22,6 @@ #include "VistaFilePicker.hxx" #include "WinImplHelper.hxx" -#include "shared.hxx" #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/lang/DisposedException.hpp> diff --git a/fpicker/source/win32/VistaFilePickerEventHandler.cxx b/fpicker/source/win32/VistaFilePickerEventHandler.cxx index 97c0c9fbd41e..7c21dcde0392 100644 --- a/fpicker/source/win32/VistaFilePickerEventHandler.cxx +++ b/fpicker/source/win32/VistaFilePickerEventHandler.cxx @@ -231,8 +231,8 @@ void VistaFilePickerEventHandler::stopListening() } } -const OUStringLiteral PROP_CONTROL_ID = u"control_id"; -const OUStringLiteral PROP_PICKER_LISTENER = u"picker_listener"; +constexpr OUString PROP_CONTROL_ID = u"control_id"_ustr; +constexpr OUString PROP_PICKER_LISTENER = u"picker_listener"_ustr; namespace { diff --git a/fpicker/source/win32/VistaFilePickerImpl.cxx b/fpicker/source/win32/VistaFilePickerImpl.cxx index a38e237e2511..a3ee8c9ad3e2 100644 --- a/fpicker/source/win32/VistaFilePickerImpl.cxx +++ b/fpicker/source/win32/VistaFilePickerImpl.cxx @@ -32,10 +32,12 @@ #include <com/sun/star/lang/SystemDependent.hpp> #include <comphelper/sequence.hxx> #include <fpicker/strings.hrc> -#include <fpsofficeResMgr.hxx> +#include <fpicker/fpsofficeResMgr.hxx> #include <osl/file.hxx> #include <rtl/process.h> #include <o3tl/char16_t2wchar_t.hxx> +#include <o3tl/string_view.hxx> +#include <vcl/svapp.hxx> #include "WinImplHelper.hxx" #include <shlguid.h> @@ -134,7 +136,7 @@ template <class ComPtrDialog, REFCLSID CLSID> class TDialogImpl : public TDialog { public: TDialogImpl() - : TDialogImplBase(ComPtrDialog().CoCreateInstance(CLSID).get()) + : TDialogImplBase(ComPtrDialog(CLSID).get()) { } }; @@ -167,55 +169,36 @@ using TFolderPickerDialogImpl = TDialogImpl<TFileOpenDialog, CLSID_FileOpenDialo static OUString lcl_getURLFromShellItem (IShellItem* pItem) { - LPWSTR pStr = nullptr; - OUString sURL; - HRESULT hr; - - hr = pItem->GetDisplayName ( SIGDN_FILESYSPATH, &pStr ); - if (SUCCEEDED(hr)) - { - ::osl::FileBase::getFileURLFromSystemPath( OUString(o3tl::toU(pStr)), sURL ); - goto cleanup; - } - - hr = pItem->GetDisplayName ( SIGDN_URL, &pStr ); - if (SUCCEEDED(hr)) - { - sURL = o3tl::toU(pStr); - goto cleanup; - } - - hr = pItem->GetDisplayName ( SIGDN_PARENTRELATIVEPARSING, &pStr ); - if (SUCCEEDED(hr)) + sal::systools::CoTaskMemAllocated<wchar_t> pStr; + HRESULT hr = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pStr); + if (FAILED(hr)) { - GUID known_folder_id; - std::wstring aStr = pStr; - CoTaskMemFree (pStr); + // tdf#155176: One could think that querying SIGDN_URL would go first. But Windows uses + // current 8-bit codepage for the filenames, and URL-encodes those octets. So check it + // only after SIGDN_FILESYSPATH query failed (can it ever happen?) + if (SUCCEEDED(pItem->GetDisplayName(SIGDN_URL, &pStr))) + return OUString(o3tl::toU(pStr)); - if (0 == aStr.compare(0, 3, L"::{")) - aStr = aStr.substr(2); - hr = IIDFromString(aStr.c_str(), &known_folder_id); + hr = pItem->GetDisplayName(SIGDN_PARENTRELATIVEPARSING, &pStr); if (SUCCEEDED(hr)) { - hr = SHGetKnownFolderPath(known_folder_id, 0, nullptr, &pStr); + GUID known_folder_id; + wchar_t* pStr2 = pStr; + if (pStr2[0] == ':' && pStr2[1] == ':' && pStr2[2] == '{') + pStr2 += 2; + hr = IIDFromString(pStr2, &known_folder_id); if (SUCCEEDED(hr)) - { - ::osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(pStr)), sURL); - goto cleanup; - } + hr = SHGetKnownFolderPath(known_folder_id, 0, nullptr, &pStr); } } // Default fallback - hr = SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &pStr); + if (FAILED(hr)) + hr = SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &pStr); + + OUString sURL; if (SUCCEEDED(hr)) ::osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(pStr)), sURL); - else // shouldn't happen... - goto bailout; - -cleanup: - CoTaskMemFree (pStr); -bailout: return sURL; } @@ -224,7 +207,7 @@ bailout: static OUString lcl_AdjustFilterName(const OUString& sName) { const sal_Int32 idx = sName.indexOf("(."); - return (idx > 0) ? sName.copy(0, idx).trim() : sName; + return (idx > 0) ? OUString(o3tl::trim(sName.subView(0, idx))) : sName; } // rvStrings holds the OUStrings, pointers to which data are stored in returned COMDLG_FILTERSPEC @@ -961,6 +944,9 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(Request& rRequest) HRESULT hResult = E_FAIL; try { + // tdf#146007: Make sure we don't hold solar mutex: COM may need to forward + // the execution to the main thread, and holding solar mutex could deadlock + SolarMutexReleaser r; // show dialog and wait for user decision hResult = iDialog->Show(m_hParentWindow ? m_hParentWindow : choose_parent_window()); // parent window needed @@ -1129,7 +1115,7 @@ void VistaFilePickerImpl::impl_sta_GetControlValue(Request& rRequest) if ( SUCCEEDED(hResult) ) { const OUString& sItem = m_lItems[bValue]; - aValue <<= OUString(sItem.getStr()); + aValue <<= sItem; } } break; diff --git a/fpicker/source/win32/VistaFilePickerImpl.hxx b/fpicker/source/win32/VistaFilePickerImpl.hxx index 8e757c9c66ac..8ea9468076ea 100644 --- a/fpicker/source/win32/VistaFilePickerImpl.hxx +++ b/fpicker/source/win32/VistaFilePickerImpl.hxx @@ -57,26 +57,26 @@ const ::sal_Int32 FEATURE_VERSION = 1024; const ::sal_Int32 FEATURE_GPGPASSWORD = 2048; const ::sal_Int32 FEATURE_IMAGEANCHOR = 4096; -inline constexpr OUStringLiteral PROP_PICKER_LISTENER(u"picker_listener" ); // [XFilePickerListenert] -inline constexpr OUStringLiteral PROP_DIALOG_SHOW_RESULT(u"dialog_show_result" ); // [sal_Bool] true=OK, false=CANCEL -inline constexpr OUStringLiteral PROP_SELECTED_FILES(u"selected_files" ); // [seq< OUString >] contains all user selected files (can be empty!) -inline constexpr OUStringLiteral PROP_MULTISELECTION_MODE(u"multiselection_mode"); // [sal_Bool] true=ON, false=OFF -inline constexpr OUStringLiteral PROP_TITLE(u"title" ); // [OUString] -inline constexpr OUStringLiteral PROP_FILENAME(u"filename" ); // [OUString] -inline constexpr OUStringLiteral PROP_DIRECTORY(u"directory" ); // [OUString] -inline constexpr OUStringLiteral PROP_FEATURES(u"features" ); // [sal_Int32] -inline constexpr OUStringLiteral PROP_TEMPLATE_DESCR(u"templatedescription"); // [sal_Int32] -inline constexpr OUStringLiteral PROP_FILTER_TITLE(u"filter_title" ); // [OUString] -inline constexpr OUStringLiteral PROP_FILTER_VALUE(u"filter_value" ); // [OUString] -inline constexpr OUStringLiteral PROP_FILTER_GROUP(u"filter-group" ); // [seq< css:beans::StringPair >] contains a group of filters - -inline constexpr OUStringLiteral PROP_CONTROL_ID(u"control_id" ); // [sal_Int16] -inline constexpr OUStringLiteral PROP_CONTROL_ACTION(u"control_action" ); // [sal_Int16] -inline constexpr OUStringLiteral PROP_CONTROL_VALUE(u"control_value" ); // [Any] -inline constexpr OUStringLiteral PROP_CONTROL_LABEL(u"control_label" ); // [OUString] -inline constexpr OUStringLiteral PROP_CONTROL_ENABLE(u"control_enable" ); // [sal_Bool] true=ON, false=OFF -inline constexpr OUStringLiteral PROP_PARENT_WINDOW(u"ParentWindow"); //[css::awt::XWindow] preferred parent window -inline constexpr OUStringLiteral STRING_SEPARATOR(u"------------------------------------------" ); +inline constexpr OUString PROP_PICKER_LISTENER(u"picker_listener"_ustr ); // [XFilePickerListenert] +inline constexpr OUString PROP_DIALOG_SHOW_RESULT(u"dialog_show_result"_ustr ); // [sal_Bool] true=OK, false=CANCEL +inline constexpr OUString PROP_SELECTED_FILES(u"selected_files"_ustr ); // [seq< OUString >] contains all user selected files (can be empty!) +inline constexpr OUString PROP_MULTISELECTION_MODE(u"multiselection_mode"_ustr); // [sal_Bool] true=ON, false=OFF +inline constexpr OUString PROP_TITLE(u"title"_ustr ); // [OUString] +inline constexpr OUString PROP_FILENAME(u"filename"_ustr ); // [OUString] +inline constexpr OUString PROP_DIRECTORY(u"directory"_ustr ); // [OUString] +inline constexpr OUString PROP_FEATURES(u"features"_ustr ); // [sal_Int32] +inline constexpr OUString PROP_TEMPLATE_DESCR(u"templatedescription"_ustr); // [sal_Int32] +inline constexpr OUString PROP_FILTER_TITLE(u"filter_title"_ustr ); // [OUString] +inline constexpr OUString PROP_FILTER_VALUE(u"filter_value"_ustr ); // [OUString] +inline constexpr OUString PROP_FILTER_GROUP(u"filter-group"_ustr ); // [seq< css:beans::StringPair >] contains a group of filters + +inline constexpr OUString PROP_CONTROL_ID(u"control_id"_ustr ); // [sal_Int16] +inline constexpr OUString PROP_CONTROL_ACTION(u"control_action"_ustr ); // [sal_Int16] +inline constexpr OUString PROP_CONTROL_VALUE(u"control_value"_ustr ); // [Any] +inline constexpr OUString PROP_CONTROL_LABEL(u"control_label"_ustr ); // [OUString] +inline constexpr OUString PROP_CONTROL_ENABLE(u"control_enable"_ustr ); // [sal_Bool] true=ON, false=OFF +inline constexpr OUString PROP_PARENT_WINDOW(u"ParentWindow"_ustr); //[css::awt::XWindow] preferred parent window +inline constexpr OUString STRING_SEPARATOR(u"------------------------------------------"_ustr ); class TDialogImplBase; diff --git a/fpicker/source/win32/WinImplHelper.cxx b/fpicker/source/win32/WinImplHelper.cxx index 5d6e20d92319..9f81f6b60ffc 100644 --- a/fpicker/source/win32/WinImplHelper.cxx +++ b/fpicker/source/win32/WinImplHelper.cxx @@ -24,12 +24,6 @@ #include <rtl/ustrbuf.hxx> #include <com/sun/star/uno/Sequence.hxx> -using ::com::sun::star::lang::IllegalArgumentException; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::XInterface; -using ::com::sun::star::uno::Any; -using ::com::sun::star::uno::Sequence; - const sal_Unicode TILDE_SIGN = L'~'; const sal_Unicode AMPERSAND_SIGN = L'&'; diff --git a/fpicker/source/win32/resourceprovider.cxx b/fpicker/source/win32/resourceprovider.cxx index ff841b385b26..3515e9432146 100644 --- a/fpicker/source/win32/resourceprovider.cxx +++ b/fpicker/source/win32/resourceprovider.cxx @@ -31,7 +31,7 @@ #include <unotools/resmgr.hxx> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> -#include <fpsofficeResMgr.hxx> +#include <fpicker/fpsofficeResMgr.hxx> using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds; using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds; diff --git a/fpicker/source/win32/shared.hxx b/fpicker/source/win32/shared.hxx deleted file mode 100644 index c47f6411e28b..000000000000 --- a/fpicker/source/win32/shared.hxx +++ /dev/null @@ -1,29 +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 . - */ - -#pragma once - -#include <rtl/ustring.hxx> - -const OUStringLiteral BACKSLASH(u"\\"); -const OUStringLiteral FILTER_SEPARATOR(u"------------------------------------------"); -const OUStringLiteral ALL_FILES_WILDCARD(u"*.*"); -const bool ALLOW_DUPLICATES = true; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/workbench/Test_fps.cxx b/fpicker/source/win32/workbench/Test_fps.cxx index 899f208f1f61..010a79c3aa55 100644 --- a/fpicker/source/win32/workbench/Test_fps.cxx +++ b/fpicker/source/win32/workbench/Test_fps.cxx @@ -78,7 +78,7 @@ void TestFilterManager( Reference< XFilePicker > xFilePicker ); Reference< XMultiServiceFactory > g_xFactory; -static const OUStringLiteral BMP_EXTENSION( u"bmp" ); +static constexpr OUStringLiteral BMP_EXTENSION( u"bmp" ); // a test client diff --git a/fpicker/uiconfig/ui/explorerfiledialog.ui b/fpicker/uiconfig/ui/explorerfiledialog.ui index 1817d785c814..238760f74d13 100644 --- a/fpicker/uiconfig/ui/explorerfiledialog.ui +++ b/fpicker/uiconfig/ui/explorerfiledialog.ui @@ -293,6 +293,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes" context="explorerfiledialog|add">Add current folder to Places</property> <property name="image">image1</property> <property name="always_show_image">True</property> </object> @@ -307,6 +308,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes" context="explorerfiledialog|del">Remove selected folder from Places</property> <property name="image">image2</property> <property name="always_show_image">True</property> </object> @@ -442,18 +444,8 @@ <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="model">liststore2</property> - <child> - <object class="GtkCellRendererPixbuf" id="icon"/> - <attributes> - <attribute name="pixbuf">0</attribute> - </attributes> - </child> - <child> - <object class="GtkCellRendererText" id="text"/> - <attributes> - <attribute name="text">1</attribute> - </attributes> - </child> + <property name="pixbuf-column">0</property> + <property name="text-column">1</property> </object> </child> </object> |