summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorobo <obo@openoffice.org>2010-06-18 10:54:35 +0200
committerobo <obo@openoffice.org>2010-06-18 10:54:35 +0200
commit3781c0d4846c9dd0adc14e6e809aa342ba5b7013 (patch)
tree52f672f03a99c91c4ae65ff509ef22dede986156 /oox
parent33750471297793a14d19f783208f7d8019903570 (diff)
parent17ba50bbd1621c775da790213454acf95f5021a7 (diff)
CWS-TOOLING: integrate CWS tl78
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/core/filterbase.hxx6
-rw-r--r--oox/inc/oox/core/filterdetect.hxx1
-rw-r--r--oox/inc/oox/dump/dumperbase.hxx2
-rw-r--r--[-rwxr-xr-x]oox/source/core/filterbase.cxx18
-rw-r--r--oox/source/core/filterdetect.cxx10
-rw-r--r--oox/source/token/makefile.mk5
-rw-r--r--oox/source/token/properties.txt3
-rw-r--r--oox/source/xls/workbooksettings.cxx26
8 files changed, 42 insertions, 29 deletions
diff --git a/oox/inc/oox/core/filterbase.hxx b/oox/inc/oox/core/filterbase.hxx
index 31e26d38f590..617559a9a90f 100644
--- a/oox/inc/oox/core/filterbase.hxx
+++ b/oox/inc/oox/core/filterbase.hxx
@@ -113,9 +113,6 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
getGlobalFactory() const;
- /** Returns the media descriptor. */
- ::comphelper::MediaDescriptor& getMediaDescriptor() const;
-
/** Returns the document model (always existing). */
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >&
getModel() const;
@@ -136,6 +133,9 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >&
getInteractionHandler() const;
+ /** Returns the media descriptor. */
+ ::comphelper::MediaDescriptor& getMediaDescriptor() const;
+
/** Returns the URL of the imported or exported file. */
const ::rtl::OUString& getFileUrl() const;
diff --git a/oox/inc/oox/core/filterdetect.hxx b/oox/inc/oox/core/filterdetect.hxx
index e38008305d71..76e46050c24a 100644
--- a/oox/inc/oox/core/filterdetect.hxx
+++ b/oox/inc/oox/core/filterdetect.hxx
@@ -41,6 +41,7 @@ namespace com { namespace sun { namespace star {
} } }
namespace comphelper { class MediaDescriptor; }
+
namespace oox { class AttributeList; }
namespace oox {
diff --git a/oox/inc/oox/dump/dumperbase.hxx b/oox/inc/oox/dump/dumperbase.hxx
index f65eeceebf27..ed1a3e1fc938 100644
--- a/oox/inc/oox/dump/dumperbase.hxx
+++ b/oox/inc/oox/dump/dumperbase.hxx
@@ -39,9 +39,9 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/util/DateTime.hpp>
#include <comphelper/mediadescriptor.hxx>
+#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/helper.hxx"
#include "oox/helper/storagebase.hxx"
-#include "oox/helper/binaryinputstream.hxx"
#define OOX_INCLUDE_DUMPER (OSL_DEBUG_LEVEL > 0)
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 902784cafe80..5bb6aac886e0 100755..100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -200,11 +200,7 @@ void FilterBaseImpl::finalizeFilter()
{
try
{
- // clear the 'ComponentData' property in the descriptor
- MediaDescriptor::iterator aIt = maMediaDesc.find( MediaDescriptor::PROP_COMPONENTDATA() );
- if( aIt != maMediaDesc.end() )
- aIt->second.clear();
- // write the descriptor back to the document model (adds the password)
+ // write the descriptor back to the document model (adds the passwords)
mxModel->attachResource( maFileUrl, maMediaDesc.getAsConstPropertyValueList() );
// unlock the model controllers
mxModel->unlockControllers();
@@ -248,11 +244,6 @@ const Reference< XMultiServiceFactory >& FilterBase::getGlobalFactory() const
return mxImpl->mxGlobalFactory;
}
-MediaDescriptor& FilterBase::getMediaDescriptor() const
-{
- return mxImpl->maMediaDesc;
-}
-
const Reference< XModel >& FilterBase::getModel() const
{
return mxImpl->mxModel;
@@ -278,6 +269,11 @@ const Reference< XInteractionHandler >& FilterBase::getInteractionHandler() cons
return mxImpl->mxInteractionHandler;
}
+MediaDescriptor& FilterBase::getMediaDescriptor() const
+{
+ return mxImpl->maMediaDesc;
+}
+
const OUString& FilterBase::getFileUrl() const
{
return mxImpl->maFileUrl;
@@ -560,7 +556,7 @@ Reference< XStream > FilterBase::implGetOutputStream( MediaDescriptor& rMediaDes
void FilterBase::setMediaDescriptor( const Sequence< PropertyValue >& rMediaDescSeq )
{
- mxImpl->maMediaDesc = rMediaDescSeq;
+ mxImpl->maMediaDesc << rMediaDescSeq;
switch( mxImpl->meDirection )
{
diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index 12cafc48305a..00244c224778 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -41,6 +41,7 @@
#include "oox/ole/olestorage.hxx"
using ::rtl::OUString;
+using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::RuntimeException;
@@ -474,9 +475,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript
return xInStrm;
// check if a temporary file is passed in the 'ComponentData' property
- Sequence< NamedValue > aCompData = rMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_COMPONENTDATA(), Sequence< NamedValue >() );
- SequenceAsHashMap aCompDataMap( aCompData );
- Reference< XStream > xDecrypted = aCompDataMap.getUnpackedValueOrDefault( CREATE_OUSTRING( "DecryptedPackage" ), Reference< XStream >() );
+ Reference< XStream > xDecrypted( rMediaDesc.getComponentDataEntry( CREATE_OUSTRING( "DecryptedPackage" ) ), UNO_QUERY );
if( xDecrypted.is() )
{
Reference< XInputStream > xDecrInStrm = xDecrypted->getInputStream();
@@ -559,10 +558,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript
aDecryptedPackage.seekToStart();
// store temp file in media descriptor to keep it alive
- Sequence< NamedValue > aPropSeq( 1 );
- aPropSeq[ 0 ].Name = CREATE_OUSTRING( "DecryptedPackage" );
- aPropSeq[ 0 ].Value <<= xTempFile;
- rMediaDesc[ MediaDescriptor::PROP_COMPONENTDATA() ] <<= aPropSeq;
+ rMediaDesc.setComponentDataEntry( CREATE_OUSTRING( "DecryptedPackage" ), Any( xTempFile ) );
Reference< XInputStream > xDecrInStrm = xTempFile->getInputStream();
if( lclIsZipPackage( mxFactory, xDecrInStrm ) )
diff --git a/oox/source/token/makefile.mk b/oox/source/token/makefile.mk
index 3c2e9201ea33..7884c375fde6 100644
--- a/oox/source/token/makefile.mk
+++ b/oox/source/token/makefile.mk
@@ -51,6 +51,7 @@ $(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$
@@noop $(assign do_phony:=.PHONY)
$(MISC)$/do_tokens $(do_phony) : tokens.txt gentoken.pl $(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx
+ @@-$(RM) $@
$(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(INCCOM)$/tokenwords.inc $(MISC)$/tokens.gperf && $(TOUCH) $@
$(INCCOM)$/oox:
@@ -60,6 +61,7 @@ $(INCCOM)$/oox$/core: $(INCCOM)$/oox
$(MKDIR) $(INCCOM)$/oox$/core
$(MISC)$/do_namespaces $(do_phony) : namespaces.txt gennamespaces.pl
+ @@-$(RM) $@
$(MKDIRHIER) $(INCCOM)$/oox$/core
$(PERL) gennamespaces.pl namespaces.txt $(INCCOM)$/oox$/core$/namespaces.hxx && $(TOUCH) $@
@@ -69,7 +71,8 @@ $(INCCOM)$/tokens.inc : $(MISC)$/tokens.gperf $(MISC)$/do_tokens
$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.inc $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/oox$/core$/namespaces.hxx $(MISC)$/do_tokens $(MISC)$/do_namespaces
$(MISC)$/do_properties $(do_phony) : properties.txt genproperties.pl $(INCCOM)$/properties.hxx $(INCCOM)$/propertywords.inc
- $(PERL) genproperties.pl properties.txt $(INCCOM)$/properties.hxx $(INCCOM)$/propertywords.inc && $(TOUCH) $@
+ @@-$(RM) $@
+ $(PERL) genproperties.pl properties.txt $(INCCOM)$/properties.hxx $(INCCOM)$/propertywords.inc && $(TOUCH) $@
$(SLO)$/propertylist.obj : $(INCCOM)$/propertywords.inc $(INCCOM)$/properties.hxx $(MISC)$/do_properties
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 2b32b0a14d91..a0f0021d710a 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -250,6 +250,7 @@ LineStyle
LineTransparence
LineWidth
LinkURL
+LoadReadonly
LookUpLabels
MajorTickmarks
MarkPosition
@@ -259,6 +260,7 @@ MediaType
MinorTickmarks
MissingValueTreatment
Model
+ModifyPasswordHash
MultiLine
MultiSelection
Name
@@ -449,7 +451,6 @@ VisualEffect
Weight
WhiteDay
Width
-WriteProtectionPassword
WritingMode
ZoomType
ZoomValue
diff --git a/oox/source/xls/workbooksettings.cxx b/oox/source/xls/workbooksettings.cxx
index 40d400da7757..6fc5a330b8dd 100644
--- a/oox/source/xls/workbooksettings.cxx
+++ b/oox/source/xls/workbooksettings.cxx
@@ -26,9 +26,9 @@
************************************************************************/
#include "oox/xls/workbooksettings.hxx"
+#include <com/sun/star/sheet/XCalculatable.hpp>
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <com/sun/star/sheet/XCalculatable.hpp>
#include <comphelper/mediadescriptor.hxx>
#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
@@ -39,11 +39,16 @@
#include "oox/xls/unitconverter.hxx"
using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::sheet::XCalculatable;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::util::Date;
using ::com::sun::star::util::XNumberFormatsSupplier;
-using ::com::sun::star::sheet::XCalculatable;
+using ::comphelper::MediaDescriptor;
using ::oox::core::CodecHelper;
namespace oox {
@@ -293,10 +298,21 @@ void WorkbookSettings::finalizeImport()
}
// write protection
- if( maFileSharing.mbRecommendReadOnly || (maFileSharing.mnPasswordHash != 0) )
+ if( maFileSharing.mbRecommendReadOnly || (maFileSharing.mnPasswordHash != 0) ) try
+ {
getBaseFilter().getMediaDescriptor()[ CREATE_OUSTRING( "ReadOnly" ) ] <<= true;
- if( maFileSharing.mnPasswordHash != 0 )
- aPropSet.setProperty( PROP_WriteProtectionPassword, static_cast< sal_Int32 >( maFileSharing.mnPasswordHash ) );
+
+ Reference< XPropertySet > xDocumentSettings( getDocumentFactory()->createInstance(
+ CREATE_OUSTRING( "com.sun.star.document.Settings" ) ), UNO_QUERY_THROW );
+ PropertySet aSettingsProp( xDocumentSettings );
+ if( maFileSharing.mbRecommendReadOnly )
+ aSettingsProp.setProperty( PROP_LoadReadonly, true );
+// if( maFileSharing.mnPasswordHash != 0 )
+// aSettingsProp.setProperty( PROP_ModifyPasswordHash, static_cast< sal_Int32 >( maFileSharing.mnPasswordHash ) );
+ }
+ catch( Exception& )
+ {
+ }
// calculation settings
Date aNullDate = getNullDate();