titleconverter.cxx (ca5ec200) titleconverter.cxx (f325a5bf)
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

--- 21 unchanged lines hidden (view full) ---

30#include <com/sun/star/chart2/XLegend.hpp>
31#include <com/sun/star/chart2/XTitle.hpp>
32#include <com/sun/star/chart2/XTitled.hpp>
33#include "oox/drawingml/textbody.hxx"
34#include "oox/drawingml/textparagraph.hxx"
35#include "oox/drawingml/chart/datasourceconverter.hxx"
36#include "oox/drawingml/chart/titlemodel.hxx"
37#include "oox/helper/containerhelper.hxx"
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

--- 21 unchanged lines hidden (view full) ---

30#include <com/sun/star/chart2/XLegend.hpp>
31#include <com/sun/star/chart2/XTitle.hpp>
32#include <com/sun/star/chart2/XTitled.hpp>
33#include "oox/drawingml/textbody.hxx"
34#include "oox/drawingml/textparagraph.hxx"
35#include "oox/drawingml/chart/datasourceconverter.hxx"
36#include "oox/drawingml/chart/titlemodel.hxx"
37#include "oox/helper/containerhelper.hxx"
38#include <com/sun/star/chart2/RelativePosition.hpp>
39#include <com/sun/star/drawing/Alignment.hpp>
38
40
41#include "oox/drawingml/chart/modelbase.hxx"
39namespace oox {
40namespace drawingml {
41namespace chart {
42
43// ============================================================================
44
45using namespace ::com::sun::star::awt;
46using namespace ::com::sun::star::chart2;
47using namespace ::com::sun::star::chart2::data;
48using namespace ::com::sun::star::uno;
49
50using ::oox::core::XmlFilterBase;
51using ::rtl::OUString;
42namespace oox {
43namespace drawingml {
44namespace chart {
45
46// ============================================================================
47
48using namespace ::com::sun::star::awt;
49using namespace ::com::sun::star::chart2;
50using namespace ::com::sun::star::chart2::data;
51using namespace ::com::sun::star::uno;
52
53using ::oox::core::XmlFilterBase;
54using ::rtl::OUString;
55using namespace ::com::sun::star::drawing;
52
53// ============================================================================
54
55TextConverter::TextConverter( const ConverterRoot& rParent, TextModel& rModel ) :
56 ConverterBase< TextModel >( rParent, rModel )
57{
58}
59

--- 144 unchanged lines hidden (view full) ---

204 aPropSet.setProperty( PROP_Show, true );
205
206 // legend formatting
207 getFormatter().convertFormatting( aPropSet, mrModel.mxShapeProp, mrModel.mxTextProp, OBJECTTYPE_LEGEND );
208
209 // predefined legend position and expansion
210 cssc2::LegendPosition eLegendPos = cssc2::LegendPosition_CUSTOM;
211 cssc::ChartLegendExpansion eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
56
57// ============================================================================
58
59TextConverter::TextConverter( const ConverterRoot& rParent, TextModel& rModel ) :
60 ConverterBase< TextModel >( rParent, rModel )
61{
62}
63

--- 144 unchanged lines hidden (view full) ---

208 aPropSet.setProperty( PROP_Show, true );
209
210 // legend formatting
211 getFormatter().convertFormatting( aPropSet, mrModel.mxShapeProp, mrModel.mxTextProp, OBJECTTYPE_LEGEND );
212
213 // predefined legend position and expansion
214 cssc2::LegendPosition eLegendPos = cssc2::LegendPosition_CUSTOM;
215 cssc::ChartLegendExpansion eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
216 RelativePosition eRelPos;
217 bool bTopRight=0;
212 switch( mrModel.mnPosition )
213 {
214 case XML_l:
215 eLegendPos = cssc2::LegendPosition_LINE_START;
216 eLegendExpand = cssc::ChartLegendExpansion_HIGH;
217 break;
218 case XML_r:
218 switch( mrModel.mnPosition )
219 {
220 case XML_l:
221 eLegendPos = cssc2::LegendPosition_LINE_START;
222 eLegendExpand = cssc::ChartLegendExpansion_HIGH;
223 break;
224 case XML_r:
219 case XML_tr: // top-right not supported
220 eLegendPos = cssc2::LegendPosition_LINE_END;
221 eLegendExpand = cssc::ChartLegendExpansion_HIGH;
225 eLegendPos = cssc2::LegendPosition_LINE_END;
226 eLegendExpand = cssc::ChartLegendExpansion_HIGH;
227 break;
228 case XML_tr: // top-right not supported
229 eLegendPos = LegendPosition_CUSTOM;
230 eRelPos.Primary = 1;
231 eRelPos.Secondary =0;
232 eRelPos.Anchor = Alignment_TOP_RIGHT;
233 bTopRight=1;
234
222 break;
223 case XML_t:
224 eLegendPos = cssc2::LegendPosition_PAGE_START;
225 eLegendExpand = cssc::ChartLegendExpansion_WIDE;
226 break;
227 case XML_b:
228 eLegendPos = cssc2::LegendPosition_PAGE_END;
229 eLegendExpand = cssc::ChartLegendExpansion_WIDE;
230 break;
231 }
235 break;
236 case XML_t:
237 eLegendPos = cssc2::LegendPosition_PAGE_START;
238 eLegendExpand = cssc::ChartLegendExpansion_WIDE;
239 break;
240 case XML_b:
241 eLegendPos = cssc2::LegendPosition_PAGE_END;
242 eLegendExpand = cssc::ChartLegendExpansion_WIDE;
243 break;
244 }
232
245 bool bManualLayout=false;
233 // manual positioning and size
246 // manual positioning and size
234 if( mrModel.mxLayout.get() )
247 if( mrModel.mxLayout.get() )
235 {
236 LayoutConverter aLayoutConv( *this, *mrModel.mxLayout );
237 // manual size needs ChartLegendExpansion_CUSTOM
238 if( aLayoutConv.convertFromModel( aPropSet ) )
239 eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
248 {
249 LayoutConverter aLayoutConv( *this, *mrModel.mxLayout );
250 // manual size needs ChartLegendExpansion_CUSTOM
251 if( aLayoutConv.convertFromModel( aPropSet ) )
252 eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
253 bManualLayout = !aLayoutConv.getAutoLayout();
240 }
241
242 // set position and expansion properties
243 aPropSet.setProperty( PROP_AnchorPosition, eLegendPos );
244 aPropSet.setProperty( PROP_Expansion, eLegendExpand );
254 }
255
256 // set position and expansion properties
257 aPropSet.setProperty( PROP_AnchorPosition, eLegendPos );
258 aPropSet.setProperty( PROP_Expansion, eLegendExpand );
259
260 if(eLegendPos == LegendPosition_CUSTOM && 1 == bTopRight && bManualLayout==false)
261 aPropSet.setProperty( PROP_RelativePosition , makeAny(eRelPos));
245 }
246 catch( Exception& )
247 {
248 }
249}
250
251// ============================================================================
252
253} // namespace chart
254} // namespace drawingml
255} // namespace oox
262 }
263 catch( Exception& )
264 {
265 }
266}
267
268// ============================================================================
269
270} // namespace chart
271} // namespace drawingml
272} // namespace oox