diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-01-25 22:35:24 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-01-25 22:35:24 +0100 |
commit | a2e88c92f9d23707d6aa72ecb635326f13a0d66a (patch) | |
tree | e6f76bc582887c0d79b8a23ec477d30e86eaedd0 | |
parent | 64b4e680a5af6677b4d8e5106fe02964fb305e4c (diff) |
autorecovery: introduce PersistentPath property at the document definition object
-rw-r--r-- | dbaccess/source/core/dataaccess/documentdefinition.cxx | 69 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/documentdefinition.hxx | 6 | ||||
-rw-r--r-- | dbaccess/source/core/misc/dbastrings.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/inc/dbastrings.hrc | 4 | ||||
-rw-r--r-- | dbaccess/source/inc/stringconstants.hrc | 1 |
5 files changed, 64 insertions, 21 deletions
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index d2fb5b15c405..1ed214036d66 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -632,15 +632,39 @@ IMPLEMENT_SERVICE_INFO1(ODocumentDefinition,"com.sun.star.comp.dba.ODocumentDefi //-------------------------------------------------------------------------- void ODocumentDefinition::registerProperties() { - registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME, PropertyAttribute::BOUND | PropertyAttribute::READONLY | PropertyAttribute::CONSTRAINED, - &m_pImpl->m_aProps.aTitle, ::getCppuType(&m_pImpl->m_aProps.aTitle)); - registerProperty(PROPERTY_AS_TEMPLATE, PROPERTY_ID_AS_TEMPLATE, PropertyAttribute::BOUND | PropertyAttribute::READONLY | PropertyAttribute::CONSTRAINED, - &m_pImpl->m_aProps.bAsTemplate, ::getCppuType(&m_pImpl->m_aProps.bAsTemplate)); - registerProperty(PROPERTY_PERSISTENT_NAME, PROPERTY_ID_PERSISTENT_NAME, PropertyAttribute::BOUND | PropertyAttribute::READONLY | PropertyAttribute::CONSTRAINED, - &m_pImpl->m_aProps.sPersistentName, ::getCppuType(&m_pImpl->m_aProps.sPersistentName)); - registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsForm")), PROPERTY_ID_IS_FORM, PropertyAttribute::BOUND | PropertyAttribute::READONLY | PropertyAttribute::CONSTRAINED, - &m_bForm, ::getCppuType(&m_bForm)); +#define REGISTER_PROPERTY( name, location ) \ + registerProperty( PROPERTY_##name, PROPERTY_ID_##name, PropertyAttribute::READONLY, &location, ::getCppuType( &location ) ); + +#define REGISTER_PROPERTY_BV( name, location ) \ + registerProperty( PROPERTY_##name, PROPERTY_ID_##name, PropertyAttribute::CONSTRAINED | PropertyAttribute::BOUND | PropertyAttribute::READONLY, &location, ::getCppuType( &location ) ); + + REGISTER_PROPERTY_BV( NAME, m_pImpl->m_aProps.aTitle ); + REGISTER_PROPERTY ( AS_TEMPLATE, m_pImpl->m_aProps.bAsTemplate ); + REGISTER_PROPERTY ( PERSISTENT_NAME, m_pImpl->m_aProps.sPersistentName ); + REGISTER_PROPERTY ( IS_FORM, m_bForm ); } + +// ----------------------------------------------------------------------------- +void SAL_CALL ODocumentDefinition::getFastPropertyValue( Any& o_rValue, sal_Int32 i_nHandle ) const +{ + if ( i_nHandle == PROPERTY_ID_PERSISTENT_PATH ) + { + ::rtl::OUString sPersistentPath; + if ( m_pImpl->m_aProps.sPersistentName.getLength() ) + { + ::rtl::OUStringBuffer aBuffer; + aBuffer.append( ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) ); + aBuffer.append( sal_Unicode( '/' ) ); + aBuffer.append( m_pImpl->m_aProps.sPersistentName ); + sPersistentPath = aBuffer.makeStringAndClear(); + } + o_rValue <<= sPersistentPath; + return; + } + + OPropertyStateContainer::getFastPropertyValue( o_rValue, i_nHandle ); +} + // ----------------------------------------------------------------------------- Reference< XPropertySetInfo > SAL_CALL ODocumentDefinition::getPropertySetInfo( ) throw(RuntimeException) { @@ -658,10 +682,21 @@ IPropertyArrayHelper& ODocumentDefinition::getInfoHelper() //-------------------------------------------------------------------------- IPropertyArrayHelper* ODocumentDefinition::createArrayHelper( ) const { + // properties maintained by our base class (see registerProperties) Sequence< Property > aProps; - describeProperties(aProps); - return new OPropertyArrayHelper(aProps); + describeProperties( aProps ); + + // properties not maintained by our base class + Sequence< Property > aManualProps( 1 ); + aManualProps[0].Name = PROPERTY_PERSISTENT_PATH; + aManualProps[0].Handle = PROPERTY_ID_PERSISTENT_PATH; + aManualProps[0].Type = ::getCppuType( static_cast< const ::rtl::OUString* >( NULL ) ); + aManualProps[0].Attributes = PropertyAttribute::READONLY; + + return new OPropertyArrayHelper( ::comphelper::concatSequences( aProps, aManualProps ) ); } + +// ----------------------------------------------------------------------------- class OExecuteImpl { sal_Bool& m_rbSet; @@ -669,6 +704,7 @@ public: OExecuteImpl(sal_Bool& _rbSet) : m_rbSet(_rbSet){ m_rbSet=sal_True; } ~OExecuteImpl(){ m_rbSet = sal_False; } }; + // ----------------------------------------------------------------------------- namespace { @@ -1569,18 +1605,15 @@ sal_Bool ODocumentDefinition::objectSupportsEmbeddedScripts() const // ----------------------------------------------------------------------------- void ODocumentDefinition::separateOpenCommandArguments( const Sequence< PropertyValue >& i_rOpenCommandArguments, - ::comphelper::NamedValueCollection& o_rDocumentLoadArgs, ::comphelper::NamedValueCollection& o_rEmbeddedObjectDescriptor ) + ::comphelper::NamedValueCollection& o_rDocumentLoadArgs, ::comphelper::NamedValueCollection& /*o_rEmbeddedObjectDescriptor*/ ) { ::comphelper::NamedValueCollection aOpenCommandArguments( i_rOpenCommandArguments ); o_rDocumentLoadArgs.merge( aOpenCommandArguments, false ); - // the only OpenCommandArgument so far, which belongs into the EmbeddedObjectDescriptor, and not the document's - // media descriptor, is RecoverFromStorage - if ( aOpenCommandArguments.has( "RecoverFromStorage" ) ) - { - o_rEmbeddedObjectDescriptor.put( "RecoverFromStorage", aOpenCommandArguments.get( "RecoverFromStorage" ) ); - o_rDocumentLoadArgs.remove( "RecoverFromStorage" ); - } + // This method is to separate OpenCommandArguments into args which belong into the EmbeddedObjectDescriptor, + // and args which belong into the document's media descriptor. + + // Well, there was some intermediate state where such args really existed - at the moment, they don't. } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx index 5b2c43521f6b..0c164fd2e30d 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.hxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx @@ -133,6 +133,12 @@ public: // ::com::sun::star::beans::XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // OPropertySetHelper + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& o_rValue, + sal_Int32 i_nHandle + ) const; + // XComponentSupplier virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent( ) throw (::com::sun::star::uno::RuntimeException); diff --git a/dbaccess/source/core/misc/dbastrings.cxx b/dbaccess/source/core/misc/dbastrings.cxx index 4caaa5650656..96e6d86145cf 100644 --- a/dbaccess/source/core/misc/dbastrings.cxx +++ b/dbaccess/source/core/misc/dbastrings.cxx @@ -46,6 +46,7 @@ namespace dbaccess //============================================================ //= Properties //============================================================ - IMPLEMENT_CONSTASCII_USTRING(PROPERTY_APPLYFORMDESIGNMODE, "ApplyFormDesignMode"); - + IMPLEMENT_CONSTASCII_USTRING( PROPERTY_APPLYFORMDESIGNMODE, "ApplyFormDesignMode" ); + IMPLEMENT_CONSTASCII_USTRING( PROPERTY_IS_FORM, "IsForm" ); + IMPLEMENT_CONSTASCII_USTRING( PROPERTY_PERSISTENT_PATH, "PersistentPath" ); } diff --git a/dbaccess/source/inc/dbastrings.hrc b/dbaccess/source/inc/dbastrings.hrc index 1e5eb7984046..a881bb039194 100644 --- a/dbaccess/source/inc/dbastrings.hrc +++ b/dbaccess/source/inc/dbastrings.hrc @@ -48,7 +48,9 @@ namespace dbaccess //============================================================ //= Properties //============================================================ - DECLARE_CONSTASCII_USTRING(PROPERTY_APPLYFORMDESIGNMODE); + DECLARE_CONSTASCII_USTRING( PROPERTY_APPLYFORMDESIGNMODE ); + DECLARE_CONSTASCII_USTRING( PROPERTY_IS_FORM ); + DECLARE_CONSTASCII_USTRING( PROPERTY_PERSISTENT_PATH ); } #endif // DBACCESS_SHARED_DBASTRINGS_HRC diff --git a/dbaccess/source/inc/stringconstants.hrc b/dbaccess/source/inc/stringconstants.hrc index 6a58ba1ddd0d..02bb911ef287 100644 --- a/dbaccess/source/inc/stringconstants.hrc +++ b/dbaccess/source/inc/stringconstants.hrc @@ -183,6 +183,7 @@ #define PROPERTY_ID_THOUSAND_DELIMITER 140 #define PROPERTY_ID_ENCODING 141 #define PROPERTY_ID_HELP_URL 142 +#define PROPERTY_ID_PERSISTENT_PATH 143 //============================================================ //= property names |