Warning, file /office/calligra/libs/flake/KoTextShapeDataBase.cpp 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) 2006, 2009-2010 Thomas Zander <zander@kde.org>
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 #include "KoTextShapeDataBase.h"
0021 #include "KoTextShapeDataBase_p.h"
0022 
0023 KoTextShapeDataBasePrivate::KoTextShapeDataBasePrivate()
0024         : document(0)
0025         , textAlignment(Qt::AlignLeft | Qt::AlignTop)
0026         , resizeMethod(KoTextShapeDataBase::NoResize)
0027 {
0028 }
0029 
0030 KoTextShapeDataBasePrivate::~KoTextShapeDataBasePrivate()
0031 {
0032 }
0033 
0034 KoTextShapeDataBase::KoTextShapeDataBase(KoTextShapeDataBasePrivate &dd)
0035     : d_ptr(&dd)
0036 {
0037 }
0038 
0039 KoTextShapeDataBase::~KoTextShapeDataBase()
0040 {
0041     delete d_ptr;
0042 }
0043 
0044 QTextDocument *KoTextShapeDataBase::document() const
0045 {
0046     Q_D(const KoTextShapeDataBase);
0047     return d->document;
0048 }
0049 
0050 void KoTextShapeDataBase::setShapeMargins(const KoInsets &margins)
0051 {
0052     Q_D(KoTextShapeDataBase);
0053     d->margins = margins;
0054 }
0055 
0056 KoInsets KoTextShapeDataBase::shapeMargins() const
0057 {
0058     Q_D(const KoTextShapeDataBase);
0059     return d->margins;
0060 }
0061 
0062 void KoTextShapeDataBase::setVerticalAlignment(Qt::Alignment alignment)
0063 {
0064     Q_D(KoTextShapeDataBase);
0065     d->textAlignment = (d->textAlignment & Qt::AlignHorizontal_Mask)
0066         | (alignment & Qt::AlignVertical_Mask);
0067 }
0068 
0069 Qt::Alignment KoTextShapeDataBase::verticalAlignment() const
0070 {
0071     Q_D(const KoTextShapeDataBase);
0072     return d->textAlignment & Qt::AlignVertical_Mask;
0073 }
0074 
0075 void KoTextShapeDataBase::setResizeMethod(KoTextShapeDataBase::ResizeMethod method)
0076 {
0077     Q_D(KoTextShapeDataBase);
0078     if (d->resizeMethod == method)
0079         return;
0080     d->resizeMethod = method;
0081 }
0082 
0083 KoTextShapeDataBase::ResizeMethod KoTextShapeDataBase::resizeMethod() const
0084 {
0085     Q_D(const KoTextShapeDataBase);
0086     return d->resizeMethod;
0087 }