remove SwXODFCheckboxField and fix a stray edit

This commit is contained in:
Noel Power 2011-02-23 14:46:36 +00:00
parent eeeaf6c343
commit ac436499d3
3 changed files with 23 additions and 32 deletions

View file

@ -149,7 +149,7 @@ public:
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::WrappedTargetException,
::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)
throw (::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
@ -236,8 +236,8 @@ class SwXFieldmark
: public SwXFieldmark_Base
{
protected:
private:
::sw::mark::ICheckboxFieldmark* getCheckboxFieldmark();
bool isReplacementObject;
public:
@ -259,17 +259,6 @@ public:
throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getParameters( )
throw (::com::sun::star::uno::RuntimeException);
};
class SwXODFCheckboxField : public SwXFieldmark
{
private:
::sw::mark::ICheckboxFieldmark* getCheckboxFieldmark();
public:
SwXODFCheckboxField( ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0) : SwXFieldmark(true,
pBkm, pDoc) {}
virtual void SAL_CALL setPropertyValue(
const ::rtl::OUString& rPropertyName,
const ::com::sun::star::uno::Any& rValue)
@ -284,7 +273,13 @@ public:
throw (::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
};
class SwXODFCheckboxField : public SwXFieldmark
{
public:
SwXODFCheckboxField( ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0) : SwXFieldmark(true,
pBkm, pDoc) {}
};
#endif // SW_UNOBOOKMARK_HXX

View file

@ -46,7 +46,7 @@
#include <comcore.hrc>
#include <undobj.hxx>
#include <docsh.hxx>
#include <xmloff/odffields.hxx>
using namespace ::sw::mark;
using namespace ::com::sun::star;
@ -679,12 +679,13 @@ SwXFieldmark::CreateXFieldmark(SwDoc & rDoc, ::sw::mark::IMark & rMark)
}
::sw::mark::ICheckboxFieldmark*
SwXODFCheckboxField::getCheckboxFieldmark()
SwXFieldmark::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));
::sw::mark::ICheckboxFieldmark* pCheckboxFm = NULL;
if ( getFieldType() == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(ODF_FORMCHECKBOX) ) )
// evil #TODO #FIXME casting away the const-ness
pCheckboxFm = (::sw::mark::ICheckboxFieldmark*)(reinterpret_cast< const ::sw::mark::ICheckboxFieldmark* >( GetBookmark()));
return pCheckboxFm;
}
@ -692,7 +693,7 @@ SwXODFCheckboxField::getCheckboxFieldmark()
// docx import filter thus not published via PropertySet info )
void SAL_CALL
SwXODFCheckboxField::setPropertyValue(const OUString& PropertyName,
SwXFieldmark::setPropertyValue(const OUString& PropertyName,
const uno::Any& rValue)
throw (beans::UnknownPropertyException, beans::PropertyVetoException,
lang::IllegalArgumentException, lang::WrappedTargetException,
@ -710,26 +711,26 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
else
SwXFieldmark::setPropertyValue( PropertyName, rValue );
SwXFieldmark_Base::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)
uno::Any SAL_CALL SwXFieldmark::getPropertyValue(const OUString& rPropertyName)
throw (beans::UnknownPropertyException, lang::WrappedTargetException,
uno::RuntimeException)
{
SolarMutexGuard g;
if ( PropertyName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Checked") ) ) )
if ( rPropertyName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Checked") ) ) )
{
::sw::mark::ICheckboxFieldmark* pCheckboxFm = getCheckboxFieldmark();
if ( pCheckboxFm )
return uno::makeAny( pCheckboxFm->GetChecked() );
return uno::makeAny( pCheckboxFm->IsChecked() );
else
throw uno::RuntimeException();
}
return SwXFieldmark::getPropertyValue( PropertyName );
return SwXFieldmark_Base::getPropertyValue( rPropertyName );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -564,6 +564,7 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16
}
break;
case SW_SERVICE_ODF_FORM_LISTBOX:
case SW_SERVICE_ODF_FORM_CHECKBOX:
case SW_SERVICE_TYPE_FORMFIELDMARK :
{
SwXFieldmark* pFieldmark = new SwXFieldmark(true);
@ -838,12 +839,6 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16
case SW_SERVICE_FIELDTYPE_METAFIELD:
xRet = static_cast< ::cppu::OWeakObject* >(new SwXMetaField(pDoc));
break;
case SW_SERVICE_ODF_FORM_CHECKBOX:
{
SwXFieldmark* pFormCheckbox = new SwXODFCheckboxField();
xRet = (cppu::OWeakObject*)pFormCheckbox;
}
break;
default:
throw uno::RuntimeException();
}