LibreOffice Module writerfilter (master) 1
StyleSheetTable.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#pragma once
20
21#include <memory>
22#include "TblStylePrHandler.hxx"
23
24#include "DomainMapper.hxx"
25#include <com/sun/star/beans/PropertyValues.hpp>
26#include "PropertyMap.hxx"
27#include "FontTable.hxx"
28#include "LoggedResources.hxx"
29
30namespace com::sun::star::text { class XTextDocument; }
31
32
34{
35
36
38{
44};
45class StyleSheetTable;
47
48struct StyleSheetTable_Impl;
49class StyleSheetEntry : public virtual SvRefBase
50{
51 std::vector<css::beans::PropertyValue> m_aInteropGrabBag;
52public:
53 OUString m_sStyleIdentifierD; // WW8 name
57 bool m_bHasUPE; //universal property expansion
62 OUString m_sStyleName;
65 std::vector<css::beans::PropertyValue> m_aLatentStyles;
66 std::vector<css::beans::PropertyValue> m_aLsdExceptions;
68
69 void AppendInteropGrabBag(const css::beans::PropertyValue& rValue);
70 css::beans::PropertyValue GetInteropGrabBag();
71 css::beans::PropertyValues GetInteropGrabBagSeq() const;
72
73 // Get all properties, merged with the all of the parent's properties
75
78 virtual ~StyleSheetEntry() override;
79};
80
82
83class DomainMapper;
85 public LoggedProperties,
86 public LoggedTable
87{
88 std::unique_ptr<StyleSheetTable_Impl> m_pImpl;
89
90public:
91 StyleSheetTable(DomainMapper& rDMapper, css::uno::Reference<css::text::XTextDocument> const& xTextDocument, bool bIsNewDoc);
92 virtual ~StyleSheetTable() override;
93
96 void ApplyStyleSheets( const FontTablePtr& rFontTable );
97 StyleSheetEntryPtr FindStyleSheetByISTD(const OUString& sIndex);
100
101 OUString ConvertStyleName( const OUString& rWWName, bool bExtendedSearch = false );
102 OUString CloneTOCStyle(FontTablePtr const& rFontTable, StyleSheetEntryPtr const pStyle, OUString const& rName);
104
105 OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate );
106
107 void SetDefaultParaProps(PropertyIds eId, const css::uno::Any& rAny);
108 PropertyMapPtr const & GetDefaultParaProps() const;
110 PropertyMapPtr const & GetDefaultCharProps() const;
111
112 const StyleSheetEntryPtr & GetCurrentEntry() const;
113
114private:
115 // Properties
116 virtual void lcl_attribute(Id Name, Value & val) override;
117 virtual void lcl_sprm(Sprm & sprm) override;
118
119 // Table
121
122 void applyDefaults(bool bParaProperties);
123
124 void ApplyStyleSheetsImpl(const FontTablePtr& rFontTable, std::vector<StyleSheetEntryPtr> const& rEntries);
125};
126
127
129 public StyleSheetEntry
130{
131public:
132 // Adds a new tblStylePr to the table style entry. This method
133 // fixes some possible properties conflicts, like borders ones.
134 void AddTblStylePr( TblStyleType nType, const PropertyMapPtr& pProps );
135
136 // Gets all the properties
137 // + corresponding to the mask,
138 // + from the parent styles
139
140 // @param mask mask describing which properties to return
141 PropertyMapPtr GetProperties( sal_Int32 nMask);
142
143 TableStyleSheetEntry( StyleSheetEntry const & aEntry );
144 virtual ~TableStyleSheetEntry( ) override;
145
146private:
147 typedef std::map<TblStyleType, PropertyMapPtr> TblStylePrs;
150};
151
152
153}
154
155/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< css::beans::PropertyValue > PropertyValueVector_t
void sprm(Sprm &sprm) override
Receives a SPRM.
An SPRM: Section, Paragraph and Run Modifier.
bool m_bAutoRedefine
Writer calls this auto-update.
css::beans::PropertyValue GetInteropGrabBag()
Used for table styles, has a name.
StyleSheetEntry(StyleSheetEntry const &)=default
std::vector< css::beans::PropertyValue > m_aLsdExceptions
List of lsdException attribute lists.
css::beans::PropertyValues GetInteropGrabBagSeq() const
Used for existing styles, just a list of properties.
const tools::SvRef< StyleSheetPropertyMap > m_pProperties
std::vector< css::beans::PropertyValue > m_aLatentStyles
Attributes of latentStyles.
std::vector< css::beans::PropertyValue > m_aInteropGrabBag
PropertyMapPtr GetMergedInheritedProperties(const StyleSheetTablePtr &pStyleSheetTable)
void AppendInteropGrabBag(const css::beans::PropertyValue &rValue)
void ApplyStyleSheetsImpl(const FontTablePtr &rFontTable, std::vector< StyleSheetEntryPtr > const &rEntries)
void ApplyClonedTOCStyles()
Replace the applied en-US Word built-in styles that were referenced from TOC fields (also STYLEREF an...
OUString CloneTOCStyle(FontTablePtr const &rFontTable, StyleSheetEntryPtr const pStyle, OUString const &rName)
virtual void lcl_sprm(Sprm &sprm) override
StyleSheetEntryPtr FindStyleSheetByConvertedStyleName(std::u16string_view rIndex)
void SetDefaultParaProps(PropertyIds eId, const css::uno::Any &rAny)
virtual void lcl_entry(writerfilter::Reference< Properties >::Pointer_t ref) override
OUString ConvertStyleName(const OUString &rWWName, bool bExtendedSearch=false)
PropertyMapPtr const & GetDefaultParaProps() const
OUString getOrCreateCharStyle(PropertyValueVector_t &rCharProperties, bool bAlwaysCreate)
const StyleSheetEntryPtr & GetCurrentEntry() const
StyleSheetEntryPtr FindStyleSheetByISTD(const OUString &sIndex)
std::unique_ptr< StyleSheetTable_Impl > m_pImpl
void applyDefaults(bool bParaProperties)
PropertyMapPtr const & GetDefaultCharProps() const
Returns the default character properties.
StyleSheetTable(DomainMapper &rDMapper, css::uno::Reference< css::text::XTextDocument > const &xTextDocument, bool bIsNewDoc)
void ApplyStyleSheets(const FontTablePtr &rFontTable)
virtual void lcl_attribute(Id Name, Value &val) override
TableStyleSheetEntry(StyleSheetEntry const &aEntry)
std::map< TblStyleType, PropertyMapPtr > TblStylePrs
PropertyMapPtr GetLocalPropertiesFromMask(sal_Int32 nMask)
void AddTblStylePr(TblStyleType nType, const PropertyMapPtr &pProps)
PropertyMapPtr GetProperties(sal_Int32 nMask)
tools::SvRef< StyleSheetEntry > StyleSheetEntryPtr
tools::SvRef< StyleSheetTable > StyleSheetTablePtr
QPRO_FUNC_TYPE nType
sal_uInt32 Id