Bug Summary

File:home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx
Warning:line 523, column 34
1st function call argument is an uninitialized value

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name txtstyli.cxx -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D LINUX -D OSL_DEBUG_LEVEL=1 -D SAL_LOG_INFO -D SAL_LOG_WARN -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D XMLOFF_DLLIMPLEMENTATION -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/external/boost/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/boost -I /home/maarten/src/libreoffice/core/xmloff/inc -I /home/maarten/src/libreoffice/core/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include/linux -I /home/maarten/src/libreoffice/core/config_host -I /home/maarten/src/libreoffice/core/workdir/CustomTarget/officecfg/registry -I /home/maarten/src/libreoffice/core/workdir/CustomTarget/xmloff/generated -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/offapi/normal -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-missing-braces -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/maarten/src/libreoffice/core -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -debug-info-kind=constructor -analyzer-output=html -faddrsig -o /home/maarten/tmp/wis/scan-build-libreoffice/output/report/2020-10-07-141433-9725-1 -x c++ /home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx

/home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx

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
21#include "XMLTextPropertySetContext.hxx"
22#include <xmloff/xmlnamespace.hxx>
23#include <xmloff/XMLEventsImportContext.hxx>
24#include <xmloff/families.hxx>
25#include <xmloff/txtprmap.hxx>
26#include <xmloff/txtstyli.hxx>
27#include <xmloff/xmlimp.hxx>
28#include <xmloff/xmltoken.hxx>
29#include <xmloff/xmluconv.hxx>
30#include <xmloff/maptype.hxx>
31#include <xmloff/xmlimppr.hxx>
32#include <xmloff/xmlement.hxx>
33
34#include <com/sun/star/beans/XPropertySet.hpp>
35#include <com/sun/star/container/XNameContainer.hpp>
36#include <com/sun/star/document/XEventsSupplier.hpp>
37#include <com/sun/star/frame/XModel.hpp>
38#include <com/sun/star/lang/XMultiServiceFactory.hpp>
39#include <com/sun/star/style/ParagraphStyleCategory.hpp>
40#include <com/sun/star/style/XStyle.hpp>
41
42#include <o3tl/any.hxx>
43
44#include <sax/tools/converter.hxx>
45
46#include <tools/debug.hxx>
47#include <tools/diagnose_ex.h>
48#include <sal/log.hxx>
49
50#include <vector>
51
52#include <xmlsdtypes.hxx>
53#include <xmloff/xmlerror.hxx>
54
55
56using namespace ::std;
57using namespace ::com::sun::star;
58using namespace ::com::sun::star::uno;
59using namespace ::com::sun::star::xml::sax;
60using namespace ::com::sun::star::style;
61using namespace ::com::sun::star::beans;
62using namespace ::com::sun::star::lang;
63using namespace ::com::sun::star::container;
64using namespace ::xmloff::token;
65
66const SvXMLEnumMapEntry<sal_uInt16> aCategoryMap[] =
67{
68 { XML_TEXT, ParagraphStyleCategory::TEXT },
69 { XML_CHAPTER, ParagraphStyleCategory::CHAPTER },
70 { XML_LIST, ParagraphStyleCategory::LIST },
71 { XML_INDEX, ParagraphStyleCategory::INDEX },
72 { XML_EXTRA, ParagraphStyleCategory::EXTRA },
73 { XML_HTML, ParagraphStyleCategory::HTML },
74 { XML_TOKEN_INVALID, 0 }
75};
76
77void XMLTextStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
78 const OUString& rLocalName,
79 const OUString& rValue )
80{
81 if( XML_NAMESPACE_STYLE == nPrefixKey )
82 {
83 // TODO: use a map here
84 if( IsXMLToken( rLocalName, XML_AUTO_UPDATE ) )
85 {
86 if( IsXMLToken( rValue, XML_TRUE ) )
87 m_isAutoUpdate = true;
88 }
89 else if( IsXMLToken( rLocalName, XML_LIST_STYLE_NAME ) )
90 {
91 m_sListStyleName = rValue;
92 // Inherited paragraph style lost information about unset numbering (#i69523#)
93 m_bListStyleSet = true;
94 }
95 else if( IsXMLToken( rLocalName, XML_MASTER_PAGE_NAME ) )
96 {
97 m_sMasterPageName = rValue;
98 m_bHasMasterPageName = true;
99 }
100 else if( IsXMLToken( rLocalName, XML_DATA_STYLE_NAME ) )
101 {
102 m_sDataStyleName = rValue;
103 }
104 else if( IsXMLToken( rLocalName, XML_CLASS ) )
105 {
106 m_sCategoryVal = rValue;
107 }
108 else if( IsXMLToken( rLocalName, XML_DEFAULT_OUTLINE_LEVEL ) )
109 {
110 sal_Int32 nTmp;
111 if (::sax::Converter::convertNumber( nTmp, rValue ) &&
112 0 <= nTmp && nTmp <= 10 )
113 {
114 m_nOutlineLevel = static_cast<sal_Int8>(nTmp);
115 }
116 }
117 else
118 {
119 XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
120 }
121 }
122 else
123 {
124 XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
125 }
126}
127
128XMLTextStyleContext::XMLTextStyleContext( SvXMLImport& rImport,
129 SvXMLStylesContext& rStyles, XmlStyleFamily nFamily,
130 bool bDefaultStyle )
131: XMLPropStyleContext( rImport, rStyles, nFamily, bDefaultStyle )
132, m_nOutlineLevel( -1 )
133, m_isAutoUpdate( false )
134, m_bHasMasterPageName( false )
135, m_bHasCombinedCharactersLetter( false )
136// Inherited paragraph style lost information about unset numbering (#i69523#)
137, m_bListStyleSet( false )
138{
139}
140
141XMLTextStyleContext::~XMLTextStyleContext()
142{}
143
144css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextStyleContext::createFastChildContext(
145 sal_Int32 nElement,
146 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
147{
148 if( IsTokenInNamespace(nElement, XML_NAMESPACE_STYLE) )
149 {
150 sal_Int32 nLocalName = nElement & TOKEN_MASK;
151 sal_uInt32 nFamily = 0;
152 if( nLocalName == XML_TEXT_PROPERTIES )
153 nFamily = XML_TYPE_PROP_TEXT(0x5 << 14);
154 else if( nLocalName == XML_PARAGRAPH_PROPERTIES )
155 nFamily = XML_TYPE_PROP_PARAGRAPH(0x6 << 14);
156 else if( nLocalName == XML_SECTION_PROPERTIES )
157 nFamily = XML_TYPE_PROP_SECTION(0x8 << 14);
158 else if( IsDefaultStyle() && nLocalName == XML_TABLE_PROPERTIES )
159 nFamily = XML_TYPE_PROP_TABLE(0x9 << 14);
160 else if( IsDefaultStyle() && nLocalName == XML_TABLE_ROW_PROPERTIES )
161 nFamily = XML_TYPE_PROP_TABLE_ROW(0xb << 14);
162 if( nFamily )
163 {
164 rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
165 GetStyles()->GetImportPropertyMapper( GetFamily() );
166 if( xImpPrMap.is() )
167 return new XMLTextPropertySetContext( GetImport(), nElement, xAttrList,
168 nFamily,
169 GetProperties(),
170 xImpPrMap,
171 m_sDropCapTextStyleName);
172 }
173 }
174 else if ( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS)( NAMESPACE_TOKEN(XML_NAMESPACE_OFFICE) | XML_EVENT_LISTENERS
)
)
175 {
176 // create and remember events import context
177 // (for delayed processing of events)
178 m_xEventContext.set(new XMLEventsImportContext( GetImport() ));
179 return m_xEventContext.get();
180 }
181
182 return XMLPropStyleContext::createFastChildContext( nElement, xAttrList );
183}
184
185void XMLTextStyleContext::CreateAndInsert( bool bOverwrite )
186{
187 XMLPropStyleContext::CreateAndInsert( bOverwrite );
188 Reference < XStyle > xStyle = GetStyle();
189 if( !xStyle.is() || !(bOverwrite || IsNew()) )
190 return;
191
192 Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
193 Reference< XPropertySetInfo > xPropSetInfo =
194 xPropSet->getPropertySetInfo();
195
196 OUString const sIsAutoUpdate("IsAutoUpdate");
197 if( xPropSetInfo->hasPropertyByName( sIsAutoUpdate ) )
198 {
199 xPropSet->setPropertyValue( sIsAutoUpdate, Any(m_isAutoUpdate) );
200 }
201
202 sal_uInt16 nCategory = ParagraphStyleCategory::TEXT;
203 if( XmlStyleFamily::TEXT_PARAGRAPH == GetFamily() &&
204 !m_sCategoryVal.isEmpty() && xStyle->isUserDefined() &&
205 xPropSetInfo->hasPropertyByName("Category") &&
206 SvXMLUnitConverter::convertEnum( nCategory, m_sCategoryVal, aCategoryMap))
207 {
208 xPropSet->setPropertyValue("Category", Any(static_cast<sal_Int16>(nCategory)));
209 }
210
211 // tell the style about it's events (if applicable)
212 if (m_xEventContext.is())
213 {
214 // pass events into event supplier
215 Reference<document::XEventsSupplier> xEventsSupplier(xStyle,UNO_QUERY);
216 m_xEventContext->SetEvents(xEventsSupplier);
217 m_xEventContext.clear();
218 }
219
220 // XML import: reconstruction of assignment of paragraph style to outline levels (#i69629#)
221 if (m_nOutlineLevel > 0)
222 {
223 GetImport().GetTextImport()->AddOutlineStyleCandidate(m_nOutlineLevel,
224 GetDisplayName() );
225 }
226}
227
228void XMLTextStyleContext::SetDefaults( )
229{
230 if( ( GetFamily() == XmlStyleFamily::TEXT_PARAGRAPH ) ||
231 ( GetFamily() == XmlStyleFamily::TABLE_TABLE ) ||
232 ( GetFamily() == XmlStyleFamily::TABLE_ROW ) )
233 {
234 Reference < XMultiServiceFactory > xFactory ( GetImport().GetModel(), UNO_QUERY);
235 if (xFactory.is())
236 {
237 Reference < XInterface > xInt = xFactory->createInstance( "com.sun.star.text.Defaults" );
238 Reference < XPropertySet > xProperties ( xInt, UNO_QUERY );
239 if ( xProperties.is() )
240 FillPropertySet ( xProperties );
241 }
242 }
243}
244
245void XMLTextStyleContext::Finish( bool bOverwrite )
246{
247 XMLPropStyleContext::Finish( bOverwrite );
248
249 Reference < XStyle > xStyle = GetStyle();
250 // Consider set empty list style (#i69523#)
251 if ( !( m_bListStyleSet ||
252 m_nOutlineLevel >= 0 ||
253 !m_sDropCapTextStyleName.isEmpty() ||
254 m_bHasMasterPageName ) ||
255 !xStyle.is() ||
256 !( bOverwrite || IsNew() ) )
257 return;
258
259 Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
260 Reference< XPropertySetInfo > xPropSetInfo =
261 xPropSet->getPropertySetInfo();
262
263 OUString const sOutlineLevel("OutlineLevel");
264 if( xPropSetInfo->hasPropertyByName( sOutlineLevel ))
265 {
266 if (m_nOutlineLevel >= 0)
267 {
268 xPropSet->setPropertyValue( sOutlineLevel, Any(m_nOutlineLevel) );
269 }
270 }
271
272 // Consider set empty list style (#i69523#)
273 OUString const sNumberingStyleName("NumberingStyleName");
274 if (m_bListStyleSet &&
275 xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
276 {
277 /* Only for text document from version prior OOo 2.1 resp. SO 8 PU5:
278 - Do not apply list style, if paragraph style has a default outline
279 level > 0 and thus, will be assigned to the corresponding list
280 level of the outline style. (#i70223#)
281 */
282 bool bApplyListStyle( true );
283 if (m_nOutlineLevel > 0)
284 {
285 if ( GetImport().IsTextDocInOOoFileFormat() )
286 {
287 bApplyListStyle = false;
288 }
289 else
290 {
291 sal_Int32 nUPD( 0 );
292 sal_Int32 nBuild( 0 );
293 // Check explicitly on certain versions (#i86058#)
294 if ( GetImport().getBuildIds( nUPD, nBuild ) &&
295 ( ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0
296 ( nUPD == 680 && nBuild <= 9073 ) ) ) // OOo 2.0 - OOo 2.0.4
297 {
298 bApplyListStyle = false;
299 }
300 }
301 }
302
303 if ( bApplyListStyle )
304 {
305 if (m_sListStyleName.isEmpty())
306 {
307 xPropSet->setPropertyValue(sNumberingStyleName, Any(m_sListStyleName)); /* empty string */
308 }
309 else
310 {
311 // change list style name to display name
312 OUString sDisplayListStyleName(
313 GetImport().GetStyleDisplayName(XmlStyleFamily::TEXT_LIST,
314 m_sListStyleName));
315 // The families container must exist
316 const Reference < XNameContainer >& rNumStyles =
317 GetImport().GetTextImport()->GetNumberingStyles();
318 // if( rNumStyles.is() && rNumStyles->hasByName( sDisplayListStyleName ) &&
319 // xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
320 if ( rNumStyles.is() &&
321 rNumStyles->hasByName( sDisplayListStyleName ) )
322 {
323 xPropSet->setPropertyValue( sNumberingStyleName, Any(sDisplayListStyleName) );
324 }
325 }
326 }
327 }
328
329 if (!m_sDropCapTextStyleName.isEmpty())
330 {
331 // change list style name to display name
332 OUString sDisplayDropCapTextStyleName(
333 GetImport().GetStyleDisplayName( XmlStyleFamily::TEXT_TEXT,
334 m_sDropCapTextStyleName));
335 // The families container must exist
336 const Reference < XNameContainer >& rTextStyles =
337 GetImport().GetTextImport()->GetTextStyles();
338 if( rTextStyles.is() &&
339 rTextStyles->hasByName( sDisplayDropCapTextStyleName ) &&
340 xPropSetInfo->hasPropertyByName("DropCapCharStyleName"))
341 {
342 xPropSet->setPropertyValue("DropCapCharStyleName", Any(sDisplayDropCapTextStyleName));
343 }
344 }
345
346 if (!m_bHasMasterPageName)
347 return;
348
349 OUString sDisplayName(
350 GetImport().GetStyleDisplayName(
351 XmlStyleFamily::MASTER_PAGE, m_sMasterPageName));
352 // The families container must exist
353 const Reference < XNameContainer >& rPageStyles =
354 GetImport().GetTextImport()->GetPageStyles();
355
356 OUString const sPageDescName("PageDescName");
357 if( ( sDisplayName.isEmpty() ||
358 (rPageStyles.is() &&
359 rPageStyles->hasByName( sDisplayName )) ) &&
360 xPropSetInfo->hasPropertyByName( sPageDescName ) )
361 {
362 xPropSet->setPropertyValue( sPageDescName, Any(sDisplayName) );
363 }
364}
365
366void XMLTextStyleContext::FillPropertySet(
367 const Reference<XPropertySet > & rPropSet )
368{
369 // imitate the FillPropertySet of the super class, so we get a chance to
370 // catch the combined characters attribute
371
372 // imitate XMLPropStyleContext::FillPropertySet(...)
373 SvXMLStylesContext* pSvXMLStylesContext = GetStyles();
374 rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily());
375 DBG_ASSERT(xImpPrMap.is(),"Where is the import prop mapper?")do { if (true && (!(xImpPrMap.is()))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.tools"), ("/home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx"
":" "375" ": "), "%s", "Where is the import prop mapper?"); }
} while (false)
;
1
Taking false branch
2
Loop condition is false. Exiting loop
376
377 if(!xImpPrMap.is())
3
Calling 'Reference::is'
5
Returning from 'Reference::is'
6
Taking false branch
378 return;
379
380 // imitate SvXMLImportPropertyMapper::FillPropertySet(...)
381 // The reason for this is that we have no other way to
382 // efficiently intercept the value of combined characters. To
383 // get that value, we could iterate through the map once more,
384 // but instead we chose to insert the code into this
385 // iteration. I haven't been able to come up with a much more
386 // intelligent solution.
387 struct ContextID_Index_Pair aContextIDs[] =
388 {
389 { CTF_COMBINED_CHARACTERS_FIELD(0x00003000 + 111), -1 },
390 { CTF_KEEP_TOGETHER(0x00003000 + 122), -1 },
391 { CTF_BORDER_MODEL(0x00003000 + 128), -1 },
392 { CTF_TEXT_DISPLAY(0x00003000 + 143), -1 },
393 { CTF_FONTFAMILYNAME(0x00003000 + 34), -1 },
394 { CTF_FONTFAMILYNAME_CJK(0x00003000 + 72), -1 },
395 { CTF_FONTFAMILYNAME_CTL(0x00003000 + 81), -1 },
396
397 //UUU need special handling for DrawingLayer FillStyle names
398 { CTF_FILLGRADIENTNAME1015, -1 },
399 { CTF_FILLTRANSNAME1018, -1 },
400 { CTF_FILLHATCHNAME1016, -1 },
401 { CTF_FILLBITMAPNAME1017, -1 },
402
403 { -1, -1 }
404 };
405
406 // the style families associated with the same index modulo 4
407 static const XmlStyleFamily aFamilies[] =
408 {
409 XmlStyleFamily::SD_GRADIENT_ID,
410 XmlStyleFamily::SD_GRADIENT_ID,
411 XmlStyleFamily::SD_HATCH_ID,
412 XmlStyleFamily::SD_FILL_IMAGE_ID
413 };
414
415 // get property set info
416 Reference< XPropertySetInfo > xInfo;
417 rtl::Reference< XMLPropertySetMapper > rPropMapper;
418 bool bAutomatic = false;
419
420 if(pSvXMLStylesContext->IsAutomaticStyle() &&
7
Assuming the condition is false
421 (XmlStyleFamily::TEXT_TEXT == GetFamily() || XmlStyleFamily::TEXT_PARAGRAPH == GetFamily()))
422 {
423 bAutomatic = true;
424
425 if( !GetAutoName().isEmpty() )
426 {
427 OUString sAutoProp = ( GetFamily() == XmlStyleFamily::TEXT_TEXT ) ?
428 OUString( "CharAutoStyleName" ):
429 OUString( "ParaAutoStyleName" );
430
431 try
432 {
433 if(!xInfo.is())
434 {
435 xInfo = rPropSet->getPropertySetInfo();
436 }
437
438 if ( xInfo->hasPropertyByName( sAutoProp ) )
439 {
440 rPropSet->setPropertyValue( sAutoProp, makeAny(GetAutoName()) );
441 }
442 else
443 {
444 bAutomatic = false;
445 }
446 }
447 catch( const RuntimeException& ) { throw; }
448 catch( const Exception& )
449 {
450 DBG_UNHANDLED_EXCEPTION("xmloff.text")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx"
":" "450" ": ", "xmloff.text" );
;
451 bAutomatic = false;
452 }
453 }
454 }
455
456 if( bAutomatic
7.1
'bAutomatic' is false
7.1
'bAutomatic' is false
7.1
'bAutomatic' is false
)
8
Taking false branch
457 {
458 xImpPrMap->CheckSpecialContext( GetProperties(), rPropSet, aContextIDs );
459 }
460 else
461 {
462 xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
463 }
464
465 sal_Int32 nIndex = aContextIDs[0].nIndex;
466
467 // have we found a combined characters
468 if ( nIndex != -1 )
9
Assuming the condition is false
10
Taking false branch
469 {
470 Any& rAny = GetProperties()[nIndex].maValue;
471 bool bVal = *o3tl::doAccess<bool>(rAny);
472 m_bHasCombinedCharactersLetter = bVal;
473 }
474
475 // keep-together: the application default is different from
476 // the file format default. Hence, if we always set this
477 // value; if we didn't find one, we'll set to false, the file
478 // format default.
479 // border-model: same
480 if(IsDefaultStyle() && XmlStyleFamily::TABLE_ROW == GetFamily())
11
Assuming the condition is false
481 {
482 OUString sIsSplitAllowed("IsSplitAllowed");
483 SAL_WARN_IF( !rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ), "xmloff", "property missing?" )do { if (true && (!rPropSet->getPropertySetInfo()->
hasPropertyByName( sIsSplitAllowed ))) { switch (sal_detail_log_report
(::SAL_DETAIL_LOG_LEVEL_WARN, "xmloff")) { case SAL_DETAIL_LOG_ACTION_IGNORE
: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail
::getResult( ::sal::detail::StreamStart() << "property missing?"
) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("xmloff"
), ("/home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx"
":" "483" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "property missing?"), 0); } else { ::std
::ostringstream sal_detail_stream; sal_detail_stream <<
"property missing?"; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN
), ("xmloff"), ("/home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx"
":" "483" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "property missing?") == 1) { ::sal_detail_log( (::
SAL_DETAIL_LOG_LEVEL_WARN), ("xmloff"), ("/home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx"
":" "483" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "property missing?"), 0); } else { ::std
::ostringstream sal_detail_stream; sal_detail_stream <<
"property missing?"; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN
), ("xmloff"), ("/home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx"
":" "483" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false)
;
484 rPropSet->setPropertyValue(
485 sIsSplitAllowed,
486 (aContextIDs[1].nIndex == -1) ? makeAny( false ) : GetProperties()[aContextIDs[1].nIndex].maValue );
487 }
488
489 if(IsDefaultStyle() && XmlStyleFamily::TABLE_TABLE == GetFamily())
12
Calling 'SvXMLStyleContext::IsDefaultStyle'
14
Returning from 'SvXMLStyleContext::IsDefaultStyle'
490 {
491 OUString sCollapsingBorders("CollapsingBorders");
492 SAL_WARN_IF( !rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ), "xmloff", "property missing?" )do { if (true && (!rPropSet->getPropertySetInfo()->
hasPropertyByName( sCollapsingBorders ))) { switch (sal_detail_log_report
(::SAL_DETAIL_LOG_LEVEL_WARN, "xmloff")) { case SAL_DETAIL_LOG_ACTION_IGNORE
: break; case SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail
::getResult( ::sal::detail::StreamStart() << "property missing?"
) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("xmloff"
), ("/home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx"
":" "492" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "property missing?"), 0); } else { ::std
::ostringstream sal_detail_stream; sal_detail_stream <<
"property missing?"; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN
), ("xmloff"), ("/home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx"
":" "492" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "property missing?") == 1) { ::sal_detail_log( (::
SAL_DETAIL_LOG_LEVEL_WARN), ("xmloff"), ("/home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx"
":" "492" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "property missing?"), 0); } else { ::std
::ostringstream sal_detail_stream; sal_detail_stream <<
"property missing?"; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN
), ("xmloff"), ("/home/maarten/src/libreoffice/core/xmloff/source/text/txtstyli.cxx"
":" "492" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false)
;
493 rPropSet->setPropertyValue(
494 sCollapsingBorders,
495 (aContextIDs[2].nIndex == -1)
496 ? makeAny( false )
497 : GetProperties()[aContextIDs[2].nIndex].maValue );
498 }
499
500
501 // iterate over aContextIDs entries, start with 3, prev ones are already used above
502 for(sal_uInt16 i(3); aContextIDs[i].nContextID != -1; i++)
15
Assuming the condition is true
16
Loop condition is true. Entering loop body
503 {
504 nIndex = aContextIDs[i].nIndex;
505
506 if ( nIndex != -1 )
17
Assuming the condition is true
18
Taking true branch
507 {
508 // Found!
509 struct XMLPropertyState& rState = GetProperties()[nIndex];
510
511 switch(aContextIDs[i].nContextID)
19
Control jumps to 'case 1017:' at line 516
512 {
513 case CTF_FILLGRADIENTNAME1015:
514 case CTF_FILLTRANSNAME1018:
515 case CTF_FILLHATCHNAME1016:
516 case CTF_FILLBITMAPNAME1017:
517 {
518 // DrawingLayer FillStyle name needs to be mapped to DisplayName
519 OUString sStyleName;
520 rState.maValue >>= sStyleName;
521
522 // translate the used name from ODF intern to the name used in the Model
523 sStyleName = GetImport().GetStyleDisplayName(aFamilies[i - 7], sStyleName);
20
1st function call argument is an uninitialized value
524
525 if(bAutomatic)
526 {
527 // in this case the rPropSet got not really filled since above the call to
528 // CheckSpecialContext was used and not FillPropertySet, thus the below call to
529 // setPropertyValue can fail/will not be useful (e.g. when the rPropSet
530 // is a SwXTextCursor).
531 // This happens for AutoStyles which are already filled in XMLPropStyleContext::CreateAndInsert,
532 // thus the whole mechanism based on _ContextID_Index_Pair will not work
533 // in that case. Thus the slots which need to be converted already get
534 // converted there (it's called first) and not here (see
535 // translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames)
536 // For convenience, still Write back the corrected value to the XMLPropertyState entry
537 rState.maValue <<= sStyleName;
538 break;
539 }
540
541 // Still needed if it's not an AutomaticStyle (!)
542 try
543 {
544 if(!rPropMapper.is())
545 {
546 rPropMapper = xImpPrMap->getPropertySetMapper();
547 }
548
549 // set property
550 const OUString& rPropertyName = rPropMapper->GetEntryAPIName(rState.mnIndex);
551
552 if(!xInfo.is())
553 {
554 xInfo = rPropSet->getPropertySetInfo();
555 }
556
557 if(xInfo->hasPropertyByName(rPropertyName))
558 {
559 rPropSet->setPropertyValue(rPropertyName,Any(sStyleName));
560 }
561 }
562 catch(css::lang::IllegalArgumentException& e)
563 {
564 Sequence<OUString> aSeq { sStyleName };
565 GetImport().SetError(XMLERROR_STYLE_PROP_VALUE( 0x00040000 | 0x00000001 ) | XMLERROR_FLAG_WARNING0x10000000, aSeq, e.Message, nullptr);
566 }
567 break;
568 }
569 default:
570 {
571 // check for StarBats and StarMath fonts
572 Any rAny = rState.maValue;
573 sal_Int32 nMapperIndex = rState.mnIndex;
574
575 // Now check for font name in rState and set corrected value,
576 // if necessary.
577 OUString sFontName;
578 rAny >>= sFontName;
579
580 if ( !sFontName.isEmpty() )
581 {
582 if ( sFontName.equalsIgnoreAsciiCase( "StarBats" ) ||
583 sFontName.equalsIgnoreAsciiCase( "StarMath" ) )
584 {
585 // construct new value
586 sFontName = "StarSymbol";
587 Any aAny(rAny);
588 aAny <<= sFontName;
589
590 if(!rPropMapper.is())
591 {
592 rPropMapper = xImpPrMap->getPropertySetMapper();
593 }
594
595 // set property
596 OUString rPropertyName(rPropMapper->GetEntryAPIName(nMapperIndex));
597
598 if(!xInfo.is())
599 {
600 xInfo = rPropSet->getPropertySetInfo();
601 }
602
603 if(xInfo->hasPropertyByName(rPropertyName))
604 {
605 rPropSet->setPropertyValue(rPropertyName,aAny);
606 }
607 }
608 // else: "normal" style name -> no correction is necessary
609 }
610 // else: no style name found -> illegal value -> ignore
611 }
612 }
613 }
614 }
615
616}
617
618/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

/home/maarten/src/libreoffice/core/include/rtl/ref.hxx

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#ifndef INCLUDED_RTL_REF_HXX
21#define INCLUDED_RTL_REF_HXX
22
23#include "sal/config.h"
24
25#include <cassert>
26#include <cstddef>
27#include <functional>
28#ifdef LIBO_INTERNAL_ONLY1
29#include <type_traits>
30#endif
31
32#include "sal/types.h"
33
34namespace rtl
35{
36
37/** Template reference class for reference type.
38*/
39template <class reference_type>
40class Reference
41{
42 /** The <b>reference_type</b> body pointer.
43 */
44 reference_type * m_pBody;
45
46
47public:
48 /** Constructor...
49 */
50 Reference()
51 : m_pBody (NULL__null)
52 {}
53
54
55 /** Constructor...
56 */
57 Reference (reference_type * pBody, __sal_NoAcquire)
58 : m_pBody (pBody)
59 {
60 }
61
62 /** Constructor...
63 */
64 Reference (reference_type * pBody)
65 : m_pBody (pBody)
66 {
67 if (m_pBody)
68 m_pBody->acquire();
69 }
70
71 /** Copy constructor...
72 */
73 Reference (const Reference<reference_type> & handle)
74 : m_pBody (handle.m_pBody)
75 {
76 if (m_pBody)
77 m_pBody->acquire();
78 }
79
80#ifdef LIBO_INTERNAL_ONLY1
81 /** Move constructor...
82 */
83 Reference (Reference<reference_type> && handle) noexcept
84 : m_pBody (handle.m_pBody)
85 {
86 handle.m_pBody = nullptr;
87 }
88#endif
89
90#if defined LIBO_INTERNAL_ONLY1
91 /** Up-casting conversion constructor: Copies interface reference.
92
93 Does not work for up-casts to ambiguous bases.
94
95 @param rRef another reference
96 */
97 template< class derived_type >
98 inline Reference(
99 const Reference< derived_type > & rRef,
100 std::enable_if_t<std::is_base_of_v<reference_type, derived_type>, int> = 0 )
101 : m_pBody (rRef.get())
102 {
103 if (m_pBody)
104 m_pBody->acquire();
105 }
106#endif
107
108 /** Destructor...
109 */
110 ~Reference() COVERITY_NOEXCEPT_FALSE
111 {
112 if (m_pBody)
113 m_pBody->release();
114 }
115
116 /** Set...
117 Similar to assignment.
118 */
119 Reference<reference_type> &
120 SAL_CALL set (reference_type * pBody)
121 {
122 if (pBody)
123 pBody->acquire();
124 reference_type * const pOld = m_pBody;
125 m_pBody = pBody;
126 if (pOld)
127 pOld->release();
128 return *this;
129 }
130
131 /** Assignment.
132 Unbinds this instance from its body (if bound) and
133 bind it to the body represented by the handle.
134 */
135 Reference<reference_type> &
136 SAL_CALL operator= (const Reference<reference_type> & handle)
137 {
138 return set( handle.m_pBody );
139 }
140
141#ifdef LIBO_INTERNAL_ONLY1
142 /** Assignment.
143 * Unbinds this instance from its body (if bound),
144 * bind it to the body represented by the handle, and
145 * set the body represented by the handle to nullptr.
146 */
147 Reference<reference_type> &
148 operator= (Reference<reference_type> && handle)
149 {
150 // self-movement guts ourself
151 if (m_pBody)
152 m_pBody->release();
153 m_pBody = handle.m_pBody;
154 handle.m_pBody = nullptr;
155 return *this;
156 }
157#endif
158
159 /** Assignment...
160 */
161 Reference<reference_type> &
162 SAL_CALL operator= (reference_type * pBody)
163 {
164 return set( pBody );
165 }
166
167 /** Unbind the body from this handle.
168 Note that for a handle representing a large body,
169 "handle.clear().set(new body());" _might_
170 perform a little bit better than "handle.set(new body());",
171 since in the second case two large objects exist in memory
172 (the old body and the new body).
173 */
174 Reference<reference_type> & SAL_CALL clear()
175 {
176 if (m_pBody)
177 {
178 reference_type * const pOld = m_pBody;
179 m_pBody = NULL__null;
180 pOld->release();
181 }
182 return *this;
183 }
184
185
186 /** Get the body. Can be used instead of operator->().
187 I.e. handle->someBodyOp() and handle.get()->someBodyOp()
188 are the same.
189 */
190 reference_type * SAL_CALL get() const
191 {
192 return m_pBody;
193 }
194
195
196 /** Probably most common used: handle->someBodyOp().
197 */
198 reference_type * SAL_CALL operator->() const
199 {
200 assert(m_pBody != NULL)(static_cast <bool> (m_pBody != __null) ? void (0) : __assert_fail
("m_pBody != NULL", "/home/maarten/src/libreoffice/core/include/rtl/ref.hxx"
, 200, __extension__ __PRETTY_FUNCTION__))
;
201 return m_pBody;
202 }
203
204
205 /** Allows (*handle).someBodyOp().
206 */
207 reference_type & SAL_CALL operator*() const
208 {
209 assert(m_pBody != NULL)(static_cast <bool> (m_pBody != __null) ? void (0) : __assert_fail
("m_pBody != NULL", "/home/maarten/src/libreoffice/core/include/rtl/ref.hxx"
, 209, __extension__ __PRETTY_FUNCTION__))
;
210 return *m_pBody;
211 }
212
213
214 /** Returns True if the handle does point to a valid body.
215 */
216 bool SAL_CALL is() const
217 {
218 return (m_pBody
3.1
Field 'm_pBody' is not equal to NULL
3.1
Field 'm_pBody' is not equal to NULL
3.1
Field 'm_pBody' is not equal to NULL
!= NULL__null)
;
4
Returning the value 1, which participates in a condition later
219 }
220
221#if defined LIBO_INTERNAL_ONLY1
222 /** Returns True if the handle does point to a valid body.
223 */
224 explicit operator bool() const
225 {
226 return is();
227 }
228#endif
229
230 /** Returns True if this points to pBody.
231 */
232 bool SAL_CALL operator== (const reference_type * pBody) const
233 {
234 return (m_pBody == pBody);
235 }
236
237
238 /** Returns True if handle points to the same body.
239 */
240 bool
241 SAL_CALL operator== (const Reference<reference_type> & handle) const
242 {
243 return (m_pBody == handle.m_pBody);
244 }
245
246
247 /** Needed to place References into STL collection.
248 */
249 bool
250 SAL_CALL operator!= (const Reference<reference_type> & handle) const
251 {
252 return (m_pBody != handle.m_pBody);
253 }
254
255
256 /** Needed to place References into STL collection.
257 */
258 bool
259 SAL_CALL operator< (const Reference<reference_type> & handle) const
260 {
261 return (m_pBody < handle.m_pBody);
262 }
263
264
265 /** Needed to place References into STL collection.
266 */
267 bool
268 SAL_CALL operator> (const Reference<reference_type> & handle) const
269 {
270 return (m_pBody > handle.m_pBody);
271 }
272};
273
274} // namespace rtl
275
276#if defined LIBO_INTERNAL_ONLY1
277namespace std
278{
279
280/// @cond INTERNAL
281/**
282 Make rtl::Reference hashable by default for use in STL containers.
283
284 @since LibreOffice 6.3
285*/
286template<typename T>
287struct hash<::rtl::Reference<T>>
288{
289 std::size_t operator()(::rtl::Reference<T> const & s) const
290 { return std::size_t(s.get()); }
291};
292/// @endcond
293
294}
295
296#endif
297
298#endif /* ! INCLUDED_RTL_REF_HXX */
299
300/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

/home/maarten/src/libreoffice/core/include/xmloff/xmlstyle.hxx

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#ifndef INCLUDED_XMLOFF_XMLSTYLE_HXX
21#define INCLUDED_XMLOFF_XMLSTYLE_HXX
22
23#include <rtl/ref.hxx>
24#include <sal/config.h>
25#include <xmloff/dllapi.h>
26#include <sal/types.h>
27#include <xmloff/xmlictxt.hxx>
28#include <xmloff/families.hxx>
29#include <memory>
30
31class SvXMLStylesContext_Impl;
32class SvXMLImportPropertyMapper;
33class SvXMLTokenMap;
34
35namespace com::sun::star {
36namespace container { class XNameContainer; }
37namespace style { class XAutoStyleFamily; }
38}
39
40enum XMLStyleStylesElemTokens
41{
42 XML_TOK_STYLE_STYLE,
43 XML_TOK_STYLE_PAGE_MASTER,
44 XML_TOK_TEXT_LIST_STYLE,
45 XML_TOK_TEXT_OUTLINE,
46 XML_TOK_STYLES_GRADIENTSTYLES,
47 XML_TOK_STYLES_HATCHSTYLES,
48 XML_TOK_STYLES_BITMAPSTYLES,
49 XML_TOK_STYLES_TRANSGRADIENTSTYLES,
50 XML_TOK_STYLES_MARKERSTYLES,
51 XML_TOK_STYLES_DASHSTYLES,
52 XML_TOK_TEXT_NOTE_CONFIG,
53 XML_TOK_TEXT_BIBLIOGRAPHY_CONFIG,
54 XML_TOK_TEXT_LINENUMBERING_CONFIG,
55 XML_TOK_STYLE_DEFAULT_STYLE,
56 XML_TOK_STYLE_DEFAULT_PAGE_LAYOUT //text grid enhancement
57};
58
59class XMLOFF_DLLPUBLIC__attribute__ ((visibility("default"))) SvXMLStyleContext : public SvXMLImportContext
60{
61 OUString maName;
62 OUString maDisplayName;
63 OUString maAutoName;
64 OUString maParentName;// Will be moved to XMLPropStyle soon!!!!
65 OUString maFollow; // Will be moved to XMLPropStyle soon!!!!
66 bool mbHidden;
67
68 XmlStyleFamily mnFamily;
69
70 bool mbValid : 1; // Set this to false in CreateAndInsert
71 // if the style shouldn't be processed
72 // by Finish() or si somehow invalid.
73 bool mbNew : 1; // Set this to false in CreateAnsInsert
74 // if the style is already existing.
75 bool mbDefaultStyle : 1;
76
77protected:
78
79 virtual void SetAttribute( sal_uInt16 nPrefixKey,
80 const OUString& rLocalName,
81 const OUString& rValue );
82
83 void SetFamily( XmlStyleFamily nSet ) { mnFamily = nSet; }
84 void SetAutoName( const OUString& rName ) { maAutoName = rName; }
85
86public:
87
88 SvXMLStyleContext( SvXMLImport& rImport,
89 XmlStyleFamily nFamily=XmlStyleFamily::DATA_STYLE,
90 bool bDefaultStyle = false );
91
92 virtual ~SvXMLStyleContext() override;
93
94 virtual void SAL_CALL startFastElement(
95 sal_Int32 nElement,
96 const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override;
97
98 const OUString& GetName() const { return maName; }
99 const OUString& GetDisplayName() const { return maDisplayName.getLength() ? maDisplayName : maName; }
100 const OUString& GetAutoName() const { return maAutoName; }
101 const OUString& GetParentName() const { return maParentName; }
102 const OUString& GetFollow() const { return maFollow; }
103
104 XmlStyleFamily GetFamily() const { return mnFamily; }
105
106 bool IsValid() const { return mbValid; }
107 void SetValid( bool b ) { mbValid = b; }
108
109 bool IsNew() const { return mbNew; }
110 void SetNew( bool b ) { mbNew = b; }
111
112 bool IsHidden() const { return mbHidden; }
113
114 // This method is called for every default style
115 virtual void SetDefaults();
116
117 // This method is called for every style. It must create it and insert
118 // it into the document.
119 virtual void CreateAndInsert( bool bOverwrite );
120
121 // This method is called for every style. It must create it and insert
122 // it into the document if this hasn't happened already in CreateAndInsert().
123 virtual void CreateAndInsertLate( bool bOverwrite );
124
125 // This method is called for every style after all styles have been
126 // inserted into the document.
127 virtual void Finish( bool bOverwrite );
128
129 bool IsDefaultStyle() const { return mbDefaultStyle; }
13
Returning zero, which participates in a condition later
130
131 /** if this method returns true, its parent styles context
132 should not add it to its container.<br>
133 Transient styles can't be accessed from its
134 parent SvXMLStylesContext after they are imported and
135 the methods CreateAndInsert(), CreateAndInsertLate()
136 and Finish() will not be called.
137 The default return value is false
138 */
139 virtual bool IsTransient() const;
140};
141
142class XMLOFF_DLLPUBLIC__attribute__ ((visibility("default"))) SvXMLStylesContext : public SvXMLImportContext
143{
144 std::unique_ptr<SvXMLStylesContext_Impl> mpImpl;
145
146
147 css::uno::Reference< css::container::XNameContainer > mxParaStyles;
148
149 css::uno::Reference< css::container::XNameContainer > mxTextStyles;
150
151 css::uno::Reference< css::style::XAutoStyleFamily > mxParaAutoStyles;
152
153 css::uno::Reference< css::style::XAutoStyleFamily > mxTextAutoStyles;
154
155 rtl::Reference < SvXMLImportPropertyMapper > mxParaImpPropMapper;
156 rtl::Reference < SvXMLImportPropertyMapper > mxTextImpPropMapper;
157 rtl::Reference < SvXMLImportPropertyMapper > mxShapeImpPropMapper;
158 mutable rtl::Reference < SvXMLImportPropertyMapper > mxChartImpPropMapper;
159 mutable rtl::Reference < SvXMLImportPropertyMapper > mxPageImpPropMapper;
160
161 SvXMLStylesContext(SvXMLStylesContext const &) = delete;
162 SvXMLStylesContext& operator =(SvXMLStylesContext const &) = delete;
163
164protected:
165
166 sal_uInt32 GetStyleCount() const;
167 SvXMLStyleContext *GetStyle( sal_uInt32 i );
168 const SvXMLStyleContext *GetStyle( sal_uInt32 i ) const;
169
170 virtual SvXMLStyleContext *CreateStyleChildContext(
171 sal_Int32 nElement,
172 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList );
173
174 virtual SvXMLStyleContext *CreateStyleStyleChildContext( XmlStyleFamily nFamily,
175 sal_Int32 nElement,
176 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList );
177
178 virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
179 XmlStyleFamily nFamily, sal_Int32 nElement,
180 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList );
181
182 virtual bool InsertStyleFamily( XmlStyleFamily nFamily ) const;
183
184public:
185
186 SvXMLStylesContext( SvXMLImport& rImport,
187 bool bAutomatic = false );
188
189 virtual ~SvXMLStylesContext() override;
190
191 virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
192 const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
193
194 // Create child element.
195 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
196 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
197
198 // This allows to add an SvXMLStyleContext to this context from extern
199 void AddStyle(SvXMLStyleContext& rNew);
200
201 const SvXMLStyleContext *FindStyleChildContext(
202 XmlStyleFamily nFamily,
203 const OUString& rName,
204 bool bCreateIndex = false ) const;
205 static XmlStyleFamily GetFamily( const OUString& rFamily );
206 virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper(
207 XmlStyleFamily nFamily ) const;
208
209 virtual css::uno::Reference< css::container::XNameContainer >
210 GetStylesContainer( XmlStyleFamily nFamily ) const;
211 virtual OUString GetServiceName( XmlStyleFamily nFamily ) const;
212
213 css::uno::Reference< css::style::XAutoStyleFamily >
214 GetAutoStyles( XmlStyleFamily nFamily ) const;
215 void CopyAutoStylesToDoc();
216 void CopyStylesToDoc( bool bOverwrite, bool bFinish = true );
217 void FinishStyles( bool bOverwrite );
218
219 // This method must be called to release the references to all styles
220 // that are stored in the context.
221 void dispose();
222 bool IsAutomaticStyle() const;
223};
224
225#endif // INCLUDED_XMLOFF_XMLSTYLE_HXX
226
227/* vim:set shiftwidth=4 softtabstop=4 expandtab: */