1*63bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*63bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*63bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*63bba73cSAndrew Rist  * distributed with this work for additional information
6*63bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*63bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*63bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
9*63bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*63bba73cSAndrew Rist  *
11*63bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*63bba73cSAndrew Rist  *
13*63bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*63bba73cSAndrew Rist  * software distributed under the License is distributed on an
15*63bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*63bba73cSAndrew Rist  * specific language governing permissions and limitations
18*63bba73cSAndrew Rist  * under the License.
19*63bba73cSAndrew Rist  *
20*63bba73cSAndrew Rist  *************************************************************/
21*63bba73cSAndrew Rist 
22*63bba73cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "PageMasterImportPropMapper.hxx"
28cdf0e10cSrcweir #include "PageMasterPropMapper.hxx"
29cdf0e10cSrcweir #include <xmloff/PageMasterStyleMap.hxx>
30cdf0e10cSrcweir #include <xmloff/maptype.hxx>
31cdf0e10cSrcweir #include <com/sun/star/table/BorderLine.hpp>
32cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
33cdf0e10cSrcweir #include <xmloff/xmlimp.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #define XML_LINE_LEFT 0
36cdf0e10cSrcweir #define XML_LINE_RIGHT 1
37cdf0e10cSrcweir #define XML_LINE_TOP 2
38cdf0e10cSrcweir #define XML_LINE_BOTTOM 3
39cdf0e10cSrcweir 
40cdf0e10cSrcweir using namespace ::com::sun::star;
41cdf0e10cSrcweir using namespace ::com::sun::star::uno;
42cdf0e10cSrcweir using namespace ::com::sun::star::container;
43cdf0e10cSrcweir 
PageMasterImportPropertyMapper(const UniReference<XMLPropertySetMapper> & rMapper,SvXMLImport & rImp)44cdf0e10cSrcweir PageMasterImportPropertyMapper::PageMasterImportPropertyMapper(
45cdf0e10cSrcweir 		const UniReference< XMLPropertySetMapper >& rMapper,
46cdf0e10cSrcweir 		SvXMLImport& rImp ) :
47cdf0e10cSrcweir 	SvXMLImportPropertyMapper( rMapper, rImp ),
48cdf0e10cSrcweir 	rImport( rImp )
49cdf0e10cSrcweir {
50cdf0e10cSrcweir }
51cdf0e10cSrcweir 
~PageMasterImportPropertyMapper()52cdf0e10cSrcweir PageMasterImportPropertyMapper::~PageMasterImportPropertyMapper()
53cdf0e10cSrcweir {
54cdf0e10cSrcweir }
55cdf0e10cSrcweir 
handleSpecialItem(XMLPropertyState & rProperty,::std::vector<XMLPropertyState> & rProperties,const::rtl::OUString & rValue,const SvXMLUnitConverter & rUnitConverter,const SvXMLNamespaceMap & rNamespaceMap) const56cdf0e10cSrcweir sal_Bool PageMasterImportPropertyMapper::handleSpecialItem(
57cdf0e10cSrcweir 		XMLPropertyState& rProperty,
58cdf0e10cSrcweir 		::std::vector< XMLPropertyState >& rProperties,
59cdf0e10cSrcweir 		const ::rtl::OUString& rValue,
60cdf0e10cSrcweir 		const SvXMLUnitConverter& rUnitConverter,
61cdf0e10cSrcweir 		const SvXMLNamespaceMap& rNamespaceMap ) const
62cdf0e10cSrcweir {
63cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
64cdf0e10cSrcweir 	sal_Int16 nContextID =
65cdf0e10cSrcweir 			getPropertySetMapper()->GetEntryContextId(rProperty.mnIndex);
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	if( CTF_PM_REGISTER_STYLE==nContextID )
68cdf0e10cSrcweir 	{
69cdf0e10cSrcweir 		::rtl::OUString sDisplayName( rImport.GetStyleDisplayName(
70cdf0e10cSrcweir 					XML_STYLE_FAMILY_TEXT_PARAGRAPH, rValue ) );
71cdf0e10cSrcweir 		Reference < XNameContainer > xParaStyles =
72cdf0e10cSrcweir 			rImport.GetTextImport()->GetParaStyles();
73cdf0e10cSrcweir 		if( xParaStyles.is() && xParaStyles->hasByName( sDisplayName ) )
74cdf0e10cSrcweir 		{
75cdf0e10cSrcweir 			rProperty.maValue <<= sDisplayName;
76cdf0e10cSrcweir 			bRet = sal_True;
77cdf0e10cSrcweir 		}
78cdf0e10cSrcweir 	}
79cdf0e10cSrcweir 	else
80cdf0e10cSrcweir 	{
81cdf0e10cSrcweir 		bRet = SvXMLImportPropertyMapper::handleSpecialItem(
82cdf0e10cSrcweir 					rProperty, rProperties, rValue,
83cdf0e10cSrcweir 					rUnitConverter, rNamespaceMap );
84cdf0e10cSrcweir 	}
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	return bRet;
87cdf0e10cSrcweir }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 
finished(::std::vector<XMLPropertyState> & rProperties,sal_Int32 nStartIndex,sal_Int32 nEndIndex) const90cdf0e10cSrcweir void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const
91cdf0e10cSrcweir {
92cdf0e10cSrcweir 	SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex);
93cdf0e10cSrcweir 	XMLPropertyState* pAllPaddingProperty = NULL;
94cdf0e10cSrcweir 	XMLPropertyState* pPadding[4] = { NULL, NULL, NULL, NULL };
95cdf0e10cSrcweir 	XMLPropertyState* pNewPadding[4] = { NULL, NULL, NULL, NULL };
96cdf0e10cSrcweir 	XMLPropertyState* pAllBorderProperty = NULL;
97cdf0e10cSrcweir 	XMLPropertyState* pBorders[4] = { NULL, NULL, NULL, NULL };
98cdf0e10cSrcweir 	XMLPropertyState* pNewBorders[4] = { NULL, NULL, NULL, NULL };
99cdf0e10cSrcweir 	XMLPropertyState* pAllBorderWidthProperty = NULL;
100cdf0e10cSrcweir 	XMLPropertyState* pBorderWidths[4] = { NULL, NULL, NULL, NULL };
101cdf0e10cSrcweir 	XMLPropertyState* pAllHeaderPaddingProperty = NULL;
102cdf0e10cSrcweir 	XMLPropertyState* pHeaderPadding[4] = { NULL, NULL, NULL, NULL };
103cdf0e10cSrcweir 	XMLPropertyState* pHeaderNewPadding[4] = { NULL, NULL, NULL, NULL };
104cdf0e10cSrcweir 	XMLPropertyState* pAllHeaderBorderProperty = NULL;
105cdf0e10cSrcweir 	XMLPropertyState* pHeaderBorders[4] = { NULL, NULL, NULL, NULL };
106cdf0e10cSrcweir 	XMLPropertyState* pHeaderNewBorders[4] = { NULL, NULL, NULL, NULL };
107cdf0e10cSrcweir 	XMLPropertyState* pAllHeaderBorderWidthProperty = NULL;
108cdf0e10cSrcweir 	XMLPropertyState* pHeaderBorderWidths[4] = { NULL, NULL, NULL, NULL };
109cdf0e10cSrcweir 	XMLPropertyState* pAllFooterPaddingProperty = NULL;
110cdf0e10cSrcweir 	XMLPropertyState* pFooterPadding[4] = { NULL, NULL, NULL, NULL };
111cdf0e10cSrcweir 	XMLPropertyState* pFooterNewPadding[4] = { NULL, NULL, NULL, NULL };
112cdf0e10cSrcweir 	XMLPropertyState* pAllFooterBorderProperty = NULL;
113cdf0e10cSrcweir 	XMLPropertyState* pFooterBorders[4] = { NULL, NULL, NULL, NULL };
114cdf0e10cSrcweir 	XMLPropertyState* pFooterNewBorders[4] = { NULL, NULL, NULL, NULL };
115cdf0e10cSrcweir 	XMLPropertyState* pAllFooterBorderWidthProperty = NULL;
116cdf0e10cSrcweir 	XMLPropertyState* pFooterBorderWidths[4] = { NULL, NULL, NULL, NULL };
117cdf0e10cSrcweir 	XMLPropertyState* pHeaderHeight = NULL;
118cdf0e10cSrcweir 	XMLPropertyState* pHeaderMinHeight = NULL;
119cdf0e10cSrcweir 	XMLPropertyState* pHeaderDynamic = NULL;
120cdf0e10cSrcweir 	XMLPropertyState* pFooterHeight = NULL;
121cdf0e10cSrcweir 	XMLPropertyState* pFooterMinHeight = NULL;
122cdf0e10cSrcweir 	XMLPropertyState* pFooterDynamic = NULL;
123cdf0e10cSrcweir     XMLPropertyState* pAllMarginProperty = NULL;
124cdf0e10cSrcweir     XMLPropertyState* pMargins[4] = { NULL, NULL, NULL, NULL };
125cdf0e10cSrcweir     ::std::auto_ptr<XMLPropertyState> pNewMargins[4];
126cdf0e10cSrcweir     XMLPropertyState* pAllHeaderMarginProperty = NULL;
127cdf0e10cSrcweir     XMLPropertyState* pHeaderMargins[4] = { NULL, NULL, NULL, NULL };
128cdf0e10cSrcweir     ::std::auto_ptr<XMLPropertyState> pNewHeaderMargins[4];
129cdf0e10cSrcweir     XMLPropertyState* pAllFooterMarginProperty = NULL;
130cdf0e10cSrcweir     XMLPropertyState* pFooterMargins[4] = { NULL, NULL, NULL, NULL };
131cdf0e10cSrcweir     ::std::auto_ptr<XMLPropertyState> pNewFooterMargins[4];
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	::std::vector< XMLPropertyState >::iterator aEnd = rProperties.end();
134cdf0e10cSrcweir 	for (::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != aEnd; ++aIter)
135cdf0e10cSrcweir 	{
136cdf0e10cSrcweir 		XMLPropertyState *property = &(*aIter);
137cdf0e10cSrcweir 		sal_Int16 nContextID = getPropertySetMapper()->GetEntryContextId(property->mnIndex);
138cdf0e10cSrcweir 		if (property->mnIndex >= nStartIndex && property->mnIndex < nEndIndex)
139cdf0e10cSrcweir 		{
140cdf0e10cSrcweir 			switch (nContextID)
141cdf0e10cSrcweir 			{
142cdf0e10cSrcweir 				case CTF_PM_PADDINGALL					: pAllPaddingProperty = property; break;
143cdf0e10cSrcweir 				case CTF_PM_PADDINGLEFT					: pPadding[XML_LINE_LEFT] = property; break;
144cdf0e10cSrcweir 				case CTF_PM_PADDINGRIGHT				: pPadding[XML_LINE_RIGHT] = property; break;
145cdf0e10cSrcweir 				case CTF_PM_PADDINGTOP					: pPadding[XML_LINE_TOP] = property; break;
146cdf0e10cSrcweir 				case CTF_PM_PADDINGBOTTOM				: pPadding[XML_LINE_BOTTOM] = property; break;
147cdf0e10cSrcweir 				case CTF_PM_BORDERALL					: pAllBorderProperty = property; break;
148cdf0e10cSrcweir 				case CTF_PM_BORDERLEFT					: pBorders[XML_LINE_LEFT] = property; break;
149cdf0e10cSrcweir 				case CTF_PM_BORDERRIGHT					: pBorders[XML_LINE_RIGHT] = property; break;
150cdf0e10cSrcweir 				case CTF_PM_BORDERTOP					: pBorders[XML_LINE_TOP] = property; break;
151cdf0e10cSrcweir 				case CTF_PM_BORDERBOTTOM				: pBorders[XML_LINE_BOTTOM] = property; break;
152cdf0e10cSrcweir 				case CTF_PM_BORDERWIDTHALL				: pAllBorderWidthProperty = property; break;
153cdf0e10cSrcweir 				case CTF_PM_BORDERWIDTHLEFT				: pBorderWidths[XML_LINE_LEFT] = property; break;
154cdf0e10cSrcweir 				case CTF_PM_BORDERWIDTHRIGHT			: pBorderWidths[XML_LINE_RIGHT] = property; break;
155cdf0e10cSrcweir 				case CTF_PM_BORDERWIDTHTOP				: pBorderWidths[XML_LINE_TOP] = property; break;
156cdf0e10cSrcweir 				case CTF_PM_BORDERWIDTHBOTTOM			: pBorderWidths[XML_LINE_BOTTOM] = property; break;
157cdf0e10cSrcweir 				case CTF_PM_HEADERPADDINGALL			: pAllHeaderPaddingProperty = property; break;
158cdf0e10cSrcweir 				case CTF_PM_HEADERPADDINGLEFT			: pHeaderPadding[XML_LINE_LEFT] = property; break;
159cdf0e10cSrcweir 				case CTF_PM_HEADERPADDINGRIGHT			: pHeaderPadding[XML_LINE_RIGHT] = property; break;
160cdf0e10cSrcweir 				case CTF_PM_HEADERPADDINGTOP			: pHeaderPadding[XML_LINE_TOP] = property; break;
161cdf0e10cSrcweir 				case CTF_PM_HEADERPADDINGBOTTOM			: pHeaderPadding[XML_LINE_BOTTOM] = property; break;
162cdf0e10cSrcweir 				case CTF_PM_HEADERBORDERALL				: pAllHeaderBorderProperty = property; break;
163cdf0e10cSrcweir 				case CTF_PM_HEADERBORDERLEFT			: pHeaderBorders[XML_LINE_LEFT] = property; break;
164cdf0e10cSrcweir 				case CTF_PM_HEADERBORDERRIGHT			: pHeaderBorders[XML_LINE_RIGHT] = property; break;
165cdf0e10cSrcweir 				case CTF_PM_HEADERBORDERTOP				: pHeaderBorders[XML_LINE_TOP] = property; break;
166cdf0e10cSrcweir 				case CTF_PM_HEADERBORDERBOTTOM			: pHeaderBorders[XML_LINE_BOTTOM] = property; break;
167cdf0e10cSrcweir 				case CTF_PM_HEADERBORDERWIDTHALL		: pAllHeaderBorderWidthProperty = property; break;
168cdf0e10cSrcweir 				case CTF_PM_HEADERBORDERWIDTHLEFT		: pHeaderBorderWidths[XML_LINE_LEFT] = property; break;
169cdf0e10cSrcweir 				case CTF_PM_HEADERBORDERWIDTHRIGHT		: pHeaderBorderWidths[XML_LINE_RIGHT] = property; break;
170cdf0e10cSrcweir 				case CTF_PM_HEADERBORDERWIDTHTOP		: pHeaderBorderWidths[XML_LINE_TOP] = property; break;
171cdf0e10cSrcweir 				case CTF_PM_HEADERBORDERWIDTHBOTTOM		: pHeaderBorderWidths[XML_LINE_BOTTOM] = property; break;
172cdf0e10cSrcweir 				case CTF_PM_FOOTERPADDINGALL			: pAllFooterPaddingProperty = property; break;
173cdf0e10cSrcweir 				case CTF_PM_FOOTERPADDINGLEFT			: pFooterPadding[XML_LINE_LEFT] = property; break;
174cdf0e10cSrcweir 				case CTF_PM_FOOTERPADDINGRIGHT			: pFooterPadding[XML_LINE_RIGHT] = property; break;
175cdf0e10cSrcweir 				case CTF_PM_FOOTERPADDINGTOP			: pFooterPadding[XML_LINE_TOP] = property; break;
176cdf0e10cSrcweir 				case CTF_PM_FOOTERPADDINGBOTTOM			: pFooterPadding[XML_LINE_BOTTOM] = property; break;
177cdf0e10cSrcweir 				case CTF_PM_FOOTERBORDERALL				: pAllFooterBorderProperty = property; break;
178cdf0e10cSrcweir 				case CTF_PM_FOOTERBORDERLEFT			: pFooterBorders[XML_LINE_LEFT] = property; break;
179cdf0e10cSrcweir 				case CTF_PM_FOOTERBORDERRIGHT			: pFooterBorders[XML_LINE_RIGHT] = property; break;
180cdf0e10cSrcweir 				case CTF_PM_FOOTERBORDERTOP				: pFooterBorders[XML_LINE_TOP] = property; break;
181cdf0e10cSrcweir 				case CTF_PM_FOOTERBORDERBOTTOM			: pFooterBorders[XML_LINE_BOTTOM] = property; break;
182cdf0e10cSrcweir 				case CTF_PM_FOOTERBORDERWIDTHALL		: pAllFooterBorderWidthProperty = property; break;
183cdf0e10cSrcweir 				case CTF_PM_FOOTERBORDERWIDTHLEFT		: pFooterBorderWidths[XML_LINE_LEFT] = property; break;
184cdf0e10cSrcweir 				case CTF_PM_FOOTERBORDERWIDTHRIGHT		: pFooterBorderWidths[XML_LINE_RIGHT] = property; break;
185cdf0e10cSrcweir 				case CTF_PM_FOOTERBORDERWIDTHTOP		: pFooterBorderWidths[XML_LINE_TOP] = property; break;
186cdf0e10cSrcweir 				case CTF_PM_FOOTERBORDERWIDTHBOTTOM		: pFooterBorderWidths[XML_LINE_BOTTOM] = property; break;
187cdf0e10cSrcweir 				case CTF_PM_HEADERHEIGHT				: pHeaderHeight = property; break;
188cdf0e10cSrcweir 				case CTF_PM_HEADERMINHEIGHT				: pHeaderMinHeight = property; break;
189cdf0e10cSrcweir 				case CTF_PM_FOOTERHEIGHT				: pFooterHeight = property; break;
190cdf0e10cSrcweir 				case CTF_PM_FOOTERMINHEIGHT				: pFooterMinHeight = property; break;
191cdf0e10cSrcweir                 case CTF_PM_MARGINALL   :
192cdf0e10cSrcweir                       pAllMarginProperty = property; break;
193cdf0e10cSrcweir                 case CTF_PM_MARGINTOP   :
194cdf0e10cSrcweir                       pMargins[XML_LINE_TOP] = property; break;
195cdf0e10cSrcweir                 case CTF_PM_MARGINBOTTOM:
196cdf0e10cSrcweir                       pMargins[XML_LINE_BOTTOM] = property; break;
197cdf0e10cSrcweir                 case CTF_PM_MARGINLEFT  :
198cdf0e10cSrcweir                       pMargins[XML_LINE_LEFT] = property; break;
199cdf0e10cSrcweir                 case CTF_PM_MARGINRIGHT :
200cdf0e10cSrcweir                       pMargins[XML_LINE_RIGHT] = property; break;
201cdf0e10cSrcweir                 case CTF_PM_HEADERMARGINALL   :
202cdf0e10cSrcweir                       pAllHeaderMarginProperty = property; break;
203cdf0e10cSrcweir                 case CTF_PM_HEADERMARGINTOP   :
204cdf0e10cSrcweir                       pHeaderMargins[XML_LINE_TOP] = property; break;
205cdf0e10cSrcweir                 case CTF_PM_HEADERMARGINBOTTOM:
206cdf0e10cSrcweir                       pHeaderMargins[XML_LINE_BOTTOM] = property; break;
207cdf0e10cSrcweir                 case CTF_PM_HEADERMARGINLEFT  :
208cdf0e10cSrcweir                       pHeaderMargins[XML_LINE_LEFT] = property; break;
209cdf0e10cSrcweir                 case CTF_PM_HEADERMARGINRIGHT :
210cdf0e10cSrcweir                       pHeaderMargins[XML_LINE_RIGHT] = property; break;
211cdf0e10cSrcweir                 case CTF_PM_FOOTERMARGINALL   :
212cdf0e10cSrcweir                       pAllFooterMarginProperty = property; break;
213cdf0e10cSrcweir                 case CTF_PM_FOOTERMARGINTOP   :
214cdf0e10cSrcweir                       pFooterMargins[XML_LINE_TOP] = property; break;
215cdf0e10cSrcweir                 case CTF_PM_FOOTERMARGINBOTTOM:
216cdf0e10cSrcweir                       pFooterMargins[XML_LINE_BOTTOM] = property; break;
217cdf0e10cSrcweir                 case CTF_PM_FOOTERMARGINLEFT  :
218cdf0e10cSrcweir                       pFooterMargins[XML_LINE_LEFT] = property; break;
219cdf0e10cSrcweir                 case CTF_PM_FOOTERMARGINRIGHT :
220cdf0e10cSrcweir                       pFooterMargins[XML_LINE_RIGHT] = property; break;
221cdf0e10cSrcweir 			}
222cdf0e10cSrcweir 		}
223cdf0e10cSrcweir 	}
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 	for (sal_uInt16 i = 0; i < 4; i++)
226cdf0e10cSrcweir 	{
227cdf0e10cSrcweir         if (pAllMarginProperty && !pMargins[i])
228cdf0e10cSrcweir         {
229cdf0e10cSrcweir             pNewMargins[i].reset(new XMLPropertyState(
230cdf0e10cSrcweir                 pAllMarginProperty->mnIndex + 1 + i,
231cdf0e10cSrcweir                 pAllMarginProperty->maValue));
232cdf0e10cSrcweir         }
233cdf0e10cSrcweir         if (pAllHeaderMarginProperty && !pHeaderMargins[i])
234cdf0e10cSrcweir         {
235cdf0e10cSrcweir             pNewHeaderMargins[i].reset(new XMLPropertyState(
236cdf0e10cSrcweir                 pAllHeaderMarginProperty->mnIndex + 1 + i,
237cdf0e10cSrcweir                 pAllHeaderMarginProperty->maValue));
238cdf0e10cSrcweir         }
239cdf0e10cSrcweir         if (pAllFooterMarginProperty && !pFooterMargins[i])
240cdf0e10cSrcweir         {
241cdf0e10cSrcweir             pNewFooterMargins[i].reset(new XMLPropertyState(
242cdf0e10cSrcweir                 pAllFooterMarginProperty->mnIndex + 1 + i,
243cdf0e10cSrcweir                 pAllFooterMarginProperty->maValue));
244cdf0e10cSrcweir         }
245cdf0e10cSrcweir 		if (pAllPaddingProperty && !pPadding[i])
246cdf0e10cSrcweir 			pNewPadding[i] = new XMLPropertyState(pAllPaddingProperty->mnIndex + 1 + i, pAllPaddingProperty->maValue);
247cdf0e10cSrcweir 		if (pAllBorderProperty && !pBorders[i])
248cdf0e10cSrcweir 		{
249cdf0e10cSrcweir 			pNewBorders[i] = new XMLPropertyState(pAllBorderProperty->mnIndex + 1 + i, pAllBorderProperty->maValue);
250cdf0e10cSrcweir 			pBorders[i] = pNewBorders[i];
251cdf0e10cSrcweir 		}
252cdf0e10cSrcweir 		if( !pBorderWidths[i] )
253cdf0e10cSrcweir 			pBorderWidths[i] = pAllBorderWidthProperty;
254cdf0e10cSrcweir 		else
255cdf0e10cSrcweir 			pBorderWidths[i]->mnIndex = -1;
256cdf0e10cSrcweir 		if( pBorders[i] )
257cdf0e10cSrcweir 		{
258cdf0e10cSrcweir 			table::BorderLine aBorderLine;
259cdf0e10cSrcweir 			pBorders[i]->maValue >>= aBorderLine;
260cdf0e10cSrcweir  			if( pBorderWidths[i] )
261cdf0e10cSrcweir 			{
262cdf0e10cSrcweir 				table::BorderLine aBorderLineWidth;
263cdf0e10cSrcweir 				pBorderWidths[i]->maValue >>= aBorderLineWidth;
264cdf0e10cSrcweir 				aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
265cdf0e10cSrcweir 				aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
266cdf0e10cSrcweir 				aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
267cdf0e10cSrcweir 				pBorders[i]->maValue <<= aBorderLine;
268cdf0e10cSrcweir 			}
269cdf0e10cSrcweir 		}
270cdf0e10cSrcweir 		if (pAllHeaderPaddingProperty && !pHeaderPadding[i])
271cdf0e10cSrcweir 			pHeaderNewPadding[i] = new XMLPropertyState(pAllHeaderPaddingProperty->mnIndex + 1 + i, pAllHeaderPaddingProperty->maValue);
272cdf0e10cSrcweir 		if (pAllHeaderBorderProperty && !pHeaderBorders[i])
273cdf0e10cSrcweir 			pHeaderNewBorders[i] = new XMLPropertyState(pAllHeaderBorderProperty->mnIndex + 1 + i, pAllHeaderBorderProperty->maValue);
274cdf0e10cSrcweir 		if( !pHeaderBorderWidths[i] )
275cdf0e10cSrcweir 			pHeaderBorderWidths[i] = pAllHeaderBorderWidthProperty;
276cdf0e10cSrcweir 		else
277cdf0e10cSrcweir 			pHeaderBorderWidths[i]->mnIndex = -1;
278cdf0e10cSrcweir 		if( pHeaderBorders[i] )
279cdf0e10cSrcweir 		{
280cdf0e10cSrcweir 			table::BorderLine aBorderLine;
281cdf0e10cSrcweir 			pHeaderBorders[i]->maValue >>= aBorderLine;
282cdf0e10cSrcweir  			if( pHeaderBorderWidths[i] )
283cdf0e10cSrcweir 			{
284cdf0e10cSrcweir 				table::BorderLine aBorderLineWidth;
285cdf0e10cSrcweir 				pHeaderBorderWidths[i]->maValue >>= aBorderLineWidth;
286cdf0e10cSrcweir 				aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
287cdf0e10cSrcweir 				aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
288cdf0e10cSrcweir 				aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
289cdf0e10cSrcweir 				pHeaderBorders[i]->maValue <<= aBorderLine;
290cdf0e10cSrcweir 			}
291cdf0e10cSrcweir 		}
292cdf0e10cSrcweir 		if (pAllFooterPaddingProperty && !pFooterPadding[i])
293cdf0e10cSrcweir 			pFooterNewPadding[i] = new XMLPropertyState(pAllFooterPaddingProperty->mnIndex + 1 + i, pAllFooterPaddingProperty->maValue);
294cdf0e10cSrcweir 		if (pAllFooterBorderProperty && !pFooterBorders[i])
295cdf0e10cSrcweir 			pFooterNewBorders[i] = new XMLPropertyState(pAllFooterBorderProperty->mnIndex + 1 + i, pAllFooterBorderProperty->maValue);
296cdf0e10cSrcweir 		if( !pFooterBorderWidths[i] )
297cdf0e10cSrcweir 			pFooterBorderWidths[i] = pAllFooterBorderWidthProperty;
298cdf0e10cSrcweir 		else
299cdf0e10cSrcweir 			pFooterBorderWidths[i]->mnIndex = -1;
300cdf0e10cSrcweir 		if( pFooterBorders[i] )
301cdf0e10cSrcweir 		{
302cdf0e10cSrcweir 			table::BorderLine aBorderLine;
303cdf0e10cSrcweir 			pFooterBorders[i]->maValue >>= aBorderLine;
304cdf0e10cSrcweir  			if( pFooterBorderWidths[i] )
305cdf0e10cSrcweir 			{
306cdf0e10cSrcweir 				table::BorderLine aBorderLineWidth;
307cdf0e10cSrcweir 				pFooterBorderWidths[i]->maValue >>= aBorderLineWidth;
308cdf0e10cSrcweir 				aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
309cdf0e10cSrcweir 				aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
310cdf0e10cSrcweir 				aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
311cdf0e10cSrcweir 				pFooterBorders[i]->maValue <<= aBorderLine;
312cdf0e10cSrcweir 			}
313cdf0e10cSrcweir 		}
314cdf0e10cSrcweir 	}
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 	if (pHeaderHeight)
317cdf0e10cSrcweir 	{
318cdf0e10cSrcweir 		sal_Bool bValue(sal_False);
319cdf0e10cSrcweir 		uno::Any aAny;
320cdf0e10cSrcweir 		aAny.setValue( &bValue, ::getBooleanCppuType() );
321cdf0e10cSrcweir 		pHeaderDynamic = new XMLPropertyState(pHeaderHeight->mnIndex + 2, aAny);
322cdf0e10cSrcweir 	}
323cdf0e10cSrcweir 	if (pHeaderMinHeight)
324cdf0e10cSrcweir 	{
325cdf0e10cSrcweir 		sal_Bool bValue(sal_True);
326cdf0e10cSrcweir 		uno::Any aAny;
327cdf0e10cSrcweir 		aAny.setValue( &bValue, ::getBooleanCppuType() );
328cdf0e10cSrcweir 		pHeaderDynamic = new XMLPropertyState(pHeaderMinHeight->mnIndex + 1, aAny);
329cdf0e10cSrcweir 	}
330cdf0e10cSrcweir 	if (pFooterHeight)
331cdf0e10cSrcweir 	{
332cdf0e10cSrcweir 		sal_Bool bValue(sal_False);
333cdf0e10cSrcweir 		uno::Any aAny;
334cdf0e10cSrcweir 		aAny.setValue( &bValue, ::getBooleanCppuType() );
335cdf0e10cSrcweir 		pFooterDynamic = new XMLPropertyState(pFooterHeight->mnIndex + 2, aAny);
336cdf0e10cSrcweir 	}
337cdf0e10cSrcweir 	if (pFooterMinHeight)
338cdf0e10cSrcweir 	{
339cdf0e10cSrcweir 		sal_Bool bValue(sal_True);
340cdf0e10cSrcweir 		uno::Any aAny;
341cdf0e10cSrcweir 		aAny.setValue( &bValue, ::getBooleanCppuType() );
342cdf0e10cSrcweir 		pFooterDynamic = new XMLPropertyState(pFooterMinHeight->mnIndex + 1, aAny);
343cdf0e10cSrcweir 	}
344cdf0e10cSrcweir     for (sal_uInt16 i = 0; i < 4; i++)
345cdf0e10cSrcweir     {
346cdf0e10cSrcweir         if (pNewMargins[i].get())
347cdf0e10cSrcweir         {
348cdf0e10cSrcweir             rProperties.push_back(*pNewMargins[i]);
349cdf0e10cSrcweir         }
350cdf0e10cSrcweir         if (pNewHeaderMargins[i].get())
351cdf0e10cSrcweir         {
352cdf0e10cSrcweir             rProperties.push_back(*pNewHeaderMargins[i]);
353cdf0e10cSrcweir         }
354cdf0e10cSrcweir         if (pNewFooterMargins[i].get())
355cdf0e10cSrcweir         {
356cdf0e10cSrcweir             rProperties.push_back(*pNewFooterMargins[i]);
357cdf0e10cSrcweir         }
358cdf0e10cSrcweir 		if (pNewPadding[i])
359cdf0e10cSrcweir 		{
360cdf0e10cSrcweir 			rProperties.push_back(*pNewPadding[i]);
361cdf0e10cSrcweir 			delete pNewPadding[i];
362cdf0e10cSrcweir 		}
363cdf0e10cSrcweir 		if (pNewBorders[i])
364cdf0e10cSrcweir 		{
365cdf0e10cSrcweir 			rProperties.push_back(*pNewBorders[i]);
366cdf0e10cSrcweir 			delete pNewBorders[i];
367cdf0e10cSrcweir 		}
368cdf0e10cSrcweir 		if (pHeaderNewPadding[i])
369cdf0e10cSrcweir 		{
370cdf0e10cSrcweir 			rProperties.push_back(*pHeaderNewPadding[i]);
371cdf0e10cSrcweir 			delete pHeaderNewPadding[i];
372cdf0e10cSrcweir 		}
373cdf0e10cSrcweir 		if (pHeaderNewBorders[i])
374cdf0e10cSrcweir 		{
375cdf0e10cSrcweir 			rProperties.push_back(*pHeaderNewBorders[i]);
376cdf0e10cSrcweir 			delete pHeaderNewBorders[i];
377cdf0e10cSrcweir 		}
378cdf0e10cSrcweir 		if (pFooterNewPadding[i])
379cdf0e10cSrcweir 		{
380cdf0e10cSrcweir 			rProperties.push_back(*pFooterNewPadding[i]);
381cdf0e10cSrcweir 			delete pFooterNewPadding[i];
382cdf0e10cSrcweir 		}
383cdf0e10cSrcweir 		if (pFooterNewBorders[i])
384cdf0e10cSrcweir 		{
385cdf0e10cSrcweir 			rProperties.push_back(*pFooterNewBorders[i]);
386cdf0e10cSrcweir 			delete pFooterNewBorders[i];
387cdf0e10cSrcweir 		}
388cdf0e10cSrcweir 	}
389cdf0e10cSrcweir 	if(pHeaderDynamic)
390cdf0e10cSrcweir 	{
391cdf0e10cSrcweir 		rProperties.push_back(*pHeaderDynamic);
392cdf0e10cSrcweir 		delete pHeaderDynamic;
393cdf0e10cSrcweir 	}
394cdf0e10cSrcweir 	if(pFooterDynamic)
395cdf0e10cSrcweir 	{
396cdf0e10cSrcweir 		rProperties.push_back(*pFooterDynamic);
397cdf0e10cSrcweir 		delete pFooterDynamic;
398cdf0e10cSrcweir 	}
399cdf0e10cSrcweir }
400cdf0e10cSrcweir 
401