Kaydet (Commit) eeeaf6c3 authored tarafından Noel Power's avatar Noel Power

oops forgot to support the getProperty...

üst e51fbdff
...@@ -149,7 +149,7 @@ public: ...@@ -149,7 +149,7 @@ public:
::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::WrappedTargetException, ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( virtual ::com::sun::star::uno::Any SAL_CALL GetPropertyValue(
const ::rtl::OUString& rPropertyName) const ::rtl::OUString& rPropertyName)
throw (::com::sun::star::beans::UnknownPropertyException, throw (::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException, ::com::sun::star::lang::WrappedTargetException,
...@@ -264,6 +264,8 @@ public: ...@@ -264,6 +264,8 @@ public:
class SwXODFCheckboxField : public SwXFieldmark class SwXODFCheckboxField : public SwXFieldmark
{ {
private:
::sw::mark::ICheckboxFieldmark* getCheckboxFieldmark();
public: public:
SwXODFCheckboxField( ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0) : SwXFieldmark(true, SwXODFCheckboxField( ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0) : SwXFieldmark(true,
pBkm, pDoc) {} pBkm, pDoc) {}
...@@ -277,6 +279,12 @@ public: ...@@ -277,6 +279,12 @@ public:
::com::sun::star::lang::WrappedTargetException, ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
const ::rtl::OUString& rPropertyName)
throw (::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
}; };
#endif // SW_UNOBOOKMARK_HXX #endif // SW_UNOBOOKMARK_HXX
......
...@@ -678,6 +678,19 @@ SwXFieldmark::CreateXFieldmark(SwDoc & rDoc, ::sw::mark::IMark & rMark) ...@@ -678,6 +678,19 @@ SwXFieldmark::CreateXFieldmark(SwDoc & rDoc, ::sw::mark::IMark & rMark)
return xMark; return xMark;
} }
::sw::mark::ICheckboxFieldmark*
SwXODFCheckboxField::getCheckboxFieldmark()
{
// evil #TODO #FIXME can we get rid of the dynamic_cast
const ::sw::mark::ICheckboxFieldmark* pCheckboxFm = dynamic_cast< const ::sw::mark::ICheckboxFieldmark* >( GetBookmark());
// even evil-er #TODO #FIXME casting away the constness
return ((::sw::mark::ICheckboxFieldmark*)(pCheckboxFm));
}
// support 'hidden' "Checked" property ( note: this property is just for convenience to support
// docx import filter thus not published via PropertySet info )
void SAL_CALL void SAL_CALL
SwXODFCheckboxField::setPropertyValue(const OUString& PropertyName, SwXODFCheckboxField::setPropertyValue(const OUString& PropertyName,
const uno::Any& rValue) const uno::Any& rValue)
...@@ -685,20 +698,38 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, ...@@ -685,20 +698,38 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
lang::IllegalArgumentException, lang::WrappedTargetException, lang::IllegalArgumentException, lang::WrappedTargetException,
uno::RuntimeException) uno::RuntimeException)
{ {
SolarMutexGuard g;
if ( PropertyName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Checked") ) ) ) if ( PropertyName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Checked") ) ) )
{ {
const ::sw::mark::ICheckboxFieldmark* pCheckboxFm = dynamic_cast< const ::sw::mark::ICheckboxFieldmark* >( GetBookmark()); ::sw::mark::ICheckboxFieldmark* pCheckboxFm = getCheckboxFieldmark();
sal_Bool bChecked( sal_False ); sal_Bool bChecked( sal_False );
if ( pCheckboxFm && ( rValue >>= bChecked ) ) if ( pCheckboxFm && ( rValue >>= bChecked ) )
{ pCheckboxFm->SetChecked( bChecked );
// evil #TODO #FIXME
((::sw::mark::ICheckboxFieldmark*)(pCheckboxFm))->SetChecked( bChecked );
}
else else
throw uno::RuntimeException(); throw uno::RuntimeException();
} }
else else
throw lang::IllegalArgumentException(); SwXFieldmark::setPropertyValue( PropertyName, rValue );
}
// support 'hidden' "Checked" property ( note: this property is just for convenience to support
// docx import filter thus not published via PropertySet info )
uno::Any SAL_CALL SwXODFCheckboxField::getPropertyValue(const OUString& rPropertyName)
throw (beans::UnknownPropertyException, lang::WrappedTargetException,
uno::RuntimeException)
{
SolarMutexGuard g;
if ( PropertyName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Checked") ) ) )
{
::sw::mark::ICheckboxFieldmark* pCheckboxFm = getCheckboxFieldmark();
if ( pCheckboxFm )
return uno::makeAny( pCheckboxFm->GetChecked() );
else
throw uno::RuntimeException();
}
return SwXFieldmark::getPropertyValue( PropertyName );
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment