You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by js...@apache.org on 2013/03/20 16:19:46 UTC
svn commit: r1458881 - in /openoffice/trunk/main:
offapi/com/sun/star/text/XTextMarkup.idl sw/inc/unoflatpara.hxx
sw/inc/unotextmarkup.hxx sw/source/core/unocore/unoflatpara.cxx
sw/source/core/unocore/unotextmarkup.cxx
Author: jsc
Date: Wed Mar 20 15:19:45 2013
New Revision: 1458881
URL: http://svn.apache.org/r1458881
Log:
#121734# extend XTextMarkup to support ranges
Patch by: Kai Labusch
Review by: arielch, jsc
Modified:
openoffice/trunk/main/offapi/com/sun/star/text/XTextMarkup.idl
openoffice/trunk/main/sw/inc/unoflatpara.hxx
openoffice/trunk/main/sw/inc/unotextmarkup.hxx
openoffice/trunk/main/sw/source/core/unocore/unoflatpara.cxx
openoffice/trunk/main/sw/source/core/unocore/unotextmarkup.cxx
Modified: openoffice/trunk/main/offapi/com/sun/star/text/XTextMarkup.idl
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/offapi/com/sun/star/text/XTextMarkup.idl?rev=1458881&r1=1458880&r2=1458881&view=diff
==============================================================================
--- openoffice/trunk/main/offapi/com/sun/star/text/XTextMarkup.idl (original)
+++ openoffice/trunk/main/offapi/com/sun/star/text/XTextMarkup.idl Wed Mar 20 15:19:45 2013
@@ -32,6 +32,11 @@
#include <com/sun/star/text/TextMarkupType.idl>
#endif
+#ifndef __com_sun_star_text_XTextRange_idl__
+#include <com/sun/star/text/XTextRange.idl>
+#endif
+
+
//=============================================================================
module com { module sun { module star { module text {
@@ -74,11 +79,17 @@ interface XTextMarkup
@param xMarkupInfoContainer
contains additional information about the markup.
*/
- void commitTextMarkup( [in] long nType,
+ void commitStringMarkup( [in] long nType,
[in] string aIdentifier,
[in] long nStart,
[in] long nLength,
[in] com::sun::star::container::XStringKeyMap xMarkupInfoContainer );
+
+ void commitTextRangeMarkup( [in] long nType,
+ [in] string aIdentifier,
+ [in] com::sun::star::text::XTextRange xRange,
+ [in] com::sun::star::container::XStringKeyMap xMarkupInfoContainer );
+
};
}; }; }; };
Modified: openoffice/trunk/main/sw/inc/unoflatpara.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/unoflatpara.hxx?rev=1458881&r1=1458880&r2=1458881&view=diff
==============================================================================
--- openoffice/trunk/main/sw/inc/unoflatpara.hxx (original)
+++ openoffice/trunk/main/sw/inc/unoflatpara.hxx Wed Mar 20 15:19:45 2013
@@ -40,6 +40,10 @@ namespace com { namespace sun { namespac
class XStringKeyMap;
} } } }
+namespace com { namespace sun { namespace star { namespace text {
+ class XTextRange;
+} } } }
+
class SwTxtNode;
class SwDoc;
@@ -68,7 +72,14 @@ public:
// text::XTextMarkup:
virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() throw (css::uno::RuntimeException);
- virtual void SAL_CALL commitTextMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength, const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength,
+ const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange> & xRange,
+ const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) throw (css::uno::RuntimeException);
+
+
// text::XFlatParagraph:
virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
Modified: openoffice/trunk/main/sw/inc/unotextmarkup.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/unotextmarkup.hxx?rev=1458881&r1=1458880&r2=1458881&view=diff
==============================================================================
--- openoffice/trunk/main/sw/inc/unotextmarkup.hxx (original)
+++ openoffice/trunk/main/sw/inc/unotextmarkup.hxx Wed Mar 20 15:19:45 2013
@@ -37,6 +37,11 @@ namespace com { namespace sun { namespac
class XStringKeyMap;
} } } }
+namespace com { namespace sun { namespace star { namespace text {
+ class XTextRange;
+} } } }
+
+
class SwTxtNode;
class SfxPoolItem;
@@ -56,7 +61,14 @@ public:
// ::com::sun::star::text::XTextMarkup:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL commitTextMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > & xMarkupInfoContainer) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > & xMarkupInfoContainer) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange> & xRange,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > & xMarkupInfoContainer) throw (::com::sun::star::uno::RuntimeException);
+
+
// ::com::sun::star::text::XMultiTextMarkup:
virtual void SAL_CALL commitMultiTextMarkup( const ::com::sun::star::uno::Sequence< ::com::sun::star::text::TextMarkupDescriptor >& aMarkups ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
Modified: openoffice/trunk/main/sw/source/core/unocore/unoflatpara.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/unocore/unoflatpara.cxx?rev=1458881&r1=1458880&r2=1458881&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/unocore/unoflatpara.cxx (original)
+++ openoffice/trunk/main/sw/source/core/unocore/unoflatpara.cxx Wed Mar 20 15:19:45 2013
@@ -50,6 +50,9 @@
#include <IGrammarContact.hxx>
#include <viewopt.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+
using namespace ::com::sun::star;
/******************************************************************************
@@ -117,10 +120,18 @@ css::uno::Reference< css::container::XSt
return SwXTextMarkup::getMarkupInfoContainer();
}
-void SAL_CALL SwXFlatParagraph::commitTextMarkup(::sal_Int32 nType, const ::rtl::OUString & rIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength, const css::uno::Reference< css::container::XStringKeyMap > & rxMarkupInfoContainer) throw (css::uno::RuntimeException)
+void SAL_CALL SwXFlatParagraph::commitTextRangeMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, const uno::Reference< text::XTextRange> & xRange,
+ const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwXTextMarkup::commitTextRangeMarkup( nType, aIdentifier, xRange, xMarkupInfoContainer );
+}
+
+
+void SAL_CALL SwXFlatParagraph::commitStringMarkup(::sal_Int32 nType, const ::rtl::OUString & rIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength, const css::uno::Reference< css::container::XStringKeyMap > & rxMarkupInfoContainer) throw (css::uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwXTextMarkup::commitTextMarkup( nType, rIdentifier, nStart, nLength, rxMarkupInfoContainer );
+ SwXTextMarkup::commitStringMarkup( nType, rIdentifier, nStart, nLength, rxMarkupInfoContainer );
}
// text::XFlatParagraph:
Modified: openoffice/trunk/main/sw/source/core/unocore/unotextmarkup.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/unocore/unotextmarkup.cxx?rev=1458881&r1=1458880&r2=1458881&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/unocore/unotextmarkup.cxx (original)
+++ openoffice/trunk/main/sw/source/core/unocore/unotextmarkup.cxx Wed Mar 20 15:19:45 2013
@@ -36,6 +36,15 @@
#include <IGrammarContact.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+
+#include <pam.hxx>
+
+#include <unotextrange.hxx>
+#include <unotextcursor.hxx>
+
+
using namespace ::com::sun::star;
/*
@@ -62,7 +71,52 @@ uno::Reference< container::XStringKeyMap
return xProp;
}
-void SAL_CALL SwXTextMarkup::commitTextMarkup(
+void SAL_CALL SwXTextMarkup::commitTextRangeMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, const uno::Reference< text::XTextRange> & xRange,
+ const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
+
+ if(!xRangeTunnel.is()) return;
+
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+
+ if(xRangeTunnel.is())
+ {
+ pRange = reinterpret_cast<SwXTextRange*>( sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething(SwXTextRange::getUnoTunnelId())));
+ pCursor = reinterpret_cast<OTextCursorHelper*>( sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething(OTextCursorHelper::getUnoTunnelId())));
+ }
+
+ if (pRange)
+ {
+ SwDoc* pDoc = reinterpret_cast<SwDoc*>(pRange->GetDoc());
+
+ if (!pDoc) return;
+
+ SwUnoInternalPaM aPam(*pDoc);
+
+ ::sw::XTextRangeToSwPaM(aPam, xRange);
+
+ SwPosition* startPos = aPam.Start();
+ SwPosition* endPos = aPam.End();
+
+ commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), xMarkupInfoContainer);
+ }
+ else if (pCursor)
+ {
+ SwPaM aPam(*pCursor->GetPaM());
+
+ SwPosition* startPos = aPam.Start();
+ SwPosition* endPos = aPam.End();
+
+ commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), xMarkupInfoContainer);
+ }
+}
+
+
+void SAL_CALL SwXTextMarkup::commitStringMarkup(
::sal_Int32 nType,
const ::rtl::OUString & rIdentifier,
::sal_Int32 nStart,