LCOV - code coverage report
Current view: top level - sw/inc - splargs.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 13 33 39.4 %
Date: 2015-06-13 12:38:46 Functions: 5 16 31.2 %
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             : #ifndef INCLUDED_SW_INC_SPLARGS_HXX
      20             : #define INCLUDED_SW_INC_SPLARGS_HXX
      21             : 
      22             : #include <i18nlangtag/lang.h>
      23             : #include <tools/solar.h>
      24             : #include <tools/gen.hxx>
      25             : #include <limits.h>
      26             : 
      27             : #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
      28             : #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
      29             : #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
      30             : 
      31             : class SwTextNode;
      32             : class SwIndex;
      33             : namespace vcl { class Font; }
      34             : 
      35             : struct SwArgsBase     // used for text conversion (Hangul/Hanja, ...)
      36             : {
      37             :     SwTextNode  *pStartNode;
      38             :     SwIndex    *pStartIdx;
      39             :     SwTextNode  *pEndNode;
      40             :     SwIndex    *pEndIdx;
      41             : 
      42           4 :     SwArgsBase(
      43             :             SwTextNode* pStart, SwIndex& rStart,
      44             :             SwTextNode* pEnd, SwIndex& rEnd )
      45             :         : pStartNode( pStart ), pStartIdx( &rStart ),
      46           4 :           pEndNode( pEnd ), pEndIdx( &rEnd )
      47           4 :         {}
      48             : 
      49           6 :     void SetStart(SwTextNode* pStart, SwIndex& rStart )
      50             :     {
      51           6 :         pStartNode = pStart;    pStartIdx = &rStart ;
      52           6 :     }
      53             : 
      54           6 :     void SetEnd( SwTextNode* pEnd, SwIndex& rEnd  )
      55             :     {
      56           6 :         pEndNode = pEnd;        pEndIdx = &rEnd ;
      57           6 :     }
      58             : };
      59             : 
      60             : // used for text conversion (Hangul/Hanja, Simplified/Traditional Chinese, ...)
      61           4 : struct SwConversionArgs : SwArgsBase
      62             : {
      63             :     OUString   aConvText;          // convertible text found
      64             :     LanguageType    nConvSrcLang;       // (source) language to look for
      65             :     LanguageType    nConvTextLang;      // language of aConvText (if the latter one was found)
      66             : 
      67             :     // used for chinese translation
      68             :     LanguageType    nConvTargetLang;    // target language of text to be changed
      69             :     const vcl::Font *pTargetFont;        // target font of text to be changed
      70             :     // explicitly enables or disables application of the above two
      71             :     bool            bAllowImplicitChangesForNotConvertibleText;
      72             : 
      73           4 :     SwConversionArgs( LanguageType nLang,
      74             :             SwTextNode* pStart, SwIndex& rStart,
      75             :             SwTextNode* pEnd, SwIndex& rEnd )
      76             :         : SwArgsBase( pStart, rStart, pEnd, rEnd ),
      77             :           nConvSrcLang( nLang ),
      78             :           nConvTextLang( LANGUAGE_NONE ),
      79             :           nConvTargetLang( LANGUAGE_NONE ),
      80             :           pTargetFont( NULL ),
      81           4 :           bAllowImplicitChangesForNotConvertibleText( false )
      82           4 :         {}
      83             : };
      84             : 
      85           0 : struct SwSpellArgs : SwArgsBase
      86             : {
      87             :     ::com::sun::star::uno::Reference<
      88             :         ::com::sun::star::linguistic2::XSpellChecker1 >     xSpeller;
      89             : 
      90             :     ::com::sun::star::uno::Reference<
      91             :         ::com::sun::star::linguistic2::XSpellAlternatives > xSpellAlt;
      92             : 
      93             :     bool bIsGrammarCheck;
      94             : 
      95           0 :     SwSpellArgs(::com::sun::star::uno::Reference<
      96             :             ::com::sun::star::linguistic2::XSpellChecker1 > &rxSplChk,
      97             :             SwTextNode* pStart, SwIndex& rStart,
      98             :             SwTextNode* pEnd, SwIndex& rEnd,
      99             :             bool bGrammar )
     100             :         :   SwArgsBase( pStart, rStart, pEnd, rEnd ),
     101             :             xSpeller( rxSplChk ),
     102           0 :             bIsGrammarCheck( bGrammar )
     103           0 :         {}
     104             : };
     105             : 
     106             : // Parameter-class for Hyphenate.
     107             : // docedt.cxx:  SwDoc::Hyphenate()
     108             : // txtedt.cxx:  SwTextNode::Hyphenate()
     109             : // txthyph.cxx: SwTextFrm::Hyphenate()
     110             : 
     111           0 : class SwInterHyphInfo
     112             : {
     113             :     css::uno::Reference< css::linguistic2::XHyphenatedWord >    xHyphWord;
     114             :     const Point aCrsrPos;
     115             :     bool bNoLang : 1;
     116             :     bool bCheck  : 1;
     117             : public:
     118             :     sal_Int32 nStart;
     119             :     sal_Int32 nEnd;
     120             :     sal_Int32 nWordStart;
     121             :     sal_Int32 nWordLen;
     122             :     sal_Int32 nHyphPos;
     123             :     sal_uInt16 nMinTrail;
     124             : 
     125           0 :     SwInterHyphInfo( const Point &rCrsrPos, sal_Int32 nStartPos = 0,
     126             :         sal_Int32 nLength = SAL_MAX_INT32 )
     127             :         : aCrsrPos(rCrsrPos)
     128             :         , bNoLang(false)
     129             :         , bCheck(false)
     130             :         , nStart(nStartPos)
     131             :         , nEnd(nLength == SAL_MAX_INT32 ? SAL_MAX_INT32 : nStartPos + nLength)
     132             :         , nWordStart(0), nWordLen(0)
     133           0 :         , nHyphPos(0), nMinTrail(0)
     134             :     {
     135           0 :     }
     136           0 :     sal_Int32 GetEnd() const
     137             :     {
     138           0 :         return nEnd;
     139             :     }
     140           0 :     const Point *GetCrsrPos() const
     141             :     {
     142           0 :         return aCrsrPos.X() || aCrsrPos.Y() ? &aCrsrPos : 0;
     143             :     }
     144           0 :     bool IsCheck() const { return bCheck; }
     145           0 :     void SetCheck( const bool bNew ) { bCheck = bNew; }
     146           0 :     void SetNoLang( const bool bNew ) { bNoLang = bNew; }
     147           0 :     void SetHyphWord(const css::uno::Reference< css::linguistic2::XHyphenatedWord >  &rxHW)
     148             :     {
     149           0 :         xHyphWord = rxHW;
     150           0 :     }
     151           0 :     css::uno::Reference< css::linguistic2::XHyphenatedWord > GetHyphWord()
     152             :     {
     153           0 :         return xHyphWord;
     154             :     }
     155             : };
     156             : 
     157             : #endif
     158             : 
     159             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11