remove assert looking for new compatibilityMode DOCX
[LibreOffice.git] / lotuswordpro / inc / xfilter / xflinenumberconfig.hxx
blob1984b0b37faf9fbf250d07b134deaee9b946cd77
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
10 * Sun Microsystems Inc., October, 2000
12 * GNU Lesser General Public License Version 2.1
13 * =============================================
14 * Copyright 2000 by Sun Microsystems, Inc.
15 * 901 San Antonio Road, Palo Alto, CA 94303, USA
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License version 2.1, as published by the Free Software Foundation.
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
32 * Sun Industry Standards Source License Version 1.1
33 * =================================================
34 * The contents of this file are subject to the Sun Industry Standards
35 * Source License Version 1.1 (the "License"); You may not use this file
36 * except in compliance with the License. You may obtain a copy of the
37 * License at http://www.openoffice.org/license.html.
39 * Software provided under this License is provided on an "AS IS" basis,
40 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 * See the License for the specific provisions governing your rights and
44 * obligations concerning the Software.
46 * The Initial Developer of the Original Code is: IBM Corporation
48 * Copyright: 2008 by IBM Corporation
50 * All Rights Reserved.
52 * Contributor(s): _______________________________________
55 ************************************************************************/
56 /*************************************************************************
57 * @file
58 * Line numbering config for the full document.
59 ************************************************************************/
60 #ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLINENUMBERCONFIG_HXX
61 #define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFLINENUMBERCONFIG_HXX
63 #include <xfilter/ixfattrlist.hxx>
64 #include <xfilter/xfstyle.hxx>
66 class XFLineNumberConfig : public XFStyle
68 public:
69 XFLineNumberConfig();
71 public:
72 void SetNumberOffset(double offset);
74 void SetNumberPosition(enumXFLineNumberPos pos);
76 void SetNumberIncrement(sal_Int32 increment);
78 void SetRestartOnPage(bool restart = true);
80 void SetCountEmptyLines(bool empty = true);
82 virtual void ToXml(IXFStream *pStrm) override;
84 private:
85 enumXFLineNumberPos m_ePosition;
86 double m_fOffset;
87 sal_Int32 m_nIncrement;
88 static const sal_Int32 m_nSepIncrement = 3;
89 OUString m_strSeparator;
90 OUString m_strNumFmt;
91 OUString m_strTextStyle;
92 bool m_bRestartOnPage;
93 bool m_bCountEmptyLines;
96 inline XFLineNumberConfig::XFLineNumberConfig()
97 : m_ePosition(enumXFLineNumberLeft)
98 , m_fOffset(0)
99 , m_nIncrement(5)
100 , m_bRestartOnPage(false)
101 , m_bCountEmptyLines(true)
104 inline void XFLineNumberConfig::SetNumberOffset(double offset)
106 m_fOffset = offset;
109 inline void XFLineNumberConfig::SetNumberPosition(enumXFLineNumberPos position)
111 m_ePosition = position;
114 inline void XFLineNumberConfig::SetNumberIncrement(sal_Int32 increment)
116 m_nIncrement = increment;
119 inline void XFLineNumberConfig::SetRestartOnPage(bool restart)
121 m_bRestartOnPage = restart;
124 inline void XFLineNumberConfig::SetCountEmptyLines(bool empty)
126 m_bCountEmptyLines = empty;
129 inline void XFLineNumberConfig::ToXml(IXFStream *pStrm)
131 IXFAttrList *pAttrList = pStrm->GetAttrList();
133 if( !m_strTextStyle.isEmpty() )
134 pAttrList->AddAttribute( u"text:style-name"_ustr, m_strTextStyle );
135 pAttrList->AddAttribute( u"text:offset"_ustr, OUString::number(m_fOffset) + "cm" );
136 pAttrList->AddAttribute( u"style:num-format"_ustr, m_strNumFmt );
137 //position:
138 if( m_ePosition == enumXFLineNumberLeft )
139 pAttrList->AddAttribute( u"text:number-position"_ustr, u"left"_ustr );
140 else if( m_ePosition == enumXFLineNumberRight )
141 pAttrList->AddAttribute( u"text:number-position"_ustr, u"right"_ustr );
142 else if( m_ePosition == enumXFLineNumberInner )
143 pAttrList->AddAttribute( u"text:number-position"_ustr, u"inner"_ustr );
144 else if( m_ePosition == enumXFLineNumberOuter )
145 pAttrList->AddAttribute( u"text:number-position"_ustr, u"outer"_ustr );
147 pAttrList->AddAttribute( u"text:increment"_ustr, OUString::number(m_nIncrement) );
149 if( m_bRestartOnPage )
150 pAttrList->AddAttribute( u"text:restart-on-page"_ustr, u"true"_ustr );
151 else
152 pAttrList->AddAttribute( u"text:restart-on-page"_ustr, u"false"_ustr );
154 if( m_bCountEmptyLines )
155 pAttrList->AddAttribute( u"text:count-empty-lines"_ustr, u"true"_ustr );
156 else
157 pAttrList->AddAttribute( u"text:count-empty-lines"_ustr, u"false"_ustr );
159 pAttrList->AddAttribute( u"text:count-in-floating-frames"_ustr, u"false"_ustr );
161 pStrm->StartElement( u"text:linenumbering-configuration"_ustr );
163 pAttrList->Clear();
164 pAttrList->AddAttribute( u"text:increment"_ustr, OUString::number(m_nSepIncrement) );
165 pStrm->StartElement( u"text:linenumbering-separator"_ustr );
166 pStrm->Characters(m_strSeparator);
167 pStrm->EndElement( u"text:linenumbering-separator"_ustr );
169 pStrm->EndElement( u"text:linenumbering-configuration"_ustr );
172 #endif
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */