android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / text / itratr.hxx
blobeb15400cf5d83542a37f1f65ca41867763e3bcfa
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include <o3tl/deleter.hxx>
22 #include "atrhndl.hxx"
23 #include <swfont.hxx>
25 namespace sw { struct MergedPara; }
26 class SwTextAttr;
27 class SwTextNode;
28 class SwRedlineItr;
29 class SwViewShell;
30 class SwTextFrame;
32 class SwAttrIter
34 friend class SwFontSave;
35 protected:
37 SwAttrHandler m_aAttrHandler;
38 SwViewShell *m_pViewShell;
39 SwFont* m_pFont;
40 SwScriptInfo* m_pScriptInfo;
42 private:
43 VclPtr<OutputDevice> m_pLastOut;
44 /// count currently open hints, redlines, ext-input
45 short m_nChgCnt;
46 std::unique_ptr<SwRedlineItr, o3tl::default_delete<SwRedlineItr>> m_pRedline;
47 /// current iteration index in HintStarts
48 size_t m_nStartIndex;
49 /// current iteration index in HintEnds
50 size_t m_nEndIndex;
51 /// current iteration index in text node
52 sal_Int32 m_nPosition;
53 sal_uInt8 m_nPropFont;
54 o3tl::enumarray<SwFontScript, const void*> m_aFontCacheIds;
55 o3tl::enumarray<SwFontScript, sal_uInt16> m_aFontIdx;
56 /// input: the current text node
57 const SwTextNode* m_pTextNode;
58 sw::MergedPara const* m_pMergedPara;
60 void SeekFwd(sal_Int32 nOldPos, sal_Int32 nNewPos);
61 void SetFnt( SwFont* pNew ) { m_pFont = pNew; }
62 void InitFontAndAttrHandler(
63 SwTextNode const& rPropsNode, SwTextNode const& rTextNode,
64 std::u16string_view aText, bool const* pbVertLayout,
65 bool const* pbVertLayoutLRBT);
67 protected:
68 void Chg( SwTextAttr const *pHt );
69 void Rst( SwTextAttr const *pHt );
70 void CtorInitAttrIter(SwTextNode& rTextNode, SwScriptInfo& rScrInf, SwTextFrame const* pFrame = nullptr);
71 explicit SwAttrIter(SwTextNode const * pTextNode);
73 public:
74 /// All subclasses of this always have a SwTextFrame passed to the
75 /// constructor, but SwAttrIter itself may be created without a
76 /// SwTextFrame in certain special cases via this ctor here
77 SwAttrIter(SwTextNode& rTextNode, SwScriptInfo& rScrInf, SwTextFrame const*const pFrame = nullptr);
79 virtual ~SwAttrIter();
81 SwRedlineItr *GetRedln() { return m_pRedline.get(); }
82 // The parameter returns the position of the next change before or at the
83 // char position.
84 TextFrameIndex GetNextAttr() const;
85 /// Enables the attributes used at char pos nPos in the logical font
86 bool Seek(TextFrameIndex nPos);
87 // Creates the font at the specified position via Seek() and checks
88 // if it's a symbol font.
89 bool IsSymbol(TextFrameIndex nPos);
91 /** Executes ChgPhysFnt if Seek() returns true
92 * and change font to merge character border with neighbours.
93 **/
94 bool SeekAndChgAttrIter(TextFrameIndex nPos, OutputDevice* pOut);
95 bool SeekStartAndChgAttrIter( OutputDevice* pOut, const bool bParaFont );
97 // Do we possibly have nasty things like footnotes?
98 bool MaybeHasHints() const;
100 // Returns the attribute for a position
101 SwTextAttr *GetAttr(TextFrameIndex nPos) const;
103 SwFont *GetFnt() { return m_pFont; }
104 const SwFont *GetFnt() const { return m_pFont; }
106 sal_uInt8 GetPropFont() const { return m_nPropFont; }
107 void SetPropFont( const sal_uInt8 nNew ) { m_nPropFont = nNew; }
109 SwAttrHandler& GetAttrHandler() { return m_aAttrHandler; }
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */