summaryrefslogtreecommitdiff
path: root/forms/source/xforms/binding.cxx
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2008-06-25 13:29:20 +0000
committerKurt Zenker <kz@openoffice.org>2008-06-25 13:29:20 +0000
commit94db190335601afbbe2897c528894c6f66f1cec7 (patch)
treec308e51a06bdec046fa12037ddbf2e1cd8571879 /forms/source/xforms/binding.cxx
parent893dfa5cb0d4c8559d14fc6b2d7cfcde699470ce (diff)
INTEGRATION: CWS xformsdocmodify (1.9.14); FILE MERGED
2008/06/02 21:44:12 fs 1.9.14.1: #i90243# implement a ExternalData property which controls whether changes in the model data should mark the embedding document as modified
Diffstat (limited to 'forms/source/xforms/binding.cxx')
-rw-r--r--forms/source/xforms/binding.cxx61
1 files changed, 46 insertions, 15 deletions
diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx
index c731f52d3..6b8da64b8 100644
--- a/forms/source/xforms/binding.cxx
+++ b/forms/source/xforms/binding.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: binding.cxx,v $
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
* This file is part of OpenOffice.org.
*
@@ -45,6 +45,8 @@
#include <rtl/ustrbuf.hxx>
#include <osl/diagnose.h>
+#include <tools/diagnose_ex.h>
+
#include <algorithm>
#include <functional>
@@ -99,6 +101,7 @@ using com::sun::star::uno::Sequence;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::UNO_QUERY_THROW;
using com::sun::star::uno::XInterface;
+using com::sun::star::uno::Exception;
using com::sun::star::uno::makeAny;
using com::sun::star::util::XModifyListener;
using com::sun::star::xforms::XDataTypeRepository;
@@ -129,6 +132,7 @@ using com::sun::star::xsd::XDataType;
#define HANDLE_ReadOnly 11 // from com.sun.star.form.binding.ValueBinding, for interaction with a bound form control
#define HANDLE_Relevant 12 // from com.sun.star.form.binding.ValueBinding, for interaction with a bound form control
#define HANDLE_ModelNamespaces 13
+#define HANDLE_ExternalData 14
Binding::Binding() :
@@ -171,6 +175,8 @@ void Binding::_setModel( const Model_t& xModel )
// set namespaces (and move to model, if appropriate)
setBindingNamespaces( xNamespaces );
_checkBindingID();
+
+ notifyAndCachePropertyValue( HANDLE_ExternalData );
}
@@ -470,6 +476,25 @@ bool Binding::getRelevant() const
return maMIP.isRelevant();
}
+bool Binding::getExternalData() const
+{
+ bool bExternalData = true;
+ if ( !mxModel.is() )
+ return bExternalData;
+
+ try
+ {
+ Reference< XPropertySet > xModelProps( mxModel, UNO_QUERY_THROW );
+ OSL_VERIFY(
+ xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExternalData" ) ) ) >>= bExternalData );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return bExternalData;
+}
+
void Binding::checkLive()
throw( RuntimeException )
@@ -1317,25 +1342,31 @@ Binding::XCloneable_t SAL_CALL Binding::createClone()
registerProperty( PROPERTY_RO( property, type ), \
new DirectPropertyAccessor< Binding, type >( this, NULL, &Binding::get##property ) );
+#define REGISTER_BOOL_PROPERTY_RO( property ) \
+ registerProperty( PROPERTY_RO( property, sal_Bool ), \
+ new BooleanPropertyAccessor< Binding, bool >( this, NULL, &Binding::get##property ) );
+
void Binding::initializePropertySet()
{
- REGISTER_PROPERTY ( BindingID, OUString );
- REGISTER_PROPERTY ( BindingExpression, OUString );
- REGISTER_PROPERTY_RO( Model, Model_t );
- REGISTER_PROPERTY ( BindingNamespaces, XNameContainer_t );
- REGISTER_PROPERTY ( ModelNamespaces, XNameContainer_t );
- REGISTER_PROPERTY_RO( ModelID, OUString );
- REGISTER_PROPERTY ( ReadonlyExpression, OUString );
- REGISTER_PROPERTY ( RelevantExpression, OUString );
- REGISTER_PROPERTY ( RequiredExpression, OUString );
- REGISTER_PROPERTY ( ConstraintExpression, OUString );
- REGISTER_PROPERTY ( CalculateExpression, OUString );
- REGISTER_PROPERTY ( Type, OUString );
- REGISTER_PROPERTY_RO( ReadOnly, bool );
- REGISTER_PROPERTY_RO( Relevant, bool );
+ REGISTER_PROPERTY ( BindingID, OUString );
+ REGISTER_PROPERTY ( BindingExpression, OUString );
+ REGISTER_PROPERTY_RO ( Model, Model_t );
+ REGISTER_PROPERTY ( BindingNamespaces, XNameContainer_t );
+ REGISTER_PROPERTY ( ModelNamespaces, XNameContainer_t );
+ REGISTER_PROPERTY_RO ( ModelID, OUString );
+ REGISTER_PROPERTY ( ReadonlyExpression, OUString );
+ REGISTER_PROPERTY ( RelevantExpression, OUString );
+ REGISTER_PROPERTY ( RequiredExpression, OUString );
+ REGISTER_PROPERTY ( ConstraintExpression, OUString );
+ REGISTER_PROPERTY ( CalculateExpression, OUString );
+ REGISTER_PROPERTY ( Type, OUString );
+ REGISTER_PROPERTY_RO ( ReadOnly, bool );
+ REGISTER_PROPERTY_RO ( Relevant, bool );
+ REGISTER_BOOL_PROPERTY_RO( ExternalData );
initializePropertyValueCache( HANDLE_ReadOnly );
initializePropertyValueCache( HANDLE_Relevant );
+ initializePropertyValueCache( HANDLE_ExternalData );
}
void Binding::addModifyListener(