1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 #include "oox/drawingml/textliststyle.hxx"
25 #include "oox/drawingml/textliststylecontext.hxx"
26 #include "oox/ppt/slidemastertextstylescontext.hxx"
27
28 using rtl::OUString;
29 using namespace ::oox::core;
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::xml::sax;
32
33 namespace oox { namespace ppt {
34
SlideMasterTextStylesContext(ContextHandler & rParent,SlidePersistPtr pSlidePersistPtr)35 SlideMasterTextStylesContext::SlideMasterTextStylesContext( ContextHandler& rParent, SlidePersistPtr pSlidePersistPtr )
36 : ContextHandler( rParent )
37 , mpSlidePersistPtr( pSlidePersistPtr )
38 {
39 }
40
~SlideMasterTextStylesContext()41 SlideMasterTextStylesContext::~SlideMasterTextStylesContext()
42 {
43 }
44
createFastChildContext(sal_Int32 aElementToken,const Reference<XFastAttributeList> &)45 Reference< XFastContextHandler > SlideMasterTextStylesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& /* xAttribs */ ) throw (SAXException, RuntimeException)
46 {
47 oox::drawingml::TextListStylePtr aTextListStylePtr;
48 Reference< XFastContextHandler > xRet;
49 switch( aElementToken )
50 {
51 case PPT_TOKEN( titleStyle ):
52 {
53 aTextListStylePtr = mpSlidePersistPtr->getTitleTextStyle();
54 break;
55 }
56 case PPT_TOKEN( bodyStyle ):
57 {
58 aTextListStylePtr = mpSlidePersistPtr->getBodyTextStyle();
59 break;
60 }
61 case PPT_TOKEN( notesStyle ):
62 {
63 aTextListStylePtr = mpSlidePersistPtr->getNotesTextStyle();
64 break;
65 }
66 case PPT_TOKEN( otherStyle ):
67 {
68 aTextListStylePtr = mpSlidePersistPtr->getOtherTextStyle();
69 break;
70 }
71 }
72 if ( aTextListStylePtr ) // sj: the master list style is the last instance of from where properties
73 { // are obtained. i got some documents without having the textsize set at
74 for ( int i = 0; i < 9; i++ ) // any point, the master reference application is using 18pt then
75 aTextListStylePtr->getListStyle()[ i ]->getTextCharacterProperties().moHeight = 1800;
76 xRet.set( new oox::drawingml::TextListStyleContext( *this, *aTextListStylePtr ) );
77 }
78 if( !xRet.is() )
79 xRet.set( this );
80
81 return xRet;
82 }
83
84 } }
85