Warning, file /office/calligra/braindump/src/Section.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *  Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation;
0007  * either version 2, or (at your option) any later version of the License.
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  * Lesser General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Lesser General Public License
0015  * along with this library; see the file COPYING.  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 "Section.h"
0021 
0022 #include "SectionContainer.h"
0023 #include "LayoutFactoryRegistry.h"
0024 #include "Layout.h"
0025 
0026 Section::Section(RootSection* _rootSection) : SectionGroup(0), m_layout(LayoutFactoryRegistry::instance()->createLayout("freelayout")), m_sectionContainer(new SectionContainer(this, _rootSection))
0027 {
0028 }
0029 
0030 Section::Section(const Section& _rhs) : SectionGroup(_rhs), m_layout(LayoutFactoryRegistry::instance()->createLayout(_rhs.m_layout->id())), m_sectionContainer(new SectionContainer(*_rhs.m_sectionContainer, this))
0031 {
0032     setName(_rhs.name());
0033 }
0034 
0035 Section::~Section()
0036 {
0037     delete m_sectionContainer;
0038 }
0039 
0040 SectionContainer* Section::sectionContainer()
0041 {
0042     return m_sectionContainer;
0043 }
0044 
0045 const QString& Section::name() const
0046 {
0047     return m_name;
0048 }
0049 
0050 void Section::setName(const QString& _name)
0051 {
0052     m_name = _name;
0053 }
0054 
0055 Layout* Section::layout()
0056 {
0057     return m_layout;
0058 }
0059 
0060 void Section::setLayout(Layout* layout)
0061 {
0062     layout->replaceLayout(m_layout);
0063     delete m_layout;
0064     m_layout = layout;
0065 }