LibreOffice Module xmloff (master) 1
txtdrope.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
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>
26#include "txtdrope.hxx"
27
28using namespace ::com::sun::star;
29using namespace ::com::sun::star::style;
30using namespace ::com::sun::star::uno;
31
32using namespace ::xmloff::token;
33
34
36 rExport(rExp)
37{
38}
39
40void XMLTextDropCapExport::exportXML( const Any& rAny,
41 bool bWholeWord,
42 const OUString& rStyleName )
43{
44 DropCapFormat aFormat;
45 rAny >>= aFormat;
46 if( aFormat.Lines > 1 )
47 {
49
50 // style:lines
52 OUString::number( aFormat.Lines ) );
53
54 // style:length
55 OUString sValue;
56 if( bWholeWord )
57 {
58 sValue = GetXMLToken(XML_WORD);
59 }
60 else if( aFormat.Count > 1 )
61 {
62 sValue = OUString::number(aFormat.Count);
63 }
64 if( !sValue.isEmpty() )
66
67 // style:distance
68 if( aFormat.Distance > 0 )
69 {
70 OUStringBuffer sBuffer;
71 rUnitConv.convertMeasureToXML( sBuffer, aFormat.Distance );
73 sBuffer.makeStringAndClear() );
74 }
75
76 // style:style-name
77 if( !rStyleName.isEmpty() )
79 rExport.EncodeStyleName( rStyleName ) );
80 }
81
83 false, false );
84}
85
86
87/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
Definition: xmlexp.cxx:907
OUString EncodeStyleName(const OUString &rName, bool *pEncoded=nullptr) const
Definition: xmlexp.cxx:1934
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlexp.hxx:391
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:83
void convertMeasureToXML(OUStringBuffer &rBuffer, sal_Int32 nMeasure) const
convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit
Definition: xmluconv.cxx:208
SvXMLExport & rExport
Definition: txtdrope.hxx:29
XMLTextDropCapExport(SvXMLExport &rExport)
Definition: txtdrope.cxx:35
void exportXML(const css::uno::Any &rAny, bool bWholeWord, const OUString &rStyleName)
Definition: txtdrope.cxx:40
Handling of tokens in XML:
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3541
constexpr sal_uInt16 XML_NAMESPACE_STYLE