merge the formfield patch from ooo-build
[ooovba.git] / writerfilter / source / dmapper / StyleSheetTable.hxx
blob9c01dbc162d32c22dfcc58b91d92de54ad35c93f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: StyleSheetTable.hxx,v $
10 * $Revision: 1.16 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef INCLUDED_STYLESHEETTABLE_HXX
31 #define INCLUDED_STYLESHEETTABLE_HXX
33 #include "TblStylePrHandler.hxx"
35 #include <WriterFilterDllApi.hxx>
36 #include <dmapper/DomainMapper.hxx>
37 #include <com/sun/star/lang/XComponent.hpp>
38 #include <PropertyMap.hxx>
39 #include <FontTable.hxx>
40 #include <resourcemodel/WW8ResourceModel.hxx>
42 namespace com{ namespace sun { namespace star { namespace text{
43 class XTextDocument;
44 }}}}
47 namespace writerfilter {
48 namespace dmapper
52 enum StyleType
54 STYLE_TYPE_UNKNOWN,
55 STYLE_TYPE_PARA,
56 STYLE_TYPE_CHAR,
57 STYLE_TYPE_TABLE,
58 STYLE_LIST
61 struct StyleSheetTable_Impl;
62 struct StyleSheetEntry
64 ::rtl::OUString sStyleIdentifierI;
65 ::rtl::OUString sStyleIdentifierD;
66 bool bIsDefaultStyle;
67 bool bInvalidHeight;
68 bool bHasUPE; //universal property expansion
69 StyleType nStyleTypeCode; //sgc
70 ::rtl::OUString sBaseStyleIdentifier;
71 ::rtl::OUString sNextStyleIdentifier;
72 ::rtl::OUString sStyleName;
73 ::rtl::OUString sStyleName1;
74 PropertyMapPtr pProperties;
75 ::rtl::OUString sConvertedStyleName;
76 StyleSheetEntry();
79 typedef boost::shared_ptr<StyleSheetEntry> StyleSheetEntryPtr;
81 class DomainMapper;
82 class WRITERFILTER_DLLPRIVATE StyleSheetTable :
83 public Properties,
84 public Table
86 StyleSheetTable_Impl *m_pImpl;
88 public:
89 StyleSheetTable( DomainMapper& rDMapper,
90 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument> xTextDocument );
91 virtual ~StyleSheetTable();
93 // Properties
94 virtual void attribute(Id Name, Value & val);
95 virtual void sprm(Sprm & sprm);
97 // Table
98 virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
100 void ApplyStyleSheets( FontTablePtr rFontTable );
101 const StyleSheetEntryPtr FindStyleSheetByISTD(const ::rtl::OUString& sIndex);
102 const StyleSheetEntryPtr FindStyleSheetByStyleName(const ::rtl::OUString& rIndex);
103 const StyleSheetEntryPtr FindStyleSheetByConvertedStyleName(const ::rtl::OUString& rIndex);
104 // returns the parent of the one with the given name - if empty the parent of the current style sheet is returned
105 const StyleSheetEntryPtr FindParentStyleSheet(::rtl::OUString sBaseStyle);
107 ::rtl::OUString ConvertStyleName( const ::rtl::OUString& rWWName, bool bExtendedSearch = false );
108 ::rtl::OUString GetStyleIdFromIndex(const sal_uInt32 sti);
110 ::rtl::OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties );
112 private:
113 void resolveAttributeProperties(Value & val);
114 void resolveSprmProps(Sprm & sprm_);
115 void applyDefaults(bool bParaProperties);
117 typedef boost::shared_ptr< StyleSheetTable > StyleSheetTablePtr;
120 class WRITERFILTER_DLLPRIVATE TableStyleSheetEntry :
121 public StyleSheetEntry
123 private:
124 typedef std::map<TblStyleType, PropertyMapPtr> TblStylePrs;
126 StyleSheetTable* m_pStyleSheet;
127 TblStylePrs m_aStyles;
129 public:
131 short m_nColBandSize;
132 short m_nRowBandSize;
134 // Adds a new tblStylePr to the table style entry. This method
135 // fixes some possible properties conflicts, like borders ones.
136 void AddTblStylePr( TblStyleType nType, PropertyMapPtr pProps );
138 // Gets all the properties
139 // + corresponding to the mask,
140 // + from the parent styles
141 PropertyMapPtr GetProperties( sal_Int32 nMask );
143 TableStyleSheetEntry( StyleSheetEntry& aEntry, StyleSheetTable* pStyles );
144 ~TableStyleSheetEntry( );
146 protected:
147 PropertyMapPtr GetLocalPropertiesFromMask( sal_Int32 nMask );
149 typedef boost::shared_ptr<TableStyleSheetEntry> TableStyleSheetEntryPtr;
153 #endif //