LibreOffice Module xmloff (master) 1
txtstyle.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 <sal/config.h>
21
22#include <com/sun/star/frame/XModel.hpp>
23#include <com/sun/star/style/ParagraphStyleCategory.hpp>
24#include <com/sun/star/beans/XPropertySet.hpp>
25#include <com/sun/star/beans/XPropertySetInfo.hpp>
26#include <com/sun/star/beans/XPropertyState.hpp>
27#include <com/sun/star/lang/XMultiServiceFactory.hpp>
28#include <com/sun/star/style/XStyle.hpp>
29#include <xmloff/xmltoken.hxx>
31#include <xmloff/families.hxx>
32#include <xmloff/txtparae.hxx>
33#include <xmloff/xmlnume.hxx>
34#include <xmloff/xmlexp.hxx>
36#include "XMLSectionExport.hxx"
38#include "txtexppr.hxx"
39#include <xmloff/txtprmap.hxx>
40
41
42using namespace ::com::sun::star;
43using namespace ::com::sun::star::uno;
44using namespace ::com::sun::star::style;
45using namespace ::com::sun::star::container;
46using namespace ::com::sun::star::beans;
47using namespace ::xmloff::token;
48
50 const css::uno::Reference< css::style::XStyle > & rStyle )
51{
52 Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
53 Reference< XPropertySetInfo > xPropSetInfo(
54 xPropSet->getPropertySetInfo());
55 if( xPropSetInfo->hasPropertyByName( gsCategory ) )
56 {
57 sal_Int16 nCategory = 0;
58 xPropSet->getPropertyValue( gsCategory ) >>= nCategory;
59 enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
60 if( -1 != nCategory )
61 {
62 switch( nCategory )
63 {
64 case ParagraphStyleCategory::TEXT:
65 eValue = XML_TEXT;
66 break;
67 case ParagraphStyleCategory::CHAPTER:
68 eValue = XML_CHAPTER;
69 break;
70 case ParagraphStyleCategory::LIST:
71 eValue = XML_LIST;
72 break;
73 case ParagraphStyleCategory::INDEX:
74 eValue = XML_INDEX;
75 break;
76 case ParagraphStyleCategory::EXTRA:
77 eValue = XML_EXTRA;
78 break;
79 case ParagraphStyleCategory::HTML:
80 eValue = XML_HTML;
81 break;
82 }
83 }
84 if( eValue != XML_TOKEN_INVALID )
86 }
87 if( xPropSetInfo->hasPropertyByName( gsPageDescName ) )
88 {
89 Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
90 if( PropertyState_DIRECT_VALUE ==
91 xPropState->getPropertyState( gsPageDescName ) )
92 {
93 OUString sName;
94 xPropSet->getPropertyValue( gsPageDescName ) >>= sName;
95 // fix for #i5551# if( sName.getLength() > 0 )
98 GetExport().EncodeStyleName( sName ) );
99 }
100 }
101 if( m_bProgress )
102 {
104 pProgress->SetValue( pProgress->GetValue()+2 );
105 }
106}
107
109{
110 SvxXMLNumRuleExport aNumRuleExport( GetExport() );
111 aNumRuleExport.exportStyles(bUsed, !IsBlockMode());
112}
113
114void XMLTextParagraphExport::exportTextStyles( bool bUsed, bool bProg )
115{
116 bool bOldProg = m_bProgress;
117 m_bProgress = bProg;
118
119 Reference < lang::XMultiServiceFactory > xFactory (GetExport().GetModel(), UNO_QUERY);
120 if (xFactory.is())
121 {
122 Reference < XPropertySet > xPropSet (xFactory->createInstance ( "com.sun.star.text.Defaults" ), UNO_QUERY);
123 if (xPropSet.is())
124 {
126
128 xPropSet,
133 GetExport() ) );
134
136 xPropSet,
141 GetExport() ) );
142 }
143 }
148 // get shape export to make sure the frame family is added correctly.
152 exportNumStyles( bUsed );
153 if( !IsBlockMode() )
154 {
157 XMLLineNumberingExport aLineNumberingExport(GetExport());
158 aLineNumberingExport.Export();
159 }
160
161 m_bProgress = bOldProg;
162}
163
164/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetValue(sal_Int32 nValue)
sal_Int32 GetValue() const
ProgressBarHelper * GetProgressBarHelper()
Definition: xmlexp.cxx:1941
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
Definition: xmlexp.cxx:907
rtl::Reference< XMLShapeExport > const & GetShapeExport()
Definition: xmlexp.hxx:565
void exportStyles(bool bUsed, bool bExportChapterNumbering)
Definition: xmlnume.cxx:795
export <text:linenumbering-configuration> and its child elements
static void ExportBibliographyConfiguration(SvXMLExport &rExport)
Export the configuration element for bibliography indices.
void exportStyleFamily(const OUString &rFamily, const OUString &rXMLFamily, const rtl::Reference< SvXMLExportPropertyMapper > &rPropMapper, bool bUsed, XmlStyleFamily nFamily, const OUString *pPrefix=nullptr)
Definition: styleexp.cxx:456
void exportDefaultStyle(const css::uno::Reference< css::beans::XPropertySet > &xPropSet, const OUString &rXMLFamily, const rtl::Reference< SvXMLExportPropertyMapper > &rPropMapper)
Definition: styleexp.cxx:431
SvXMLExport & GetExport()
Definition: styleexp.hxx:59
const rtl::Reference< SvXMLExportPropertyMapper > & GetTextPropMapper() const
Definition: txtparae.hxx:175
static constexpr OUStringLiteral gsPageDescName
Definition: txtparae.hxx:151
rtl::Reference< SvXMLExportPropertyMapper > m_xFramePropMapper
Definition: txtparae.hxx:88
virtual void exportStyleAttributes(const css::uno::Reference< css::style::XStyle > &rStyle) override
Definition: txtstyle.cxx:49
void exportTextFootnoteConfiguration()
export footnote and endnote configuration elements
Definition: txtftne.cxx:173
void exportTextStyles(bool bUsed, bool bProg)
Definition: txtstyle.cxx:114
const rtl::Reference< SvXMLExportPropertyMapper > & GetParaPropMapper() const
Definition: txtparae.hxx:170
bool IsBlockMode() const
Definition: txtparae.hxx:512
static constexpr OUStringLiteral gsCategory
Definition: txtparae.hxx:144
void exportNumStyles(bool bUsed)
Definition: txtstyle.cxx:108
Reference< XSingleServiceFactory > xFactory
constexpr OUStringLiteral XML_STYLE_FAMILY_SD_GRAPHICS_NAME
Definition: families.hxx:38
OUString sName
Handling of tokens in XML:
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:50
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3541
constexpr sal_uInt16 XML_NAMESPACE_STYLE