1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <rtl/ustrbuf.hxx>
21 #include <com/sun/star/style/DropCapFormat.hpp>
22 #include <xmloff/xmltoken.hxx>
23 #include <xmloff/xmlexp.hxx>
24 #include <xmloff/xmluconv.hxx>
25 #include <xmloff/xmlnamespace.hxx>
26 #include "txtdrope.hxx"
28 using namespace ::com::sun::star
;
29 using namespace ::com::sun::star::style
;
30 using namespace ::com::sun::star::uno
;
32 using namespace ::xmloff::token
;
35 XMLTextDropCapExport::XMLTextDropCapExport( SvXMLExport
& rExp
) :
40 void XMLTextDropCapExport::exportXML( const Any
& rAny
,
42 const OUString
& rStyleName
)
44 DropCapFormat aFormat
;
46 if( aFormat
.Lines
> 1 )
48 SvXMLUnitConverter
& rUnitConv
= rExport
.GetMM100UnitConverter();
51 rExport
.AddAttribute( XML_NAMESPACE_STYLE
, XML_LINES
,
52 OUString::number( aFormat
.Lines
) );
58 sValue
= GetXMLToken(XML_WORD
);
60 else if( aFormat
.Count
> 1 )
62 sValue
= OUString::number(aFormat
.Count
);
64 if( !sValue
.isEmpty() )
65 rExport
.AddAttribute( XML_NAMESPACE_STYLE
, XML_LENGTH
, sValue
);
68 if( aFormat
.Distance
> 0 )
70 OUStringBuffer sBuffer
;
71 rUnitConv
.convertMeasureToXML( sBuffer
, aFormat
.Distance
);
72 rExport
.AddAttribute( XML_NAMESPACE_STYLE
, XML_DISTANCE
,
73 sBuffer
.makeStringAndClear() );
77 if( !rStyleName
.isEmpty() )
78 rExport
.AddAttribute( XML_NAMESPACE_STYLE
, XML_STYLE_NAME
,
79 rExport
.EncodeStyleName( rStyleName
) );
82 SvXMLElementExport
aElem( rExport
, XML_NAMESPACE_STYLE
, XML_DROP_CAP
,
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */