Warning, file /office/calligra/libs/textlayout/AnchorStrategy.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2011 Matus Hanzes <matus.hanzes@ixonos.com> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Library General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Library General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Library General Public License 0015 * along with this library; see the file COPYING.LIB. If not, write to 0016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef ANCHORSTRATEGY_H_ 0021 #define ANCHORSTRATEGY_H_ 0022 0023 #include "KoShapeAnchor.h" 0024 0025 #include <QRectF> 0026 0027 class KoTextShapeContainerModel; 0028 class KoTextLayoutRootArea; 0029 0030 0031 class AnchorStrategy : public KoShapeAnchor::PlacementStrategy 0032 { 0033 public: 0034 AnchorStrategy(KoShapeAnchor *anchor, KoTextLayoutRootArea *rootArea); 0035 ~AnchorStrategy() override; 0036 0037 /** 0038 * Moves the subject to it's right position. 0039 * 0040 * @return true if subject was moved to a new position (or it it couldn't be calculated yet) 0041 */ 0042 virtual bool moveSubject() = 0; 0043 0044 void detachFromModel() override; 0045 0046 /** 0047 * Reparent the anchored shape under the rootArea's container this AnchorStrategy acts for 0048 * 0049 * If needed changes the parent KoShapeContainerModel and KoShapeContainer of the anchored shape. 0050 * It is changed so the anchored shape is now under the rootArea 0051 */ 0052 void updateContainerModel() override; 0053 0054 /// get page rectangle coordinates to which this text anchor is anchored (needed for HPage) 0055 QRectF pageRect() const; 0056 0057 /// set page rectangle coordinates to which this text anchor is anchored (needed for HPage) 0058 void setPageRect(const QRectF &pageRect); 0059 0060 /// get content rectangle coordinates to which this text anchor is anchored (needed for 0061 /// HPageContent) 0062 QRectF pageContentRect() const; 0063 0064 /// set content rectangle coordinates to which this text anchor is anchored (needed for 0065 /// HPageContent) 0066 void setPageContentRect(const QRectF &marginRect); 0067 0068 /// get paragraph rectangle coordinates to which this text anchor is anchored (needed for 0069 /// HParagraphContent, HParagraphStartMargin, HParagraphEndMargin, VParagraph) 0070 QRectF paragraphRect() const; 0071 0072 /// set paragraph rectangle to which this text anchor is anchored (needed for HParagraphContent, 0073 /// HParagraphStartMargin, HParagraphEndMargin, VParagraph) 0074 void setParagraphRect(const QRectF ¶graphRect); 0075 0076 /// get paragraph rectangle coordinates to which this text anchor is anchored (needed for 0077 /// HParagraphContent, HParagraphStartMargin, HParagraphEndMargin) 0078 QRectF paragraphContentRect() const; 0079 0080 /// set paragraph rectangle to which this text anchor is anchored (needed for HParagraphContent, 0081 /// HParagraphStartMargin, HParagraphEndMargin) 0082 void setParagraphContentRect(const QRectF ¶graphContentRect); 0083 0084 /// get layout environment rectangle @see odf attribute style:flow-with-text 0085 QRectF layoutEnvironmentRect() const; 0086 0087 /// set layout environment rect @see odf attribute style:flow-with-text 0088 void setLayoutEnvironmentRect(const QRectF &layoutEnvironmentRect); 0089 0090 /// get number of page to which this text anchor is anchored (needed for HOutside, HInside, 0091 /// HFromInside) 0092 int pageNumber() const; 0093 0094 /// set number of page to which this text anchor is anchored (needed for HOutside, HInside, 0095 /// HFromInside) 0096 void setPageNumber(int pageNumber); 0097 0098 protected: 0099 KoShapeAnchor * const m_anchor; 0100 KoTextLayoutRootArea *m_rootArea; 0101 0102 private: 0103 KoTextShapeContainerModel *m_model; 0104 QRectF m_pageRect; 0105 QRectF m_pageContentRect; 0106 QRectF m_paragraphRect; 0107 QRectF m_paragraphContentRect; 0108 QRectF m_layoutEnvironmentRect; 0109 int m_pageNumber; 0110 }; 0111 0112 #endif /* ANCHORSTRATEGY_H_ */