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

Generated by: LCOV version 1.10