diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-11-12 17:21:24 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-11-15 16:06:08 +0000 |
commit | 17ff7b41d15ab9928e2e2706faa26234a09802cd (patch) | |
tree | 597ca5fd177dfd74990db5b8ce49e21759a612f6 /editeng | |
parent | f2d8b05b73f058cd4b9e3e8b5a3e54c5047c2c8a (diff) |
re-base on ALv2 code. Includes:
Patches contributed by: Armin Le Grand.
#118558# Correcting OLE attributes of LO3.4 at load time by loading as OOo3.3, details see task.
http://svn.apache.org/viewvc?view=revision&revision=1195906
#118485# - Styles for OLEs are not saved.
http://svn.apache.org/viewvc?view=revision&revision=1182166
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert metafiles
http://svn.apache.org/viewvc?view=revision&revision=1293316
#119337# Solves the wrong get/setPropertyValue calls in
SvxShapeText (and thus in SvxOle2Shape)
http://svn.apache.org/viewvc?view=revision&revision=1344156
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394707
http://svn.apache.org/viewvc?view=revision&revision=1394326
cws mba34issues01: #i117717#: remove wrong assertion
http://svn.apache.org/viewvc?view=revision&revision=1172349
Patch contributed by Herbert Duerr
goodbye Registration and License dialogs, don't let the door hit you
http://svn.apache.org/viewvc?view=revision&revision=1172613
help gcc 4.6.0 on 32bit ubuntu 11.10"
http://svn.apache.org/viewvc?view=revision&revision=1245357
Do not add targets for junit tests when junit is disabled.
Patch contributed by Andre Fischer
http://svn.apache.org/viewvc?view=revision&revision=1241508
Revert "sb140: #i117082# avoid unncessary static class data members
commit 21d97438e2944861e26e4984195f959a0cce1e41.
remove obsolete FreeBSD visibility special case.
retain consolidated BSD bridge code, remove OS/2 pieces.
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/unopracc.hxx | 54 | ||||
-rw-r--r-- | editeng/inc/editeng/unotext.hxx | 195 | ||||
-rw-r--r-- | editeng/source/uno/unopracc.cxx | 64 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 302 | ||||
-rw-r--r-- | editeng/source/uno/unotext2.cxx | 234 |
5 files changed, 643 insertions, 206 deletions
diff --git a/editeng/inc/editeng/unopracc.hxx b/editeng/inc/editeng/unopracc.hxx index 3d07c4841bdd..fc7d1d233752 100644 --- a/editeng/inc/editeng/unopracc.hxx +++ b/editeng/inc/editeng/unopracc.hxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ #ifndef _SVX_UNOPRACC_HXX #define _SVX_UNOPRACC_HXX @@ -40,7 +31,9 @@ class SvxEditSource; XMultiPropertySet interfaces. Just set the selection to the required text range and return a reference to a XPropertySet. */ -class SvxAccessibleTextPropertySet : public SvxUnoTextRangeBase +class SvxAccessibleTextPropertySet : public SvxUnoTextRangeBase, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakObject { public: SvxAccessibleTextPropertySet( const SvxEditSource*, const SvxItemPropertySet* ); @@ -49,10 +42,23 @@ public: // XTextRange virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + // uno::XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + // lang::XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // lang::XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // XServiceName + ::rtl::OUString SAL_CALL getServiceName() throw (::com::sun::star::uno::RuntimeException); }; #endif diff --git a/editeng/inc/editeng/unotext.hxx b/editeng/inc/editeng/unotext.hxx index 99ae06512542..39b63f1b4a0c 100644 --- a/editeng/inc/editeng/unotext.hxx +++ b/editeng/inc/editeng/unotext.hxx @@ -1,43 +1,32 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ #ifndef _SVX_UNOTEXT_HXX #define _SVX_UNOTEXT_HXX -#include "sal/config.h" - #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/text/XTextRange.hpp> #include <com/sun/star/text/XText.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/text/XTextRangeMover.hpp> -#include <com/sun/star/text/XTextContent.hpp> #include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -54,10 +43,7 @@ #include <com/sun/star/style/LineSpacing.hpp> #include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> -#include <cppuhelper/implbase4.hxx> -#include <cppuhelper/implbase8.hxx> +#include <com/sun/star/text/XTextRange.hpp> #include <cppuhelper/interfacecontainer.h> #include <cppuhelper/weak.hxx> #include <cppuhelper/weakagg.hxx> @@ -255,20 +241,16 @@ namespace accessibility } // ==================================================================== -typedef - cppu::WeakAggImplHelper8< - ::com::sun::star::text::XTextRange, - ::com::sun::star::beans::XPropertySet, - ::com::sun::star::beans::XMultiPropertySet, - ::com::sun::star::beans::XMultiPropertyStates, - ::com::sun::star::beans::XPropertyState, - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::text::XTextRangeCompare, - ::com::sun::star::lang::XUnoTunnel > - SvxUnoTextRangeBase_Base; - -class EDITENG_DLLPUBLIC SvxUnoTextRangeBase : public SvxUnoTextRangeBase_Base, +class EDITENG_DLLPUBLIC SvxUnoTextRangeBase : public ::com::sun::star::text::XTextRange, + public ::com::sun::star::beans::XPropertySet, + public ::com::sun::star::beans::XMultiPropertySet, + public ::com::sun::star::beans::XMultiPropertyStates, + public ::com::sun::star::beans::XPropertyState, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::text::XTextRangeCompare, + public ::com::sun::star::lang::XUnoTunnel, private osl::DebugBase<SvxUnoTextRangeBase> + { friend class SvxUnoTextRangeEnumeration; friend class ::accessibility::AccessibleEditableTextPara; @@ -373,7 +355,9 @@ public: // ==================================================================== class SvxUnoTextBase; -class EDITENG_DLLPUBLIC SvxUnoTextRange : public SvxUnoTextRangeBase +class EDITENG_DLLPUBLIC SvxUnoTextRange : public SvxUnoTextRangeBase, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakAggObject { friend class SvxUnoTextRangeEnumeration; private: @@ -384,37 +368,29 @@ public: SvxUnoTextRange( const SvxUnoTextBase& rParent, sal_Bool bPortion = sal_False ) throw(); virtual ~SvxUnoTextRange() throw(); + // ::com::sun::star::uno::XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + // ::com::sun::star::text::XTextRange virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::lang::XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); -}; - -typedef - cppu::AggImplInheritanceHelper4< - SvxUnoTextRangeBase, - ::com::sun::star::text::XTextAppend, - ::com::sun::star::text::XTextCopy, - ::com::sun::star::container::XEnumerationAccess, - ::com::sun::star::text::XTextRangeMover > - SvxUnoTextBase_Base0; - -// Extra indirection to keep MSC from trying to (unsuccessfully) fully -// instantiate a non-DLLPUBLIC template base class of a DLLPUBLIC class: -class SvxUnoTextBase_Base: public SvxUnoTextBase_Base0 { -protected: - explicit SvxUnoTextBase_Base(SvxUnoTextBase_Base const &) throw (); - explicit SvxUnoTextBase_Base(SvxItemPropertySet const * set) throw (); - SvxUnoTextBase_Base( - SvxEditSource const * source, SvxItemPropertySet const * set) throw (); - virtual ~SvxUnoTextBase_Base() throw (); -private: - void operator =(SvxUnoTextBase_Base const &); // not defined + // ::com::sun::star::lang::XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); }; -class EDITENG_DLLPUBLIC SvxUnoTextBase : public SvxUnoTextBase_Base +class EDITENG_DLLPUBLIC SvxUnoTextBase : public SvxUnoTextRangeBase, + public ::com::sun::star::text::XTextAppend, + public ::com::sun::star::text::XTextCopy, + public ::com::sun::star::container::XEnumerationAccess, + public ::com::sun::star::text::XTextRangeMover, + public ::com::sun::star::lang::XTypeProvider { protected: ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText; @@ -428,8 +404,14 @@ public: UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextBase ) + ESelection InsertField( const SvxFieldItem& rField ) throw(); + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getStaticTypes() throw(); + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > createTextCursorBySelection( const ESelection& rSel ); + // ::com::sun::star::uno::XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::text::XSimpleText virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor( ) throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& aTextPosition ) throw(::com::sun::star::uno::RuntimeException); @@ -471,10 +453,15 @@ public: virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static( ) SAL_THROW(()); + + // ::com::sun::star::lang::XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); }; // ==================================================================== -class EDITENG_DLLPUBLIC SvxUnoText : public SvxUnoTextBase +class EDITENG_DLLPUBLIC SvxUnoText : public SvxUnoTextBase, + public ::cppu::OWeakAggObject { public: SvxUnoText( ) throw(); @@ -484,9 +471,17 @@ public: virtual ~SvxUnoText() throw(); // Internal - static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); - virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) - throw(::com::sun::star::uno::RuntimeException); + UNO3_GETIMPLEMENTATION_DECL( SvxUnoText ) + + // ::com::sun::star::uno::XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // ::com::sun::star::lang::XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); }; // ==================================================================== @@ -509,15 +504,13 @@ public: }; // ==================================================================== +#include <com/sun/star/text/XTextContent.hpp> -typedef - cppu::AggImplInheritanceHelper2< - SvxUnoTextRangeBase, - ::com::sun::star::text::XTextContent, - ::com::sun::star::container::XEnumerationAccess > - SvxUnoTextContent_Base; - -class SvxUnoTextContent : public SvxUnoTextContent_Base +class SvxUnoTextContent : public SvxUnoTextRangeBase, + public ::com::sun::star::text::XTextContent, + public ::com::sun::star::container::XEnumerationAccess, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakAggObject { friend class SvxUnoTextContentEnumeration; private: @@ -539,6 +532,12 @@ public: SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw(); virtual ~SvxUnoTextContent() throw(); + // ::com::sun::star::uno::XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + // ::com::sun::star::text::XTextRange virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException); @@ -574,6 +573,10 @@ public: // ::com::sun::star::lang::XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); }; // ==================================================================== @@ -599,25 +602,10 @@ public: // ==================================================================== -typedef - cppu::AggImplInheritanceHelper1< - SvxUnoTextRangeBase, - ::com::sun::star::text::XTextCursor > - SvxUnoTextCursor_Base0; - -// Extra indirection to keep MSC from trying to (unsuccessfully) fully -// instantiate a non-DLLPUBLIC template base class of a DLLPUBLIC class: -class SvxUnoTextCursor_Base: public SvxUnoTextCursor_Base0 { -protected: - explicit SvxUnoTextCursor_Base(SvxUnoTextCursor_Base const & base) throw (); - explicit SvxUnoTextCursor_Base(SvxUnoTextRangeBase const & base) throw (); - virtual ~SvxUnoTextCursor_Base() throw (); - -private: - void operator =(SvxUnoTextCursor_Base const &); // not defined -}; - -class EDITENG_DLLPUBLIC SvxUnoTextCursor : public SvxUnoTextCursor_Base +class EDITENG_DLLPUBLIC SvxUnoTextCursor : public SvxUnoTextRangeBase, + public ::com::sun::star::text::XTextCursor, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakAggObject { private: ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText; @@ -627,6 +615,12 @@ public: SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw(); virtual ~SvxUnoTextCursor() throw(); + // ::com::sun::star::uno::XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + // ::com::sun::star::text::XTextRange virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException); @@ -648,6 +642,11 @@ public: virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + }; EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet(); diff --git a/editeng/source/uno/unopracc.cxx b/editeng/source/uno/unopracc.cxx index 0ca802052da2..d7e1cf75b25d 100644 --- a/editeng/source/uno/unopracc.cxx +++ b/editeng/source/uno/unopracc.cxx @@ -64,6 +64,70 @@ uno::Reference< text::XText > SAL_CALL SvxAccessibleTextPropertySet::getText() t return uno::Reference< text::XText > (); } +uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryAggregation( const uno::Type & ) throw(uno::RuntimeException) +{ + // TODO (empty?) + return uno::Any(); +} + +uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryInterface( const uno::Type & rType ) + throw(uno::RuntimeException) +{ + return OWeakObject::queryInterface(rType); +} + +void SAL_CALL SvxAccessibleTextPropertySet::acquire() + throw() +{ + OWeakObject::acquire(); +} + +void SAL_CALL SvxAccessibleTextPropertySet::release() + throw() +{ + OWeakObject::release(); +} + +// XTypeProvider +uno::Sequence< uno::Type > SAL_CALL SvxAccessibleTextPropertySet::getTypes() throw ( uno::RuntimeException ) +{ + static ::cppu::OTypeCollection* pTypeCollection = NULL ; + + // double-checked locking pattern. + if ( pTypeCollection == NULL ) + { + osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; + + // Control these pointer again ... it can be, that another instance will be faster then these! + if ( pTypeCollection == NULL ) + { + // Create a static typecollection ... + static ::cppu::OTypeCollection aTypeCollection( + ::getCppuType( static_cast< const uno::Reference< beans::XPropertySet >* > (0) ), + ::getCppuType( static_cast< const uno::Reference< beans::XMultiPropertySet >* > (0) ), + ::getCppuType( static_cast< const uno::Reference< beans::XPropertyState >* > (0) ), + ::getCppuType( static_cast< const uno::Reference< lang::XServiceInfo >* > (0) ), + ::getCppuType( static_cast< const uno::Reference< lang::XTypeProvider >* > (0) ) ); + + // ... and set his address to static pointer! + pTypeCollection = &aTypeCollection ; + } + } + + return pTypeCollection->getTypes() ; +} + +namespace +{ + class theSvxAccessibleTextPropertySetImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxAccessibleTextPropertySetImplementationId > {}; +} + +uno::Sequence< sal_Int8 > SAL_CALL SvxAccessibleTextPropertySet::getImplementationId() + throw (uno::RuntimeException) +{ + return theSvxAccessibleTextPropertySetImplementationId::get().getSeq(); +} + // XServiceInfo ::rtl::OUString SAL_CALL SAL_CALL SvxAccessibleTextPropertySet::getImplementationName (void) throw (uno::RuntimeException) { diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 14121c6eb484..d6ab43aad548 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ #include <vcl/svapp.hxx> #include <com/sun/star/style/LineSpacing.hpp> @@ -77,6 +68,10 @@ ESelection toESelection(const text::TextRangeSelection& rSel) } +#define QUERYINT( xint ) \ + if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \ + return uno::makeAny(uno::Reference< xint >(this)) + const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() { static SvxItemPropertySet aTextCursorSvxPropertySet( ImplGetSvxUnoOutlinerTextCursorPropertyMap(), EditEngine::GetGlobalItemPool() ); @@ -237,7 +232,14 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const Sv } SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw() -: SvxUnoTextRangeBase_Base() +: text::XTextRange() +, beans::XPropertySet() +, beans::XMultiPropertySet() +, beans::XMultiPropertyStates() +, beans::XPropertyState() +, lang::XServiceInfo() +, text::XTextRangeCompare() +, lang::XUnoTunnel() , osl::DebugBase<SvxUnoTextRangeBase>() , mpPropSet(rRange.getPropertySet()) { @@ -1573,6 +1575,89 @@ SvxUnoTextRange::~SvxUnoTextRange() throw() { } +uno::Any SAL_CALL SvxUnoTextRange::queryAggregation( const uno::Type & rType ) + throw(uno::RuntimeException) +{ + QUERYINT( text::XTextRange ); + else if( rType == ::getCppuType((const uno::Reference< beans::XMultiPropertyStates >*)0) ) + return uno::makeAny(uno::Reference< beans::XMultiPropertyStates >(this)); + else if( rType == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) ) + return uno::makeAny(uno::Reference< beans::XPropertySet >(this)); + else QUERYINT( beans::XPropertyState ); + else QUERYINT( text::XTextRangeCompare ); + else if( rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0) ) + return uno::makeAny(uno::Reference< beans::XMultiPropertySet >(this)); + else QUERYINT( lang::XServiceInfo ); + else QUERYINT( lang::XTypeProvider ); + else QUERYINT( lang::XUnoTunnel ); + else + return OWeakAggObject::queryAggregation( rType ); +} + +uno::Any SAL_CALL SvxUnoTextRange::queryInterface( const uno::Type & rType ) + throw(uno::RuntimeException) +{ + return OWeakAggObject::queryInterface(rType); +} + +void SAL_CALL SvxUnoTextRange::acquire() + throw( ) +{ + OWeakAggObject::acquire(); +} + +void SAL_CALL SvxUnoTextRange::release() + throw( ) +{ + OWeakAggObject::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) +{ + return theSvxUnoTextRangeTypes::get(); +} + +namespace +{ + class theSvxUnoTextRangeImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextRangeImplementationId > {}; +} + +uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextRange::getImplementationId() + throw (uno::RuntimeException) +{ + return theSvxUnoTextRangeImplementationId::get().getSeq(); +} + // XTextRange uno::Reference< text::XText > SAL_CALL SvxUnoTextRange::getText() throw(uno::RuntimeException) @@ -1591,36 +1676,19 @@ OUString SAL_CALL SvxUnoTextRange::getImplementationName() // class SvxUnoText // ==================================================================== -SvxUnoTextBase_Base::SvxUnoTextBase_Base(SvxUnoTextBase_Base const & base) - throw (): - SvxUnoTextBase_Base0(base) -{} - -SvxUnoTextBase_Base::SvxUnoTextBase_Base(SvxItemPropertySet const * set) - throw (): - SvxUnoTextBase_Base0(set) -{} - -SvxUnoTextBase_Base::SvxUnoTextBase_Base( - SvxEditSource const * source, SvxItemPropertySet const * set) throw (): - SvxUnoTextBase_Base0(source, set) -{} - -SvxUnoTextBase_Base::~SvxUnoTextBase_Base() throw () {} - SvxUnoTextBase::SvxUnoTextBase() throw() -: SvxUnoTextBase_Base( static_cast< SvxItemPropertySet * >(NULL) ) +: SvxUnoTextRangeBase( NULL ) { } SvxUnoTextBase::SvxUnoTextBase( const SvxItemPropertySet* _pSet ) throw() -: SvxUnoTextBase_Base( _pSet ) +: SvxUnoTextRangeBase( _pSet ) { } SvxUnoTextBase::SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, uno::Reference < text::XText > xParent ) throw() -: SvxUnoTextBase_Base( pSource, _pSet ) +: SvxUnoTextRangeBase( pSource, _pSet ) { xParentText = xParent; ESelection aSelection; @@ -1629,7 +1697,12 @@ SvxUnoTextBase::SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPrope } SvxUnoTextBase::SvxUnoTextBase( const SvxUnoTextBase& rText ) throw() -: SvxUnoTextBase_Base( rText ) +: SvxUnoTextRangeBase( rText ) +, text::XTextAppend() +, text::XTextCopy() +, container::XEnumerationAccess() +, text::XTextRangeMover() +, lang::XTypeProvider() { xParentText = rText.xParentText; } @@ -1638,6 +1711,89 @@ SvxUnoTextBase::~SvxUnoTextBase() throw() { } +// XInterface +uno::Any SAL_CALL SvxUnoTextBase::queryAggregation( const uno::Type & rType ) + throw(uno::RuntimeException) +{ + QUERYINT( text::XText ); + QUERYINT( text::XSimpleText ); + if( rType == ::getCppuType((const uno::Reference< text::XTextRange >*)0) ) + return uno::makeAny(uno::Reference< text::XTextRange >((text::XText*)(this))); + QUERYINT(container::XEnumerationAccess ); + QUERYINT( container::XElementAccess ); + QUERYINT( beans::XMultiPropertyStates ); + QUERYINT( beans::XPropertySet ); + QUERYINT( beans::XMultiPropertySet ); + QUERYINT( beans::XPropertyState ); + QUERYINT( text::XTextRangeCompare ); + QUERYINT( lang::XServiceInfo ); + QUERYINT( text::XTextRangeMover ); + QUERYINT( text::XTextCopy ); + QUERYINT( text::XTextAppend ); + QUERYINT( text::XParagraphAppend ); + QUERYINT( text::XTextPortionAppend ); + QUERYINT( lang::XTypeProvider ); + QUERYINT( lang::XUnoTunnel ); + + return uno::Any(); +} + +// XTypeProvider + +namespace +{ + struct theSvxUnoTextBaseTypes : + public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextBaseTypes> + { + 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() + throw (uno::RuntimeException) +{ + return getStaticTypes(); +} + +namespace +{ + class theSvxUnoTextBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextBaseImplementationId > {}; +} + +uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextBase::getImplementationId() + throw (uno::RuntimeException) +{ + return theSvxUnoTextBaseImplementationId::get().getSeq(); +} + uno::Reference< text::XTextCursor > SvxUnoTextBase::createTextCursorBySelection( const ESelection& rSel ) { SvxUnoTextCursor* pCursor = new SvxUnoTextCursor( *this ); @@ -2189,6 +2345,7 @@ SvxUnoText::SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* SvxUnoText::SvxUnoText( const SvxUnoText& rText ) throw() : SvxUnoTextBase( rText ) +, cppu::OWeakAggObject() { } @@ -2196,6 +2353,61 @@ SvxUnoText::~SvxUnoText() throw() { } +uno::Sequence< uno::Type > SAL_CALL getStaticTypes() throw() +{ + return SvxUnoTextBase::getStaticTypes(); +} + +// uno::XInterface +uno::Any SAL_CALL SvxUnoText::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException ) +{ + uno::Any aAny( SvxUnoTextBase::queryAggregation( rType ) ); + if( !aAny.hasValue() ) + aAny = OWeakAggObject::queryAggregation( rType ); + + return aAny; +} + +uno::Any SAL_CALL SvxUnoText::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException ) +{ + return OWeakAggObject::queryInterface( rType ); +} + +void SAL_CALL SvxUnoText::acquire() throw( ) +{ + OWeakAggObject::acquire(); +} + +void SAL_CALL SvxUnoText::release() throw( ) +{ + OWeakAggObject::release(); +} + +// lang::XTypeProvider +uno::Sequence< uno::Type > SAL_CALL SvxUnoText::getTypes( ) throw( uno::RuntimeException ) +{ + return SvxUnoTextBase::getTypes(); +} + +namespace +{ + class theSvxUnoTextImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextImplementationId > {}; +} + +uno::Sequence< sal_Int8 > SAL_CALL SvxUnoText::getImplementationId( ) throw( uno::RuntimeException ) +{ + return theSvxUnoTextImplementationId::get().getSeq(); +} + +SvxUnoText* SvxUnoText::getImplementation( const uno::Reference< uno::XInterface >& xInt ) +{ + uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY ); + if( xUT.is() ) + return reinterpret_cast<SvxUnoText*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SvxUnoText::getUnoTunnelId()))); + else + return NULL; +} + namespace { class theSvxUnoTextUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextUnoTunnelId > {}; diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx index e3fb8c93a9b4..886b99e23e7a 100644 --- a/editeng/source/uno/unotext2.cxx +++ b/editeng/source/uno/unotext2.cxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ #include <vcl/svapp.hxx> #include <osl/mutex.hxx> @@ -41,6 +32,10 @@ using namespace ::rtl; using namespace ::cppu; using namespace ::com::sun::star; +#define QUERYINT( xint ) \ + if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \ + return uno::makeAny(uno::Reference< xint >(this)) + // ==================================================================== // SvxUnoTextContentEnumeration // ==================================================================== @@ -104,7 +99,7 @@ uno::Any SvxUnoTextContentEnumeration::nextElement(void) throw( container::NoSuc // ==================================================================== SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw() -: SvxUnoTextContent_Base(rText) +: SvxUnoTextRangeBase(rText) , mnParagraph(nPara) , mrParentText(rText) , maDisposeListeners(maDisposeContainerMutex) @@ -116,7 +111,11 @@ SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextBase& rText, sal_uInt16 nP } SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw() -: SvxUnoTextContent_Base(rContent) +: SvxUnoTextRangeBase(rContent) +, text::XTextContent() +, container::XEnumerationAccess() +, lang::XTypeProvider() +, cppu::OWeakAggObject() , mrParentText(rContent.mrParentText) , maDisposeListeners(maDisposeContainerMutex) , mbDisposing( false ) @@ -130,6 +129,89 @@ SvxUnoTextContent::~SvxUnoTextContent() throw() { } +// uno::XInterface +uno::Any SAL_CALL SvxUnoTextContent::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException ) +{ + QUERYINT( text::XTextRange ); + else QUERYINT( beans::XMultiPropertyStates ); + else QUERYINT( beans::XPropertySet ); + else QUERYINT( beans::XMultiPropertySet ); + else QUERYINT( beans::XPropertyState ); + else QUERYINT( text::XTextContent ); + else QUERYINT( text::XTextRangeCompare ); + else QUERYINT( lang::XComponent ); + else QUERYINT( container::XEnumerationAccess ); + else QUERYINT( container::XElementAccess ); + else QUERYINT( lang::XServiceInfo ); + else QUERYINT( lang::XTypeProvider ); + else QUERYINT( lang::XUnoTunnel ); + else + return OWeakAggObject::queryAggregation( rType ); +} + +uno::Any SAL_CALL SvxUnoTextContent::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException ) +{ + return OWeakAggObject::queryInterface(rType); +} + +void SAL_CALL SvxUnoTextContent::acquire() throw( ) +{ + OWeakAggObject::acquire(); +} + +void SAL_CALL SvxUnoTextContent::release() throw( ) +{ + OWeakAggObject::release(); +} + +// 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) +{ + return theSvxUnoTextContentTypes::get(); +} + +namespace +{ + class theSvxUnoTextContentImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextContentImplementationId > {}; +} + +uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextContent::getImplementationId() + throw (uno::RuntimeException) +{ + return theSvxUnoTextContentImplementationId::get().getSeq(); +} + // text::XTextRange uno::Reference< text::XText > SAL_CALL SvxUnoTextContent::getText() @@ -382,18 +464,6 @@ uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement() // class SvxUnoTextCursor // ==================================================================== -SvxUnoTextCursor_Base::SvxUnoTextCursor_Base(SvxUnoTextCursor_Base const & base) - throw (): - SvxUnoTextCursor_Base0(base) -{} - -SvxUnoTextCursor_Base::SvxUnoTextCursor_Base(SvxUnoTextRangeBase const & base) - throw (): - SvxUnoTextCursor_Base0(base) -{} - -SvxUnoTextCursor_Base::~SvxUnoTextCursor_Base() throw () {} - uno::Reference< uno::XInterface > SvxUnoTextCursor_NewInstance() { SvxUnoText aText; @@ -403,13 +473,16 @@ uno::Reference< uno::XInterface > SvxUnoTextCursor_NewInstance() } SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw() -: SvxUnoTextCursor_Base(rText), +: SvxUnoTextRangeBase(rText), mxParentText( const_cast<SvxUnoTextBase*>(&rText) ) { } SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw() -: SvxUnoTextCursor_Base(rCursor) +: SvxUnoTextRangeBase(rCursor) +, text::XTextCursor() +, lang::XTypeProvider() +, cppu::OWeakAggObject() , mxParentText(rCursor.mxParentText) { } @@ -418,6 +491,89 @@ SvxUnoTextCursor::~SvxUnoTextCursor() throw() { } +// Comment out automatically - [getIdlClass(es) or queryInterface] +// Please use the XTypeProvider! +//sal_Bool SvxUnoTextCursor::queryInterface( uno::Uik aUIK, Reference< uno::XInterface > & xRef) +uno::Any SAL_CALL SvxUnoTextCursor::queryAggregation( const uno::Type & rType ) + throw(uno::RuntimeException) +{ + if( rType == ::getCppuType((const uno::Reference< text::XTextRange >*)0) ) + return uno::makeAny(uno::Reference< text::XTextRange >((text::XText*)(this))); + else QUERYINT( text::XTextCursor ); + else QUERYINT( beans::XMultiPropertyStates ); + else QUERYINT( beans::XPropertySet ); + else QUERYINT( beans::XMultiPropertySet ); + else QUERYINT( beans::XPropertyState ); + else QUERYINT( text::XTextRangeCompare ); + else QUERYINT( lang::XServiceInfo ); + else QUERYINT( lang::XTypeProvider ); + else QUERYINT( lang::XUnoTunnel ); + else + return OWeakAggObject::queryAggregation( rType ); +} + +uno::Any SAL_CALL SvxUnoTextCursor::queryInterface( const uno::Type & rType ) + throw(uno::RuntimeException) +{ + return OWeakAggObject::queryInterface(rType); +} + +void SAL_CALL SvxUnoTextCursor::acquire() throw ( ) +{ + OWeakAggObject::acquire(); +} + +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) +{ + return theSvxUnoTextCursorTypes::get(); +} + +namespace +{ + class theSvxUnoTextCursorImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextCursorImplementationId > {}; +} + +uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextCursor::getImplementationId() + throw (uno::RuntimeException) +{ + return theSvxUnoTextCursorImplementationId::get().getSeq(); +} + // text::XTextCursor void SAL_CALL SvxUnoTextCursor::collapseToStart() throw(uno::RuntimeException) |