diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-03-23 17:13:39 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-03-23 17:13:39 +0100 |
commit | 498887fd01f7793842430464508f39352b76d452 (patch) | |
tree | bba7cdbd7bf36d78a9100ae219b042836805e32a /editeng | |
parent | d4e88719d67c5cadb55c85cd372d412fd969c613 (diff) | |
parent | a16869e2ff8a85e877f4060995937835f03a2beb (diff) |
Merge branch 'master' of git://anongit.freedesktop.org/libreoffice/libs-core
Diffstat (limited to 'editeng')
-rwxr-xr-x | editeng/inc/editeng/unotext.hxx | 9 | ||||
-rwxr-xr-x | editeng/source/uno/unotext.cxx | 106 | ||||
-rwxr-xr-x | editeng/source/uno/unotext2.cxx | 98 |
3 files changed, 122 insertions, 91 deletions
diff --git a/editeng/inc/editeng/unotext.hxx b/editeng/inc/editeng/unotext.hxx index 72a9d5ffbc..3489944ba4 100755 --- a/editeng/inc/editeng/unotext.hxx +++ b/editeng/inc/editeng/unotext.hxx @@ -373,9 +373,6 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText; sal_Bool mbPortion; -protected: - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; - public: SvxUnoTextRange( const SvxUnoTextBase& rParent, sal_Bool bPortion = sal_False ) throw(); virtual ~SvxUnoTextRange() throw(); @@ -406,7 +403,6 @@ class EDITENG_DLLPUBLIC SvxUnoTextBase : public SvxUnoTextRangeBase, { protected: ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText; - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; public: SvxUnoTextBase( ) throw(); @@ -541,8 +537,6 @@ private: bool mbDisposing; protected: - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; - using SvxUnoTextRangeBase::setPropertyValue; using SvxUnoTextRangeBase::getPropertyValue; @@ -630,9 +624,6 @@ class EDITENG_DLLPUBLIC SvxUnoTextCursor : public SvxUnoTextRangeBase, private: ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText; -protected: - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; - public: SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw(); SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw(); diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index af248fc685..029168192f 100755 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -40,6 +40,7 @@ #include <svl/eitem.hxx> #include <rtl/uuid.h> #include <rtl/memory.h> +#include <rtl/instance.hxx> #include <editeng/fontitem.hxx> #include <editeng/tstpitem.hxx> @@ -1523,8 +1524,6 @@ sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionEnds( const uno::Reference< // class SvxUnoTextRange // ==================================================================== -uno::Sequence< uno::Type > SvxUnoTextRange::maTypeSequence; - uno::Reference< uno::XInterface > SvxUnoTextRange_NewInstance() { SvxUnoText aText; @@ -1586,25 +1585,37 @@ void SAL_CALL SvxUnoTextRange::release() // XTypeProvider +namespace +{ + struct theSvxUnoTextRangeTypes : + public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextRangeTypes> + { + uno::Sequence<uno::Type> operator () () + { + uno::Sequence< uno::Type > aTypeSequence; + + aTypeSequence.realloc( 9 ); // !DANGER! keep this updated + uno::Type* pTypes = aTypeSequence.getArray(); + + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); + + return aTypeSequence; + } + }; +} + uno::Sequence< uno::Type > SAL_CALL SvxUnoTextRange::getTypes() throw (uno::RuntimeException) { - if( maTypeSequence.getLength() == 0 ) - { - maTypeSequence.realloc( 9 ); // !DANGER! keep this updated - uno::Type* pTypes = maTypeSequence.getArray(); - - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); - } - return maTypeSequence; + return theSvxUnoTextRangeTypes::get(); } uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextRange::getImplementationId() @@ -1637,10 +1648,6 @@ OUString SAL_CALL SvxUnoTextRange::getImplementationName() // class SvxUnoText // ==================================================================== -// UNO3_GETIMPLEMENTATION2_IMPL( SvxUnoText, SvxUnoTextRangeBase ); - -uno::Sequence< uno::Type > SvxUnoTextBase::maTypeSequence; - SvxUnoTextBase::SvxUnoTextBase() throw() : SvxUnoTextRangeBase( NULL ) { @@ -1732,30 +1739,41 @@ uno::Any SAL_CALL SvxUnoTextBase::queryAggregation( const uno::Type & rType ) // XTypeProvider -uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getStaticTypes() throw() +namespace { - if( maTypeSequence.getLength() == 0 ) + struct theSvxUnoTextBaseTypes : + public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextBaseTypes> { - maTypeSequence.realloc( 15 ); // !DANGER! keep this updated - uno::Type* pTypes = maTypeSequence.getArray(); - - *pTypes++ = ::getCppuType(( const uno::Reference< text::XText >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeMover >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextAppend >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCopy >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XParagraphAppend >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextPortionAppend >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); - } - return maTypeSequence; + uno::Sequence<uno::Type> operator () () + { + uno::Sequence< uno::Type > aTypeSequence; + + aTypeSequence.realloc( 15 ); // !DANGER! keep this updated + uno::Type* pTypes = aTypeSequence.getArray(); + + *pTypes++ = ::getCppuType(( const uno::Reference< text::XText >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeMover >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextAppend >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCopy >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XParagraphAppend >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextPortionAppend >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); + + return aTypeSequence; + } + }; +} +uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getStaticTypes() throw() +{ + return theSvxUnoTextBaseTypes::get(); } uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getTypes() diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx index 7e94aac3bb..f715c8eac1 100755 --- a/editeng/source/uno/unotext2.cxx +++ b/editeng/source/uno/unotext2.cxx @@ -36,6 +36,7 @@ #include <rtl/uuid.h> #include <rtl/memory.h> +#include <rtl/instance.hxx> #include <editeng/eeitem.hxx> #include <editeng/flditem.hxx> @@ -113,7 +114,6 @@ uno::Any SvxUnoTextContentEnumeration::nextElement(void) throw( container::NoSuc // class SvxUnoTextContent // ==================================================================== uno::Reference< text::XText > xDummyText; -uno::Sequence< uno::Type > SvxUnoTextContent::maTypeSequence; static SvxUnoText* getDummyText() throw() { @@ -200,27 +200,39 @@ void SAL_CALL SvxUnoTextContent::release() throw( ) // XTypeProvider +namespace +{ + struct theSvxUnoTextContentTypes : + public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextContentTypes> + { + uno::Sequence<uno::Type> operator () () + { + uno::Sequence< uno::Type > aTypeSequence; + + aTypeSequence.realloc( 11 ); // !DANGER! keep this updated + uno::Type* pTypes = aTypeSequence.getArray(); + + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextContent >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); + + return aTypeSequence; + } + }; +} + uno::Sequence< uno::Type > SAL_CALL SvxUnoTextContent::getTypes() throw (uno::RuntimeException) { - if( maTypeSequence.getLength() == 0 ) - { - maTypeSequence.realloc( 11 ); // !DANGER! keep this updated - uno::Type* pTypes = maTypeSequence.getArray(); - - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextContent >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); - } - return maTypeSequence; + return theSvxUnoTextContentTypes::get(); } uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextContent::getImplementationId() @@ -487,8 +499,6 @@ uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement() // class SvxUnoTextCursor // ==================================================================== -uno::Sequence< uno::Type > SvxUnoTextCursor::maTypeSequence; - uno::Reference< uno::XInterface > SvxUnoTextCursor_NewInstance() { SvxUnoText aText; @@ -553,27 +563,39 @@ void SAL_CALL SvxUnoTextCursor::release() throw ( ) OWeakAggObject::release(); } +namespace +{ + struct theSvxUnoTextCursorTypes : + public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextCursorTypes> + { + uno::Sequence<uno::Type> operator () () + { + uno::Sequence< uno::Type > aTypeSequence; + + aTypeSequence.realloc( 10 ); // !DANGER! keep this updated + uno::Type* pTypes = aTypeSequence.getArray(); + + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCursor >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); + + return aTypeSequence; + } + }; +} + // XTypeProvider uno::Sequence< uno::Type > SAL_CALL SvxUnoTextCursor::getTypes() throw(uno::RuntimeException) { - if( maTypeSequence.getLength() == 0 ) - { - maTypeSequence.realloc( 10 ); // !DANGER! keep this updated - uno::Type* pTypes = maTypeSequence.getArray(); - - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCursor >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); - } - return maTypeSequence; + return theSvxUnoTextCursorTypes::get(); } uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextCursor::getImplementationId() |