fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / writerfilter / source / dmapper / NumberingManager.hxx
blobd04d0f96ed41583989ccfbb63180cc41d94b8d79
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 {
35 namespace dmapper {
37 class DomainMapper;
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;
58 sal_Int32 m_nTabstop;
59 boost::shared_ptr< StyleSheetEntry > m_pParaStyle;
60 bool m_outline;
62 public:
64 typedef boost::shared_ptr< ListLevel > Pointer;
66 ListLevel() :
67 m_nIStartAt(-1)
68 ,m_nNFC(-1)
69 ,m_nJC(-1)
70 ,m_nFLegal(-1)
71 ,m_nFNoRestart(-1)
72 ,m_nFPrev(-1)
73 ,m_nFPrevSpace(-1)
74 ,m_nFWord6(-1)
75 ,m_nXChFollow(SvxNumberFormat::LISTTAB)
76 ,m_nTabstop( 0 )
77 ,m_outline(false)
80 ~ListLevel( ){ }
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; };
91 // Getters
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 >
103 GetProperties( );
105 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue>
106 GetCharStyleProperties( );
107 private:
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.
116 class NumPicBullet
118 public:
119 typedef boost::shared_ptr<NumPicBullet> Pointer;
120 NumPicBullet();
121 virtual ~NumPicBullet();
123 void SetId(sal_Int32 nId);
124 sal_Int32 GetId();
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();
127 private:
128 sal_Int32 m_nId;
129 com::sun::star::uno::Reference<com::sun::star::drawing::XShape> m_xShape;
132 class AbstractListDef
134 private:
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
143 sal_Int32 m_nId;
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;
155 public:
156 typedef boost::shared_ptr< AbstractListDef > Pointer;
158 AbstractListDef( );
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; };
166 // Accessors
167 sal_Int32 GetId( ) { return m_nId; };
169 sal_Int16 Size( ) { return sal_Int16( m_aLevels.size( ) ); };
170 ListLevel::Pointer GetLevel( sal_uInt16 nLvl );
171 void AddLevel( );
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
185 private:
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;
192 public:
193 typedef boost::shared_ptr< ListDef > Pointer;
195 ListDef( );
196 virtual ~ListDef( );
198 // Accessors
199 void SetAbstractDefinition( AbstractListDef::Pointer pAbstract ) { m_pAbstractDef = pAbstract; };
200 AbstractListDef::Pointer GetAbstractDefinition( ) { return m_pAbstractDef; };
202 // Mapping functions
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.
221 class ListsManager :
222 public LoggedProperties,
223 public LoggedTable
225 private:
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;
240 bool m_bIsLFOImport;
242 AbstractListDef::Pointer GetAbstractList( sal_Int32 nId );
244 // Properties
245 virtual void lcl_attribute( Id nName, Value & rVal );
246 virtual void lcl_sprm(Sprm & sprm);
248 // Table
249 virtual void lcl_entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
251 public:
253 ListsManager(
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;
260 // Config methods
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 );
270 // Mapping methods
271 void CreateNumberingRules( );
276 #endif
278 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */