diff options
Diffstat (limited to 'oox/source/helper')
-rw-r--r-- | oox/source/helper/propertymap.cxx | 73 | ||||
-rw-r--r-- | oox/source/helper/propertyset.cxx | 7 | ||||
-rw-r--r-- | oox/source/helper/zipstorage.cxx | 9 |
3 files changed, 87 insertions, 2 deletions
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx index 9ff791fd21f3..31072fe449e5 100644 --- a/oox/source/helper/propertymap.cxx +++ b/oox/source/helper/propertymap.cxx @@ -50,6 +50,19 @@ using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::beans::XVetoableChangeListener; +#if OSL_DEBUG_LEVEL > 0 +#include <cstdio> +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/LineSpacingMode.hpp> +#include <com/sun/star/text/WritingMode.hpp> +#define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr() +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using ::rtl::OString; +using ::com::sun::star::style::LineSpacing; +using ::com::sun::star::text::WritingMode; +#endif + namespace oox { // ============================================================================ @@ -228,6 +241,66 @@ Reference< XPropertySet > PropertyMap::makePropertySet() const return new GenericPropertySet( *this ); } +#if OSL_DEBUG_LEVEL > 0 +void PropertyMap::dump( Reference< XPropertySet > rXPropSet ) +{ + Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo (); + Sequence< beans::Property > props = info->getProperties (); + + OSL_TRACE("dump props, len: %d", props.getLength ()); + + for (int i=0; i < props.getLength (); i++) { + OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8); + fprintf (stderr,"%30s = ", name.getStr() ); + + try { + Any value = rXPropSet->getPropertyValue( props [i].Name ); + + OUString strValue; + sal_Int32 intValue = 0; + sal_uInt32 uintValue = 0; + sal_Int16 int16Value = 0; + sal_uInt16 uint16Value = 0; + bool boolValue = false; + LineSpacing spacing; +// RectanglePoint pointValue; + WritingMode aWritingMode; + + if( value >>= strValue ) + fprintf (stderr,"\"%s\"\n", USS( strValue ) ); + else if( value >>= intValue ) + fprintf (stderr,"%"SAL_PRIdINT32" (hex: %"SAL_PRIxUINT32")\n", intValue, intValue); + else if( value >>= uintValue ) + fprintf (stderr,"%"SAL_PRIdINT32" (hex: %"SAL_PRIxUINT32")\n", uintValue, uintValue); + else if( value >>= int16Value ) + fprintf (stderr,"%d (hex: %x)\n", int16Value, int16Value); + else if( value >>= uint16Value ) + fprintf (stderr,"%d (hex: %x)\n", uint16Value, uint16Value); + else if( value >>= boolValue ) + fprintf (stderr,"%d (bool)\n", boolValue); + else if( value >>= aWritingMode ) + fprintf (stderr, "%d writing mode\n", aWritingMode); + else if( value >>= spacing ) { + fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height); + } else if( value.isExtractableTo(::getCppuType((const sal_Int32*)0))) { + fprintf (stderr,"is extractable to int32\n"); + } +// else if( value >>= pointValue ) +// fprintf (stderr,"%d (RectanglePoint)\n", pointValue); + else + fprintf (stderr,"??? <unhandled type %s>\n", USS(value.getValueTypeName())); + } catch(Exception e) { + fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name)); + } + } +} + +void PropertyMap::dump() +{ + dump( Reference< XPropertySet >( makePropertySet(), UNO_QUERY ) ); +} +#endif + // ============================================================================ } // namespace oox diff --git a/oox/source/helper/propertyset.cxx b/oox/source/helper/propertyset.cxx index c52872e50f2f..e7071ba402a2 100644 --- a/oox/source/helper/propertyset.cxx +++ b/oox/source/helper/propertyset.cxx @@ -172,6 +172,13 @@ void PropertySet::setAnyProperty( const OUString& rPropName, const Any& rValue ) } } +#if OSL_DEBUG_LEVEL > 0 +void PropertySet::dump() +{ + PropertyMap::dump( Reference< XPropertySet >( getXPropertySet(), UNO_QUERY ) ); +} +#endif + // ============================================================================ } // namespace oox diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx index 72b6fcd1bff0..384870430c39 100644 --- a/oox/source/helper/zipstorage.cxx +++ b/oox/source/helper/zipstorage.cxx @@ -66,10 +66,15 @@ ZipStorage::ZipStorage( /* #i105325# ::comphelper::OStorageHelper::GetStorageFromInputStream() cannot be used here as it will open a storage with format type 'PackageFormat' that will not work with OOXML packages. + + #161971# The MS-document storages should always be opened in Repair-Mode to + ignore the format errors and get so much info as possible. I hate this + solution, but it seems to be the only consistent way to handle the MS-documents. + TODO: #i105410# switch to 'OFOPXMLFormat' and use its implementation of relations handling. */ mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( - ZIP_STORAGE_FORMAT_STRING, rxInStream, rxFactory ); + ZIP_STORAGE_FORMAT_STRING, rxInStream, rxFactory, sal_True ); } catch( Exception& ) { @@ -87,7 +92,7 @@ ZipStorage::ZipStorage( { using namespace ::com::sun::star::embed::ElementModes; mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( - OFOPXML_STORAGE_FORMAT_STRING, rxStream, READWRITE | TRUNCATE, rxFactory ); + OFOPXML_STORAGE_FORMAT_STRING, rxStream, READWRITE | TRUNCATE, rxFactory, sal_True ); } catch( Exception& ) { |