Avoid potential negative array index access to cached text.
[LibreOffice.git] / writerfilter / source / dmapper / PropertyMap.hxx
blob711ef47195a06ecfc54bf17efee7dadf4fbaf654
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 .
19 #pragma once
21 #include <rtl/ustring.hxx>
22 #include <tools/ref.hxx>
23 #include <com/sun/star/uno/Sequence.hxx>
24 #include <com/sun/star/text/XText.hpp>
25 #include <com/sun/star/beans/PropertyValue.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/table/BorderLine2.hpp>
28 #include <com/sun/star/text/WrapTextMode.hpp>
29 #include <com/sun/star/uno/Any.h>
30 #include <com/sun/star/drawing/XShape.hpp>
31 #include "PropertyIds.hxx"
32 #include <memory>
33 #include <optional>
34 #include <map>
35 #include <utility>
36 #include <vector>
37 #include <set>
38 #include <deque>
40 namespace com::sun::star {
41 namespace beans {
42 struct PropertyValue;
44 namespace container {
45 class XNameContainer;
47 namespace lang {
48 class XMultiServiceFactory;
50 namespace text {
51 class XTextRange;
52 class XTextColumns;
53 class XFootnote;
55 namespace table {
56 struct BorderLine2;
57 struct ShadowFormat;
61 namespace writerfilter::dmapper {
63 class DomainMapper_Impl;
64 struct AnchoredObjectInfo;
66 enum BorderPosition
68 BORDER_LEFT,
69 BORDER_RIGHT,
70 BORDER_TOP,
71 BORDER_BOTTOM
74 enum GrabBagType
76 NO_GRAB_BAG,
77 ROW_GRAB_BAG,
78 CELL_GRAB_BAG,
79 PARA_GRAB_BAG,
80 CHAR_GRAB_BAG
83 struct RedlineParams : public SvRefBase
85 OUString m_sAuthor;
86 OUString m_sDate;
87 sal_Int32 m_nToken;
89 // This can hold properties of runs that had formatted 'track changes' properties
90 css::uno::Sequence< css::beans::PropertyValue > m_aRevertProperties;
93 typedef tools::SvRef< RedlineParams > RedlineParamsPtr;
95 class PropValue
97 private:
98 css::uno::Any m_aValue;
99 GrabBagType m_GrabBagType;
100 bool m_bIsDocDefault;
102 public:
103 PropValue( css::uno::Any aValue, GrabBagType i_GrabBagType, bool bDocDefault )
104 : m_aValue(std::move( aValue ))
105 , m_GrabBagType( i_GrabBagType )
106 , m_bIsDocDefault( bDocDefault )
110 PropValue( css::uno::Any aValue, GrabBagType i_GrabBagType )
111 : m_aValue(std::move( aValue ))
112 , m_GrabBagType( i_GrabBagType )
113 , m_bIsDocDefault( false )
117 PropValue()
118 : m_aValue()
119 , m_GrabBagType( NO_GRAB_BAG )
120 , m_bIsDocDefault( false )
124 const css::uno::Any& getValue() const { return m_aValue; }
126 GrabBagType getGrabBagType() const { return m_GrabBagType; }
128 bool getIsDocDefault() const { return m_bIsDocDefault; }
131 class PropertyMap;
132 typedef tools::SvRef< PropertyMap > PropertyMapPtr;
134 class PropertyMap : public SvRefBase
136 private:
137 // Cache the property values for the GetPropertyValues() call(s).
138 std::vector< css::beans::PropertyValue > m_aValues;
140 // marks context as footnote context - ::text( ) events contain either the footnote character or can be ignored
141 // depending on sprmCSymbol
142 css::uno::Reference< css::text::XFootnote > m_xFootnote;
143 OUString m_sFootnoteCharStyleName;
144 std::map< PropertyIds, PropValue > m_vMap;
145 std::vector< RedlineParamsPtr > m_aRedlines;
147 public:
148 typedef std::pair< PropertyIds, css::uno::Any > Property;
150 PropertyMap() {}
152 // Sequence: Grab Bags: The CHAR_GRAB_BAG has Name "CharInteropGrabBag" and the PARA_GRAB_BAG has Name "ParaInteropGrabBag"
153 // the contained properties are their Value.
154 css::uno::Sequence< css::beans::PropertyValue > GetPropertyValues( bool bCharGrabBag = true );
156 std::vector< PropertyIds > GetPropertyIds();
158 // Add property, optionally overwriting existing attributes
159 void Insert( PropertyIds eId, const css::uno::Any& rAny, bool bOverwrite = true, GrabBagType i_GrabBagType = NO_GRAB_BAG, bool bDocDefault = false );
161 // Remove a named property from *this, does nothing if the property id has not been set
162 void Erase( PropertyIds eId);
164 // Imports properties from pMap (bOverwrite==false means m_bIsDocDefault=true setting)
165 void InsertProps( const PropertyMapPtr& rMap, const bool bOverwrite = true );
167 // Returns a copy of the property if it exists, .first is its PropertyIds and .second is its Value (type css::uno::Any)
168 std::optional< Property > getProperty( PropertyIds eId ) const;
170 // Has the property named been set (via Insert)?
171 bool isSet( PropertyIds eId ) const;
172 bool isDocDefault( PropertyIds eId ) const;
174 const css::uno::Reference< css::text::XFootnote >& GetFootnote() const { return m_xFootnote; }
175 const OUString& GetFootnoteStyle() const { return m_sFootnoteCharStyleName; }
177 void SetFootnote(const css::uno::Reference< css::text::XFootnote >& xFootnote, const OUString& sStyleName)
179 m_xFootnote = xFootnote;
180 m_sFootnoteCharStyleName = sStyleName;
183 virtual void insertTableProperties( const PropertyMap*, const bool bOverwrite = true );
185 const std::vector< RedlineParamsPtr >& Redlines() const { return m_aRedlines; }
187 std::vector< RedlineParamsPtr >& Redlines() { return m_aRedlines; }
189 void printProperties();
191 #ifdef DBG_UTIL
192 void dumpXml() const;
193 #endif
195 static css::table::ShadowFormat getShadowFromBorder( const css::table::BorderLine2& rBorder );
197 protected:
198 void Invalidate()
200 if ( m_aValues.size() )
201 m_aValues.clear();
205 /** Type of an page, which has an effect which headers and/or footers will be used. */
206 enum class PageType
208 FIRST,
209 LEFT,
210 RIGHT
213 /** Which page part we are referring to.
214 * This is mainly introduced to avoid having cryptic bools as input parameter.*/
215 enum class PagePartType
217 Header,
218 Footer
221 /** A page break type to force what the next page type will be.
222 * For example - the next page is forced to be even (left) or odd (right). */
223 enum class PageBreakType
225 Even,
226 Odd,
227 Both
230 class SectionPropertyMap : public PropertyMap
232 public:
233 enum class BorderApply
235 ToAllInSection = 0,
236 ToFirstPageInSection = 1,
237 ToAllButFirstInSection = 2
239 enum class BorderOffsetFrom
241 Text = 0,
242 Edge = 1,
244 private:
245 #ifdef DBG_UTIL
246 sal_Int32 m_nDebugSectionNumber;
247 #endif
249 // 'temporarily' the section page settings are imported as page styles
250 // empty strings mark page settings as not yet imported
252 bool m_bIsFirstSection;
253 css::uno::Reference< css::text::XTextRange > m_xStartingRange;
255 OUString m_sPageStyleName;
256 css::uno::Reference<css::beans::XPropertySet> m_aPageStyle;
258 std::optional< css::table::BorderLine2 > m_oBorderLines[4];
259 sal_Int32 m_nBorderDistances[4];
260 BorderApply m_eBorderApply;
261 BorderOffsetFrom m_eBorderOffsetFrom;
262 bool m_bBorderShadows[4];
264 bool m_bTitlePage;
265 sal_Int16 m_nColumnCount;
266 sal_Int32 m_nColumnDistance;
267 css::uno::Reference< css::beans::XPropertySet > m_xColumnContainer;
268 std::vector< sal_Int32 > m_aColWidth;
269 std::vector< sal_Int32 > m_aColDistance;
271 bool m_bSeparatorLineIsOn;
272 bool m_bEvenlySpaced;
274 sal_Int32 m_nPageNumber;
275 // Page number type is a value from css::style::NumberingType.
276 sal_Int16 m_nPageNumberType;
277 sal_Int32 m_nBreakType;
279 sal_Int32 m_nLeftMargin;
280 sal_Int32 m_nRightMargin;
281 sal_Int32 m_nGutterMargin;
282 sal_Int32 m_nTopMargin;
283 sal_Int32 m_nBottomMargin;
284 sal_Int32 m_nHeaderTop;
285 sal_Int32 m_nHeaderBottom;
287 sal_Int32 m_nGridType;
288 sal_Int32 m_nGridLinePitch;
289 sal_Int32 m_nDxtCharSpace;
290 bool m_bGridSnapToChars;
292 // line numbering
293 sal_Int32 m_nLnnMod;
294 sal_uInt32 m_nLnc;
295 sal_Int32 m_ndxaLnn;
296 sal_Int32 m_nLnnMin;
298 sal_Int32 m_nPaperSourceFirst;
299 sal_Int32 m_nPaperSourceOther;
301 bool m_bDynamicHeightTop;
302 bool m_bDynamicHeightBottom;
304 std::vector<css::uno::Reference<css::drawing::XShape>> m_xRelativeWidthShapes;
306 // The "Link To Previous" flag indicates whether the header/footer
307 // content should be taken from the previous section
308 bool m_bDefaultHeaderLinkToPrevious = true;
309 bool m_bEvenPageHeaderLinkToPrevious = true;
310 bool m_bFirstPageHeaderLinkToPrevious = true;
311 bool m_bDefaultFooterLinkToPrevious = true;
312 bool m_bEvenPageFooterLinkToPrevious = true;
313 bool m_bFirstPageFooterLinkToPrevious = true;
315 void ApplyProperties_( const css::uno::Reference< css::beans::XPropertySet >& xStyle );
317 void DontBalanceTextColumns();
319 /// Apply section-specific properties: only valid to use after PageStyle has been determined by InheritOrFinalizePageStyles
320 void ApplySectionProperties( const css::uno::Reference< css::beans::XPropertySet >& xSection, DomainMapper_Impl& rDM_Impl );
322 /// Check if document is protected. If so, ensure a section exists, and apply its protected value.
323 void ApplyProtectionProperties( css::uno::Reference< css::beans::XPropertySet >& xSection, DomainMapper_Impl& rDM_Impl );
325 css::uno::Reference< css::text::XTextColumns > ApplyColumnProperties(const css::uno::Reference<css::beans::XPropertySet>& xPageStyle,
326 DomainMapper_Impl& rDM_Impl);
328 void CopyLastHeaderFooter(DomainMapper_Impl& rDM_Impl);
330 void CreateEvenOddPageStyleCopy(DomainMapper_Impl& rDM_Impl, PageBreakType eBreakType);
332 void PrepareHeaderFooterProperties();
334 bool HasHeader() const;
335 bool HasFooter() const;
337 static void SetBorderDistance( const css::uno::Reference< css::beans::XPropertySet >& xStyle,
338 PropertyIds eMarginId,
339 PropertyIds eDistId,
340 sal_Int32 nDistance,
341 BorderOffsetFrom eOffsetFrom,
342 sal_uInt32 nLineWidth,
343 DomainMapper_Impl& rDM_Impl );
345 /// Increases paragraph spacing according to Word 2013+ needs if necessary.
346 void HandleIncreasedAnchoredObjectSpacing(DomainMapper_Impl& rDM_Impl);
348 public:
349 explicit SectionPropertyMap( bool bIsFirstSection );
351 bool IsFirstSection() const { return m_bIsFirstSection; }
353 void SetStart( const css::uno::Reference< css::text::XTextRange >& xRange ) { m_xStartingRange = xRange; }
355 const css::uno::Reference< css::text::XTextRange >& GetStartingRange() const { return m_xStartingRange; }
357 css::uno::Reference<css::beans::XPropertySet> GetPageStyle(DomainMapper_Impl& rDM_Impl);
359 const OUString& GetPageStyleName()
361 return m_sPageStyleName;
364 bool getFirstPageHeader() { return m_bFirstPageHeaderLinkToPrevious; }
365 bool getFirstPageFooter() { return m_bFirstPageFooterLinkToPrevious; }
367 // @throws css::beans::UnknownPropertyException
368 // @throws css::beans::PropertyVetoException
369 // @throws css::lang::IllegalArgumentException
370 // @throws css::lang::WrappedTargetException
371 // @throws css::uno::RuntimeException
372 void InheritOrFinalizePageStyles( DomainMapper_Impl& rDM_Impl );
374 void SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const css::table::BorderLine2& rBorderLine, bool bShadow );
375 void SetBorderApply( BorderApply nSet ) { m_eBorderApply = nSet; }
376 void SetBorderOffsetFrom( BorderOffsetFrom nSet ) { m_eBorderOffsetFrom = nSet; }
378 void SetColumnCount( sal_Int16 nCount ) { m_nColumnCount = nCount; }
379 sal_Int16 ColumnCount() const { return m_nColumnCount; }
381 void SetColumnDistance( sal_Int32 nDist ) { m_nColumnDistance = nDist; }
382 void AppendColumnWidth( sal_Int32 nWidth ) { m_aColWidth.push_back( nWidth ); }
383 void AppendColumnSpacing( sal_Int32 nDist ) { m_aColDistance.push_back( nDist ); }
385 void SetTitlePage( bool bSet ) { m_bTitlePage = bSet; }
386 void SetSeparatorLine( bool bSet ) { m_bSeparatorLineIsOn = bSet; }
387 void SetEvenlySpaced( bool bSet ) { m_bEvenlySpaced = bSet; }
388 void SetPageNumber( sal_Int32 nSet ) { m_nPageNumber = nSet; }
389 void SetPageNumberType( sal_Int32 nSet ) { m_nPageNumberType = nSet; }
390 void SetBreakType( sal_Int32 nSet ) { m_nBreakType = nSet; }
391 // GetBreakType returns -1 if the breakType has not yet been identified for the section
392 sal_Int32 GetBreakType() const { return m_nBreakType; }
394 void SetLeftMargin( sal_Int32 nSet ) { m_nLeftMargin = nSet; }
395 sal_Int32 GetLeftMargin() const { return m_nLeftMargin; }
396 void SetRightMargin( sal_Int32 nSet ) { m_nRightMargin = nSet; }
397 sal_Int32 GetRightMargin() const { return m_nRightMargin; }
398 void SetTopMargin(sal_Int32 nSet) { m_bDynamicHeightTop = nSet >= 0; m_nTopMargin = std::abs(nSet); }
399 void SetBottomMargin( sal_Int32 nSet ) { m_bDynamicHeightBottom = nSet >= 0; m_nBottomMargin = std::abs(nSet); }
400 void SetHeaderTop( sal_Int32 nSet ) { m_nHeaderTop = nSet; }
401 void SetHeaderBottom( sal_Int32 nSet ) { m_nHeaderBottom = nSet; }
402 void SetGutterMargin( sal_Int32 nGutterMargin ) { m_nGutterMargin = nGutterMargin; }
403 sal_Int32 GetPageWidth() const;
405 void SetGridType( sal_Int32 nSet ) { m_nGridType = nSet; }
406 void SetGridLinePitch( sal_Int32 nSet ) { m_nGridLinePitch = nSet; }
407 void SetGridSnapToChars( bool bSet ) { m_bGridSnapToChars = bSet; }
408 void SetDxtCharSpace( sal_Int32 nSet ) { m_nDxtCharSpace = nSet; }
410 void SetLnnMod( sal_Int32 nValue ) { m_nLnnMod = nValue; }
411 void SetLnc( sal_Int32 nValue ) { m_nLnc = nValue; }
412 void SetdxaLnn( sal_Int32 nValue ) { m_ndxaLnn = nValue; }
413 void SetLnnMin( sal_Int32 nValue ) { m_nLnnMin = nValue; }
415 void SetPaperSource(sal_Int32 first, sal_Int32 other) { m_nPaperSourceFirst = first; m_nPaperSourceOther = other;}
417 void addRelativeWidthShape( css::uno::Reference<css::drawing::XShape> xShape ) { m_xRelativeWidthShapes.push_back( xShape ); }
419 // determine which style gets the borders
420 void ApplyBorderToPageStyles( DomainMapper_Impl &rDM_Impl,
421 BorderApply eBorderApply, BorderOffsetFrom eOffsetFrom );
422 void ApplyPaperSource(DomainMapper_Impl& rDM_Impl);
423 void CloseSectionGroup( DomainMapper_Impl& rDM_Impl );
424 // Handling of margins, header and footer for any kind of sections breaks.
425 void HandleMarginsHeaderFooter(DomainMapper_Impl& rDM_Impl);
426 void clearHeaderFooterLinkToPrevious(PagePartType ePartType, PageType eType);
427 void setHeaderFooterProperties(DomainMapper_Impl& rDM_Impl);
429 // Which headers/footer types are used (have been imported) by the current section.
430 bool m_bFirstHeader = false;
431 bool m_bFirstFooter = false;
432 bool m_bLeftHeader = false;
433 bool m_bLeftFooter = false;
434 bool m_bRightHeader = false;
435 bool m_bRightFooter = false;
436 bool m_bHadFirstHeader = false;
437 bool m_bHadLeftHeader = false;
438 bool m_bHadRightHeader = false;
440 static void removeXTextContent(css::uno::Reference<css::text::XText> const& rxText);
443 void BeforeConvertToTextFrame(std::deque<css::uno::Any>& rFramedRedlines, std::vector<sal_Int32>& redPos, std::vector<sal_Int32>& redLen, std::vector<OUString>& redCell, std::vector<OUString>& redTable);
445 void AfterConvertToTextFrame(DomainMapper_Impl& rDM_Impl, std::deque<css::uno::Any>& aFramedRedlines, std::vector<sal_Int32>& redPos, std::vector<sal_Int32>& redLen, std::vector<OUString>& redCell, std::vector<OUString>& redTable);
447 class ParagraphProperties : public SvRefBase
449 private:
450 bool m_bFrameMode;
451 sal_Int32 m_nDropCap; // drop, margin ST_DropCap
452 sal_Int32 m_nLines; // number of lines of the drop cap
453 sal_Int32 m_w; // width
454 sal_Int32 m_h; // height
455 css::text::WrapTextMode m_nWrap; // from ST_Wrap around, auto, none, notBeside, through, tight
456 sal_Int32 m_hAnchor; // page, from ST_HAnchor margin, page, text
457 sal_Int32 m_vAnchor; // around from ST_VAnchor margin, page, text
458 sal_Int32 m_x; // x-position
459 bool m_bxValid;
460 sal_Int32 m_y; // y-position
461 bool m_byValid;
462 sal_Int32 m_hSpace; // frame padding h
463 sal_Int32 m_vSpace; // frame padding v
464 sal_Int32 m_hRule; // from ST_HeightRule exact, atLeast, auto
465 sal_Int32 m_xAlign; // from ST_XAlign center, inside, left, outside, right
466 sal_Int32 m_yAlign; // from ST_YAlign bottom, center, inline, inside, outside, top
467 sal_Int8 m_nDropCapLength; // number of characters
468 OUString m_sParaStyleName;
469 OUString m_sParaId; // [MS-DOCX] sect. 2.2.4 "p and tr Extensions"
471 css::uno::Reference< css::text::XTextRange > m_xStartingRange; // start of a frame
472 css::uno::Reference< css::text::XTextRange > m_xEndingRange; // end of the frame
473 sal_Int32 m_nListId = -1;
475 public:
476 ParagraphProperties();
478 ParagraphProperties(ParagraphProperties const &) = default;
479 ParagraphProperties(ParagraphProperties &&) = default;
480 ParagraphProperties & operator =(ParagraphProperties const &) = default;
481 ParagraphProperties & operator =(ParagraphProperties &&) = default;
483 sal_Int32 GetListId() const { return m_nListId; }
484 void SetListId( sal_Int32 nId ) { m_nListId = nId; }
486 bool IsFrameMode() const { return m_bFrameMode; }
487 void SetFrameMode( bool set = true ) { m_bFrameMode = set; }
489 sal_Int32 GetDropCap() const { return m_nDropCap; }
490 void SetDropCap( sal_Int32 nSet ) { m_nDropCap = nSet; }
492 sal_Int32 GetLines() const { return m_nLines; }
493 void SetLines( sal_Int32 nSet ) { m_nLines = nSet; }
495 sal_Int32 Getw() const { return m_w; }
496 void Setw( sal_Int32 nSet ) { m_w = nSet; }
498 sal_Int32 Geth() const { return m_h; }
499 void Seth( sal_Int32 nSet ) { m_h = nSet; }
501 css::text::WrapTextMode GetWrap() const { return m_nWrap; }
502 void SetWrap( css::text::WrapTextMode nSet ) { m_nWrap = nSet; }
504 sal_Int32 GethAnchor() const { return m_hAnchor; }
505 void SethAnchor( sal_Int32 nSet ) { m_hAnchor = nSet; }
507 sal_Int32 GetvAnchor() const { return m_vAnchor; }
508 void SetvAnchor( sal_Int32 nSet ) { m_vAnchor = nSet; }
510 sal_Int32 Getx() const { return m_x; }
511 void Setx( sal_Int32 nSet ) { m_x = nSet; m_bxValid = true; }
512 bool IsxValid() const { return m_bxValid; }
514 sal_Int32 Gety() const { return m_y; }
515 void Sety( sal_Int32 nSet ) { m_y = nSet; m_byValid = true; }
516 bool IsyValid() const { return m_byValid; }
518 void SethSpace( sal_Int32 nSet ) { m_hSpace = nSet; }
519 sal_Int32 GethSpace() const { return m_hSpace; }
521 sal_Int32 GetvSpace() const { return m_vSpace; }
522 void SetvSpace( sal_Int32 nSet ) { m_vSpace = nSet; }
524 sal_Int32 GethRule() const { return m_hRule; }
525 void SethRule( sal_Int32 nSet ) { m_hRule = nSet; }
527 sal_Int32 GetxAlign() const { return m_xAlign; }
528 void SetxAlign( sal_Int32 nSet ) { m_xAlign = nSet; }
530 sal_Int32 GetyAlign() const { return m_yAlign; }
531 void SetyAlign( sal_Int32 nSet ) { m_yAlign = nSet; }
533 sal_Int8 GetDropCapLength() const { return m_nDropCapLength; }
534 void SetDropCapLength( sal_Int8 nSet ) { m_nDropCapLength = nSet; }
536 const css::uno::Reference< css::text::XTextRange >& GetStartingRange() const { return m_xStartingRange; }
537 void SetStartingRange( const css::uno::Reference< css::text::XTextRange >& xSet ) { m_xStartingRange = xSet; }
539 const css::uno::Reference< css::text::XTextRange >& GetEndingRange() const { return m_xEndingRange; }
540 void SetEndingRange( const css::uno::Reference< css::text::XTextRange >& xSet ) { m_xEndingRange = xSet; }
542 const OUString& GetParaStyleName() const { return m_sParaStyleName; }
543 void SetParaStyleName( const OUString& rSet ) { m_sParaStyleName = rSet; }
545 const OUString& GetParaId() const { return m_sParaId; }
546 void SetParaId(const OUString& rSet) { m_sParaId = rSet; }
548 void ResetFrameProperties();
551 typedef tools::SvRef< ParagraphProperties > ParagraphPropertiesPtr;
553 class ParagraphPropertiesPropertyMap: public PropertyMap {
554 public:
555 ParagraphProperties & props() { return m_props; }
557 ParagraphProperties const & props() const { return m_props; }
559 private:
560 ParagraphProperties m_props;
563 /*-------------------------------------------------------------------------
564 property map of a stylesheet
565 -----------------------------------------------------------------------*/
567 #define WW_OUTLINE_MAX sal_Int16( 9 )
568 #define WW_OUTLINE_MIN sal_Int16( 0 )
570 class StyleSheetPropertyMap
571 : public ParagraphPropertiesPropertyMap
573 private:
574 sal_Int16 mnListLevel;
575 sal_Int16 mnOutlineLevel;
577 public:
578 explicit StyleSheetPropertyMap();
580 sal_Int16 GetListLevel() const { return mnListLevel; }
581 void SetListLevel( sal_Int16 nLevel ) { mnListLevel = nLevel; }
583 sal_Int16 GetOutlineLevel() const { return mnOutlineLevel; }
584 void SetOutlineLevel(sal_Int16 nLevel) { if (nLevel <= WW_OUTLINE_MAX) mnOutlineLevel = nLevel; }
587 class ParagraphPropertyMap
588 : public ParagraphPropertiesPropertyMap
590 public:
591 explicit ParagraphPropertyMap() {}
594 class TablePropertyMap
595 : public PropertyMap
597 public:
598 enum TablePropertyMapTarget
600 TablePropertyMapTarget_START,
601 CELL_MAR_LEFT = TablePropertyMapTarget_START,
602 CELL_MAR_RIGHT,
603 CELL_MAR_TOP,
604 CELL_MAR_BOTTOM,
605 TABLE_WIDTH,
606 TABLE_WIDTH_TYPE,
607 LEFT_MARGIN,
608 HORI_ORIENT,
609 TablePropertyMapTarget_MAX
612 private:
613 struct ValidValue
615 sal_Int32 nValue;
616 bool bValid;
618 ValidValue()
619 : nValue( 0 )
620 , bValid( false )
625 ValidValue m_aValidValues[TablePropertyMapTarget_MAX];
627 public:
628 explicit TablePropertyMap() {}
630 bool getValue( TablePropertyMapTarget eWhich, sal_Int32& nFill );
631 void setValue( TablePropertyMapTarget eWhich, sal_Int32 nSet );
633 virtual void insertTableProperties( const PropertyMap*, const bool bOverwrite = true ) override;
636 typedef tools::SvRef< TablePropertyMap > TablePropertyMapPtr;
638 /// Information about a paragraph to be finished after a table end.
639 struct TableParagraph
641 css::uno::Reference<css::text::XTextRange> m_rStartParagraph;
642 css::uno::Reference<css::text::XTextRange> m_rEndParagraph;
643 PropertyMapPtr m_pPropertyMap;
644 css::uno::Reference<css::beans::XPropertySet> m_rPropertySet;
647 typedef std::shared_ptr< std::vector<TableParagraph> > TableParagraphVectorPtr;
649 } // namespace writerfilter::dmapper
651 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */