LCOV - code coverage report
Current view: top level - include/editeng - unoedhlp.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 6 16.7 %
Date: 2015-06-13 12:38:46 Functions: 3 8 37.5 %
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_UNOEDHLP_HXX
      21             : #define INCLUDED_EDITENG_UNOEDHLP_HXX
      22             : 
      23             : #include <memory>
      24             : #include <tools/solar.h>
      25             : #include <vcl/textdata.hxx>
      26             : #include <svl/hint.hxx>
      27             : #include <tools/gen.hxx>
      28             : #include <editeng/editengdllapi.h>
      29             : 
      30             : struct EENotify;
      31             : class EditEngine;
      32             : 
      33             : #define EDITSOURCE_HINT_PARASMOVED          20
      34             : #define EDITSOURCE_HINT_SELECTIONCHANGED    21
      35             : 
      36             : /** Extends TextHint by two additional parameters which are necessary
      37             :     for the EDITSOURCE_HINT_PARASMOVED hint. TextHint's value in this
      38             :     case denotes the destination position, the two parameters the
      39             :     start and the end of the moved paragraph range.
      40             :  */
      41          15 : class EDITENG_DLLPUBLIC SvxEditSourceHint : public TextHint
      42             : {
      43             : private:
      44             :     sal_Int32   mnStart;
      45             :     sal_Int32   mnEnd;
      46             : 
      47             : public:
      48             :             SvxEditSourceHint( sal_uLong nId );
      49             :             SvxEditSourceHint( sal_uLong nId, sal_uLong nValue, sal_Int32 nStart=0, sal_Int32 nEnd=0 );
      50             : 
      51             :     sal_uLong   GetValue() const;
      52           0 :     sal_Int32   GetStartValue() const { return mnStart;}
      53           0 :     sal_Int32   GetEndValue() const { return mnEnd;}
      54             : };
      55           0 : class SvxEditSourceHintEndPara :public SvxEditSourceHint
      56             : {
      57             : public:
      58           0 :     SvxEditSourceHintEndPara( sal_uInt32 nId )
      59           0 :         :SvxEditSourceHint(nId) {}
      60             :     SvxEditSourceHintEndPara( sal_uInt32 nId, sal_uInt32 nValue, sal_uInt32 nStart=0, sal_uInt32 nEnd=0 )
      61             :         :SvxEditSourceHint(nId,nValue,nStart){ (void)nEnd; }
      62             : };
      63             : /** Helper class for common functionality in edit sources
      64             :  */
      65             : class EDITENG_DLLPUBLIC SvxEditSourceHelper
      66             : {
      67             : public:
      68             : 
      69             :     /** Translates EditEngine notifications into broadcastable hints
      70             : 
      71             :         @param aNotify
      72             :         Notification object send by the EditEngine.
      73             : 
      74             :         @return the translated hint
      75             :      */
      76             :     static ::std::unique_ptr<SfxHint> EENotification2Hint( EENotify* aNotify );
      77             : 
      78             :     /** Calculate attribute run for EditEngines
      79             : 
      80             :         Please note that the range returned is half-open: [nStartIndex,nEndIndex)
      81             : 
      82             :         @param nStartIndex
      83             :         Herein, the start index of the range of similar attributes is returned
      84             : 
      85             :         @param nEndIndex
      86             :         Herein, the end index (exclusive) of the range of similar attributes is returned
      87             : 
      88             :         @param rEE
      89             :         The EditEngine to query for attributes
      90             : 
      91             :         @param nPara
      92             :         The paragraph the following index value is to be interpreted in
      93             : 
      94             :         @param nIndex
      95             :         The character index from which the range of similar attributed characters is requested
      96             : 
      97             :         @return true, if the range has been successfully determined
      98             :      */
      99             :      static bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, const EditEngine& rEE, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false);
     100             : 
     101             :     /** Convert point from edit engine to user coordinate space
     102             : 
     103             :         As the edit engine internally keeps vertical text unrotated,
     104             :         all internal edit engine methods return their stuff unrotated,
     105             :         too. This method rotates and shifts given point appropriately,
     106             :         if vertical writing is on.
     107             : 
     108             :         @param rPoint
     109             :         Point to transform
     110             : 
     111             :         @param rEESize
     112             :         Paper size of the edit engine
     113             : 
     114             :         @param  bIsVertical
     115             :         Whether output text is vertical or not
     116             : 
     117             :         @return the possibly transformed point
     118             :      */
     119             :     static Point EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical );
     120             : 
     121             :     /** Convert point from user to edit engine coordinate space
     122             : 
     123             :         As the edit engine internally keeps vertical text unrotated,
     124             :         all internal edit engine methods return their stuff unrotated,
     125             :         too. This method rotates and shifts given point appropriately,
     126             :         if vertical writing is on.
     127             : 
     128             :         @param rPoint
     129             :         Point to transform
     130             : 
     131             :         @param rEESize
     132             :         Paper size of the edit engine
     133             : 
     134             :         @param  bIsVertical
     135             :         Whether output text is vertical or not
     136             : 
     137             :         @return the possibly transformed point
     138             :      */
     139             :     static Point UserSpaceToEE( const Point& rPoint, const Size& rEESize, bool bIsVertical );
     140             : 
     141             :     /** Convert rect from edit engine to user coordinate space
     142             : 
     143             :         As the edit engine internally keeps vertical text unrotated,
     144             :         all internal edit engine methods return their stuff unrotated,
     145             :         too. This method rotates and shifts given rect appropriately,
     146             :         if vertical writing is on.
     147             : 
     148             :         @param rRect
     149             :         Rectangle to transform
     150             : 
     151             :         @param rEESize
     152             :         Paper size of the edit engine
     153             : 
     154             :         @param  bIsVertical
     155             :         Whether output text is vertical or not
     156             : 
     157             :         @return the possibly transformed rect
     158             :      */
     159             :     static Rectangle EEToUserSpace( const Rectangle& rRect, const Size& rEESize, bool bIsVertical );
     160             : 
     161             : };
     162             : 
     163             : #endif
     164             : 
     165             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11