merge the formfield patch from ooo-build
[ooovba.git] / writerfilter / source / dmapper / NumberingManager.hxx
blob0f93c27bad51e94bb75f4f67b081fd6c61d19f36
1 #ifndef INCLUDED_NUMBERINGMANAGER_HXX
2 #define INCLUDED_NUMBERINGMANAGER_HXX
4 #include "PropertyMap.hxx"
6 #include <WriterFilterDllApi.hxx>
7 #include <dmapper/DomainMapper.hxx>
8 #include <resourcemodel/WW8ResourceModel.hxx>
10 #include <com/sun/star/container/XIndexReplace.hpp>
12 namespace writerfilter {
13 namespace dmapper {
15 class DomainMapper;
16 class StyleSheetEntry;
19 /** Class representing the numbering level properties.
21 class ListLevel : public PropertyMap
23 sal_Int32 m_nIStartAt; //LN_ISTARTAT
24 sal_Int32 m_nNFC; //LN_NFC
25 sal_Int32 m_nJC; //LN_JC
26 sal_Int32 m_nFLegal; //LN_FLEGAL
27 sal_Int32 m_nFNoRestart; //LN_FNORESTART
28 sal_Int32 m_nFPrev; //LN_FPREV
29 sal_Int32 m_nFPrevSpace; //LN_FPREVSPACE
30 sal_Int32 m_nFWord6; //LN_FWORD6
31 ::rtl::OUString m_sRGBXchNums; //LN_RGBXCHNUMS
32 sal_Int32 m_nXChFollow; //LN_IXCHFOLLOW
33 ::rtl::OUString m_sBulletChar;
34 sal_Int32 m_nTabstop;
35 boost::shared_ptr< StyleSheetEntry > m_pParaStyle;
37 public:
39 typedef boost::shared_ptr< ListLevel > Pointer;
41 ListLevel() :
42 m_nIStartAt(-1)
43 ,m_nNFC(-1)
44 ,m_nJC(-1)
45 ,m_nFLegal(-1)
46 ,m_nFNoRestart(-1)
47 ,m_nFPrev(-1)
48 ,m_nFPrevSpace(-1)
49 ,m_nFWord6(-1)
50 ,m_nXChFollow(-1)
51 ,m_nTabstop( 0 )
54 ~ListLevel( ){ }
56 // Setters for the import
57 void SetValue( Id nId, sal_Int32 nValue );
58 void SetBulletChar( rtl::OUString sValue ) { m_sBulletChar = sValue; };
59 void SetParaStyle( boost::shared_ptr< StyleSheetEntry > pStyle )
61 m_pParaStyle = pStyle;
63 void AddRGBXchNums( rtl::OUString sValue ) { m_sRGBXchNums += sValue; };
65 // Getters
66 rtl::OUString GetBulletChar( ) { return m_sBulletChar; };
67 boost::shared_ptr< StyleSheetEntry > GetParaStyle( ) { return m_pParaStyle; };
69 // UNO mapping functions
71 // rPrefix and rSuffix are out parameters
72 static sal_Int16 GetParentNumbering( rtl::OUString sText, sal_Int16 nLevel,
73 rtl::OUString& rPrefix, rtl::OUString& rSuffix );
75 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
76 GetProperties( );
78 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue>
79 GetCharStyleProperties( );
80 private:
82 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
83 GetLevelProperties( );
85 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
86 GetParaProperties( );
89 class AbstractListDef
91 private:
92 sal_Int32 m_nTPLC; //LN_TPLC
93 ::rtl::OUString m_sRGISTD; //LN_RGISTD
94 sal_Int32 m_nSimpleList; //LN_FSIMPLELIST
95 sal_Int32 m_nRestart; //LN_FRESTARTHDN
96 sal_Int32 m_nUnsigned; //LN_UNSIGNED26_2
98 // The ID member reflects either the abstractNumId or the numId
99 // depending on the use of the class
100 sal_Int32 m_nId;
102 // Properties of each level. This can also reflect the overridden
103 // levels of a numbering.
104 ::std::vector< ListLevel::Pointer > m_aLevels;
106 // Only used during the numberings import
107 ListLevel::Pointer m_pCurrentLevel;
109 public:
110 typedef boost::shared_ptr< AbstractListDef > Pointer;
112 AbstractListDef( );
113 ~AbstractListDef( );
115 // Setters using during the import
116 void SetId( sal_Int32 nId ) { m_nId = nId; };
117 void SetValue( sal_uInt32 nSprmId, sal_Int32 nValue );
118 void AddRGISTD( rtl::OUString sValue ) { m_sRGISTD += sValue; };
120 // Accessors
121 sal_Int32 GetId( ) { return m_nId; };
123 sal_Int16 Size( ) { return sal_Int16( m_aLevels.size( ) ); };
124 ListLevel::Pointer GetLevel( sal_uInt16 nLvl );
125 void AddLevel( );
127 ListLevel::Pointer GetCurrentLevel( ) { return m_pCurrentLevel; };
129 virtual com::sun::star::uno::Sequence<
130 com::sun::star::uno::Sequence<
131 com::sun::star::beans::PropertyValue > > GetPropertyValues( );
134 class ListDef : public AbstractListDef
136 private:
137 // Pointer to the abstract numbering
138 AbstractListDef::Pointer m_pAbstractDef;
140 // Cache for the UNO numbering rules
141 uno::Reference< container::XIndexReplace > m_xNumRules;
143 public:
144 typedef boost::shared_ptr< ListDef > Pointer;
146 ListDef( );
147 ~ListDef( );
149 // Accessors
150 void SetAbstractDefinition( AbstractListDef::Pointer pAbstract ) { m_pAbstractDef = pAbstract; };
151 AbstractListDef::Pointer GetAbstractDefinition( ) { return m_pAbstractDef; };
153 // Mapping functions
154 static rtl::OUString GetStyleName( sal_Int32 nId );
156 com::sun::star::uno::Sequence<
157 com::sun::star::uno::Sequence<
158 com::sun::star::beans::PropertyValue > > GetPropertyValues( );
160 void CreateNumberingRules(
161 DomainMapper& rDMapper,
162 com::sun::star::uno::Reference<
163 com::sun::star::lang::XMultiServiceFactory> xFactory );
165 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace >
166 GetNumberingRules( ) { return m_xNumRules; };
170 /** This class provides access to the defined numbering styles.
172 class WRITERFILTER_DLLPRIVATE ListsManager :
173 public Properties,
174 public Table
176 private:
178 DomainMapper& m_rDMapper;
179 com::sun::star::uno::Reference<
180 com::sun::star::lang::XMultiServiceFactory > m_xFactory;
182 // The numbering entries
183 std::vector< AbstractListDef::Pointer > m_aAbstractLists;
184 std::vector< ListDef::Pointer > m_aLists;
187 // These members are used for import only
188 AbstractListDef::Pointer m_pCurrentDefinition;
189 bool m_bIsLFOImport;
191 public:
193 ListsManager(
194 DomainMapper& rDMapper,
195 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory);
196 virtual ~ListsManager();
198 typedef boost::shared_ptr< ListsManager > Pointer;
200 // Properties
201 virtual void attribute( Id nName, Value & rVal );
202 virtual void sprm(Sprm & sprm);
204 // Table
205 virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
207 // Config methods
208 void SetLFOImport( bool bLFOImport ) { m_bIsLFOImport = bLFOImport; };
210 // Numberings accessors
211 AbstractListDef::Pointer GetCurrentDef( ) { return m_pCurrentDefinition; };
213 sal_uInt32 Size() const
214 { return sal_uInt32( m_aLists.size( ) ); };
215 ListDef::Pointer GetList( sal_Int32 nId );
217 // Mapping methods
218 void CreateNumberingRules( );
223 #endif