Files
libreoffice/oox/source/dump/dumperbase.cxx

2598 lines
81 KiB
C++
Raw Normal View History

/* -*- 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 .
*/
2008-01-17 07:06:10 +00:00
#include "oox/dump/dumperbase.hxx"
#include <algorithm>
2008-01-17 07:06:10 +00:00
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/TextOutputStream.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
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'
2009-09-07 14:41:16 +00:00
#include <comphelper/docpasswordhelper.hxx>
2010-08-05 16:01:52 +02:00
#include <osl/file.hxx>
#include <rtl/math.hxx>
#include <rtl/tencinfo.h>
2010-08-05 16:01:52 +02:00
#include "oox/core/filterbase.hxx"
2008-01-17 07:06:10 +00:00
#include "oox/helper/binaryoutputstream.hxx"
#include "oox/helper/textinputstream.hxx"
#include <tools/time.hxx>
2008-01-17 07:06:10 +00:00
#if OOX_INCLUDE_DUMPER
2010-08-05 16:01:52 +02:00
namespace oox {
namespace dump {
2012-12-13 19:02:26 +01:00
using namespace ::com::sun::star;
2010-12-28 17:59:34 +01:00
using namespace ::com::sun::star::beans;
2010-08-05 16:01:52 +02:00
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::uno;
using ::oox::core::FilterBase;
namespace {
2008-01-17 07:06:10 +00:00
const sal_Unicode OOX_DUMP_BOM = 0xFEFF;
const sal_Int32 OOX_DUMP_MAXSTRLEN = 80;
const sal_Int32 OOX_DUMP_INDENT = 2;
const sal_Unicode OOX_DUMP_BINDOT = '.';
const sal_Unicode OOX_DUMP_CFG_LISTSEP = ',';
const sal_Unicode OOX_DUMP_CFG_QUOTE = '\'';
const sal_Unicode OOX_DUMP_LF = '\n';
const sal_Unicode OOX_DUMP_ITEMSEP = '=';
const sal_Int32 OOX_DUMP_BYTESPERLINE = 16;
2008-09-30 13:51:36 +00:00
const sal_Int64 OOX_DUMP_MAXARRAY = 16;
2008-01-17 07:06:10 +00:00
2010-08-05 16:01:52 +02:00
} // namespace
2008-01-17 07:06:10 +00:00
// file names -----------------------------------------------------------------
OUString InputOutputHelper::convertFileNameToUrl( const OUString& rFileName )
{
OUString aFileUrl;
if( ::osl::FileBase::getFileURLFromSystemPath( rFileName, aFileUrl ) == ::osl::FileBase::E_None )
return aFileUrl;
return OUString();
}
sal_Int32 InputOutputHelper::getFileNamePos( const OUString& rFileUrl )
{
sal_Int32 nSepPos = rFileUrl.lastIndexOf( '/' );
return (nSepPos < 0) ? 0 : (nSepPos + 1);
}
OUString InputOutputHelper::getFileNameExtension( const OUString& rFileUrl )
{
sal_Int32 nNamePos = getFileNamePos( rFileUrl );
sal_Int32 nExtPos = rFileUrl.lastIndexOf( '.' );
if( nExtPos >= nNamePos )
return rFileUrl.copy( nExtPos + 1 );
return OUString();
}
2008-09-30 13:51:36 +00:00
// input streams --------------------------------------------------------------
Reference< XInputStream > InputOutputHelper::openInputStream(
const Reference< XComponentContext >& rxContext, const OUString& rFileName )
2008-01-17 07:06:10 +00:00
{
Reference< XInputStream > xInStrm;
if( rxContext.is() ) try
2008-01-17 07:06:10 +00:00
{
Reference<XSimpleFileAccess3> xFileAccess(SimpleFileAccess::create(rxContext));
2008-01-17 07:06:10 +00:00
xInStrm = xFileAccess->openFileRead( rFileName );
}
catch( Exception& )
{
}
return xInStrm;
}
2008-09-30 13:51:36 +00:00
// output streams -------------------------------------------------------------
Reference< XOutputStream > InputOutputHelper::openOutputStream(
const Reference< XComponentContext >& rxContext, const OUString& rFileName )
2008-01-17 07:06:10 +00:00
{
Reference< XOutputStream > xOutStrm;
if( rxContext.is() ) try
2008-01-17 07:06:10 +00:00
{
Reference<XSimpleFileAccess3> xFileAccess(SimpleFileAccess::create(rxContext));
2008-09-30 13:51:36 +00:00
xOutStrm = xFileAccess->openFileWrite( rFileName );
2008-01-17 07:06:10 +00:00
}
catch( Exception& )
{
}
return xOutStrm;
}
Reference< XTextOutputStream2 > InputOutputHelper::openTextOutputStream(
const Reference< XComponentContext >& rxContext, const Reference< XOutputStream >& rxOutStrm, rtl_TextEncoding eTextEnc )
2008-01-17 07:06:10 +00:00
{
Reference< XTextOutputStream2 > xTextOutStrm;
const char* pcCharset = rtl_getMimeCharsetFromTextEncoding( eTextEnc );
if( rxContext.is() && rxOutStrm.is() && pcCharset ) try
2008-01-17 07:06:10 +00:00
{
xTextOutStrm = TextOutputStream::create(rxContext);
xTextOutStrm->setOutputStream( rxOutStrm );
xTextOutStrm->setEncoding( OUString::createFromAscii( pcCharset ) );
2008-01-17 07:06:10 +00:00
}
catch( Exception& )
{
}
return xTextOutStrm;
}
Reference< XTextOutputStream2 > InputOutputHelper::openTextOutputStream(
const Reference< XComponentContext >& rxContext, const OUString& rFileName, rtl_TextEncoding eTextEnc )
2008-01-17 07:06:10 +00:00
{
return openTextOutputStream( rxContext, openOutputStream( rxContext, rFileName ), eTextEnc );
2008-01-17 07:06:10 +00:00
}
ItemFormat::ItemFormat() :
meDataType( DATATYPE_VOID ),
meFmtType( FORMATTYPE_NONE )
{
}
void ItemFormat::set( DataType eDataType, FormatType eFmtType, const OUString& rItemName )
{
meDataType = eDataType;
meFmtType = eFmtType;
maItemName = rItemName;
maListName.clear();
2008-01-17 07:06:10 +00:00
}
OUStringVector::const_iterator ItemFormat::parse( const OUStringVector& rFormatVec )
{
set( DATATYPE_VOID, FORMATTYPE_NONE, OUString() );
OUStringVector::const_iterator aIt = rFormatVec.begin(), aEnd = rFormatVec.end();
OUString aDataType, aFmtType;
if( aIt != aEnd ) aDataType = *aIt++;
if( aIt != aEnd ) aFmtType = *aIt++;
if( aIt != aEnd ) maItemName = *aIt++;
if( aIt != aEnd ) maListName = *aIt++;
meDataType = StringHelper::convertToDataType( aDataType );
meFmtType = StringHelper::convertToFormatType( aFmtType );
if( meFmtType == FORMATTYPE_NONE )
{
if ( aFmtType == "unused" )
set( meDataType, FORMATTYPE_HEX, OOX_DUMP_UNUSED );
else if ( aFmtType == "unknown" )
set( meDataType, FORMATTYPE_HEX, OOX_DUMP_UNKNOWN );
2008-01-17 07:06:10 +00:00
}
return aIt;
}
OUStringVector ItemFormat::parse( const OUString& rFormatStr )
{
OUStringVector aFormatVec;
StringHelper::convertStringToStringList( aFormatVec, rFormatStr, false );
OUStringVector::const_iterator aIt = parse( aFormatVec );
return OUStringVector( aIt, const_cast< const OUStringVector& >( aFormatVec ).end() );
}
// append string to string ----------------------------------------------------
2008-09-30 13:51:36 +00:00
void StringHelper::appendChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount )
2008-01-17 07:06:10 +00:00
{
for( sal_Int32 nIndex = 0; nIndex < nCount; ++nIndex )
rStr.append( cChar );
}
void StringHelper::appendString( OUStringBuffer& rStr, const OUString& rData, sal_Int32 nWidth, sal_Unicode cFill )
{
appendChar( rStr, cFill, nWidth - rData.getLength() );
rStr.append( rData );
}
// append decimal -------------------------------------------------------------
void StringHelper::appendDec( OUStringBuffer& rStr, sal_uInt8 nData, sal_Int32 nWidth, sal_Unicode cFill )
{
appendString( rStr, OUString::number( nData ), nWidth, cFill );
2008-01-17 07:06:10 +00:00
}
void StringHelper::appendDec( OUStringBuffer& rStr, sal_Int8 nData, sal_Int32 nWidth, sal_Unicode cFill )
{
appendString( rStr, OUString::number( nData ), nWidth, cFill );
2008-01-17 07:06:10 +00:00
}
void StringHelper::appendDec( OUStringBuffer& rStr, sal_uInt16 nData, sal_Int32 nWidth, sal_Unicode cFill )
{
appendString( rStr, OUString::number( nData ), nWidth, cFill );
2008-01-17 07:06:10 +00:00
}
void StringHelper::appendDec( OUStringBuffer& rStr, sal_Int16 nData, sal_Int32 nWidth, sal_Unicode cFill )
{
appendString( rStr, OUString::number( nData ), nWidth, cFill );
2008-01-17 07:06:10 +00:00
}
void StringHelper::appendDec( OUStringBuffer& rStr, sal_uInt32 nData, sal_Int32 nWidth, sal_Unicode cFill )
{
appendString( rStr, OUString::number( nData ), nWidth, cFill );
2008-01-17 07:06:10 +00:00
}
void StringHelper::appendDec( OUStringBuffer& rStr, sal_Int32 nData, sal_Int32 nWidth, sal_Unicode cFill )
{
appendString( rStr, OUString::number( nData ), nWidth, cFill );
2008-01-17 07:06:10 +00:00
}
void StringHelper::appendDec( OUStringBuffer& rStr, sal_uInt64 nData, sal_Int32 nWidth, sal_Unicode cFill )
{
/* Values greater than biggest signed 64bit integer will change to
negative when converting to sal_Int64. Therefore, the trailing digit
will be written separately. */
OUStringBuffer aBuffer;
if( nData > 9 )
aBuffer.append( OUString::number( nData / 10 ) );
2008-01-17 07:06:10 +00:00
aBuffer.append( static_cast< sal_Unicode >( '0' + (nData % 10) ) );
appendString( rStr, aBuffer.makeStringAndClear(), nWidth, cFill );
}
void StringHelper::appendDec( OUStringBuffer& rStr, sal_Int64 nData, sal_Int32 nWidth, sal_Unicode cFill )
{
appendString( rStr, OUString::number( nData ), nWidth, cFill );
2008-01-17 07:06:10 +00:00
}
void StringHelper::appendDec( OUStringBuffer& rStr, double fData, sal_Int32 nWidth, sal_Unicode cFill )
{
appendString( rStr, ::rtl::math::doubleToUString( fData, rtl_math_StringFormat_G, 15, '.', true ), nWidth, cFill );
}
// append hexadecimal ---------------------------------------------------------
void StringHelper::appendHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix )
{
static const sal_Unicode spcHexDigits[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
if( bPrefix )
rStr.append( "0x" );
2008-01-17 07:06:10 +00:00
rStr.append( spcHexDigits[ (nData >> 4) & 0x0F ] ).append( spcHexDigits[ nData & 0x0F ] );
}
void StringHelper::appendHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix )
{
appendHex( rStr, static_cast< sal_uInt8 >( nData ), bPrefix );
}
void StringHelper::appendHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix )
{
appendHex( rStr, static_cast< sal_uInt8 >( nData >> 8 ), bPrefix );
appendHex( rStr, static_cast< sal_uInt8 >( nData ), false );
}
void StringHelper::appendHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix )
{
appendHex( rStr, static_cast< sal_uInt16 >( nData ), bPrefix );
}
void StringHelper::appendHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix )
{
appendHex( rStr, static_cast< sal_uInt16 >( nData >> 16 ), bPrefix );
appendHex( rStr, static_cast< sal_uInt16 >( nData ), false );
}
void StringHelper::appendHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix )
{
appendHex( rStr, static_cast< sal_uInt32 >( nData ), bPrefix );
}
void StringHelper::appendHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix )
{
appendHex( rStr, static_cast< sal_uInt32 >( nData >> 32 ), bPrefix );
appendHex( rStr, static_cast< sal_uInt32 >( nData ), false );
}
void StringHelper::appendHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix )
{
appendHex( rStr, static_cast< sal_uInt64 >( nData ), bPrefix );
}
static sal_uInt64
lcl_ConvertDouble(double const f)
{
sal_uInt64 i = sal_uInt64();
for (size_t j = 0; j < sizeof(double); ++j)
{ // hopefully both endian independent and strict aliasing safe
reinterpret_cast<char *>(&i)[j] = reinterpret_cast<char const *>(&f)[j];
}
return i;
}
2008-01-17 07:06:10 +00:00
void StringHelper::appendHex( OUStringBuffer& rStr, double fData, bool bPrefix )
{
appendHex( rStr, lcl_ConvertDouble(fData), bPrefix );
2008-01-17 07:06:10 +00:00
}
// append shortened hexadecimal -----------------------------------------------
void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix )
{
2008-09-30 13:51:36 +00:00
appendHex( rStr, nData, bPrefix );
2008-01-17 07:06:10 +00:00
}
void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix )
{
2008-09-30 13:51:36 +00:00
appendHex( rStr, nData, bPrefix );
2008-01-17 07:06:10 +00:00
}
void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix )
{
2008-09-30 13:51:36 +00:00
if( nData > SAL_MAX_UINT8 )
2008-01-17 07:06:10 +00:00
appendHex( rStr, nData, bPrefix );
else
2008-09-30 13:51:36 +00:00
appendHex( rStr, static_cast< sal_uInt8 >( nData ), bPrefix );
2008-01-17 07:06:10 +00:00
}
void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix )
{
appendShortHex( rStr, static_cast< sal_uInt16 >( nData ), bPrefix );
}
void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix )
{
2008-09-30 13:51:36 +00:00
if( nData > SAL_MAX_UINT16 )
2008-01-17 07:06:10 +00:00
appendHex( rStr, nData, bPrefix );
else
appendShortHex( rStr, static_cast< sal_uInt16 >( nData ), bPrefix );
}
void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix )
{
appendShortHex( rStr, static_cast< sal_uInt32 >( nData ), bPrefix );
}
void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix )
{
2008-09-30 13:51:36 +00:00
if( nData > SAL_MAX_UINT32 )
2008-01-17 07:06:10 +00:00
appendHex( rStr, nData, bPrefix );
else
appendShortHex( rStr, static_cast< sal_uInt32 >( nData ), bPrefix );
}
void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix )
{
appendShortHex( rStr, static_cast< sal_uInt64 >( nData ), bPrefix );
}
2008-09-30 13:51:36 +00:00
void StringHelper::appendShortHex( OUStringBuffer& rStr, double fData, bool bPrefix )
{
appendHex( rStr, fData, bPrefix );
}
2008-01-17 07:06:10 +00:00
// append binary --------------------------------------------------------------
void StringHelper::appendBin( OUStringBuffer& rStr, sal_uInt8 nData, bool bDots )
{
for( sal_uInt8 nMask = 0x80; nMask != 0; (nMask >>= 1) &= 0x7F )
{
rStr.append( static_cast< sal_Unicode >( (nData & nMask) ? '1' : '0' ) );
if( bDots && (nMask == 0x10) )
rStr.append( OOX_DUMP_BINDOT );
}
}
void StringHelper::appendBin( OUStringBuffer& rStr, sal_Int8 nData, bool bDots )
{
appendBin( rStr, static_cast< sal_uInt8 >( nData ), bDots );
}
void StringHelper::appendBin( OUStringBuffer& rStr, sal_uInt16 nData, bool bDots )
{
appendBin( rStr, static_cast< sal_uInt8 >( nData >> 8 ), bDots );
if( bDots )
rStr.append( OOX_DUMP_BINDOT );
appendBin( rStr, static_cast< sal_uInt8 >( nData ), bDots );
}
void StringHelper::appendBin( OUStringBuffer& rStr, sal_Int16 nData, bool bDots )
{
appendBin( rStr, static_cast< sal_uInt16 >( nData ), bDots );
}
void StringHelper::appendBin( OUStringBuffer& rStr, sal_uInt32 nData, bool bDots )
{
appendBin( rStr, static_cast< sal_uInt16 >( nData >> 16 ), bDots );
if( bDots )
rStr.append( OOX_DUMP_BINDOT );
appendBin( rStr, static_cast< sal_uInt16 >( nData ), bDots );
}
void StringHelper::appendBin( OUStringBuffer& rStr, sal_Int32 nData, bool bDots )
{
appendBin( rStr, static_cast< sal_uInt32 >( nData ), bDots );
}
void StringHelper::appendBin( OUStringBuffer& rStr, sal_uInt64 nData, bool bDots )
{
appendBin( rStr, static_cast< sal_uInt32 >( nData >> 32 ), bDots );
if( bDots )
rStr.append( OOX_DUMP_BINDOT );
appendBin( rStr, static_cast< sal_uInt32 >( nData ), bDots );
}
void StringHelper::appendBin( OUStringBuffer& rStr, sal_Int64 nData, bool bDots )
{
appendBin( rStr, static_cast< sal_uInt64 >( nData ), bDots );
}
void StringHelper::appendBin( OUStringBuffer& rStr, double fData, bool bDots )
{
appendBin( rStr, lcl_ConvertDouble(fData), bDots );
2008-01-17 07:06:10 +00:00
}
// append formatted value -----------------------------------------------------
void StringHelper::appendBool( OUStringBuffer& rStr, bool bData )
{
rStr.appendAscii( bData ? "true" : "false" );
}
// encoded text output --------------------------------------------------------
void StringHelper::appendCChar( OUStringBuffer& rStr, sal_Unicode cChar, bool bPrefix )
{
if( cChar > 0x00FF )
{
if( bPrefix )
rStr.append( "\\u" );
2008-01-17 07:06:10 +00:00
appendHex( rStr, static_cast< sal_uInt16 >( cChar ), false );
}
else
{
if( bPrefix )
rStr.append( "\\x" );
2008-01-17 07:06:10 +00:00
appendHex( rStr, static_cast< sal_uInt8 >( cChar ), false );
}
}
void StringHelper::appendEncChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount, bool bPrefix )
{
if( cChar < 0x0020 )
{
// C-style hex code
OUStringBuffer aCode;
appendCChar( aCode, cChar, bPrefix );
2011-10-05 17:04:23 +02:00
OUString aCodeStr = aCode.makeStringAndClear();
2008-01-17 07:06:10 +00:00
for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
2011-10-05 17:04:23 +02:00
rStr.append( aCodeStr );
2008-01-17 07:06:10 +00:00
}
else
{
appendChar( rStr, cChar, nCount );
}
}
void StringHelper::appendEncString( OUStringBuffer& rStr, const OUString& rData, bool bPrefix )
{
sal_Int32 nBeg = 0;
sal_Int32 nIdx = 0;
sal_Int32 nEnd = rData.getLength();
while( nIdx < nEnd )
{
// find next character that needs encoding
while( (nIdx < nEnd) && (rData[ nIdx ] >= 0x20) ) ++nIdx;
// append portion
if( nBeg < nIdx )
{
if( (nBeg == 0) && (nIdx == nEnd) )
rStr.append( rData );
else
rStr.append( rData.copy( nBeg, nIdx - nBeg ) );
}
// append characters to be encoded
while( (nIdx < nEnd) && (rData[ nIdx ] < 0x20) )
{
appendCChar( rStr, rData[ nIdx ], bPrefix );
++nIdx;
}
// adjust limits
nBeg = nIdx;
}
}
// token list -----------------------------------------------------------------
void StringHelper::appendToken( OUStringBuffer& rStr, const OUString& rToken, sal_Unicode cSep )
{
if( (rStr.getLength() > 0) && (!rToken.isEmpty()) )
2008-01-17 07:06:10 +00:00
rStr.append( cSep );
rStr.append( rToken );
}
void StringHelper::appendIndex( OUStringBuffer& rStr, const OUString& rIdx )
{
rStr.append( '[' ).append( rIdx ).append( ']' );
2008-01-17 07:06:10 +00:00
}
void StringHelper::appendIndex( OUStringBuffer& rStr, sal_Int64 nIdx )
{
OUStringBuffer aToken;
appendDec( aToken, nIdx );
appendIndex( rStr, aToken.makeStringAndClear() );
}
OUString StringHelper::getToken( const OUString& rData, sal_Int32& rnPos, sal_Unicode cSep )
{
return trimSpaces( rData.getToken( 0, cSep, rnPos ) );
}
void StringHelper::enclose( OUStringBuffer& rStr, sal_Unicode cOpen, sal_Unicode cClose )
{
rStr.insert( 0, cOpen ).append( cClose ? cClose : cOpen );
}
// string conversion ----------------------------------------------------------
namespace {
sal_Int32 lclIndexOf( const OUString& rStr, sal_Unicode cChar, sal_Int32 nStartPos )
{
sal_Int32 nIndex = rStr.indexOf( cChar, nStartPos );
return (nIndex < 0) ? rStr.getLength() : nIndex;
}
OUString lclTrimQuotedStringList( const OUString& rStr )
{
OUStringBuffer aBuffer;
sal_Int32 nPos = 0;
sal_Int32 nLen = rStr.getLength();
while( nPos < nLen )
{
if( rStr[ nPos ] == OOX_DUMP_CFG_QUOTE )
{
// quoted string, skip leading quote character
++nPos;
// process quoted text and embedded literal quote characters
2008-01-17 07:06:10 +00:00
OUStringBuffer aToken;
do
{
// seek to next quote character and add text portion to token buffer
sal_Int32 nEnd = lclIndexOf( rStr, OOX_DUMP_CFG_QUOTE, nPos );
aToken.append( rStr.copy( nPos, nEnd - nPos ) );
// process literal quotes
while( (nEnd + 1 < nLen) && (rStr[ nEnd ] == OOX_DUMP_CFG_QUOTE) && (rStr[ nEnd + 1 ] == OOX_DUMP_CFG_QUOTE) )
{
aToken.append( OOX_DUMP_CFG_QUOTE );
nEnd += 2;
}
// nEnd is start of possible next text portion
nPos = nEnd;
}
while( (nPos < nLen) && (rStr[ nPos ] != OOX_DUMP_CFG_QUOTE) );
// add token, seek to list separator, ignore text following closing quote
aBuffer.append( aToken.makeStringAndClear() );
nPos = lclIndexOf( rStr, OOX_DUMP_CFG_LISTSEP, nPos );
if( nPos < nLen )
aBuffer.append( OOX_DUMP_LF );
// set current position behind list separator
++nPos;
}
else
{
// find list separator, add token text to buffer
sal_Int32 nEnd = lclIndexOf( rStr, OOX_DUMP_CFG_LISTSEP, nPos );
aBuffer.append( rStr.copy( nPos, nEnd - nPos ) );
if( nEnd < nLen )
aBuffer.append( OOX_DUMP_LF );
// set current position behind list separator
nPos = nEnd + 1;
}
}
return aBuffer.makeStringAndClear();
}
} // namespace
OUString StringHelper::trimSpaces( const OUString& rStr )
{
sal_Int32 nBeg = 0;
while( (nBeg < rStr.getLength()) && ((rStr[ nBeg ] == ' ') || (rStr[ nBeg ] == '\t')) )
++nBeg;
sal_Int32 nEnd = rStr.getLength();
while( (nEnd > nBeg) && ((rStr[ nEnd - 1 ] == ' ') || (rStr[ nEnd - 1 ] == '\t')) )
--nEnd;
return rStr.copy( nBeg, nEnd - nBeg );
}
OUString StringHelper::trimTrailingNul( const OUString& rStr )
{
sal_Int32 nLastPos = rStr.getLength() - 1;
if( (nLastPos >= 0) && (rStr[ nLastPos ] == 0) )
return rStr.copy( 0, nLastPos );
return rStr;
}
2008-01-17 07:06:10 +00:00
OString StringHelper::convertToUtf8( const OUString& rStr )
{
2008-09-30 13:51:36 +00:00
return OUStringToOString( rStr, RTL_TEXTENCODING_UTF8 );
2008-01-17 07:06:10 +00:00
}
DataType StringHelper::convertToDataType( const OUString& rStr )
{
DataType eType = DATATYPE_VOID;
if ( rStr == "int8" )
2008-01-17 07:06:10 +00:00
eType = DATATYPE_INT8;
else if ( rStr == "uint8" )
2008-01-17 07:06:10 +00:00
eType = DATATYPE_UINT8;
else if ( rStr == "int16" )
2008-01-17 07:06:10 +00:00
eType = DATATYPE_INT16;
else if ( rStr == "uint16" )
2008-01-17 07:06:10 +00:00
eType = DATATYPE_UINT16;
else if ( rStr == "int32" )
2008-01-17 07:06:10 +00:00
eType = DATATYPE_INT32;
else if ( rStr == "uint32" )
2008-01-17 07:06:10 +00:00
eType = DATATYPE_UINT32;
else if ( rStr == "int64" )
2008-01-17 07:06:10 +00:00
eType = DATATYPE_INT64;
else if ( rStr == "uint64" )
2008-01-17 07:06:10 +00:00
eType = DATATYPE_UINT64;
else if ( rStr == "float" )
2008-01-17 07:06:10 +00:00
eType = DATATYPE_FLOAT;
else if ( rStr == "double" )
2008-01-17 07:06:10 +00:00
eType = DATATYPE_DOUBLE;
return eType;
}
FormatType StringHelper::convertToFormatType( const OUString& rStr )
{
FormatType eType = FORMATTYPE_NONE;
if ( rStr == "dec" )
2008-01-17 07:06:10 +00:00
eType = FORMATTYPE_DEC;
else if ( rStr == "hex" )
2008-01-17 07:06:10 +00:00
eType = FORMATTYPE_HEX;
else if ( rStr == "shorthex" )
2008-09-30 13:51:36 +00:00
eType = FORMATTYPE_SHORTHEX;
else if ( rStr == "bin" )
2008-01-17 07:06:10 +00:00
eType = FORMATTYPE_BIN;
else if ( rStr == "fix" )
2008-01-17 07:06:10 +00:00
eType = FORMATTYPE_FIX;
else if ( rStr == "bool" )
2008-01-17 07:06:10 +00:00
eType = FORMATTYPE_BOOL;
return eType;
}
bool StringHelper::convertFromDec( sal_Int64& ornData, const OUString& rData )
{
sal_Int32 nPos = 0;
sal_Int32 nLen = rData.getLength();
bool bNeg = false;
if( (nLen > 0) && (rData[ 0 ] == '-') )
{
bNeg = true;
++nPos;
}
ornData = 0;
for( ; nPos < nLen; ++nPos )
{
sal_Unicode cChar = rData[ nPos ];
if( (cChar < '0') || (cChar > '9') )
return false;
(ornData *= 10) += (cChar - '0');
}
if( bNeg )
ornData *= -1;
return true;
}
bool StringHelper::convertFromHex( sal_Int64& ornData, const OUString& rData )
{
ornData = 0;
for( sal_Int32 nPos = 0, nLen = rData.getLength(); nPos < nLen; ++nPos )
{
sal_Unicode cChar = rData[ nPos ];
if( ('0' <= cChar) && (cChar <= '9') )
cChar -= '0';
else if( ('A' <= cChar) && (cChar <= 'F') )
cChar -= ('A' - 10);
else if( ('a' <= cChar) && (cChar <= 'f') )
cChar -= ('a' - 10);
else
return false;
(ornData <<= 4) += cChar;
}
return true;
}
bool StringHelper::convertStringToInt( sal_Int64& ornData, const OUString& rData )
{
if( (rData.getLength() > 2) && (rData[ 0 ] == '0') && ((rData[ 1 ] == 'X') || (rData[ 1 ] == 'x')) )
return convertFromHex( ornData, rData.copy( 2 ) );
return convertFromDec( ornData, rData );
}
bool StringHelper::convertStringToDouble( double& orfData, const OUString& rData )
{
rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok;
sal_Int32 nSize = 0;
orfData = rtl::math::stringToDouble( rData, '.', '\0', &eStatus, &nSize );
return (eStatus == rtl_math_ConversionStatus_Ok) && (nSize == rData.getLength());
}
bool StringHelper::convertStringToBool( const OUString& rData )
{
if ( rData == "true" )
2008-01-17 07:06:10 +00:00
return true;
if ( rData == "false" )
2008-01-17 07:06:10 +00:00
return false;
sal_Int64 nData;
return convertStringToInt( nData, rData ) && (nData != 0);
}
OUStringPair StringHelper::convertStringToPair( const OUString& rString, sal_Unicode cSep )
{
OUStringPair aPair;
if( !rString.isEmpty() )
{
sal_Int32 nEqPos = rString.indexOf( cSep );
if( nEqPos < 0 )
{
aPair.first = rString;
}
else
{
aPair.first = StringHelper::trimSpaces( rString.copy( 0, nEqPos ) );
aPair.second = StringHelper::trimSpaces( rString.copy( nEqPos + 1 ) );
}
}
return aPair;
}
2008-01-17 07:06:10 +00:00
void StringHelper::convertStringToStringList( OUStringVector& orVec, const OUString& rData, bool bIgnoreEmpty )
{
orVec.clear();
OUString aUnquotedData = lclTrimQuotedStringList( rData );
sal_Int32 nPos = 0;
sal_Int32 nLen = aUnquotedData.getLength();
while( (0 <= nPos) && (nPos < nLen) )
{
OUString aToken = getToken( aUnquotedData, nPos, OOX_DUMP_LF );
if( !bIgnoreEmpty || !aToken.isEmpty() )
2008-01-17 07:06:10 +00:00
orVec.push_back( aToken );
}
}
void StringHelper::convertStringToIntList( Int64Vector& orVec, const OUString& rData, bool bIgnoreEmpty )
{
orVec.clear();
OUString aUnquotedData = lclTrimQuotedStringList( rData );
sal_Int32 nPos = 0;
sal_Int32 nLen = aUnquotedData.getLength();
sal_Int64 nData;
while( (0 <= nPos) && (nPos < nLen) )
{
bool bOk = convertStringToInt( nData, getToken( aUnquotedData, nPos, OOX_DUMP_LF ) );
if( !bIgnoreEmpty || bOk )
orVec.push_back( bOk ? nData : 0 );
}
}
Base::~Base()
{
}
ConfigItemBase::~ConfigItemBase()
{
}
void ConfigItemBase::readConfigBlock( TextInputStream& rStrm )
2008-01-17 07:06:10 +00:00
{
readConfigBlockContents( rStrm );
2008-01-17 07:06:10 +00:00
}
void ConfigItemBase::implProcessConfigItemStr(
TextInputStream& /*rStrm*/, const OUString& /*rKey*/, const OUString& /*rData*/ )
2008-01-17 07:06:10 +00:00
{
}
void ConfigItemBase::implProcessConfigItemInt(
TextInputStream& /*rStrm*/, sal_Int64 /*nKey*/, const OUString& /*rData*/ )
2008-01-17 07:06:10 +00:00
{
}
void ConfigItemBase::readConfigBlockContents( TextInputStream& rStrm )
2008-01-17 07:06:10 +00:00
{
bool bLoop = true;
while( bLoop && !rStrm.isEof() )
2008-01-17 07:06:10 +00:00
{
OUString aKey, aData;
switch( readConfigLine( rStrm, aKey, aData ) )
2008-01-17 07:06:10 +00:00
{
case LINETYPE_DATA:
processConfigItem( rStrm, aKey, aData );
2008-01-17 07:06:10 +00:00
break;
case LINETYPE_END:
bLoop = false;
break;
}
}
}
ConfigItemBase::LineType ConfigItemBase::readConfigLine(
TextInputStream& rStrm, OUString& orKey, OUString& orData )
2008-01-17 07:06:10 +00:00
{
OUString aLine;
while( !rStrm.isEof() && aLine.isEmpty() )
2008-01-17 07:06:10 +00:00
{
aLine = rStrm.readLine();
if( !aLine.isEmpty() && (aLine[ 0 ] == OOX_DUMP_BOM) )
2008-01-17 07:06:10 +00:00
aLine = aLine.copy( 1 );
aLine = StringHelper::trimSpaces( aLine );
if( !aLine.isEmpty() )
2008-01-17 07:06:10 +00:00
{
// ignore comments (starting with hash or semicolon)
sal_Unicode cChar = aLine[ 0 ];
if( (cChar == '#') || (cChar == ';') )
aLine.clear();
2008-01-17 07:06:10 +00:00
}
}
OUStringPair aPair = StringHelper::convertStringToPair( aLine );
orKey = aPair.first;
orData = aPair.second;
return ( !orKey.isEmpty() && (!orData.isEmpty() || orKey != "end" )) ?
LINETYPE_DATA : LINETYPE_END;
2008-01-17 07:06:10 +00:00
}
void ConfigItemBase::processConfigItem(
TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
2008-01-17 07:06:10 +00:00
{
sal_Int64 nKey;
if( StringHelper::convertStringToInt( nKey, rKey ) )
implProcessConfigItemInt( rStrm, nKey, rData );
2008-01-17 07:06:10 +00:00
else
implProcessConfigItemStr( rStrm, rKey, rData );
2008-01-17 07:06:10 +00:00
}
NameListBase::~NameListBase()
{
}
2008-09-30 13:51:36 +00:00
void NameListBase::setName( sal_Int64 nKey, const String& rName )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
implSetName( nKey, rName );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void NameListBase::includeList( const NameListRef& rxList )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
if( rxList.get() )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
for( const_iterator aIt = rxList->begin(), aEnd = rxList->end(); aIt != aEnd; ++aIt )
2008-01-17 07:06:10 +00:00
maMap[ aIt->first ] = aIt->second;
2008-09-30 13:51:36 +00:00
implIncludeList( *rxList );
2008-01-17 07:06:10 +00:00
}
}
bool NameListBase::implIsValid() const
{
return true;
}
void NameListBase::implProcessConfigItemStr(
TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
2008-01-17 07:06:10 +00:00
{
if ( rKey == "include" )
2008-01-17 07:06:10 +00:00
include( rData );
else if ( rKey == "exclude" )
2008-01-17 07:06:10 +00:00
exclude( rData );
else
ConfigItemBase::implProcessConfigItemStr( rStrm, rKey, rData );
2008-01-17 07:06:10 +00:00
}
void NameListBase::implProcessConfigItemInt(
TextInputStream& /*rStrm*/, sal_Int64 nKey, const OUString& rData )
2008-01-17 07:06:10 +00:00
{
implSetName( nKey, rData );
}
void NameListBase::insertRawName( sal_Int64 nKey, const OUString& rName )
{
maMap[ nKey ] = rName;
}
const OUString* NameListBase::findRawName( sal_Int64 nKey ) const
{
const_iterator aIt = maMap.find( nKey );
return (aIt == end()) ? 0 : &aIt->second;
}
void NameListBase::include( const OUString& rListKeys )
{
OUStringVector aVec;
StringHelper::convertStringToStringList( aVec, rListKeys, true );
for( OUStringVector::const_iterator aIt = aVec.begin(), aEnd = aVec.end(); aIt != aEnd; ++aIt )
includeList( mrCfgData.getNameList( *aIt ) );
}
void NameListBase::exclude( const OUString& rKeys )
{
Int64Vector aVec;
StringHelper::convertStringToIntList( aVec, rKeys, true );
for( Int64Vector::const_iterator aIt = aVec.begin(), aEnd = aVec.end(); aIt != aEnd; ++aIt )
maMap.erase( *aIt );
}
void ItemFormatMap::insertFormats( const NameListRef& rxNameList )
{
if( Base::isValid( rxNameList ) )
for( NameListBase::const_iterator aIt = rxNameList->begin(), aEnd = rxNameList->end(); aIt != aEnd; ++aIt )
maMap[ aIt->first ].parse( aIt->second );
}
2008-01-17 07:06:10 +00:00
ConstList::ConstList( const SharedConfigData& rCfgData ) :
NameListBase( rCfgData ),
maDefName( OOX_DUMP_ERR_NONAME ),
mbQuoteNames( false )
{
}
void ConstList::implProcessConfigItemStr(
TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
2008-01-17 07:06:10 +00:00
{
if ( rKey == "default" )
2008-01-17 07:06:10 +00:00
setDefaultName( rData );
else if ( rKey == "quote-names" )
2008-01-17 07:06:10 +00:00
setQuoteNames( StringHelper::convertStringToBool( rData ) );
else
NameListBase::implProcessConfigItemStr( rStrm, rKey, rData );
2008-01-17 07:06:10 +00:00
}
void ConstList::implSetName( sal_Int64 nKey, const OUString& rName )
{
insertRawName( nKey, rName );
}
OUString ConstList::implGetName( const Config& /*rCfg*/, sal_Int64 nKey ) const
{
const OUString* pName = findRawName( nKey );
OUString aName = pName ? *pName : maDefName;
if( mbQuoteNames )
{
OUStringBuffer aBuffer( aName );
StringHelper::enclose( aBuffer, OOX_DUMP_STRQUOTE );
aName = aBuffer.makeStringAndClear();
}
return aName;
}
OUString ConstList::implGetNameDbl( const Config& /*rCfg*/, double /*fValue*/ ) const
{
return OUString();
}
void ConstList::implIncludeList( const NameListBase& rList )
{
if( const ConstList* pConstList = dynamic_cast< const ConstList* >( &rList ) )
{
maDefName = pConstList->maDefName;
mbQuoteNames = pConstList->mbQuoteNames;
}
}
MultiList::MultiList( const SharedConfigData& rCfgData ) :
ConstList( rCfgData ),
mbIgnoreEmpty( true )
{
}
void MultiList::setNamesFromVec( sal_Int64 nStartKey, const OUStringVector& rNames )
{
sal_Int64 nKey = nStartKey;
for( OUStringVector::const_iterator aIt = rNames.begin(), aEnd = rNames.end(); aIt != aEnd; ++aIt, ++nKey )
if( !mbIgnoreEmpty || !aIt->isEmpty() )
2008-01-17 07:06:10 +00:00
insertRawName( nKey, *aIt );
}
void MultiList::implProcessConfigItemStr(
TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
2008-01-17 07:06:10 +00:00
{
if ( rKey == "ignore-empty" )
2008-01-17 07:06:10 +00:00
mbIgnoreEmpty = StringHelper::convertStringToBool( rData );
else
ConstList::implProcessConfigItemStr( rStrm, rKey, rData );
2008-01-17 07:06:10 +00:00
}
void MultiList::implSetName( sal_Int64 nKey, const OUString& rName )
{
OUStringVector aNames;
StringHelper::convertStringToStringList( aNames, rName, false );
setNamesFromVec( nKey, aNames );
}
FlagsList::FlagsList( const SharedConfigData& rCfgData ) :
NameListBase( rCfgData ),
mnIgnore( 0 )
{
}
void FlagsList::implProcessConfigItemStr(
TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
2008-01-17 07:06:10 +00:00
{
if ( rKey == "ignore" )
2008-01-17 07:06:10 +00:00
{
sal_Int64 nIgnore;
if( StringHelper::convertStringToInt( nIgnore, rData ) )
setIgnoreFlags( nIgnore );
}
else
{
NameListBase::implProcessConfigItemStr( rStrm, rKey, rData );
2008-01-17 07:06:10 +00:00
}
}
void FlagsList::implSetName( sal_Int64 nKey, const OUString& rName )
{
if( (nKey != 0) && ((nKey & (nKey - 1)) == 0) ) // only a single bit set?
insertRawName( nKey, rName );
2008-01-17 07:06:10 +00:00
}
OUString FlagsList::implGetName( const Config& /*rCfg*/, sal_Int64 nKey ) const
{
sal_Int64 nFound = mnIgnore;
2008-01-17 07:06:10 +00:00
OUStringBuffer aName;
// add known flags
for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
{
sal_Int64 nMask = aIt->first;
setFlag( nFound, nMask );
if( !getFlag( mnIgnore, nMask ) )
2008-09-30 13:51:36 +00:00
{
const OUString& rFlagName = aIt->second;
bool bOnOff = rFlagName.startsWith(":");
bool bFlag = getFlag( nKey, nMask );
if( bOnOff )
{
2008-09-30 13:51:36 +00:00
StringHelper::appendToken( aName, rFlagName.copy( 1 ) );
aName.appendAscii( bFlag ? ":on" : ":off" );
}
else
{
bool bNegated = rFlagName.startsWith("!");
sal_Int32 nBothSep = bNegated ? rFlagName.indexOf( '!', 1 ) : -1;
if( bFlag )
{
if( !bNegated )
StringHelper::appendToken( aName, rFlagName );
else if( nBothSep > 0 )
StringHelper::appendToken( aName, rFlagName.copy( nBothSep + 1 ) );
}
else if( bNegated )
{
if( nBothSep > 0 )
StringHelper::appendToken( aName, rFlagName.copy( 1, nBothSep - 1 ) );
else
StringHelper::appendToken( aName, rFlagName.copy( 1 ) );
}
}
2008-09-30 13:51:36 +00:00
}
2008-01-17 07:06:10 +00:00
}
// add unknown flags
setFlag( nKey, nFound, false );
if( nKey != 0 )
2008-01-17 07:06:10 +00:00
{
OUStringBuffer aUnknown( OOX_DUMP_UNKNOWN );
2008-01-17 07:06:10 +00:00
aUnknown.append( OOX_DUMP_ITEMSEP );
StringHelper::appendShortHex( aUnknown, nKey );
2008-01-17 07:06:10 +00:00
StringHelper::enclose( aUnknown, '(', ')' );
StringHelper::appendToken( aName, aUnknown.makeStringAndClear() );
}
return aName.makeStringAndClear();
}
OUString FlagsList::implGetNameDbl( const Config& /*rCfg*/, double /*fValue*/ ) const
{
return OUString();
}
void FlagsList::implIncludeList( const NameListBase& rList )
{
if( const FlagsList* pFlagsList = dynamic_cast< const FlagsList* >( &rList ) )
mnIgnore = pFlagsList->mnIgnore;
}
bool CombiList::ExtItemFormatKey::operator<( const ExtItemFormatKey& rRight ) const
{
return (mnKey < rRight.mnKey) || ((mnKey == rRight.mnKey) && (maFilter < rRight.maFilter));
}
2008-01-17 07:06:10 +00:00
CombiList::CombiList( const SharedConfigData& rCfgData ) :
FlagsList( rCfgData )
{
}
void CombiList::implSetName( sal_Int64 nKey, const OUString& rName )
{
if( (nKey & (nKey - 1)) != 0 ) // more than a single bit set?
{
typedef ::std::set< ExtItemFormatKey > ExtItemFormatKeySet;
::std::set< ExtItemFormatKey > aItemKeys;
ExtItemFormat aItemFmt;
OUStringVector aRemain = aItemFmt.parse( rName );
for( OUStringVector::iterator aIt = aRemain.begin(), aEnd = aRemain.end(); aIt != aEnd; ++aIt )
{
OUStringPair aPair = StringHelper::convertStringToPair( *aIt );
if ( aPair.first == "noshift" )
{
aItemFmt.mbShiftValue = StringHelper::convertStringToBool( aPair.second );
}
else if ( aPair.first == "filter" )
{
OUStringPair aFilter = StringHelper::convertStringToPair( aPair.second, '~' );
ExtItemFormatKey aKey( nKey );
if( !aFilter.first.isEmpty() && StringHelper::convertStringToInt( aKey.maFilter.first, aFilter.first ) &&
!aFilter.second.isEmpty() && StringHelper::convertStringToInt( aKey.maFilter.second, aFilter.second ) )
{
if( aKey.maFilter.first == 0 )
aKey.maFilter.second = 0;
aItemKeys.insert( aKey );
}
}
}
if( aItemKeys.empty() )
aItemKeys.insert( ExtItemFormatKey( nKey ) );
for( ExtItemFormatKeySet::iterator aIt = aItemKeys.begin(), aEnd = aItemKeys.end(); aIt != aEnd; ++aIt )
maFmtMap[ *aIt ] = aItemFmt;
2008-01-17 07:06:10 +00:00
}
else
{
FlagsList::implSetName( nKey, rName );
}
}
OUString CombiList::implGetName( const Config& rCfg, sal_Int64 nKey ) const
{
sal_Int64 nFound = 0;
OUStringBuffer aName;
// add known flag fields
for( ExtItemFormatMap::const_iterator aIt = maFmtMap.begin(), aEnd = maFmtMap.end(); aIt != aEnd; ++aIt )
{
const ExtItemFormatKey& rMapKey = aIt->first;
sal_Int64 nMask = rMapKey.mnKey;
if( (nMask != 0) && ((nKey & rMapKey.maFilter.first) == rMapKey.maFilter.second) )
2008-01-17 07:06:10 +00:00
{
const ExtItemFormat& rItemFmt = aIt->second;
sal_uInt64 nUFlags = static_cast< sal_uInt64 >( nKey );
2008-01-17 07:06:10 +00:00
sal_uInt64 nUMask = static_cast< sal_uInt64 >( nMask );
if( rItemFmt.mbShiftValue )
while( (nUMask & 1) == 0 ) { nUFlags >>= 1; nUMask >>= 1; }
sal_uInt64 nUValue = nUFlags & nUMask;
sal_Int64 nSValue = static_cast< sal_Int64 >( nUValue );
if( getFlag< sal_uInt64 >( nUValue, (nUMask + 1) >> 1 ) )
setFlag( nSValue, static_cast< sal_Int64 >( ~nUMask ) );
OUStringBuffer aItem( rItemFmt.maItemName );
OUStringBuffer aValue;
switch( rItemFmt.meDataType )
{
case DATATYPE_INT8: StringHelper::appendValue( aValue, static_cast< sal_Int8 >( nSValue ), rItemFmt.meFmtType ); break;
case DATATYPE_UINT8: StringHelper::appendValue( aValue, static_cast< sal_uInt8 >( nUValue ), rItemFmt.meFmtType ); break;
case DATATYPE_INT16: StringHelper::appendValue( aValue, static_cast< sal_Int16 >( nSValue ), rItemFmt.meFmtType ); break;
case DATATYPE_UINT16: StringHelper::appendValue( aValue, static_cast< sal_uInt16 >( nUValue ), rItemFmt.meFmtType ); break;
case DATATYPE_INT32: StringHelper::appendValue( aValue, static_cast< sal_Int32 >( nSValue ), rItemFmt.meFmtType ); break;
case DATATYPE_UINT32: StringHelper::appendValue( aValue, static_cast< sal_uInt32 >( nUValue ), rItemFmt.meFmtType ); break;
case DATATYPE_INT64: StringHelper::appendValue( aValue, nSValue, rItemFmt.meFmtType ); break;
case DATATYPE_UINT64: StringHelper::appendValue( aValue, nUValue, rItemFmt.meFmtType ); break;
case DATATYPE_FLOAT: StringHelper::appendValue( aValue, static_cast< float >( nSValue ), rItemFmt.meFmtType ); break;
case DATATYPE_DOUBLE: StringHelper::appendValue( aValue, static_cast< double >( nSValue ), rItemFmt.meFmtType ); break;
default:;
}
StringHelper::appendToken( aItem, aValue.makeStringAndClear(), OOX_DUMP_ITEMSEP );
if( !rItemFmt.maListName.isEmpty() )
2008-01-17 07:06:10 +00:00
{
OUString aValueName = rCfg.getName( rItemFmt.maListName, static_cast< sal_Int64 >( nUValue ) );
StringHelper::appendToken( aItem, aValueName, OOX_DUMP_ITEMSEP );
}
StringHelper::enclose( aItem, '(', ')' );
StringHelper::appendToken( aName, aItem.makeStringAndClear() );
setFlag( nFound, nMask );
}
}
setFlag( nKey, nFound, false );
StringHelper::appendToken( aName, FlagsList::implGetName( rCfg, nKey ) );
2008-01-17 07:06:10 +00:00
return aName.makeStringAndClear();
}
void CombiList::implIncludeList( const NameListBase& rList )
{
if( const CombiList* pCombiList = dynamic_cast< const CombiList* >( &rList ) )
maFmtMap = pCombiList->maFmtMap;
FlagsList::implIncludeList( rList );
}
UnitConverter::UnitConverter( const SharedConfigData& rCfgData ) :
NameListBase( rCfgData ),
mfFactor( 1.0 )
{
}
void UnitConverter::implSetName( sal_Int64 /*nKey*/, const OUString& /*rName*/ )
{
// nothing to do
}
OUString UnitConverter::implGetName( const Config& rCfg, sal_Int64 nKey ) const
{
return implGetNameDbl( rCfg, static_cast< double >( nKey ) );
}
OUString UnitConverter::implGetNameDbl( const Config& /*rCfg*/, double fValue ) const
{
OUStringBuffer aValue;
StringHelper::appendDec( aValue, mfFactor * fValue );
aValue.append( maUnitName );
return aValue.makeStringAndClear();
}
void UnitConverter::implIncludeList( const NameListBase& /*rList*/ )
{
}
NameListRef NameListWrapper::getNameList( const Config& rCfg ) const
{
2008-09-30 13:51:36 +00:00
return mxList.get() ? mxList : (mxList = rCfg.getNameList( maName ));
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
SharedConfigData::SharedConfigData( const OUString& rFileName,
const Reference< XComponentContext >& rxContext, const StorageRef& rxRootStrg,
const OUString& rSysFileName ) :
mxContext( rxContext ),
2008-09-30 13:51:36 +00:00
mxRootStrg( rxRootStrg ),
maSysFileName( rSysFileName ),
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'
2009-09-07 14:41:16 +00:00
mbLoaded( false ),
mbPwCancelled( false )
2008-01-17 07:06:10 +00:00
{
OUString aFileUrl = InputOutputHelper::convertFileNameToUrl( rFileName );
if( !aFileUrl.isEmpty() )
2008-01-17 07:06:10 +00:00
{
sal_Int32 nNamePos = InputOutputHelper::getFileNamePos( aFileUrl );
maConfigPath = aFileUrl.copy( 0, nNamePos );
mbLoaded = readConfigFile( aFileUrl );
}
}
2008-09-30 13:51:36 +00:00
SharedConfigData::~SharedConfigData()
{
}
2008-01-17 07:06:10 +00:00
void SharedConfigData::setOption( const OUString& rKey, const OUString& rData )
{
maConfigData[ rKey ] = rData;
}
const OUString* SharedConfigData::getOption( const OUString& rKey ) const
{
ConfigDataMap::const_iterator aIt = maConfigData.find( rKey );
return (aIt == maConfigData.end()) ? 0 : &aIt->second;
}
2008-09-30 13:51:36 +00:00
void SharedConfigData::setNameList( const OUString& rListName, const NameListRef& rxList )
2008-01-17 07:06:10 +00:00
{
if( !rListName.isEmpty() )
2008-09-30 13:51:36 +00:00
maNameLists[ rListName ] = rxList;
2008-01-17 07:06:10 +00:00
}
void SharedConfigData::eraseNameList( const OUString& rListName )
{
maNameLists.erase( rListName );
}
NameListRef SharedConfigData::getNameList( const OUString& rListName ) const
{
NameListRef xList;
NameListMap::const_iterator aIt = maNameLists.find( rListName );
if( aIt != maNameLists.end() )
xList = aIt->second;
return xList;
}
bool SharedConfigData::implIsValid() const
{
return mbLoaded && mxContext.is() && mxRootStrg.get() && !maSysFileName.isEmpty();
2008-01-17 07:06:10 +00:00
}
void SharedConfigData::implProcessConfigItemStr(
TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
2008-01-17 07:06:10 +00:00
{
if ( rKey == "include-config-file" )
2008-01-17 07:06:10 +00:00
readConfigFile( maConfigPath + rData );
else if ( rKey == "constlist" )
readNameList< ConstList >( rStrm, rData );
else if ( rKey == "multilist" )
readNameList< MultiList >( rStrm, rData );
else if ( rKey == "flagslist" )
readNameList< FlagsList >( rStrm, rData );
else if ( rKey == "combilist" )
readNameList< CombiList >( rStrm, rData );
else if ( rKey == "shortlist" )
2008-01-17 07:06:10 +00:00
createShortList( rData );
else if ( rKey == "unitconverter" )
2008-01-17 07:06:10 +00:00
createUnitConverter( rData );
else
setOption( rKey, rData );
}
bool SharedConfigData::readConfigFile( const OUString& rFileUrl )
{
bool bLoaded = maConfigFiles.count( rFileUrl ) > 0;
if( !bLoaded )
2008-01-17 07:06:10 +00:00
{
Reference< XInputStream > xInStrm = InputOutputHelper::openInputStream( mxContext, rFileUrl );
TextInputStream aTxtStrm( mxContext, xInStrm, RTL_TEXTENCODING_UTF8 );
if( !aTxtStrm.isEof() )
{
maConfigFiles.insert( rFileUrl );
readConfigBlockContents( aTxtStrm );
bLoaded = true;
}
2008-01-17 07:06:10 +00:00
}
return bLoaded;
}
void SharedConfigData::createShortList( const OUString& rData )
{
OUStringVector aDataVec;
StringHelper::convertStringToStringList( aDataVec, rData, false );
if( aDataVec.size() >= 3 )
{
sal_Int64 nStartKey;
if( StringHelper::convertStringToInt( nStartKey, aDataVec[ 1 ] ) )
{
std::shared_ptr< MultiList > xList = createNameList< MultiList >( aDataVec[ 0 ] );
2008-01-17 07:06:10 +00:00
if( xList.get() )
{
aDataVec.erase( aDataVec.begin(), aDataVec.begin() + 2 );
xList->setNamesFromVec( nStartKey, aDataVec );
}
}
}
}
void SharedConfigData::createUnitConverter( const OUString& rData )
{
OUStringVector aDataVec;
StringHelper::convertStringToStringList( aDataVec, rData, false );
if( aDataVec.size() >= 2 )
{
OUString aFactor = aDataVec[ 1 ];
bool bRecip = aFactor.startsWith("/");
2008-01-17 07:06:10 +00:00
if( bRecip )
aFactor = aFactor.copy( 1 );
double fFactor;
if( StringHelper::convertStringToDouble( fFactor, aFactor ) && (fFactor != 0.0) )
{
std::shared_ptr< UnitConverter > xList = createNameList< UnitConverter >( aDataVec[ 0 ] );
2008-01-17 07:06:10 +00:00
if( xList.get() )
{
xList->setFactor( bRecip ? (1.0 / fFactor) : fFactor );
if( aDataVec.size() >= 3 )
xList->setUnitName( aDataVec[ 2 ] );
}
}
}
}
Config::Config( const Config& rParent ) :
Base() // c'tor needs to be called explicitly to avoid compiler warning
{
construct( rParent );
}
2008-09-30 13:51:36 +00:00
Config::Config( const sal_Char* pcEnvVar, const FilterBase& rFilter )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
construct( pcEnvVar, rFilter );
2008-01-17 07:06:10 +00:00
}
Config::Config( const sal_Char* pcEnvVar, const Reference< XComponentContext >& rxContext, const StorageRef& rxRootStrg, const OUString& rSysFileName )
2008-01-17 07:06:10 +00:00
{
construct( pcEnvVar, rxContext, rxRootStrg, rSysFileName );
2008-01-17 07:06:10 +00:00
}
Config::~Config()
{
}
void Config::construct( const Config& rParent )
{
*this = rParent;
}
2008-09-30 13:51:36 +00:00
void Config::construct( const sal_Char* pcEnvVar, const FilterBase& rFilter )
2008-01-17 07:06:10 +00:00
{
if( !rFilter.getFileUrl().isEmpty() )
construct( pcEnvVar, rFilter.getComponentContext(), rFilter.getStorage(), rFilter.getFileUrl() );
2008-01-17 07:06:10 +00:00
}
void Config::construct( const sal_Char* pcEnvVar, const Reference< XComponentContext >& rxContext, const StorageRef& rxRootStrg, const OUString& rSysFileName )
2008-01-17 07:06:10 +00:00
{
if( pcEnvVar && rxRootStrg.get() && !rSysFileName.isEmpty() )
2008-01-17 07:06:10 +00:00
if( const sal_Char* pcFileName = ::getenv( pcEnvVar ) )
mxCfgData.reset( new SharedConfigData( OUString::createFromAscii( pcFileName ), rxContext, rxRootStrg, rSysFileName ) );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
const OUString& Config::getStringOption( const String& rKey, const OUString& rDefault ) const
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
const OUString* pData = implGetOption( rKey );
2008-01-17 07:06:10 +00:00
return pData ? *pData : rDefault;
}
2008-09-30 13:51:36 +00:00
bool Config::getBoolOption( const String& rKey, bool bDefault ) const
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
const OUString* pData = implGetOption( rKey );
2008-01-17 07:06:10 +00:00
return pData ? StringHelper::convertStringToBool( *pData ) : bDefault;
}
bool Config::isDumperEnabled() const
{
return getBoolOption( "enable-dumper", false );
}
bool Config::isImportEnabled() const
{
return getBoolOption( "enable-import", true );
}
2008-09-30 13:51:36 +00:00
void Config::eraseNameList( const String& rListName )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
mxCfgData->eraseNameList( rListName );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
NameListRef Config::getNameList( const String& rListName ) const
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
return implGetNameList( rListName );
2008-01-17 07:06:10 +00:00
}
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'
2009-09-07 14:41:16 +00:00
bool Config::isPasswordCancelled() const
{
return mxCfgData->isPasswordCancelled();
}
2008-01-17 07:06:10 +00:00
bool Config::implIsValid() const
{
return isValid( mxCfgData );
}
const OUString* Config::implGetOption( const OUString& rKey ) const
{
return mxCfgData->getOption( rKey );
}
NameListRef Config::implGetNameList( const OUString& rListName ) const
{
return mxCfgData->getNameList( rListName );
}
Output::Output( const Reference< XComponentContext >& rxContext, const OUString& rFileName ) :
mxStrm( InputOutputHelper::openTextOutputStream( rxContext, rFileName, RTL_TEXTENCODING_UTF8 ) ),
mnCol( 0 ),
mnItemLevel( 0 ),
mnMultiLevel( 0 ),
mnItemIdx( 0 ),
mnLastItem( 0 )
2008-01-17 07:06:10 +00:00
{
if( mxStrm.is() )
mxStrm->writeString( OUString( OOX_DUMP_BOM ) );
2008-01-17 07:06:10 +00:00
}
void Output::newLine()
{
if( maLine.getLength() > 0 )
{
mxStrm->writeString( maIndent );
maLine.append( '\n' );
2008-01-17 07:06:10 +00:00
mxStrm->writeString( maLine.makeStringAndClear() );
mnCol = 0;
mnLastItem = 0;
}
}
void Output::emptyLine( size_t nCount )
{
for( size_t nIdx = 0; nIdx < nCount; ++nIdx )
mxStrm->writeString( OUString( '\n' ) );
2008-01-17 07:06:10 +00:00
}
void Output::incIndent()
{
OUStringBuffer aBuffer( maIndent );
StringHelper::appendChar( aBuffer, ' ', OOX_DUMP_INDENT );
maIndent = aBuffer.makeStringAndClear();
}
void Output::decIndent()
{
if( maIndent.getLength() >= OOX_DUMP_INDENT )
maIndent = maIndent.copy( OOX_DUMP_INDENT );
}
void Output::startTable( sal_Int32 nW1 )
{
startTable( 1, &nW1 );
}
void Output::startTable( sal_Int32 nW1, sal_Int32 nW2 )
{
sal_Int32 pnColWidths[ 2 ];
pnColWidths[ 0 ] = nW1;
pnColWidths[ 1 ] = nW2;
startTable( 2, pnColWidths );
}
void Output::startTable( sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 )
{
sal_Int32 pnColWidths[ 4 ];
pnColWidths[ 0 ] = nW1;
pnColWidths[ 1 ] = nW2;
pnColWidths[ 2 ] = nW3;
pnColWidths[ 3 ] = nW4;
startTable( 4, pnColWidths );
}
void Output::startTable( size_t nColCount, const sal_Int32* pnColWidths )
{
maColPos.clear();
maColPos.push_back( 0 );
sal_Int32 nColPos = 0;
for( size_t nCol = 0; nCol < nColCount; ++nCol )
{
nColPos = nColPos + pnColWidths[ nCol ];
maColPos.push_back( nColPos );
}
}
void Output::tab()
{
tab( mnCol + 1 );
}
void Output::tab( size_t nCol )
{
mnCol = nCol;
if( mnCol < maColPos.size() )
{
sal_Int32 nColPos = maColPos[ mnCol ];
if( maLine.getLength() >= nColPos )
maLine.setLength( ::std::max< sal_Int32 >( nColPos - 1, 0 ) );
StringHelper::appendChar( maLine, ' ', nColPos - maLine.getLength() );
}
else
{
StringHelper::appendChar( maLine, ' ', 2 );
}
}
void Output::endTable()
{
maColPos.clear();
}
void Output::resetItemIndex( sal_Int64 nIdx )
{
mnItemIdx = nIdx;
}
2008-09-30 13:51:36 +00:00
void Output::startItem( const String& rItemName )
2008-01-17 07:06:10 +00:00
{
if( mnItemLevel == 0 )
{
if( (mnMultiLevel > 0) && (maLine.getLength() > 0) )
tab();
2008-09-30 13:51:36 +00:00
if( rItemName.has() )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
writeItemName( rItemName );
2008-01-17 07:06:10 +00:00
writeChar( OOX_DUMP_ITEMSEP );
}
}
++mnItemLevel;
mnLastItem = maLine.getLength();
}
void Output::contItem()
{
if( mnItemLevel > 0 )
{
if( (maLine.getLength() == 0) || (maLine[ maLine.getLength() - 1 ] != OOX_DUMP_ITEMSEP) )
writeChar( OOX_DUMP_ITEMSEP );
mnLastItem = maLine.getLength();
}
}
void Output::endItem()
{
if( mnItemLevel > 0 )
{
maLastItem = OUString( maLine.getStr() + mnLastItem );
if( maLastItem.isEmpty() && mnLastItem > 0 && maLine[ mnLastItem - 1 ] == OOX_DUMP_ITEMSEP )
2008-01-17 07:06:10 +00:00
maLine.setLength( mnLastItem - 1 );
--mnItemLevel;
}
if( mnItemLevel == 0 )
{
if( mnMultiLevel == 0 )
newLine();
}
else
contItem();
}
void Output::startMultiItems()
{
++mnMultiLevel;
}
void Output::endMultiItems()
{
if( mnMultiLevel > 0 )
--mnMultiLevel;
if( mnMultiLevel == 0 )
newLine();
}
void Output::writeChar( sal_Unicode cChar, sal_Int32 nCount )
{
StringHelper::appendEncChar( maLine, cChar, nCount );
}
void Output::writeAscii( const sal_Char* pcStr )
{
if( pcStr )
maLine.appendAscii( pcStr );
}
void Output::writeString( const OUString& rStr )
{
StringHelper::appendEncString( maLine, rStr );
}
void Output::writeArray( const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep )
{
const sal_uInt8* pnEnd = pnData ? (pnData + nSize) : 0;
for( const sal_uInt8* pnByte = pnData; pnByte < pnEnd; ++pnByte )
{
if( pnByte > pnData )
writeChar( cSep );
writeHex( *pnByte, false );
}
}
void Output::writeBool( bool bData )
{
StringHelper::appendBool( maLine, bData );
}
2012-12-13 19:02:26 +01:00
void Output::writeDateTime( const util::DateTime& rDateTime )
2008-01-17 07:06:10 +00:00
{
writeDec( rDateTime.Year, 4, '0' );
writeChar( '-' );
writeDec( rDateTime.Month, 2, '0' );
writeChar( '-' );
writeDec( rDateTime.Day, 2, '0' );
writeChar( 'T' );
writeDec( rDateTime.Hours, 2, '0' );
writeChar( ':' );
writeDec( rDateTime.Minutes, 2, '0' );
writeChar( ':' );
writeDec( rDateTime.Seconds, 2, '0' );
}
bool Output::implIsValid() const
{
return mxStrm.is();
}
2008-09-30 13:51:36 +00:00
void Output::writeItemName( const String& rItemName )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
if( rItemName.has() && (rItemName[ 0 ] == '#') )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
writeString( rItemName.copy( 1 ) );
2008-01-17 07:06:10 +00:00
StringHelper::appendIndex( maLine, mnItemIdx++ );
}
else
2008-09-30 13:51:36 +00:00
writeString( rItemName );
}
StorageIterator::StorageIterator( const StorageRef& rxStrg ) :
mxStrg( rxStrg )
{
if( mxStrg.get() )
mxStrg->getElementNames( maNames );
maIt = maNames.begin();
}
StorageIterator::~StorageIterator()
{
}
StorageIterator& StorageIterator::operator++()
{
if( maIt != maNames.end() )
++maIt;
return *this;
}
OUString StorageIterator::getName() const
{
OUString aName;
if( maIt != maNames.end() )
aName = *maIt;
return aName;
}
bool StorageIterator::isStream() const
{
return isValid() && mxStrg->openInputStream( *maIt ).is();
}
bool StorageIterator::isStorage() const
{
if( !isValid() )
return false;
StorageRef xStrg = mxStrg->openSubStorage( *maIt, false );
return xStrg.get() && xStrg->isStorage();
}
bool StorageIterator::implIsValid() const
{
return mxStrg.get() && mxStrg->isStorage() && (maIt != maNames.end());
2008-01-17 07:06:10 +00:00
}
ObjectBase::~ObjectBase()
{
}
2008-09-30 13:51:36 +00:00
void ObjectBase::construct( const ConfigRef& rxConfig )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
mxConfig = rxConfig;
2008-01-17 07:06:10 +00:00
}
void ObjectBase::construct( const ObjectBase& rParent )
{
*this = rParent;
}
void ObjectBase::dump()
{
if( isValid() )
implDump();
}
bool ObjectBase::implIsValid() const
{
2008-09-30 13:51:36 +00:00
return isValid( mxConfig );
2008-01-17 07:06:10 +00:00
}
void ObjectBase::implDump()
{
}
2008-09-30 13:51:36 +00:00
void StorageObjectBase::construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath )
2008-01-17 07:06:10 +00:00
{
ObjectBase::construct( rParent );
2008-09-30 13:51:36 +00:00
mxStrg = rxStrg;
maSysPath = rSysPath;
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void StorageObjectBase::construct( const ObjectBase& rParent )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
ObjectBase::construct( rParent );
if( ObjectBase::implIsValid() )
{
mxStrg = cfg().getRootStorage();
maSysPath = cfg().getSysFileName();
}
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
bool StorageObjectBase::implIsValid() const
2008-01-17 07:06:10 +00:00
{
return mxStrg.get() && !maSysPath.isEmpty() && ObjectBase::implIsValid();
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void StorageObjectBase::implDump()
2008-01-17 07:06:10 +00:00
{
bool bIsStrg = mxStrg->isStorage();
bool bIsRoot = mxStrg->isRootStorage();
Reference< XInputStream > xBaseStrm;
if( !bIsStrg )
xBaseStrm = mxStrg->openInputStream( OUString() );
OUString aSysOutPath = maSysPath;
if( bIsRoot ) try
2008-01-17 07:06:10 +00:00
{
aSysOutPath += OOX_DUMP_DUMPEXT;
Reference<XSimpleFileAccess3> xFileAccess(SimpleFileAccess::create(getContext()));
xFileAccess->kill( aSysOutPath );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
catch( Exception& )
2008-01-17 07:06:10 +00:00
{
}
if( bIsStrg )
{
extractStorage( mxStrg, OUString(), aSysOutPath );
}
else if( xBaseStrm.is() )
{
BinaryInputStreamRef xInStrm( new BinaryXInputStream( xBaseStrm, false ) );
xInStrm->seekToStart();
implDumpBaseStream( xInStrm, aSysOutPath );
}
2008-01-17 07:06:10 +00:00
}
void StorageObjectBase::implDumpStream( const Reference< XInputStream >&, const OUString&, const OUString&, const OUString& )
2008-01-17 07:06:10 +00:00
{
}
2008-09-30 13:51:36 +00:00
void StorageObjectBase::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
extractStorage( rxStrg, rStrgPath, rSysPath );
2008-01-17 07:06:10 +00:00
}
void StorageObjectBase::implDumpBaseStream( const BinaryInputStreamRef&, const OUString& )
{
}
2008-09-30 13:51:36 +00:00
void StorageObjectBase::addPreferredStream( const String& rStrmName )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
if( rStrmName.has() )
maPreferred.push_back( PreferredItem( rStrmName, false ) );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void StorageObjectBase::addPreferredStorage( const String& rStrgPath )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
if( rStrgPath.has() )
maPreferred.push_back( PreferredItem( rStrgPath, true ) );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
OUString StorageObjectBase::getSysFileName( const OUString& rStrmName, const OUString& rSysOutPath )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
// encode all characters < 0x20
OUStringBuffer aBuffer;
StringHelper::appendEncString( aBuffer, rStrmName, false );
// replace all characters reserved in file system
OUString aFileName = aBuffer.makeStringAndClear();
static const sal_Unicode spcReserved[] = { '/', '\\', ':', '*', '?', '<', '>', '|' };
for( const sal_Unicode* pcChar = spcReserved; pcChar < STATIC_ARRAY_END( spcReserved ); ++pcChar )
aFileName = aFileName.replace( *pcChar, '_' );
// build full path
return rSysOutPath + "/" + aFileName;
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void StorageObjectBase::extractStream( StorageBase& rStrg, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
BinaryXInputStream aInStrm( rStrg.openInputStream( rStrmName ), true );
if( !aInStrm.isEof() )
{
BinaryXOutputStream aOutStrm( InputOutputHelper::openOutputStream( getContext(), rSysFileName ), true );
2008-09-30 13:51:36 +00:00
if( !aOutStrm.isEof() )
aInStrm.copyToStream( aOutStrm );
2008-09-30 13:51:36 +00:00
}
Reference< XInputStream > xDumpStrm = InputOutputHelper::openInputStream( getContext(), rSysFileName );
if( xDumpStrm.is() )
2008-09-30 13:51:36 +00:00
implDumpStream( xDumpStrm, rStrgPath, rStrmName, rSysFileName );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void StorageObjectBase::extractStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
// create directory in file system
::osl::FileBase::RC eRes = ::osl::Directory::create( rSysPath );
2008-09-30 13:51:36 +00:00
if( (eRes != ::osl::FileBase::E_None) && (eRes != ::osl::FileBase::E_EXIST) )
return;
// process preferred storages and streams in root storage first
if( rStrgPath.isEmpty() )
2008-09-30 13:51:36 +00:00
for( PreferredItemVector::iterator aIt = maPreferred.begin(), aEnd = maPreferred.end(); aIt != aEnd; ++aIt )
extractItem( rxStrg, rStrgPath, aIt->maName, rSysPath, aIt->mbStorage, !aIt->mbStorage );
2008-09-30 13:51:36 +00:00
// process children of the storage
for( StorageIterator aIt( rxStrg ); aIt.isValid(); ++aIt )
{
// skip processed preferred items
OUString aItemName = aIt.getName();
bool bFound = false;
if( rStrgPath.isEmpty() )
2008-09-30 13:51:36 +00:00
for( PreferredItemVector::iterator aIIt = maPreferred.begin(), aIEnd = maPreferred.end(); !bFound && (aIIt != aIEnd); ++aIIt )
bFound = aIIt->maName == aItemName;
if( !bFound )
extractItem( rxStrg, rStrgPath, aItemName, rSysPath, aIt.isStorage(), aIt.isStream() );
2008-09-30 13:51:36 +00:00
}
2008-01-17 07:06:10 +00:00
}
void StorageObjectBase::extractItem( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rItemName, const OUString& rSysPath, bool bIsStrg, bool bIsStrm )
2008-01-17 07:06:10 +00:00
{
OUString aSysFileName = getSysFileName( rItemName, rSysPath );
2008-09-30 13:51:36 +00:00
if( bIsStrg )
{
OUStringBuffer aStrgPath( rStrgPath );
StringHelper::appendToken( aStrgPath, rItemName, '/' );
implDumpStorage( rxStrg->openSubStorage( rItemName, false ), aStrgPath.makeStringAndClear(), aSysFileName );
}
else if( bIsStrm )
{
extractStream( *rxStrg, rStrgPath, rItemName, aSysFileName );
}
2008-01-17 07:06:10 +00:00
}
OutputObjectBase::~OutputObjectBase()
{
}
2008-09-30 13:51:36 +00:00
void OutputObjectBase::construct( const ObjectBase& rParent, const OUString& rSysFileName )
2008-01-17 07:06:10 +00:00
{
ObjectBase::construct( rParent );
2008-09-30 13:51:36 +00:00
if( ObjectBase::implIsValid() )
{
maSysFileName = rSysFileName;
mxOut.reset( new Output( getContext(), rSysFileName + OOX_DUMP_DUMPEXT ) );
}
2008-01-17 07:06:10 +00:00
}
void OutputObjectBase::construct( const OutputObjectBase& rParent )
{
*this = rParent;
}
bool OutputObjectBase::implIsValid() const
{
return isValid( mxOut ) && ObjectBase::implIsValid();
}
2008-09-30 13:51:36 +00:00
void OutputObjectBase::writeEmptyItem( const String& rName )
2008-01-17 07:06:10 +00:00
{
ItemGuard aItem( mxOut, rName );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void OutputObjectBase::writeInfoItem( const String& rName, const String& rData )
2008-01-17 07:06:10 +00:00
{
ItemGuard aItem( mxOut, rName );
2008-09-30 13:51:36 +00:00
mxOut->writeString( rData );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void OutputObjectBase::writeCharItem( const String& rName, sal_Unicode cData )
2008-01-17 07:06:10 +00:00
{
ItemGuard aItem( mxOut, rName );
2008-09-30 13:51:36 +00:00
mxOut->writeChar( OOX_DUMP_STRQUOTE );
mxOut->writeChar( cData );
mxOut->writeChar( OOX_DUMP_STRQUOTE );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void OutputObjectBase::writeStringItem( const String& rName, const OUString& rData )
2008-01-17 07:06:10 +00:00
{
ItemGuard aItem( mxOut, rName );
2008-01-17 07:06:10 +00:00
mxOut->writeAscii( "(len=" );
mxOut->writeDec( rData.getLength() );
mxOut->writeAscii( ")," );
OUStringBuffer aValue( rData.copy( 0, ::std::min( rData.getLength(), OOX_DUMP_MAXSTRLEN ) ) );
StringHelper::enclose( aValue, OOX_DUMP_STRQUOTE );
mxOut->writeString( aValue.makeStringAndClear() );
if( rData.getLength() > OOX_DUMP_MAXSTRLEN )
mxOut->writeAscii( ",cut" );
}
2008-09-30 13:51:36 +00:00
void OutputObjectBase::writeArrayItem( const String& rName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep )
2008-01-17 07:06:10 +00:00
{
ItemGuard aItem( mxOut, rName );
2008-01-17 07:06:10 +00:00
mxOut->writeArray( pnData, nSize, cSep );
}
2012-12-13 19:02:26 +01:00
void OutputObjectBase::writeDateTimeItem( const String& rName, const util::DateTime& rDateTime )
2008-01-17 07:06:10 +00:00
{
ItemGuard aItem( mxOut, rName );
2008-01-17 07:06:10 +00:00
mxOut->writeDateTime( rDateTime );
}
2008-09-30 13:51:36 +00:00
void OutputObjectBase::writeGuidItem( const String& rName, const OUString& rGuid )
2008-01-17 07:06:10 +00:00
{
ItemGuard aItem( mxOut, rName );
2008-01-17 07:06:10 +00:00
mxOut->writeString( rGuid );
aItem.cont();
mxOut->writeString( cfg().getStringOption( rGuid, OUString() ) );
}
InputObjectBase::~InputObjectBase()
{
}
2008-09-30 13:51:36 +00:00
void InputObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
OutputObjectBase::construct( rParent, rSysFileName );
mxStrm = rxStrm;
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void InputObjectBase::construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
2008-01-17 07:06:10 +00:00
{
OutputObjectBase::construct( rParent );
2008-09-30 13:51:36 +00:00
mxStrm = rxStrm;
2008-01-17 07:06:10 +00:00
}
void InputObjectBase::construct( const InputObjectBase& rParent )
{
*this = rParent;
}
bool InputObjectBase::implIsValid() const
{
2008-09-30 13:51:36 +00:00
return mxStrm.get() && OutputObjectBase::implIsValid();
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void InputObjectBase::skipBlock( sal_Int64 nBytes, bool bShowSize )
2008-01-17 07:06:10 +00:00
{
sal_Int64 nEndPos = ::std::min< sal_Int64 >( mxStrm->tell() + nBytes, mxStrm->size() );
2008-09-30 13:51:36 +00:00
if( mxStrm->tell() < nEndPos )
2008-01-17 07:06:10 +00:00
{
if( bShowSize )
2008-09-30 13:51:36 +00:00
writeDecItem( "skipped-data-size", static_cast< sal_uInt64 >( nEndPos - mxStrm->tell() ) );
mxStrm->seek( nEndPos );
2008-01-17 07:06:10 +00:00
}
}
2008-09-30 13:51:36 +00:00
void InputObjectBase::dumpRawBinary( sal_Int64 nBytes, bool bShowOffset, bool bStream )
2008-01-17 07:06:10 +00:00
{
TableGuard aTabGuard( mxOut,
2008-01-17 07:06:10 +00:00
bShowOffset ? 12 : 0,
3 * OOX_DUMP_BYTESPERLINE / 2 + 1,
3 * OOX_DUMP_BYTESPERLINE / 2 + 1,
OOX_DUMP_BYTESPERLINE / 2 + 1 );
2008-09-30 13:51:36 +00:00
sal_Int64 nMaxShowSize = cfg().getIntOption< sal_Int64 >(
bStream ? "max-binary-stream-size" : "max-binary-data-size", SAL_MAX_INT64 );
2008-01-17 07:06:10 +00:00
bool bSeekable = mxStrm->size() >= 0;
sal_Int64 nEndPos = bSeekable ? ::std::min< sal_Int64 >( mxStrm->tell() + nBytes, mxStrm->size() ) : 0;
2008-09-30 13:51:36 +00:00
sal_Int64 nDumpEnd = bSeekable ? ::std::min< sal_Int64 >( mxStrm->tell() + nMaxShowSize, nEndPos ) : nMaxShowSize;
sal_Int64 nPos = bSeekable ? mxStrm->tell() : 0;
2008-01-17 07:06:10 +00:00
bool bLoop = true;
while( bLoop && (nPos < nDumpEnd) )
{
mxOut->writeHex( static_cast< sal_uInt32 >( nPos ) );
mxOut->tab();
2008-01-17 07:06:10 +00:00
sal_uInt8 pnLineData[ OOX_DUMP_BYTESPERLINE ];
2008-09-30 13:51:36 +00:00
sal_Int32 nLineSize = bSeekable ? ::std::min( static_cast< sal_Int32 >( nDumpEnd - mxStrm->tell() ), OOX_DUMP_BYTESPERLINE ) : OOX_DUMP_BYTESPERLINE;
sal_Int32 nReadSize = mxStrm->readMemory( pnLineData, nLineSize );
2008-01-17 07:06:10 +00:00
bLoop = nReadSize == nLineSize;
nPos += nReadSize;
if( nReadSize > 0 )
{
const sal_uInt8* pnByte = 0;
const sal_uInt8* pnEnd = 0;
for( pnByte = pnLineData, pnEnd = pnLineData + nReadSize; pnByte != pnEnd; ++pnByte )
{
if( (pnByte - pnLineData) == (OOX_DUMP_BYTESPERLINE / 2) ) mxOut->tab();
mxOut->writeHex( *pnByte, false );
mxOut->writeChar( ' ' );
2008-01-17 07:06:10 +00:00
}
aTabGuard.tab( 3 );
2008-09-30 13:51:36 +00:00
for( pnByte = pnLineData, pnEnd = pnLineData + nReadSize; pnByte != pnEnd; ++pnByte )
2008-01-17 07:06:10 +00:00
{
if( (pnByte - pnLineData) == (OOX_DUMP_BYTESPERLINE / 2) ) mxOut->tab();
mxOut->writeChar( static_cast< sal_Unicode >( (*pnByte < 0x20) ? '.' : *pnByte ) );
2008-01-17 07:06:10 +00:00
}
mxOut->newLine();
2008-01-17 07:06:10 +00:00
}
}
// skip undumped data
if( bSeekable )
2008-09-30 13:51:36 +00:00
skipBlock( nEndPos - mxStrm->tell() );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void InputObjectBase::dumpBinary( const String& rName, sal_Int64 nBytes, bool bShowOffset )
2008-01-17 07:06:10 +00:00
{
{
MultiItemsGuard aMultiGuard( mxOut );
2008-09-30 13:51:36 +00:00
writeEmptyItem( rName );
2008-01-17 07:06:10 +00:00
writeDecItem( "size", nBytes );
}
IndentGuard aIndGuard( mxOut );
2008-01-17 07:06:10 +00:00
dumpRawBinary( nBytes, bShowOffset );
}
2008-09-30 13:51:36 +00:00
void InputObjectBase::dumpRemaining( sal_Int64 nBytes )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
if( nBytes > 0 )
{
if( cfg().getBoolOption( "show-trailing-unknown", true ) )
dumpBinary( "remaining-data", nBytes, false );
else
skipBlock( nBytes );
}
}
void InputObjectBase::dumpRemainingTo( sal_Int64 nPos )
{
if( mxStrm->isEof() || (mxStrm->tell() > nPos) )
2008-09-30 13:51:36 +00:00
writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
else
dumpRemaining( nPos - mxStrm->tell() );
mxStrm->seek( nPos );
}
void InputObjectBase::dumpRemainingStream()
{
dumpRemainingTo( mxStrm->size() );
2008-09-30 13:51:36 +00:00
}
void InputObjectBase::dumpArray( const String& rName, sal_Int32 nBytes, sal_Unicode cSep )
{
sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxStrm->size() - mxStrm->tell(), 0, nBytes );
2008-01-17 07:06:10 +00:00
if( nDumpSize > OOX_DUMP_MAXARRAY )
{
2008-09-30 13:51:36 +00:00
dumpBinary( rName, nBytes, false );
2008-01-17 07:06:10 +00:00
}
else if( nDumpSize > 1 )
{
sal_uInt8 pnData[ OOX_DUMP_MAXARRAY ];
2008-09-30 13:51:36 +00:00
mxStrm->readMemory( pnData, nDumpSize );
writeArrayItem( rName, pnData, nDumpSize, cSep );
2008-01-17 07:06:10 +00:00
}
else if( nDumpSize == 1 )
2008-09-30 13:51:36 +00:00
dumpHex< sal_uInt8 >( rName );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
sal_Unicode InputObjectBase::dumpUnicode( const String& rName )
2008-01-17 07:06:10 +00:00
{
sal_uInt16 nChar = mxStrm->readuInt16();
2008-09-30 13:51:36 +00:00
sal_Unicode cChar = static_cast< sal_Unicode >( nChar );
writeCharItem( rName( "char" ), cChar );
return cChar;
}
OUString InputObjectBase::dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul )
2008-09-30 13:51:36 +00:00
{
sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxStrm->size() - mxStrm->tell(), 0, nLen );
2008-01-17 07:06:10 +00:00
OUString aString;
if( nDumpSize > 0 )
{
2008-09-30 13:51:36 +00:00
::std::vector< sal_Char > aBuffer( static_cast< sal_Size >( nLen ) + 1 );
sal_Int32 nCharsRead = mxStrm->readMemory( &aBuffer.front(), nLen );
2008-01-17 07:06:10 +00:00
aBuffer[ nCharsRead ] = 0;
aString = OStringToOUString( OString( &aBuffer.front() ), eTextEnc );
}
if( bHideTrailingNul )
aString = StringHelper::trimTrailingNul( aString );
2008-09-30 13:51:36 +00:00
writeStringItem( rName( "text" ), aString );
2008-01-17 07:06:10 +00:00
return aString;
}
OUString InputObjectBase::dumpUnicodeArray( const String& rName, sal_Int32 nLen, bool bHideTrailingNul )
2008-01-17 07:06:10 +00:00
{
OUStringBuffer aBuffer;
2008-09-30 13:51:36 +00:00
for( sal_Int32 nIndex = 0; !mxStrm->isEof() && (nIndex < nLen); ++nIndex )
{
2008-09-30 13:51:36 +00:00
aBuffer.append( static_cast< sal_Unicode >( mxStrm->readuInt16() ) );
}
2008-01-17 07:06:10 +00:00
OUString aString = aBuffer.makeStringAndClear();
if( bHideTrailingNul )
aString = StringHelper::trimTrailingNul( aString );
2008-09-30 13:51:36 +00:00
writeStringItem( rName( "text" ), aString );
2008-01-17 07:06:10 +00:00
return aString;
}
2012-12-13 19:02:26 +01:00
util::DateTime InputObjectBase::dumpFileTime( const String& rName )
2008-09-30 13:51:36 +00:00
{
2012-12-13 19:02:26 +01:00
util::DateTime aDateTime;
2008-09-30 13:51:36 +00:00
ItemGuard aItem( mxOut, rName( "file-time" ) );
2008-09-30 13:51:36 +00:00
sal_Int64 nFileTime = dumpDec< sal_Int64 >( EMPTY_STRING );
// file time is in 10^-7 seconds (100 nanoseconds), convert to nanoseconds
nFileTime *= 100;
2008-09-30 13:51:36 +00:00
// entire days
sal_Int64 nDays = nFileTime / sal_Int64( ::tools::Time::nanoSecPerDay );
2008-09-30 13:51:36 +00:00
// number of entire years
sal_Int64 nYears = (nDays - (nDays / (4 * 365)) + (nDays / (100 * 365)) - (nDays / (400 * 365))) / 365;
// remaining days in the year
sal_Int64 nDaysInYear = nDays - (nYears * 365 + nYears / 4 - nYears / 100 + nYears / 400);
// the year (file dates start from 1601-01-01)
aDateTime.Year = static_cast< sal_uInt16 >( 1601 + nYears );
// leap year?
bool bLeap = ((aDateTime.Year % 4 == 0) && (aDateTime.Year % 100 != 0)) || (aDateTime.Year % 400 == 0);
// static arrays with number of days in month
static const sal_Int64 spnDaysInMonth[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static const sal_Int64 spnDaysInMonthL[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
const sal_Int64* pnDaysInMonth = bLeap ? spnDaysInMonthL : spnDaysInMonth;
// the month
aDateTime.Month = 1;
while( nDaysInYear >= *pnDaysInMonth )
{
nDaysInYear -= *pnDaysInMonth++;
++aDateTime.Month;
}
// the day
aDateTime.Day = static_cast< sal_uInt16 >( nDaysInYear + 1 );
// number of nanoseconds in the day
sal_Int64 nTimeInDay = nFileTime % sal_Int64( ::tools::Time::nanoSecPerDay );
// nanoseconds
aDateTime.NanoSeconds = static_cast< sal_uInt32 >( nTimeInDay % ::tools::Time::nanoSecPerSec );
nTimeInDay /= ::tools::Time::nanoSecPerSec;
2008-09-30 13:51:36 +00:00
// seconds
aDateTime.Seconds = static_cast< sal_uInt16 >( nTimeInDay % ::tools::Time::secondPerMinute );
nTimeInDay /= ::tools::Time::secondPerMinute;
2008-09-30 13:51:36 +00:00
// minutes
aDateTime.Minutes = static_cast< sal_uInt16 >( nTimeInDay % ::tools::Time::minutePerHour );
nTimeInDay /= ::tools::Time::minutePerHour;
2008-09-30 13:51:36 +00:00
// hours
aDateTime.Hours = static_cast< sal_uInt16 >( nTimeInDay );
writeDateTimeItem( EMPTY_STRING, aDateTime );
return aDateTime;
}
OUString InputObjectBase::dumpGuid( const String& rName )
2008-01-17 07:06:10 +00:00
{
OUStringBuffer aBuffer;
sal_uInt32 nData32;
sal_uInt16 nData16;
sal_uInt8 nData8;
nData32 = mxStrm->readuInt32();
2008-01-17 07:06:10 +00:00
StringHelper::appendHex( aBuffer, nData32, false );
aBuffer.append( '-' );
nData16 = mxStrm->readuInt16();
2008-01-17 07:06:10 +00:00
StringHelper::appendHex( aBuffer, nData16, false );
aBuffer.append( '-' );
nData16 = mxStrm->readuInt16();
2008-01-17 07:06:10 +00:00
StringHelper::appendHex( aBuffer, nData16, false );
aBuffer.append( '-' );
nData8 = mxStrm->readuChar();
2008-01-17 07:06:10 +00:00
StringHelper::appendHex( aBuffer, nData8, false );
nData8 = mxStrm->readuChar( );
2008-01-17 07:06:10 +00:00
StringHelper::appendHex( aBuffer, nData8, false );
aBuffer.append( '-' );
2008-01-17 07:06:10 +00:00
for( int nIndex = 0; nIndex < 6; ++nIndex )
{
nData8 = mxStrm->readuChar( );
2008-01-17 07:06:10 +00:00
StringHelper::appendHex( aBuffer, nData8, false );
}
2008-09-30 13:51:36 +00:00
StringHelper::enclose( aBuffer, '{', '}' );
2008-01-17 07:06:10 +00:00
OUString aGuid = aBuffer.makeStringAndClear();
2008-09-30 13:51:36 +00:00
writeGuidItem( rName( "guid" ), aGuid );
2008-01-17 07:06:10 +00:00
return aGuid;
}
void InputObjectBase::dumpItem( const ItemFormat& rItemFmt )
{
switch( rItemFmt.meDataType )
{
case DATATYPE_VOID: break;
case DATATYPE_INT8: dumpValue< sal_Int8 >( rItemFmt ); break;
case DATATYPE_UINT8: dumpValue< sal_uInt8 >( rItemFmt ); break;
case DATATYPE_INT16: dumpValue< sal_Int16 >( rItemFmt ); break;
case DATATYPE_UINT16: dumpValue< sal_uInt16 >( rItemFmt ); break;
case DATATYPE_INT32: dumpValue< sal_Int32 >( rItemFmt ); break;
case DATATYPE_UINT32: dumpValue< sal_uInt32 >( rItemFmt ); break;
case DATATYPE_INT64: dumpValue< sal_Int64 >( rItemFmt ); break;
case DATATYPE_UINT64: dumpValue< sal_uInt64 >( rItemFmt ); break;
case DATATYPE_FLOAT: dumpValue< float >( rItemFmt ); break;
case DATATYPE_DOUBLE: dumpValue< double >( rItemFmt ); break;
default:;
}
}
2008-09-30 13:51:36 +00:00
BinaryStreamObject::BinaryStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
InputObjectBase::construct( rParent, rxStrm, rSysFileName );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void BinaryStreamObject::dumpBinaryStream( bool bShowOffset )
2008-01-17 07:06:10 +00:00
{
mxStrm->seekToStart();
dumpRawBinary( mxStrm->size(), bShowOffset, true );
mxOut->emptyLine();
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void BinaryStreamObject::implDump()
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
dumpBinaryStream();
2008-01-17 07:06:10 +00:00
}
void TextStreamObjectBase::construct( const ObjectBase& rParent,
const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc, const OUString& rSysFileName )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
InputObjectBase::construct( rParent, rxStrm, rSysFileName );
constructTextStrmObj( eTextEnc );
2008-09-30 13:51:36 +00:00
}
void TextStreamObjectBase::construct( const OutputObjectBase& rParent,
const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc )
2008-09-30 13:51:36 +00:00
{
InputObjectBase::construct( rParent, rxStrm );
constructTextStrmObj( eTextEnc );
}
bool TextStreamObjectBase::implIsValid() const
{
return InputObjectBase::implIsValid() && mxTextStrm.get();
2008-01-17 07:06:10 +00:00
}
void TextStreamObjectBase::implDump()
{
implDumpText( *mxTextStrm );
}
void TextStreamObjectBase::constructTextStrmObj( rtl_TextEncoding eTextEnc )
{
if( mxStrm.get() )
mxTextStrm.reset( new TextInputStream( getContext(), *mxStrm, eTextEnc ) );
}
TextLineStreamObject::TextLineStreamObject( const ObjectBase& rParent,
const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc, const OUString& rSysFileName )
{
TextStreamObjectBase::construct( rParent, rxStrm, eTextEnc, rSysFileName );
}
TextLineStreamObject::TextLineStreamObject( const OutputObjectBase& rParent,
const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc )
{
TextStreamObjectBase::construct( rParent, rxStrm, eTextEnc );
}
void TextLineStreamObject::implDumpText( TextInputStream& rTextStrm )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
sal_uInt32 nLine = 0;
while( !rTextStrm.isEof() )
{
OUString aLine = rTextStrm.readLine();
if( !rTextStrm.isEof() || !aLine.isEmpty() )
implDumpLine( aLine, ++nLine );
}
2008-01-17 07:06:10 +00:00
}
void TextLineStreamObject::implDumpLine( const OUString& rLine, sal_uInt32 nLine )
2008-01-17 07:06:10 +00:00
{
TableGuard aTabGuard( mxOut, 8 );
mxOut->writeDec( nLine, 6 );
mxOut->tab();
mxOut->writeString( rLine );
mxOut->newLine();
2008-09-30 13:51:36 +00:00
}
XmlStreamObject::XmlStreamObject( const ObjectBase& rParent,
const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
{
TextStreamObjectBase::construct( rParent, rxStrm, RTL_TEXTENCODING_UTF8, rSysFileName );
}
void XmlStreamObject::implDumpText( TextInputStream& rTextStrm )
{
/* Buffers a start element and the following element text. Needed to dump
matching start/end elements and the element text on the same line. */
OUStringBuffer aOldStartElem;
// special handling for VML
bool bIsVml = InputOutputHelper::getFileNameExtension( maSysFileName ).equalsIgnoreAsciiCase("vml");
while( !rTextStrm.isEof() )
{
// get the next element and the following element text from text stream
OUString aElem = rTextStrm.readToChar( '>', true ).trim();
OUString aText = rTextStrm.readToChar( '<', false );
// remove multiple whitespace from element
sal_Int32 nPos = 0;
while( nPos < aElem.getLength() )
{
while( (nPos < aElem.getLength()) && (aElem[ nPos ] >= 32) ) ++nPos;
if( nPos < aElem.getLength() )
aElem = OUStringBuffer( aElem.copy( 0, nPos ) ).append( ' ' ).append( aElem.copy( nPos ).trim() ).makeStringAndClear();
++nPos;
}
sal_Int32 nElemLen = aElem.getLength();
if( (nElemLen >= 2) && (aElem[ 0 ] == '<') && (aElem[ nElemLen - 1 ] == '>') )
{
// determine type of the element
bool bSimpleElem = (aElem[ 1 ] == '!') || (aElem[ 1 ] == '?') || (aElem[ nElemLen - 2 ] == '/') ||
(bIsVml && (nElemLen == 4) && (aElem[ 1 ] == 'b') && (aElem[ 2 ] == 'r'));
bool bStartElem = !bSimpleElem && (aElem[ 1 ] != '/');
bool bEndElem = !bSimpleElem && !bStartElem;
/* Start element or simple element: flush old start element and
its text from previous iteration, and start a new indentation
level for the new element. Trim whitespace and line breaks from
the text of the old start element. */
if( (bSimpleElem || bStartElem) && (aOldStartElem.getLength() > 0) )
{
mxOut->writeString( aOldStartElem.makeStringAndClear().trim() );
mxOut->newLine();
mxOut->incIndent();
}
/* Start element: remember it and its text, to be able to print the
matching end element on the same line in the next iteration. */
if( bStartElem )
{
aOldStartElem.append( aElem ).append( aText );
}
else
{
/* End element: if a start element has been remembered in the
previous iteration, write it out here untrimmed, to show
all whitespace in the element text, and without trailing
line break. Code below will add the end element right after
it. Otherwise, return to previous indentation level. */
if( bEndElem )
{
if( aOldStartElem.getLength() == 0 )
mxOut->decIndent();
else
mxOut->writeString( aOldStartElem.makeStringAndClear() );
}
/* Write the element. Write following element text in a new
line, but only, if it does not contain of white space
entirely. */
mxOut->writeString( aElem );
mxOut->newLine();
if( !aText.trim().isEmpty() )
{
mxOut->writeString( aText );
mxOut->newLine();
}
}
2008-01-17 07:06:10 +00:00
}
}
}
2008-09-30 13:51:36 +00:00
void RecordObjectBase::construct( const ObjectBase& rParent,
const BinaryInputStreamRef& rxBaseStrm, const OUString& rSysFileName,
const BinaryInputStreamRef& rxRecStrm, const String& rRecNames, const String& rSimpleRecs )
{
InputObjectBase::construct( rParent, rxRecStrm, rSysFileName );
constructRecObjBase( rxBaseStrm, rRecNames, rSimpleRecs );
}
bool RecordObjectBase::implIsValid() const
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
return mxBaseStrm.get() && InputObjectBase::implIsValid();
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
void RecordObjectBase::implDump()
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
NameListRef xRecNames = getRecNames();
ItemFormatMap aSimpleRecs( maSimpleRecs.getNameList( cfg() ) );
2008-09-30 13:51:36 +00:00
while( implStartRecord( *mxBaseStrm, mnRecPos, mnRecId, mnRecSize ) )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
// record header
mxOut->emptyLine();
2008-09-30 13:51:36 +00:00
writeHeader();
implWriteExtHeader();
IndentGuard aIndGuard( mxOut );
sal_Int64 nRecPos = mxStrm->tell();
2008-09-30 13:51:36 +00:00
// record body
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'
2009-09-07 14:41:16 +00:00
if( !mbBinaryOnly && cfg().hasName( xRecNames, mnRecId ) )
2008-09-30 13:51:36 +00:00
{
::std::map< sal_Int64, ItemFormat >::const_iterator aIt = aSimpleRecs.find( mnRecId );
2008-09-30 13:51:36 +00:00
if( aIt != aSimpleRecs.end() )
dumpItem( aIt->second );
else
implDumpRecordBody();
}
// remaining undumped data
if( !mxStrm->isEof() && (mxStrm->tell() == nRecPos) )
2008-09-30 13:51:36 +00:00
dumpRawBinary( mnRecSize, false );
else
dumpRemainingTo( nRecPos + mnRecSize );
2008-01-17 07:06:10 +00:00
}
}
2008-09-30 13:51:36 +00:00
void RecordObjectBase::implWriteExtHeader()
2008-01-17 07:06:10 +00:00
{
}
2008-09-30 13:51:36 +00:00
void RecordObjectBase::implDumpRecordBody()
{
}
void RecordObjectBase::constructRecObjBase( const BinaryInputStreamRef& rxBaseStrm, const String& rRecNames, const String& rSimpleRecs )
{
mxBaseStrm = rxBaseStrm;
maRecNames = rRecNames;
maSimpleRecs = rSimpleRecs;
mnRecPos = mnRecId = mnRecSize = 0;
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'
2009-09-07 14:41:16 +00:00
mbBinaryOnly = false;
CWS-TOOLING: integrate CWS dr67 2009-04-08 13:23:56 +0200 dr r270638 : #i100534# reverted 2009-04-08 10:14:55 +0200 dr r270621 : CWS-TOOLING: rebase CWS dr67 to trunk@270033 (milestone: DEV300:m45) 2009-04-07 21:06:33 +0200 dr r270610 : #i100534# sc does not link in debug mode 2009-03-12 11:20:09 +0100 dr r269375 : #i10000# wae 2009-03-11 19:43:55 +0100 dr r269351 : #i10000# adjust oox namespace ids according to oox/inc/oox/core/namespaces.hxx 2009-03-11 15:38:52 +0100 dr r269339 : CWS-TOOLING: rebase CWS dr67 to trunk@269297 (milestone: DEV300:m43) 2009-02-27 15:20:21 +0100 dr r268598 : CWS-TOOLING: rebase CWS dr67 to trunk@268395 (milestone: DEV300:m42) 2009-02-19 13:32:17 +0100 dr r268277 : moved hf parser into page settings 2009-02-19 12:25:15 +0100 dr r268272 : renamed some structs according to chart filter 2009-02-16 15:51:31 +0100 dr r267823 : #i97873# import autosort settings from BIFF8/OOBIN/OOXML 2009-02-06 17:09:29 +0100 dr r267477 : #i97873# minor changes 2009-02-06 16:38:56 +0100 dr r267473 : #i97873# import date grouping settings from BIFF5/BIFF8/OOBIN/OOXML 2009-02-06 16:38:11 +0100 dr r267472 : #i97873# check min/max/step of passed GroupInfo 2009-02-06 16:35:13 +0100 dr r267471 : #i97873# more doc for createDategroup() 2009-02-06 13:53:42 +0100 dr r267459 : #i97873# make XDataPilotGrouping::createDateGroup() implementation working and robust against wrong input data 2009-02-06 13:52:16 +0100 dr r267458 : #i97873# fix and extend IDL doc for datapilot grouping 2009-02-06 12:35:49 +0100 dr r267453 : fix other IDLC warnings in sheet module 2009-02-06 12:05:19 +0100 dr r267448 : #i97873# fix and extend IDL doc for datapilot grouping 2009-02-02 17:58:46 +0100 dr r267284 : #i10000# rebase errors 2009-02-02 17:52:21 +0100 dr r267282 : #i10000# rebase errors 2009-02-02 17:35:58 +0100 dr r267280 : #i10000# rebase errors 2009-02-02 15:58:04 +0100 dr r267274 : CWS-TOOLING: rebase CWS dr67 to trunk@267171 (milestone: DEV300:m41) 2009-02-02 09:16:32 +0100 dr r267247 : #i97873# typo 2009-01-30 17:09:09 +0100 dr r267215 : #i97873# import numeric grouping settings for datapilot fields from BIFF5/BIFF8/OOBIN/OOXML 2009-01-29 16:36:24 +0100 dr r267154 : #i97873# import datapilot discrete grouping from BIFF5/BIFF8/OOBIN/OOXLS 2009-01-29 16:33:37 +0100 dr r267152 : #i97873# do not kill _all_ the other group fields when writing back DataPilotField::GroupInfo property 2009-01-29 14:15:45 +0100 dr r267133 : #i93839# remove ScChengeTrack::Load and ::Store, adapt xls export filter 2009-01-28 13:30:37 +0100 dr r267056 : #i98397# enhance DataPilot API: allow to rename groups and items in a group field 2009-01-28 12:09:05 +0100 dr r267051 : #i98397# enhance DataPilot API: allow to rename groups and items in a group field 2009-01-27 16:13:58 +0100 dr r267005 : #i97873# minor changes in DataPilot API implementation as preparation for additional changes needed for OOX import filter 2009-01-27 10:08:01 +0100 dr r266961 : #i97873# changing orientation of a DP field moves it to last position in new dimension 2009-01-27 10:06:50 +0100 dr r266960 : #i97873# changing orientation of a DP field moves it to last position in new dimension 2009-01-23 12:52:31 +0100 dr r266808 : #i97873# DP documentation extended 2009-01-21 20:07:15 +0100 dr r266702 : #i97873# this trivial patch adds BIFF5/BIFF8 pivot table import to the oox filter 2009-01-20 16:06:23 +0100 dr r266592 : select BIFF filter via env.var 2009-01-16 18:51:01 +0100 dr r266452 : #i97873# import page fields 2009-01-16 15:05:36 +0100 dr r266420 : #i97873# field item settings (collapsed/hidden), settings of hidden fields 2009-01-15 16:01:17 +0100 dr r266377 : #i97873# import OOXML7/OOBIN7 autoshow settings 2009-01-14 15:24:27 +0100 dr r266310 : #i97873# import auto show settings generated by MSO2003 2009-01-14 12:29:44 +0100 dr r266281 : #i97873# set global dp settings 2009-01-13 15:04:30 +0100 dr r266229 : #i98029# SdrGroupObj does not remember predefined bounding rectangle anymore 2009-01-13 14:46:50 +0100 dr r266225 : #i98029# SdrGroupObj does not remember predefined bounding rectangle anymore 2009-01-12 15:04:22 +0100 dr r266161 : #i97873# remove misleading hasDataLayoutField() 2009-01-12 15:03:42 +0100 dr r266160 : #i97873# remove misleading hasDataLayoutField() 2009-01-12 14:57:33 +0100 dr r266159 : #i97900# reverted previous change, adjusted code to new EnableRTL() behaviour 2009-01-12 14:52:43 +0100 dr r266158 : #i97900# reverted previous change, adjusted code to new EnableRTL() behaviour 2009-01-09 16:34:55 +0100 dr r266098 : #i97900# RTL handling in TabBar changed with CWS rtlcontrols 2009-01-09 16:32:16 +0100 dr r266097 : #i97900# RTL handling in TabBar changed with CWS rtlcontrols 2009-01-09 12:02:39 +0100 dr r266072 : #i97623# RTL handling changed after CWS rtlcontrols 2009-01-09 09:48:53 +0100 dr r266050 : #i158444# SXLI must be filled completely before starting CONTINUE 2009-01-08 18:50:08 +0100 dr r266032 : #158444# allow to disable dump of record positions 2009-01-08 15:46:45 +0100 dr r266020 : #i97873# data layout field handling 2009-01-08 15:45:45 +0100 dr r266019 : #i97873# data layout field handling 2009-01-08 15:42:25 +0100 dr r266018 : #i97873# data layout field handling 2009-01-02 17:28:32 +0100 dr r265844 : #i10000# unxmacxi warning 2009-01-02 16:59:13 +0100 dr r265842 : #i10000# rebase corrections 2009-01-02 16:44:44 +0100 dr r265838 : #i10000# rebase corrections 2009-01-02 11:32:44 +0100 dr r265834 : CWS-TOOLING: rebase CWS dr67 to trunk@265758 (milestone: DEV300:m38) 2008-12-29 16:55:40 +0100 dr r265822 : more pivot table import, field layout settings 2008-12-29 14:27:35 +0100 dr r265817 : more pivot table import, additions for data field settings 2008-12-26 14:39:21 +0100 dr r265805 : updates 2008-12-19 16:31:39 +0100 dr r265734 : typo 2008-12-19 16:30:00 +0100 dr r265733 : add API for sequence of DP field subtotal functions 2008-12-19 16:29:43 +0100 dr r265732 : add API for sequence of DP field subtotal functions 2008-12-19 16:29:07 +0100 dr r265731 : add API for sequence of DP field subtotal functions 2008-12-18 18:07:58 +0100 dr r265710 : #i96758# try to cache row default formatting and apply it at row ranges instead of single rows 2008-12-18 16:00:25 +0100 dr r265698 : more additions to pivot import 2008-12-17 13:38:19 +0100 dr r265599 : do not assert HIDDEN orientation 2008-12-12 13:51:29 +0100 dr r265415 : minor typos 2008-12-12 10:15:04 +0100 dr r265394 : pivot cache import extended to XLSB, added creation of cache data for missing/external sheets 2008-12-04 13:16:16 +0100 dr r264837 : #i96860# remove old dumper files 2008-12-04 12:17:38 +0100 dr r264834 : #i96858# XTO broken, if textbox is empty but contains formatting 2008-12-04 12:16:38 +0100 dr r264833 : #i96858# XTO broken, if textbox is empty but contains formatting 2008-12-03 14:51:05 +0100 dr r264784 : #i10000# warnings 2008-12-03 14:32:46 +0100 dr r264778 : #i10000# warning 2008-12-03 11:28:38 +0100 dr r264758 : #i96758# ignore zero-sized objects 2008-12-03 10:09:34 +0100 dr r264748 : #i96758# change ::oox::Property(Set|Map) keys to sal_Int32 property identifiers, to save construction of property names 2008-12-01 16:09:02 +0100 dr r264615 : #i96758# headerdoc 2008-12-01 14:49:04 +0100 dr r264607 : #i96758# import performance of formatted documents 2008-11-26 17:08:15 +0100 dr r264424 : make it more simple 2008-11-26 16:31:41 +0100 dr r264419 : c:crossesAt is for crossing axis, not for own axis. This is different to BIFF 2008-11-26 13:55:55 +0100 dr r264382 : #i86346# import of MissingValueTreatment from XLSX 2008-11-26 12:49:38 +0100 dr r264370 : #i86346# import/export of MissingValueTreatment from/to XLS 2008-11-25 17:48:59 +0100 dr r264320 : update row height with single progress bar when using 'IsAdjustHeightEnabled' document property 2008-11-25 17:24:26 +0100 dr r264319 : #i96438# disable importing comment text until API is fixed 2008-11-25 17:11:30 +0100 dr r264318 : #i90124# set control tooltips, patch from npower 2008-11-25 15:09:28 +0100 dr r264309 : #i94028# #i94991# update drawing objects when changing row height 2008-11-24 15:21:35 +0100 dr r264224 : prevent ::rtl::OUString::copy assertion 2008-11-24 15:19:39 +0100 dr r264223 : #i95183# #158573# handle non-ascii characters in sheet names in OOXML import 2008-11-24 12:54:30 +0100 dr r264221 : #i94157# support ESC key to leave full-screen in page preview 2008-11-21 18:15:17 +0100 dr r264165 : #i90360# disable chart perspective if it is set to 0 2008-11-21 18:14:41 +0100 dr r264164 : #i90360# disable chart perspective if it is set to 0 2008-11-21 17:43:26 +0100 dr r264155 : #i96140# missing parenth 2008-11-21 17:36:35 +0100 dr r264154 : #i96438# first steps of note import 2008-11-20 15:15:03 +0100 dr r264059 : get rid of ContextWrapper 2008-11-18 11:39:52 +0100 dr r263755 : #i78476# moved to CWS dr67
2009-04-22 10:06:26 +00:00
if( InputObjectBase::implIsValid() )
mbShowRecPos = cfg().getBoolOption( "show-record-position", true );
2008-09-30 13:51:36 +00:00
}
void RecordObjectBase::writeHeader()
{
MultiItemsGuard aMultiGuard( mxOut );
2008-09-30 13:51:36 +00:00
writeEmptyItem( "REC" );
CWS-TOOLING: integrate CWS dr67 2009-04-08 13:23:56 +0200 dr r270638 : #i100534# reverted 2009-04-08 10:14:55 +0200 dr r270621 : CWS-TOOLING: rebase CWS dr67 to trunk@270033 (milestone: DEV300:m45) 2009-04-07 21:06:33 +0200 dr r270610 : #i100534# sc does not link in debug mode 2009-03-12 11:20:09 +0100 dr r269375 : #i10000# wae 2009-03-11 19:43:55 +0100 dr r269351 : #i10000# adjust oox namespace ids according to oox/inc/oox/core/namespaces.hxx 2009-03-11 15:38:52 +0100 dr r269339 : CWS-TOOLING: rebase CWS dr67 to trunk@269297 (milestone: DEV300:m43) 2009-02-27 15:20:21 +0100 dr r268598 : CWS-TOOLING: rebase CWS dr67 to trunk@268395 (milestone: DEV300:m42) 2009-02-19 13:32:17 +0100 dr r268277 : moved hf parser into page settings 2009-02-19 12:25:15 +0100 dr r268272 : renamed some structs according to chart filter 2009-02-16 15:51:31 +0100 dr r267823 : #i97873# import autosort settings from BIFF8/OOBIN/OOXML 2009-02-06 17:09:29 +0100 dr r267477 : #i97873# minor changes 2009-02-06 16:38:56 +0100 dr r267473 : #i97873# import date grouping settings from BIFF5/BIFF8/OOBIN/OOXML 2009-02-06 16:38:11 +0100 dr r267472 : #i97873# check min/max/step of passed GroupInfo 2009-02-06 16:35:13 +0100 dr r267471 : #i97873# more doc for createDategroup() 2009-02-06 13:53:42 +0100 dr r267459 : #i97873# make XDataPilotGrouping::createDateGroup() implementation working and robust against wrong input data 2009-02-06 13:52:16 +0100 dr r267458 : #i97873# fix and extend IDL doc for datapilot grouping 2009-02-06 12:35:49 +0100 dr r267453 : fix other IDLC warnings in sheet module 2009-02-06 12:05:19 +0100 dr r267448 : #i97873# fix and extend IDL doc for datapilot grouping 2009-02-02 17:58:46 +0100 dr r267284 : #i10000# rebase errors 2009-02-02 17:52:21 +0100 dr r267282 : #i10000# rebase errors 2009-02-02 17:35:58 +0100 dr r267280 : #i10000# rebase errors 2009-02-02 15:58:04 +0100 dr r267274 : CWS-TOOLING: rebase CWS dr67 to trunk@267171 (milestone: DEV300:m41) 2009-02-02 09:16:32 +0100 dr r267247 : #i97873# typo 2009-01-30 17:09:09 +0100 dr r267215 : #i97873# import numeric grouping settings for datapilot fields from BIFF5/BIFF8/OOBIN/OOXML 2009-01-29 16:36:24 +0100 dr r267154 : #i97873# import datapilot discrete grouping from BIFF5/BIFF8/OOBIN/OOXLS 2009-01-29 16:33:37 +0100 dr r267152 : #i97873# do not kill _all_ the other group fields when writing back DataPilotField::GroupInfo property 2009-01-29 14:15:45 +0100 dr r267133 : #i93839# remove ScChengeTrack::Load and ::Store, adapt xls export filter 2009-01-28 13:30:37 +0100 dr r267056 : #i98397# enhance DataPilot API: allow to rename groups and items in a group field 2009-01-28 12:09:05 +0100 dr r267051 : #i98397# enhance DataPilot API: allow to rename groups and items in a group field 2009-01-27 16:13:58 +0100 dr r267005 : #i97873# minor changes in DataPilot API implementation as preparation for additional changes needed for OOX import filter 2009-01-27 10:08:01 +0100 dr r266961 : #i97873# changing orientation of a DP field moves it to last position in new dimension 2009-01-27 10:06:50 +0100 dr r266960 : #i97873# changing orientation of a DP field moves it to last position in new dimension 2009-01-23 12:52:31 +0100 dr r266808 : #i97873# DP documentation extended 2009-01-21 20:07:15 +0100 dr r266702 : #i97873# this trivial patch adds BIFF5/BIFF8 pivot table import to the oox filter 2009-01-20 16:06:23 +0100 dr r266592 : select BIFF filter via env.var 2009-01-16 18:51:01 +0100 dr r266452 : #i97873# import page fields 2009-01-16 15:05:36 +0100 dr r266420 : #i97873# field item settings (collapsed/hidden), settings of hidden fields 2009-01-15 16:01:17 +0100 dr r266377 : #i97873# import OOXML7/OOBIN7 autoshow settings 2009-01-14 15:24:27 +0100 dr r266310 : #i97873# import auto show settings generated by MSO2003 2009-01-14 12:29:44 +0100 dr r266281 : #i97873# set global dp settings 2009-01-13 15:04:30 +0100 dr r266229 : #i98029# SdrGroupObj does not remember predefined bounding rectangle anymore 2009-01-13 14:46:50 +0100 dr r266225 : #i98029# SdrGroupObj does not remember predefined bounding rectangle anymore 2009-01-12 15:04:22 +0100 dr r266161 : #i97873# remove misleading hasDataLayoutField() 2009-01-12 15:03:42 +0100 dr r266160 : #i97873# remove misleading hasDataLayoutField() 2009-01-12 14:57:33 +0100 dr r266159 : #i97900# reverted previous change, adjusted code to new EnableRTL() behaviour 2009-01-12 14:52:43 +0100 dr r266158 : #i97900# reverted previous change, adjusted code to new EnableRTL() behaviour 2009-01-09 16:34:55 +0100 dr r266098 : #i97900# RTL handling in TabBar changed with CWS rtlcontrols 2009-01-09 16:32:16 +0100 dr r266097 : #i97900# RTL handling in TabBar changed with CWS rtlcontrols 2009-01-09 12:02:39 +0100 dr r266072 : #i97623# RTL handling changed after CWS rtlcontrols 2009-01-09 09:48:53 +0100 dr r266050 : #i158444# SXLI must be filled completely before starting CONTINUE 2009-01-08 18:50:08 +0100 dr r266032 : #158444# allow to disable dump of record positions 2009-01-08 15:46:45 +0100 dr r266020 : #i97873# data layout field handling 2009-01-08 15:45:45 +0100 dr r266019 : #i97873# data layout field handling 2009-01-08 15:42:25 +0100 dr r266018 : #i97873# data layout field handling 2009-01-02 17:28:32 +0100 dr r265844 : #i10000# unxmacxi warning 2009-01-02 16:59:13 +0100 dr r265842 : #i10000# rebase corrections 2009-01-02 16:44:44 +0100 dr r265838 : #i10000# rebase corrections 2009-01-02 11:32:44 +0100 dr r265834 : CWS-TOOLING: rebase CWS dr67 to trunk@265758 (milestone: DEV300:m38) 2008-12-29 16:55:40 +0100 dr r265822 : more pivot table import, field layout settings 2008-12-29 14:27:35 +0100 dr r265817 : more pivot table import, additions for data field settings 2008-12-26 14:39:21 +0100 dr r265805 : updates 2008-12-19 16:31:39 +0100 dr r265734 : typo 2008-12-19 16:30:00 +0100 dr r265733 : add API for sequence of DP field subtotal functions 2008-12-19 16:29:43 +0100 dr r265732 : add API for sequence of DP field subtotal functions 2008-12-19 16:29:07 +0100 dr r265731 : add API for sequence of DP field subtotal functions 2008-12-18 18:07:58 +0100 dr r265710 : #i96758# try to cache row default formatting and apply it at row ranges instead of single rows 2008-12-18 16:00:25 +0100 dr r265698 : more additions to pivot import 2008-12-17 13:38:19 +0100 dr r265599 : do not assert HIDDEN orientation 2008-12-12 13:51:29 +0100 dr r265415 : minor typos 2008-12-12 10:15:04 +0100 dr r265394 : pivot cache import extended to XLSB, added creation of cache data for missing/external sheets 2008-12-04 13:16:16 +0100 dr r264837 : #i96860# remove old dumper files 2008-12-04 12:17:38 +0100 dr r264834 : #i96858# XTO broken, if textbox is empty but contains formatting 2008-12-04 12:16:38 +0100 dr r264833 : #i96858# XTO broken, if textbox is empty but contains formatting 2008-12-03 14:51:05 +0100 dr r264784 : #i10000# warnings 2008-12-03 14:32:46 +0100 dr r264778 : #i10000# warning 2008-12-03 11:28:38 +0100 dr r264758 : #i96758# ignore zero-sized objects 2008-12-03 10:09:34 +0100 dr r264748 : #i96758# change ::oox::Property(Set|Map) keys to sal_Int32 property identifiers, to save construction of property names 2008-12-01 16:09:02 +0100 dr r264615 : #i96758# headerdoc 2008-12-01 14:49:04 +0100 dr r264607 : #i96758# import performance of formatted documents 2008-11-26 17:08:15 +0100 dr r264424 : make it more simple 2008-11-26 16:31:41 +0100 dr r264419 : c:crossesAt is for crossing axis, not for own axis. This is different to BIFF 2008-11-26 13:55:55 +0100 dr r264382 : #i86346# import of MissingValueTreatment from XLSX 2008-11-26 12:49:38 +0100 dr r264370 : #i86346# import/export of MissingValueTreatment from/to XLS 2008-11-25 17:48:59 +0100 dr r264320 : update row height with single progress bar when using 'IsAdjustHeightEnabled' document property 2008-11-25 17:24:26 +0100 dr r264319 : #i96438# disable importing comment text until API is fixed 2008-11-25 17:11:30 +0100 dr r264318 : #i90124# set control tooltips, patch from npower 2008-11-25 15:09:28 +0100 dr r264309 : #i94028# #i94991# update drawing objects when changing row height 2008-11-24 15:21:35 +0100 dr r264224 : prevent ::rtl::OUString::copy assertion 2008-11-24 15:19:39 +0100 dr r264223 : #i95183# #158573# handle non-ascii characters in sheet names in OOXML import 2008-11-24 12:54:30 +0100 dr r264221 : #i94157# support ESC key to leave full-screen in page preview 2008-11-21 18:15:17 +0100 dr r264165 : #i90360# disable chart perspective if it is set to 0 2008-11-21 18:14:41 +0100 dr r264164 : #i90360# disable chart perspective if it is set to 0 2008-11-21 17:43:26 +0100 dr r264155 : #i96140# missing parenth 2008-11-21 17:36:35 +0100 dr r264154 : #i96438# first steps of note import 2008-11-20 15:15:03 +0100 dr r264059 : get rid of ContextWrapper 2008-11-18 11:39:52 +0100 dr r263755 : #i78476# moved to CWS dr67
2009-04-22 10:06:26 +00:00
if( mbShowRecPos && mxBaseStrm->isSeekable() )
2008-09-30 13:51:36 +00:00
writeShortHexItem( "pos", mnRecPos, "CONV-DEC" );
writeShortHexItem( "size", mnRecSize, "CONV-DEC" );
ItemGuard aItem( mxOut, "id" );
mxOut->writeShortHex( mnRecId );
2008-09-30 13:51:36 +00:00
addNameToItem( mnRecId, "CONV-DEC" );
addNameToItem( mnRecId, maRecNames );
}
void SequenceRecordObjectBase::construct( const ObjectBase& rParent,
const BinaryInputStreamRef& rxBaseStrm, const OUString& rSysFileName,
2008-09-30 13:51:36 +00:00
const String& rRecNames, const String& rSimpleRecs )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
BinaryInputStreamRef xRecStrm( new SequenceInputStream( *mxRecData ) );
RecordObjectBase::construct( rParent, rxBaseStrm, rSysFileName, xRecStrm, rRecNames, rSimpleRecs );
2008-01-17 07:06:10 +00:00
}
2008-09-30 13:51:36 +00:00
bool SequenceRecordObjectBase::implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize )
{
bool bValid = true;
if( rBaseStrm.isSeekable() )
{
ornRecPos = rBaseStrm.tell();
// do not try to overread seekable streams, may cause assertions
bValid = ornRecPos < rBaseStrm.size();
2008-09-30 13:51:36 +00:00
}
// read the record header
if( bValid )
bValid = implReadRecordHeader( rBaseStrm, ornRecId, ornRecSize ) && !rBaseStrm.isEof() && (0 <= ornRecSize) && (ornRecSize <= 0x00100000);
// read record contents into data sequence
if( bValid )
{
sal_Int32 nRecSize = static_cast< sal_Int32 >( ornRecSize );
mxRecData->realloc( nRecSize );
bValid = (nRecSize == 0) || (rBaseStrm.readData( *mxRecData, nRecSize ) == nRecSize);
mxStrm->seekToStart();
2008-09-30 13:51:36 +00:00
}
return bValid;
}
DumperBase::~DumperBase()
{
}
bool DumperBase::isImportEnabled() const
{
return !isValid() || cfg().isImportEnabled();
2008-01-17 07:06:10 +00:00
}
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'
2009-09-07 14:41:16 +00:00
bool DumperBase::isImportCancelled() const
{
return isValid() && cfg().isPasswordCancelled();
}
2008-09-30 13:51:36 +00:00
void DumperBase::construct( const ConfigRef& rxConfig )
2008-01-17 07:06:10 +00:00
{
2008-09-30 13:51:36 +00:00
if( isValid( rxConfig ) && rxConfig->isDumperEnabled() )
ObjectBase::construct( rxConfig );
2008-01-17 07:06:10 +00:00
}
} // namespace dump
} // namespace oox
#endif
Merge commit 'ooo/DEV300_m106' into integration/dev300_m106 Conflicts: binfilter/bf_svtools/source/filter.vcl/jpeg/svt_jpegc.c filter/source/config/fragments/filters/SVG___Scalable_Vector_Graphics.xcu filter/source/config/fragments/internalgraphicfilters/svg_Import.xcu filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu filter/source/graphicfilter/eos2met/eos2met.cxx filter/source/msfilter/msvbahelper.cxx filter/source/svg/makefile.mk filter/source/svg/svgexport.cxx filter/source/svg/svgfilter.cxx filter/source/svg/svgfilter.hxx filter/source/svg/svgfontexport.cxx filter/source/svg/svgfontexport.hxx filter/source/svg/svgwriter.cxx filter/source/svg/svgwriter.hxx oox/inc/oox/core/relations.hxx oox/inc/oox/core/relationshandler.hxx oox/inc/oox/dump/biffdumper.hxx oox/inc/oox/dump/dffdumper.hxx oox/inc/oox/dump/dumperbase.hxx oox/inc/oox/dump/oledumper.hxx oox/inc/oox/dump/pptxdumper.hxx oox/inc/oox/helper/containerhelper.hxx oox/inc/oox/helper/propertyset.hxx oox/inc/oox/xls/commentsbuffer.hxx oox/inc/oox/xls/sharedformulabuffer.hxx oox/source/drawingml/shape.cxx oox/source/dump/oledumper.cxx oox/source/helper/binaryinputstream.cxx oox/source/helper/binaryoutputstream.cxx oox/source/helper/binarystreambase.cxx oox/source/helper/propertyset.cxx oox/source/ole/vbacontrol.cxx oox/source/ole/vbaproject.cxx oox/source/token/namespaces.hxx.tail oox/source/vml/vmlshape.cxx oox/source/xls/commentsbuffer.cxx oox/source/xls/condformatbuffer.cxx oox/source/xls/drawingfragment.cxx oox/source/xls/formulaparser.cxx oox/source/xls/pivotcachebuffer.cxx oox/source/xls/richstring.cxx oox/source/xls/sharedformulabuffer.cxx oox/source/xls/sheetdatacontext.cxx oox/source/xls/worksheethelper.cxx writerfilter/source/dmapper/DomainMapper_Impl.cxx
2011-04-27 01:31:35 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */