1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: StyleSheetTable.hxx,v $
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
{
47 namespace writerfilter
{
61 struct StyleSheetTable_Impl
;
62 struct StyleSheetEntry
64 ::rtl::OUString sStyleIdentifierI
;
65 ::rtl::OUString sStyleIdentifierD
;
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
;
79 typedef boost::shared_ptr
<StyleSheetEntry
> StyleSheetEntryPtr
;
82 class WRITERFILTER_DLLPRIVATE StyleSheetTable
:
86 StyleSheetTable_Impl
*m_pImpl
;
89 StyleSheetTable( DomainMapper
& rDMapper
,
90 ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextDocument
> xTextDocument
);
91 virtual ~StyleSheetTable();
94 virtual void attribute(Id Name
, Value
& val
);
95 virtual void sprm(Sprm
& sprm
);
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
);
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
124 typedef std::map
<TblStyleType
, PropertyMapPtr
> TblStylePrs
;
126 StyleSheetTable
* m_pStyleSheet
;
127 TblStylePrs m_aStyles
;
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( );
147 PropertyMapPtr
GetLocalPropertiesFromMask( sal_Int32 nMask
);
149 typedef boost::shared_ptr
<TableStyleSheetEntry
> TableStyleSheetEntryPtr
;