LibreOffice Module lotuswordpro (master) 1
xflinenumberconfig.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*************************************************************************
3 *
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
6 *
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
9 *
10 * Sun Microsystems Inc., October, 2000
11 *
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
16 *
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.
20 *
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.
25 *
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
30 *
31 *
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.
38 *
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.
45 *
46 * The Initial Developer of the Original Code is: IBM Corporation
47 *
48 * Copyright: 2008 by IBM Corporation
49 *
50 * All Rights Reserved.
51 *
52 * Contributor(s): _______________________________________
53 *
54 *
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
62
64#include <xfilter/xfstyle.hxx>
65
67{
68public:
70
71public:
72 void SetNumberOffset(double offset);
73
75
76 void SetNumberIncrement(sal_Int32 increment);
77
78 void SetRestartOnPage(bool restart = true);
79
80 void SetCountEmptyLines(bool empty = true);
81
82 virtual void ToXml(IXFStream *pStrm) override;
83
84private:
86 double m_fOffset;
87 sal_Int32 m_nIncrement;
88 static const sal_Int32 m_nSepIncrement = 3;
90 OUString m_strNumFmt;
94};
95
98 , m_fOffset(0)
99 , m_nIncrement(5)
100 , m_bRestartOnPage(false)
101 , m_bCountEmptyLines(true)
102{}
103
104inline void XFLineNumberConfig::SetNumberOffset(double offset)
105{
106 m_fOffset = offset;
107}
108
110{
112}
113
114inline void XFLineNumberConfig::SetNumberIncrement(sal_Int32 increment)
115{
116 m_nIncrement = increment;
117}
118
120{
121 m_bRestartOnPage = restart;
122}
123
125{
126 m_bCountEmptyLines = empty;
127}
128
130{
131 IXFAttrList *pAttrList = pStrm->GetAttrList();
132
133 if( !m_strTextStyle.isEmpty() )
134 pAttrList->AddAttribute( "text:style-name", m_strTextStyle );
135 pAttrList->AddAttribute( "text:offset", OUString::number(m_fOffset) + "cm" );
136 pAttrList->AddAttribute( "style:num-format", m_strNumFmt );
137 //position:
139 pAttrList->AddAttribute( "text:number-position", "left" );
141 pAttrList->AddAttribute( "text:number-position", "right" );
143 pAttrList->AddAttribute( "text:number-position", "inner" );
145 pAttrList->AddAttribute( "text:number-position", "outer" );
146
147 pAttrList->AddAttribute( "text:increment", OUString::number(m_nIncrement) );
148
149 if( m_bRestartOnPage )
150 pAttrList->AddAttribute( "text:restart-on-page", "true" );
151 else
152 pAttrList->AddAttribute( "text:restart-on-page", "false" );
153
155 pAttrList->AddAttribute( "text:count-empty-lines", "true" );
156 else
157 pAttrList->AddAttribute( "text:count-empty-lines", "false" );
158
159 pAttrList->AddAttribute( "text:count-in-floating-frames", "false" );
160
161 pStrm->StartElement( "text:linenumbering-configuration" );
162
163 pAttrList->Clear();
164 pAttrList->AddAttribute( "text:increment", OUString::number(m_nSepIncrement) );
165 pStrm->StartElement( "text:linenumbering-separator" );
167 pStrm->EndElement( "text:linenumbering-separator" );
168
169 pStrm->EndElement( "text:linenumbering-configuration" );
170}
171
172#endif
173/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Attribute list interface for sax writer.
Definition: ixfattrlist.hxx:72
virtual void Clear()=0
@descr: Clear all the attributes in the attribute list.
virtual void AddAttribute(const OUString &name, const OUString &value)=0
@descr: Add an attribute to the attribute list.
Stream wrapper for sax writer.
Definition: ixfstream.hxx:72
virtual void Characters(const OUString &oustr)=0
@descr output text node.
virtual IXFAttrList * GetAttrList()=0
@descr return the Attribute list interface.
virtual void StartElement(const OUString &oustr)=0
@descr Wrap XDocumentHandler::startElement()
virtual void EndElement(const OUString &oustr)=0
@descr Wrap XDocumentHandler::endElement()
void SetNumberOffset(double offset)
virtual void ToXml(IXFStream *pStrm) override
static const sal_Int32 m_nSepIncrement
void SetNumberPosition(enumXFLineNumberPos pos)
enumXFLineNumberPos m_ePosition
void SetRestartOnPage(bool restart=true)
void SetNumberIncrement(sal_Int32 increment)
void SetCountEmptyLines(bool empty=true)
implements ixfstyle interface.
Definition: xfstyle.hxx:70
RubyPosition m_ePosition
def position(n=-1)
size_t pos
enumXFLineNumberPos
Definition: xfdefs.hxx:426
@ enumXFLineNumberRight
Definition: xfdefs.hxx:428
@ enumXFLineNumberOuter
Definition: xfdefs.hxx:430
@ enumXFLineNumberInner
Definition: xfdefs.hxx:429
@ enumXFLineNumberLeft
Definition: xfdefs.hxx:427