summaryrefslogtreecommitdiff
path: root/oox/source/dump/dumperbase.cxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-09-07 14:41:16 +0000
committerOliver Bolte <obo@openoffice.org>2009-09-07 14:41:16 +0000
commit9fa41b880dcfef94fa3b7b057f601d97f8a37763 (patch)
treee9fa09c313164699137f72e8350585a0c8571849 /oox/source/dump/dumperbase.cxx
parentc2f366873f2a3b423265a1ebfdb5e1547d49f3e5 (diff)
CWS-TOOLING: integrate CWS dr72
2009-08-26 10:24:00 +0200 dr r275402 : #i92645# CODEPAGE is encrypted... 2009-08-24 14:37:36 +0200 dr r275316 : #i10000# enable exceptions for xlroot.cxx 2009-08-24 14:33:15 +0200 dr r275313 : #i10000# link openssl under solaris correctly 2009-08-21 17:41:16 +0200 dr r275267 : #i10000# unxlngi6 warning 2009-08-21 15:35:56 +0200 dr r275265 : #i10000# remove files again, already deleted in previous milestone... 2009-08-21 11:24:57 +0200 dr r275227 : #160401# port to DEV300 2009-08-21 09:53:45 +0200 dr r275221 : #i92645# full support for encrypted Word2007 files 2009-08-21 09:50:52 +0200 dr r275219 : #i92645# final changes for decryption 2009-08-20 19:48:40 +0200 dr r275195 : #i104370# missing parentheses, patch from cmc 2009-08-20 18:28:22 +0200 dr r275193 : #i92645# rework package decryption to repair 'Reload Document' functionality 2009-08-20 13:55:14 +0200 dr r275179 : #i92645# add new property names 2009-08-19 19:24:21 +0200 dr r275159 : #160401# open writeprotected files read-only, merged to DEV300 2009-08-18 14:41:47 +0200 dr r275109 : #i92645# add 'Aborted' property 2009-08-18 11:20:34 +0200 dr r275084 : #i92645# write back password to medium 2009-08-17 17:52:51 +0200 dr r275066 : #i92645# detect Word2007 docs with oox detection impl, this adds support of encryped Word2007; correct detection of templates and macro-enabled docs 2009-08-17 17:51:31 +0200 dr r275065 : #i92645# detect Word2007 docs with oox detection impl, this adds support of encryped Word2007; correct detection of templates and macro-enabled docs 2009-08-17 11:06:39 +0200 dr r275035 : #i92645# more password handling 2009-08-17 11:05:21 +0200 dr r275034 : #i92645# use new password input mechanism for BIFF filter and dumper in oox 2009-08-14 16:33:53 +0200 nn r274996 : #i104228# DelBroadcastAreasInRange: remove area from hash_set before deleting 2009-08-14 16:27:12 +0200 nn r274995 : #i104059# restore a change lost in the integration of fhawfixes1 2009-08-14 16:24:00 +0200 dr r274994 : #i92645# adapt BIFF import to latest changes 2009-08-14 16:21:30 +0200 dr r274993 : #i92645# adapt BIFF import to latest changes 2009-08-14 16:20:43 +0200 dr r274992 : #i92645# do not add default passwords to media descriptor 2009-08-13 19:20:45 +0200 dr r274965 : #i92645# add a helper to request a document password 2009-08-13 19:09:35 +0200 dr r274964 : #i92645# add a helper to request a document password 2009-08-13 19:09:03 +0200 dr r274963 : #i92645# add a helper to request a document password 2009-08-13 14:35:01 +0200 dr r274946 : #i92645# comment typo 2009-08-13 14:33:47 +0200 dr r274945 : #i92645# add a helper to request a document password 2009-08-13 14:04:47 +0200 dr r274941 : #i92645# add a helper to request a document password 2009-08-13 14:04:22 +0200 dr r274940 : #i92645# add a helper to request a document password 2009-08-13 11:16:27 +0200 dr r274927 : #i42303# show quick help if field name too long for button 2009-08-13 10:55:48 +0200 dr r274925 : #i31600# cut field name and add ellipsis, if too long for button 2009-08-12 18:47:26 +0200 dr r274914 : #i92645# ask user for a password 2009-08-12 18:02:39 +0200 dr r274909 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-12 16:59:11 +0200 dr r274906 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-12 16:41:18 +0200 dr r274905 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-12 16:40:33 +0200 dr r274904 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-12 16:40:08 +0200 dr r274903 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-12 16:39:30 +0200 dr r274902 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-12 16:15:28 +0200 dr r274899 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-11 19:51:12 +0200 dr r274877 : #i92645# open encrypted MSOOXML package protected with standard XL password 'VelvetSweatshop'
Diffstat (limited to 'oox/source/dump/dumperbase.cxx')
-rw-r--r--oox/source/dump/dumperbase.cxx55
1 files changed, 45 insertions, 10 deletions
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
index e3a553ffa523..81f63062b4ad 100644
--- a/oox/source/dump/dumperbase.cxx
+++ b/oox/source/dump/dumperbase.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/io/XTextOutputStream.hpp>
#include <rtl/math.hxx>
#include <osl/file.hxx>
+#include <comphelper/docpasswordhelper.hxx>
#include "oox/helper/binaryoutputstream.hxx"
#include "oox/core/filterbase.hxx"
#include "oox/xls/biffhelper.hxx"
@@ -51,8 +52,8 @@ using ::rtl::OStringToOUString;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using ::rtl::OUStringToOString;
-using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::util::DateTime;
using ::com::sun::star::lang::XMultiServiceFactory;
@@ -60,9 +61,10 @@ using ::com::sun::star::ucb::XSimpleFileAccess;
using ::com::sun::star::io::XActiveDataSink;
using ::com::sun::star::io::XActiveDataSource;
using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XTextInputStream;
using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XTextInputStream;
using ::com::sun::star::io::XTextOutputStream;
+using ::comphelper::MediaDescriptor;
using ::oox::core::FilterBase;
namespace oox {
@@ -1465,11 +1467,14 @@ NameListRef NameListWrapper::getNameList( const Config& rCfg ) const
// ============================================================================
SharedConfigData::SharedConfigData( const OUString& rFileName,
- const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName ) :
+ const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg,
+ const OUString& rSysFileName, MediaDescriptor& rMediaDesc ) :
mxFactory( rxFactory ),
mxRootStrg( rxRootStrg ),
maSysFileName( rSysFileName ),
- mbLoaded( false )
+ mrMediaDesc( rMediaDesc ),
+ mbLoaded( false ),
+ mbPwCancelled( false )
{
OUString aFileUrl = InputOutputHelper::convertFileNameToUrl( rFileName );
if( aFileUrl.getLength() > 0 )
@@ -1515,6 +1520,20 @@ NameListRef SharedConfigData::getNameList( const OUString& rListName ) const
return xList;
}
+OUString SharedConfigData::requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier )
+{
+ OUString aPassword;
+ if( !mbPwCancelled )
+ {
+ ::std::vector< OUString > aDefaultPasswords;
+ aDefaultPasswords.push_back( CREATE_OUSTRING( "VelvetSweatshop" ) );
+ aPassword = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
+ rVerifier, mrMediaDesc, ::comphelper::DocPasswordRequestType_MS, &aDefaultPasswords );
+ mbPwCancelled = aPassword.getLength() == 0;
+ }
+ return aPassword;
+}
+
bool SharedConfigData::implIsValid() const
{
return mbLoaded && mxFactory.is() && mxRootStrg.get() && (maSysFileName.getLength() > 0);
@@ -1614,9 +1633,9 @@ Config::Config( const sal_Char* pcEnvVar, const FilterBase& rFilter )
construct( pcEnvVar, rFilter );
}
-Config::Config( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName )
+Config::Config( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc )
{
- construct( pcEnvVar, rxFactory, rxRootStrg, rSysFileName );
+ construct( pcEnvVar, rxFactory, rxRootStrg, rSysFileName, rMediaDesc );
}
Config::~Config()
@@ -1631,14 +1650,14 @@ void Config::construct( const Config& rParent )
void Config::construct( const sal_Char* pcEnvVar, const FilterBase& rFilter )
{
if( rFilter.getFileUrl().getLength() > 0 )
- construct( pcEnvVar, rFilter.getGlobalFactory(), rFilter.getStorage(), rFilter.getFileUrl() );
+ construct( pcEnvVar, rFilter.getGlobalFactory(), rFilter.getStorage(), rFilter.getFileUrl(), rFilter.getMediaDescriptor() );
}
-void Config::construct( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName )
+void Config::construct( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc )
{
if( pcEnvVar && rxRootStrg.get() && (rSysFileName.getLength() > 0) )
if( const sal_Char* pcFileName = ::getenv( pcEnvVar ) )
- mxCfgData.reset( new SharedConfigData( OUString::createFromAscii( pcFileName ), rxFactory, rxRootStrg, rSysFileName ) );
+ mxCfgData.reset( new SharedConfigData( OUString::createFromAscii( pcFileName ), rxFactory, rxRootStrg, rSysFileName, rMediaDesc ) );
}
void Config::setStringOption( const String& rKey, const String& rData )
@@ -1683,6 +1702,16 @@ NameListRef Config::getNameList( const String& rListName ) const
return implGetNameList( rListName );
}
+OUString Config::requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier )
+{
+ return mxCfgData->requestPassword( rVerifier );
+}
+
+bool Config::isPasswordCancelled() const
+{
+ return mxCfgData->isPasswordCancelled();
+}
+
bool Config::implIsValid() const
{
return isValid( mxCfgData );
@@ -3050,7 +3079,7 @@ void RecordObjectBase::implDump()
sal_Int64 nRecPos = in().tell();
// record body
- if( cfg().hasName( xRecNames, mnRecId ) )
+ if( !mbBinaryOnly && cfg().hasName( xRecNames, mnRecId ) )
{
ItemFormatMap::const_iterator aIt = aSimpleRecs.find( mnRecId );
if( aIt != aSimpleRecs.end() )
@@ -3081,6 +3110,7 @@ void RecordObjectBase::constructRecObjBase( const BinaryInputStreamRef& rxBaseSt
maRecNames = rRecNames;
maSimpleRecs = rSimpleRecs;
mnRecPos = mnRecId = mnRecSize = 0;
+ mbBinaryOnly = false;
if( InputObjectBase::implIsValid() )
mbShowRecPos = cfg().getBoolOption( "show-record-position", true );
}
@@ -3166,6 +3196,11 @@ bool DumperBase::isImportEnabled() const
return !isValid() || cfg().isImportEnabled();
}
+bool DumperBase::isImportCancelled() const
+{
+ return isValid() && cfg().isPasswordCancelled();
+}
+
void DumperBase::construct( const ConfigRef& rxConfig )
{
if( isValid( rxConfig ) && rxConfig->isDumperEnabled() )