[Libreoffice-commits] .: 2 commits - sw/inc sw/source
Noel Power
noelp at kemper.freedesktop.org
Wed Feb 23 06:48:03 PST 2011
sw/inc/unobookmark.hxx | 25 ++++++++++---------
sw/source/core/unocore/unobkm.cxx | 48 ++++++++++++++++++++++++++++++-------
sw/source/core/unocore/unocoll.cxx | 7 -----
3 files changed, 55 insertions(+), 25 deletions(-)
New commits:
commit 5c826f177a87f9e29cf91c286703d848265dfb2a
Author: Noel Power <noel.power at novell.com>
Date: Wed Feb 23 14:46:36 2011 +0000
remove SwXODFCheckboxField and fix a stray edit
diff --git a/sw/inc/unobookmark.hxx b/sw/inc/unobookmark.hxx
index c3ec7bb..7b7eded 100644
--- a/sw/inc/unobookmark.hxx
+++ b/sw/inc/unobookmark.hxx
@@ -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
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index f0cca08..e78a8c9 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -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: */
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 7b037e9..e33b3ee 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -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();
}
commit 547a9153e35b433e9f1e77ce272a2db11597b534
Author: Noel Power <noel.power at novell.com>
Date: Wed Feb 23 11:04:23 2011 +0000
oops forgot to support the getProperty...
diff --git a/sw/inc/unobookmark.hxx b/sw/inc/unobookmark.hxx
index 9c8936c..c3ec7bb 100644
--- a/sw/inc/unobookmark.hxx
+++ b/sw/inc/unobookmark.hxx
@@ -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,
@@ -264,6 +264,8 @@ public:
class SwXODFCheckboxField : public SwXFieldmark
{
+private:
+ ::sw::mark::ICheckboxFieldmark* getCheckboxFieldmark();
public:
SwXODFCheckboxField( ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0) : SwXFieldmark(true,
pBkm, pDoc) {}
@@ -277,6 +279,12 @@ public:
::com::sun::star::lang::WrappedTargetException,
::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
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index 96e6079..f0cca08 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -678,6 +678,19 @@ SwXFieldmark::CreateXFieldmark(SwDoc & rDoc, ::sw::mark::IMark & rMark)
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
SwXODFCheckboxField::setPropertyValue(const OUString& PropertyName,
const uno::Any& rValue)
@@ -685,20 +698,38 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
lang::IllegalArgumentException, lang::WrappedTargetException,
uno::RuntimeException)
{
+ SolarMutexGuard g;
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 );
if ( pCheckboxFm && ( rValue >>= bChecked ) )
- {
- // evil #TODO #FIXME
- ((::sw::mark::ICheckboxFieldmark*)(pCheckboxFm))->SetChecked( bChecked );
- }
+ pCheckboxFm->SetChecked( bChecked );
else
throw uno::RuntimeException();
+
}
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: */
More information about the Libreoffice-commits
mailing list