LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/lingu - sdrhhcwrap.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 68 0.0 %
Date: 2012-12-27 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <hintids.hxx>
      21             : #include <svx/svditer.hxx>
      22             : #include <svx/svdotext.hxx>
      23             : #include <editeng/editdata.hxx>
      24             : #include <svx/svdpagv.hxx>
      25             : #include <svx/svdogrp.hxx>
      26             : #include <sfx2/printer.hxx>
      27             : #include <svx/svdmodel.hxx>
      28             : #include <editeng/langitem.hxx>
      29             : #include <com/sun/star/beans/XPropertySet.hpp>
      30             : #include <linguistic/lngprops.hxx>
      31             : #include <sfx2/sfxuno.hxx>
      32             : #include <svx/svdview.hxx>
      33             : #include <editeng/unolingu.hxx>
      34             : #include <unotools/localedatawrapper.hxx>
      35             : #include <sdrhhcwrap.hxx>
      36             : #include <frmfmt.hxx>
      37             : #include <docsh.hxx>        //     "     "     "
      38             : #include <wrtsh.hxx>        //  MakeVisible
      39             : #include <view.hxx>
      40             : #include <dcontact.hxx>     // Spelling von DrawObj
      41             : #include <doc.hxx>        //     "     "     "
      42             : #include <docary.hxx>
      43             : #include <edtwin.hxx>
      44             : 
      45             : using namespace ::com::sun::star;
      46             : using ::rtl::OUString;
      47             : 
      48             : //////////////////////////////////////////////////////////////////////
      49             : 
      50           0 : SdrHHCWrapper::SdrHHCWrapper( SwView* pVw,
      51             :        LanguageType nSourceLanguage, LanguageType nTargetLanguage,
      52             :        const Font* pTargetFnt,
      53             :        sal_Int32 nConvOptions,
      54             :        sal_Bool bInteractive ) :
      55           0 :     SdrOutliner(pVw->GetDocShell()->GetDoc()->GetDrawModel()->
      56           0 :                              GetDrawOutliner().GetEmptyItemSet().GetPool(),
      57             :                 OUTLINERMODE_TEXTOBJECT ),
      58             :     pView( pVw ),
      59             :     pTextObj( NULL ),
      60             :     pOutlView( NULL ),
      61             :     nOptions( nConvOptions ),
      62             :     nDocIndex( 0 ),
      63             :     nSourceLang( nSourceLanguage ),
      64             :     nTargetLang( nTargetLanguage ),
      65             :     pTargetFont( pTargetFnt ),
      66           0 :     bIsInteractive( bInteractive )
      67             : {
      68           0 :     SetRefDevice( pView->GetDocShell()->GetDoc()->getPrinter( false ) );
      69             : 
      70           0 :     MapMode aMapMode (MAP_TWIP);
      71           0 :     SetRefMapMode(aMapMode);
      72             : 
      73           0 :      Size aSize( 1, 1 );
      74           0 :     SetPaperSize( aSize );
      75             : 
      76           0 :     pOutlView = new OutlinerView( this, &(pView->GetEditWin()) );
      77           0 :     pOutlView->GetOutliner()->SetRefDevice(pView->GetWrtShell().getIDocumentDeviceAccess()->getPrinter( false ));
      78             : 
      79             :     // Hack: all SdrTextObj attributes should be transferred to EditEngine
      80           0 :     pOutlView->SetBackgroundColor( Color( COL_WHITE ) );
      81             : 
      82             : 
      83           0 :     InsertView( pOutlView );
      84           0 :     Point aPoint( 0, 0 );
      85           0 :      Rectangle aRect( aPoint, aSize );
      86           0 :     pOutlView->SetOutputArea( aRect );
      87             : //  SetText( NULL );
      88           0 :     ClearModifyFlag();
      89           0 : }
      90             : 
      91           0 : SdrHHCWrapper::~SdrHHCWrapper()
      92             : {
      93           0 :     if (pTextObj)
      94             :     {
      95           0 :         SdrView *pSdrView = pView->GetWrtShell().GetDrawView();
      96             :         OSL_ENSURE( pSdrView, "SdrHHCWrapper without DrawView?" );
      97           0 :         pSdrView->SdrEndTextEdit( sal_True );
      98           0 :         SetUpdateMode(sal_False);
      99           0 :         pOutlView->SetOutputArea( Rectangle( Point(), Size(1, 1) ) );
     100             :     }
     101           0 :     RemoveView( pOutlView );
     102           0 :     delete pOutlView;
     103           0 : }
     104             : 
     105             : 
     106           0 : void SdrHHCWrapper::StartTextConversion()
     107             : {
     108           0 :     pOutlView->StartTextConversion( nSourceLang, nTargetLang, pTargetFont, nOptions, bIsInteractive, sal_True );
     109           0 : }
     110             : 
     111             : 
     112           0 : sal_Bool SdrHHCWrapper::ConvertNextDocument()
     113             : {
     114           0 :     sal_Bool bNextDoc = sal_False;
     115             : 
     116           0 :     if ( pTextObj )
     117             :     {
     118           0 :         SdrView *pSdrView = pView->GetWrtShell().GetDrawView();
     119             :         OSL_ENSURE( pSdrView, "SdrHHCWrapper without DrawView?" );
     120           0 :         pSdrView->SdrEndTextEdit( sal_True );
     121           0 :         SetUpdateMode(sal_False);
     122           0 :         pOutlView->SetOutputArea( Rectangle( Point(), Size(1, 1) ) );
     123           0 :         SetPaperSize( Size(1, 1) );
     124           0 :         Clear();
     125           0 :         pTextObj = NULL;
     126             :     }
     127             : 
     128           0 :     sal_uInt16 n = nDocIndex;
     129             : 
     130           0 :     std::list<SdrTextObj*> aTextObjs;
     131           0 :     SwDrawContact::GetTextObjectsFromFmt( aTextObjs, pView->GetDocShell()->GetDoc() );
     132           0 :     for ( std::list<SdrTextObj*>::iterator aIt = aTextObjs.begin(); aIt != aTextObjs.end(); ++aIt )
     133             :     {
     134           0 :         pTextObj = (*aIt);
     135           0 :         if ( pTextObj )
     136             :         {
     137           0 :             OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
     138           0 :             if ( pParaObj )
     139             :             {
     140           0 :                 SetPaperSize( pTextObj->GetLogicRect().GetSize() );
     141           0 :                 SetText( *pParaObj );
     142             : 
     143           0 :                 ClearModifyFlag();
     144             : 
     145             :                 //!! update mode needs to be set to true otherwise
     146             :                 //!! the call to 'HasConvertibleTextPortion' will not always
     147             :                 //!! work correctly because the document may not be properly
     148             :                 //!! formatted when some information is accessed, and thus
     149             :                 //!! incorrect results get returned.
     150           0 :                 SetUpdateMode(sal_True);
     151           0 :                 if (HasConvertibleTextPortion( nSourceLang ))
     152             :                 {
     153           0 :                     SdrView *pSdrView = pView->GetWrtShell().GetDrawView();
     154             :                     OSL_ENSURE( pSdrView, "SdrHHCWrapper without DrawView?" );
     155           0 :                     SdrPageView* pPV = pSdrView->GetSdrPageView();
     156           0 :                     nDocIndex = n;
     157           0 :                     bNextDoc = sal_True;
     158           0 :                     pOutlView->SetOutputArea( Rectangle( Point(), Size(1,1)));
     159           0 :                     SetPaperSize( pTextObj->GetLogicRect().GetSize() );
     160           0 :                     SetUpdateMode(sal_True);
     161           0 :                     pView->GetWrtShell().MakeVisible(pTextObj->GetLogicRect());
     162             : 
     163           0 :                     pSdrView->SdrBeginTextEdit(pTextObj, pPV, &pView->GetEditWin(), sal_False, this, pOutlView, sal_True, sal_True);
     164             :                 }
     165             :                 else
     166           0 :                     SetUpdateMode(sal_False);
     167             :             }
     168             : 
     169           0 :             if ( !bNextDoc )
     170           0 :                 pTextObj = NULL;
     171             :             else
     172           0 :                 break;
     173             :         }
     174             :     }
     175             : 
     176           0 :     ClearModifyFlag();
     177             : 
     178           0 :     return bNextDoc;
     179             : }
     180             : 
     181             : //////////////////////////////////////////////////////////////////////
     182             : 
     183             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10