You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2012/08/20 13:46:47 UTC
svn commit: r1374979 [20/29] - in /incubator/ooo/branches/writer001: ./
ext_libraries/apr-util/ ext_libraries/apr-util/prj/ ext_libraries/apr/
ext_libraries/coinmp/ ext_libraries/hunspell/ ext_libraries/serf/
ext_libraries/serf/prj/ ext_sources/ extras...
Modified: incubator/ooo/branches/writer001/main/package/source/manifest/ManifestExport.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/package/source/manifest/ManifestExport.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/package/source/manifest/ManifestExport.cxx (original)
+++ incubator/ooo/branches/writer001/main/package/source/manifest/ManifestExport.cxx Mon Aug 20 11:46:19 2012
@@ -34,7 +34,7 @@
#include <ManifestDefines.hxx>
#include <ManifestExport.hxx>
-#include <Base64Codec.hxx>
+#include <sax/tools/converter.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/documentconstants.hxx>
@@ -273,7 +273,7 @@ ManifestExport::ManifestExport( uno::Ref
pNewAttrList->AddAttribute ( sChecksumTypeAttribute, sCdataAttribute, sChecksumType );
*pDigest >>= aSequence;
- Base64Codec::encodeBase64( aBuffer, aSequence );
+ ::sax::Converter::encodeBase64( aBuffer, aSequence );
pNewAttrList->AddAttribute ( sChecksumAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
xHandler->startElement( sEncryptionDataElement , xNewAttrList);
@@ -306,7 +306,7 @@ ManifestExport::ManifestExport( uno::Ref
pNewAttrList->AddAttribute ( sAlgorithmNameAttribute, sCdataAttribute, sEncAlgName );
*pVector >>= aSequence;
- Base64Codec::encodeBase64 ( aBuffer, aSequence );
+ ::sax::Converter::encodeBase64 ( aBuffer, aSequence );
pNewAttrList->AddAttribute ( sInitialisationVectorAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
xHandler->ignorableWhitespace ( sWhiteSpace );
@@ -332,7 +332,7 @@ ManifestExport::ManifestExport( uno::Ref
pNewAttrList->AddAttribute ( sIterationCountAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
*pSalt >>= aSequence;
- Base64Codec::encodeBase64 ( aBuffer, aSequence );
+ ::sax::Converter::encodeBase64 ( aBuffer, aSequence );
pNewAttrList->AddAttribute ( sSaltAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
xHandler->ignorableWhitespace ( sWhiteSpace );
Modified: incubator/ooo/branches/writer001/main/package/source/manifest/ManifestImport.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/package/source/manifest/ManifestImport.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/package/source/manifest/ManifestImport.cxx (original)
+++ incubator/ooo/branches/writer001/main/package/source/manifest/ManifestImport.cxx Mon Aug 20 11:46:19 2012
@@ -25,12 +25,11 @@
#include "precompiled_package.hxx"
#include <ManifestImport.hxx>
#include <ManifestDefines.hxx>
-#include <Base64Codec.hxx>
+#include <sax/tools/converter.hxx>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <com/sun/star/xml/crypto/DigestID.hpp>
#include <com/sun/star/xml/crypto/CipherID.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
using namespace com::sun::star::uno;
using namespace com::sun::star::beans;
@@ -38,19 +37,36 @@ using namespace com::sun::star;
using namespace rtl;
using namespace std;
+// helper for ignoring multiple settings of the same property
+#define setProperty(e,v) do{ if(!maValues[e].hasValue()) maValues[e] <<= v;} while(0)
+
+static const char* getMnfstPropName( int nManifestPropId )
+{
+ const char* pName;
+ switch( nManifestPropId )
+ {
+ case PKG_MNFST_MEDIATYPE: pName = "MediaType"; break;
+ case PKG_MNFST_VERSION: pName = "Version"; break;
+ case PKG_MNFST_FULLPATH: pName = "FullPath"; break;
+ case PKG_MNFST_INIVECTOR: pName = "InitialisationVector"; break;
+ case PKG_MNFST_SALT: pName = "Salt"; break;
+ case PKG_MNFST_ITERATION: pName = "IterationCount"; break;
+ case PKG_MNFST_UCOMPSIZE: pName = "Size"; break;
+ case PKG_MNFST_DIGEST: pName = "Digest"; break;
+ case PKG_MNFST_ENCALG: pName = "EncryptionAlgorithm"; break;
+ case PKG_MNFST_STARTALG: pName = "StartKeyAlgorithm"; break;
+ case PKG_MNFST_DIGESTALG: pName = "DigestAlgorithm"; break;
+ case PKG_MNFST_DERKEYSIZE: pName = "DerivedKeySize"; break;
+ default: pName = NULL;
+ }
+ return pName;
+}
+
// ---------------------------------------------------
ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManVector )
-: nNumProperty ( 0 )
-, bIgnoreEncryptData ( sal_False )
+: rManVector ( rNewManVector )
, nDerivedKeySize( 0 )
-, rManVector ( rNewManVector )
-
-, sFileEntryElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_FILE_ENTRY ) )
-, sManifestElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_MANIFEST ) )
-, sEncryptionDataElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ENCRYPTION_DATA ) )
-, sAlgorithmElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ALGORITHM ) )
-, sStartKeyAlgElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_START_KEY_GENERATION ) )
-, sKeyDerivationElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_KEY_DERIVATION ) )
+, bIgnoreEncryptData( false )
, sCdataAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CDATA ) )
, sMediaTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_MEDIA_TYPE ) )
@@ -58,46 +74,14 @@ ManifestImport::ManifestImport( vector <
, sFullPathAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_FULL_PATH ) )
, sSizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SIZE ) )
, sSaltAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SALT ) )
-, sInitialisationVectorAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_INITIALISATION_VECTOR ) )
+, sInitialisationVectorAttribute(RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_INITIALISATION_VECTOR ) )
, sIterationCountAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ITERATION_COUNT ) )
-, sKeySizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_SIZE ) )
+, sKeySizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_SIZE ) )
, sAlgorithmNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ALGORITHM_NAME ) )
-, sStartKeyAlgNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_START_KEY_GENERATION_NAME ) )
+, sStartKeyAlgNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_START_KEY_GENERATION_NAME ) )
, sKeyDerivationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_DERIVATION_NAME ) )
, sChecksumAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM ) )
, sChecksumTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM_TYPE ) )
-
-, sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) )
-, sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) )
-, sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) )
-, sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) )
-, sDerivedKeySizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DerivedKeySize" ) )
-, sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) )
-, sInitialisationVectorProperty ( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) )
-, sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) )
-, sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) )
-, sEncryptionAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "EncryptionAlgorithm" ) )
-, sStartKeyAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "StartKeyAlgorithm" ) )
-, sDigestAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DigestAlgorithm" ) )
-
-, sWhiteSpace ( RTL_CONSTASCII_USTRINGPARAM ( " " ) )
-
-, sSHA256_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_URL ) )
-, sSHA1_Name ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_NAME ) )
-, sSHA1_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_URL ) )
-
-, sSHA256_1k_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_1K_URL ) )
-, sSHA1_1k_Name ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_1K_NAME ) )
-, sSHA1_1k_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_1K_URL ) )
-
-, sBlowfish_Name ( RTL_CONSTASCII_USTRINGPARAM ( BLOWFISH_NAME ) )
-, sBlowfish_URL ( RTL_CONSTASCII_USTRINGPARAM ( BLOWFISH_URL ) )
-, sAES128_URL ( RTL_CONSTASCII_USTRINGPARAM ( AES128_URL ) )
-, sAES192_URL ( RTL_CONSTASCII_USTRINGPARAM ( AES192_URL ) )
-, sAES256_URL ( RTL_CONSTASCII_USTRINGPARAM ( AES256_URL ) )
-
-, sPBKDF2_Name ( RTL_CONSTASCII_USTRINGPARAM ( PBKDF2_NAME ) )
-, sPBKDF2_URL ( RTL_CONSTASCII_USTRINGPARAM ( PBKDF2_URL ) )
{
aStack.reserve( 10 );
}
@@ -126,138 +110,115 @@ void SAL_CALL ManifestImport::startEleme
StringHashMap aConvertedAttribs;
::rtl::OUString aConvertedName = PushNameAndNamespaces( aName, xAttribs, aConvertedAttribs );
- if ( aConvertedName == sFileEntryElement )
+ if ( aConvertedName.equalsAscii( ELEMENT_FILE_ENTRY ) )
{
- aSequence.realloc ( PKG_SIZE_ENCR_MNFST );
+ setProperty( PKG_MNFST_FULLPATH, aConvertedAttribs[sFullPathAttribute]);
+ setProperty( PKG_MNFST_MEDIATYPE, aConvertedAttribs[sMediaTypeAttribute]);
- // Put full-path property first for MBA
- aSequence[nNumProperty].Name = sFullPathProperty;
- aSequence[nNumProperty++].Value <<= aConvertedAttribs[sFullPathAttribute];
- aSequence[nNumProperty].Name = sMediaTypeProperty;
- aSequence[nNumProperty++].Value <<= aConvertedAttribs[sMediaTypeAttribute];
-
- OUString sVersion = aConvertedAttribs[sVersionAttribute];
+ const OUString& sVersion = aConvertedAttribs[sVersionAttribute];
if ( sVersion.getLength() )
- {
- aSequence[nNumProperty].Name = sVersionProperty;
- aSequence[nNumProperty++].Value <<= sVersion;
- }
+ setProperty( PKG_MNFST_VERSION, sVersion );
- OUString sSize = aConvertedAttribs[sSizeAttribute];
+ const OUString& sSize = aConvertedAttribs[sSizeAttribute];
if ( sSize.getLength() )
- {
- sal_Int32 nSize;
- nSize = sSize.toInt32();
- aSequence[nNumProperty].Name = sSizeProperty;
- aSequence[nNumProperty++].Value <<= nSize;
- }
+ setProperty( PKG_MNFST_UCOMPSIZE, sSize.toInt32() );
}
else if ( aStack.size() > 1 )
{
ManifestStack::reverse_iterator aIter = aStack.rbegin();
aIter++;
- if ( aIter->m_aConvertedName.equals( sFileEntryElement ) )
+ if ( aIter->m_aConvertedName.equalsAscii( ELEMENT_FILE_ENTRY ) )
{
- if ( aConvertedName.equals( sEncryptionDataElement ) )
+ if ( aConvertedName.equalsAscii( ELEMENT_ENCRYPTION_DATA ) )
{
// If this element exists, then this stream is encrypted and we need
// to import the initialisation vector, salt and iteration count used
nDerivedKeySize = 0;
- OUString aString = aConvertedAttribs[sChecksumTypeAttribute];
if ( !bIgnoreEncryptData )
{
- if ( aString.equals( sSHA1_1k_Name ) || aString.equals( sSHA1_1k_URL ) )
- {
- aSequence[nNumProperty].Name = sDigestAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA1_1K;
- }
- else if ( aString.equals( sSHA256_1k_URL ) )
- {
- aSequence[nNumProperty].Name = sDigestAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256_1K;
- }
+ long nDigestId = 0;
+ const OUString& rChecksumType = aConvertedAttribs[sChecksumTypeAttribute];
+ if( rChecksumType.equalsAscii( SHA1_1K_NAME )
+ || rChecksumType.equalsAscii( SHA1_1K_URL ) )
+ nDigestId = xml::crypto::DigestID::SHA1_1K;
+ else if ( rChecksumType.equalsAscii( SHA256_1K_URL ) )
+ nDigestId = xml::crypto::DigestID::SHA256_1K;
else
- bIgnoreEncryptData = sal_True;
+ bIgnoreEncryptData = true;
if ( !bIgnoreEncryptData )
{
- aString = aConvertedAttribs[sChecksumAttribute];
+ setProperty( PKG_MNFST_DIGESTALG, nDigestId );
+ const OUString& sChecksumData = aConvertedAttribs[sChecksumAttribute];
uno::Sequence < sal_Int8 > aDecodeBuffer;
- Base64Codec::decodeBase64( aDecodeBuffer, aString );
- aSequence[nNumProperty].Name = sDigestProperty;
- aSequence[nNumProperty++].Value <<= aDecodeBuffer;
+ ::sax::Converter::decodeBase64( aDecodeBuffer, sChecksumData );
+ setProperty( PKG_MNFST_DIGEST, aDecodeBuffer );
}
}
}
}
- else if ( aIter->m_aConvertedName.equals( sEncryptionDataElement ) )
+ else if ( aIter->m_aConvertedName.equalsAscii( ELEMENT_ENCRYPTION_DATA ) )
{
- if ( aConvertedName == sAlgorithmElement )
+ if ( aConvertedName.equalsAscii( ELEMENT_ALGORITHM ) )
{
if ( !bIgnoreEncryptData )
{
- OUString aString = aConvertedAttribs[sAlgorithmNameAttribute];
- if ( aString.equals( sBlowfish_Name ) || aString.equals( sBlowfish_URL ) )
- {
- aSequence[nNumProperty].Name = sEncryptionAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::BLOWFISH_CFB_8;
- }
- else if ( aString.equals( sAES256_URL ) )
+ long nCypherId = 0;
+ const OUString& rAlgoName = aConvertedAttribs[sAlgorithmNameAttribute];
+ if ( rAlgoName.equalsAscii( BLOWFISH_NAME )
+ || rAlgoName.equalsAscii( BLOWFISH_URL ) )
+ nCypherId = xml::crypto::CipherID::BLOWFISH_CFB_8;
+ else if( rAlgoName.equalsAscii( AES256_URL ) )
{
- aSequence[nNumProperty].Name = sEncryptionAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ nCypherId = xml::crypto::CipherID::AES_CBC_W3C_PADDING;
OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 32, "Unexpected derived key length!" );
nDerivedKeySize = 32;
}
- else if ( aString.equals( sAES192_URL ) )
+ else if( rAlgoName.equalsAscii( AES192_URL ) )
{
- aSequence[nNumProperty].Name = sEncryptionAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ nCypherId = xml::crypto::CipherID::AES_CBC_W3C_PADDING;
OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 24, "Unexpected derived key length!" );
nDerivedKeySize = 24;
}
- else if ( aString.equals( sAES128_URL ) )
+ else if( rAlgoName.equalsAscii( AES128_URL ) )
{
- aSequence[nNumProperty].Name = sEncryptionAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ nCypherId = xml::crypto::CipherID::AES_CBC_W3C_PADDING;
OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 16, "Unexpected derived key length!" );
nDerivedKeySize = 16;
}
else
- bIgnoreEncryptData = sal_True;
+ bIgnoreEncryptData = true;
if ( !bIgnoreEncryptData )
{
- aString = aConvertedAttribs[sInitialisationVectorAttribute];
+ setProperty( PKG_MNFST_ENCALG, nCypherId );
+ const OUString& sInitVector = aConvertedAttribs[sInitialisationVectorAttribute];
uno::Sequence < sal_Int8 > aDecodeBuffer;
- Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
- aSequence[nNumProperty].Name = sInitialisationVectorProperty;
- aSequence[nNumProperty++].Value <<= aDecodeBuffer;
+ ::sax::Converter::decodeBase64 ( aDecodeBuffer, sInitVector );
+ setProperty( PKG_MNFST_INIVECTOR, aDecodeBuffer );
}
}
}
- else if ( aConvertedName == sKeyDerivationElement )
+ else if ( aConvertedName.equalsAscii( ELEMENT_KEY_DERIVATION ) )
{
if ( !bIgnoreEncryptData )
{
- OUString aString = aConvertedAttribs[sKeyDerivationNameAttribute];
- if ( aString.equals( sPBKDF2_Name ) || aString.equals( sPBKDF2_URL ) )
+ const OUString& rKeyDerivString = aConvertedAttribs[sKeyDerivationNameAttribute];
+ if ( rKeyDerivString.equalsAscii( PBKDF2_NAME ) || rKeyDerivString.equalsAscii( PBKDF2_URL ) )
{
- aString = aConvertedAttribs[sSaltAttribute];
+ const OUString& rSaltString = aConvertedAttribs[sSaltAttribute];
uno::Sequence < sal_Int8 > aDecodeBuffer;
- Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
- aSequence[nNumProperty].Name = sSaltProperty;
- aSequence[nNumProperty++].Value <<= aDecodeBuffer;
-
- aString = aConvertedAttribs[sIterationCountAttribute];
- aSequence[nNumProperty].Name = sIterationCountProperty;
- aSequence[nNumProperty++].Value <<= aString.toInt32();
+ ::sax::Converter::decodeBase64 ( aDecodeBuffer, rSaltString );
+ setProperty( PKG_MNFST_SALT, aDecodeBuffer );
- aString = aConvertedAttribs[sKeySizeAttribute];
- if ( aString.getLength() )
+ const OUString& rIterationCount = aConvertedAttribs[sIterationCountAttribute];
+ setProperty( PKG_MNFST_ITERATION, rIterationCount.toInt32() );
+
+ const OUString& rKeySize = aConvertedAttribs[sKeySizeAttribute];
+ if ( rKeySize.getLength() )
{
- sal_Int32 nKey = aString.toInt32();
+ const sal_Int32 nKey = rKeySize.toInt32();
OSL_ENSURE( !nDerivedKeySize || nKey == nDerivedKeySize , "Provided derived key length differs from the expected one!" );
nDerivedKeySize = nKey;
}
@@ -266,28 +227,21 @@ void SAL_CALL ManifestImport::startEleme
else if ( nDerivedKeySize != 16 )
OSL_ENSURE( sal_False, "Default derived key length differs from the expected one!" );
- aSequence[nNumProperty].Name = sDerivedKeySizeProperty;
- aSequence[nNumProperty++].Value <<= nDerivedKeySize;
+ setProperty( PKG_MNFST_DERKEYSIZE, nDerivedKeySize );
}
else
- bIgnoreEncryptData = sal_True;
+ bIgnoreEncryptData = true;
}
}
- else if ( aConvertedName == sStartKeyAlgElement )
+ else if ( aConvertedName.equalsAscii( ELEMENT_START_KEY_GENERATION ) )
{
- OUString aString = aConvertedAttribs[sStartKeyAlgNameAttribute];
- if ( aString.equals( sSHA256_URL ) )
- {
- aSequence[nNumProperty].Name = sStartKeyAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256;
- }
- else if ( aString.equals( sSHA1_Name ) || aString.equals( sSHA1_URL ) )
- {
- aSequence[nNumProperty].Name = sStartKeyAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA1;
- }
+ const OUString& rSKeyAlg = aConvertedAttribs[sStartKeyAlgNameAttribute];
+ if ( rSKeyAlg.equalsAscii( SHA256_URL ) )
+ setProperty( PKG_MNFST_STARTALG, xml::crypto::DigestID::SHA256 );
+ else if ( rSKeyAlg.equalsAscii( SHA1_NAME ) || rSKeyAlg.equalsAscii( SHA1_URL ) )
+ setProperty( PKG_MNFST_STARTALG, xml::crypto::DigestID::SHA1 );
else
- bIgnoreEncryptData = sal_True;
+ bIgnoreEncryptData = true;
}
}
}
@@ -297,19 +251,41 @@ void SAL_CALL ManifestImport::startEleme
void SAL_CALL ManifestImport::endElement( const OUString& aName )
throw( xml::sax::SAXException, uno::RuntimeException )
{
- ::rtl::OUString aConvertedName = ConvertName( aName );
- if ( !aStack.empty() && aStack.rbegin()->m_aConvertedName.equals( aConvertedName ) )
- {
- if ( aConvertedName.equals( sFileEntryElement ) )
- {
- aSequence.realloc ( nNumProperty );
- bIgnoreEncryptData = sal_False;
- rManVector.push_back ( aSequence );
- nNumProperty = 0;
- }
+ if( aStack.empty() )
+ return;
+
+ const OUString aConvertedName = ConvertName( aName );
+ if( !aStack.rbegin()->m_aConvertedName.equals( aConvertedName ) )
+ return;
+
+ aStack.pop_back();
+
+ if( !aConvertedName.equalsAscii( ELEMENT_FILE_ENTRY ) )
+ return;
+
+ // create the property sequence
+ // Put full-path property first for MBA
+ // TODO: get rid of fullpath-first requirement
+ const bool bHasFullPath = maValues[PKG_MNFST_FULLPATH].hasValue();
+ OSL_ENSURE( bHasFullPath, "Full path missing in manifest" );
+
+ int nNumProperty = bHasFullPath ? 1 : 0;
+ PropertyValue aProperties[ PKG_SIZE_ENCR_MNFST ];
+ for( int i = 0; i < PKG_SIZE_ENCR_MNFST; ++i)
+ {
+ if(! maValues[i].hasValue() )
+ continue;
- aStack.pop_back();
+ const int nDest = (i == PKG_MNFST_FULLPATH) ? 0 : nNumProperty++;
+ PropertyValue& rProp = aProperties[ nDest ];
+ rProp.Name = OUString::createFromAscii( getMnfstPropName(i));
+ rProp.Value = maValues[i];
+ maValues[i].clear();
}
+
+ // add the property sequence to the vector of manifests
+ rManVector.push_back ( PropertyValues( aProperties, nNumProperty ) );
+ bIgnoreEncryptData = false;
}
// ---------------------------------------------------
@@ -382,6 +358,7 @@ void SAL_CALL ManifestImport::setDocumen
return aConvertedName;
}
+
// ---------------------------------------------------
::rtl::OUString ManifestImport::ConvertNameWithNamespace( const ::rtl::OUString& aName, const StringHashMap& aNamespaces )
{
@@ -399,8 +376,8 @@ void SAL_CALL ManifestImport::setDocumen
StringHashMap::const_iterator aIter = aNamespaces.find( aNsAlias );
if ( aIter != aNamespaces.end()
- && ( aIter->second.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MANIFEST_NAMESPACE ) ) )
- || aIter->second.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MANIFEST_OASIS_NAMESPACE ) ) ) ) )
+ && ( aIter->second.equalsAscii( MANIFEST_NAMESPACE )
+ || aIter->second.equalsAscii( MANIFEST_OASIS_NAMESPACE ) ) )
{
// no check for manifest.xml consistency currently since the old versions have supported inconsistent documents as well
aResult = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MANIFEST_NSPREFIX ) );
Modified: incubator/ooo/branches/writer001/main/package/source/manifest/ManifestImport.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/package/source/manifest/ManifestImport.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/package/source/manifest/ManifestImport.hxx (original)
+++ incubator/ooo/branches/writer001/main/package/source/manifest/ManifestImport.hxx Mon Aug 20 11:46:19 2012
@@ -28,8 +28,10 @@
#ifndef _COM_SUN_STAR_XML_SAX_XDUCUMENTHANDLER_HPP_
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#endif
+#include "PackageConstants.hxx"
#include <vector>
+#include <com/sun/star/beans/PropertyValues.hpp>
#include <HashMaps.hxx>
namespace com { namespace sun { namespace star {
@@ -58,19 +60,12 @@ typedef ::std::vector< ManifestScopeEntr
class ManifestImport : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler >
{
protected:
- com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aSequence;
- sal_Int16 nNumProperty;
+ ::com::sun::star::uno::Any maValues[ PKG_SIZE_ENCR_MNFST ];
+
+ ::std::vector < ::com::sun::star::beans::PropertyValues > & rManVector;
ManifestStack aStack;
- sal_Bool bIgnoreEncryptData;
sal_Int32 nDerivedKeySize;
- ::std::vector < ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > > & rManVector;
-
- const ::rtl::OUString sFileEntryElement;
- const ::rtl::OUString sManifestElement;
- const ::rtl::OUString sEncryptionDataElement;
- const ::rtl::OUString sAlgorithmElement;
- const ::rtl::OUString sStartKeyAlgElement;
- const ::rtl::OUString sKeyDerivationElement;
+ bool bIgnoreEncryptData;
const ::rtl::OUString sCdataAttribute;
const ::rtl::OUString sMediaTypeAttribute;
@@ -87,39 +82,6 @@ protected:
const ::rtl::OUString sChecksumAttribute;
const ::rtl::OUString sChecksumTypeAttribute;
- const ::rtl::OUString sFullPathProperty;
- const ::rtl::OUString sMediaTypeProperty;
- const ::rtl::OUString sVersionProperty;
- const ::rtl::OUString sIterationCountProperty;
- const ::rtl::OUString sDerivedKeySizeProperty;
- const ::rtl::OUString sSaltProperty;
- const ::rtl::OUString sInitialisationVectorProperty;
- const ::rtl::OUString sSizeProperty;
- const ::rtl::OUString sDigestProperty;
- const ::rtl::OUString sEncryptionAlgProperty;
- const ::rtl::OUString sStartKeyAlgProperty;
- const ::rtl::OUString sDigestAlgProperty;
-
- const ::rtl::OUString sWhiteSpace;
-
- const ::rtl::OUString sSHA256_URL;
- const ::rtl::OUString sSHA1_Name;
- const ::rtl::OUString sSHA1_URL;
-
- const ::rtl::OUString sSHA256_1k_URL;
- const ::rtl::OUString sSHA1_1k_Name;
- const ::rtl::OUString sSHA1_1k_URL;
-
- const ::rtl::OUString sBlowfish_Name;
- const ::rtl::OUString sBlowfish_URL;
- const ::rtl::OUString sAES128_URL;
- const ::rtl::OUString sAES192_URL;
- const ::rtl::OUString sAES256_URL;
-
- const ::rtl::OUString sPBKDF2_Name;
- const ::rtl::OUString sPBKDF2_URL;
-
-
::rtl::OUString PushNameAndNamespaces( const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs,
StringHashMap& o_aConvertedAttribs );
Modified: incubator/ooo/branches/writer001/main/package/source/manifest/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/package/source/manifest/makefile.mk?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/package/source/manifest/makefile.mk (original)
+++ incubator/ooo/branches/writer001/main/package/source/manifest/makefile.mk Mon Aug 20 11:46:19 2012
@@ -41,7 +41,6 @@ SLOFILES= \
$(SLO)$/ManifestWriter.obj \
$(SLO)$/ManifestImport.obj \
$(SLO)$/ManifestExport.obj \
- $(SLO)$/Base64Codec.obj \
$(SLO)$/UnoRegister.obj
.ENDIF # L10N_framework
Modified: incubator/ooo/branches/writer001/main/package/util/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/package/util/makefile.mk?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/package/util/makefile.mk (original)
+++ incubator/ooo/branches/writer001/main/package/util/makefile.mk Mon Aug 20 11:46:19 2012
@@ -59,7 +59,8 @@ SHL1STDLIBS=\
$(CPPUHELPERLIB) \
$(COMPHELPERLIB) \
$(SALLIB) \
- $(ZLIB3RDLIB)
+ $(ZLIB3RDLIB) \
+ $(SAXLIB)
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
SHL1LIBS=$(LIB1TARGET)
Modified: incubator/ooo/branches/writer001/main/python/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/python/makefile.mk?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/python/makefile.mk (original)
+++ incubator/ooo/branches/writer001/main/python/makefile.mk Mon Aug 20 11:46:19 2012
@@ -42,16 +42,15 @@ all:
TARFILE_NAME=Python-$(PYVERSION)
-TARFILE_MD5=e81c2f0953aa60f8062c05a4673f2be0
+TARFILE_MD5=c57477edd6d18bd9eeca2f21add73919
PATCH_FILES=\
- Python-$(PYVERSION).patch \
- Python-parallel-make.patch \
- Python-ssl.patch \
- Python-2.6.1-sysbase.patch\
- Python-2.6.1-nohardlink.patch \
- Python-disable-dbm.patch \
- Python-linux3.patch \
- Python-subversion-1-7.patch
+ python-solaris.patch \
+ python-freebsd.patch \
+ python-md5.patch \
+ python-ssl.patch \
+ python-$(PYVERSION)-sysbase.patch \
+ python-$(PYVERSION)-nohardlink.patch \
+ python-$(PYVERSION)-pcbuild.patch
CONFIGURE_DIR=
@@ -83,7 +82,7 @@ BUILD_ACTION=$(ENV_BUILD) $(GNUMAKE) -j$
# WINDOWS
# ----------------------------------
.IF "$(COM)"=="GCC"
-PATCH_FILES=Python-$(PYVERSION)-mingw.patch
+PATCH_FILES=python-$(PYVERSION)-mingw.patch
BUILD_DIR=
MYCWD=$(shell cygpath -m $(shell @pwd))/$(INPATH)/misc/build
python_CFLAGS=-mno-cygwin -mthreads
Modified: incubator/ooo/branches/writer001/main/python/prj/d.lst
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/python/prj/d.lst?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/python/prj/d.lst (original)
+++ incubator/ooo/branches/writer001/main/python/prj/d.lst Mon Aug 20 11:46:19 2012
@@ -30,74 +30,85 @@ mkdir: %_DEST%\lib%_EXT%\python\lib2to3\
mkdir: %_DEST%\lib%_EXT%\python\sqlite3
mkdir: %_DEST%\lib%_EXT%\python\ctypes
mkdir: %_DEST%\lib%_EXT%\python\ctypes\macholib
-
-..\%__SRC%\misc\build\Python-2.6.1\Lib\* %_DEST%\lib%_EXT%\python\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\lib-old\* %_DEST%\lib%_EXT%\python\lib-old\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\lib-tk\* %_DEST%\lib%_EXT%\python\lib-tk\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\site-packages\* %_DEST%\lib%_EXT%\python\site-packages\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\encodings\* %_DEST%\lib%_EXT%\python\encodings\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\email\* %_DEST%\lib%_EXT%\python\email\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\email\mime\* %_DEST%\lib%_EXT%\python\email\mime\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\compiler\* %_DEST%\lib%_EXT%\python\compiler\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\hotshot\* %_DEST%\lib%_EXT%\python\hotshot\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\distutils\* %_DEST%\lib%_EXT%\python\distutils\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\distutils\command\* %_DEST%\lib%_EXT%\python\distutils\command\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\xml\* %_DEST%\lib%_EXT%\python\xml\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\xml\dom\* %_DEST%\lib%_EXT%\python\xml\dom\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\xml\parsers\* %_DEST%\lib%_EXT%\python\xml\parsers\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\xml\sax\* %_DEST%\lib%_EXT%\python\xml\sax\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\curses\* %_DEST%\lib%_EXT%\python\curses\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\plat-linux2\* %_DEST%\lib%_EXT%\python\plat-linux2\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\config\* %_DEST%\lib%_EXT%\python\config\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\bsddb\* %_DEST%\lib%_EXT%\python\bsddb\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\logging\* %_DEST%\lib%_EXT%\python\logging\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\idlelib\* %_DEST%\lib%_EXT%\python\idlelib\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\idlelib\Icons\* %_DEST%\lib%_EXT%\python\idlelib\Icons\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\wsgiref\* %_DEST%\lib%_EXT%\python\wsgiref\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\json\* %_DEST%\lib%_EXT%\python\json\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\lib2to3\* %_DEST%\lib%_EXT%\python\lib2to3\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\lib2to3\fixes\* %_DEST%\lib%_EXT%\python\lib2to3\fixes\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\lib2to3\pgen2\* %_DEST%\lib%_EXT%\python\lib2to3\pgen2\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\sqlite3\* %_DEST%\lib%_EXT%\python\sqlite3\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\ctypes\* %_DEST%\lib%_EXT%\python\ctypes\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\ctypes\macholib\* %_DEST%\lib%_EXT%\python\ctypes\macholib\*
-..\%__SRC%\misc\build\Python-2.6.1\Lib\xml\etree\* %_DEST%\lib%_EXT%\python\xml\etree
+mkdir: %_DEST%\lib%_EXT%\python\importlib
+mkdir: %_DEST%\lib%_EXT%\python\multiprocessing
+mkdir: %_DEST%\lib%_EXT%\python\multiprocessing\dummy
+mkdir: %_DEST%\lib%_EXT%\python\unittest
+mkdir: %_DEST%\lib%_EXT%\python\python2.7\config
+
+..\%__SRC%\misc\build\Python-2.7.3\Lib\* %_DEST%\lib%_EXT%\python\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\lib-old\* %_DEST%\lib%_EXT%\python\lib-old\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\lib-tk\* %_DEST%\lib%_EXT%\python\lib-tk\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\site-packages\* %_DEST%\lib%_EXT%\python\site-packages\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\encodings\* %_DEST%\lib%_EXT%\python\encodings\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\email\* %_DEST%\lib%_EXT%\python\email\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\email\mime\* %_DEST%\lib%_EXT%\python\email\mime\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\compiler\* %_DEST%\lib%_EXT%\python\compiler\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\hotshot\* %_DEST%\lib%_EXT%\python\hotshot\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\distutils\* %_DEST%\lib%_EXT%\python\distutils\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\distutils\command\* %_DEST%\lib%_EXT%\python\distutils\command\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\xml\* %_DEST%\lib%_EXT%\python\xml\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\xml\dom\* %_DEST%\lib%_EXT%\python\xml\dom\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\xml\parsers\* %_DEST%\lib%_EXT%\python\xml\parsers\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\xml\sax\* %_DEST%\lib%_EXT%\python\xml\sax\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\curses\* %_DEST%\lib%_EXT%\python\curses\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\plat-linux2\* %_DEST%\lib%_EXT%\python\plat-linux2\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\config\* %_DEST%\lib%_EXT%\python\config\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\bsddb\* %_DEST%\lib%_EXT%\python\bsddb\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\logging\* %_DEST%\lib%_EXT%\python\logging\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\idlelib\* %_DEST%\lib%_EXT%\python\idlelib\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\idlelib\Icons\* %_DEST%\lib%_EXT%\python\idlelib\Icons\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\wsgiref\* %_DEST%\lib%_EXT%\python\wsgiref\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\json\* %_DEST%\lib%_EXT%\python\json\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\lib2to3\* %_DEST%\lib%_EXT%\python\lib2to3\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\lib2to3\fixes\* %_DEST%\lib%_EXT%\python\lib2to3\fixes\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\lib2to3\pgen2\* %_DEST%\lib%_EXT%\python\lib2to3\pgen2\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\sqlite3\* %_DEST%\lib%_EXT%\python\sqlite3\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\ctypes\* %_DEST%\lib%_EXT%\python\ctypes\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\ctypes\macholib\* %_DEST%\lib%_EXT%\python\ctypes\macholib\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\xml\etree\* %_DEST%\lib%_EXT%\python\xml\etree
+..\%__SRC%\misc\build\Python-2.7.3\Lib\xml\etree\* %_DEST%\lib%_EXT%\python\xml\etree
+..\%__SRC%\misc\build\Python-2.7.3\Lib\importlib\* %_DEST%\lib%_EXT%\python\importlib\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\multiprocessing\* %_DEST%\lib%_EXT%\python\multiprocessing\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\multiprocessing\dummy\* %_DEST%\lib%_EXT%\python\multiprocessing\dummy\*
+..\%__SRC%\misc\build\Python-2.7.3\Lib\unittest\* %_DEST%\lib%_EXT%\python\unittest\*
+..\%__SRC%\misc\build\Python-2.7.3\Makefile %_DEST%\lib%_EXT%\python\python2.7\config\Makefile
..\pyversion.mk %_DEST%\inc%_EXT%\pyversion.mk
-..\%__SRC%\misc\build\Python-2.6.1\Include\* %_DEST%\inc%_EXT%\python\*
+..\%__SRC%\misc\build\Python-2.7.3\Include\* %_DEST%\inc%_EXT%\python\*
#unix ONLY !
..\%__SRC%\misc\build\python-inst\bin\python %_DEST%\bin%_EXT%\python
-..\%__SRC%\misc\build\Python-2.6.1\pyconfig.h %_DEST%\inc%_EXT%\python\pyconfig.h
-..\%__SRC%\misc\build\python-inst\lib\python2.6\lib-dynload\* %_DEST%\lib%_EXT%\python\lib-dynload\*
-..\%__SRC%\misc\build\python-inst\bin\python2.6 %_DEST%\bin%_EXT%\python
-..\%__SRC%\misc\build\python-inst\lib\libpython2.6.so.1.0 %_DEST%\lib%_EXT%\libpython2.6.so.1.0
-symlink: %_DEST%\lib%_EXT%\libpython2.6.so.1.0 %_DEST%\lib%_EXT%\libpython2.6.so
+..\%__SRC%\misc\build\Python-2.7.3\pyconfig.h %_DEST%\inc%_EXT%\python\pyconfig.h
+..\%__SRC%\misc\build\python-inst\lib\python2.7\lib-dynload\* %_DEST%\lib%_EXT%\python\lib-dynload\*
+..\%__SRC%\misc\build\python-inst\bin\python2.7 %_DEST%\bin%_EXT%\python
+..\%__SRC%\misc\build\python-inst\lib\libpython2.7.so.1.0 %_DEST%\lib%_EXT%\libpython2.7.so.1.0
+symlink: %_DEST%\lib%_EXT%\libpython2.7.so.1.0 %_DEST%\lib%_EXT%\libpython2.7.so
# MacOS X
-..\%__SRC%\misc\build\python-inst\lib\libpython2.6.dylib %_DEST%\lib%_EXT%\libpython2.6.dylib
+..\%__SRC%\misc\build\python-inst\lib\libpython2.7.dylib %_DEST%\lib%_EXT%\libpython2.7.dylib
#MingW ONLY !
..\%__SRC%\misc\build\python-inst\bin\python.exe %_DEST%\bin%_EXT%\python.exe
-..\%__SRC%\misc\build\Python-2.6.1\libpython2.6.dll %_DEST%\bin%_EXT%\libpython2.6.dll
+..\%__SRC%\misc\build\Python-2.7.3\libpython2.7.dll %_DEST%\bin%_EXT%\libpython2.7.dll
# WINDOWS ONLY !
..\%__SRC%\misc\build\pyconfig.h %_DEST%\inc%_EXT%\python\pyconfig.h
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\python.exe %_DEST%\bin%_EXT%\python.exe
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\python26.dll %_DEST%\bin%_EXT%\python26.dll
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\python26.lib %_DEST%\lib%_EXT%\python26.lib
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\_socket.pyd %_DEST%\lib%_EXT%\python\_socket.pyd
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\_ssl.pyd %_DEST%\lib%_EXT%\python\_ssl.pyd
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\select.pyd %_DEST%\lib%_EXT%\python\select.pyd
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\unicodedata.pyd %_DEST%\lib%_EXT%\python\unicodedata.pyd
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\winsound.pyd %_DEST%\lib%_EXT%\python\winsound.pyd
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\pyexpat.pyd %_DEST%\lib%_EXT%\python\pyexpat.pyd
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\_testcapi.pyd %_DEST%\lib%_EXT%\python\_testcapi.pyd
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\_multiprocessing.pyd %_DEST%\lib%_EXT%\python\_multiprocessing.pyd
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\_msi.pyd %_DEST%\lib%_EXT%\python\_msi.pyd
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\_elementtree.pyd %_DEST%\lib%_EXT%\python\_elementtree.pyd
-..\%__SRC%\misc\build\Python-2.6.1\PCbuild\_ctypes.pyd %_DEST%\lib%_EXT%\python\_ctypes.pyd
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\python.exe %_DEST%\bin%_EXT%\python.exe
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\python27.dll %_DEST%\bin%_EXT%\python27.dll
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\python27.lib %_DEST%\lib%_EXT%\python27.lib
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\_socket.pyd %_DEST%\lib%_EXT%\python\_socket.pyd
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\_ssl.pyd %_DEST%\lib%_EXT%\python\_ssl.pyd
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\select.pyd %_DEST%\lib%_EXT%\python\select.pyd
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\unicodedata.pyd %_DEST%\lib%_EXT%\python\unicodedata.pyd
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\winsound.pyd %_DEST%\lib%_EXT%\python\winsound.pyd
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\pyexpat.pyd %_DEST%\lib%_EXT%\python\pyexpat.pyd
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\_testcapi.pyd %_DEST%\lib%_EXT%\python\_testcapi.pyd
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\_multiprocessing.pyd %_DEST%\lib%_EXT%\python\_multiprocessing.pyd
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\_msi.pyd %_DEST%\lib%_EXT%\python\_msi.pyd
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\_elementtree.pyd %_DEST%\lib%_EXT%\python\_elementtree.pyd
+..\%__SRC%\misc\build\Python-2.7.3\PCbuild\_ctypes.pyd %_DEST%\lib%_EXT%\python\_ctypes.pyd
#linklib: libpython.so.*.*.*
Modified: incubator/ooo/branches/writer001/main/python/pyversion.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/python/pyversion.mk?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/python/pyversion.mk (original)
+++ incubator/ooo/branches/writer001/main/python/pyversion.mk Mon Aug 20 11:46:19 2012
@@ -21,8 +21,8 @@
# when you want to change the python version, you must update the d.lst
# in the python project accordingly !!!
PYMAJOR=2
-PYMINOR=6
-PYMICRO=1
+PYMINOR=7
+PYMICRO=3
PYVERSION=$(PYMAJOR).$(PYMINOR).$(PYMICRO)
.IF "$(GUI)" == "UNX"
Modified: incubator/ooo/branches/writer001/main/pyuno/demo/biblioaccess.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/demo/biblioaccess.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/demo/biblioaccess.py (original)
+++ incubator/ooo/branches/writer001/main/pyuno/demo/biblioaccess.py Mon Aug 20 11:46:19 2012
@@ -26,9 +26,9 @@ from com.sun.star.sdb.CommandType import
def main():
connectionString = "socket,host=localhost,port=2002"
-
+
url = "uno:"+connectionString + ";urp;StarOffice.ComponentContext"
-
+
localCtx = uno.getComponentContext()
localSmgr = localCtx.ServiceManager
resolver = localSmgr.createInstanceWithContext(
@@ -43,12 +43,12 @@ def main():
rowset.execute();
- print "Identifier\tAuthor"
+ print("Identifier\tAuthor")
id = rowset.findColumn( "IDENTIFIER" )
author = rowset.findColumn( "AUTHOR" )
while rowset.next():
- print rowset.getString( id ) + "\t" + repr( rowset.getString( author ) )
+ print(rowset.getString( id ) + "\t" + repr( rowset.getString( author ) ))
rowset.dispose();
Modified: incubator/ooo/branches/writer001/main/pyuno/demo/hello_world_comp.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/demo/hello_world_comp.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/demo/hello_world_comp.py (original)
+++ incubator/ooo/branches/writer001/main/pyuno/demo/hello_world_comp.py Mon Aug 20 11:46:19 2012
@@ -30,32 +30,32 @@ class HelloWorldJob( unohelper.Base, XJo
def __init__( self, ctx ):
# store the component context for later use
self.ctx = ctx
-
+
def trigger( self, args ):
# note: args[0] == "HelloWorld", see below config settings
-
+
# retrieve the desktop object
desktop = self.ctx.ServiceManager.createInstanceWithContext(
"com.sun.star.frame.Desktop", self.ctx )
-
+
# get current document model
model = desktop.getCurrentComponent()
- # access the document's text property
- text = model.Text
+ # access the document's text property
+ text = model.Text
- # create a cursor
- cursor = text.createTextCursor()
+ # create a cursor
+ cursor = text.createTextCursor()
- # insert the text into the document
- text.insertString( cursor, "Hello World", 0 )
+ # insert the text into the document
+ text.insertString( cursor, "Hello World", 0 )
# pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper()
-#
+#
g_ImplementationHelper.addImplementation( \
- HelloWorldJob, # UNO object class
- "org.openoffice.comp.pyuno.demo.HelloWorld", # implemenation name
- ("com.sun.star.task.Job",),) # list of implemented services
- # (the only service)
+ HelloWorldJob, # UNO object class
+ "org.openoffice.comp.pyuno.demo.HelloWorld", # implemenation name
+ ("com.sun.star.task.Job",),) # list of implemented services
+ # (the only service)
Modified: incubator/ooo/branches/writer001/main/pyuno/demo/ooextract.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/demo/ooextract.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/demo/ooextract.py (original)
+++ incubator/ooo/branches/writer001/main/pyuno/demo/ooextract.py Mon Aug 20 11:46:19 2012
@@ -30,18 +30,18 @@ from com.sun.star.uno import Exception a
from com.sun.star.io import IOException,XInputStream, XOutputStream
class OutputStream( Base, XOutputStream ):
- def __init__( self ):
- self.closed = 0
-
- def closeOutput(self):
- self.closed = 1
-
- def writeBytes( self, seq ):
- sys.stdout.write( seq.value )
-
- def flush( self ):
- pass
-
+ def __init__( self ):
+ self.closed = 0
+
+ def closeOutput(self):
+ self.closed = 1
+
+ def writeBytes( self, seq ):
+ sys.stdout.write( seq.value )
+
+ def flush( self ):
+ pass
+
def main():
retVal = 0
@@ -60,12 +60,12 @@ def main():
url = "uno:" + a + ";urp;StarOffice.ComponentContext"
if o == "--html":
filterName = "HTML (StarWriter)"
-
- print filterName
+
+ print(filterName)
if not len( args ):
- usage()
- sys.exit()
-
+ usage()
+ sys.exit()
+
ctxLocal = uno.getComponentContext()
smgrLocal = ctxLocal.ServiceManager
@@ -90,25 +90,25 @@ def main():
raise UnoException( "Couldn't open stream for unknown reason", None )
doc.storeToURL("private:stream",outProps)
- except IOException, e:
+ except IOException as e:
sys.stderr.write( "Error during conversion: " + e.Message + "\n" )
retVal = 1
- except UnoException, e:
+ except UnoException as e:
sys.stderr.write( "Error ("+repr(e.__class__)+") during conversion:" + e.Message + "\n" )
retVal = 1
if doc:
doc.dispose()
- except UnoException, e:
+ except UnoException as e:
sys.stderr.write( "Error ("+repr(e.__class__)+") :" + e.Message + "\n" )
retVal = 1
- except getopt.GetoptError,e:
+ except getopt.GetoptError as e:
sys.stderr.write( str(e) + "\n" )
usage()
retVal = 1
sys.exit(retVal)
-
+
def usage():
sys.stderr.write( "usage: ooextract.py --help |\n"+
" [-c <connection-string> | --connection-string=<connection-string>\n"+
@@ -127,4 +127,4 @@ def usage():
" Instead of the text filter, the writer html filter is used\n"
)
-main()
+main()
Modified: incubator/ooo/branches/writer001/main/pyuno/demo/swritercomp.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/demo/swritercomp.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/demo/swritercomp.py (original)
+++ incubator/ooo/branches/writer001/main/pyuno/demo/swritercomp.py Mon Aug 20 11:46:19 2012
@@ -42,92 +42,92 @@ def insertTextIntoCell( table, cellName,
# implementing the interface com.sun.star.lang.XMain
# unohelper.Base implements the XTypeProvider interface
class SWriterComp(XMain,unohelper.Base):
- def __init__( self, ctx ):
- self.ctx = ctx
+ def __init__( self, ctx ):
+ self.ctx = ctx
- # implementation for XMain.run( [in] sequence< any > )
- def run( self,args ):
+ # implementation for XMain.run( [in] sequence< any > )
+ def run( self,args ):
- ctx = self.ctx
- smgr = ctx.ServiceManager
- desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
+ ctx = self.ctx
+ smgr = ctx.ServiceManager
+ desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
- # open a writer document
- doc = desktop.loadComponentFromURL( "private:factory/swriter","_blank", 0, () )
+ # open a writer document
+ doc = desktop.loadComponentFromURL( "private:factory/swriter","_blank", 0, () )
- text = doc.Text
- cursor = text.createTextCursor()
- text.insertString( cursor, "The first line in the newly created text document.\n", 0 )
- text.insertString( cursor, "Now we are in the second line\n" , 0 )
+ text = doc.Text
+ cursor = text.createTextCursor()
+ text.insertString( cursor, "The first line in the newly created text document.\n", 0 )
+ text.insertString( cursor, "Now we are in the second line\n" , 0 )
- # create a text table
- table = doc.createInstance( "com.sun.star.text.TextTable" )
+ # create a text table
+ table = doc.createInstance( "com.sun.star.text.TextTable" )
- # with 4 rows and 4 columns
- table.initialize( 4,4)
+ # with 4 rows and 4 columns
+ table.initialize( 4,4)
- text.insertTextContent( cursor, table, 0 )
- rows = table.Rows
+ text.insertTextContent( cursor, table, 0 )
+ rows = table.Rows
- table.setPropertyValue( "BackTransparent", uno.Bool(0) )
- table.setPropertyValue( "BackColor", 13421823 )
- row = rows.getByIndex(0)
- row.setPropertyValue( "BackTransparent", uno.Bool(0) )
- row.setPropertyValue( "BackColor", 6710932 )
+ table.setPropertyValue( "BackTransparent", uno.Bool(0) )
+ table.setPropertyValue( "BackColor", 13421823 )
+ row = rows.getByIndex(0)
+ row.setPropertyValue( "BackTransparent", uno.Bool(0) )
+ row.setPropertyValue( "BackColor", 6710932 )
- textColor = 16777215
+ textColor = 16777215
- insertTextIntoCell( table, "A1", "FirstColumn", textColor )
- insertTextIntoCell( table, "B1", "SecondColumn", textColor )
- insertTextIntoCell( table, "C1", "ThirdColumn", textColor )
- insertTextIntoCell( table, "D1", "SUM", textColor )
+ insertTextIntoCell( table, "A1", "FirstColumn", textColor )
+ insertTextIntoCell( table, "B1", "SecondColumn", textColor )
+ insertTextIntoCell( table, "C1", "ThirdColumn", textColor )
+ insertTextIntoCell( table, "D1", "SUM", textColor )
- values = ( (22.5,21.5,121.5),
- (5615.3,615.3,-615.3),
- (-2315.7,315.7,415.7) )
- table.getCellByName("A2").setValue(22.5)
- table.getCellByName("B2").setValue(5615.3)
- table.getCellByName("C2").setValue(-2315.7)
- table.getCellByName("D2").setFormula("sum <A2:C2>")
+ values = ( (22.5,21.5,121.5),
+ (5615.3,615.3,-615.3),
+ (-2315.7,315.7,415.7) )
+ table.getCellByName("A2").setValue(22.5)
+ table.getCellByName("B2").setValue(5615.3)
+ table.getCellByName("C2").setValue(-2315.7)
+ table.getCellByName("D2").setFormula("sum <A2:C2>")
- table.getCellByName("A3").setValue(21.5)
- table.getCellByName("B3").setValue(615.3)
- table.getCellByName("C3").setValue(-315.7)
- table.getCellByName("D3").setFormula("sum <A3:C3>")
+ table.getCellByName("A3").setValue(21.5)
+ table.getCellByName("B3").setValue(615.3)
+ table.getCellByName("C3").setValue(-315.7)
+ table.getCellByName("D3").setFormula("sum <A3:C3>")
- table.getCellByName("A4").setValue(121.5)
- table.getCellByName("B4").setValue(-615.3)
- table.getCellByName("C4").setValue(415.7)
- table.getCellByName("D4").setFormula("sum <A4:C4>")
+ table.getCellByName("A4").setValue(121.5)
+ table.getCellByName("B4").setValue(-615.3)
+ table.getCellByName("C4").setValue(415.7)
+ table.getCellByName("D4").setFormula("sum <A4:C4>")
- cursor.setPropertyValue( "CharColor", 255 )
- cursor.setPropertyValue( "CharShadowed", uno.Bool(1) )
+ cursor.setPropertyValue( "CharColor", 255 )
+ cursor.setPropertyValue( "CharShadowed", uno.Bool(1) )
- text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
- text.insertString( cursor, " This is a colored Text - blue with shadow\n" , 0 )
- text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
+ text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
+ text.insertString( cursor, " This is a colored Text - blue with shadow\n" , 0 )
+ text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
- textFrame = doc.createInstance( "com.sun.star.text.TextFrame" )
- textFrame.setSize( Size(15000,400))
- textFrame.setPropertyValue( "AnchorType" , AS_CHARACTER )
+ textFrame = doc.createInstance( "com.sun.star.text.TextFrame" )
+ textFrame.setSize( Size(15000,400))
+ textFrame.setPropertyValue( "AnchorType" , AS_CHARACTER )
- text.insertTextContent( cursor, textFrame, 0 )
+ text.insertTextContent( cursor, textFrame, 0 )
- textInTextFrame = textFrame.getText()
- cursorInTextFrame = textInTextFrame.createTextCursor()
- textInTextFrame.insertString( cursorInTextFrame, "The first line in the newly created text frame.", 0 )
- textInTextFrame.insertString( cursorInTextFrame, "\nWith this second line the height of the rame raises.",0)
- text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
+ textInTextFrame = textFrame.getText()
+ cursorInTextFrame = textInTextFrame.createTextCursor()
+ textInTextFrame.insertString( cursorInTextFrame, "The first line in the newly created text frame.", 0 )
+ textInTextFrame.insertString( cursorInTextFrame, "\nWith this second line the height of the rame raises.",0)
+ text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 )
- cursor.setPropertyValue( "CharColor", 65536 )
- cursor.setPropertyValue( "CharShadowed", uno.Bool(0) )
+ cursor.setPropertyValue( "CharColor", 65536 )
+ cursor.setPropertyValue( "CharShadowed", uno.Bool(0) )
- text.insertString( cursor, " That's all for now !!" , 0 )
- return 0
+ text.insertString( cursor, " That's all for now !!" , 0 )
+ return 0
# pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation( \
- SWriterComp,"org.openoffice.comp.pyuno.swriter",("org.openoffice.demo.SWriter",),)
+ SWriterComp,"org.openoffice.comp.pyuno.swriter",("org.openoffice.demo.SWriter",),)
Modified: incubator/ooo/branches/writer001/main/pyuno/demo/swritercompclient.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/demo/swritercompclient.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/demo/swritercompclient.py (original)
+++ incubator/ooo/branches/writer001/main/pyuno/demo/swritercompclient.py Mon Aug 20 11:46:19 2012
@@ -24,11 +24,10 @@ import uno
localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
- "com.sun.star.bridge.UnoUrlResolver", localContext )
+ "com.sun.star.bridge.UnoUrlResolver", localContext )
remoteContext = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
remoteSmgr = remoteContext.ServiceManager
pyComp = remoteSmgr.createInstanceWithContext( "org.openoffice.demo.SWriter" , remoteContext )
pyComp.run( (), )
-
Modified: incubator/ooo/branches/writer001/main/pyuno/inc/pyuno/pyuno.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/inc/pyuno/pyuno.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/inc/pyuno/pyuno.hxx (original)
+++ incubator/ooo/branches/writer001/main/pyuno/inc/pyuno/pyuno.hxx Mon Aug 20 11:46:19 2012
@@ -37,6 +37,12 @@
#pragma warning(pop)
#endif
#endif // #ifdef Py_PYTHON_H
+// Compatibility for older system Python (2.6 and previous)
+#ifndef PyVarObject_HEAD_INIT
+#define PyVarObject_HEAD_INIT(type, size) \
+ PyObject_HEAD_INIT(type) size,
+#endif
+
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/script/CannotConvertException.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
Modified: incubator/ooo/branches/writer001/main/pyuno/source/loader/pythonloader.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/source/loader/pythonloader.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/source/loader/pythonloader.py (original)
+++ incubator/ooo/branches/writer001/main/pyuno/source/loader/pythonloader.py Mon Aug 20 11:46:19 2012
@@ -34,112 +34,110 @@ g_supportedServices = "com.sun.star.loa
g_implementationName = "org.openoffice.comp.pyuno.Loader" # referenced by the native C++ loader !
def splitUrl( url ):
- nColon = url.find( ":" )
- if -1 == nColon:
- raise RuntimeException( "PythonLoader: No protocol in url " + url, None )
- return url[0:nColon], url[nColon+1:len(url)]
+ nColon = url.find( ":" )
+ if -1 == nColon:
+ raise RuntimeException( "PythonLoader: No protocol in url " + url, None )
+ return url[0:nColon], url[nColon+1:len(url)]
g_loadedComponents = {}
def checkForPythonPathBesideComponent( url ):
- path = unohelper.fileUrlToSystemPath( url+"/pythonpath.zip" );
- if DEBUG == 1:
- print "checking for existence of " + encfile( path )
- if 1 == os.access( encfile( path ), os.F_OK) and not path in sys.path:
- if DEBUG == 1:
- print "adding " + encfile( path ) + " to sys.path"
- sys.path.append( path )
-
- path = unohelper.fileUrlToSystemPath( url+"/pythonpath" );
- if 1 == os.access( encfile( path ), os.F_OK) and not path in sys.path:
- if DEBUG == 1:
- print "adding " + encfile( path ) + " to sys.path"
- sys.path.append( path )
+ path = unohelper.fileUrlToSystemPath( url+"/pythonpath.zip" );
+ if DEBUG == 1:
+ print("checking for existence of " + encfile( path ))
+ if 1 == os.access( encfile( path ), os.F_OK) and not path in sys.path:
+ if DEBUG == 1:
+ print("adding " + encfile( path ) + " to sys.path")
+ sys.path.append( path )
+
+ path = unohelper.fileUrlToSystemPath( url+"/pythonpath" );
+ if 1 == os.access( encfile( path ), os.F_OK) and not path in sys.path:
+ if DEBUG == 1:
+ print("adding " + encfile( path ) + " to sys.path")
+ sys.path.append( path )
def encfile(uni):
return uni.encode( sys.getfilesystemencoding())
class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ):
- def __init__(self, ctx ):
- if DEBUG:
- print "pythonloader.Loader ctor"
- self.ctx = ctx
-
- def getModuleFromUrl( self, url ):
- if DEBUG:
- print "pythonloader: interpreting url " +url
- protocol, dependent = splitUrl( url )
- if "vnd.sun.star.expand" == protocol:
- exp = self.ctx.getValueByName( "/singletons/com.sun.star.util.theMacroExpander" )
- url = exp.expandMacros(dependent)
- protocol,dependent = splitUrl( url )
-
- if DEBUG:
- print "pythonloader: after expansion " +protocol +":" + dependent
-
- try:
- if "file" == protocol:
- # remove \..\ sequence, which may be useful e.g. in the build env
- url = unohelper.absolutize( url, url )
-
- # did we load the module already ?
- mod = g_loadedComponents.get( url )
- if not mod:
- mod = imp.new_module("uno_component")
-
- # check for pythonpath.zip beside .py files
- checkForPythonPathBesideComponent( url[0:url.rfind('/')] )
-
- # read the file
- filename = unohelper.fileUrlToSystemPath( url )
- fileHandle = file( filename )
- src = fileHandle.read().replace("\r","")
- if not src.endswith( "\n" ):
- src = src + "\n"
-
- # compile and execute the module
- codeobject = compile( src, encfile(filename), "exec" )
- exec codeobject in mod.__dict__
- mod.__file__ = encfile(filename)
- g_loadedComponents[url] = mod
- return mod
- elif "vnd.openoffice.pymodule" == protocol:
- return __import__( dependent )
- else:
- raise RuntimeException( "PythonLoader: Unknown protocol " +
- protocol + " in url " +url, self )
- except ImportError, e:
- raise RuntimeException( "Couldn't load "+url+ " for reason "+str(e), None)
- return None
-
- def activate( self, implementationName, dummy, locationUrl, regKey ):
- if DEBUG:
- print "pythonloader.Loader.activate"
-
- mod = self.getModuleFromUrl( locationUrl )
- implHelper = mod.__dict__.get( "g_ImplementationHelper" , None )
- if implHelper == None:
- return mod.getComponentFactory( implementationName, self.ctx.ServiceManager, regKey )
- else:
- return implHelper.getComponentFactory( implementationName,regKey,self.ctx.ServiceManager)
-
- def writeRegistryInfo( self, regKey, dummy, locationUrl ):
- if DEBUG:
- print "pythonloader.Loader.writeRegistryInfo"
-
- mod = self.getModuleFromUrl( locationUrl )
- implHelper = mod.__dict__.get( "g_ImplementationHelper" , None )
- if implHelper == None:
- return mod.writeRegistryInfo( self.ctx.ServiceManager, regKey )
- else:
- return implHelper.writeRegistryInfo( regKey, self.ctx.ServiceManager )
+ def __init__(self, ctx ):
+ if DEBUG:
+ print("pythonloader.Loader ctor")
+ self.ctx = ctx
+
+ def getModuleFromUrl( self, url ):
+ if DEBUG:
+ print("pythonloader: interpreting url " +url)
+ protocol, dependent = splitUrl( url )
+ if "vnd.sun.star.expand" == protocol:
+ exp = self.ctx.getValueByName( "/singletons/com.sun.star.util.theMacroExpander" )
+ url = exp.expandMacros(dependent)
+ protocol,dependent = splitUrl( url )
+
+ if DEBUG:
+ print("pythonloader: after expansion " +protocol +":" + dependent)
+
+ try:
+ if "file" == protocol:
+ # remove \..\ sequence, which may be useful e.g. in the build env
+ url = unohelper.absolutize( url, url )
+
+ # did we load the module already ?
+ mod = g_loadedComponents.get( url )
+ if not mod:
+ mod = imp.new_module("uno_component")
+
+ # check for pythonpath.zip beside .py files
+ checkForPythonPathBesideComponent( url[0:url.rfind('/')] )
+
+ # read the file
+ filename = unohelper.fileUrlToSystemPath( url )
+ fileHandle = file( filename )
+ src = fileHandle.read().replace("\r","")
+ if not src.endswith( "\n" ):
+ src = src + "\n"
+
+ # compile and execute the module
+ codeobject = compile( src, encfile(filename), "exec" )
+ exec(codeobject, mod.__dict__)
+ mod.__file__ = encfile(filename)
+ g_loadedComponents[url] = mod
+ return mod
+ elif "vnd.openoffice.pymodule" == protocol:
+ return __import__( dependent )
+ else:
+ raise RuntimeException( "PythonLoader: Unknown protocol " +
+ protocol + " in url " +url, self )
+ except ImportError as e:
+ raise RuntimeException( "Couldn't load "+url+ " for reason "+str(e), None)
+ return None
+
+ def activate( self, implementationName, dummy, locationUrl, regKey ):
+ if DEBUG:
+ print("pythonloader.Loader.activate")
+
+ mod = self.getModuleFromUrl( locationUrl )
+ implHelper = mod.__dict__.get( "g_ImplementationHelper" , None )
+ if implHelper == None:
+ return mod.getComponentFactory( implementationName, self.ctx.ServiceManager, regKey )
+ else:
+ return implHelper.getComponentFactory( implementationName,regKey,self.ctx.ServiceManager)
+
+ def writeRegistryInfo( self, regKey, dummy, locationUrl ):
+ if DEBUG:
+ print("pythonloader.Loader.writeRegistryInfo")
+
+ mod = self.getModuleFromUrl( locationUrl )
+ implHelper = mod.__dict__.get( "g_ImplementationHelper" , None )
+ if implHelper == None:
+ return mod.writeRegistryInfo( self.ctx.ServiceManager, regKey )
+ else:
+ return implHelper.writeRegistryInfo( regKey, self.ctx.ServiceManager )
- def getImplementationName( self ):
- return g_implementationName
-
- def supportsService( self, ServiceName ):
- return ServiceName in self.serviceNames
-
- def getSupportedServiceNames( self ):
- return g_supportedServices
+ def getImplementationName( self ):
+ return g_implementationName
+ def supportsService( self, ServiceName ):
+ return ServiceName in self.serviceNames
+ def getSupportedServiceNames( self ):
+ return g_supportedServices
Modified: incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno.cxx (original)
+++ incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno.cxx Mon Aug 20 11:46:19 2012
@@ -639,8 +639,7 @@ static int PyUNO_cmp( PyObject *self, Py
static PyTypeObject PyUNOType =
{
- PyObject_HEAD_INIT (&PyType_Type)
- 0,
+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
const_cast< char * >("pyuno"),
sizeof (PyUNO),
0,
Modified: incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno_callable.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno_callable.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno_callable.cxx (original)
+++ incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno_callable.cxx Mon Aug 20 11:46:19 2012
@@ -191,8 +191,7 @@ PyObject* PyUNO_callable_call (PyObject*
static PyTypeObject PyUNO_callable_Type =
{
- PyObject_HEAD_INIT (&PyType_Type)
- 0,
+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
const_cast< char * >("PyUNO_callable"),
sizeof (PyUNO_callable),
0,
Modified: incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno_module.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno_module.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno_module.cxx (original)
+++ incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno_module.cxx Mon Aug 20 11:46:19 2012
@@ -486,9 +486,18 @@ static PyObject *isInterface( PyObject *
{
PyObject *obj = PyTuple_GetItem( args, 0 );
Runtime r;
+#if PY_MAJOR_VERSION >= 3
+ return PyLong_FromLong( isInterfaceClass( r, obj ) );
+#else
return PyInt_FromLong( isInterfaceClass( r, obj ) );
+
+#endif
}
+#if PY_MAJOR_VERSION >= 3
+ return PyLong_FromLong( 0 );
+#else
return PyInt_FromLong( 0 );
+#endif
}
static PyObject * generateUuid( PyObject *, PyObject * )
Modified: incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno_runtime.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno_runtime.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno_runtime.cxx (original)
+++ incubator/ooo/branches/writer001/main/pyuno/source/module/pyuno_runtime.cxx Mon Aug 20 11:46:19 2012
@@ -65,8 +65,7 @@ namespace pyuno
static PyTypeObject RuntimeImpl_Type =
{
- PyObject_HEAD_INIT (&PyType_Type)
- 0,
+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
const_cast< char * >("pyuno_runtime"),
sizeof (RuntimeImpl),
0,
@@ -438,7 +437,11 @@ PyRef Runtime::any2PyObject (const Any &
{
sal_Int32 l = 0;
a >>= l;
+#if PY_MAJOR_VERSION >= 3
+ return PyRef( PyLong_FromLong (l), SAL_NO_ACQUIRE );
+#else
return PyRef( PyInt_FromLong (l), SAL_NO_ACQUIRE );
+#endif
}
case typelib_TypeClass_UNSIGNED_LONG:
{
Modified: incubator/ooo/branches/writer001/main/pyuno/source/module/uno.py
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/pyuno/source/module/uno.py?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/pyuno/source/module/uno.py (original)
+++ incubator/ooo/branches/writer001/main/pyuno/source/module/uno.py Mon Aug 20 11:46:19 2012
@@ -31,8 +31,8 @@ _g_delegatee = __builtin__.__dict__["__i
def getComponentContext():
""" returns the UNO component context, that was used to initialize the python runtime.
- """
- return _g_ctx
+ """
+ return _g_ctx
def getConstantByName( constant ):
"Looks up the value of a idl constant by giving its explicit name"
@@ -41,7 +41,7 @@ def getConstantByName( constant ):
def getTypeByName( typeName):
""" returns a uno.Type instance of the type given by typeName. In case the
type does not exist, a com.sun.star.uno.RuntimeException is raised.
- """
+ """
return pyuno.getTypeByName( typeName )
def createUnoStruct( typeName, *args ):
@@ -70,7 +70,7 @@ def isInterface( obj ):
def generateUuid():
"returns a 16 byte sequence containing a newly generated uuid or guid, see rtl/uuid.h "
- return pyuno.generateUuid()
+ return pyuno.generateUuid()
def systemPathToFileUrl( systemPath ):
"returns a file-url for the given system path"
@@ -100,9 +100,9 @@ def setCurrentContext( newContext ):
"""
return pyuno.setCurrentContext( newContext )
-
+
class Enum:
- "Represents a UNO idl enum, use an instance of this class to explicitly pass a boolean to UNO"
+ "Represents a UNO idl enum, use an instance of this class to explicitly pass a boolean to UNO"
#typeName the name of the enum as a string
#value the actual value of this enum as a string
def __init__(self,typeName, value):
@@ -138,7 +138,7 @@ class Type:
return self.typeName.__hash__()
class Bool(object):
- """Represents a UNO boolean, use an instance of this class to explicitly
+ """Represents a UNO boolean, use an instance of this class to explicitly
pass a boolean to UNO.
Note: This class is deprecated. Use python's True and False directly instead
"""
@@ -161,13 +161,13 @@ class Char:
def __repr__(self):
return "<Char instance %s>" % (self.value, )
-
+
def __eq__(self, that):
if isinstance(that, (str, unicode)):
if len(that) > 1:
return False
return self.value == that[0]
- if isinstance(that, Char):
+ if isinstance(that, Char):
return self.value == that.value
return False
@@ -178,12 +178,12 @@ class Char:
# def __repr__(self):
# return "<ByteSequence instance %s>" % str.__repr__(self)
- # for a little bit compatitbility; setting value is not possible as
+ # for a little bit compatibility; setting value is not possible as
# strings are immutable
# def _get_value(self):
# return self
#
-# value = property(_get_value)
+# value = property(_get_value)
class ByteSequence:
def __init__(self, value):
@@ -236,7 +236,7 @@ class Any:
def invoke( object, methodname, argTuple ):
"use this function to pass exactly typed anys to the callee (using uno.Any)"
return pyuno.invoke( object, methodname, argTuple )
-
+
#---------------------------------------------------------------------------------------
# don't use any functions beyond this point, private section, likely to change
#---------------------------------------------------------------------------------------
@@ -254,56 +254,56 @@ def _uno_import( name, *optargs, **kwarg
mod = None
d = sys.modules
for x in modnames:
- if d.has_key(x):
- mod = d[x]
+ if x in d:
+ mod = d[x]
else:
- mod = pyuno.__class__(x) # How to create a module ??
+ mod = pyuno.__class__(x) # How to create a module ??
d = mod.__dict__
RuntimeException = pyuno.getClass( "com.sun.star.uno.RuntimeException" )
for x in fromlist:
- if not d.has_key(x):
- if x.startswith( "typeOf" ):
- try:
- d[x] = pyuno.getTypeByName( name + "." + x[6:len(x)] )
- except RuntimeException,e:
- raise ImportError( "type " + name + "." + x[6:len(x)] +" is unknown" )
- else:
- try:
- # check for structs, exceptions or interfaces
- d[x] = pyuno.getClass( name + "." + x )
- except RuntimeException,e:
- # check for enums
+ if x not in d:
+ if x.startswith( "typeOf" ):
try:
- d[x] = Enum( name , x )
- except RuntimeException,e2:
- # check for constants
- try:
- d[x] = getConstantByName( name + "." + x )
- except RuntimeException,e3:
- # no known uno type !
- raise ImportError( "type "+ name + "." +x + " is unknown" )
+ d[x] = pyuno.getTypeByName( name + "." + x[6:len(x)] )
+ except RuntimeException as e:
+ raise ImportError( "type " + name + "." + x[6:len(x)] +" is unknown" )
+ else:
+ try:
+ # check for structs, exceptions or interfaces
+ d[x] = pyuno.getClass( name + "." + x )
+ except RuntimeException as e:
+ # check for enums
+ try:
+ d[x] = Enum( name , x )
+ except RuntimeException as e2:
+ # check for constants
+ try:
+ d[x] = getConstantByName( name + "." + x )
+ except RuntimeException as e3:
+ # no known uno type !
+ raise ImportError( "type "+ name + "." +x + " is unknown" )
return mod
-# hook into the __import__ chain
+# hook into the __import__ chain
__builtin__.__dict__["__import__"] = _uno_import
-
+
# private function, don't use
def _impl_extractName(name):
- r = range (len(name)-1,0,-1)
+ r = list(range(len(name)-1,0,-1))
for i in r:
if name[i] == ".":
- name = name[i+1:len(name)]
- break
- return name
+ name = name[i+1:len(name)]
+ break
+ return name
# private, referenced from the pyuno shared library
def _uno_struct__init__(self,*args):
if len(args) == 1 and hasattr(args[0], "__class__") and args[0].__class__ == self.__class__ :
- self.__dict__["value"] = args[0]
+ self.__dict__["value"] = args[0]
else:
- self.__dict__["value"] = pyuno._createUnoStructHelper(self.__class__.__pyunostruct__,args)
-
+ self.__dict__["value"] = pyuno._createUnoStructHelper(self.__class__.__pyunostruct__,args)
+
# private, referenced from the pyuno shared library
def _uno_struct__getattr__(self,name):
return __builtin__.getattr(self.__dict__["value"],name)
@@ -315,14 +315,14 @@ def _uno_struct__setattr__(self,name,val
# private, referenced from the pyuno shared library
def _uno_struct__repr__(self):
return repr(self.__dict__["value"])
-
+
def _uno_struct__str__(self):
return str(self.__dict__["value"])
# private, referenced from the pyuno shared library
def _uno_struct__eq__(self,cmp):
if hasattr(cmp,"value"):
- return self.__dict__["value"] == cmp.__dict__["value"]
+ return self.__dict__["value"] == cmp.__dict__["value"]
return False
# referenced from pyuno shared lib and pythonscript.py
@@ -330,7 +330,7 @@ def _uno_extract_printable_stacktrace( t
mod = None
try:
mod = __import__("traceback")
- except ImportError,e:
+ except ImportError as e:
pass
ret = ""
if mod: