lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / writerfilter / source / dmapper / StyleSheetTable.hxx
blob686779acbd711bd6c68e53c39d17f567ed134fa3
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 #ifndef INCLUDED_WRITERFILTER_SOURCE_DMAPPER_STYLESHEETTABLE_HXX
20 #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_STYLESHEETTABLE_HXX
22 #include <memory>
23 #include "TblStylePrHandler.hxx"
25 #include "DomainMapper.hxx"
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <com/sun/star/beans/PropertyValues.hpp>
28 #include "PropertyMap.hxx"
29 #include "FontTable.hxx"
30 #include "LoggedResources.hxx"
32 namespace com{ namespace sun { namespace star { namespace text{
33 class XTextDocument;
34 }}}}
37 namespace writerfilter {
38 namespace dmapper
42 enum StyleType
44 STYLE_TYPE_UNKNOWN,
45 STYLE_TYPE_PARA,
46 STYLE_TYPE_CHAR,
47 STYLE_TYPE_TABLE,
48 STYLE_TYPE_LIST
50 class StyleSheetTable;
51 typedef tools::SvRef<StyleSheetTable> StyleSheetTablePtr;
53 struct StyleSheetTable_Impl;
54 class StyleSheetEntry : public virtual SvRefBase
56 std::vector<css::beans::PropertyValue> m_aInteropGrabBag;
57 public:
58 OUString sStyleIdentifierD; // WW8 name
59 bool bIsDefaultStyle;
60 bool bInvalidHeight;
61 bool bHasUPE; //universal property expansion
62 StyleType nStyleTypeCode; //sgc
63 OUString sBaseStyleIdentifier;
64 OUString sNextStyleIdentifier;
65 OUString sStyleName;
66 PropertyMapPtr pProperties;
67 OUString sConvertedStyleName;
68 std::vector<css::beans::PropertyValue> aLatentStyles; ///< Attributes of latentStyles
69 std::vector<css::beans::PropertyValue> aLsdExceptions; ///< List of lsdException attribute lists
70 bool bAutoRedefine; ///< Writer calls this auto-update.
72 void AppendInteropGrabBag(const css::beans::PropertyValue& rValue);
73 css::beans::PropertyValue GetInteropGrabBag(); ///< Used for table styles, has a name.
74 css::beans::PropertyValues GetInteropGrabBagSeq(); ///< Used for existing styles, just a list of properties.
76 // Get all properties, merged with the all of the parent's properties
77 PropertyMapPtr GetMergedInheritedProperties(const StyleSheetTablePtr& pStyleSheetTable);
79 StyleSheetEntry();
80 virtual ~StyleSheetEntry() override;
83 typedef tools::SvRef<StyleSheetEntry> StyleSheetEntryPtr;
85 class DomainMapper;
86 class StyleSheetTable :
87 public LoggedProperties,
88 public LoggedTable
90 std::unique_ptr<StyleSheetTable_Impl> m_pImpl;
92 public:
93 StyleSheetTable(DomainMapper& rDMapper, css::uno::Reference<css::text::XTextDocument> const& xTextDocument, bool bIsNewDoc);
94 virtual ~StyleSheetTable() override;
96 void ApplyStyleSheets( const FontTablePtr& rFontTable );
97 const StyleSheetEntryPtr FindStyleSheetByISTD(const OUString& sIndex);
98 const StyleSheetEntryPtr FindStyleSheetByConvertedStyleName(const OUString& rIndex);
99 const StyleSheetEntryPtr FindDefaultParaStyle();
101 OUString ConvertStyleName( const OUString& rWWName, bool bExtendedSearch = false );
103 OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate );
105 PropertyMapPtr const & GetDefaultParaProps();
106 /// Returns the default character properties.
107 PropertyMapPtr const & GetDefaultCharProps();
109 const StyleSheetEntryPtr GetCurrentEntry();
111 private:
112 // Properties
113 virtual void lcl_attribute(Id Name, Value & val) override;
114 virtual void lcl_sprm(Sprm & sprm) override;
116 // Table
117 virtual void lcl_entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref) override;
119 void applyDefaults(bool bParaProperties);
123 class TableStyleSheetEntry :
124 public StyleSheetEntry
126 public:
127 // Adds a new tblStylePr to the table style entry. This method
128 // fixes some possible properties conflicts, like borders ones.
129 void AddTblStylePr( TblStyleType nType, const PropertyMapPtr& pProps );
131 // Gets all the properties
132 // + corresponding to the mask,
133 // + from the parent styles
135 // @param mask mask describing which properties to return
136 PropertyMapPtr GetProperties( sal_Int32 nMask);
138 TableStyleSheetEntry( StyleSheetEntry const & aEntry );
139 virtual ~TableStyleSheetEntry( ) override;
141 private:
142 typedef std::map<TblStyleType, PropertyMapPtr> TblStylePrs;
143 TblStylePrs m_aStyles;
144 PropertyMapPtr GetLocalPropertiesFromMask( sal_Int32 nMask );
150 #endif
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */