From b538fc543ecfbafef94b15ef068890c22d7f2218 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Thu, 17 Oct 2013 19:49:37 -0300 Subject: fdo#60698: Move fileaccess module to ucb Change-Id: I4c688a4aeedcae56ed6404574bd1bb392d4190cb Reviewed-on: https://gerrit.libreoffice.org/6311 Reviewed-by: Stephan Bergmann Tested-by: Stephan Bergmann --- Repository.mk | 1 - RepositoryExternal.mk | 1 - RepositoryModule_build.mk | 1 - RepositoryModule_host.mk | 1 - chart2/CppunitTest_chart2_export.mk | 2 - chart2/CppunitTest_chart2_import.mk | 2 - configmgr/CppunitTest_configmgr_unit.mk | 1 - cppcanvas/CppunitTest_cppcanvas_test.mk | 1 - dbaccess/CppunitTest_dbaccess_dialog_save.mk | 2 - ...unitTest_dbaccess_embeddeddb_performancetest.mk | 1 - dbaccess/CppunitTest_dbaccess_firebird_test.mk | 1 - dbaccess/CppunitTest_dbaccess_hsqldb_test.mk | 1 - dbaccess/CppunitTest_dbaccess_macros_test.mk | 2 - fileaccess/Library_fileacc.mk | 29 - fileaccess/Makefile | 7 - fileaccess/Module_fileaccess.mk | 15 - fileaccess/README | 1 - fileaccess/source/FileAccess.cxx | 828 --------------------- fileaccess/source/fileacc.component | 25 - ios/qa/sc/Makefile | 2 +- ios/qa/sc/filters-test.m | 1 - postprocess/Rdb_services.mk | 1 - sc/CppunitTest_sc_annotationobj.mk | 2 - sc/CppunitTest_sc_annotationshapeobj.mk | 2 - sc/CppunitTest_sc_annotationsobj.mk | 2 - sc/CppunitTest_sc_cellrangeobj.mk | 2 - sc/CppunitTest_sc_chart_regression_test.mk | 2 - sc/CppunitTest_sc_databaserangeobj.mk | 2 - sc/CppunitTest_sc_datapilotfieldobj.mk | 2 - sc/CppunitTest_sc_datapilottableobj.mk | 2 - sc/CppunitTest_sc_editfieldobj_cell.mk | 2 - sc/CppunitTest_sc_editfieldobj_header.mk | 2 - sc/CppunitTest_sc_filters_test.mk | 2 - sc/CppunitTest_sc_macros_test.mk | 2 - sc/CppunitTest_sc_modelobj.mk | 2 - sc/CppunitTest_sc_namedrangeobj.mk | 2 - sc/CppunitTest_sc_namedrangesobj.mk | 2 - sc/CppunitTest_sc_outlineobj.mk | 2 - sc/CppunitTest_sc_rangelst_test.mk | 2 - sc/CppunitTest_sc_subsequent_export_test.mk | 2 - sc/CppunitTest_sc_subsequent_filters_test.mk | 2 - sc/CppunitTest_sc_tableautoformatfield.mk | 2 - sc/CppunitTest_sc_tablesheetobj.mk | 2 - sc/CppunitTest_sc_tablesheetsobj.mk | 2 - sc/CppunitTest_sc_ucalc.mk | 1 - sd/CppunitTest_sd_filters_test.mk | 2 - sd/CppunitTest_sd_import_tests.mk | 2 - solenv/gbuild/extensions/pre_MergedLibsList.mk | 1 - sw/CppunitTest_sw_filters_test.mk | 1 - sw/CppunitTest_sw_htmlexport.mk | 1 - sw/CppunitTest_sw_layout_test.mk | 2 - sw/CppunitTest_sw_macros_test.mk | 2 - sw/CppunitTest_sw_odfexport.mk | 1 - sw/CppunitTest_sw_odfimport.mk | 1 - sw/CppunitTest_sw_ooxmlexport.mk | 1 - sw/CppunitTest_sw_ooxmlimport.mk | 1 - sw/CppunitTest_sw_rtfexport.mk | 1 - sw/CppunitTest_sw_rtfimport.mk | 1 - sw/CppunitTest_sw_uiwriter.mk | 1 - sw/CppunitTest_sw_uwriter.mk | 1 - sw/CppunitTest_sw_ww8export.mk | 1 - sw/CppunitTest_sw_ww8import.mk | 1 - ucb/Library_ucb1.mk | 3 + ucb/source/core/FileAccess.cxx | 777 +++++++++++++++++++ ucb/source/core/FileAccess.hxx | 44 ++ ucb/source/core/ucb1.component | 3 + ucb/source/core/ucbserv.cxx | 17 +- xmloff/CppunitTest_xmloff_uxmloff.mk | 1 - 68 files changed, 839 insertions(+), 998 deletions(-) delete mode 100644 fileaccess/Library_fileacc.mk delete mode 100644 fileaccess/Makefile delete mode 100644 fileaccess/Module_fileaccess.mk delete mode 100644 fileaccess/README delete mode 100644 fileaccess/source/FileAccess.cxx delete mode 100644 fileaccess/source/fileacc.component create mode 100644 ucb/source/core/FileAccess.cxx create mode 100644 ucb/source/core/FileAccess.hxx diff --git a/Repository.mk b/Repository.mk index 4ba21b25e8cd..6a4f6bac1be0 100644 --- a/Repository.mk +++ b/Repository.mk @@ -526,7 +526,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \ dict_ja \ dict_zh \ embobj \ - fileacc \ $(if $(ENABLE_JAVA),hsqldb) \ i18nlangtag \ i18nutil \ diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index b4def01513e2..20a488155c64 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -2911,7 +2911,6 @@ gb_Gallery__UNO_COMPONENTS := \ comphelper/util/comphelp \ configmgr/source/configmgr \ drawinglayer/drawinglayer \ - fileaccess/source/fileacc \ framework/util/fwk \ i18npool/util/i18npool \ package/source/xstor/xstor \ diff --git a/RepositoryModule_build.mk b/RepositoryModule_build.mk index b94a163bbc1e..aa1585373383 100644 --- a/RepositoryModule_build.mk +++ b/RepositoryModule_build.mk @@ -65,7 +65,6 @@ $(eval $(call gb_Module_add_moduledirs,cross_toolset,\ cppcanvas \ drawinglayer \ editeng \ - fileaccess \ framework \ harfbuzz \ lcms2 \ diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk index 314dbeb0cbb7..f4c30554ccba 100644 --- a/RepositoryModule_host.mk +++ b/RepositoryModule_host.mk @@ -49,7 +49,6 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\ extensions \ external \ extras \ - fileaccess \ filter \ $(call gb_Helper_optional,DBCONNECTIVITY,forms) \ formula \ diff --git a/chart2/CppunitTest_chart2_export.mk b/chart2/CppunitTest_chart2_export.mk index 11599dfeb079..93b8821dd2c8 100644 --- a/chart2/CppunitTest_chart2_export.mk +++ b/chart2/CppunitTest_chart2_export.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,chart2_export, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -74,7 +73,6 @@ $(eval $(call gb_CppunitTest_use_components,chart2_export,\ dbaccess/util/dba \ embeddedobj/util/embobj \ eventattacher/source/evtatt \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/chart2/CppunitTest_chart2_import.mk b/chart2/CppunitTest_chart2_import.mk index 0005363ce289..4aa64c170ec0 100644 --- a/chart2/CppunitTest_chart2_import.mk +++ b/chart2/CppunitTest_chart2_import.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,chart2_import, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -74,7 +73,6 @@ $(eval $(call gb_CppunitTest_use_components,chart2_import,\ dbaccess/util/dba \ embeddedobj/util/embobj \ eventattacher/source/evtatt \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/configmgr/CppunitTest_configmgr_unit.mk b/configmgr/CppunitTest_configmgr_unit.mk index ed84ff498f67..0ab0e7138fa7 100644 --- a/configmgr/CppunitTest_configmgr_unit.mk +++ b/configmgr/CppunitTest_configmgr_unit.mk @@ -38,7 +38,6 @@ $(eval $(call gb_CppunitTest_use_configuration,configmgr_unit)) $(eval $(call gb_CppunitTest_use_components,configmgr_unit,\ configmgr/source/configmgr \ - fileaccess/source/fileacc \ i18npool/util/i18npool \ i18npool/source/search/i18nsearch \ sax/source/expatwrap/expwrap \ diff --git a/cppcanvas/CppunitTest_cppcanvas_test.mk b/cppcanvas/CppunitTest_cppcanvas_test.mk index 8112fd3d193d..e8b10940d951 100644 --- a/cppcanvas/CppunitTest_cppcanvas_test.mk +++ b/cppcanvas/CppunitTest_cppcanvas_test.mk @@ -46,7 +46,6 @@ $(eval $(call gb_CppunitTest_use_components,cppcanvas_test,\ canvas/source/cairo/cairocanvas \ canvas/source/factory/canvasfactory \ configmgr/source/configmgr \ - fileaccess/source/fileacc \ i18npool/util/i18npool \ linguistic/source/lng \ package/util/package2 \ diff --git a/dbaccess/CppunitTest_dbaccess_dialog_save.mk b/dbaccess/CppunitTest_dbaccess_dialog_save.mk index 3bd434649eb7..5e571dcfc2a4 100644 --- a/dbaccess/CppunitTest_dbaccess_dialog_save.mk +++ b/dbaccess/CppunitTest_dbaccess_dialog_save.mk @@ -28,7 +28,6 @@ $(eval $(call gb_CppunitTest_use_libraries,dbaccess_dialog_save, \ sdbt \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -79,7 +78,6 @@ $(eval $(call gb_CppunitTest_use_components,dbaccess_dialog_save,\ dbaccess/util/dbu \ dbaccess/util/sdbt \ dbaccess/source/filter/xml/dbaxml \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/dbaccess/CppunitTest_dbaccess_embeddeddb_performancetest.mk b/dbaccess/CppunitTest_dbaccess_embeddeddb_performancetest.mk index a20712b7981c..631c72e17f4f 100644 --- a/dbaccess/CppunitTest_dbaccess_embeddeddb_performancetest.mk +++ b/dbaccess/CppunitTest_dbaccess_embeddeddb_performancetest.mk @@ -54,7 +54,6 @@ $(eval $(call gb_CppunitTest_use_components,dbaccess_embeddeddb_performancetest, dbaccess/util/dba \ dbaccess/source/filter/xml/dbaxml \ dbaccess/util/dbu \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ diff --git a/dbaccess/CppunitTest_dbaccess_firebird_test.mk b/dbaccess/CppunitTest_dbaccess_firebird_test.mk index 06164f7c6ba7..157a01912124 100644 --- a/dbaccess/CppunitTest_dbaccess_firebird_test.mk +++ b/dbaccess/CppunitTest_dbaccess_firebird_test.mk @@ -45,7 +45,6 @@ $(eval $(call gb_CppunitTest_use_components,dbaccess_firebird_test,\ dbaccess/util/dba \ dbaccess/source/filter/xml/dbaxml \ dbaccess/util/dbu \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ diff --git a/dbaccess/CppunitTest_dbaccess_hsqldb_test.mk b/dbaccess/CppunitTest_dbaccess_hsqldb_test.mk index 095d899fda53..5bdaef6101a3 100644 --- a/dbaccess/CppunitTest_dbaccess_hsqldb_test.mk +++ b/dbaccess/CppunitTest_dbaccess_hsqldb_test.mk @@ -51,7 +51,6 @@ $(eval $(call gb_CppunitTest_use_components,dbaccess_hsqldb_test,\ dbaccess/util/dba \ dbaccess/source/filter/xml/dbaxml \ dbaccess/util/dbu \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ diff --git a/dbaccess/CppunitTest_dbaccess_macros_test.mk b/dbaccess/CppunitTest_dbaccess_macros_test.mk index cf7d983c577e..f84405ca7e5f 100644 --- a/dbaccess/CppunitTest_dbaccess_macros_test.mk +++ b/dbaccess/CppunitTest_dbaccess_macros_test.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,dbaccess_macros_test, \ sdbt \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -75,7 +74,6 @@ $(eval $(call gb_CppunitTest_use_components,dbaccess_macros_test,\ dbaccess/util/dbu \ dbaccess/util/sdbt \ dbaccess/source/filter/xml/dbaxml \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/fileaccess/Library_fileacc.mk b/fileaccess/Library_fileacc.mk deleted file mode 100644 index e7f176c3cf2d..000000000000 --- a/fileaccess/Library_fileacc.mk +++ /dev/null @@ -1,29 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_Library_Library,fileacc)) - -$(eval $(call gb_Library_use_sdk_api,fileacc)) - -$(eval $(call gb_Library_use_libraries,fileacc,\ - comphelper \ - cppu \ - cppuhelper \ - sal \ - tl \ - ucbhelper \ - utl \ - $(gb_UWINAPI) \ -)) - -$(eval $(call gb_Library_set_componentfile,fileacc,fileaccess/source/fileacc)) - -$(eval $(call gb_Library_add_exception_objects,fileacc,fileaccess/source/FileAccess)) - -# vim: set noet sw=4 ts=4: diff --git a/fileaccess/Makefile b/fileaccess/Makefile deleted file mode 100644 index ccb1c85a04da..000000000000 --- a/fileaccess/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- - -module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) - -include $(module_directory)/../solenv/gbuild/partial_build.mk - -# vim: set noet sw=4 ts=4: diff --git a/fileaccess/Module_fileaccess.mk b/fileaccess/Module_fileaccess.mk deleted file mode 100644 index fd72516a6fc1..000000000000 --- a/fileaccess/Module_fileaccess.mk +++ /dev/null @@ -1,15 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_Module_Module,fileaccess)) -$(eval $(call gb_Module_add_targets,fileaccess,\ - Library_fileacc \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/fileaccess/README b/fileaccess/README deleted file mode 100644 index 113465afdcb9..000000000000 --- a/fileaccess/README +++ /dev/null @@ -1 +0,0 @@ -Implements XSimpleFileAccess interface that makes the UCB interfaces actually usable (via UNO) and more intuitive. diff --git a/fileaccess/source/FileAccess.cxx b/fileaccess/source/FileAccess.cxx deleted file mode 100644 index da2dbcb3d5a0..000000000000 --- a/fileaccess/source/FileAccess.cxx +++ /dev/null @@ -1,828 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define IMPLEMENTATION_NAME "com.sun.star.comp.ucb.SimpleFileAccess" -#define SERVICE_NAME "com.sun.star.ucb.SimpleFileAccess" - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::task; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::container; - -using ::std::vector; - -namespace -{ - - -//=========================================================================== -// Implementation XSimpleFileAccess - -typedef cppu::WeakImplHelper1< XSimpleFileAccess3 > FileAccessHelper; -class OCommandEnvironment; - -class OFileAccess : public FileAccessHelper -{ - Reference< XComponentContext > m_xContext; - Reference< XCommandEnvironment > mxEnvironment; - OCommandEnvironment* mpEnvironment; - - void transferImpl( const OUString& rSource, const OUString& rDest, sal_Bool bMoveData ) - throw(CommandAbortedException, Exception, RuntimeException); - bool createNewFile( const OUString & rParentURL, - const OUString & rTitle, - const Reference< XInputStream >& data ) - throw ( Exception ); - -public: - OFileAccess( const Reference< XComponentContext > & xContext ) - : m_xContext( xContext), mpEnvironment( NULL ) {} - - // Methods - virtual void SAL_CALL copy( const OUString& SourceURL, const OUString& DestURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL move( const OUString& SourceURL, const OUString& DestURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL kill( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isFolder( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isReadOnly( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setReadOnly( const OUString& FileURL, sal_Bool bReadOnly ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL createFolder( const OUString& NewFolderURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSize( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual OUString SAL_CALL getContentType( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::util::DateTime SAL_CALL getDateTimeModified( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getFolderContents( const OUString& FolderURL, sal_Bool bIncludeFolders ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL exists( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL openFileRead( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL openFileWrite( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openFileReadWrite( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setInteractionHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL writeFile( const OUString& FileURL, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& data ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isHidden( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setHidden( const OUString& FileURL, sal_Bool bHidden ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); -}; - - -//=========================================================================== -// Implementation XActiveDataSink - -typedef cppu::WeakImplHelper1< XActiveDataSink > ActiveDataSinkHelper; - -class OActiveDataSink : public ActiveDataSinkHelper -{ - Reference< XInputStream > mxStream; - -public: - - // Methods - virtual void SAL_CALL setInputStream( const Reference< XInputStream >& aStream ) - throw(RuntimeException); - virtual Reference< XInputStream > SAL_CALL getInputStream( ) - throw(RuntimeException); -}; - -void OActiveDataSink::setInputStream( const Reference< XInputStream >& aStream ) - throw(RuntimeException) -{ - mxStream = aStream; -} - -Reference< XInputStream > OActiveDataSink::getInputStream() - throw(RuntimeException) -{ - return mxStream; -} - - -//=========================================================================== -// Implementation XActiveDataStreamer - -typedef cppu::WeakImplHelper1< XActiveDataStreamer > ActiveDataStreamerHelper; - -class OActiveDataStreamer : public ActiveDataStreamerHelper -{ - Reference< XStream > mxStream; - -public: - - // Methods - virtual void SAL_CALL setStream( const Reference< XStream >& aStream ) - throw(RuntimeException); - virtual Reference< XStream > SAL_CALL getStream() - throw(RuntimeException); -}; - -void OActiveDataStreamer::setStream( const Reference< XStream >& aStream ) - throw(RuntimeException) -{ - mxStream = aStream; -} - -Reference< XStream > OActiveDataStreamer::getStream() - throw(RuntimeException) -{ - return mxStream; -} - - - -//=========================================================================== -// Implementation XCommandEnvironment - -typedef cppu::WeakImplHelper1< XCommandEnvironment > CommandEnvironmentHelper; - -class OCommandEnvironment : public CommandEnvironmentHelper -{ - Reference< XInteractionHandler > mxInteraction; - -public: - void setHandler( Reference< XInteractionHandler > xInteraction_ ) - { - mxInteraction = xInteraction_; - } - - // Methods - virtual Reference< XInteractionHandler > SAL_CALL getInteractionHandler() - throw(RuntimeException); - virtual Reference< XProgressHandler > SAL_CALL getProgressHandler() - throw(RuntimeException); -}; - -Reference< XInteractionHandler > OCommandEnvironment::getInteractionHandler() - throw(RuntimeException) -{ - return mxInteraction; -} - -Reference< XProgressHandler > OCommandEnvironment::getProgressHandler() - throw(RuntimeException) -{ - Reference< XProgressHandler > xRet; - return xRet; -} - -//=========================================================================== - -void OFileAccess::transferImpl( const OUString& rSource, - const OUString& rDest, - sal_Bool bMoveData ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - // SfxContentHelper::Transfer_Impl - INetURLObject aSourceObj( rSource, INET_PROT_FILE ); - INetURLObject aDestObj( rDest, INET_PROT_FILE ); - OUString aName = aDestObj.getName( - INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - OUString aDestURL; - OUString aSourceURL = aSourceObj.GetMainURL( INetURLObject::NO_DECODE ); - if ( aDestObj.removeSegment() ) - { - // hierarchical URL. - - aDestObj.setFinalSlash(); - aDestURL = aDestObj.GetMainURL( INetURLObject::NO_DECODE ); - } - else - { - // non-hierachical URL - - // #i29648# - // - - if ( aDestObj.GetProtocol() == INET_PROT_VND_SUN_STAR_EXPAND ) - { - // Hack: Expand destination URL using Macro Expander and try again - // with the hopefully hierarchical expanded URL... - - try - { - Reference< XMacroExpander > xExpander = theMacroExpander::get(m_xContext); - - aDestURL = xExpander->expandMacros( - aDestObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ) ); - } - catch ( Exception const & ) - { - throw RuntimeException( - OUString( "OFileAccess::transferrImpl - Unable to obtain " - "destination folder URL!" ), - static_cast< cppu::OWeakObject * >( this ) ); - } - - transferImpl( rSource, aDestURL, bMoveData ); - return; - } - - throw RuntimeException( - OUString( "OFileAccess::transferrImpl - Unable to obtain " - "destination folder URL!" ), - static_cast< cppu::OWeakObject * >( this ) ); - - } - - ucbhelper::Content aDestPath( aDestURL, mxEnvironment, comphelper::getProcessComponentContext() ); - ucbhelper::Content aSrc ( aSourceURL, mxEnvironment, comphelper::getProcessComponentContext() ); - - try - { - aDestPath.transferContent( aSrc, - bMoveData - ? ucbhelper::InsertOperation_MOVE - : ucbhelper::InsertOperation_COPY, - aName, - ::com::sun::star::ucb::NameClash::OVERWRITE ); - } - catch ( ::com::sun::star::ucb::CommandFailedException const & ) - { - // Interaction Handler already handled the error that has occurred... - } -} - -void OFileAccess::copy( const OUString& SourceURL, const OUString& DestURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - transferImpl( SourceURL, DestURL, sal_False ); -} - -void OFileAccess::move( const OUString& SourceURL, const OUString& DestURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - transferImpl( SourceURL, DestURL, sal_True ); -} - -void OFileAccess::kill( const OUString& FileURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - // SfxContentHelper::Kill - INetURLObject aDeleteObj( FileURL, INET_PROT_FILE ); - ucbhelper::Content aCnt( aDeleteObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); - try - { - aCnt.executeCommand( OUString("delete" ), makeAny( sal_Bool( sal_True ) ) ); - } - catch ( ::com::sun::star::ucb::CommandFailedException const & ) - { - // Interaction Handler already handled the error that has occurred... - } -} - -sal_Bool OFileAccess::isFolder( const OUString& FileURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - sal_Bool bRet = sal_False; - try - { - INetURLObject aURLObj( FileURL, INET_PROT_FILE ); - ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); - bRet = aCnt.isFolder(); - } - catch (const Exception &) {} - return bRet; -} - -sal_Bool OFileAccess::isReadOnly( const OUString& FileURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - INetURLObject aURLObj( FileURL, INET_PROT_FILE ); - ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); - Any aRetAny = aCnt.getPropertyValue("IsReadOnly"); - sal_Bool bRet = sal_False; - aRetAny >>= bRet; - return bRet; -} - -void OFileAccess::setReadOnly( const OUString& FileURL, sal_Bool bReadOnly ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - INetURLObject aURLObj( FileURL, INET_PROT_FILE ); - ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); - Any aAny; - aAny <<= bReadOnly; - aCnt.setPropertyValue("IsReadOnly", aAny ); -} - -void OFileAccess::createFolder( const OUString& NewFolderURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - // Does the folder already exist? - if( NewFolderURL.isEmpty() || isFolder( NewFolderURL ) ) - return; - - // SfxContentHelper::MakeFolder - INetURLObject aURL( NewFolderURL, INET_PROT_FILE ); - OUString aTitle = aURL.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - if ( !aTitle.isEmpty() ) - { - aURL.removeSegment(); - - // Does the base folder exist? Otherwise create it first - OUString aBaseFolderURLStr = aURL.GetMainURL( INetURLObject::NO_DECODE ); - if( !isFolder( aBaseFolderURLStr ) ) - { - createFolder( aBaseFolderURLStr ); - } - } - - ucbhelper::Content aCnt( aURL.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); - - Sequence< ContentInfo > aInfo = aCnt.queryCreatableContentsInfo(); - sal_Int32 nCount = aInfo.getLength(); - if ( nCount == 0 ) - return; - - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - // Simply look for the first KIND_FOLDER... - const ContentInfo & rCurr = aInfo[i]; - if ( rCurr.Attributes & ContentInfoAttribute::KIND_FOLDER ) - { - // Make sure the only required bootstrap property is "Title", - const Sequence< Property > & rProps = rCurr.Properties; - if ( rProps.getLength() != 1 ) - continue; - - if ( rProps[ 0 ].Name != "Title" ) - continue; - - Sequence aNames(1); - OUString* pNames = aNames.getArray(); - pNames[0] = OUString( "Title" ); - Sequence< Any > aValues(1); - Any* pValues = aValues.getArray(); - pValues[0] = makeAny( OUString( aTitle ) ); - - ucbhelper::Content aNew; - try - { - if ( !aCnt.insertNewContent( rCurr.Type, aNames, aValues, aNew ) ) - continue; - - // Success. We're done. - return; - } - catch ( ::com::sun::star::ucb::CommandFailedException const & ) - { - // Interaction Handler already handled the error that has occurred... - continue; - } - } - } -} - -sal_Int32 OFileAccess::getSize( const OUString& FileURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - // SfxContentHelper::GetSize - sal_Int32 nSize = 0; - sal_Int64 nTemp = 0; - INetURLObject aObj( FileURL, INET_PROT_FILE ); - ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); - aCnt.getPropertyValue( "Size" ) >>= nTemp; - nSize = (sal_Int32)nTemp; - return nSize; -} - -OUString OFileAccess::getContentType( const OUString& FileURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - INetURLObject aObj( FileURL, INET_PROT_FILE ); - ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); - - Reference< XContent > xContent = aCnt.get(); - OUString aTypeStr = xContent->getContentType(); - return aTypeStr; -} - -DateTime OFileAccess::getDateTimeModified( const OUString& FileURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - INetURLObject aFileObj( FileURL, INET_PROT_FILE ); - DateTime aDateTime; - - Reference< XCommandEnvironment > aCmdEnv; - ucbhelper::Content aYoung( aFileObj.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv, comphelper::getProcessComponentContext() ); - aYoung.getPropertyValue("DateModified") >>= aDateTime; - return aDateTime; -} - -typedef vector< OUString* > StringList_Impl; - -Sequence< OUString > OFileAccess::getFolderContents( const OUString& FolderURL, sal_Bool bIncludeFolders ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - // SfxContentHelper::GetFolderContents - - StringList_Impl* pFiles = NULL; - INetURLObject aFolderObj( FolderURL, INET_PROT_FILE ); - - ucbhelper::Content aCnt( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); - Reference< XResultSet > xResultSet; - Sequence< OUString > aProps(0); - - ucbhelper::ResultSetInclude eInclude = bIncludeFolders ? ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS : ucbhelper::INCLUDE_DOCUMENTS_ONLY; - - try - { - xResultSet = aCnt.createCursor( aProps, eInclude ); - } - catch ( ::com::sun::star::ucb::CommandFailedException const & ) - { - // Interaction Handler already handled the error that has occurred... - } - - if ( xResultSet.is() ) - { - pFiles = new StringList_Impl(); - Reference< com::sun::star::ucb::XContentAccess > xContentAccess( xResultSet, UNO_QUERY ); - - while ( xResultSet->next() ) - { - OUString aId = xContentAccess->queryContentIdentifierString(); - INetURLObject aURL( aId, INET_PROT_FILE ); - OUString* pFile = new OUString( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); - pFiles->push_back( pFile ); - } - } - - if ( pFiles ) - { - size_t nCount = pFiles->size(); - Sequence < OUString > aRet( nCount ); - OUString* pRet = aRet.getArray(); - for ( size_t i = 0; i < nCount; ++i ) - { - OUString* pFile = pFiles->at( i ); - pRet[i] = *( pFile ); - delete pFile; - } - pFiles->clear(); - delete pFiles; - return aRet; - } - else - return Sequence < OUString > (); -} - -sal_Bool OFileAccess::exists( const OUString& FileURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - sal_Bool bRet = sal_False; - try - { - bRet = isFolder( FileURL ); - if( !bRet ) - { - Reference< XInputStream > xStream = openFileRead( FileURL ); - bRet = xStream.is(); - if( bRet ) - xStream->closeInput(); - } - } - catch (const Exception &) {} - return bRet; -} - -Reference< XInputStream > OFileAccess::openFileRead( const OUString& FileURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - Reference< XInputStream > xRet; - INetURLObject aObj( FileURL, INET_PROT_FILE ); - ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); - - Reference< XActiveDataSink > xSink = (XActiveDataSink*)(new OActiveDataSink()); - - try - { - sal_Bool bRet = aCnt.openStream( xSink ); - if( bRet ) - xRet = xSink->getInputStream(); - } - catch ( ::com::sun::star::ucb::CommandFailedException const & ) - { - // Interaction Handler already handled the error that has occurred... - } - - return xRet; -} - -Reference< XOutputStream > OFileAccess::openFileWrite( const OUString& FileURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - Reference< XOutputStream > xRet; - Reference< XStream > xStream = OFileAccess::openFileReadWrite( FileURL ); - if( xStream.is() ) - xRet = xStream->getOutputStream(); - return xRet; -} - -Reference< XStream > OFileAccess::openFileReadWrite( const OUString& FileURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - Reference< XActiveDataStreamer > xSink = (XActiveDataStreamer*)new OActiveDataStreamer(); - Reference< XInterface > xSinkIface = Reference< XInterface >::query( xSink ); - - OpenCommandArgument2 aArg; - aArg.Mode = OpenMode::DOCUMENT; - aArg.Priority = 0; // unused - aArg.Sink = xSink; - aArg.Properties = Sequence< Property >( 0 ); // unused - - Any aCmdArg; - aCmdArg <<= aArg; - - INetURLObject aFileObj( FileURL, INET_PROT_FILE ); - ucbhelper::Content aCnt( aFileObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); - - // Be silent... - Reference< XInteractionHandler > xIH; - if ( mpEnvironment ) - { - xIH = mpEnvironment->getInteractionHandler(); - mpEnvironment->setHandler( 0 ); - } - - try - { - aCnt.executeCommand( OUString("open" ), aCmdArg ); - } - catch ( InteractiveIOException const & e ) - { - if ( xIH.is() ) - mpEnvironment->setHandler( xIH ); - - if ( e.Code == IOErrorCode_NOT_EXISTING ) - { - // Create file... - SvMemoryStream aStream(0,0); - ::utl::OInputStreamWrapper* pInput = new ::utl::OInputStreamWrapper( aStream ); - Reference< XInputStream > xInput( pInput ); - InsertCommandArgument aInsertArg; - aInsertArg.Data = xInput; - aInsertArg.ReplaceExisting = sal_False; - - aCmdArg <<= aInsertArg; - aCnt.executeCommand( OUString("insert" ), aCmdArg ); - - // Retry... - return openFileReadWrite( FileURL ); - } - - throw; - } - - if ( xIH.is() ) - mpEnvironment->setHandler( xIH ); - - Reference< XStream > xRet = xSink->getStream(); - return xRet; -} - -void OFileAccess::setInteractionHandler( const Reference< XInteractionHandler >& Handler ) - throw(RuntimeException) -{ - if( !mpEnvironment ) - { - mpEnvironment = new OCommandEnvironment(); - mxEnvironment = (XCommandEnvironment*)mpEnvironment; - } - mpEnvironment->setHandler( Handler ); -} - -bool OFileAccess::createNewFile( const OUString & rParentURL, - const OUString & rTitle, - const Reference< XInputStream >& data ) - throw ( Exception ) -{ - ucbhelper::Content aParentCnt( rParentURL, mxEnvironment, comphelper::getProcessComponentContext() ); - - Sequence< ContentInfo > aInfo = aParentCnt.queryCreatableContentsInfo(); - sal_Int32 nCount = aInfo.getLength(); - if ( nCount == 0 ) - return false; - - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - const ContentInfo & rCurr = aInfo[i]; - if ( ( rCurr.Attributes - & ContentInfoAttribute::KIND_DOCUMENT ) && - ( rCurr.Attributes - & ContentInfoAttribute::INSERT_WITH_INPUTSTREAM ) ) - { - // Make sure the only required bootstrap property is - // "Title", - const Sequence< Property > & rProps = rCurr.Properties; - if ( rProps.getLength() != 1 ) - continue; - - if ( rProps[ 0 ].Name != "Title" ) - continue; - - Sequence aNames(1); - OUString* pNames = aNames.getArray(); - pNames[0] = OUString( - "Title" ); - Sequence< Any > aValues(1); - Any* pValues = aValues.getArray(); - pValues[0] = makeAny( OUString( rTitle ) ); - - try - { - ucbhelper::Content aNew; - if ( aParentCnt.insertNewContent( - rCurr.Type, aNames, aValues, data, aNew ) ) - return true; // success. - else - continue; - } - catch ( CommandFailedException const & ) - { - // Interaction Handler already handled the - // error that has occurred... - continue; - } - } - } - - return false; -} - -void SAL_CALL OFileAccess::writeFile( const OUString& FileURL, - const Reference< XInputStream >& data ) - throw ( Exception, RuntimeException ) -{ - INetURLObject aURL( FileURL, INET_PROT_FILE ); - try - { - ucbhelper::Content aCnt( - aURL.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, - comphelper::getProcessComponentContext() ); - - try - { - aCnt.writeStream( data, sal_True /* bReplaceExisting */ ); - } - catch ( CommandFailedException const & ) - { - // Interaction Handler already handled the error that has occurred... - } - } - catch ( ContentCreationException const & e ) - { - // Most probably file does not exist. Try to create. - if ( e.eError == ContentCreationError_CONTENT_CREATION_FAILED ) - { - INetURLObject aParentURLObj( aURL ); - if ( aParentURLObj.removeSegment() ) - { - OUString aParentURL - = aParentURLObj.GetMainURL( INetURLObject::NO_DECODE ); - - // ensure all parent folders exist. - createFolder( aParentURL ); - - // create the new file... - OUString aTitle - = aURL.getName( INetURLObject::LAST_SEGMENT, - true, - INetURLObject::DECODE_WITH_CHARSET ); - if ( createNewFile( aParentURL, aTitle, data ) ) - { - // success - return; - } - } - } - - throw; - } -} - -sal_Bool OFileAccess::isHidden( const OUString& FileURL ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - INetURLObject aURLObj( FileURL, INET_PROT_FILE ); - ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); - Any aRetAny = aCnt.getPropertyValue("IsHidden"); - sal_Bool bRet = sal_False; - aRetAny >>= bRet; - return bRet; -} - -void OFileAccess::setHidden( const OUString& FileURL, sal_Bool bHidden ) - throw(CommandAbortedException, Exception, RuntimeException) -{ - INetURLObject aURLObj( FileURL, INET_PROT_FILE ); - ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); - Any aAny; - aAny <<= bHidden; - aCnt.setPropertyValue("IsHidden", aAny ); -} - -//================================================================================================== -//================================================================================================== -//================================================================================================== - -Reference< XInterface > SAL_CALL FileAccess_CreateInstance( const Reference< XMultiServiceFactory > & xSMgr ) -{ - return Reference < XInterface >( ( cppu::OWeakObject * ) new OFileAccess( comphelper::getComponentContext(xSMgr) ) ); -} - - -Sequence< OUString > FileAccess_getSupportedServiceNames() -{ - Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString(SERVICE_NAME ); - return seqNames; -} - - -} - -//================================================================================================== -// Component exports - -extern "C" -{ -SAL_DLLPUBLIC_EXPORT void * SAL_CALL fileacc_component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) -{ - void * pRet = 0; - - if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0) - { - Reference< XSingleServiceFactory > xFactory( cppu::createSingleFactory( - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), - OUString::createFromAscii( pImplName ), - FileAccess_CreateInstance, - FileAccess_getSupportedServiceNames() ) ); - - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - - return pRet; -} -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fileaccess/source/fileacc.component b/fileaccess/source/fileacc.component deleted file mode 100644 index a71ef8d4ff85..000000000000 --- a/fileaccess/source/fileacc.component +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/ios/qa/sc/Makefile b/ios/qa/sc/Makefile index 916c56ebb439..5eb1cb3a33b1 100644 --- a/ios/qa/sc/Makefile +++ b/ios/qa/sc/Makefile @@ -83,7 +83,7 @@ stuff: cp $(OUTDIR)/bin/ure/types.rdb $(APPDIR)/ure # # a bunch of .component files - for F in framework/util/fwk i18npool/util/i18npool sfx2/util/sfx ucb/source/core/ucb1 ucb/source/ucp/file/ucpfile1 unoxml/source/service/unoxml configmgr/source/configmgr basic/util/sb chart2/source/controller/chartcontroller chart2/source/chartcore comphelper/util/comphelp eventattacher/source/evtatt fileaccess/source/fileacc filter/source/config/cache/filterconfig1 oox/util/oox package/source/xstor/xstor package/util/package2 sax/source/expatwrap/expwrap sax/source/fastparser/fastsax sc/util/sc sc/util/scfilt scaddins/source/analysis/analysis scaddins/source/datefunc/date sot/util/sot svl/util/svl toolkit/util/tk ucb/source/ucp/tdoc/ucptdoc1 unotools/util/utl unoxml/source/rdf/unordf; do \ + for F in framework/util/fwk i18npool/util/i18npool sfx2/util/sfx ucb/source/core/ucb1 ucb/source/ucp/file/ucpfile1 unoxml/source/service/unoxml configmgr/source/configmgr basic/util/sb chart2/source/controller/chartcontroller chart2/source/chartcore comphelper/util/comphelp eventattacher/source/evtatt filter/source/config/cache/filterconfig1 oox/util/oox package/source/xstor/xstor package/util/package2 sax/source/expatwrap/expwrap sax/source/fastparser/fastsax sc/util/sc sc/util/scfilt scaddins/source/analysis/analysis scaddins/source/datefunc/date sot/util/sot svl/util/svl toolkit/util/tk ucb/source/ucp/tdoc/ucptdoc1 unotools/util/utl unoxml/source/rdf/unordf; do \ mkdir -p $(APPDIR)/ComponentTarget/`dirname $$F`; \ cp $(WORKDIR)/ComponentTarget/$$F.component $(APPDIR)/ComponentTarget/$$F.component; \ done diff --git a/ios/qa/sc/filters-test.m b/ios/qa/sc/filters-test.m index a78ce82f0658..84e5bf5f10e7 100644 --- a/ios/qa/sc/filters-test.m +++ b/ios/qa/sc/filters-test.m @@ -133,7 +133,6 @@ didFinishLaunchingWithOptions: (NSDictionary *) launchOptions "ComponentTarget/chart2/source/chartcore.component", "ComponentTarget/comphelper/util/comphelp.component", "ComponentTarget/eventattacher/source/evtatt.component", - "ComponentTarget/fileaccess/source/fileacc.component", "ComponentTarget/filter/source/config/cache/filterconfig1.component", "ComponentTarget/oox/util/oox.component", "ComponentTarget/package/source/xstor/xstor.component", diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk index 42ebcd1108f1..0f28e03d4d22 100644 --- a/postprocess/Rdb_services.mk +++ b/postprocess/Rdb_services.mk @@ -26,7 +26,6 @@ $(eval $(call gb_Rdb_add_components,services,\ dtrans/util/mcnttype \ embeddedobj/util/embobj \ eventattacher/source/evtatt \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ filter/source/flash/flash \ filter/source/graphic/graphicfilter \ diff --git a/sc/CppunitTest_sc_annotationobj.mk b/sc/CppunitTest_sc_annotationobj.mk index 25bc1c657f27..cc632fad0c5e 100644 --- a/sc/CppunitTest_sc_annotationobj.mk +++ b/sc/CppunitTest_sc_annotationobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_annotationobj, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_annotationobj,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_annotationshapeobj.mk b/sc/CppunitTest_sc_annotationshapeobj.mk index e9678126e752..db4dbcd09927 100644 --- a/sc/CppunitTest_sc_annotationshapeobj.mk +++ b/sc/CppunitTest_sc_annotationshapeobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_annonationshapeobj, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_annonationshapeobj,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_annotationsobj.mk b/sc/CppunitTest_sc_annotationsobj.mk index d36fb5a3ba2b..b2daad5274b2 100644 --- a/sc/CppunitTest_sc_annotationsobj.mk +++ b/sc/CppunitTest_sc_annotationsobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_annotationsobj, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_annotationsobj,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_cellrangeobj.mk b/sc/CppunitTest_sc_cellrangeobj.mk index e27a7a51acaf..3be6547332c4 100644 --- a/sc/CppunitTest_sc_cellrangeobj.mk +++ b/sc/CppunitTest_sc_cellrangeobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_cellrangesbase, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_cellrangesbase,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_chart_regression_test.mk b/sc/CppunitTest_sc_chart_regression_test.mk index 703ed0c351b7..65619e7c4a91 100644 --- a/sc/CppunitTest_sc_chart_regression_test.mk +++ b/sc/CppunitTest_sc_chart_regression_test.mk @@ -21,7 +21,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_chart_regression_test, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_chart_regression_test,\ dbaccess/util/dba \ embeddedobj/util/embobj \ eventattacher/source/evtatt \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_databaserangeobj.mk b/sc/CppunitTest_sc_databaserangeobj.mk index 1022d943eaf4..2eb62ee42208 100644 --- a/sc/CppunitTest_sc_databaserangeobj.mk +++ b/sc/CppunitTest_sc_databaserangeobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_databaserangeobj, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_databaserangeobj,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_datapilotfieldobj.mk b/sc/CppunitTest_sc_datapilotfieldobj.mk index 927f37d2c773..0c49f98f4245 100644 --- a/sc/CppunitTest_sc_datapilotfieldobj.mk +++ b/sc/CppunitTest_sc_datapilotfieldobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_datapilotfieldobj, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_datapilotfieldobj,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_datapilottableobj.mk b/sc/CppunitTest_sc_datapilottableobj.mk index 79a106dd0efb..bf739ca154a7 100644 --- a/sc/CppunitTest_sc_datapilottableobj.mk +++ b/sc/CppunitTest_sc_datapilottableobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_datapilottableobj, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_datapilottableobj,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_editfieldobj_cell.mk b/sc/CppunitTest_sc_editfieldobj_cell.mk index a1859970baa8..47cfb68f1ac4 100644 --- a/sc/CppunitTest_sc_editfieldobj_cell.mk +++ b/sc/CppunitTest_sc_editfieldobj_cell.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_editfieldobj_cell, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_editfieldobj_cell,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_editfieldobj_header.mk b/sc/CppunitTest_sc_editfieldobj_header.mk index 90160b1f23b5..9ec9fe52617d 100644 --- a/sc/CppunitTest_sc_editfieldobj_header.mk +++ b/sc/CppunitTest_sc_editfieldobj_header.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_editfieldobj_header, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_editfieldobj_header,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_filters_test.mk b/sc/CppunitTest_sc_filters_test.mk index 58c3949dbe6d..e71d581b34c4 100644 --- a/sc/CppunitTest_sc_filters_test.mk +++ b/sc/CppunitTest_sc_filters_test.mk @@ -34,7 +34,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_filters_test, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -84,7 +83,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_filters_test,\ dbaccess/util/dba \ embeddedobj/util/embobj \ eventattacher/source/evtatt \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_macros_test.mk b/sc/CppunitTest_sc_macros_test.mk index 516474e48699..a595b148040c 100644 --- a/sc/CppunitTest_sc_macros_test.mk +++ b/sc/CppunitTest_sc_macros_test.mk @@ -23,7 +23,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_macros_test, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -72,7 +71,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_macros_test,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_modelobj.mk b/sc/CppunitTest_sc_modelobj.mk index 760842a9d73b..c211a5529baa 100644 --- a/sc/CppunitTest_sc_modelobj.mk +++ b/sc/CppunitTest_sc_modelobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_modelobj, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_modelobj,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_namedrangeobj.mk b/sc/CppunitTest_sc_namedrangeobj.mk index 5af7ada215bd..5452d44e6db1 100644 --- a/sc/CppunitTest_sc_namedrangeobj.mk +++ b/sc/CppunitTest_sc_namedrangeobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_namedrangeobj, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_namedrangeobj,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_namedrangesobj.mk b/sc/CppunitTest_sc_namedrangesobj.mk index c346ff99578a..baf47f43b4fb 100644 --- a/sc/CppunitTest_sc_namedrangesobj.mk +++ b/sc/CppunitTest_sc_namedrangesobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_namedrangesobj, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_namedrangesobj,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_outlineobj.mk b/sc/CppunitTest_sc_outlineobj.mk index 8d661719117c..cfaf818a7c2e 100644 --- a/sc/CppunitTest_sc_outlineobj.mk +++ b/sc/CppunitTest_sc_outlineobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_outlineobj, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_outlineobj,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_rangelst_test.mk b/sc/CppunitTest_sc_rangelst_test.mk index 45cef04a437c..3b5e347f1a22 100644 --- a/sc/CppunitTest_sc_rangelst_test.mk +++ b/sc/CppunitTest_sc_rangelst_test.mk @@ -37,7 +37,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_rangelst_test, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -89,7 +88,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_rangelst_test,\ dbaccess/util/dba \ embeddedobj/util/embobj \ eventattacher/source/evtatt \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_subsequent_export_test.mk b/sc/CppunitTest_sc_subsequent_export_test.mk index fc53cc7b5169..be3bbb7dd5ae 100644 --- a/sc/CppunitTest_sc_subsequent_export_test.mk +++ b/sc/CppunitTest_sc_subsequent_export_test.mk @@ -28,7 +28,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_subsequent_export_test, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -77,7 +76,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_subsequent_export_test,\ dbaccess/util/dba \ embeddedobj/util/embobj \ eventattacher/source/evtatt \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_subsequent_filters_test.mk b/sc/CppunitTest_sc_subsequent_filters_test.mk index a5acabd791f8..f57e1c797edf 100644 --- a/sc/CppunitTest_sc_subsequent_filters_test.mk +++ b/sc/CppunitTest_sc_subsequent_filters_test.mk @@ -28,7 +28,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_subsequent_filters_test, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -77,7 +76,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_subsequent_filters_test,\ dbaccess/util/dba \ embeddedobj/util/embobj \ eventattacher/source/evtatt \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_tableautoformatfield.mk b/sc/CppunitTest_sc_tableautoformatfield.mk index 413c6c5fe6f5..5ec9288ad5bc 100644 --- a/sc/CppunitTest_sc_tableautoformatfield.mk +++ b/sc/CppunitTest_sc_tableautoformatfield.mk @@ -23,7 +23,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_tableautoformatfield, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -71,7 +70,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_tableautoformatfield,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_tablesheetobj.mk b/sc/CppunitTest_sc_tablesheetobj.mk index 06a8e6f48469..4dab5185178c 100644 --- a/sc/CppunitTest_sc_tablesheetobj.mk +++ b/sc/CppunitTest_sc_tablesheetobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_tablesheetobj, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_tablesheetobj,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_tablesheetsobj.mk b/sc/CppunitTest_sc_tablesheetsobj.mk index dd6a8d81720a..723d4368a94f 100644 --- a/sc/CppunitTest_sc_tablesheetsobj.mk +++ b/sc/CppunitTest_sc_tablesheetsobj.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_tablesheetsobj, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sc_tablesheetsobj,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk index a40733d235bd..b7370a23b7ef 100644 --- a/sc/CppunitTest_sc_ucalc.mk +++ b/sc/CppunitTest_sc_ucalc.mk @@ -88,7 +88,6 @@ $(eval $(call gb_CppunitTest_use_ure,sc_ucalc)) $(eval $(call gb_CppunitTest_use_components,sc_ucalc,\ configmgr/source/configmgr \ - fileaccess/source/fileacc \ framework/util/fwk \ i18npool/util/i18npool \ i18npool/source/search/i18nsearch \ diff --git a/sd/CppunitTest_sd_filters_test.mk b/sd/CppunitTest_sd_filters_test.mk index 55f62c197a37..58dffc9b8436 100644 --- a/sd/CppunitTest_sd_filters_test.mk +++ b/sd/CppunitTest_sd_filters_test.mk @@ -31,7 +31,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_filters_test, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ i18nlangtag \ i18nutil \ msfilter \ @@ -77,7 +76,6 @@ $(eval $(call gb_CppunitTest_use_components,sd_filters_test,\ configmgr/source/configmgr \ dbaccess/util/dba \ embeddedobj/util/embobj \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ diff --git a/sd/CppunitTest_sd_import_tests.mk b/sd/CppunitTest_sd_import_tests.mk index be5ec1abb61d..8e0773cd76c6 100644 --- a/sd/CppunitTest_sd_import_tests.mk +++ b/sd/CppunitTest_sd_import_tests.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_import_tests, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\ dbaccess/util/dba \ desktop/source/deployment/deployment \ embeddedobj/util/embobj \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ filter/source/svg/svgfilter \ forms/util/frm \ diff --git a/solenv/gbuild/extensions/pre_MergedLibsList.mk b/solenv/gbuild/extensions/pre_MergedLibsList.mk index 2dea0b2f4aba..15d9cfc6d6ad 100644 --- a/solenv/gbuild/extensions/pre_MergedLibsList.mk +++ b/solenv/gbuild/extensions/pre_MergedLibsList.mk @@ -121,7 +121,6 @@ gb_MERGEDLIBS := \ $(if $(filter unx,$(GUIBASE)),desktop_detector) \ drawinglayer \ editeng \ - fileacc \ filterconfig \ fsstorage \ fwe \ diff --git a/sw/CppunitTest_sw_filters_test.mk b/sw/CppunitTest_sw_filters_test.mk index 0e2c044d4110..0cc65fd00b49 100644 --- a/sw/CppunitTest_sw_filters_test.mk +++ b/sw/CppunitTest_sw_filters_test.mk @@ -59,7 +59,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_filters_test,\ configmgr/source/configmgr \ dbaccess/util/dba \ embeddedobj/util/embobj \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sw/CppunitTest_sw_htmlexport.mk b/sw/CppunitTest_sw_htmlexport.mk index 32134351faad..603939ae7114 100644 --- a/sw/CppunitTest_sw_htmlexport.mk +++ b/sw/CppunitTest_sw_htmlexport.mk @@ -53,7 +53,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_htmlexport,\ comphelper/util/comphelp \ configmgr/source/configmgr \ embeddedobj/util/embobj \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sw/CppunitTest_sw_layout_test.mk b/sw/CppunitTest_sw_layout_test.mk index 1a52610cb441..370cff8ee33b 100644 --- a/sw/CppunitTest_sw_layout_test.mk +++ b/sw/CppunitTest_sw_layout_test.mk @@ -23,7 +23,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_layout_test, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -69,7 +68,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_layout_test,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sw/CppunitTest_sw_macros_test.mk b/sw/CppunitTest_sw_macros_test.mk index 49b8b53f4d55..819e0f872196 100644 --- a/sw/CppunitTest_sw_macros_test.mk +++ b/sw/CppunitTest_sw_macros_test.mk @@ -25,7 +25,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_macros_test, \ cppuhelper \ drawinglayer \ editeng \ - fileacc \ for \ forui \ i18nlangtag \ @@ -73,7 +72,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_macros_test,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sw/CppunitTest_sw_odfexport.mk b/sw/CppunitTest_sw_odfexport.mk index 179f344f823a..8c0842eab28b 100644 --- a/sw/CppunitTest_sw_odfexport.mk +++ b/sw/CppunitTest_sw_odfexport.mk @@ -53,7 +53,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_odfexport,\ comphelper/util/comphelp \ configmgr/source/configmgr \ embeddedobj/util/embobj \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ diff --git a/sw/CppunitTest_sw_odfimport.mk b/sw/CppunitTest_sw_odfimport.mk index 723ba25498de..7bbdab876e81 100644 --- a/sw/CppunitTest_sw_odfimport.mk +++ b/sw/CppunitTest_sw_odfimport.mk @@ -54,7 +54,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_odfimport,\ comphelper/util/comphelp \ configmgr/source/configmgr \ embeddedobj/util/embobj \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ diff --git a/sw/CppunitTest_sw_ooxmlexport.mk b/sw/CppunitTest_sw_ooxmlexport.mk index 4927c0dd8613..6e21d5de30e7 100644 --- a/sw/CppunitTest_sw_ooxmlexport.mk +++ b/sw/CppunitTest_sw_ooxmlexport.mk @@ -55,7 +55,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_ooxmlexport,\ configmgr/source/configmgr \ drawinglayer/drawinglayer \ embeddedobj/util/embobj \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ diff --git a/sw/CppunitTest_sw_ooxmlimport.mk b/sw/CppunitTest_sw_ooxmlimport.mk index 696b6ab96b0c..fe1cefeca2a4 100644 --- a/sw/CppunitTest_sw_ooxmlimport.mk +++ b/sw/CppunitTest_sw_ooxmlimport.mk @@ -55,7 +55,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_ooxmlimport,\ configmgr/source/configmgr \ drawinglayer/drawinglayer \ embeddedobj/util/embobj \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sw/CppunitTest_sw_rtfexport.mk b/sw/CppunitTest_sw_rtfexport.mk index 7bc28b4c61d9..01b9378f12ed 100644 --- a/sw/CppunitTest_sw_rtfexport.mk +++ b/sw/CppunitTest_sw_rtfexport.mk @@ -52,7 +52,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_rtfexport,\ comphelper/util/comphelp \ configmgr/source/configmgr \ embeddedobj/util/embobj \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ diff --git a/sw/CppunitTest_sw_rtfimport.mk b/sw/CppunitTest_sw_rtfimport.mk index ba09f4b50498..e4e7ca231926 100644 --- a/sw/CppunitTest_sw_rtfimport.mk +++ b/sw/CppunitTest_sw_rtfimport.mk @@ -55,7 +55,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_rtfimport,\ comphelper/util/comphelp \ configmgr/source/configmgr \ embeddedobj/util/embobj \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ diff --git a/sw/CppunitTest_sw_uiwriter.mk b/sw/CppunitTest_sw_uiwriter.mk index b14d6c9385d6..b4c125769bf8 100644 --- a/sw/CppunitTest_sw_uiwriter.mk +++ b/sw/CppunitTest_sw_uiwriter.mk @@ -54,7 +54,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_uiwriter,\ comphelper/util/comphelp \ configmgr/source/configmgr \ embeddedobj/util/embobj \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ i18npool/util/i18npool \ diff --git a/sw/CppunitTest_sw_uwriter.mk b/sw/CppunitTest_sw_uwriter.mk index 79b9b5719f53..42f481eaa245 100644 --- a/sw/CppunitTest_sw_uwriter.mk +++ b/sw/CppunitTest_sw_uwriter.mk @@ -76,7 +76,6 @@ $(eval $(call gb_CppunitTest_use_ure,sw_uwriter)) $(eval $(call gb_CppunitTest_use_components,sw_uwriter,\ comphelper/util/comphelp \ configmgr/source/configmgr \ - fileaccess/source/fileacc \ framework/util/fwk \ i18npool/util/i18npool \ package/util/package2 \ diff --git a/sw/CppunitTest_sw_ww8export.mk b/sw/CppunitTest_sw_ww8export.mk index 78ee4e3b6da4..9cf5f7f6f7e4 100644 --- a/sw/CppunitTest_sw_ww8export.mk +++ b/sw/CppunitTest_sw_ww8export.mk @@ -54,7 +54,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_ww8export,\ configmgr/source/configmgr \ dbaccess/util/dba \ embeddedobj/util/embobj \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/sw/CppunitTest_sw_ww8import.mk b/sw/CppunitTest_sw_ww8import.mk index e45addc88063..93acdbf98ef7 100644 --- a/sw/CppunitTest_sw_ww8import.mk +++ b/sw/CppunitTest_sw_ww8import.mk @@ -50,7 +50,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_ww8import,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ - fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ forms/util/frm \ framework/util/fwk \ diff --git a/ucb/Library_ucb1.mk b/ucb/Library_ucb1.mk index d819a0f24c42..4b1f1d96aff4 100644 --- a/ucb/Library_ucb1.mk +++ b/ucb/Library_ucb1.mk @@ -26,7 +26,9 @@ $(eval $(call gb_Library_use_libraries,ucb1,\ cppu \ cppuhelper \ sal \ + tl \ ucbhelper \ + utl \ $(gb_UWINAPI) \ )) @@ -39,6 +41,7 @@ $(eval $(call gb_Library_add_exception_objects,ucb1,\ ucb/source/core/ucbprops \ ucb/source/core/ucbserv \ ucb/source/core/ucbstore \ + ucb/source/core/FileAccess \ ucb/source/regexp/regexp \ )) diff --git a/ucb/source/core/FileAccess.cxx b/ucb/source/core/FileAccess.cxx new file mode 100644 index 000000000000..5ecc7e1860b6 --- /dev/null +++ b/ucb/source/core/FileAccess.cxx @@ -0,0 +1,777 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "FileAccess.hxx" + +#define SERVICE_NAME "com.sun.star.ucb.SimpleFileAccess" + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::task; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::registry; +using namespace ::com::sun::star::container; + +using ::std::vector; + +namespace +{ + +// Implementation XSimpleFileAccess +typedef cppu::WeakImplHelper1< XSimpleFileAccess3 > FileAccessHelper; +class OCommandEnvironment; + +class OFileAccess : public FileAccessHelper +{ + Reference< XComponentContext > m_xContext; + Reference< XCommandEnvironment > mxEnvironment; + OCommandEnvironment* mpEnvironment; + + void transferImpl( const OUString& rSource, const OUString& rDest, sal_Bool bMoveData ) + throw(CommandAbortedException, Exception, RuntimeException); + bool createNewFile( const OUString & rParentURL, + const OUString & rTitle, + const Reference< XInputStream >& data ) + throw ( Exception ); + +public: + OFileAccess( const Reference< XComponentContext > & xContext ) + : m_xContext( xContext), mpEnvironment( NULL ) {} + // Methods + virtual void SAL_CALL copy( const OUString& SourceURL, const OUString& DestURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL move( const OUString& SourceURL, const OUString& DestURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL kill( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFolder( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setReadOnly( const OUString& FileURL, sal_Bool bReadOnly ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL createFolder( const OUString& NewFolderURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSize( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getContentType( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getDateTimeModified( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getFolderContents( const OUString& FolderURL, sal_Bool bIncludeFolders ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL exists( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL openFileRead( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL openFileWrite( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openFileReadWrite( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setInteractionHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL writeFile( const OUString& FileURL, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& data ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isHidden( const OUString& FileURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHidden( const OUString& FileURL, sal_Bool bHidden ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); +}; + +// Implementation XActiveDataSink +typedef cppu::WeakImplHelper1< XActiveDataSink > ActiveDataSinkHelper; + +class OActiveDataSink : public ActiveDataSinkHelper +{ + Reference< XInputStream > mxStream; + +public: + + // Methods + virtual void SAL_CALL setInputStream( const Reference< XInputStream >& aStream ) + throw(RuntimeException); + virtual Reference< XInputStream > SAL_CALL getInputStream( ) + throw(RuntimeException); +}; + +// Implementation XActiveDataStreamer +typedef cppu::WeakImplHelper1< XActiveDataStreamer > ActiveDataStreamerHelper; + +class OActiveDataStreamer : public ActiveDataStreamerHelper +{ + Reference< XStream > mxStream; + +public: + + // Methods + virtual void SAL_CALL setStream( const Reference< XStream >& aStream ) + throw(RuntimeException); + virtual Reference< XStream > SAL_CALL getStream() + throw(RuntimeException); +}; + +// Implementation XCommandEnvironment +typedef cppu::WeakImplHelper1< XCommandEnvironment > CommandEnvironmentHelper; + +class OCommandEnvironment : public CommandEnvironmentHelper +{ + Reference< XInteractionHandler > mxInteraction; + +public: + void setHandler( Reference< XInteractionHandler > xInteraction_ ) + { + mxInteraction = xInteraction_; + } + + // Methods + virtual Reference< XInteractionHandler > SAL_CALL getInteractionHandler() + throw(RuntimeException); + virtual Reference< XProgressHandler > SAL_CALL getProgressHandler() + throw(RuntimeException); +}; + +void OActiveDataSink::setInputStream( const Reference< XInputStream >& aStream ) + throw(RuntimeException) +{ + mxStream = aStream; +} + +Reference< XInputStream > OActiveDataSink::getInputStream() + throw(RuntimeException) +{ + return mxStream; +} + +void OActiveDataStreamer::setStream( const Reference< XStream >& aStream ) + throw(RuntimeException) +{ + mxStream = aStream; +} + +Reference< XStream > OActiveDataStreamer::getStream() + throw(RuntimeException) +{ + return mxStream; +} + +Reference< XInteractionHandler > OCommandEnvironment::getInteractionHandler() + throw(RuntimeException) +{ + return mxInteraction; +} + +Reference< XProgressHandler > OCommandEnvironment::getProgressHandler() + throw(RuntimeException) +{ + Reference< XProgressHandler > xRet; + return xRet; +} + +void OFileAccess::transferImpl( const OUString& rSource, + const OUString& rDest, + sal_Bool bMoveData ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + // SfxContentHelper::Transfer_Impl + INetURLObject aSourceObj( rSource, INET_PROT_FILE ); + INetURLObject aDestObj( rDest, INET_PROT_FILE ); + OUString aName = aDestObj.getName( + INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); + OUString aDestURL; + OUString aSourceURL = aSourceObj.GetMainURL( INetURLObject::NO_DECODE ); + if ( aDestObj.removeSegment() ) + { + // hierarchical URL. + + aDestObj.setFinalSlash(); + aDestURL = aDestObj.GetMainURL( INetURLObject::NO_DECODE ); + } + else + { + // non-hierachical URL + + // #i29648# + // + + if ( aDestObj.GetProtocol() == INET_PROT_VND_SUN_STAR_EXPAND ) + { + // Hack: Expand destination URL using Macro Expander and try again + // with the hopefully hierarchical expanded URL... + + try + { + Reference< XMacroExpander > xExpander = theMacroExpander::get(m_xContext); + + aDestURL = xExpander->expandMacros( + aDestObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ) ); + } + catch ( Exception const & ) + { + throw RuntimeException( + OUString( "OFileAccess::transferrImpl - Unable to obtain " + "destination folder URL!" ), + static_cast< cppu::OWeakObject * >( this ) ); + } + + transferImpl( rSource, aDestURL, bMoveData ); + return; + } + + throw RuntimeException( + OUString( "OFileAccess::transferrImpl - Unable to obtain " + "destination folder URL!" ), + static_cast< cppu::OWeakObject * >( this ) ); + + } + + ucbhelper::Content aDestPath( aDestURL, mxEnvironment, comphelper::getProcessComponentContext() ); + ucbhelper::Content aSrc ( aSourceURL, mxEnvironment, comphelper::getProcessComponentContext() ); + + try + { + aDestPath.transferContent( aSrc, + bMoveData + ? ucbhelper::InsertOperation_MOVE + : ucbhelper::InsertOperation_COPY, + aName, + ::com::sun::star::ucb::NameClash::OVERWRITE ); + } + catch ( ::com::sun::star::ucb::CommandFailedException const & ) + { + // Interaction Handler already handled the error that has occurred... + } +} + +void OFileAccess::copy( const OUString& SourceURL, const OUString& DestURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + transferImpl( SourceURL, DestURL, sal_False ); +} + +void OFileAccess::move( const OUString& SourceURL, const OUString& DestURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + transferImpl( SourceURL, DestURL, sal_True ); +} + +void OFileAccess::kill( const OUString& FileURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + // SfxContentHelper::Kill + INetURLObject aDeleteObj( FileURL, INET_PROT_FILE ); + ucbhelper::Content aCnt( aDeleteObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); + try + { + aCnt.executeCommand( OUString("delete" ), makeAny( sal_Bool( sal_True ) ) ); + } + catch ( ::com::sun::star::ucb::CommandFailedException const & ) + { + // Interaction Handler already handled the error that has occurred... + } +} + +sal_Bool OFileAccess::isFolder( const OUString& FileURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + sal_Bool bRet = sal_False; + try + { + INetURLObject aURLObj( FileURL, INET_PROT_FILE ); + ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); + bRet = aCnt.isFolder(); + } + catch (const Exception &) {} + return bRet; +} + +sal_Bool OFileAccess::isReadOnly( const OUString& FileURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + INetURLObject aURLObj( FileURL, INET_PROT_FILE ); + ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); + Any aRetAny = aCnt.getPropertyValue("IsReadOnly"); + sal_Bool bRet = sal_False; + aRetAny >>= bRet; + return bRet; +} + +void OFileAccess::setReadOnly( const OUString& FileURL, sal_Bool bReadOnly ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + INetURLObject aURLObj( FileURL, INET_PROT_FILE ); + ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); + Any aAny; + aAny <<= bReadOnly; + aCnt.setPropertyValue("IsReadOnly", aAny ); +} + +void OFileAccess::createFolder( const OUString& NewFolderURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + // Does the folder already exist? + if( NewFolderURL.isEmpty() || isFolder( NewFolderURL ) ) + return; + + // SfxContentHelper::MakeFolder + INetURLObject aURL( NewFolderURL, INET_PROT_FILE ); + OUString aTitle = aURL.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); + if ( !aTitle.isEmpty() ) + { + aURL.removeSegment(); + + // Does the base folder exist? Otherwise create it first + OUString aBaseFolderURLStr = aURL.GetMainURL( INetURLObject::NO_DECODE ); + if( !isFolder( aBaseFolderURLStr ) ) + { + createFolder( aBaseFolderURLStr ); + } + } + + ucbhelper::Content aCnt( aURL.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); + + Sequence< ContentInfo > aInfo = aCnt.queryCreatableContentsInfo(); + sal_Int32 nCount = aInfo.getLength(); + if ( nCount == 0 ) + return; + + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + // Simply look for the first KIND_FOLDER... + const ContentInfo & rCurr = aInfo[i]; + if ( rCurr.Attributes & ContentInfoAttribute::KIND_FOLDER ) + { + // Make sure the only required bootstrap property is "Title", + const Sequence< Property > & rProps = rCurr.Properties; + if ( rProps.getLength() != 1 ) + continue; + + if ( rProps[ 0 ].Name != "Title" ) + continue; + + Sequence aNames(1); + OUString* pNames = aNames.getArray(); + pNames[0] = OUString( "Title" ); + Sequence< Any > aValues(1); + Any* pValues = aValues.getArray(); + pValues[0] = makeAny( OUString( aTitle ) ); + + ucbhelper::Content aNew; + try + { + if ( !aCnt.insertNewContent( rCurr.Type, aNames, aValues, aNew ) ) + continue; + + // Success. We're done. + return; + } + catch ( ::com::sun::star::ucb::CommandFailedException const & ) + { + // Interaction Handler already handled the error that has occurred... + continue; + } + } + } +} + +sal_Int32 OFileAccess::getSize( const OUString& FileURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + // SfxContentHelper::GetSize + sal_Int32 nSize = 0; + sal_Int64 nTemp = 0; + INetURLObject aObj( FileURL, INET_PROT_FILE ); + ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); + aCnt.getPropertyValue( "Size" ) >>= nTemp; + nSize = (sal_Int32)nTemp; + return nSize; +} + +OUString OFileAccess::getContentType( const OUString& FileURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + INetURLObject aObj( FileURL, INET_PROT_FILE ); + ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); + + Reference< XContent > xContent = aCnt.get(); + OUString aTypeStr = xContent->getContentType(); + return aTypeStr; +} + +DateTime OFileAccess::getDateTimeModified( const OUString& FileURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + INetURLObject aFileObj( FileURL, INET_PROT_FILE ); + DateTime aDateTime; + + Reference< XCommandEnvironment > aCmdEnv; + ucbhelper::Content aYoung( aFileObj.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv, comphelper::getProcessComponentContext() ); + aYoung.getPropertyValue("DateModified") >>= aDateTime; + return aDateTime; +} + +typedef vector< OUString* > StringList_Impl; + +Sequence< OUString > OFileAccess::getFolderContents( const OUString& FolderURL, sal_Bool bIncludeFolders ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + // SfxContentHelper::GetFolderContents + + StringList_Impl* pFiles = NULL; + INetURLObject aFolderObj( FolderURL, INET_PROT_FILE ); + + ucbhelper::Content aCnt( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); + Reference< XResultSet > xResultSet; + Sequence< OUString > aProps(0); + + ucbhelper::ResultSetInclude eInclude = bIncludeFolders ? ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS : ucbhelper::INCLUDE_DOCUMENTS_ONLY; + + try + { + xResultSet = aCnt.createCursor( aProps, eInclude ); + } + catch ( ::com::sun::star::ucb::CommandFailedException const & ) + { + // Interaction Handler already handled the error that has occurred... + } + + if ( xResultSet.is() ) + { + pFiles = new StringList_Impl(); + Reference< com::sun::star::ucb::XContentAccess > xContentAccess( xResultSet, UNO_QUERY ); + + while ( xResultSet->next() ) + { + OUString aId = xContentAccess->queryContentIdentifierString(); + INetURLObject aURL( aId, INET_PROT_FILE ); + OUString* pFile = new OUString( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); + pFiles->push_back( pFile ); + } + } + + if ( pFiles ) + { + size_t nCount = pFiles->size(); + Sequence < OUString > aRet( nCount ); + OUString* pRet = aRet.getArray(); + for ( size_t i = 0; i < nCount; ++i ) + { + OUString* pFile = pFiles->at( i ); + pRet[i] = *( pFile ); + delete pFile; + } + pFiles->clear(); + delete pFiles; + return aRet; + } + else + return Sequence < OUString > (); +} + +sal_Bool OFileAccess::exists( const OUString& FileURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + sal_Bool bRet = sal_False; + try + { + bRet = isFolder( FileURL ); + if( !bRet ) + { + Reference< XInputStream > xStream = openFileRead( FileURL ); + bRet = xStream.is(); + if( bRet ) + xStream->closeInput(); + } + } + catch (const Exception &) {} + return bRet; +} + +Reference< XInputStream > OFileAccess::openFileRead( const OUString& FileURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + Reference< XInputStream > xRet; + INetURLObject aObj( FileURL, INET_PROT_FILE ); + ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); + + Reference< XActiveDataSink > xSink = (XActiveDataSink*)(new OActiveDataSink()); + + try + { + sal_Bool bRet = aCnt.openStream( xSink ); + if( bRet ) + xRet = xSink->getInputStream(); + } + catch ( ::com::sun::star::ucb::CommandFailedException const & ) + { + // Interaction Handler already handled the error that has occurred... + } + + return xRet; +} + +Reference< XOutputStream > OFileAccess::openFileWrite( const OUString& FileURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + Reference< XOutputStream > xRet; + Reference< XStream > xStream = OFileAccess::openFileReadWrite( FileURL ); + if( xStream.is() ) + xRet = xStream->getOutputStream(); + return xRet; +} + +Reference< XStream > OFileAccess::openFileReadWrite( const OUString& FileURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + Reference< XActiveDataStreamer > xSink = (XActiveDataStreamer*)new OActiveDataStreamer(); + Reference< XInterface > xSinkIface = Reference< XInterface >::query( xSink ); + + OpenCommandArgument2 aArg; + aArg.Mode = OpenMode::DOCUMENT; + aArg.Priority = 0; // unused + aArg.Sink = xSink; + aArg.Properties = Sequence< Property >( 0 ); // unused + + Any aCmdArg; + aCmdArg <<= aArg; + + INetURLObject aFileObj( FileURL, INET_PROT_FILE ); + ucbhelper::Content aCnt( aFileObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); + + // Be silent... + Reference< XInteractionHandler > xIH; + if ( mpEnvironment ) + { + xIH = mpEnvironment->getInteractionHandler(); + mpEnvironment->setHandler( 0 ); + } + + try + { + aCnt.executeCommand( OUString("open" ), aCmdArg ); + } + catch ( InteractiveIOException const & e ) + { + if ( xIH.is() ) + mpEnvironment->setHandler( xIH ); + + if ( e.Code == IOErrorCode_NOT_EXISTING ) + { + // Create file... + SvMemoryStream aStream(0,0); + ::utl::OInputStreamWrapper* pInput = new ::utl::OInputStreamWrapper( aStream ); + Reference< XInputStream > xInput( pInput ); + InsertCommandArgument aInsertArg; + aInsertArg.Data = xInput; + aInsertArg.ReplaceExisting = sal_False; + + aCmdArg <<= aInsertArg; + aCnt.executeCommand( OUString("insert" ), aCmdArg ); + + // Retry... + return openFileReadWrite( FileURL ); + } + + throw; + } + + if ( xIH.is() ) + mpEnvironment->setHandler( xIH ); + + Reference< XStream > xRet = xSink->getStream(); + return xRet; +} + +void OFileAccess::setInteractionHandler( const Reference< XInteractionHandler >& Handler ) + throw(RuntimeException) +{ + if( !mpEnvironment ) + { + mpEnvironment = new OCommandEnvironment(); + mxEnvironment = (XCommandEnvironment*)mpEnvironment; + } + mpEnvironment->setHandler( Handler ); +} + +bool OFileAccess::createNewFile( const OUString & rParentURL, + const OUString & rTitle, + const Reference< XInputStream >& data ) + throw ( Exception ) +{ + ucbhelper::Content aParentCnt( rParentURL, mxEnvironment, comphelper::getProcessComponentContext() ); + + Sequence< ContentInfo > aInfo = aParentCnt.queryCreatableContentsInfo(); + sal_Int32 nCount = aInfo.getLength(); + if ( nCount == 0 ) + return false; + + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + const ContentInfo & rCurr = aInfo[i]; + if ( ( rCurr.Attributes + & ContentInfoAttribute::KIND_DOCUMENT ) && + ( rCurr.Attributes + & ContentInfoAttribute::INSERT_WITH_INPUTSTREAM ) ) + { + // Make sure the only required bootstrap property is + // "Title", + const Sequence< Property > & rProps = rCurr.Properties; + if ( rProps.getLength() != 1 ) + continue; + + if ( rProps[ 0 ].Name != "Title" ) + continue; + + Sequence aNames(1); + OUString* pNames = aNames.getArray(); + pNames[0] = OUString( + "Title" ); + Sequence< Any > aValues(1); + Any* pValues = aValues.getArray(); + pValues[0] = makeAny( OUString( rTitle ) ); + + try + { + ucbhelper::Content aNew; + if ( aParentCnt.insertNewContent( + rCurr.Type, aNames, aValues, data, aNew ) ) + return true; // success. + else + continue; + } + catch ( CommandFailedException const & ) + { + // Interaction Handler already handled the + // error that has occurred... + continue; + } + } + } + + return false; +} + +void SAL_CALL OFileAccess::writeFile( const OUString& FileURL, + const Reference< XInputStream >& data ) + throw ( Exception, RuntimeException ) +{ + INetURLObject aURL( FileURL, INET_PROT_FILE ); + try + { + ucbhelper::Content aCnt( + aURL.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, + comphelper::getProcessComponentContext() ); + + try + { + aCnt.writeStream( data, sal_True /* bReplaceExisting */ ); + } + catch ( CommandFailedException const & ) + { + // Interaction Handler already handled the error that has occurred... + } + } + catch ( ContentCreationException const & e ) + { + // Most probably file does not exist. Try to create. + if ( e.eError == ContentCreationError_CONTENT_CREATION_FAILED ) + { + INetURLObject aParentURLObj( aURL ); + if ( aParentURLObj.removeSegment() ) + { + OUString aParentURL + = aParentURLObj.GetMainURL( INetURLObject::NO_DECODE ); + + // ensure all parent folders exist. + createFolder( aParentURL ); + + // create the new file... + OUString aTitle + = aURL.getName( INetURLObject::LAST_SEGMENT, + true, + INetURLObject::DECODE_WITH_CHARSET ); + if ( createNewFile( aParentURL, aTitle, data ) ) + { + // success + return; + } + } + } + + throw; + } +} + +sal_Bool OFileAccess::isHidden( const OUString& FileURL ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + INetURLObject aURLObj( FileURL, INET_PROT_FILE ); + ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); + Any aRetAny = aCnt.getPropertyValue("IsHidden"); + sal_Bool bRet = sal_False; + aRetAny >>= bRet; + return bRet; +} + +void OFileAccess::setHidden( const OUString& FileURL, sal_Bool bHidden ) + throw(CommandAbortedException, Exception, RuntimeException) +{ + INetURLObject aURLObj( FileURL, INET_PROT_FILE ); + ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() ); + Any aAny; + aAny <<= bHidden; + aCnt.setPropertyValue("IsHidden", aAny ); +} + +}; // namespace end + +Reference< XInterface > SAL_CALL FileAccess_CreateInstance( const Reference< XMultiServiceFactory > & xSMgr ) +{ + return Reference < XInterface >( ( cppu::OWeakObject * ) new OFileAccess( comphelper::getComponentContext(xSMgr) ) ); +} + +Sequence< OUString > FileAccess_getSupportedServiceNames() +{ + Sequence< OUString > seqNames(1); + seqNames.getArray()[0] = OUString( SERVICE_NAME ); + return seqNames; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/core/FileAccess.hxx b/ucb/source/core/FileAccess.hxx new file mode 100644 index 000000000000..2e2665c10795 --- /dev/null +++ b/ucb/source/core/FileAccess.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_UCB_SOURCE_CORE_FILEACCESS_HXX +#define INCLUDED_UCB_SOURCE_CORE_FILEACCESS_HXX + +#include "sal/config.h" + +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +namespace com { namespace sun { namespace star { +namespace lang { class XMultiServiceFactory; } +namespace uno { class XInterface; } +} } } + +#define IMPLEMENTATION_NAME "com.sun.star.comp.ucb.SimpleFileAccess" + +css::uno::Reference SAL_CALL FileAccess_CreateInstance( +css::uno::Reference const & xSMgr); + +css::uno::Sequence FileAccess_getSupportedServiceNames(); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/core/ucb1.component b/ucb/source/core/ucb1.component index 00b43ee2ae9a..3fce4dfe8b44 100644 --- a/ucb/source/core/ucb1.component +++ b/ucb/source/core/ucb1.component @@ -34,4 +34,7 @@ + + + diff --git a/ucb/source/core/ucbserv.cxx b/ucb/source/core/ucbserv.cxx index 9c1379592758..1a1745180d67 100644 --- a/ucb/source/core/ucbserv.cxx +++ b/ucb/source/core/ucbserv.cxx @@ -24,11 +24,11 @@ #include "ucbprops.hxx" #include "provprox.hxx" #include "cmdenv.hxx" +#include "FileAccess.hxx" using namespace com::sun::star::uno; using namespace com::sun::star::lang; - //========================================================================= extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucb_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * ) @@ -76,8 +76,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucb_component_getFactory( else if ( UcbContentProviderProxyFactory::getImplementationName_Static(). compareToAscii( pImplName ) == 0 ) { - xFactory - = UcbContentProviderProxyFactory::createServiceFactory( xSMgr ); + xFactory = UcbContentProviderProxyFactory::createServiceFactory( xSMgr ); } ////////////////////////////////////////////////////////////////////// @@ -87,11 +86,17 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucb_component_getFactory( else if ( ucb_cmdenv::UcbCommandEnvironment::getImplementationName_Static(). compareToAscii( pImplName ) == 0 ) { - xFactory - = ucb_cmdenv::UcbCommandEnvironment::createServiceFactory( xSMgr ); + xFactory = ucb_cmdenv::UcbCommandEnvironment::createServiceFactory( xSMgr ); } - ////////////////////////////////////////////////////////////////////// + // FilePicker + else if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0) + { + xFactory = cppu::createSingleFactory(xSMgr, + OUString::createFromAscii( pImplName ), + FileAccess_CreateInstance, + FileAccess_getSupportedServiceNames() ); + } if ( xFactory.is() ) { diff --git a/xmloff/CppunitTest_xmloff_uxmloff.mk b/xmloff/CppunitTest_xmloff_uxmloff.mk index 4a5492c7e074..41fed906204f 100644 --- a/xmloff/CppunitTest_xmloff_uxmloff.mk +++ b/xmloff/CppunitTest_xmloff_uxmloff.mk @@ -53,7 +53,6 @@ $(eval $(call gb_CppunitTest_use_libraries,xmloff_uxmloff, \ $(eval $(call gb_CppunitTest_use_components,xmloff_uxmloff,\ configmgr/source/configmgr \ - fileaccess/source/fileacc \ i18npool/util/i18npool \ sax/source/expatwrap/expwrap \ ucb/source/core/ucb1 \ -- cgit v1.2.3