summaryrefslogtreecommitdiff
path: root/sw/inc/unotextrange.hxx
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2010-01-05 16:37:46 +0100
committerMichael Stahl <mst@openoffice.org>2010-01-05 16:37:46 +0100
commite23c9ccd3e9e8d415d0bbab189e2de5ba48b42e9 (patch)
tree9991ab227ef357c5fb2be9561872ae4d28ba4c7d /sw/inc/unotextrange.hxx
parent3d404991d52a130cf2144bcf3aec2ea52859d31f (diff)
swunolocking1: #i105557#: unoobj.hxx: split out unotextrange.hxx:
move SwXTextRange, SwXTextRanges from unoobj.hxx to new unotextrange.hxx. move SwUnoInternalPaM to unotextrange.hxx.
Diffstat (limited to 'sw/inc/unotextrange.hxx')
-rw-r--r--sw/inc/unotextrange.hxx376
1 files changed, 376 insertions, 0 deletions
diff --git a/sw/inc/unotextrange.hxx b/sw/inc/unotextrange.hxx
new file mode 100644
index 000000000000..a7d13daf4848
--- /dev/null
+++ b/sw/inc/unotextrange.hxx
@@ -0,0 +1,376 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: unoobj.hxx,v $
+ *
+ * $Revision: 1.49 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNOTEXTRANGE_HXX
+#define SW_UNOTEXTRANGE_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XRedline.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase8.hxx>
+
+#include <svtools/svarray.hxx>
+
+#include <calbck.hxx>
+#include <pam.hxx>
+
+
+class String;
+class SfxItemPropertySet;
+class SwDoc;
+class SwStartNode;
+struct SwPosition;
+class SwPaM;
+class SwUnoCrsr;
+class SwFrmFmt;
+class SwTableBox;
+
+namespace sw {
+ namespace mark {
+ class IMark;
+ }
+}
+
+/* -----------------29.04.98 07:35-------------------
+ *
+ * --------------------------------------------------*/
+class SwUnoInternalPaM
+ : public SwPaM
+{
+
+private:
+ SwUnoInternalPaM(const SwUnoInternalPaM&);
+ SwUnoInternalPaM& operator=(const SwPaM& rPaM);
+
+public:
+ SwUnoInternalPaM(SwDoc& rDoc);
+ virtual ~SwUnoInternalPaM();
+
+};
+
+
+typedef ::cppu::WeakImplHelper8
+< ::com::sun::star::lang::XUnoTunnel
+, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::beans::XPropertySet
+, ::com::sun::star::beans::XPropertyState
+, ::com::sun::star::container::XEnumerationAccess
+, ::com::sun::star::container::XContentEnumerationAccess
+, ::com::sun::star::text::XTextRange
+, ::com::sun::star::text::XRedline
+> SwXTextRange_Base;
+
+class SW_DLLPUBLIC SwXTextRange
+ : public SwXTextRange_Base
+ , private SwClient
+{
+
+private:
+
+ friend class SwXText;
+
+ enum RangePosition
+ {
+ RANGE_IN_TEXT, // "ordinary" ::com::sun::star::text::TextRange
+ RANGE_IN_FRAME, // position created with a frame that has no uno object
+ RANGE_IN_CELL, // position created with a cell that has no uno object
+ RANGE_IS_TABLE, // anchor of a table
+ RANGE_INVALID // created by NewInstance
+ } eRangePosition;
+
+ SwDoc* pDoc;
+ SwTableBox* pBox;
+ const SwStartNode* pBoxStartNode;
+ SwDepend aObjectDepend; // register at format of table or frame
+ const SfxItemPropertySet* m_pPropSet;
+ //SwDepend aFrameDepend;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ xParentText;
+ ::sw::mark::IMark* pMark;
+
+ void _CreateNewBookmark(SwPaM& rPam);
+ //TODO: new exception type for protected content
+ void DeleteAndInsert(const String& rText, const bool bForceExpandHints)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+
+ virtual ~SwXTextRange();
+
+public:
+
+ SwXTextRange(SwPaM& rPam,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XText > & xParent,
+ enum RangePosition eRange = RANGE_IN_TEXT);
+ // only for RANGE_IS_TABLE
+ SwXTextRange(SwFrmFmt& rTblFmt);
+
+ BOOL GetPositions(SwPaM& rToFill) const;
+ const SwDoc* GetDoc() const
+ { return pDoc; }
+ SwDoc* GetDoc()
+ { return pDoc; }
+ const ::sw::mark::IMark * GetBookmark() const
+ { return pMark; }
+
+ static BOOL XTextRangeToSwPaM(SwUnoInternalPaM& rToFill,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange);
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > CreateTextRangeFromPosition(
+ SwDoc* pDoc,
+ const SwPosition& rPos, const SwPosition* pMark);
+ static ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ CreateParentXText(SwDoc* pDoc, const SwPosition& rPos);
+
+ TYPEINFO();
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::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);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& xListener)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL
+ getPropertyState(const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyState > SAL_CALL
+ getPropertyStates(
+ const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString >& rPropertyNames)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
+ const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XEnumeration > SAL_CALL
+ createEnumeration()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XContentEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XEnumeration > SAL_CALL
+ createContentEnumeration(const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getAvailableServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ SAL_CALL getText()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getStart()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > SAL_CALL getEnd()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getString()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString(const ::rtl::OUString& rString)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XRedline
+ virtual void SAL_CALL makeRedline(
+ const ::rtl::OUString& rRedlineType,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& RedlineProperties)
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+};
+
+/* -----------------15.05.98 08:29-------------------
+ *
+ * --------------------------------------------------*/
+typedef ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > *
+ XTextRangeRefPtr;
+SV_DECL_PTRARR(XTextRangeArr, XTextRangeRefPtr, 4, 4)
+
+typedef ::cppu::WeakImplHelper3
+< ::com::sun::star::lang::XUnoTunnel
+, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::container::XIndexAccess
+> SwXTextRanges_Base;
+
+class SwXTextRanges
+ : public SwXTextRanges_Base
+ , public SwClient
+{
+
+private:
+
+ XTextRangeArr* pRangeArr;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ xParentText;
+ XTextRangeArr* GetRangesArray();
+ SwUnoCrsr* GetCrsr() const { return (SwUnoCrsr*)GetRegisteredIn(); }
+
+protected:
+
+ virtual ~SwXTextRanges();
+
+public:
+
+ SwXTextRanges();
+ SwXTextRanges(SwPaM* pCrsr);
+
+ const SwUnoCrsr* GetCursor() const {
+ return (const SwUnoCrsr*)(GetRegisteredIn());
+ }
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& rServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+};
+
+#endif // SW_UNOTEXTRANGE_HXX
+