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

Generated by: LCOV version 1.10