2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2002-02-19 13:34:55 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 13:05:44 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2002-02-19 13:34:55 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2002-02-19 13:34:55 +00:00
|
|
|
*
|
2008-04-10 13:05:44 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-02-19 13:34:55 +00:00
|
|
|
*
|
2008-04-10 13:05:44 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2002-02-19 13:34:55 +00:00
|
|
|
*
|
2008-04-10 13:05:44 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2002-02-19 13:34:55 +00:00
|
|
|
*
|
2008-04-10 13:05:44 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2002-02-19 13:34:55 +00:00
|
|
|
*
|
2008-04-10 13:05:44 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2002-02-19 13:34:55 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2012-06-02 13:43:01 +02:00
|
|
|
|
2002-02-19 13:34:55 +00:00
|
|
|
#ifndef _SW_PORTIONHANDLER_HXX
|
|
|
|
#define _SW_PORTIONHANDLER_HXX
|
|
|
|
|
|
|
|
#include <tools/solar.h>
|
2012-06-02 13:43:01 +02:00
|
|
|
|
2002-02-19 13:34:55 +00:00
|
|
|
class String;
|
|
|
|
|
|
|
|
/** The SwPortionHandler interface implements a visitor for the layout
|
|
|
|
* engine's text portions. This can be used to gather information of
|
|
|
|
* the on-screen representation of a single paragraph.
|
|
|
|
*
|
|
|
|
* For each text portion, one of the methods text(...) or special(...)
|
|
|
|
* is called, depending on whether it is a 'normal' run of text, or
|
|
|
|
* any other portion. Additionally, the linebreak() method is called
|
|
|
|
* once at the end of every on-screen line.
|
|
|
|
*
|
|
|
|
* All parameters relate to the 'model string', which is the text string
|
|
|
|
* held by the corresponding SwTxtNode.
|
|
|
|
*
|
|
|
|
* The SwPortionHandler can be used with the
|
|
|
|
* SwTextFrame::VisitPortions(...) method.
|
|
|
|
*/
|
|
|
|
class SwPortionHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
SwPortionHandler() {} /// (emtpy) constructor
|
|
|
|
|
|
|
|
virtual ~SwPortionHandler() {} /// (empty) destructor
|
|
|
|
|
|
|
|
/** text portion. A run of nLength characters from the model
|
|
|
|
* string, that contains no special characters like embedded
|
|
|
|
* fields, etc. Thus, the on-screen text of this portion
|
|
|
|
* corresponds exactly to the corresponding characters in the
|
|
|
|
* model string.
|
|
|
|
*/
|
|
|
|
virtual void Text(
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nLength, /// length of this portion in the model string
|
|
|
|
sal_uInt16 nType /// type of this portion
|
2002-02-19 13:34:55 +00:00
|
|
|
) = 0;
|
|
|
|
|
|
|
|
/** special portion. This method is called for every non-text
|
|
|
|
* portion. The parameters describe the length of the
|
|
|
|
* corresponding characters in the model string (often 0 or 1),
|
|
|
|
* the text which is displayed, and the type of the portion.
|
|
|
|
*/
|
|
|
|
virtual void Special(
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nLength, /// length of this portion in the model string
|
2002-02-19 13:34:55 +00:00
|
|
|
const String& rText, /// text which is painted on-screen
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nType /// type of this portion
|
2002-02-19 13:34:55 +00:00
|
|
|
) = 0;
|
|
|
|
|
|
|
|
/** line break. This method is called whenever a line break in the
|
|
|
|
* layout occurs.
|
|
|
|
*/
|
|
|
|
virtual void LineBreak() = 0;
|
|
|
|
|
2002-02-21 13:55:31 +00:00
|
|
|
/** skip characters. The SwTxtFrame may only display partially
|
|
|
|
* display a certain paragraph (e.g. when the paragaph is split
|
|
|
|
* across multiple pages). In this case, the Skip() method must be
|
|
|
|
* called to inform the portion handler to ignore a certain run of
|
|
|
|
* characters in the 'model string'. Skip(), if used at all, must
|
|
|
|
* be called before any of the other methods is called. Calling
|
|
|
|
* Skip() between portions is not allowed.
|
|
|
|
*/
|
|
|
|
virtual void Skip(
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nLength /// number of 'model string' characters to be skipped
|
2002-02-21 13:55:31 +00:00
|
|
|
) = 0;
|
|
|
|
|
2002-02-19 13:34:55 +00:00
|
|
|
/** end of paragraph. This method is to be called when all the
|
|
|
|
* paragraph's portions have been processed.
|
|
|
|
*/
|
|
|
|
virtual void Finish() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|