Anonymous avatar Anonymous committed ecf3170

cws swcoreseparation: #i117814#: use virtual method at EditShell to create document for TextBlocks

Comments (0)

Files changed (5)

sw/inc/editsh.hxx

 	// verkleideter Copy-Constructor
 	SwEditShell( SwEditShell&, Window* );
 	virtual ~SwEditShell();
-
+    virtual SwTextBlocks* CreateSwTextBlocks( const String& rFileName );
 private:
 	// fuer METWARE:
 	// es wird nicht kopiert und nicht zugewiesen

sw/source/core/edit/acorrect.cxx

 #include <shellio.hxx>
 #include <swundo.hxx>
 #include <viscrs.hxx>
-#include <docsh.hxx>
 #include <editeng/acorrcfg.hxx>
 
 using namespace ::com::sun::star;
 		}
 		else
 		{
-            SwDocShell* pDocSh = new SwDocShell ( SFX_CREATE_MODE_INTERNAL );
-            if( !pDocSh->DoInitNew( 0 ) )
-                return sal_False;
-			SwTextBlocks aTBlks( pDocSh->GetDoc(), rACorrect.GetAutoCorrFileName( eLang, sal_False, sal_True ));
-			sal_uInt16 nPos = aTBlks.GetIndex( pFnd->GetShort() );
-			if( USHRT_MAX != nPos && aTBlks.BeginGetDoc( nPos ) )
+			SwTextBlocks* pTBlks = rEditSh.CreateSwTextBlocks(rACorrect.GetAutoCorrFileName( eLang, sal_False, sal_True ));
+            if ( pTBlks )
+            {
+			sal_uInt16 nPos = pTBlks->GetIndex( pFnd->GetShort() );
+			if( USHRT_MAX != nPos && pTBlks->BeginGetDoc( nPos ) )
 			{
 				DeleteSel( aPam );
 				pDoc->DontExpandFmt( *aPam.GetPoint() );
 				}
 
 				//
-				SwDoc* pAutoDoc = aTBlks.GetDoc();
+				SwDoc* pAutoDoc = pTBlks->GetDoc();
 				SwNodeIndex aSttIdx( pAutoDoc->GetNodes().GetEndOfExtras(), 1 );
 				SwCntntNode* pCntntNd = pAutoDoc->GetNodes().GoNext( &aSttIdx );
 				SwPaM aCpyPam( aSttIdx );
 				}
 				bRet = sal_True;
 			}
-			aTBlks.EndGetDoc();
+			pTBlks->EndGetDoc();
+            delete pTBlks;
+            }
 		}
 	}
 

sw/source/core/edit/editsh.cxx

     FOREACHPAM_END()
 }
 
+SwTextBlocks* SwEditShell::CreateSwTextBlocks( const String& )
+{
+    return  0;
+}
+
 void SwEditShell::ApplyViewOptions( const SwViewOption &rOpt )
 {
 	SwCrsrShell::StartAction();

sw/source/ui/inc/wrtsh.hxx

     sal_Bool TryRemoveIndent(); // #i23725#
 
     String GetSelDescr() const;
+    virtual SwTextBlocks* CreateSwTextBlocks( const String& rFileName );
 
 private:
 

sw/source/ui/wrtsh/wrtsh1.cxx

     return aResult;
 }
 
+SwTextBlocks* SwWrtShell::CreateSwTextBlocks( const String& rFileName )
+{
+    SwDocShell* pDocSh = new SwDocShell ( SFX_CREATE_MODE_INTERNAL );
+    if( !pDocSh->DoInitNew( 0 ) )
+    {
+        delete pDocSh;
+        return 0;
+    }
+    return new SwTextBlocks( pDocSh->GetDoc(), rFileName );
+}
+
 void SwWrtShell::ApplyViewOptions( const SwViewOption &rOpt )
 {
 	SwFEShell::ApplyViewOptions( rOpt );
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.