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>
25 #include <xmloff/xmlnamespace.hxx>
26 #include "txtdrope.hxx"
27 
28 using namespace ::com::sun::star;
29 using namespace ::com::sun::star::style;
30 using namespace ::com::sun::star::uno;
31 
32 using namespace ::xmloff::token;
33 
34 
36  rExport(rExp)
37 {
38 }
39 
41 {
42 }
43 
44 void XMLTextDropCapExport::exportXML( const Any& rAny,
45  bool bWholeWord,
46  const OUString& rStyleName )
47 {
48  DropCapFormat aFormat;
49  rAny >>= aFormat;
50  OUString sValue;
51  OUStringBuffer sBuffer;
52  if( aFormat.Lines > 1 )
53  {
55 
56  // style:lines
58  OUString::number( aFormat.Lines ) );
59 
60  // style:length
61  if( bWholeWord )
62  {
63  sValue = GetXMLToken(XML_WORD);
64  }
65  else if( aFormat.Count > 1 )
66  {
67  sValue = OUString::number(aFormat.Count);
68  }
69  if( !sValue.isEmpty() )
71 
72  // style:distance
73  if( aFormat.Distance > 0 )
74  {
75  rUnitConv.convertMeasureToXML( sBuffer, aFormat.Distance );
77  sBuffer.makeStringAndClear() );
78  }
79 
80  // style:style-name
81  if( !rStyleName.isEmpty() )
83  rExport.EncodeStyleName( rStyleName ) );
84  }
85 
87  false, false );
88 }
89 
90 
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:77
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlexp.hxx:394
void AddAttribute(sal_uInt16 nPrefix, const char *pName, const OUString &rValue)
Definition: xmlexp.cxx:909
SvXMLExport & rExport
Definition: txtdrope.hxx:30
void exportXML(const css::uno::Any &rAny, bool bWholeWord, const OUString &rStyleName)
Definition: txtdrope.cxx:44
OUString EncodeStyleName(const OUString &rName, bool *pEncoded=nullptr) const
Definition: xmlexp.cxx:1954
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3378
Handling of tokens in XML:
XMLTextDropCapExport(SvXMLExport &rExport)
Definition: txtdrope.cxx:35
css::uno::Any const SvXMLExport & rExport
Definition: ImageStyle.hxx:38
void convertMeasureToXML(OUStringBuffer &rBuffer, sal_Int32 nMeasure) const
convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit
Definition: xmluconv.cxx:181
constexpr sal_uInt16 XML_NAMESPACE_STYLE