LCOV - code coverage report
Current view: top level - include/editeng - editstat.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 22 18.2 %
Date: 2015-06-13 12:38:46 Functions: 4 10 40.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             : #ifndef INCLUDED_EDITENG_EDITSTAT_HXX
      21             : #define INCLUDED_EDITENG_EDITSTAT_HXX
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : #include <tools/solar.h>
      25             : #include <i18nlangtag/lang.h>
      26             : #include <o3tl/typed_flags_set.hxx>
      27             : 
      28             : enum class EEControlBits
      29             : {
      30             :     NONE               = 0x00000000,
      31             :     USECHARATTRIBS     = 0x00000001,  // Use of hard character attributes
      32             :     USEPARAATTRIBS     = 0x00000002,  // Using paragraph attributes.
      33             :     CRSRLEFTPARA       = 0x00000004,  // Cursor is moved to another paragraph
      34             :     DOIDLEFORMAT       = 0x00000008,  // Formatting idle
      35             :     PASTESPECIAL       = 0x00000010,  // Allow PasteSpecial
      36             :     AUTOINDENTING      = 0x00000020,  // Automatic indenting
      37             :     UNDOATTRIBS        = 0x00000040,  // Undo for Attributes....
      38             :     ONECHARPERLINE     = 0x00000080,  // One character per line
      39             :     NOCOLORS           = 0x00000100,  // Engine: No Color
      40             :     OUTLINER           = 0x00000200,  // Special treatment Outliner/Outline mode
      41             :     OUTLINER2          = 0x00000400,  // Special treatment Outliner/Page
      42             :     ALLOWBIGOBJS       = 0x00000800,  // Portion info in text object
      43             :     ONLINESPELLING     = 0x00001000,  // During the edit Spelling
      44             :     STRETCHING         = 0x00002000,  // Stretch mode
      45             :     MARKFIELDS         = 0x00004000,  // Mark Fields with color
      46             :     RESTOREFONT        = 0x00010000,  // Restore Font in OutDev
      47             :     RTFSTYLESHEETS     = 0x00020000,  // Use Stylesheets when imported
      48             :     AUTOCORRECT        = 0x00080000,  // AutoCorrect
      49             :     AUTOCOMPLETE       = 0x00100000,  // AutoComplete
      50             :     AUTOPAGESIZEX      = 0x00200000,  // Adjust paper width to Text
      51             :     AUTOPAGESIZEY      = 0x00400000,  // Adjust paper height to Text
      52             :     AUTOPAGESIZE       = (AUTOPAGESIZEX | AUTOPAGESIZEY),
      53             :     TABINDENTING       = 0x00800000,  // Indent with tab
      54             :     FORMAT100          = 0x01000000,  // Always format to 100%
      55             :     ULSPACESUMMATION   = 0x02000000,  // MS Compat: sum SA and SB, not maximum value
      56             :     ULSPACEFIRSTPARA   = 0x04000000,  // MS Compat: evaluate also at the first paragraph
      57             : };
      58             : namespace o3tl
      59             : {
      60             :     template<> struct typed_flags<EEControlBits> : is_typed_flags<EEControlBits, 0x07ffffff> {};
      61             : }
      62             : 
      63             : enum class EVControlBits
      64             : {
      65             :     AUTOSCROLL         = 0x0001,  // Auto scrolling horizontally
      66             :     BIGSCROLL          = 0x0002,  // Scroll further to the cursor
      67             :     ENABLEPASTE        = 0x0004,  // Enable Paste
      68             :     SINGLELINEPASTE    = 0x0008,  // View: Paste in input line ...
      69             :     OVERWRITE          = 0x0010,  // Overwrite mode
      70             :     INVONEMORE         = 0x0020,  // Invalidate one pixel more
      71             :     AUTOSIZEX          = 0x0040,  // Automatically adapt to text width
      72             :     AUTOSIZEY          = 0x0080,  // Automatically adapt to Text width
      73             :     AUTOSIZE           = (AUTOSIZEX|AUTOSIZEY)
      74             : };
      75             : namespace o3tl
      76             : {
      77             :     template<> struct typed_flags<EVControlBits> : is_typed_flags<EVControlBits, 0xff> {};
      78             : }
      79             : 
      80             : enum class EditStatusFlags
      81             : {
      82             :     NONE                = 0x0000,
      83             :     HSCROLL             = 0x0001,
      84             :     VSCROLL             = 0x0002,
      85             :     CURSOROUT           = 0x0004,
      86             :     CRSRMOVEFAIL        = 0x0008,
      87             :     CRSRLEFTPARA        = 0x0010,
      88             :     TEXTWIDTHCHANGED    = 0x0020,
      89             :     TEXTHEIGHTCHANGED   = 0x0040,
      90             :     WRONGWORDCHANGED    = 0x0080
      91             : };
      92             : namespace o3tl
      93             : {
      94             :     template<> struct typed_flags<EditStatusFlags> : is_typed_flags<EditStatusFlags, 0xff> {};
      95             : }
      96             : 
      97             : /*
      98             :     EditStatusFlags::CRSRLEFTPARA at the time cursor movement and the enter.
      99             : */
     100             : 
     101             : inline void SetFlags( EEControlBits& rBits, EEControlBits nMask, bool bOn )
     102             : {
     103             :     if ( bOn )
     104             :         rBits |= nMask;
     105             :     else
     106             :         rBits &= ~nMask;
     107             : }
     108             : 
     109           0 : inline void SetFlags( EVControlBits& rBits, EVControlBits nMask, bool bOn )
     110             : {
     111           0 :     if ( bOn )
     112           0 :         rBits |= nMask;
     113             :     else
     114           0 :         rBits &= ~nMask;
     115           0 : }
     116             : 
     117             : class EditStatus
     118             : {
     119             : protected:
     120             :     EditStatusFlags nStatusBits;
     121             :     EEControlBits   nControlBits;
     122             :     sal_Int32       nPrevPara;                  // for EditStatusFlags::CRSRLEFTPARA
     123             : 
     124             : public:
     125       42102 :             EditStatus()                { nStatusBits = EditStatusFlags::NONE; nControlBits = EEControlBits::NONE; nPrevPara = -1; }
     126             : 
     127        1073 :     void    Clear()                     { nStatusBits = EditStatusFlags::NONE; }
     128             :     void    SetControlBits( EEControlBits nMask, bool bOn )
     129             :                 { SetFlags( nControlBits, nMask, bOn ); }
     130             : 
     131           0 :     EditStatusFlags  GetStatusWord() const       { return nStatusBits; }
     132      344468 :     EditStatusFlags& GetStatusWord()             { return nStatusBits; }
     133             : 
     134             :     EEControlBits  GetControlWord() const      { return nControlBits; }
     135     2550998 :     EEControlBits& GetControlWord()            { return nControlBits; }
     136             : 
     137             :     sal_Int32   GetPrevParagraph() const    { return nPrevPara; }
     138           0 :     sal_Int32&  GetPrevParagraph()          { return nPrevPara; }
     139             : };
     140             : 
     141             : enum class SpellCallbackCommand
     142             : {
     143             :     IGNOREWORD         = 0x0001,
     144             :     STARTSPELLDLG      = 0x0002,
     145             :     ADDTODICTIONARY    = 0x0003,
     146             :     WORDLANGUAGE       = 0x0004,
     147             :     PARALANGUAGE       = 0x0005,
     148             : };
     149             : 
     150           0 : struct SpellCallbackInfo
     151             : {
     152             :     SpellCallbackCommand nCommand;
     153             :     OUString        aWord;
     154             :     LanguageType    eLanguage;
     155             : 
     156           0 :     SpellCallbackInfo( SpellCallbackCommand nCMD, const OUString& rWord )
     157           0 :         : aWord( rWord )
     158             :     {
     159           0 :         nCommand = nCMD;
     160           0 :         eLanguage = LANGUAGE_DONTKNOW;
     161           0 :     }
     162             : 
     163           0 :     SpellCallbackInfo( SpellCallbackCommand nCMD, LanguageType eLang )
     164           0 :     {
     165           0 :         nCommand = nCMD;
     166           0 :         eLanguage = eLang;
     167           0 :     }
     168             : };
     169             : 
     170             : #endif // INCLUDED_EDITENG_EDITSTAT_HXX
     171             : 
     172             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11