LCOV - code coverage report
Current view: top level - sw/source/core/inc - SwPortionHandler.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 4 4 100.0 %
Date: 2014-11-03 Functions: 3 4 75.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_SW_SOURCE_CORE_INC_SWPORTIONHANDLER_HXX
      21             : #define INCLUDED_SW_SOURCE_CORE_INC_SWPORTIONHANDLER_HXX
      22             : 
      23             : #include <swtypes.hxx>
      24             : 
      25             : /** The SwPortionHandler interface implements a visitor for the layout
      26             :  * engine's text portions. This can be used to gather information of
      27             :  * the on-screen representation of a single paragraph.
      28             :  *
      29             :  * For each text portion, one of the methods text(...) or special(...)
      30             :  * is called, depending on whether it is a 'normal' run of text, or
      31             :  * any other portion. Additionally, the linebreak() method is called
      32             :  * once at the end of every on-screen line.
      33             :  *
      34             :  * All parameters relate to the 'model string', which is the text string
      35             :  * held by the corresponding SwTxtNode.
      36             :  *
      37             :  * The SwPortionHandler can be used with the
      38             :  * SwTextFrame::VisitPortions(...) method.
      39             :  */
      40             : class SwPortionHandler
      41             : {
      42             : public:
      43             : 
      44        1800 :     SwPortionHandler() {}           /// (emtpy) constructor
      45             : 
      46        1800 :     virtual ~SwPortionHandler() {}  /// (empty) destructor
      47             : 
      48             :     /** text portion. A run of nLength characters from the model
      49             :      * string, that contains no special characters like embedded
      50             :      * fields, etc. Thus, the on-screen text of this portion
      51             :      * corresponds exactly to the corresponding characters in the
      52             :      * model string.
      53             :      */
      54             :     virtual void Text(
      55             :         sal_Int32 nLength,      /// length of this portion in the model string
      56             :         sal_uInt16 nType,         /// type of this portion
      57             :         sal_Int32 nHeight = 0,   /// height of this portion
      58             :         sal_Int32 nWidth = 0     /// width of this portion
      59             :         ) = 0;
      60             : 
      61             :     /** special portion. This method is called for every non-text
      62             :      * portion. The parameters describe the length of the
      63             :      * corresponding characters in the model string (often 0 or 1),
      64             :      * the text which is displayed, and the type of the portion.
      65             :      */
      66             :     virtual void Special(
      67             :         sal_Int32 nLength,      /// length of this portion in the model string
      68             :         const OUString& rText, /// text which is painted on-screen
      69             :         sal_uInt16 nType,         /// type of this portion
      70             :         sal_Int32 nHeight = 0,     /// font height of the painted text
      71             :         sal_Int32 nWidth = 0     /// width of this portion
      72             :         ) = 0;
      73             : 
      74             :     /** line break. This method is called whenever a line break in the
      75             :      * layout occurs.
      76             :      */
      77             :     virtual void LineBreak(sal_Int32 nWidth) = 0;
      78             : 
      79             :     /** skip characters. The SwTxtFrame may only display partially
      80             :      * display a certain paragraph (e.g. when the paragaph is split
      81             :      * across multiple pages). In this case, the Skip() method must be
      82             :      * called to inform the portion handler to ignore a certain run of
      83             :      * characters in the 'model string'. Skip(), if used at all, must
      84             :      * be called before any of the other methods is called. Calling
      85             :      * Skip() between portions is not allowed.
      86             :      */
      87             :     virtual void Skip(
      88             :         sal_Int32 nLength   /// number of 'model string' characters to be skipped
      89             :         ) = 0;
      90             : 
      91             :     /** end of paragraph. This method is to be called when all the
      92             :      * paragraph's portions have been processed.
      93             :      */
      94             :     virtual void Finish() = 0;
      95           2 :     virtual void SetAttrFieldType( sal_uInt16 )
      96           2 :     { return; }
      97             : };
      98             : 
      99             : #endif
     100             : 
     101             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10