summaryrefslogtreecommitdiff
path: root/fpicker/source/office
diff options
context:
space:
mode:
Diffstat (limited to 'fpicker/source/office')
-rw-r--r--fpicker/source/office/OfficeControlAccess.cxx59
-rw-r--r--fpicker/source/office/OfficeControlAccess.hxx5
-rw-r--r--fpicker/source/office/OfficeFilePicker.cxx41
-rw-r--r--fpicker/source/office/OfficeFolderPicker.cxx1
-rw-r--r--fpicker/source/office/PlacesListBox.cxx47
-rw-r--r--fpicker/source/office/PlacesListBox.hxx3
-rw-r--r--fpicker/source/office/RemoteFilesDialog.cxx61
-rw-r--r--fpicker/source/office/RemoteFilesDialog.hxx4
-rw-r--r--fpicker/source/office/autocmpledit.cxx25
-rw-r--r--fpicker/source/office/autocmpledit.hxx2
-rw-r--r--fpicker/source/office/commonpicker.cxx2
-rw-r--r--fpicker/source/office/contentenumeration.cxx52
-rw-r--r--fpicker/source/office/contentenumeration.hxx10
-rw-r--r--fpicker/source/office/fileview.cxx110
-rw-r--r--fpicker/source/office/fileview.hxx11
-rw-r--r--fpicker/source/office/foldertree.cxx2
-rw-r--r--fpicker/source/office/foldertree.hxx2
-rw-r--r--fpicker/source/office/fpdialogbase.hxx4
-rw-r--r--fpicker/source/office/fpinteraction.cxx5
-rw-r--r--fpicker/source/office/fpinteraction.hxx2
-rw-r--r--fpicker/source/office/fpsmartcontent.cxx26
-rw-r--r--fpicker/source/office/fpsmartcontent.hxx5
-rw-r--r--fpicker/source/office/iodlg.cxx129
-rw-r--r--fpicker/source/office/iodlg.hxx4
-rw-r--r--fpicker/source/office/iodlgimp.cxx15
-rw-r--r--fpicker/source/office/iodlgimp.hxx10
26 files changed, 337 insertions, 300 deletions
diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx
index 2096ccc0f178..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
@@ -71,7 +72,6 @@ namespace svt
{ "AutoExtensionBox", CHECKBOX_AUTOEXTENSION, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX },
{ "CancelButton", PUSHBUTTON_CANCEL, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "CurrentFolderText", FIXEDTEXT_CURRENTFOLDER, PROPERTY_FLAGS_COMMON | PropFlags::Text },
- { "DefaultLocationButton", TOOLBOXBUTOON_DEFAULT_LOCATION, PROPERTY_FLAGS_COMMON },
{ "FileURLEdit", EDIT_FILEURL, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "FileURLEditLabel", EDIT_FILEURL_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "FileView", CONTROL_FILEVIEW, PROPERTY_FLAGS_COMMON },
@@ -84,9 +84,9 @@ namespace svt
{ "ImageAnchorListLabel", LISTBOX_IMAGE_ANCHOR_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "ImageTemplateList", LISTBOX_IMAGE_TEMPLATE, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_LISTBOX },
{ "ImageTemplateListLabel", LISTBOX_IMAGE_TEMPLATE_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text },
- { "LevelUpButton", TOOLBOXBUTOON_LEVEL_UP, PROPERTY_FLAGS_COMMON },
+ { "LevelUpButton", TOOLBOXBUTTON_LEVEL_UP, PROPERTY_FLAGS_COMMON },
{ "LinkBox", CHECKBOX_LINK, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX },
- { "NewFolderButton", TOOLBOXBUTOON_NEW_FOLDER, PROPERTY_FLAGS_COMMON },
+ { "NewFolderButton", TOOLBOXBUTTON_NEW_FOLDER, PROPERTY_FLAGS_COMMON },
{ "OkButton", PUSHBUTTON_OK , PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "PasswordBox", CHECKBOX_PASSWORD, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX },
{ "PlayButton", PUSHBUTTON_PLAY, PROPERTY_FLAGS_COMMON | PropFlags::Text },
@@ -140,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))
{
}
@@ -150,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)
@@ -182,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
@@ -203,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;
}
@@ -223,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 );
}
@@ -249,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 )
@@ -270,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 );
@@ -509,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 );
}
}
@@ -556,7 +547,7 @@ namespace svt
}
else if ( !_bIgnoreIllegalArgument )
{
- lcl_throwIllegalArgumentException();
+ throw IllegalArgumentException();
}
}
break;
@@ -570,7 +561,7 @@ namespace svt
}
else if ( !_bIgnoreIllegalArgument )
{
- lcl_throwIllegalArgumentException();
+ throw IllegalArgumentException();
}
}
break;
@@ -584,7 +575,7 @@ namespace svt
}
else if ( !_bIgnoreIllegalArgument )
{
- lcl_throwIllegalArgumentException();
+ throw IllegalArgumentException();
}
}
break;
@@ -598,7 +589,7 @@ namespace svt
}
else if ( !_bIgnoreIllegalArgument )
{
- lcl_throwIllegalArgumentException();
+ throw IllegalArgumentException();
}
}
break;
@@ -615,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);
}
@@ -623,7 +614,7 @@ namespace svt
}
else if ( !_bIgnoreIllegalArgument )
{
- lcl_throwIllegalArgumentException();
+ throw IllegalArgumentException();
}
}
break;
@@ -640,7 +631,7 @@ namespace svt
}
else if ( !_bIgnoreIllegalArgument )
{
- lcl_throwIllegalArgumentException();
+ throw IllegalArgumentException();
}
}
break;
@@ -657,7 +648,7 @@ namespace svt
}
else if ( !_bIgnoreIllegalArgument )
{
- lcl_throwIllegalArgumentException();
+ throw IllegalArgumentException();
}
}
break;
@@ -674,7 +665,7 @@ namespace svt
}
else if ( !_bIgnoreIllegalArgument )
{
- lcl_throwIllegalArgumentException();
+ throw IllegalArgumentException();
}
}
break;
diff --git a/fpicker/source/office/OfficeControlAccess.hxx b/fpicker/source/office/OfficeControlAccess.hxx
index 89e527be2f21..859ff15f270e 100644
--- a/fpicker/source/office/OfficeControlAccess.hxx
+++ b/fpicker/source/office/OfficeControlAccess.hxx
@@ -51,9 +51,8 @@ namespace svt
namespace InternalFilePickerElementIds
{
const sal_Int16 PUSHBUTTON_HELP = sal_Int16(0x1000);
- const sal_Int16 TOOLBOXBUTOON_DEFAULT_LOCATION = sal_Int16(0x1001);
- const sal_Int16 TOOLBOXBUTOON_LEVEL_UP = sal_Int16(0x1002);
- const sal_Int16 TOOLBOXBUTOON_NEW_FOLDER = sal_Int16(0x1003);
+ const sal_Int16 TOOLBOXBUTTON_LEVEL_UP = sal_Int16(0x1002);
+ const sal_Int16 TOOLBOXBUTTON_NEW_FOLDER = sal_Int16(0x1003);
const sal_Int16 FIXEDTEXT_CURRENTFOLDER = sal_Int16(0x1004);
}
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx
index 3386979e4714..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
@@ -773,12 +781,7 @@ Sequence< sal_Int16 > SAL_CALL SvtFilePicker::getSupportedImageFormats()
{
checkAlive();
- SolarMutexGuard aGuard;
- Sequence< sal_Int16 > aFormats( 1 );
-
- aFormats[0] = FilePreviewImageFormats::BITMAP;
-
- return aFormats;
+ return { FilePreviewImageFormats::BITMAP };
}
sal_Int32 SAL_CALL SvtFilePicker::getTargetColorDepth()
@@ -877,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;
@@ -953,19 +956,19 @@ void SAL_CALL SvtFilePicker::initialize( const Sequence< Any >& _rArguments )
{
// compatibility: one argument, type sal_Int16 , specifies the service type
int index = 0;
-
+ auto pArguments = aArguments.getArray();
if (_rArguments[0] >>= m_nServiceType)
{
// skip the first entry if it was the ServiceType, because it's not needed in OCommonPicker::initialize and it's not a NamedValue
NamedValue emptyNamedValue;
- aArguments[0] <<= emptyNamedValue;
+ pArguments[0] <<= emptyNamedValue;
index = 1;
}
for ( int i = index; i < _rArguments.getLength(); i++)
{
NamedValue namedValue;
- aArguments[i] = _rArguments[i];
+ pArguments[i] = _rArguments[i];
if (aArguments[i] >>= namedValue )
{
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 a7a90281bb11..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( )
@@ -112,31 +113,41 @@ IMPL_LINK_NOARG( PlacesListBox, DoubleClick, weld::TreeView&, bool )
{
sal_uInt16 nSelected = mxImpl->get_cursor_index();
PlacePtr pPlace = maPlaces[nSelected];
- if ( pPlace->IsEditable() && !pPlace->IsLocal( ) )
+ if ( !pPlace->IsEditable() || pPlace->IsLocal( ) )
+ return true;
+ PlaceEditDialog aDlg(mpDlg->getDialog(), pPlace);
+ short aRetCode = aDlg.run();
+ switch (aRetCode)
{
- PlaceEditDialog aDlg(mpDlg->getDialog(), pPlace);
- short aRetCode = aDlg.run();
- switch (aRetCode)
+ case RET_OK :
{
- case RET_OK :
- {
- pPlace->SetName ( aDlg.GetServerName() );
- pPlace->SetUrl( aDlg.GetServerUrl() );
- mbUpdated = true;
- break;
- }
- case RET_NO :
- {
- RemovePlace(nSelected);
- break;
- }
- default:
- break;
+ pPlace->SetName ( aDlg.GetServerName() );
+ pPlace->SetUrl( aDlg.GetServerUrl() );
+ mbUpdated = true;
+ break;
}
+ case RET_NO :
+ {
+ RemovePlace(nSelected);
+ break;
+ }
+ default:
+ break;
}
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 2e7ac67ead37..ad23cc0dd888 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -12,17 +12,15 @@
#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>
-#include <comphelper/stillreadwriteinteraction.hxx>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/task/PasswordContainer.hpp>
#include <svtools/PlaceEditDialog.hxx>
#include <tools/debug.hxx>
-#include <ucbhelper/commandenvironment.hxx>
-#include <svl/fstathelper.hxx>
+#include <unotools/ucbhelper.hxx>
#include <vcl/errinf.hxx>
#include <officecfg/Office/Common.hxx>
@@ -126,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());
@@ -135,24 +133,26 @@ 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 );
if( m_bIsUpdated )
{
Sequence< OUString > placesUrlsList( m_aServices.size() );
+ auto placesUrlsListRange = asNonConstRange(placesUrlsList);
Sequence< OUString > placesNamesList( m_aServices.size() );
+ auto placesNamesListRange = asNonConstRange(placesNamesList);
int i = 0;
for (auto const& service : m_aServices)
{
- placesUrlsList[i] = service->GetUrl();
- placesNamesList[i] = service->GetName();
+ placesUrlsListRange[i] = service->GetUrl();
+ placesNamesListRange[i] = service->GetName();
++i;
}
@@ -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 );
@@ -1138,12 +1135,32 @@ std::vector<OUString> RemoteFilesDialog::GetPathList() const
bool RemoteFilesDialog::ContentIsFolder( const OUString& rURL )
{
- return FStatHelper::IsFolder(rURL);
+ try
+ {
+ ::ucbhelper::Content content(rURL,
+ ::utl::UCBContentHelper::getDefaultCommandEnvironment(),
+ m_xContext);
+ return content.isFolder();
+ }
+ catch (css::uno::Exception const&)
+ {
+ return false;
+ }
}
bool RemoteFilesDialog::ContentIsDocument( const OUString& rURL )
{
- return FStatHelper::IsDocument(rURL);
+ try
+ {
+ ::ucbhelper::Content content(rURL,
+ ::utl::UCBContentHelper::getDefaultCommandEnvironment(),
+ m_xContext);
+ return content.isDocument();
+ }
+ catch (css::uno::Exception const&)
+ {
+ return false;
+ }
}
sal_Int32 RemoteFilesDialog::getAvailableWidth()
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index 93a8e363f5b4..8c4fa0a4cbb3 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -68,7 +68,7 @@ public:
virtual const OUString& GetPath() override;
virtual std::vector<OUString> GetPathList() const override;
virtual bool ContentIsFolder( const OUString& rURL ) override;
- static bool ContentIsDocument(const OUString& rURL);
+ bool ContentIsDocument(const OUString& rURL);
virtual OUString getCurrentFileText() const override;
virtual void setCurrentFileText( const OUString& rText, bool bSelectAll = false ) override;
@@ -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 b167fef3d190..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;
@@ -139,27 +136,25 @@ namespace svt
{
Reference< XResultSet > xResultSet;
- Sequence< OUString > aProps(12);
-
- aProps[0] = "Title";
- aProps[1] = "Size";
- aProps[2] = "DateModified";
- aProps[3] = "DateCreated";
- aProps[4] = "IsFolder";
- aProps[5] = "TargetURL";
- aProps[6] = "IsHidden";
- aProps[7] = "IsVolume";
- aProps[8] = "IsRemote";
- aProps[9] = "IsRemoveable";
- aProps[10] = "IsFloppy";
- aProps[11] = "IsCompactDisc";
+ Sequence< OUString > aProps{ "Title",
+ "Size",
+ "DateModified",
+ "DateCreated",
+ "IsFolder",
+ "TargetURL",
+ "IsHidden",
+ "IsVolume",
+ "IsRemote",
+ "IsRemoveable",
+ "IsFloppy",
+ "IsCompactDisc" };
Reference< XCommandEnvironment > xEnvironment;
try
{
FolderDescriptor aFolder;
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
aFolder = m_aFolder;
xEnvironment = m_xCommandEnv;
}
@@ -167,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;
}
}
@@ -217,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;
}
@@ -253,7 +248,6 @@ namespace svt
if ( pData->mbIsFolder )
{
- SolarMutexGuard aGuard;
::svtools::VolumeInfo aVolInfo( pData->mbIsVolume, pData->mbIsRemote,
pData->mbIsRemoveable, pData->mbIsFloppy,
pData->mbIsCompactDisc );
@@ -270,7 +264,7 @@ namespace svt
}
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
bCancelled = m_bCancelled;
}
}
@@ -289,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;
@@ -308,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 203f1d1d27b3..6a77f9154ac8 100644
--- a/fpicker/source/office/fileview.cxx
+++ b/fpicker/source/office/fileview.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <algorithm>
+#include <string_view>
#include <vector>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
@@ -46,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>
@@ -62,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;
@@ -191,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; }
@@ -227,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);
};
}
@@ -285,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 );
@@ -293,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();
@@ -407,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;
}
@@ -508,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 & )
@@ -568,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()))
@@ -601,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);
@@ -641,16 +643,20 @@ void ViewTabListBox_Impl::DeleteEntries()
eResult = aDlg.run();
}
- if ( ( eResult == svtools::QUERYDELETE_ALL ) ||
- ( eResult == svtools::QUERYDELETE_YES ) )
+ bool bDeleted = false;
+
+ if (eResult == svtools::QUERYDELETE_ALL || eResult == svtools::QUERYDELETE_YES)
{
if ( Kill( aURL ) )
{
- delete reinterpret_cast<SvtContentEntry*>(mxTreeView->get_id(rCurEntry).toInt64());
mpParent->EntryRemoved( aURL );
+ bDeleted = true;
}
}
+ if (!bDeleted)
+ mxTreeView->unselect(rCurEntry);
+
return false;
});
@@ -672,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;
@@ -714,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;
}
@@ -765,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 & )
{
@@ -826,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();
@@ -842,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;
@@ -860,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);
@@ -908,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);
}
@@ -1001,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;
}
@@ -1060,7 +1066,7 @@ OUString SvtFileView::GetConfigString() const
OUString sRet = OUString::number( mpImpl->mnSortColumn ) + ";";
bool bUp = mpImpl->mbAscending;
- sRet += (bUp ? OUStringLiteral(u"1") : OUStringLiteral(u"0")) + ";";
+ sRet += OUString::Concat(bUp ? std::u16string_view(u"1") : std::u16string_view(u"0")) + ";";
weld::TreeView* pView = mpImpl->mxView->getWidget();
sal_uInt16 nCount = mpImpl->mxView->TypeColumnVisible() ? 4 : 3;
@@ -1093,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)
@@ -1146,7 +1152,7 @@ SvtFileView_Impl::SvtFileView_Impl(SvtFileView* pAntiImpl, weld::Window* pTopLev
{
weld::TreeView* pWidget = mxView->getWidget();
- // set the width to something small so its the parent that decides the final
+ // set the width to something small so it's the parent that decides the final
// width
Size aSize(42, pWidget->get_height_rows(7));
pWidget->set_size_request(aSize.Width(), aSize.Height());
@@ -1166,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 )
{
@@ -1280,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;
@@ -1297,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;
@@ -1305,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)
@@ -1364,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);
}
@@ -1485,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
@@ -1514,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 );
}
@@ -1548,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 ec9dbb0d5f4a..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> {};
}
-#define FILEDIALOG_FILTER_ALL "*.*"
+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 d77fcda0edc1..66f531ec5732 100644
--- a/fpicker/source/office/fpsmartcontent.cxx
+++ b/fpicker/source/office/fpsmartcontent.cxx
@@ -28,8 +28,7 @@
#include <comphelper/processfactory.hxx>
#include <ucbhelper/commandenvironment.hxx>
-#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace svt
@@ -39,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;
@@ -130,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;
@@ -138,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
@@ -178,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)
@@ -186,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;
@@ -210,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
@@ -232,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;
@@ -263,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...
@@ -292,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...
@@ -308,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 6d863e1d2f3f..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>());
@@ -481,18 +480,20 @@ SvtFileDialog::~SvtFileDialog()
const std::vector<PlacePtr> aPlaces = m_xImpl->m_xPlaces->GetPlaces();
Sequence< OUString > placesUrlsList(m_xImpl->m_xPlaces->GetNbEditablePlaces());
+ auto placesUrlsListRange = asNonConstRange(placesUrlsList);
Sequence< OUString > placesNamesList(m_xImpl->m_xPlaces->GetNbEditablePlaces());
+ auto placesNamesListRange = asNonConstRange(placesNamesList);
int i(0);
for (auto const& place : aPlaces)
{
if(place->IsEditable()) {
- placesUrlsList[i] = place->GetUrl();
- placesNamesList[i] = place->GetName();
+ placesUrlsListRange[i] = place->GetUrl();
+ placesNamesListRange[i] = place->GetName();
++i;
}
}
- 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();
@@ -1268,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;
@@ -1388,12 +1389,12 @@ void SvtFileDialog::displayIOException( const OUString& _rURL, IOErrorCode _eCod
// build an own exception which tells "access denied"
InteractiveAugmentedIOException aException;
- aException.Arguments.realloc( 2 );
- aException.Arguments[ 0 ] <<= sDisplayPath;
- aException.Arguments[ 1 ] <<= PropertyValue(
+ aException.Arguments =
+ { css::uno::Any(sDisplayPath),
+ css::uno::Any(PropertyValue(
"Uri",
-1, aException.Arguments[ 0 ], PropertyState_DIRECT_VALUE
- );
+ )) };
// (formerly, it was sufficient to put the URL first parameter. Nowadays,
// the services expects the URL in a PropertyValue named "Uri" ...)
aException.Code = _eCode;
@@ -1401,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(
@@ -1781,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;
@@ -1829,51 +1830,51 @@ bool SvtFileDialog::IsolateFilterFromPath_Impl( OUString& rPath, OUString& rFilt
rFilter.clear();
- if ( nWildCardPos != -1 )
- {
- sal_Int32 nPathTokenPos = aReversePath.indexOf( '/' );
+ if ( nWildCardPos == -1 )
+ return true;
- if ( nPathTokenPos == -1 )
- {
- OUString aDelim(
+ sal_Int32 nPathTokenPos = aReversePath.indexOf( '/' );
+
+ if ( nPathTokenPos == -1 )
+ {
+ OUString aDelim(
#if defined(_WIN32)
- '\\'
+ '\\'
#else
- '/'
+ '/'
#endif
- );
+ );
- nPathTokenPos = aReversePath.indexOf( aDelim );
+ nPathTokenPos = aReversePath.indexOf( aDelim );
#if !defined( UNX )
- if ( nPathTokenPos == -1 )
- {
- nPathTokenPos = aReversePath.indexOf( ':' );
- }
-#endif
+ if ( nPathTokenPos == -1 )
+ {
+ nPathTokenPos = aReversePath.indexOf( ':' );
}
+#endif
+ }
- // check syntax
- if ( nPathTokenPos != -1 )
+ // check syntax
+ if ( nPathTokenPos != -1 )
+ {
+ if ( nPathTokenPos < (rPath.getLength() - nWildCardPos - 1) )
{
- if ( nPathTokenPos < (rPath.getLength() - nWildCardPos - 1) )
- {
- ErrorHandler::HandleError( ERRCODE_SFX_INVALIDSYNTAX );
- return false;
- }
+ ErrorHandler::HandleError( ERRCODE_SFX_INVALIDSYNTAX );
+ return false;
+ }
- // cut off filter
- rFilter = aReversePath.copy( 0, nPathTokenPos );
- rFilter = comphelper::string::reverseString(rFilter);
+ // cut off filter
+ rFilter = aReversePath.copy( 0, nPathTokenPos );
+ rFilter = comphelper::string::reverseString(rFilter);
- // determine folder
- rPath = aReversePath.copy( nPathTokenPos );
- rPath = comphelper::string::reverseString(rPath);
- }
- else
- {
- rFilter = rPath;
- rPath.clear();
- }
+ // determine folder
+ rPath = aReversePath.copy( nPathTokenPos );
+ rPath = comphelper::string::reverseString(rPath);
+ }
+ else
+ {
+ rFilter = rPath;
+ rPath.clear();
}
return true;
@@ -2005,11 +2006,11 @@ weld::Widget* SvtFileDialog::getControl( sal_Int16 nControlId, bool bLabelContro
pReturn = m_xImpl->m_xBtnHelp.get();
break;
- case TOOLBOXBUTOON_LEVEL_UP:
+ case TOOLBOXBUTTON_LEVEL_UP:
pReturn = m_xImpl->m_xBtnUp->getWidget();
break;
- case TOOLBOXBUTOON_NEW_FOLDER:
+ case TOOLBOXBUTTON_NEW_FOLDER:
pReturn = m_xImpl->m_xBtnNewFolder.get();
break;
@@ -2265,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);
@@ -2282,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