Commits

mba  committed 3d0f114

cws swcoreseparation: #i117814#: remove a further dependency on SwModule from core: create listener for linguistic events via SwDocShell

  • Participants
  • Parent commits fbd7b56

Comments (0)

Files changed (4)

File sw/inc/docsh.hxx

     virtual bool    GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash );
     virtual bool    CanSwitchReadOnlyCursor() const;
     virtual bool    IsWeb() const;
+    void CreateLinguisticEventListener();
 
 	bool GenerateGlobalDoc( const String& rPath, const SwTxtFmtColl* pSplitColl = 0 ) 
     { return GenerateDoc( SPLITDOC_TO_GLOBALDOC, rPath, pSplitColl ); }

File sw/source/core/text/guess.cxx

 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-
 #include <ctype.h>
 #include <editeng/unolingu.hxx>
-#include <tools/shl.hxx>    // needed for SW_MOD() macro
 #include <errhdl.hxx>   // ASSERTs
 #include <dlelstnr.hxx>
-#include <swmodule.hxx>
+#include <docsh.hxx>
 #include <IDocumentSettingAccess.hxx>
 #include <txtcfg.hxx>
 #include <guess.hxx>
 #include <com/sun/star/i18n/WordType.hpp>
 #include <unotools/charclass.hxx>
 #include <porfld.hxx>
+#include <doc.hxx>
 
 using ::rtl::OUString;
 using namespace ::com::sun::star;
 
         //! register listener to LinguServiceEvents now in order to get
         //! notified about relevant changes in the future
-        SwModule *pModule = SW_MOD();
-        pModule->CreateLngSvcEvtListener();
+        SwDocShell* pDocShell = rInf.GetTxtFrm()->GetNode()->GetDoc()->GetDocShell();
+        if (pDocShell)
+            pDocShell->CreateLinguisticEventListener();
 
         // !!! We must have a local copy of the locale, because inside
         // getLineBreak the LinguEventListener can trigger a new formatting,

File sw/source/core/txtnode/txtedt.cxx

 #include <unotools/transliterationwrapper.hxx>
 #include <unotools/charclass.hxx>
 #include <dlelstnr.hxx>
-#include <swmodule.hxx>
 #include <splargs.hxx>
 #include <viewopt.hxx>
 #include <acmplwrd.hxx>
 
     if( nBegin < nEnd )
     {
+		uno::Reference< XSpellChecker1 > xSpell( ::GetSpellChecker() );
+        SwDoc* pDoc = pNode->GetDoc();
+
         //! register listener to LinguServiceEvents now in order to get
         //! notified about relevant changes in the future
-        SwModule *pModule = SW_MOD();
-        pModule->CreateLngSvcEvtListener();
-
-		uno::Reference< XSpellChecker1 > xSpell( ::GetSpellChecker() );
-        SwDoc* pDoc = pNode->GetDoc();
+        if ( pDoc->GetDocShell() )
+            pDoc->GetDocShell()->CreateLinguisticEventListener();
 
         SwScanner aScanner( *pNode, pNode->GetTxt(), 0, 0,
                             WordType::DICTIONARY_WORD, nBegin, nEnd);

File sw/source/ui/app/docsh.cxx

 #include <fmtfsize.hxx>
 #include <fmtfld.hxx>
 #include <node.hxx>
-
 #include <printdata.hxx>
 #include <frmatr.hxx>
 #include <view.hxx> 		// fuer die aktuelle Sicht
     return pDoc ? &pDoc->GetXmlIdRegistry() : 0;
 }
 
-
 bool SwDocShell::IsChangeRecording() const
 {
     return (pWrtShell->GetRedlineMode() & nsRedlineMode_t::REDLINE_ON) != 0;
     return true;
 }
 
-    
+void SwDocShell::CreateLinguisticEventListener()
+{
+    SW_MOD()->CreateLngSvcEvtListener();    
+}
+