LCOV - code coverage report
Current view: top level - include/editeng - editdata.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 29 46 63.0 %
Date: 2015-06-13 12:38:46 Functions: 10 15 66.7 %
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             : // MyEDITDATA, wegen exportiertem EditData
      21             : #ifndef INCLUDED_EDITENG_EDITDATA_HXX
      22             : #define INCLUDED_EDITENG_EDITDATA_HXX
      23             : 
      24             : #include <rtl/ustring.hxx>
      25             : #include <editeng/editengdllapi.h>
      26             : 
      27             : class SfxItemSet;
      28             : class SfxPoolItem;
      29             : class SvParser;
      30             : class SvxFieldItem;
      31             : 
      32             : enum EETextFormat       { EE_FORMAT_TEXT = 0x20, EE_FORMAT_RTF, EE_FORMAT_BIN = 0x31, EE_FORMAT_HTML, EE_FORMAT_XML };
      33             : enum EEHorizontalTextDirection { EE_HTEXTDIR_DEFAULT, EE_HTEXTDIR_L2R, EE_HTEXTDIR_R2L };
      34             : enum EESelectionMode    { EE_SELMODE_STD, EE_SELMODE_TXTONLY, EE_SELMODE_HIDDEN };
      35             :     // EE_SELMODE_HIDDEN can be used to completely hide the selection. This is useful e.g. when you want show the selection
      36             :     // only as long as your window (which the edit view works on) has the focus
      37             : enum EESpellState       { EE_SPELL_OK, EE_SPELL_NOLANGUAGE, EE_SPELL_LANGUAGENOTINSTALLED, EE_SPELL_NOSPELLER, EE_SPELL_ERRORFOUND };
      38             : enum EVAnchorMode       {
      39             :             ANCHOR_TOP_LEFT,    ANCHOR_VCENTER_LEFT,    ANCHOR_BOTTOM_LEFT,
      40             :             ANCHOR_TOP_HCENTER, ANCHOR_VCENTER_HCENTER, ANCHOR_BOTTOM_HCENTER,
      41             :             ANCHOR_TOP_RIGHT,   ANCHOR_VCENTER_RIGHT,   ANCHOR_BOTTOM_RIGHT };
      42             : 
      43             : #define EE_PARA_NOT_FOUND       SAL_MAX_INT32
      44             : #define EE_PARA_APPEND          SAL_MAX_INT32
      45             : #define EE_PARA_ALL             SAL_MAX_INT32
      46             : #define EE_PARA_MAX_COUNT       SAL_MAX_INT32
      47             : 
      48             : #define EE_INDEX_NOT_FOUND      SAL_MAX_INT32
      49             : #define EE_TEXTPOS_ALL          SAL_MAX_INT32
      50             : #define EE_TEXTPOS_MAX_COUNT    SAL_MAX_INT32
      51             : 
      52             : EDITENG_DLLPUBLIC extern const size_t EE_APPEND;
      53             : 
      54             : // Error messages for Read / Write Method
      55             : #define EE_READWRITE_OK              (SVSTREAM_OK)
      56             : #define EE_READWRITE_WRONGFORMAT     (SVSTREAM_ERRBASE_USER+1)
      57             : #define EE_READWRITE_GENERALERROR    (SVSTREAM_ERRBASE_USER+2)
      58             : 
      59             : #define EDITUNDO_REMOVECHARS        100
      60             : #define EDITUNDO_CONNECTPARAS       101
      61             : #define EDITUNDO_REMOVEFEATURE      102
      62             : #define EDITUNDO_MOVEPARAGRAPHS     103
      63             : #define EDITUNDO_INSERTFEATURE      104
      64             : #define EDITUNDO_SPLITPARA          105
      65             : #define EDITUNDO_INSERTCHARS        106
      66             : #define EDITUNDO_DELCONTENT         107
      67             : #define EDITUNDO_DELETE             108
      68             : #define EDITUNDO_CUT                109
      69             : #define EDITUNDO_PASTE              110
      70             : #define EDITUNDO_INSERT             111
      71             : #define EDITUNDO_SRCHANDREPL        112
      72             : #define EDITUNDO_MOVEPARAS          113
      73             : #define EDITUNDO_PARAATTRIBS        114
      74             : #define EDITUNDO_ATTRIBS            115
      75             : #define EDITUNDO_DRAGANDDROP        116
      76             : #define EDITUNDO_READ               117
      77             : #define EDITUNDO_STYLESHEET         118
      78             : #define EDITUNDO_REPLACEALL         119
      79             : #define EDITUNDO_STRETCH            120
      80             : #define EDITUNDO_RESETATTRIBS       121
      81             : #define EDITUNDO_INDENTBLOCK        122
      82             : #define EDITUNDO_UNINDENTBLOCK      123
      83             : #define EDITUNDO_MARKSELECTION      124
      84             : #define EDITUNDO_TRANSLITERATE      125
      85             : 
      86             : #define EDITUNDO_USER               200
      87             : 
      88             : class EditView;
      89             : class EditEngine;
      90             : class ImpEditView;
      91             : class ImpEditEngine;
      92             : class EditTextObject;
      93             : class SfxStyleSheet;
      94             : 
      95             : #define RGCHK_NONE          0   // No correction of ViusArea when scrolling
      96             : #define RGCHK_NEG           1   // No negative ViusArea when scrolling
      97             : #define RGCHK_PAPERSZ1      2   // VisArea must be within paper width, Text Size
      98             : 
      99             : struct EPosition
     100             : {
     101             :     sal_Int32   nPara;
     102             :     sal_Int32   nIndex;
     103             : 
     104          57 :     EPosition()
     105             :         : nPara( EE_PARA_NOT_FOUND )
     106          57 :         , nIndex( EE_INDEX_NOT_FOUND )
     107          57 :         { }
     108             : 
     109          51 :     EPosition( sal_Int32 nPara_, sal_Int32 nPos_ )
     110             :         : nPara( nPara_ )
     111          51 :         , nIndex( nPos_ )
     112          51 :         { }
     113             : };
     114             : 
     115             : struct ESelection
     116             : {
     117             :     sal_Int32   nStartPara;
     118             :     sal_Int32   nStartPos;
     119             :     sal_Int32   nEndPara;
     120             :     sal_Int32   nEndPos;
     121             : 
     122      601676 :     ESelection() : nStartPara( 0 ), nStartPos( 0 ), nEndPara( 0 ), nEndPos( 0 ) {}
     123             : 
     124      466524 :     ESelection( sal_Int32 nStPara, sal_Int32 nStPos,
     125             :                 sal_Int32 nEPara, sal_Int32 nEPos )
     126             :         : nStartPara( nStPara )
     127             :         , nStartPos( nStPos )
     128             :         , nEndPara( nEPara )
     129      466524 :         , nEndPos( nEPos )
     130      466524 :         { }
     131             : 
     132         204 :     ESelection( sal_Int32 nPara, sal_Int32 nPos )
     133             :         : nStartPara( nPara )
     134             :         , nStartPos( nPos )
     135             :         , nEndPara( nPara )
     136         204 :         , nEndPos( nPos )
     137         204 :         { }
     138             : 
     139             :     void    Adjust();
     140             :     bool    IsEqual( const ESelection& rS ) const;
     141             :     bool    IsLess( const ESelection& rS ) const;
     142             :     bool    IsGreater( const ESelection& rS ) const;
     143             :     bool    IsZero() const;
     144             :     bool    HasRange() const;
     145             : };
     146             : 
     147          58 : inline bool ESelection::HasRange() const
     148             : {
     149          58 :     return ( nStartPara != nEndPara ) || ( nStartPos != nEndPos );
     150             : }
     151             : 
     152           0 : inline bool ESelection::IsZero() const
     153             : {
     154           0 :     return ( ( nStartPara == 0 ) && ( nStartPos == 0 ) &&
     155           0 :              ( nEndPara == 0 ) && ( nEndPos == 0 ) );
     156             : }
     157             : 
     158        6825 : inline bool ESelection::IsEqual( const ESelection& rS ) const
     159             : {
     160       18970 :     return ( ( nStartPara == rS.nStartPara ) && ( nStartPos == rS.nStartPos ) &&
     161       18703 :              ( nEndPara == rS.nEndPara ) && ( nEndPos == rS.nEndPos ) );
     162             : }
     163             : 
     164           0 : inline bool ESelection::IsLess( const ESelection& rS ) const
     165             : {
     166             :     // The selection must be adjusted.
     167             :     // => Only check if end of 'this' < Start of rS
     168           0 :     return ( nEndPara < rS.nStartPara ) ||
     169           0 :         ( ( nEndPara == rS.nStartPara ) && ( nEndPos < rS.nStartPos ) && !IsEqual( rS ) );
     170             : }
     171             : 
     172           0 : inline bool ESelection::IsGreater( const ESelection& rS ) const
     173             : {
     174             :     // The selection must be adjusted.
     175             :     // => Only check if end of 'this' < Start of rS
     176           0 :     return ( nStartPara > rS.nEndPara ) ||
     177           0 :         ( ( nStartPara == rS.nEndPara ) && ( nStartPos > rS.nEndPos ) && !IsEqual( rS ) );
     178             : }
     179             : 
     180        2934 : inline void ESelection::Adjust()
     181             : {
     182        2934 :     bool bSwap = false;
     183        2934 :     if ( nStartPara > nEndPara )
     184           0 :         bSwap = true;
     185        2934 :     else if ( ( nStartPara == nEndPara ) && ( nStartPos > nEndPos ) )
     186           0 :         bSwap = true;
     187             : 
     188        2934 :     if ( bSwap )
     189             :     {
     190           0 :         sal_Int32  nSPar = nStartPara; sal_Int32 nSPos = nStartPos;
     191           0 :         nStartPara = nEndPara; nStartPos = nEndPos;
     192           0 :         nEndPara = nSPar; nEndPos = nSPos;
     193             :     }
     194        2934 : }
     195             : 
     196             : struct EDITENG_DLLPUBLIC EFieldInfo
     197             : {
     198             :     SvxFieldItem*   pFieldItem;
     199             :     OUString        aCurrentText;
     200             :     EPosition       aPosition;
     201             : 
     202             :     EFieldInfo();
     203             :     EFieldInfo( const SvxFieldItem& rFieldItem, sal_Int32 nPara, sal_Int32 nPos );
     204             :     ~EFieldInfo();
     205             : 
     206             :     EFieldInfo( const EFieldInfo& );
     207             :     EFieldInfo& operator= ( const EFieldInfo& );
     208             : };
     209             : 
     210             : enum ImportState {
     211             :                     RTFIMP_START, RTFIMP_END,               // only pParser, nPara, nIndex
     212             :                     RTFIMP_NEXTTOKEN, RTFIMP_UNKNOWNATTR,   // nToken+nTokenValue
     213             :                     RTFIMP_SETATTR,                         // pAttrs
     214             :                     RTFIMP_INSERTTEXT,                      // aText
     215             :                     RTFIMP_INSERTPARA,                      // -
     216             :                     HTMLIMP_START, HTMLIMP_END,             // only pParser, nPara, nIndex
     217             :                     HTMLIMP_NEXTTOKEN, HTMLIMP_UNKNOWNATTR, // nToken
     218             :                     HTMLIMP_SETATTR,                        // pAttrs
     219             :                     HTMLIMP_INSERTTEXT,                     // aText
     220             :                     HTMLIMP_INSERTPARA, HTMLIMP_INSERTFIELD // -
     221             :                     };
     222             : 
     223             : struct ImportInfo
     224             : {
     225             :     SvParser*               pParser;
     226             :     ESelection              aSelection;
     227             :     ImportState             eState;
     228             : 
     229             :     int                     nToken;
     230             :     short                   nTokenValue;
     231             : 
     232             :     OUString                aText;
     233             : 
     234             :     void*                   pAttrs; // RTF: SvxRTFItemStackType*, HTML: SfxItemSet*
     235             : 
     236             :     ImportInfo( ImportState eState, SvParser* pPrsrs, const ESelection& rSel );
     237             :     ~ImportInfo();
     238             : };
     239             : 
     240             : struct ParagraphInfos
     241             : {
     242        5326 :     ParagraphInfos()
     243             :         : nParaHeight( 0 )
     244             :         , nLines( 0 )
     245             :         , nFirstLineStartX( 0 )
     246             :         , nFirstLineOffset( 0 )
     247             :         , nFirstLineHeight( 0 )
     248             :         , nFirstLineTextHeight ( 0 )
     249             :         , nFirstLineMaxAscent( 0 )
     250        5326 :         , bValid( false )
     251        5326 :         {}
     252             :     sal_uInt16  nParaHeight;
     253             :     sal_uInt16  nLines;
     254             : 
     255             :     sal_uInt16  nFirstLineStartX;
     256             : 
     257             :     sal_uInt16  nFirstLineOffset;
     258             :     sal_uInt16  nFirstLineHeight;
     259             :     sal_uInt16  nFirstLineTextHeight;
     260             :     sal_uInt16  nFirstLineMaxAscent;
     261             : 
     262             :     bool        bValid; // A query during formatting is not valid!
     263             : };
     264             : 
     265             : struct EECharAttrib
     266             : {
     267             :     const SfxPoolItem*  pAttr;
     268             : 
     269             :     sal_Int32           nPara;
     270             :     sal_Int32           nStart;
     271             :     sal_Int32           nEnd;
     272             : };
     273             : 
     274             : struct MoveParagraphsInfo
     275             : {
     276             :     sal_Int32  nStartPara;
     277             :     sal_Int32  nEndPara;
     278             :     sal_Int32  nDestPara;
     279             : 
     280           0 :     MoveParagraphsInfo( sal_Int32 nS, sal_Int32 nE, sal_Int32 nD )
     281           0 :         { nStartPara = nS; nEndPara = nE; nDestPara = nD; }
     282             : };
     283             : 
     284             : #define EE_ACTION_PASTE 1
     285             : #define EE_ACTION_DROP  2
     286             : 
     287             : struct PasteOrDropInfos
     288             : {
     289             :     sal_uInt16  nAction;
     290             :     sal_Int32   nStartPara;
     291             :     sal_Int32   nEndPara;
     292             : 
     293           0 :     PasteOrDropInfos() : nAction(0), nStartPara(-1), nEndPara(-1)  {}
     294             : };
     295             : 
     296             : enum EENotifyType
     297             : {
     298             :     /// EditEngine text was modified
     299             :     EE_NOTIFY_TEXTMODIFIED,
     300             : 
     301             :     /// A paragraph was inserted into the EditEngine
     302             :     EE_NOTIFY_PARAGRAPHINSERTED,
     303             : 
     304             :     /// A paragraph was removed from the EditEngine
     305             :     EE_NOTIFY_PARAGRAPHREMOVED,
     306             : 
     307             :     /// Multiple paragraphs have been removed from the EditEngine
     308             :     EE_NOTIFY_PARAGRAPHSMOVED,
     309             : 
     310             :     /// The height of at least one paragraph has changed
     311             :     EE_NOTIFY_TEXTHEIGHTCHANGED,
     312             : 
     313             :     /// The view area of the EditEngine scrolled
     314             :     EE_NOTIFY_TEXTVIEWSCROLLED,
     315             : 
     316             :     /// The selection and/or the cursor position has changed
     317             :     EE_NOTIFY_TEXTVIEWSELECTIONCHANGED,
     318             : 
     319             :     /** Denotes the beginning of a collected amount of EditEngine
     320             :         notification events. This event itself is not queued, but sent
     321             :         immediately
     322             :      */
     323             :     EE_NOTIFY_BLOCKNOTIFICATION_START,
     324             : 
     325             :     /** Denotes the end of a collected amount of EditEngine
     326             :         notification events. After this event, the queue is empty, and
     327             :         a high-level operation such as "insert paragraph" is finished
     328             :      */
     329             :     EE_NOTIFY_BLOCKNOTIFICATION_END,
     330             : 
     331             :     /// Denotes the beginning of a high-level action triggered by a key press
     332             :     EE_NOTIFY_INPUT_START,
     333             : 
     334             :     /// Denotes the end of a high-level action triggered by a key press
     335             :     EE_NOTIFY_INPUT_END,
     336             :     EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA
     337             : };
     338             : 
     339             : struct EENotify
     340             : {
     341             :     EENotifyType    eNotificationType;
     342             :     EditEngine*     pEditEngine;
     343             :     EditView*       pEditView;
     344             : 
     345             :     sal_Int32       nParagraph; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED
     346             : 
     347             :     sal_Int32       nParam1;
     348             :     sal_Int32       nParam2;
     349             : 
     350     1220901 :     EENotify( EENotifyType eType )
     351     1220901 :         { eNotificationType = eType; pEditEngine = NULL; pEditView = NULL; nParagraph = EE_PARA_NOT_FOUND; nParam1 = 0; nParam2 = 0; }
     352             : };
     353             : 
     354             : #endif // INCLUDED_EDITENG_EDITDATA_HXX
     355             : 
     356             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11