LibreOffice Module xmloff (master)
1
xmloff
source
text
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
35
XMLTextDropCapExport::XMLTextDropCapExport
(
SvXMLExport
& rExp ) :
36
rExport(rExp)
37
{
38
}
39
40
void
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
{
48
SvXMLUnitConverter
& rUnitConv =
rExport
.
GetMM100UnitConverter
();
49
50
// style:lines
51
rExport
.
AddAttribute
(
XML_NAMESPACE_STYLE
,
XML_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() )
65
rExport
.
AddAttribute
(
XML_NAMESPACE_STYLE
,
XML_LENGTH
, sValue );
66
67
// style:distance
68
if
( aFormat.Distance > 0 )
69
{
70
OUStringBuffer sBuffer;
71
rUnitConv.
convertMeasureToXML
( sBuffer, aFormat.Distance );
72
rExport
.
AddAttribute
(
XML_NAMESPACE_STYLE
,
XML_DISTANCE
,
73
sBuffer.makeStringAndClear() );
74
}
75
76
// style:style-name
77
if
( !rStyleName.isEmpty() )
78
rExport
.
AddAttribute
(
XML_NAMESPACE_STYLE
,
XML_STYLE_NAME
,
79
rExport
.
EncodeStyleName
( rStyleName ) );
80
}
81
82
SvXMLElementExport
aElem(
rExport
,
XML_NAMESPACE_STYLE
,
XML_DROP_CAP
,
83
false
,
false
);
84
}
85
86
87
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvXMLElementExport
Definition:
xmlexp.hxx:632
SvXMLExport
Definition:
xmlexp.hxx:116
SvXMLExport::AddAttribute
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
Definition:
xmlexp.cxx:907
SvXMLExport::EncodeStyleName
OUString EncodeStyleName(const OUString &rName, bool *pEncoded=nullptr) const
Definition:
xmlexp.cxx:1934
SvXMLExport::GetMM100UnitConverter
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition:
xmlexp.hxx:391
SvXMLUnitConverter
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition:
xmluconv.hxx:83
SvXMLUnitConverter::convertMeasureToXML
void convertMeasureToXML(OUStringBuffer &rBuffer, sal_Int32 nMeasure) const
convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit
Definition:
xmluconv.cxx:208
XMLTextDropCapExport::rExport
SvXMLExport & rExport
Definition:
txtdrope.hxx:29
XMLTextDropCapExport::XMLTextDropCapExport
XMLTextDropCapExport(SvXMLExport &rExport)
Definition:
txtdrope.cxx:35
XMLTextDropCapExport::exportXML
void exportXML(const css::uno::Any &rAny, bool bWholeWord, const OUString &rStyleName)
Definition:
txtdrope.cxx:40
com::sun::star::style
com::sun::star::uno
com::sun::star
#file
xmloff::token
Handling of tokens in XML:
Definition:
fasttokenhandler.cxx:31
xmloff::token::XML_LINES
@ XML_LINES
Definition:
xmltoken.hxx:1209
xmloff::token::XML_STYLE_NAME
@ XML_STYLE_NAME
Definition:
xmltoken.hxx:1886
xmloff::token::XML_DROP_CAP
@ XML_DROP_CAP
Definition:
xmltoken.hxx:725
xmloff::token::XML_DISTANCE
@ XML_DISTANCE
Definition:
xmltoken.hxx:694
xmloff::token::XML_LENGTH
@ XML_LENGTH
Definition:
xmltoken.hxx:1179
xmloff::token::XML_WORD
@ XML_WORD
Definition:
xmltoken.hxx:2160
xmloff::token::GetXMLToken
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition:
xmltoken.cxx:3541
txtdrope.hxx
xmlexp.hxx
xmlnamespace.hxx
XML_NAMESPACE_STYLE
constexpr sal_uInt16 XML_NAMESPACE_STYLE
Definition:
xmlnamespace.hxx:30
xmltoken.hxx
xmluconv.hxx
Generated on Sun Jul 30 2023 04:40:39 for LibreOffice Module xmloff (master) by
1.9.3