2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2013-11-05 02:17:53 +01:00
|
|
|
#ifndef INCLUDED_SW_SOURCE_CORE_TEXT_ITRATR_HXX
|
|
|
|
#define INCLUDED_SW_SOURCE_CORE_TEXT_ITRATR_HXX
|
2001-03-06 15:25:03 +00:00
|
|
|
#include <atrhndl.hxx>
|
2001-03-05 11:54:15 +00:00
|
|
|
|
2014-07-22 17:51:51 +02:00
|
|
|
#include "swtypes.hxx"
|
2000-09-27 10:53:31 +00:00
|
|
|
#include "swfont.hxx"
|
2001-02-20 09:27:05 +00:00
|
|
|
#include "porlay.hxx"
|
2000-09-27 10:53:31 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
class OutputDevice;
|
|
|
|
class SwFont;
|
|
|
|
class SwpHints;
|
2015-05-20 13:05:49 +02:00
|
|
|
class SwTextAttr;
|
2000-09-18 23:08:29 +00:00
|
|
|
class SwAttrSet;
|
2015-05-20 13:05:49 +02:00
|
|
|
class SwTextNode;
|
2000-09-18 23:08:29 +00:00
|
|
|
class SwRedlineItr;
|
2013-10-26 19:50:13 +02:00
|
|
|
class SwViewShell;
|
2015-05-20 13:05:49 +02:00
|
|
|
class SwTextFrm;
|
2001-11-19 11:13:07 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
class SwAttrIter
|
|
|
|
{
|
2000-12-11 10:05:15 +00:00
|
|
|
friend class SwFontSave;
|
2000-09-18 23:08:29 +00:00
|
|
|
protected:
|
2001-03-05 11:54:15 +00:00
|
|
|
|
|
|
|
SwAttrHandler aAttrHandler;
|
2013-10-26 19:50:13 +02:00
|
|
|
SwViewShell *pShell;
|
2000-09-18 23:08:29 +00:00
|
|
|
SwFont *pFnt;
|
|
|
|
SwpHints *pHints;
|
2012-03-28 17:24:08 +02:00
|
|
|
const SwAttrSet* pAttrSet; // The char attribute set
|
2001-02-20 09:27:05 +00:00
|
|
|
SwScriptInfo* pScriptInfo;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
private:
|
2015-03-20 11:58:25 +00:00
|
|
|
VclPtr<OutputDevice> pLastOut;
|
2014-09-01 23:31:22 +02:00
|
|
|
short nChgCnt;
|
2000-09-18 23:08:29 +00:00
|
|
|
SwRedlineItr *pRedln;
|
2014-07-20 17:39:59 +02:00
|
|
|
size_t nStartIndex;
|
|
|
|
size_t nEndIndex;
|
|
|
|
sal_Int32 nPos;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt8 nPropFont;
|
2001-02-20 09:27:05 +00:00
|
|
|
const void* aMagicNo[ SW_SCRIPTS ];
|
2014-07-22 17:14:17 +02:00
|
|
|
sal_uInt16 aFntIdx[ SW_SCRIPTS ];
|
2015-05-20 13:05:49 +02:00
|
|
|
const SwTextNode* m_pTextNode;
|
2013-08-06 10:52:38 +02:00
|
|
|
|
2014-01-14 16:50:42 +00:00
|
|
|
void SeekFwd( const sal_Int32 nPos );
|
|
|
|
void SetFnt( SwFont* pNew ) { pFnt = pNew; }
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
protected:
|
2015-05-20 13:05:49 +02:00
|
|
|
void Chg( SwTextAttr *pHt );
|
|
|
|
void Rst( SwTextAttr *pHt );
|
|
|
|
void CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf, SwTextFrm* pFrm = 0 );
|
2015-05-27 10:53:55 +01:00
|
|
|
explicit SwAttrIter(SwTextNode* pTextNode)
|
2014-01-25 21:56:22 -06:00
|
|
|
: pShell(0)
|
|
|
|
, pFnt(0)
|
|
|
|
, pHints(0)
|
|
|
|
, pAttrSet(0)
|
|
|
|
, pScriptInfo(0)
|
|
|
|
, pLastOut(0)
|
|
|
|
, nChgCnt(0)
|
|
|
|
, pRedln(0)
|
|
|
|
, nStartIndex(0)
|
|
|
|
, nEndIndex(0)
|
|
|
|
, nPos(0)
|
|
|
|
, nPropFont(0)
|
2015-05-20 13:05:49 +02:00
|
|
|
, m_pTextNode(pTextNode)
|
2013-08-16 13:01:37 +02:00
|
|
|
{
|
2011-02-19 18:20:26 +01:00
|
|
|
aMagicNo[SW_LATIN] = aMagicNo[SW_CJK] = aMagicNo[SW_CTL] = NULL;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
public:
|
2012-03-28 17:24:08 +02:00
|
|
|
// Constructor, destructor
|
2015-05-20 13:05:49 +02:00
|
|
|
SwAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf )
|
|
|
|
: pShell(0), pFnt(0), pHints(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0),nPropFont(0), m_pTextNode(&rTextNode)
|
|
|
|
{ CtorInitAttrIter( rTextNode, rScrInf ); }
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
virtual ~SwAttrIter();
|
|
|
|
|
2014-01-14 16:50:42 +00:00
|
|
|
SwRedlineItr *GetRedln() { return pRedln; }
|
2012-03-28 17:24:08 +02:00
|
|
|
// The parameter returns the position of the next change before or at the
|
|
|
|
// char position.
|
2014-01-14 16:50:42 +00:00
|
|
|
sal_Int32 GetNextAttr( ) const;
|
2013-07-28 12:44:52 +02:00
|
|
|
/// Enables the attributes used at char pos nPos in the logical font
|
2014-02-07 00:43:21 +01:00
|
|
|
bool Seek( const sal_Int32 nPos );
|
2012-03-28 17:24:08 +02:00
|
|
|
// Creates the font at the specified position via Seek() and checks
|
|
|
|
// if it's a symbol font.
|
2014-02-07 00:43:21 +01:00
|
|
|
bool IsSymbol( const sal_Int32 nPos );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2014-02-07 00:43:21 +01:00
|
|
|
/** Executes ChgPhysFnt if Seek() returns true
|
2013-07-28 12:44:52 +02:00
|
|
|
* and change font to merge character border with neighbours.
|
|
|
|
**/
|
2014-02-07 00:43:21 +01:00
|
|
|
bool SeekAndChgAttrIter( const sal_Int32 nPos, OutputDevice* pOut );
|
|
|
|
bool SeekStartAndChgAttrIter( OutputDevice* pOut, const bool bParaFont = false );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-03-28 17:24:08 +02:00
|
|
|
// Do we have an attribute change at all?
|
2014-02-07 00:43:21 +01:00
|
|
|
bool HasHints() const { return 0 != pHints; }
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-03-28 17:24:08 +02:00
|
|
|
// Returns the attribute for a position
|
2015-05-20 13:05:49 +02:00
|
|
|
SwTextAttr *GetAttr( const sal_Int32 nPos ) const;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2014-01-14 16:50:42 +00:00
|
|
|
const SwAttrSet* GetAttrSet() const { return pAttrSet; }
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2014-01-14 16:50:42 +00:00
|
|
|
const SwpHints *GetHints() const { return pHints; }
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2014-01-14 16:50:42 +00:00
|
|
|
SwFont *GetFnt() { return pFnt; }
|
|
|
|
const SwFont *GetFnt() const { return pFnt; }
|
2000-12-11 10:05:15 +00:00
|
|
|
|
2014-01-14 16:50:42 +00:00
|
|
|
sal_uInt8 GetPropFont() const { return nPropFont; }
|
|
|
|
void SetPropFont( const sal_uInt8 nNew ) { nPropFont = nNew; }
|
2001-03-06 15:08:39 +00:00
|
|
|
|
2014-01-14 16:50:42 +00:00
|
|
|
SwAttrHandler& GetAttrHandler() { return aAttrHandler; }
|
2000-09-18 23:08:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|