fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / writerfilter / source / dmapper / StyleSheetTable.hxx
blob05f5748ae00fa5fadf82602c72e0e7b569f09361
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_STYLESHEETTABLE_HXX
20 #define INCLUDED_STYLESHEETTABLE_HXX
22 #include "TblStylePrHandler.hxx"
24 #include <WriterFilterDllApi.hxx>
25 #include <dmapper/DomainMapper.hxx>
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <PropertyMap.hxx>
28 #include <FontTable.hxx>
29 #include <resourcemodel/LoggedResources.hxx>
31 namespace com{ namespace sun { namespace star { namespace text{
32 class XTextDocument;
33 }}}}
36 namespace writerfilter {
37 namespace dmapper
41 enum StyleType
43 STYLE_TYPE_UNKNOWN,
44 STYLE_TYPE_PARA,
45 STYLE_TYPE_CHAR,
46 STYLE_TYPE_TABLE,
47 STYLE_LIST
50 struct StyleSheetTable_Impl;
51 class StyleSheetEntry
53 public:
54 OUString sStyleIdentifierI;
55 OUString sStyleIdentifierD;
56 bool bIsDefaultStyle;
57 bool bInvalidHeight;
58 bool bHasUPE; //universal property expansion
59 StyleType nStyleTypeCode; //sgc
60 OUString sBaseStyleIdentifier;
61 OUString sNextStyleIdentifier;
62 OUString sStyleName;
63 OUString sStyleName1;
64 PropertyMapPtr pProperties;
65 OUString sConvertedStyleName;
67 StyleSheetEntry();
68 virtual ~StyleSheetEntry();
71 typedef boost::shared_ptr<StyleSheetEntry> StyleSheetEntryPtr;
72 typedef ::std::deque<StyleSheetEntryPtr> StyleSheetEntryDeque;
73 typedef boost::shared_ptr<StyleSheetEntryDeque> StyleSheetEntryDequePtr;
75 class DomainMapper;
76 class StyleSheetTable :
77 public LoggedProperties,
78 public LoggedTable
80 StyleSheetTable_Impl *m_pImpl;
82 public:
83 StyleSheetTable( DomainMapper& rDMapper,
84 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument> xTextDocument, bool bIsNewDoc );
85 virtual ~StyleSheetTable();
87 void ApplyStyleSheets( FontTablePtr rFontTable );
88 const StyleSheetEntryPtr FindStyleSheetByISTD(const OUString& sIndex);
89 const StyleSheetEntryPtr FindStyleSheetByStyleName(const OUString& rIndex);
90 const StyleSheetEntryPtr FindStyleSheetByConvertedStyleName(const OUString& rIndex);
91 // returns the parent of the one with the given name - if empty the parent of the current style sheet is returned
92 const StyleSheetEntryPtr FindParentStyleSheet(OUString sBaseStyle);
94 OUString ConvertStyleName( const OUString& rWWName, bool bExtendedSearch = false );
95 OUString GetStyleIdFromIndex(const sal_uInt32 sti);
97 OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties );
99 /// Returns the default character properties.
100 PropertyMapPtr GetDefaultCharProps();
102 private:
103 // Properties
104 virtual void lcl_attribute(Id Name, Value & val);
105 virtual void lcl_sprm(Sprm & sprm);
107 // Table
108 virtual void lcl_entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
110 void resolveAttributeProperties(Value & val);
111 void applyDefaults(bool bParaProperties);
113 typedef boost::shared_ptr< StyleSheetTable > StyleSheetTablePtr;
116 class WRITERFILTER_DLLPRIVATE TableStyleSheetEntry :
117 public StyleSheetEntry
119 private:
120 typedef std::map<TblStyleType, PropertyMapPtr> TblStylePrs;
122 StyleSheetTable* m_pStyleSheet;
123 TblStylePrs m_aStyles;
125 public:
127 short m_nColBandSize;
128 short m_nRowBandSize;
130 // Adds a new tblStylePr to the table style entry. This method
131 // fixes some possible properties conflicts, like borders ones.
132 void AddTblStylePr( TblStyleType nType, PropertyMapPtr pProps );
134 // Gets all the properties
135 // + corresponding to the mask,
136 // + from the parent styles
138 // @param mask mask describing which properties to return
139 // @param pStack already processed StyleSheetEntries
140 PropertyMapPtr GetProperties( sal_Int32 nMask, StyleSheetEntryDequePtr pStack = StyleSheetEntryDequePtr());
142 TableStyleSheetEntry( StyleSheetEntry& aEntry, StyleSheetTable* pStyles );
143 virtual ~TableStyleSheetEntry( );
145 protected:
146 PropertyMapPtr GetLocalPropertiesFromMask( sal_Int32 nMask );
148 typedef boost::shared_ptr<TableStyleSheetEntry> TableStyleSheetEntryPtr;
152 #endif //
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */