163bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
363bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
463bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
563bba73cSAndrew Rist  * distributed with this work for additional information
663bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
763bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
863bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
963bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
1063bba73cSAndrew Rist  *
1163bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1263bba73cSAndrew Rist  *
1363bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1463bba73cSAndrew Rist  * software distributed under the License is distributed on an
1563bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1663bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
1763bba73cSAndrew Rist  * specific language governing permissions and limitations
1863bba73cSAndrew Rist  * under the License.
1963bba73cSAndrew Rist  *
2063bba73cSAndrew Rist  *************************************************************/
2163bba73cSAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include "PageMasterImportContext.hxx"
26cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
27cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
28cdf0e10cSrcweir #include "PageMasterPropHdl.hxx"
29cdf0e10cSrcweir #include "PagePropertySetContext.hxx"
30cdf0e10cSrcweir #include "PageHeaderFooterContext.hxx"
31cdf0e10cSrcweir #include "PageMasterPropMapper.hxx"
32cdf0e10cSrcweir #include "PageMasterImportPropMapper.hxx"
33cdf0e10cSrcweir #include <xmloff/PageMasterStyleMap.hxx>
34cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35cdf0e10cSrcweir 
36*56b35d86SArmin Le Grand //UUUU
37*56b35d86SArmin Le Grand #include <xmlsdtypes.hxx>
38*56b35d86SArmin Le Grand #include <com/sun/star/beans/XPropertySetInfo.hpp>
39*56b35d86SArmin Le Grand #include <xmloff/xmlerror.hxx>
40*56b35d86SArmin Le Grand 
41cdf0e10cSrcweir using namespace ::com::sun::star;
42cdf0e10cSrcweir using namespace ::xmloff::token;
43cdf0e10cSrcweir using namespace ::com::sun::star::uno;
44cdf0e10cSrcweir using namespace ::com::sun::star::lang;
45cdf0e10cSrcweir 
46*56b35d86SArmin Le Grand //UUUU
47*56b35d86SArmin Le Grand using namespace ::com::sun::star::beans;
48*56b35d86SArmin Le Grand 
SetAttribute(sal_uInt16 nPrefixKey,const rtl::OUString & rLocalName,const rtl::OUString & rValue)49cdf0e10cSrcweir void PageStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
50cdf0e10cSrcweir                                         const rtl::OUString& rLocalName,
51cdf0e10cSrcweir                                         const rtl::OUString& rValue )
52cdf0e10cSrcweir {
53cdf0e10cSrcweir     // TODO: use a map here
54cdf0e10cSrcweir     if( XML_NAMESPACE_STYLE == nPrefixKey && IsXMLToken( rLocalName, XML_PAGE_USAGE ) )
55cdf0e10cSrcweir     {
56cdf0e10cSrcweir         sPageUsage = rValue;
57cdf0e10cSrcweir     }
58cdf0e10cSrcweir     else
59cdf0e10cSrcweir     {
60cdf0e10cSrcweir         XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
61cdf0e10cSrcweir     }
62cdf0e10cSrcweir }
63cdf0e10cSrcweir 
64cdf0e10cSrcweir TYPEINIT1( PageStyleContext, XMLPropStyleContext );
65cdf0e10cSrcweir 
PageStyleContext(SvXMLImport & rImport,sal_uInt16 nPrfx,const rtl::OUString & rLName,const uno::Reference<xml::sax::XAttributeList> & xAttrList,SvXMLStylesContext & rStyles,sal_Bool bDefaultStyle)66cdf0e10cSrcweir PageStyleContext::PageStyleContext( SvXMLImport& rImport,
67cdf0e10cSrcweir         sal_uInt16 nPrfx, const rtl::OUString& rLName,
68cdf0e10cSrcweir         const uno::Reference< xml::sax::XAttributeList > & xAttrList,
69cdf0e10cSrcweir         SvXMLStylesContext& rStyles,
70cdf0e10cSrcweir         sal_Bool bDefaultStyle) :
71cdf0e10cSrcweir     XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, XML_STYLE_FAMILY_PAGE_MASTER, bDefaultStyle),
72*56b35d86SArmin Le Grand     sPageUsage(),
73*56b35d86SArmin Le Grand     m_bIsFillStyleAlreadyConverted(false) //UUUU
74cdf0e10cSrcweir {
75cdf0e10cSrcweir }
76cdf0e10cSrcweir 
~PageStyleContext()77cdf0e10cSrcweir PageStyleContext::~PageStyleContext()
78cdf0e10cSrcweir {
79cdf0e10cSrcweir }
80cdf0e10cSrcweir 
CreateChildContext(sal_uInt16 nPrefix,const rtl::OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList)81cdf0e10cSrcweir SvXMLImportContext *PageStyleContext::CreateChildContext(
82cdf0e10cSrcweir         sal_uInt16 nPrefix,
83cdf0e10cSrcweir         const rtl::OUString& rLocalName,
84cdf0e10cSrcweir         const uno::Reference< xml::sax::XAttributeList > & xAttrList )
85cdf0e10cSrcweir {
86cdf0e10cSrcweir     SvXMLImportContext *pContext = NULL;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     if( XML_NAMESPACE_STYLE == nPrefix &&
89cdf0e10cSrcweir         ((IsXMLToken(rLocalName, XML_HEADER_STYLE )) ||
90cdf0e10cSrcweir          (IsXMLToken(rLocalName, XML_FOOTER_STYLE )) ) )
91cdf0e10cSrcweir     {
92cdf0e10cSrcweir         sal_Bool bHeader = IsXMLToken(rLocalName, XML_HEADER_STYLE);
93cdf0e10cSrcweir         UniReference < SvXMLImportPropertyMapper > xImpPrMap =
94cdf0e10cSrcweir             GetStyles()->GetImportPropertyMapper( GetFamily() );
95cdf0e10cSrcweir         if( xImpPrMap.is() )
96cdf0e10cSrcweir         {
97cdf0e10cSrcweir             const UniReference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper();
98cdf0e10cSrcweir             sal_Int32 nFlag;
99cdf0e10cSrcweir             if (bHeader)
100cdf0e10cSrcweir                 nFlag = CTF_PM_HEADERFLAG;
101cdf0e10cSrcweir             else
102cdf0e10cSrcweir                 nFlag = CTF_PM_FOOTERFLAG;
103cdf0e10cSrcweir             sal_Int32 nStartIndex (-1);
104cdf0e10cSrcweir             sal_Int32 nEndIndex (-1);
105cdf0e10cSrcweir             sal_Bool bFirst(sal_False);
106cdf0e10cSrcweir             sal_Bool bEnd(sal_False);
107cdf0e10cSrcweir             sal_Int32 nIndex = 0;
108cdf0e10cSrcweir             while ( nIndex < rMapper->GetEntryCount() && !bEnd)
109cdf0e10cSrcweir             {
110cdf0e10cSrcweir                 if ((rMapper->GetEntryContextId( nIndex ) & CTF_PM_FLAGMASK) == nFlag)
111cdf0e10cSrcweir                 {
112cdf0e10cSrcweir                     if (!bFirst)
113cdf0e10cSrcweir                     {
114cdf0e10cSrcweir                         bFirst = sal_True;
115cdf0e10cSrcweir                         nStartIndex = nIndex;
116cdf0e10cSrcweir                     }
117cdf0e10cSrcweir                 }
118cdf0e10cSrcweir                 else if (bFirst)
119cdf0e10cSrcweir                 {
120cdf0e10cSrcweir                     bEnd = sal_True;
121cdf0e10cSrcweir                     nEndIndex = nIndex;
122cdf0e10cSrcweir                 }
123cdf0e10cSrcweir                 nIndex++;
124cdf0e10cSrcweir             }
125cdf0e10cSrcweir             if (!bEnd)
126cdf0e10cSrcweir                 nEndIndex = nIndex;
127cdf0e10cSrcweir             pContext = new PageHeaderFooterContext(GetImport(), nPrefix, rLocalName,
128cdf0e10cSrcweir                             xAttrList, GetProperties(), xImpPrMap, nStartIndex, nEndIndex, bHeader);
129cdf0e10cSrcweir         }
130cdf0e10cSrcweir     }
131cdf0e10cSrcweir     if( XML_NAMESPACE_STYLE == nPrefix &&
132cdf0e10cSrcweir         IsXMLToken(rLocalName, XML_PAGE_LAYOUT_PROPERTIES) )
133cdf0e10cSrcweir     {
134cdf0e10cSrcweir         UniReference < SvXMLImportPropertyMapper > xImpPrMap =
135cdf0e10cSrcweir             GetStyles()->GetImportPropertyMapper( GetFamily() );
136cdf0e10cSrcweir         if( xImpPrMap.is() )
137cdf0e10cSrcweir         {
138cdf0e10cSrcweir             const UniReference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper();
139cdf0e10cSrcweir             sal_Int32 nEndIndex (-1);
140cdf0e10cSrcweir             sal_Bool bEnd(sal_False);
141cdf0e10cSrcweir             sal_Int32 nIndex = 0;
142cdf0e10cSrcweir             sal_Int16 nContextID;
143cdf0e10cSrcweir             while ( nIndex < rMapper->GetEntryCount() && !bEnd)
144cdf0e10cSrcweir             {
145cdf0e10cSrcweir                 nContextID = rMapper->GetEntryContextId( nIndex );
146cdf0e10cSrcweir                 if (nContextID && ((nContextID & CTF_PM_FLAGMASK) != XML_PM_CTF_START))
147cdf0e10cSrcweir                 {
148cdf0e10cSrcweir                     nEndIndex = nIndex;
149cdf0e10cSrcweir                     bEnd = sal_True;
150cdf0e10cSrcweir                 }
151cdf0e10cSrcweir                 nIndex++;
152cdf0e10cSrcweir             }
153cdf0e10cSrcweir             if (!bEnd)
154cdf0e10cSrcweir                 nEndIndex = nIndex;
155cdf0e10cSrcweir             PageContextType aType = Page;
156cdf0e10cSrcweir             pContext = new PagePropertySetContext( GetImport(), nPrefix,
157cdf0e10cSrcweir                                                     rLocalName, xAttrList,
158cdf0e10cSrcweir 													XML_TYPE_PROP_PAGE_LAYOUT,
159cdf0e10cSrcweir                                                     GetProperties(),
160cdf0e10cSrcweir                                                     xImpPrMap, 0, nEndIndex, aType);
161cdf0e10cSrcweir         }
162cdf0e10cSrcweir     }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     if (!pContext)
165cdf0e10cSrcweir         pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
166cdf0e10cSrcweir                                                            xAttrList );
167cdf0e10cSrcweir     return pContext;
168cdf0e10cSrcweir }
169cdf0e10cSrcweir 
FillPropertySet(const uno::Reference<beans::XPropertySet> & rPropSet)170*56b35d86SArmin Le Grand void PageStyleContext::FillPropertySet(const uno::Reference<beans::XPropertySet > & rPropSet)
171cdf0e10cSrcweir {
172*56b35d86SArmin Le Grand     //UUUU need to filter out old fill definitions when the new ones are used. The new
173*56b35d86SArmin Le Grand     // ones are used when a FillStyle is defined
174*56b35d86SArmin Le Grand     if(!m_bIsFillStyleAlreadyConverted && GetProperties().size())
175*56b35d86SArmin Le Grand     {
176*56b35d86SArmin Le Grand         static ::rtl::OUString s_FillStyle(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));
177*56b35d86SArmin Le Grand         static ::rtl::OUString s_HeaderFillStyle(RTL_CONSTASCII_USTRINGPARAM("HeaderFillStyle"));
178*56b35d86SArmin Le Grand         static ::rtl::OUString s_FooterFillStyle(RTL_CONSTASCII_USTRINGPARAM("FooterFillStyle"));
179*56b35d86SArmin Le Grand 
180*56b35d86SArmin Le Grand         if(doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle))
181*56b35d86SArmin Le Grand         {
182*56b35d86SArmin Le Grand             deactivateOldFillStyleDefinitions(getStandardSet());
183*56b35d86SArmin Le Grand         }
184*56b35d86SArmin Le Grand 
185*56b35d86SArmin Le Grand         if(doNewDrawingLayerFillStyleDefinitionsExist(s_HeaderFillStyle))
186*56b35d86SArmin Le Grand         {
187*56b35d86SArmin Le Grand             deactivateOldFillStyleDefinitions(getHeaderSet());
188*56b35d86SArmin Le Grand         }
189*56b35d86SArmin Le Grand 
190*56b35d86SArmin Le Grand         if(doNewDrawingLayerFillStyleDefinitionsExist(s_FooterFillStyle))
191*56b35d86SArmin Le Grand         {
192*56b35d86SArmin Le Grand             deactivateOldFillStyleDefinitions(getFooterSet());
193*56b35d86SArmin Le Grand         }
194*56b35d86SArmin Le Grand 
195*56b35d86SArmin Le Grand         m_bIsFillStyleAlreadyConverted = true;
196*56b35d86SArmin Le Grand     }
197*56b35d86SArmin Le Grand 
198*56b35d86SArmin Le Grand     //UUUU do not use XMLPropStyleContext::FillPropertySet, we need to handle this ourselves since
199*56b35d86SArmin Le Grand     // we have properties which use the MID_FLAG_NO_PROPERTY_IMPORT flag since they need some special
200*56b35d86SArmin Le Grand     // handling
201*56b35d86SArmin Le Grand     UniReference < SvXMLImportPropertyMapper > xImpPrMap = GetStyles()->GetImportPropertyMapper(GetFamily());
202*56b35d86SArmin Le Grand 
203*56b35d86SArmin Le Grand     if(xImpPrMap.is())
204*56b35d86SArmin Le Grand     {
205*56b35d86SArmin Le Grand         // properties that need special handling because they need the used name to be translated first
206*56b35d86SArmin Le Grand         struct _ContextID_Index_Pair aContextIDs[] =
207*56b35d86SArmin Le Grand         {
208*56b35d86SArmin Le Grand             { CTF_PM_FILLGRADIENTNAME, -1 },
209*56b35d86SArmin Le Grand             { CTF_PM_FILLTRANSNAME, -1 },
210*56b35d86SArmin Le Grand             { CTF_PM_FILLHATCHNAME, -1 },
211*56b35d86SArmin Le Grand             { CTF_PM_FILLBITMAPNAME, -1 },
212*56b35d86SArmin Le Grand 
213*56b35d86SArmin Le Grand             // also need to special handling for header entries
214*56b35d86SArmin Le Grand             { CTF_PM_HEADERFILLGRADIENTNAME, -1 },
215*56b35d86SArmin Le Grand             { CTF_PM_HEADERFILLTRANSNAME, -1 },
216*56b35d86SArmin Le Grand             { CTF_PM_HEADERFILLHATCHNAME, -1 },
217*56b35d86SArmin Le Grand             { CTF_PM_HEADERFILLBITMAPNAME, -1 },
218*56b35d86SArmin Le Grand 
219*56b35d86SArmin Le Grand             // also need to special handling for footer entries
220*56b35d86SArmin Le Grand             { CTF_PM_FOOTERFILLGRADIENTNAME, -1 },
221*56b35d86SArmin Le Grand             { CTF_PM_FOOTERFILLTRANSNAME, -1 },
222*56b35d86SArmin Le Grand             { CTF_PM_FOOTERFILLHATCHNAME, -1 },
223*56b35d86SArmin Le Grand             { CTF_PM_FOOTERFILLBITMAPNAME, -1 },
224*56b35d86SArmin Le Grand 
225*56b35d86SArmin Le Grand             {-1, -1}
226*56b35d86SArmin Le Grand         };
227*56b35d86SArmin Le Grand 
228*56b35d86SArmin Le Grand         // the style families associated with the same index modulo 4
229*56b35d86SArmin Le Grand         static sal_uInt16 aFamilies[] =
230*56b35d86SArmin Le Grand         {
231*56b35d86SArmin Le Grand             XML_STYLE_FAMILY_SD_GRADIENT_ID,
232*56b35d86SArmin Le Grand             XML_STYLE_FAMILY_SD_GRADIENT_ID,
233*56b35d86SArmin Le Grand             XML_STYLE_FAMILY_SD_HATCH_ID,
234*56b35d86SArmin Le Grand             XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
235*56b35d86SArmin Le Grand         };
236*56b35d86SArmin Le Grand 
237*56b35d86SArmin Le Grand         //UUUU Fill PropertySet, but let it handle special properties not itself
238*56b35d86SArmin Le Grand         xImpPrMap->FillPropertySet(GetProperties(), rPropSet, aContextIDs);
239*56b35d86SArmin Le Grand 
240*56b35d86SArmin Le Grand         // get property set mapper
241*56b35d86SArmin Le Grand         const UniReference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper();
242*56b35d86SArmin Le Grand         Reference< XPropertySetInfo > xInfo;
243*56b35d86SArmin Le Grand 
244*56b35d86SArmin Le Grand         //UUUU handle special attributes which have MID_FLAG_NO_PROPERTY_IMPORT set
245*56b35d86SArmin Le Grand         for(sal_uInt16 i = 0; aContextIDs[i].nContextID != -1; i++)
246*56b35d86SArmin Le Grand         {
247*56b35d86SArmin Le Grand             sal_Int32 nIndex = aContextIDs[i].nIndex;
248*56b35d86SArmin Le Grand 
249*56b35d86SArmin Le Grand             if(nIndex != -1)
250*56b35d86SArmin Le Grand             {
251*56b35d86SArmin Le Grand                 switch(aContextIDs[i].nContextID)
252*56b35d86SArmin Le Grand                 {
253*56b35d86SArmin Le Grand                     case CTF_PM_FILLGRADIENTNAME:
254*56b35d86SArmin Le Grand                     case CTF_PM_FILLTRANSNAME:
255*56b35d86SArmin Le Grand                     case CTF_PM_FILLHATCHNAME:
256*56b35d86SArmin Le Grand                     case CTF_PM_FILLBITMAPNAME:
257*56b35d86SArmin Le Grand 
258*56b35d86SArmin Le Grand                     case CTF_PM_HEADERFILLGRADIENTNAME:
259*56b35d86SArmin Le Grand                     case CTF_PM_HEADERFILLTRANSNAME:
260*56b35d86SArmin Le Grand                     case CTF_PM_HEADERFILLHATCHNAME:
261*56b35d86SArmin Le Grand                     case CTF_PM_HEADERFILLBITMAPNAME:
262*56b35d86SArmin Le Grand 
263*56b35d86SArmin Le Grand                     case CTF_PM_FOOTERFILLGRADIENTNAME:
264*56b35d86SArmin Le Grand                     case CTF_PM_FOOTERFILLTRANSNAME:
265*56b35d86SArmin Le Grand                     case CTF_PM_FOOTERFILLHATCHNAME:
266*56b35d86SArmin Le Grand                     case CTF_PM_FOOTERFILLBITMAPNAME:
267*56b35d86SArmin Le Grand                     {
268*56b35d86SArmin Le Grand                         struct XMLPropertyState& rState = GetProperties()[nIndex];
269*56b35d86SArmin Le Grand                         rtl::OUString sStyleName;
270*56b35d86SArmin Le Grand                         rState.maValue >>= sStyleName;
271*56b35d86SArmin Le Grand 
272*56b35d86SArmin Le Grand                         //UUUU translate the used name from ODF intern to the name used in the Model
273*56b35d86SArmin Le Grand                         sStyleName = GetImport().GetStyleDisplayName(aFamilies[i%4], sStyleName);
274*56b35d86SArmin Le Grand 
275*56b35d86SArmin Le Grand                         try
276*56b35d86SArmin Le Grand                         {
277*56b35d86SArmin Le Grand                             // set property
278*56b35d86SArmin Le Grand                             const rtl::OUString& rPropertyName = rMapper->GetEntryAPIName(rState.mnIndex);
279*56b35d86SArmin Le Grand 
280*56b35d86SArmin Le Grand                             if(!xInfo.is())
281*56b35d86SArmin Le Grand                             {
282*56b35d86SArmin Le Grand                                 xInfo = rPropSet->getPropertySetInfo();
283*56b35d86SArmin Le Grand                             }
284*56b35d86SArmin Le Grand 
285*56b35d86SArmin Le Grand                             if(xInfo->hasPropertyByName(rPropertyName))
286*56b35d86SArmin Le Grand                             {
287*56b35d86SArmin Le Grand                                 rPropSet->setPropertyValue(rPropertyName,Any(sStyleName));
288*56b35d86SArmin Le Grand                             }
289*56b35d86SArmin Le Grand                         }
290*56b35d86SArmin Le Grand                         catch(::com::sun::star::lang::IllegalArgumentException& e)
291*56b35d86SArmin Le Grand                         {
292*56b35d86SArmin Le Grand                             Sequence< rtl::OUString > aSeq(1);
293*56b35d86SArmin Le Grand                             aSeq[0] = sStyleName;
294*56b35d86SArmin Le Grand                             GetImport().SetError(
295*56b35d86SArmin Le Grand                                 XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING,
296*56b35d86SArmin Le Grand                                 aSeq,e.Message,NULL);
297*56b35d86SArmin Le Grand                         }
298*56b35d86SArmin Le Grand                         break;
299*56b35d86SArmin Le Grand                     }
300*56b35d86SArmin Le Grand                 }
301*56b35d86SArmin Le Grand             }
302*56b35d86SArmin Le Grand         }
303*56b35d86SArmin Le Grand     }
304*56b35d86SArmin Le Grand     else
305*56b35d86SArmin Le Grand     {
306*56b35d86SArmin Le Grand         OSL_ENSURE(xImpPrMap.is(), "Got no SvXMLImportPropertyMapper (!)");
307*56b35d86SArmin Le Grand     }
308*56b35d86SArmin Le Grand 
309*56b35d86SArmin Le Grand     //UUUU old code, replaced by above stuff
310*56b35d86SArmin Le Grand     // XMLPropStyleContext::FillPropertySet(rPropSet);
311*56b35d86SArmin Le Grand 
312cdf0e10cSrcweir     if (sPageUsage.getLength())
313cdf0e10cSrcweir     {
314cdf0e10cSrcweir         uno::Any aPageUsage;
315cdf0e10cSrcweir         XMLPMPropHdl_PageStyleLayout aPageUsageHdl;
316cdf0e10cSrcweir         if (aPageUsageHdl.importXML(sPageUsage, aPageUsage, GetImport().GetMM100UnitConverter()))
317cdf0e10cSrcweir             rPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageStyleLayout")), aPageUsage);
318cdf0e10cSrcweir     }
319cdf0e10cSrcweir }
320cdf0e10cSrcweir 
321cdf0e10cSrcweir // text grid enhancement for better CJK support
322cdf0e10cSrcweir //set default page layout style
SetDefaults()323cdf0e10cSrcweir void PageStyleContext::SetDefaults( )
324cdf0e10cSrcweir {
325cdf0e10cSrcweir 	Reference < XMultiServiceFactory > xFactory ( GetImport().GetModel(), UNO_QUERY);
326cdf0e10cSrcweir 	if (xFactory.is())
327cdf0e10cSrcweir 	{
328cdf0e10cSrcweir 		Reference < XInterface > xInt = xFactory->createInstance (
329cdf0e10cSrcweir 	    rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.Defaults" ) ) );
330cdf0e10cSrcweir 	    Reference < beans::XPropertySet > xProperties ( xInt, UNO_QUERY );
331cdf0e10cSrcweir 	    if ( xProperties.is() )
332cdf0e10cSrcweir 	    	FillPropertySet ( xProperties );
333cdf0e10cSrcweir 	}
334cdf0e10cSrcweir }
335cdf0e10cSrcweir 
336*56b35d86SArmin Le Grand //eof
337