1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_NUMBERINGMANAGER_HXX
21 #define INCLUDED_NUMBERINGMANAGER_HXX
23 #include "PropertyMap.hxx"
25 #include <WriterFilterDllApi.hxx>
26 #include <dmapper/DomainMapper.hxx>
27 #include <resourcemodel/LoggedResources.hxx>
29 #include <editeng/numitem.hxx>
31 #include <com/sun/star/container/XIndexReplace.hpp>
32 #include <com/sun/star/graphic/XGraphic.hpp>
34 namespace writerfilter
{
38 class StyleSheetEntry
;
41 /** Class representing the numbering level properties.
43 class ListLevel
: public PropertyMap
45 sal_Int32 m_nIStartAt
; //LN_ISTARTAT
46 sal_Int32 m_nNFC
; //LN_NFC
47 sal_Int32 m_nJC
; //LN_JC
48 sal_Int32 m_nFLegal
; //LN_FLEGAL
49 sal_Int32 m_nFNoRestart
; //LN_FNORESTART
50 sal_Int32 m_nFPrev
; //LN_FPREV
51 sal_Int32 m_nFPrevSpace
; //LN_FPREVSPACE
52 sal_Int32 m_nFWord6
; //LN_FWORD6
53 OUString m_sRGBXchNums
; //LN_RGBXCHNUMS
54 sal_Int16 m_nXChFollow
; //LN_IXCHFOLLOW
55 OUString m_sBulletChar
;
56 OUString m_sGraphicURL
;
57 com::sun::star::uno::Reference
< com::sun::star::graphic::XGraphic
> m_sGraphicBitmap
;
59 boost::shared_ptr
< StyleSheetEntry
> m_pParaStyle
;
64 typedef boost::shared_ptr
< ListLevel
> Pointer
;
75 ,m_nXChFollow(SvxNumberFormat::LISTTAB
)
82 // Setters for the import
83 void SetValue( Id nId
, sal_Int32 nValue
);
84 void SetBulletChar( OUString sValue
) { m_sBulletChar
= sValue
; };
85 void SetGraphicURL( OUString sValue
) { m_sGraphicURL
= sValue
; };
86 void SetGraphicBitmap( com::sun::star::uno::Reference
< com::sun::star::graphic::XGraphic
> sValue
)
87 { m_sGraphicBitmap
= sValue
; }
88 void SetParaStyle( boost::shared_ptr
< StyleSheetEntry
> pStyle
);
89 void AddRGBXchNums( OUString sValue
) { m_sRGBXchNums
+= sValue
; };
92 OUString
GetBulletChar( ) { return m_sBulletChar
; };
93 boost::shared_ptr
< StyleSheetEntry
> GetParaStyle( ) { return m_pParaStyle
; };
94 bool isOutlineNumbering() const { return m_outline
; }
96 // UNO mapping functions
98 // rPrefix and rSuffix are out parameters
99 static sal_Int16
GetParentNumbering( OUString sText
, sal_Int16 nLevel
,
100 OUString
& rPrefix
, OUString
& rSuffix
);
102 com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>
105 com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>
106 GetCharStyleProperties( );
109 com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>
110 GetLevelProperties( );
112 void AddParaProperties( com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>* props
);
115 /// Represents a numbering picture bullet: an id and a graphic.
119 typedef boost::shared_ptr
<NumPicBullet
> Pointer
;
121 virtual ~NumPicBullet();
123 void SetId(sal_Int32 nId
);
125 void SetShape(com::sun::star::uno::Reference
<com::sun::star::drawing::XShape
> xShape
);
126 com::sun::star::uno::Reference
<com::sun::star::drawing::XShape
> GetShape();
129 com::sun::star::uno::Reference
<com::sun::star::drawing::XShape
> m_xShape
;
132 class AbstractListDef
135 sal_Int32 m_nTPLC
; //LN_TPLC
136 OUString m_sRGISTD
; //LN_RGISTD
137 sal_Int32 m_nSimpleList
; //LN_FSIMPLELIST
138 sal_Int32 m_nRestart
; //LN_FRESTARTHDN
139 sal_Int32 m_nUnsigned
; //LN_UNSIGNED26_2
141 // The ID member reflects either the abstractNumId or the numId
142 // depending on the use of the class
145 // Properties of each level. This can also reflect the overridden
146 // levels of a numbering.
147 ::std::vector
< ListLevel::Pointer
> m_aLevels
;
149 // Only used during the numberings import
150 ListLevel::Pointer m_pCurrentLevel
;
152 // The style name linked to.
153 ::rtl::OUString m_sNumStyleLink
;
156 typedef boost::shared_ptr
< AbstractListDef
> Pointer
;
159 virtual ~AbstractListDef( );
161 // Setters using during the import
162 void SetId( sal_Int32 nId
) { m_nId
= nId
; };
163 void SetValue( sal_uInt32 nSprmId
, sal_Int32 nValue
);
164 void AddRGISTD( OUString sValue
) { m_sRGISTD
+= sValue
; };
167 sal_Int32
GetId( ) { return m_nId
; };
169 sal_Int16
Size( ) { return sal_Int16( m_aLevels
.size( ) ); };
170 ListLevel::Pointer
GetLevel( sal_uInt16 nLvl
);
173 ListLevel::Pointer
GetCurrentLevel( ) { return m_pCurrentLevel
; };
175 virtual com::sun::star::uno::Sequence
<
176 com::sun::star::uno::Sequence
<
177 com::sun::star::beans::PropertyValue
> > GetPropertyValues( );
179 void SetNumStyleLink(rtl::OUString sValue
) { m_sNumStyleLink
= sValue
; };
180 ::rtl::OUString
GetNumStyleLink() { return m_sNumStyleLink
; };
183 class ListDef
: public AbstractListDef
186 // Pointer to the abstract numbering
187 AbstractListDef::Pointer m_pAbstractDef
;
189 // Cache for the UNO numbering rules
190 uno::Reference
< container::XIndexReplace
> m_xNumRules
;
193 typedef boost::shared_ptr
< ListDef
> Pointer
;
199 void SetAbstractDefinition( AbstractListDef::Pointer pAbstract
) { m_pAbstractDef
= pAbstract
; };
200 AbstractListDef::Pointer
GetAbstractDefinition( ) { return m_pAbstractDef
; };
203 static OUString
GetStyleName( sal_Int32 nId
);
205 com::sun::star::uno::Sequence
<
206 com::sun::star::uno::Sequence
<
207 com::sun::star::beans::PropertyValue
> > GetPropertyValues( );
209 void CreateNumberingRules(
210 DomainMapper
& rDMapper
,
211 com::sun::star::uno::Reference
<
212 com::sun::star::lang::XMultiServiceFactory
> xFactory
);
214 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexReplace
>
215 GetNumberingRules( ) { return m_xNumRules
; };
219 /** This class provides access to the defined numbering styles.
222 public LoggedProperties
,
227 DomainMapper
& m_rDMapper
;
228 com::sun::star::uno::Reference
<
229 com::sun::star::lang::XMultiServiceFactory
> m_xFactory
;
231 // The numbering entries
232 std::vector
< NumPicBullet::Pointer
> m_aNumPicBullets
;
233 std::vector
< AbstractListDef::Pointer
> m_aAbstractLists
;
234 std::vector
< ListDef::Pointer
> m_aLists
;
237 // These members are used for import only
238 AbstractListDef::Pointer m_pCurrentDefinition
;
239 NumPicBullet::Pointer m_pCurrentNumPicBullet
;
242 AbstractListDef::Pointer
GetAbstractList( sal_Int32 nId
);
245 virtual void lcl_attribute( Id nName
, Value
& rVal
);
246 virtual void lcl_sprm(Sprm
& sprm
);
249 virtual void lcl_entry(int pos
, writerfilter::Reference
<Properties
>::Pointer_t ref
);
254 DomainMapper
& rDMapper
,
255 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xFactory
);
256 virtual ~ListsManager();
258 typedef boost::shared_ptr
< ListsManager
> Pointer
;
261 void SetLFOImport( bool bLFOImport
) { m_bIsLFOImport
= bLFOImport
; };
263 // Numberings accessors
264 AbstractListDef::Pointer
GetCurrentDef( ) { return m_pCurrentDefinition
; };
266 sal_uInt32
Size() const
267 { return sal_uInt32( m_aLists
.size( ) ); };
268 ListDef::Pointer
GetList( sal_Int32 nId
);
271 void CreateNumberingRules( );
278 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */