Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / oox / source / drawingml / textliststyle.cxx
blob4c0b8a8434d39ebc94e25734d6232151e932379a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "drawingml/textliststyle.hxx"
22 namespace oox { namespace drawingml {
24 TextListStyle::TextListStyle()
26 for ( int i = 0; i < 9; i++ )
28 maListStyle.push_back( std::make_shared<TextParagraphProperties>( ) );
29 maAggregationListStyle.push_back( std::make_shared<TextParagraphProperties>( ) );
33 TextListStyle::~TextListStyle()
37 TextListStyle::TextListStyle(const TextListStyle& rStyle)
39 assert(rStyle.maListStyle.size() == 9);
40 assert(rStyle.maAggregationListStyle.size() == 9);
41 for ( size_t i = 0; i < 9; i++ )
43 maListStyle.push_back( std::make_shared<TextParagraphProperties>( *rStyle.maListStyle[i] ) );
44 maAggregationListStyle.push_back( std::make_shared<TextParagraphProperties>( *rStyle.maAggregationListStyle[i] ) );
48 TextListStyle& TextListStyle::operator=(const TextListStyle& rStyle)
50 if(this != &rStyle)
52 assert(rStyle.maListStyle.size() == 9);
53 assert(rStyle.maAggregationListStyle.size() == 9);
54 assert(maListStyle.size() == 9);
55 assert(maAggregationListStyle.size() == 9);
56 for ( size_t i = 0; i < 9; i++ )
58 *maListStyle[i] = *rStyle.maListStyle[i];
59 *maAggregationListStyle[i] = *rStyle.maAggregationListStyle[i];
62 return *this;
65 void applyStyleList( const TextParagraphPropertiesVector& rSourceListStyle, TextParagraphPropertiesVector& rDestListStyle )
67 TextParagraphPropertiesVector::const_iterator aSourceListStyleIter( rSourceListStyle.begin() );
68 TextParagraphPropertiesVector::iterator aDestListStyleIter( rDestListStyle.begin() );
69 while( aSourceListStyleIter != rSourceListStyle.end() )
71 if ( aDestListStyleIter != rDestListStyle.end() )
73 (*aDestListStyleIter)->apply( **aSourceListStyleIter );
74 ++aDestListStyleIter;
76 else
77 rDestListStyle.push_back( std::make_shared<TextParagraphProperties>( **aSourceListStyleIter ) );
78 ++aSourceListStyleIter;
82 void TextListStyle::apply( const TextListStyle& rTextListStyle )
84 applyStyleList( rTextListStyle.getAggregationListStyle(), getAggregationListStyle() );
85 applyStyleList( rTextListStyle.getListStyle(), getListStyle() );
88 #ifdef DBG_UTIL
89 void TextListStyle::dump() const
91 for ( int i = 0; i < 9; i++ )
93 SAL_INFO("oox.drawingml", "text list style level: " << i);
94 maListStyle[i]->dump();
97 #endif
98 } }
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */