summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-12-10 19:15:53 +0100
committerMathias Bauer <mba@openoffice.org>2009-12-10 19:15:53 +0100
commite253f0cf0ddfed47d1e64fd7b7304f48d0a4ece0 (patch)
treee6e1a12cec1cf6fddc577f0d106ce52ed3f4aebd
parent1942021e1aa3a5dab00285d4baad3229d7af97d6 (diff)
#i107450#: move move code to create TextFields out of svdraw
-rw-r--r--svx/inc/svx/unofield.hxx3
-rw-r--r--svx/source/unodraw/unomod.cxx61
-rw-r--r--svx/source/unoedit/unofield.cxx62
-rw-r--r--svx/source/xml/xmltxtexp.cxx3
4 files changed, 67 insertions, 62 deletions
diff --git a/svx/inc/svx/unofield.hxx b/svx/inc/svx/unofield.hxx
index ad819e1b9dbe..2dc0379e3d1f 100644
--- a/svx/inc/svx/unofield.hxx
+++ b/svx/inc/svx/unofield.hxx
@@ -65,6 +65,9 @@ class SvxUnoFieldData_Impl;
class SfxItemPropertySet;
class SvxFieldData;
+com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoTextCreateTextField(
+ const ::rtl::OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
class SVX_DLLPUBLIC SvxUnoTextField : public SvxMutexHelper,
public ::cppu::OComponentHelper,
public ::com::sun::star::text::XTextField,
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
index 01f6698e3830..f69bfe606ac4 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -213,66 +213,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstance(
uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createTextField( const ::rtl::OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- uno::Reference< uno::XInterface > xRet;
-
- const OUString aTextFieldPrexit( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.textfield.") );
-
- // #i93308# up to OOo 3.2 we used this wrong namespace name with the capital T & F. This is
- // fixed since OOo 3.2 but for compatibility we will still provide support for the wrong notation.
- const OUString aTextFieldPrexit2( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextField.") );
-
- if( (ServiceSpecifier.compareTo( aTextFieldPrexit, aTextFieldPrexit.getLength() ) == 0) ||
- (ServiceSpecifier.compareTo( aTextFieldPrexit2, aTextFieldPrexit2.getLength() ) == 0) )
- {
- OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) );
-
- sal_Int32 nId = ID_UNKNOWN;
-
- if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("DateTime") ) )
- {
- nId = ID_DATEFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("URL") ) )
- {
- nId = ID_URLFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("PageNumber") ) )
- {
- nId = ID_PAGEFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("PageCount") ) )
- {
- nId = ID_PAGESFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("SheetName") ) )
- {
- nId = ID_TABLEFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FileName") ) )
- {
- nId = ID_EXT_FILEFIELD;
- }
- else if (aFieldType.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("docinfo.Title") ) ||
- aFieldType.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("DocInfo.Title") ) )
- {
- nId = ID_FILEFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Author") ) )
- {
- nId = ID_AUTHORFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Measure") ) )
- {
- nId = ID_MEASUREFIELD;
- }
-
- if( nId != ID_UNKNOWN )
- xRet = (::cppu::OWeakObject * )new SvxUnoTextField( nId );
- }
-
- return xRet;
+ return SvxUnoTextCreateTextField( ServiceSpecifier );
}
uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstanceWithArguments( const OUString&, const uno::Sequence< ::com::sun::star::uno::Any >& )
diff --git a/svx/source/unoedit/unofield.cxx b/svx/source/unoedit/unofield.cxx
index 6ff4c2aafe3e..3a882b1c8d6c 100644
--- a/svx/source/unoedit/unofield.cxx
+++ b/svx/source/unoedit/unofield.cxx
@@ -1118,4 +1118,66 @@ sal_Bool SAL_CALL SvxUnoTextField::supportsService( const OUString& ServiceName
return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
}
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rtl::OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ uno::Reference< uno::XInterface > xRet;
+
+ const OUString aTextFieldPrexit( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.textfield.") );
+
+ // #i93308# up to OOo 3.2 we used this wrong namespace name with the capital T & F. This is
+ // fixed since OOo 3.2 but for compatibility we will still provide support for the wrong notation.
+ const OUString aTextFieldPrexit2( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextField.") );
+
+ if( (ServiceSpecifier.compareTo( aTextFieldPrexit, aTextFieldPrexit.getLength() ) == 0) ||
+ (ServiceSpecifier.compareTo( aTextFieldPrexit2, aTextFieldPrexit2.getLength() ) == 0) )
+ {
+ OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) );
+
+ sal_Int32 nId = ID_UNKNOWN;
+
+ if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("DateTime") ) )
+ {
+ nId = ID_DATEFIELD;
+ }
+ else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("URL") ) )
+ {
+ nId = ID_URLFIELD;
+ }
+ else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("PageNumber") ) )
+ {
+ nId = ID_PAGEFIELD;
+ }
+ else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("PageCount") ) )
+ {
+ nId = ID_PAGESFIELD;
+ }
+ else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("SheetName") ) )
+ {
+ nId = ID_TABLEFIELD;
+ }
+ else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FileName") ) )
+ {
+ nId = ID_EXT_FILEFIELD;
+ }
+ else if (aFieldType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("docinfo.Title") ) ||
+ aFieldType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("DocInfo.Title") ) )
+ {
+ nId = ID_FILEFIELD;
+ }
+ else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Author") ) )
+ {
+ nId = ID_AUTHORFIELD;
+ }
+ else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Measure") ) )
+ {
+ nId = ID_MEASUREFIELD;
+ }
+ if( nId != ID_UNKNOWN )
+ xRet = (::cppu::OWeakObject * )new SvxUnoTextField( nId );
+ }
+
+ return xRet;
+}
diff --git a/svx/source/xml/xmltxtexp.cxx b/svx/source/xml/xmltxtexp.cxx
index 11e6b6d475d9..083577800693 100644
--- a/svx/source/xml/xmltxtexp.cxx
+++ b/svx/source/xml/xmltxtexp.cxx
@@ -61,7 +61,6 @@
#include <cppuhelper/implbase4.hxx>
#include <svx/unofield.hxx>
-#include <svx/unomod.hxx>
#include "unonrule.hxx"
using namespace com::sun::star;
@@ -256,7 +255,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxSimpleUnoModel::createInstance( co
return (::cppu::OWeakObject * )new SvxUnoTextField( ID_EXT_DATEFIELD );
}
- return SvxUnoDrawMSFactory::createTextField( aServiceSpecifier );
+ return SvxUnoTextCreateTextField( aServiceSpecifier );
}