1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
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
{
37 namespace writerfilter
{
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
;
58 OUString sStyleIdentifierD
; // WW8 name
61 bool bHasUPE
; //universal property expansion
62 StyleType nStyleTypeCode
; //sgc
63 OUString sBaseStyleIdentifier
;
64 OUString sNextStyleIdentifier
;
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
);
80 virtual ~StyleSheetEntry() override
;
83 typedef tools::SvRef
<StyleSheetEntry
> StyleSheetEntryPtr
;
86 class StyleSheetTable
:
87 public LoggedProperties
,
90 std::unique_ptr
<StyleSheetTable_Impl
> m_pImpl
;
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();
113 virtual void lcl_attribute(Id Name
, Value
& val
) override
;
114 virtual void lcl_sprm(Sprm
& sprm
) override
;
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
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
;
142 typedef std::map
<TblStyleType
, PropertyMapPtr
> TblStylePrs
;
143 TblStylePrs m_aStyles
;
144 PropertyMapPtr
GetLocalPropertiesFromMask( sal_Int32 nMask
);
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */