nss: upgrade to release 3.73
[LibreOffice.git] / xmloff / source / text / txtdrope.cxx
blob63b9222e14a3200005825b7a71c7e1dd8039e780
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 <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 ) :
36 rExport(rExp)
40 XMLTextDropCapExport::~XMLTextDropCapExport()
44 void XMLTextDropCapExport::exportXML( const Any& rAny,
45 bool bWholeWord,
46 const OUString& rStyleName )
48 DropCapFormat aFormat;
49 rAny >>= aFormat;
50 if( aFormat.Lines > 1 )
52 SvXMLUnitConverter& rUnitConv = rExport.GetMM100UnitConverter();
54 // style:lines
55 rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LINES,
56 OUString::number( aFormat.Lines ) );
58 // style:length
59 OUString sValue;
60 if( bWholeWord )
62 sValue = GetXMLToken(XML_WORD);
64 else if( aFormat.Count > 1 )
66 sValue = OUString::number(aFormat.Count);
68 if( !sValue.isEmpty() )
69 rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LENGTH, sValue );
71 // style:distance
72 if( aFormat.Distance > 0 )
74 OUStringBuffer sBuffer;
75 rUnitConv.convertMeasureToXML( sBuffer, aFormat.Distance );
76 rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_DISTANCE,
77 sBuffer.makeStringAndClear() );
80 // style:style-name
81 if( !rStyleName.isEmpty() )
82 rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_STYLE_NAME,
83 rExport.EncodeStyleName( rStyleName ) );
86 SvXMLElementExport aElem( rExport, XML_NAMESPACE_STYLE, XML_DROP_CAP,
87 false, false );
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */