[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 6 commits - cppuhelper/source offapi/com svx/inc svx/source sw/inc sw/source

Herbert Dürr hdu at apache.org
Wed Mar 20 18:22:33 PDT 2013


 cppuhelper/source/bootstrap.cxx                                 |    5 
 cppuhelper/source/makefile.mk                                   |    5 
 cppuhelper/source/primeweak.cxx                                 |  128 ++++++
 offapi/com/sun/star/smarttags/XRangeBasedSmartTagRecognizer.idl |  101 +++++
 offapi/com/sun/star/smarttags/XSmartTagAction.idl               |    9 
 offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl           |    6 
 offapi/com/sun/star/smarttags/makefile.mk                       |    1 
 offapi/com/sun/star/text/XMarkingAccess.idl                     |   47 ++
 offapi/com/sun/star/text/XTextMarkup.idl                        |   13 
 offapi/com/sun/star/text/makefile.mk                            |    1 
 svx/inc/svx/SmartTagMgr.hxx                                     |    8 
 svx/source/mnuctrls/SmartTagCtl.cxx                             |    4 
 svx/source/smarttags/SmartTagMgr.cxx                            |   39 +-
 sw/inc/unoflatpara.hxx                                          |   13 
 sw/inc/unotextcursor.hxx                                        |   15 
 sw/inc/unotextmarkup.hxx                                        |   14 
 sw/source/core/inc/wrong.hxx                                    |  149 +++++++
 sw/source/core/text/wrong.cxx                                   |   29 +
 sw/source/core/txtnode/fntcache.cxx                             |  195 +++++-----
 sw/source/core/txtnode/txtedt.cxx                               |   12 
 sw/source/core/unocore/unoflatpara.cxx                          |   15 
 sw/source/core/unocore/unoobj.cxx                               |   42 ++
 sw/source/core/unocore/unotextmarkup.cxx                        |   56 ++
 sw/source/ui/smartmenu/stmenu.cxx                               |    2 
 24 files changed, 789 insertions(+), 120 deletions(-)

New commits:
commit af614d3f8358663879e086da1a3545f9f4fd10a2
Author: Herbert Dürr <hdu at apache.org>
Date:   Wed Mar 20 15:33:52 2013 +0000

    Workaround bootstrap needing "comprehensive" type descriptions for stuff used in bootstrapping
    
    Cppumaker and its brethren emit different implementations for
    the same symbol by design (!) which is quite... unfortunate
    and can confuse the heck out of dynamic linkers, debuggers, etc.
    
    For bootstrapping the so-called "comprehensive" type descriptions are needed.
    The workaround compels these descriptions to be registered in the so-called "WeakMap"
    before they are needed by the bootstrap operation.
    
    The proper and un-hacky solution would be to change cppumaker and its brethren
    to use different symbol names for different implementations. In particular
    "cppu_detail_getUnoType" should be divided into full, weak and mini implementations.
    For now there is no time to risk such a major overhaul of this system.
    
    Types that are candidates for this special workaround are the ones mentioned
    by the exceptions thrown from implbase_ex.cxx's __queryDeepNoXInterface() method.
    They also need to added to the makefile's UNOTYPES define so that the build magic
    requests the full type descriptions to be generated and used.

diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 2413486..07c1116 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -48,6 +48,8 @@
 #include "cppuhelper/access_control.hxx"
 #include "cppuhelper/findsofficepath.h"
 
+#include <cppuhelper/com/sun/star/container/XElementAccess.hpp>
+
 #include "com/sun/star/uno/XComponentContext.hpp"
 #include "com/sun/star/uno/XCurrentContext.hpp"
 
@@ -67,6 +69,7 @@
 #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
 #define ARLEN(x) sizeof (x) / sizeof *(x)
 
+void primeWeakMap( void); // as defined in primeweak.cxx
 
 using namespace ::rtl;
 using namespace ::osl;
@@ -376,6 +379,8 @@ SAL_CALL defaultBootstrap_InitialComponentContext(
     Bootstrap const & bootstrap )
     SAL_THROW( (Exception) )
 {
+    primeWeakMap();
+
     OUString bootstrapPath;
     if (!bootstrap.getFrom(
             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URE_INTERNAL_LIB_DIR")),
diff --git a/cppuhelper/source/makefile.mk b/cppuhelper/source/makefile.mk
index 586ab06..9311ee4 100644
--- a/cppuhelper/source/makefile.mk
+++ b/cppuhelper/source/makefile.mk
@@ -78,6 +78,7 @@ UNOTYPES= \
         com.sun.star.lang.XServiceInfo \
         com.sun.star.lang.XSingleComponentFactory \
         com.sun.star.lang.XSingleServiceFactory \
+        com.sun.star.lang.XUnoTunnel \
         com.sun.star.lang.XTypeProvider \
         com.sun.star.loader.XImplementationLoader \
         com.sun.star.reflection.XArrayTypeDescription \
@@ -123,6 +124,7 @@ SLOFILES= \
         $(SLO)$/exc_thrower.obj 	\
         $(SLO)$/servicefactory.obj 	\
         $(SLO)$/bootstrap.obj 		\
+        $(SLO)$/primeweak.obj 		\
         $(SLO)$/implbase.obj 		\
         $(SLO)$/implbase_ex.obj 	\
         $(SLO)$/propshlp.obj 		\
@@ -174,7 +176,8 @@ SHL1VERSIONMAP=msvc_win32_intel.map
 SHL1VERSIONMAP=cc5_solaris_sparc.map
 .ELIF "$(GUI)$(COMNAME)"=="OS2gcc3"
 SHL1VERSIONMAP=gcc3os2.map
-.ELIF "$(COMNAME)"=="gcc3"
+#.ELIF "$(COMNAME)"=="gcc3" || "$(COMNAME)"=="Clang"
+.ELSE
 SHL1VERSIONMAP=gcc3.map
 .ENDIF
 
diff --git a/cppuhelper/source/primeweak.cxx b/cppuhelper/source/primeweak.cxx
new file mode 100644
index 0000000..c3bf7a9
--- /dev/null
+++ b/cppuhelper/source/primeweak.cxx
@@ -0,0 +1,128 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+// The only purpose of this file is to workaround a problem in UNO:
+// Cppumaker and its brethren emit different implementations for
+// the same symbol by design (!) which is quite... unfortunate
+// and can confuse the heck out of dynamic linkers, debuggers, etc.
+//
+// For bootstrapping comprehensive descriptions of some UNO types are needed.
+// The mechanism in this file makes sure that these comprehensive type
+// descriptions are used to prime the so-called "WeakMap".
+//
+// TODO: change cppumaker and its brethren to use different symbol names
+//       for different implementations. In particular "cppu_detail_getUnoType"
+//       should be divided into full, weak and mini implementations.
+
+// Types that are candidates for this special workaround are the ones mentioned
+// by the exceptions thrown from implbase_ex.cxx's __queryDeepNoXInterface()
+// that also need to added to the makefile's UNOTYPES define
+
+#define cppu_detail_getUnoType cppu_full_getUnoType
+#define InitTypeDesc(T) {(void)cppu_full_getUnoType(static_cast< T * >(NULL));}
+
+#include "cppuhelper/com/sun/star/lang/XComponent.hpp"
+#include "cppuhelper/com/sun/star/lang/XInitialization.hpp"
+#include "cppuhelper/com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "cppuhelper/com/sun/star/lang/XSingleComponentFactory.hpp"
+#include "cppuhelper/com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "cppuhelper/com/sun/star/lang/XMulticomponentFactory.hpp"
+#include "cppuhelper/com/sun/star/lang/XServiceInfo.hpp"
+#include "cppuhelper/com/sun/star/lang/XEventListener.hpp"
+#include "cppuhelper/com/sun/star/lang/XTypeProvider.hpp"
+#include "cppuhelper/com/sun/star/lang/XUnoTunnel.hpp"
+#include "cppuhelper/com/sun/star/uno/DeploymentException.hpp"
+#include "cppuhelper/com/sun/star/uno/XWeak.hpp"
+#include "cppuhelper/com/sun/star/uno/XCurrentContext.hpp"
+#include "cppuhelper/com/sun/star/uno/XComponentContext.hpp"
+#include "cppuhelper/com/sun/star/uno/RuntimeException.hpp"
+#include "cppuhelper/com/sun/star/beans/PropertyValue.hpp"
+#include "cppuhelper/com/sun/star/beans/XPropertySet.hpp"
+#include "cppuhelper/com/sun/star/beans/XMultiPropertySet.hpp"
+#include "cppuhelper/com/sun/star/container/XEnumerationAccess.hpp"
+#include "cppuhelper/com/sun/star/container/XEnumeration.hpp"
+#include "cppuhelper/com/sun/star/container/XHierarchicalNameAccess.hpp"
+#include "cppuhelper/com/sun/star/container/XSet.hpp"
+#include "cppuhelper/com/sun/star/bridge/XUnoUrlResolver.hpp"
+#include "cppuhelper/com/sun/star/bridge/XUnoUrlResolver.hpp"
+#include "cppuhelper/com/sun/star/io/IOException.hpp"
+#include "cppuhelper/com/sun/star/io/FilePermission.hpp"
+#include "cppuhelper/com/sun/star/security/RuntimePermission.hpp"
+#include "cppuhelper/com/sun/star/loader/XImplementationLoader.hpp"
+#include "cppuhelper/com/sun/star/security/XAccessController.hpp"
+#include "cppuhelper/com/sun/star/registry/XRegistryKey.hpp"
+#include "cppuhelper/com/sun/star/registry/XSimpleRegistry.hpp"
+#include "cppuhelper/com/sun/star/reflection/XTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XEnumTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XArrayTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XStructTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XUnionTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XCompoundTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XIndirectTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XMethodParameter.hpp"
+
+void primeWeakMap( void)
+{
+    InitTypeDesc( com::sun::star::lang::XComponent );
+    InitTypeDesc( com::sun::star::lang::XInitialization );
+    InitTypeDesc( com::sun::star::lang::XSingleServiceFactory );
+    InitTypeDesc( com::sun::star::lang::XSingleComponentFactory );
+    InitTypeDesc( com::sun::star::lang::XMultiServiceFactory );
+    InitTypeDesc( com::sun::star::lang::XMultiComponentFactory );
+    InitTypeDesc( com::sun::star::lang::XServiceInfo );
+    InitTypeDesc( com::sun::star::lang::XEventListener );
+    InitTypeDesc( com::sun::star::lang::XTypeProvider );
+    InitTypeDesc( com::sun::star::lang::XUnoTunnel );
+    InitTypeDesc( com::sun::star::uno::XWeak );
+    InitTypeDesc( com::sun::star::uno::DeploymentException );
+    InitTypeDesc( com::sun::star::uno::XCurrentContext );
+    InitTypeDesc( com::sun::star::uno::XComponentContext );
+    InitTypeDesc( com::sun::star::uno::RuntimeException );
+    InitTypeDesc( com::sun::star::beans::PropertyState );
+    InitTypeDesc( com::sun::star::beans::PropertyValue );
+    InitTypeDesc( com::sun::star::beans::XPropertySet );
+    InitTypeDesc( com::sun::star::beans::XMultiPropertySet );
+    InitTypeDesc( com::sun::star::container::XElementAccess );
+    InitTypeDesc( com::sun::star::container::XEnumeration );
+    InitTypeDesc( com::sun::star::container::XEnumerationAccess );
+    InitTypeDesc( com::sun::star::container::XHierarchicalNameAccess );
+    InitTypeDesc( com::sun::star::container::XSet );
+    InitTypeDesc( com::sun::star::io::IOException );
+    InitTypeDesc( com::sun::star::io::FilePermission );
+    InitTypeDesc( com::sun::star::security::XAccessController );
+    InitTypeDesc( com::sun::star::security::RuntimePermission);
+    InitTypeDesc( com::sun::star::loader::XImplementationLoader );
+    InitTypeDesc( com::sun::star::bridge::XUnoUrlResolver );
+    InitTypeDesc( com::sun::star::registry::XRegistryKey );
+    InitTypeDesc( com::sun::star::registry::XSimpleRegistry );
+    InitTypeDesc( com::sun::star::reflection::XTypeDescription );
+    InitTypeDesc( com::sun::star::reflection::XEnumTypeDescription );
+    InitTypeDesc( com::sun::star::reflection::XArrayTypeDescription );
+    InitTypeDesc( com::sun::star::reflection::XStructTypeDescription );
+    InitTypeDesc( com::sun::star::reflection::XUnionTypeDescription );
+    InitTypeDesc( com::sun::star::reflection::XCompoundTypeDescription );
+    InitTypeDesc( com::sun::star::reflection::XIndirectTypeDescription );
+    InitTypeDesc( com::sun::star::reflection::XMethodParameter );
+}
+
commit de75173372c022c3004643d8978f76662261130b
Author: Jürgen Schmidt <jsc at apache.org>
Date:   Wed Mar 20 14:19:45 2013 +0000

    #121734# extend XTextMarkup to support ranges
    
    Patch by: Kai Labusch
    Review by: arielch, jsc

diff --git a/offapi/com/sun/star/text/XTextMarkup.idl b/offapi/com/sun/star/text/XTextMarkup.idl
index d051ad7..041ee68 100644
--- a/offapi/com/sun/star/text/XTextMarkup.idl
+++ b/offapi/com/sun/star/text/XTextMarkup.idl
@@ -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 );
+
 };
 
 }; }; }; };
diff --git a/sw/inc/unoflatpara.hxx b/sw/inc/unoflatpara.hxx
index 45e741b..31a1d22 100644
--- a/sw/inc/unoflatpara.hxx
+++ b/sw/inc/unoflatpara.hxx
@@ -40,6 +40,10 @@ namespace com { namespace sun { namespace star { namespace container {
     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);
diff --git a/sw/inc/unotextmarkup.hxx b/sw/inc/unotextmarkup.hxx
index a127dc5..5fb9d32 100644
--- a/sw/inc/unotextmarkup.hxx
+++ b/sw/inc/unotextmarkup.hxx
@@ -37,6 +37,11 @@ namespace com { namespace sun { namespace star { namespace container {
     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);
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
index 5338efe..fabd18b 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -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::XStringKeyMap > SAL_CALL SwXFlatParagraph::
     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:
diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx
index 342345b..382f248 100644
--- a/sw/source/core/unocore/unotextmarkup.cxx
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -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 > SAL_CALL SwXTextMarkup::getMarkupInfo
     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,
commit 5da75c78a80e43cb2bb4ed777ae5efcc1449cdda
Author: Jürgen Schmidt <jsc at apache.org>
Date:   Wed Mar 20 14:18:15 2013 +0000

    #121733# enhancement for colored smarttags
    
    Patch By: Kai Labusch
    Review by: arielch, jsc

diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx
index 41d546a..e5517b4 100644
--- a/sw/source/core/inc/wrong.hxx
+++ b/sw/source/core/inc/wrong.hxx
@@ -28,12 +28,37 @@
 #include <com/sun/star/container/XStringKeyMap.hpp>
 #endif
 
+#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
 #include <vector>
 
 #include <tools/string.hxx>
+#include <tools/color.hxx>
+#include <viewopt.hxx>
 
 class SwWrongList;
 
+enum WrongAreaLineType
+{
+    WRONGAREA_DASHED,
+    WRONGAREA_WAVE,
+    WRONGAREA_WAVE_NORMAL,
+    WRONGAREA_WAVE_SMALL,
+    WRONGAREA_WAVE_FLAT,
+    WRONGAREA_NONE
+};
+
+enum WrongListType
+{
+    WRONGLIST_SPELL,
+    WRONGLIST_GRAMMAR,
+    WRONGLIST_SMARTTAG,
+    WRONGLIST_CHANGETRACKING
+};
+
+
 // ST2
 class SwWrongArea
 {
@@ -44,21 +69,122 @@ public:
     xub_StrLen mnLen;
     SwWrongList* mpSubList;
 
-    SwWrongArea() : mnPos(0), mnLen(0), mpSubList(NULL) {}
+    Color mColor;
+    WrongAreaLineType mLineType;
+
+    SwWrongArea( const rtl::OUString& rType,
+                 WrongListType listType,
+                 com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag,
+                 xub_StrLen nPos,
+                 xub_StrLen nLen);
+
     SwWrongArea( const rtl::OUString& rType,
                  com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag,
                  xub_StrLen nPos,
                  xub_StrLen nLen,
-                 SwWrongList* pSubList )
-        : maType(rType), mxPropertyBag(xPropertyBag), mnPos(nPos), mnLen(nLen), mpSubList(pSubList) {}
-};
+                 SwWrongList* pSubList);
+private:
+
+    SwWrongArea() : mnPos(0), mnLen(0), mpSubList(NULL), mColor(0,0,0), mLineType(WRONGAREA_WAVE) {}
+
+    Color getSmartColor ( com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag)
+    {
+        try
+        {
+            if (xPropertyBag.is())
+            {
+                const ::rtl::OUString colorKey  = ::rtl::OUString::createFromAscii ("LineColor");
+                com::sun::star::uno::Any aLineColor = xPropertyBag->getValue(colorKey).get< com::sun::star::uno::Any>();
+                com::sun::star::util::Color lineColor = 0;
+
+                if (aLineColor >>= lineColor)
+                {
+                    return Color( lineColor );
+                }
+            }
+        }
+        catch(::com::sun::star::container::NoSuchElementException& ex)
+        {
+        }
+        catch(::com::sun::star::uno::RuntimeException& ex)
+        {
+        }
+
+        return SwViewOption::GetSmarttagColor( );
+    }
+
+    WrongAreaLineType getSmartLineType( com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag )
+    {
+        try
+        {
+            if (xPropertyBag.is())
+            {
+                const ::rtl::OUString typeKey  = ::rtl::OUString::createFromAscii ("LineType");
+                com::sun::star::uno::Any aLineType = xPropertyBag->getValue(typeKey).get< com::sun::star::uno::Any>();
+                ::sal_Int16 lineType = 0;
+
+                if (!(aLineType >>= lineType))
+                {
+                    return WRONGAREA_DASHED;
+                }
+                if (::com::sun::star::awt::FontUnderline::WAVE == lineType)
+                {
+                    return WRONGAREA_WAVE_NORMAL;
+                }
+                if (::com::sun::star::awt::FontUnderline::SMALLWAVE == lineType)
+                {
+                    return WRONGAREA_WAVE_SMALL;
+                }
+            }
+        }
+        catch(::com::sun::star::container::NoSuchElementException& ex)
+        {
+        }
+        catch(::com::sun::star::uno::RuntimeException& ex)
+        {
+        }
+
+        return WRONGAREA_DASHED;
+    }
+
+    Color getWrongAreaColor(WrongListType listType,
+                            com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag )
+    {
+        if (WRONGLIST_SPELL == listType)
+        {
+            return SwViewOption::GetSpellColor();
+        }
+        else if (WRONGLIST_GRAMMAR == listType)
+        {
+            return Color( COL_LIGHTBLUE );
+        }
+        else if (WRONGLIST_SMARTTAG == listType)
+        {
+            return  getSmartColor(xPropertyBag);
+        }
+
+        return SwViewOption::GetSpellColor();
+    }
+
+    WrongAreaLineType getWrongAreaLineType(WrongListType listType,
+                                           com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag )
+    {
+        if (WRONGLIST_SPELL == listType)
+        {
+            return WRONGAREA_WAVE;
+        }
+        else if (WRONGLIST_GRAMMAR == listType)
+        {
+            return WRONGAREA_WAVE;
+        }
+        else if (WRONGLIST_SMARTTAG == listType)
+        {
+            return getSmartLineType(xPropertyBag);
+        }
+
+        return WRONGAREA_WAVE;
+    }
 
-enum WrongListType
-{
-    WRONGLIST_SPELL,
-    WRONGLIST_GRAMMAR,
-    WRONGLIST_SMARTTAG,
-    WRONGLIST_CHANGETRACKING
 };
 
 class SwWrongList
@@ -137,7 +263,8 @@ public:
             i = maList.end(); // robust
         else
             i += nWhere;
-        maList.insert(i, SwWrongArea( rType, xPropertyBag, nNewPos, nNewLen, 0 ) );
+
+        maList.insert(i, SwWrongArea( rType, meType, xPropertyBag, nNewPos, nNewLen) );
     }
 
     void Insert( const rtl::OUString& rType,
diff --git a/sw/source/core/text/wrong.cxx b/sw/source/core/text/wrong.cxx
index 9e80afe..2e85d92 100644
--- a/sw/source/core/text/wrong.cxx
+++ b/sw/source/core/text/wrong.cxx
@@ -33,6 +33,33 @@
 
 #include "SwGrammarMarkUp.hxx"
 
+/*************************************************************************
+ *SwWrongArea::SwWrongArea
+ *************************************************************************/
+
+SwWrongArea::SwWrongArea( const rtl::OUString& rType, WrongListType listType,
+        com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag,
+        xub_StrLen nPos,
+        xub_StrLen nLen)
+: maType(rType), mxPropertyBag(xPropertyBag), mnPos(nPos), mnLen(nLen), mpSubList(0)
+{
+    mColor =  getWrongAreaColor(listType, xPropertyBag);
+    mLineType = getWrongAreaLineType(listType, xPropertyBag);
+}
+
+SwWrongArea::SwWrongArea( const rtl::OUString& rType,
+        com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag,
+        xub_StrLen nPos,
+        xub_StrLen nLen,
+        SwWrongList* pSubList)
+: maType(rType), mxPropertyBag(xPropertyBag), mnPos(nPos), mnLen(nLen), mpSubList(pSubList), mLineType(WRONGAREA_NONE)
+{
+    if (pSubList != 0)
+    {
+        mColor =  getWrongAreaColor(pSubList->GetWrongListType(), xPropertyBag);
+        mLineType = getWrongAreaLineType(pSubList->GetWrongListType(), xPropertyBag);
+    }
+}
 
 /*************************************************************************
  * SwWrongList::SwWrongList()
@@ -634,7 +661,7 @@ void SwWrongList::Insert( const rtl::OUString& rType,
         ++aIter;
     }
 
-    maList.insert(aIter, SwWrongArea( rType, xPropertyBag, nNewPos, nNewLen, 0 ) );
+    maList.insert(aIter, SwWrongArea( rType, meType, xPropertyBag, nNewPos, nNewLen) );
 }
 
 
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 5481159..ee8b527 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -710,115 +710,136 @@ static void lcl_DrawLineForWrongListData(
     const CalcLinePosData   &rCalcLinePosData,
     const Size              &rPrtFontSize )
 {
-    if (!pWList)
-        return;
+    if (!pWList) return;
 
     xub_StrLen nStart = rInf.GetIdx();
     xub_StrLen nWrLen = rInf.GetLen();
 
     // check if respective data is available in the current text range
-    if (pWList->Check( nStart, nWrLen ))
+    if (!pWList->Check( nStart, nWrLen ))
+    {
+        return;
+    }
+
+    long nHght = rInf.GetOut().LogicToPixel( rPrtFontSize ).Height();
+
+    // Draw wavy lines for spell and grammar errors only if font is large enough.
+    // Lines for smart tags will always be drawn.
+    if (pWList != rInf.GetSmartTags() && WRONG_SHOW_MIN >= nHght)
+    {
+        return;
+    }
+
+    SwForbidden::iterator pIter = rForbidden.begin();
+    if (rInf.GetOut().GetConnectMetaFile())
+        rInf.GetOut().Push();
+
+    const Color aCol( rInf.GetOut().GetLineColor() );
+
+    // iterate over all ranges stored in the respective SwWrongList
+    do
     {
-        // get line color to use...
-        Color aLineColor;
-        if (pWList == rInf.GetWrong())  // ... for spell checking
-            aLineColor = SwViewOption::GetSpellColor();
-        else if (pWList == rInf.GetGrammarCheck())  // ... for grammar checking
-            // currently there is no specific color for grammar check errors available in the configuration
-            aLineColor = Color( COL_LIGHTBLUE );
-        else if (pWList == rInf.GetSmartTags())  // ... for smart tags
-            aLineColor = SwViewOption::GetSmarttagColor();
-
-        long nHght = rInf.GetOut().LogicToPixel( rPrtFontSize ).Height();
-
-        // Draw wavy lines for spell and grammar errors only if font is large enough.
-        // Lines for smart tags will always be drawn.
-        if (pWList == rInf.GetSmartTags() || WRONG_SHOW_MIN < nHght)
+        nStart = nStart - rInf.GetIdx();
+
+        const xub_StrLen nEnd = nStart + nWrLen;
+        xub_StrLen nNext = nStart;
+        while( nNext < nEnd )
         {
-            SwForbidden::iterator pIter = rForbidden.begin();
-            if (rInf.GetOut().GetConnectMetaFile())
-                rInf.GetOut().Push();
+            while( pIter != rForbidden.end() && pIter->second <= nNext )
+                ++pIter;
 
-            const Color aCol( rInf.GetOut().GetLineColor() );
-            const sal_Bool bColSave = aCol != aLineColor;
-            if (bColSave)
-                rInf.GetOut().SetLineColor( aLineColor );
+            xub_StrLen nNextStart = nNext;
+            xub_StrLen nNextEnd = nEnd;
 
-            // iterate over all ranges stored in the respective SwWrongList
-            do
+            if( pIter == rForbidden.end() || nNextEnd <= pIter->first )
             {
-                nStart = nStart - rInf.GetIdx();
+                // No overlapping mark up found
+                std::pair< xub_StrLen, xub_StrLen > aNew;
+                aNew.first = nNextStart;
+                aNew.second = nNextEnd;
+                rForbidden.insert( pIter, aNew );
+                pIter = rForbidden.begin();
+                nNext = nEnd;
+            }
+            else
+            {
+                nNext = pIter->second;
+                if( nNextStart < pIter->first )
+                {
+                    nNextEnd = pIter->first;
+                    pIter->first = nNextStart;
+                }
+                else
+                    continue;
+            }
+            // determine line pos
+            Point aStart( rInf.GetPos() );
+            Point aEnd;
+            lcl_calcLinePos( rCalcLinePosData, aStart, aEnd, nNextStart, nNextEnd - nNextStart );
+
 
-                const xub_StrLen nEnd = nStart + nWrLen;
-                xub_StrLen nNext = nStart;
-                while( nNext < nEnd )
+            sal_uInt16 wrongPos = pWList->GetWrongPos(nNextStart + rInf.GetIdx());
+
+            const SwWrongArea* wrongArea = pWList->GetElement(wrongPos);
+
+            if (wrongArea != 0)
+            {
+                if (WRONGAREA_DASHED == wrongArea->mLineType)
                 {
-                    while( pIter != rForbidden.end() && pIter->second <= nNext )
-                        ++pIter;
-                    xub_StrLen nNextStart = nNext;
-                    xub_StrLen nNextEnd = nEnd;
-                    if( pIter == rForbidden.end() || nNextEnd <= pIter->first )
-                    {
-                        // No overlapping mark up found
-                        std::pair< xub_StrLen, xub_StrLen > aNew;
-                        aNew.first = nNextStart;
-                        aNew.second = nNextEnd;
-                        rForbidden.insert( pIter, aNew );
-                        pIter = rForbidden.begin();
-                        nNext = nEnd;
-                    }
-                    else
-                    {
-                        nNext = pIter->second;
-                        if( nNextStart < pIter->first )
-                        {
-                            nNextEnd = pIter->first;
-                            pIter->first = nNextStart;
-                        }
-                        else
-                            continue;
-                    }
-                    // determine line pos
-                    Point aStart( rInf.GetPos() );
-                    Point aEnd;
-                    lcl_calcLinePos( rCalcLinePosData, aStart, aEnd, nNextStart, nNextEnd - nNextStart );
+                    rInf.GetOut().SetLineColor( wrongArea->mColor );
 
-                    // draw line for smart tags?
-                    if (pWList == rInf.GetSmartTags())
-                    {
-                        aStart.Y() +=30;
-                        aEnd.Y() +=30;
+                    aStart.Y() +=30;
+                    aEnd.Y() +=30;
 
-                        LineInfo aLineInfo( LINE_DASH );
-                        aLineInfo.SetDistance( 40 );
-                        aLineInfo.SetDashLen( 1 );
-                        aLineInfo.SetDashCount(1);
+                    LineInfo aLineInfo( LINE_DASH );
+                    aLineInfo.SetDistance( 40 );
+                    aLineInfo.SetDashLen( 1 );
+                    aLineInfo.SetDashCount(1);
 
-                        rInf.GetOut().DrawLine( aStart, aEnd, aLineInfo );
-                    }
-                    else    // draw wavy lines for spell or grammar errors
-                    {
-                        // get wavy line type to use
-                        sal_uInt16 nWave =
-                            WRONG_SHOW_MEDIUM < nHght ? WAVE_NORMAL :
-                            ( WRONG_SHOW_SMALL < nHght ? WAVE_SMALL : WAVE_FLAT );
+                    rInf.GetOut().DrawLine( aStart, aEnd, aLineInfo );
+                }
+                else if (WRONGAREA_WAVE == wrongArea->mLineType)
+                {
+                    rInf.GetOut().SetLineColor( wrongArea->mColor );
 
-                        rInf.GetOut().DrawWaveLine( aStart, aEnd, nWave );
-                    }
+                    // get wavy line type to use
+                    sal_uInt16 nWave =
+                        WRONG_SHOW_MEDIUM < nHght ? WAVE_NORMAL :
+                        ( WRONG_SHOW_SMALL < nHght ? WAVE_SMALL : WAVE_FLAT );
+
+                    rInf.GetOut().DrawWaveLine( aStart, aEnd, nWave );
                 }
+                else if (WRONGAREA_WAVE_NORMAL == wrongArea->mLineType)
+                {
+                    rInf.GetOut().SetLineColor( wrongArea->mColor );
 
-                nStart = nEnd + rInf.GetIdx();
-                nWrLen = rInf.GetIdx() + rInf.GetLen() - nStart;
-            }
-            while (nWrLen && pWList->Check( nStart, nWrLen ));
+                    rInf.GetOut().DrawWaveLine( aStart, aEnd, WAVE_NORMAL);
+                }
 
-            if (bColSave)
-                rInf.GetOut().SetLineColor( aCol );
+                else if (WRONGAREA_WAVE_SMALL == wrongArea->mLineType)
+                {
+                    rInf.GetOut().SetLineColor( wrongArea->mColor );
 
-            if (rInf.GetOut().GetConnectMetaFile())
-                rInf.GetOut().Pop();
+                    rInf.GetOut().DrawWaveLine( aStart, aEnd, WAVE_SMALL);
+                }
+                else if (WRONGAREA_WAVE_FLAT == wrongArea->mLineType)
+                {
+                    rInf.GetOut().SetLineColor( wrongArea->mColor );
+
+                    rInf.GetOut().DrawWaveLine( aStart, aEnd, WAVE_FLAT);
+                }
+            }
         }
+
+        nStart = nEnd + rInf.GetIdx();
+        nWrLen = rInf.GetIdx() + rInf.GetLen() - nStart;
     }
+    while (nWrLen && pWList->Check( nStart, nWrLen ));
+
+    rInf.GetOut().SetLineColor( aCol );
+
+    if (rInf.GetOut().GetConnectMetaFile())
+        rInf.GetOut().Pop();
 }
 
 
commit c1fb6ce135ad39299164aeecebfa746db210d0e3
Author: Jürgen Schmidt <jsc at apache.org>
Date:   Wed Mar 20 14:17:09 2013 +0000

    #121732# add new interface XMarkingAccess
    
    Patch by: Kai Labusch
    Review by: arielch, jsc

diff --git a/offapi/com/sun/star/text/XMarkingAccess.idl b/offapi/com/sun/star/text/XMarkingAccess.idl
new file mode 100644
index 0000000..cb9b539
--- /dev/null
+++ b/offapi/com/sun/star/text/XMarkingAccess.idl
@@ -0,0 +1,47 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+
+#ifndef __com_sun_star_text_XMarkingAccess_idl__
+#define __com_sun_star_text_XMarkingAccess_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+//=============================================================================
+
+ module com {  module sun {  module star {  module text {
+
+//=============================================================================
+
+/** extends a text range by method to modify its position.
+ */
+interface XMarkingAccess
+{
+    void invalidateMarkings([in] long nType);
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
diff --git a/offapi/com/sun/star/text/makefile.mk b/offapi/com/sun/star/text/makefile.mk
index adf2e89..82be3aa 100644
--- a/offapi/com/sun/star/text/makefile.mk
+++ b/offapi/com/sun/star/text/makefile.mk
@@ -234,6 +234,7 @@ IDLFILES=\
       XTextColumns.idl\
       XTextContent.idl\
       XTextCursor.idl\
+    XMarkingAccess.idl\
     XTextCopy.idl\
       XTextDocument.idl\
       XTextEmbeddedObject.idl\
diff --git a/sw/inc/unotextcursor.hxx b/sw/inc/unotextcursor.hxx
index 13b43a4..3b581e3 100644
--- a/sw/inc/unotextcursor.hxx
+++ b/sw/inc/unotextcursor.hxx
@@ -37,11 +37,18 @@
 #include <com/sun/star/text/XWordCursor.hpp>
 #include <com/sun/star/text/XParagraphCursor.hpp>
 #include <com/sun/star/text/XRedline.hpp>
+#include <com/sun/star/text/XMarkingAccess.hpp>
 
 #include <cppuhelper/implbase12.hxx>
 
 #include <comphelper/uno3.hxx>
 
+#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13)
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 13
+#include <comphelper/implbase_var.hxx>
+#endif
+
 #include <unobaseclass.hxx>
 #include <TextCursorHelper.hxx>
 
@@ -50,8 +57,7 @@ class SwDoc;
 struct SwPosition;
 class SwUnoCrsr;
 
-
-typedef ::cppu::WeakImplHelper12
+typedef ::comphelper::WeakImplHelper13
 <   ::com::sun::star::lang::XServiceInfo
 ,   ::com::sun::star::beans::XPropertySet
 ,   ::com::sun::star::beans::XPropertyState
@@ -64,6 +70,7 @@ typedef ::cppu::WeakImplHelper12
 ,   ::com::sun::star::text::XWordCursor
 ,   ::com::sun::star::text::XParagraphCursor
 ,   ::com::sun::star::text::XRedline
+,   ::com::sun::star::text::XMarkingAccess
 > SwXTextCursor_Base;
 
 class SwXTextCursor
@@ -337,6 +344,10 @@ public:
         throw (::com::sun::star::lang::IllegalArgumentException,
                 ::com::sun::star::uno::RuntimeException);
 
+    //XMarkingAccess
+    virtual void SAL_CALL invalidateMarkings(::sal_Int32 nType)
+    throw (::com::sun::star::uno::RuntimeException);
+
 };
 
 #endif // SW_UNOTEXTCURSOR_HXX
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index aba66a6..fbfc76b 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -99,6 +99,7 @@
 #include <com/sun/star/text/XTextDocument.hpp>
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/text/TextMarkupType.hpp>
 #include <unoidx.hxx>
 #include <unoframe.hxx>
 #include <fmthdft.hxx>
@@ -2683,6 +2684,47 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     return aRet;
 }
 
+void SAL_CALL SwXTextCursor::invalidateMarkings(::sal_Int32 nType)
+throw (uno::RuntimeException)
+{
+    vos::OGuard aGuard(Application::GetSolarMutex());
+
+    SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+    SwNode* node = rUnoCursor.GetNode();
+
+    if (node == 0) return;
+
+    SwTxtNode* txtNode = node->GetTxtNode();
+
+    if (txtNode == 0) return;
+
+    if ( text::TextMarkupType::SPELLCHECK == nType )
+    {
+        txtNode->SetWrongDirty(true);
+        txtNode->SetWrong(0, true);
+    }
+    else if( text::TextMarkupType::PROOFREADING == nType )
+    {
+        txtNode->SetGrammarCheckDirty(true);
+        txtNode->SetGrammarCheck(0,true);
+    }
+    else if ( text::TextMarkupType::SMARTTAG == nType )
+    {
+        txtNode->SetSmartTagDirty(true);
+        txtNode->SetSmartTags (0, true);
+    }
+    else return;
+
+    SwFmtColl* fmtColl=txtNode->GetFmtColl();
+
+    if (fmtColl == 0) return;
+
+    SwFmtChg aNew( fmtColl );
+    txtNode->NotifyClients( 0, &aNew );
+}
+
+
 /*-- 10.03.2008 09:58:47---------------------------------------------------
 
   -----------------------------------------------------------------------*/
commit 5898e201ae8bbc1203bf24629a389f8f3b3e02ee
Author: Jürgen Schmidt <jsc at apache.org>
Date:   Wed Mar 20 14:15:58 2013 +0000

    #121731# extend XSmartTagAction->getActionCount with additional parameter to increase flexibility of context menus
    
    Patch by: Kai Labusch
    Review by: arielch, jsc

diff --git a/offapi/com/sun/star/smarttags/XSmartTagAction.idl b/offapi/com/sun/star/smarttags/XSmartTagAction.idl
index 6c30320..799cc31 100644
--- a/offapi/com/sun/star/smarttags/XSmartTagAction.idl
+++ b/offapi/com/sun/star/smarttags/XSmartTagAction.idl
@@ -112,7 +112,7 @@ interface XSmartTagAction: com::sun::star::lang::XInitialization
         @throws com::sun::star::lang::IndexOutOfBoundsException
                 if nSmartTagIndex is greater than SmartTagCount.
     */
-    string getSmartTagName( [in] long nSmartTagIndex )
+    string getSmartTagName( [in] long nSmartTagIndex)
         raises( com::sun::star::lang::IndexOutOfBoundsException );
 
 
@@ -135,7 +135,7 @@ interface XSmartTagAction: com::sun::star::lang::XInitialization
                 if nSmartTagIndex is greater than SmartTagCount
      */
     string getSmartTagCaption( [in] long nSmartTagIndex,
-                               [in] ::com::sun::star::lang::Locale aLocale )
+                               [in] ::com::sun::star::lang::Locale aLocale)
         raises( com::sun::star::lang::IndexOutOfBoundsException );
 
 
@@ -155,7 +155,8 @@ interface XSmartTagAction: com::sun::star::lang::XInitialization
                 type.
     */
     long getActionCount( [in] string aSmartTagName,
-                         [in] com::sun::star::frame::XController xController );
+                         [in] com::sun::star::frame::XController xController,
+                         [in] com::sun::star::container::XStringKeyMap xProperties);
 
     //-------------------------------------------------------------------------
     /** obtains a unique integer identifier for an action.
@@ -245,7 +246,7 @@ interface XSmartTagAction: com::sun::star::lang::XInitialization
                 if the ActionID is not recognized.
     */
     string getActionNameFromID( [in] long nActionID,
-                                [in] com::sun::star::frame::XController xController )
+                                [in] com::sun::star::frame::XController xController)
         raises( com::sun::star::lang::IllegalArgumentException );
 
 
diff --git a/svx/source/mnuctrls/SmartTagCtl.cxx b/svx/source/mnuctrls/SmartTagCtl.cxx
index ccb1bd8..b29bbd5 100644
--- a/svx/source/mnuctrls/SmartTagCtl.cxx
+++ b/svx/source/mnuctrls/SmartTagCtl.cxx
@@ -104,7 +104,7 @@ void SvxSmartTagsControl::FillMenu()
 
         const sal_Int32 nSmartTagIndex = rActionIndices[0];
         const rtl::OUString aSmartTagType = xAction->getSmartTagName( nSmartTagIndex );
-        const rtl::OUString aSmartTagCaption = xAction->getSmartTagCaption( nSmartTagIndex, rLocale );
+        const rtl::OUString aSmartTagCaption = xAction->getSmartTagCaption( nSmartTagIndex, rLocale);
 
         // no sub-menues if there's only one smart tag type listed:
         PopupMenu* pSbMenu = mpMenu;
@@ -127,7 +127,7 @@ void SvxSmartTagsControl::FillMenu()
         {
             xAction = rActionComponents[i];
 
-            for ( sal_Int32 k = 0; k < xAction->getActionCount( aSmartTagType, xController ); ++k )
+            for ( sal_Int32 k = 0; k < xAction->getActionCount( aSmartTagType, xController, xSmartTagProperties ); ++k )
             {
                 const sal_uInt32 nActionID = xAction->getActionID( aSmartTagType, k, xController );
                 rtl::OUString aActionCaption = xAction->getActionCaptionFromID( nActionID,
diff --git a/sw/source/ui/smartmenu/stmenu.cxx b/sw/source/ui/smartmenu/stmenu.cxx
index 3cff78f..0245ebf 100644
--- a/sw/source/ui/smartmenu/stmenu.cxx
+++ b/sw/source/ui/smartmenu/stmenu.cxx
@@ -118,7 +118,7 @@ SwSmartTagPopup::SwSmartTagPopup( SwView* pSwView,
         {
             xAction = rActionComponents[i];
 
-            for ( sal_Int32 k = 0; k < xAction->getActionCount( aSmartTagType, xController ); ++k )
+            for ( sal_Int32 k = 0; k < xAction->getActionCount( aSmartTagType, xController, xSmartTagProperties ); ++k )
             {
                 const sal_uInt32 nActionID = xAction->getActionID( aSmartTagType, k, xController  );
                 rtl::OUString aActionCaption = xAction->getActionCaptionFromID( nActionID,
commit a64c066b02924371f486688df01b6881bcd0da8b
Author: Jürgen Schmidt <jsc at apache.org>
Date:   Wed Mar 20 14:14:46 2013 +0000

    #121730# add new optional interface XRangeBasedSmartTagRecognizer for SmartTags
    
    Patch by: Kai Labusch
    Review by: arielch, jsc

diff --git a/offapi/com/sun/star/smarttags/XRangeBasedSmartTagRecognizer.idl b/offapi/com/sun/star/smarttags/XRangeBasedSmartTagRecognizer.idl
new file mode 100644
index 0000000..c7671a5
--- /dev/null
+++ b/offapi/com/sun/star/smarttags/XRangeBasedSmartTagRecognizer.idl
@@ -0,0 +1,101 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+
+
+#ifndef __com_sun_star_smarttags_XRangeBasedSmartTagRecognizer_idl__
+#define __com_sun_star_smarttags_XRangeBasedSmartTagRecognizer_idl__
+
+#ifndef __com_sun_star_uno_XInitialization_idl__
+#include <com/sun/star/lang/XInitialization.idl>
+#endif
+
+#ifndef __com_sun_star_lang_Locale_idl__
+#include <com/sun/star/lang/Locale.idl>
+#endif
+
+#ifndef __com_sun_star_smarttags_SmartTagRecognizerMode_idl__
+#include <com/sun/star/smarttags/SmartTagRecognizerMode.idl>
+#endif
+
+#ifndef __com_sun_star_text_XTextMarkup_idl__
+#include <com/sun/star/text/XTextMarkup.idl>
+#endif
+
+#ifndef __com_sun_star_frame_XController_idl__
+#include <com/sun/star/frame/XController.idl>
+#endif
+
+#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__
+#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
+#endif
+
+#ifndef __com_sun_star_text_XTextRange_idl__
+#include <com/sun/star/text/XTextRange.idl>
+#endif
+
+
+//=============================================================================
+
+module com {  module sun {  module star {  module smarttags {
+
+//=============================================================================
+
+/**
+    provides access to a range based smart tag recognizer.
+ */
+
+interface XRangeBasedSmartTagRecognizer: com::sun::star::lang::XInitialization
+{
+
+    //-------------------------------------------------------------------------
+    /** recognizes smart tags.
+
+        @param xRange
+                The text that should be scanned by the recognizer.
+
+        @param eDataType
+                This value indicates the type of the passed text.
+
+        @param aLocale
+                Is used to indicate the language of the passed text.
+
+        @param xTextMarkup
+                This object is used to submit any recognized smart tags
+                to the calling application.
+
+        @param aApplicationName
+                A string containing the name of the calling application.
+
+        @param xController
+                The current controller of the document.
+     */
+
+    void recognizeTextRange( [in] com::sun::star::text::XTextRange xRange,
+                       [in] SmartTagRecognizerMode eDataType,
+                       [in] com::sun::star::text::XTextMarkup xTextMarkup,
+                       [in] string aApplicationName,
+                       [in] com::sun::star::frame::XController xController);
+};
+
+}; }; }; };
+
+#endif
diff --git a/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl b/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl
index 31efc4c..6cf33f9 100644
--- a/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl
+++ b/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl
@@ -52,6 +52,11 @@
 #include <com/sun/star/lang/IndexOutOfBoundsException.idl>
 #endif
 
+#ifndef __com_sun_star_text_XTextRange_idl__
+#include <com/sun/star/text/XTextRange.idl>
+#endif
+
+
 //=============================================================================
 
 module com {  module sun {  module star {  module smarttags {
@@ -178,7 +183,6 @@ interface XSmartTagRecognizer: com::sun::star::lang::XInitialization
                     [in] com::sun::star::frame::XController xController,
                     [in] com::sun::star::i18n::XBreakIterator xTokenizer );
 
-
     //-------------------------------------------------------------------------
     /** indicates whether there is a property page for a smart tag type.
 
diff --git a/offapi/com/sun/star/smarttags/makefile.mk b/offapi/com/sun/star/smarttags/makefile.mk
index 227483b..77675f3 100644
--- a/offapi/com/sun/star/smarttags/makefile.mk
+++ b/offapi/com/sun/star/smarttags/makefile.mk
@@ -37,6 +37,7 @@ IDLFILES=\
         SmartTagAction.idl\
         SmartTagRecognizer.idl\
         SmartTagRecognizerMode.idl\
+        XRangeBasedSmartTagRecognizer.idl\
         XSmartTagAction.idl\
         XSmartTagRecognizer.idl
 
diff --git a/svx/inc/svx/SmartTagMgr.hxx b/svx/inc/svx/SmartTagMgr.hxx
index 09531f2..bb89426 100644
--- a/svx/inc/svx/SmartTagMgr.hxx
+++ b/svx/inc/svx/SmartTagMgr.hxx
@@ -46,6 +46,7 @@ namespace com { namespace sun { namespace star { namespace smarttags {
 
 namespace com { namespace sun { namespace star { namespace text {
     class XTextMarkup;
+    class XTextRange;
 } } } }
 
 namespace com { namespace sun { namespace star { namespace i18n {
@@ -155,12 +156,17 @@ public:
             The length of the text to be scanned.
 
     */
-    void Recognize( const rtl::OUString& rText,
+    void RecognizeString( const rtl::OUString& rText,
                     const com::sun::star::uno::Reference< com::sun::star::text::XTextMarkup > xMarkup,
                     const com::sun::star::uno::Reference< com::sun::star::frame::XController > xController,
                     const com::sun::star::lang::Locale& rLocale,
                     sal_uInt32 nStart, sal_uInt32 nLen ) const;
 
+   void RecognizeTextRange(const com::sun::star::uno::Reference< com::sun::star::text::XTextRange> xRange,
+                    const com::sun::star::uno::Reference< com::sun::star::text::XTextMarkup > xMarkup,
+                    const com::sun::star::uno::Reference< com::sun::star::frame::XController > xController) const;
+
+
     /** Returns all action references associated with a given list of smart tag types
 
         @param rSmartTagTypes
diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx
index 5f50139..d065400 100644
--- a/svx/source/smarttags/SmartTagMgr.cxx
+++ b/svx/source/smarttags/SmartTagMgr.cxx
@@ -30,6 +30,7 @@
 #include <vos/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include <com/sun/star/smarttags/XSmartTagRecognizer.hpp>
+#include <com/sun/star/smarttags/XRangeBasedSmartTagRecognizer.hpp>
 #include <com/sun/star/smarttags/XSmartTagAction.hpp>
 #include <com/sun/star/deployment/ExtensionManager.hpp>
 #include <com/sun/star/text/XTextMarkup.hpp>
@@ -50,6 +51,8 @@
 #include <rtl/ustring.hxx>
 #include <tools/string.hxx>
 
+#include <com/sun/star/text/XTextRange.hpp>
+
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
 
@@ -100,7 +103,7 @@ void SmartTagMgr::CreateBreakIterator() const
 
 /** Dispatches the recognize call to all installed smart tag recognizers
 */
-void SmartTagMgr::Recognize( const rtl::OUString& rText,
+void SmartTagMgr::RecognizeString( const rtl::OUString& rText,
                              const Reference< text::XTextMarkup > xMarkup,
                              const Reference< frame::XController > xController,
                              const lang::Locale& rLocale,
@@ -132,6 +135,40 @@ void SmartTagMgr::Recognize( const rtl::OUString& rText,
     }
 }
 
+void SmartTagMgr::RecognizeTextRange(const Reference< text::XTextRange> xRange,
+                             const Reference< text::XTextMarkup > xMarkup,
+                             const Reference< frame::XController > xController) const
+{
+    for ( sal_uInt32 i = 0; i < maRecognizerList.size(); i++ )
+    {
+        Reference < smarttags::XSmartTagRecognizer > xRecognizer = maRecognizerList[i];
+
+        Reference< smarttags::XRangeBasedSmartTagRecognizer > xRangeBasedRecognizer = Reference< smarttags::XRangeBasedSmartTagRecognizer >( xRecognizer, UNO_QUERY);
+
+        if (!xRangeBasedRecognizer.is()) continue;
+
+        // if all smart tag types supported by this recognizer have been
+        // disabled, we do not have to call the recognizer:
+        bool bCallRecognizer = false;
+        const sal_uInt32 nSmartTagCount = xRecognizer->getSmartTagCount();
+        for ( sal_uInt32 j = 0; j < nSmartTagCount && !bCallRecognizer; ++j )
+        {
+            const rtl::OUString aSmartTagName = xRecognizer->getSmartTagName(j);
+            if ( IsSmartTagTypeEnabled( aSmartTagName ) )
+                bCallRecognizer = true;
+        }
+
+        if ( bCallRecognizer )
+        {
+            xRangeBasedRecognizer->recognizeTextRange( xRange,
+                                                       smarttags::SmartTagRecognizerMode_PARAGRAPH,
+                                                       xMarkup, maApplicationName, xController);
+        }
+    }
+
+}
+
+
 typedef std::multimap < rtl::OUString, ActionReference >::const_iterator SmartTagMapIter;
 
 void SmartTagMgr::GetActionSequences( Sequence < rtl::OUString >& rSmartTagTypes,
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 6b814e1..3f0cfca 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -88,6 +88,7 @@
 
 #include <vector>
 
+#include <unotextrange.hxx>
 
 using rtl::OUString;
 using namespace ::com::sun::star;
@@ -1352,7 +1353,14 @@ SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, xub_StrLen /*nActPos*/
 
         Reference< ::com::sun::star::frame::XController > xController = pNode->GetDoc()->GetDocShell()->GetController();
 
-        xub_StrLen nLangBegin = nBegin;
+    SwPosition start(*pNode, nBegin);
+    SwPosition end  (*pNode, nEnd);
+        Reference< ::com::sun::star::text::XTextRange > xRange = SwXTextRange::CreateXTextRange(*pNode->GetDoc(), start, &end);
+
+    rSmartTagMgr.RecognizeTextRange(xRange, xTextMarkup, xController);
+
+
+    xub_StrLen nLangBegin = nBegin;
         xub_StrLen nLangEnd = nEnd;
 
         // smart tag recognization has to be done for each language portion:
@@ -1367,7 +1375,7 @@ SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, xub_StrLen /*nActPos*/
             const sal_uInt32 nExpandBegin = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nLangBegin );
             const sal_uInt32 nExpandEnd   = ModelToViewHelper::ConvertToViewPosition( pConversionMap, nLangEnd );
 
-            rSmartTagMgr.Recognize( aExpandText, xTextMarkup, xController, aLocale, nExpandBegin, nExpandEnd - nExpandBegin );
+            rSmartTagMgr.RecognizeString(aExpandText, xTextMarkup, xController, aLocale, nExpandBegin, nExpandEnd - nExpandBegin );
 
             nLangBegin = nLangEnd;
         }


More information about the Libreoffice-commits mailing list