LibreOffice Module sw (master)  1
xmlfmt.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 <sal/log.hxx>
22 #include <osl/diagnose.h>
23 #include <tools/diagnose_ex.h>
24 #include <xmloff/nmspmap.hxx>
25 #include <fmtcol.hxx>
26 #include <hints.hxx>
27 #include <doc.hxx>
28 #include <docary.hxx>
30 #include <unoprnms.hxx>
31 #include <fmtpdsc.hxx>
32 #include <pagedesc.hxx>
33 #include <xmloff/maptype.hxx>
34 #include <xmloff/xmlnumfi.hxx>
35 #include <xmloff/xmlprmap.hxx>
36 #include <xmloff/xmlnmspe.hxx>
37 #include <xmloff/xmlstyle.hxx>
38 #include <xmloff/txtstyli.hxx>
39 #include <xmloff/txtimp.hxx>
40 #include <xmloff/families.hxx>
47 #include <com/sun/star/beans/XPropertySet.hpp>
48 #include <com/sun/star/frame/XModel.hpp>
49 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
50 #include "xmlimp.hxx"
51 #include <cellatr.hxx>
52 #include <SwStyleNameMapper.hxx>
53 #include <xmloff/attrlist.hxx>
54 #include <ccoll.hxx>
55 
56 #include <memory>
57 
58 using namespace ::com::sun::star;
59 using namespace ::com::sun::star::beans;
60 using namespace ::com::sun::star::uno;
61 using namespace ::xmloff::token;
62 
63 namespace {
64 
65 class SwXMLConditionParser_Impl
66 {
67  OUString sInput;
68 
69  Master_CollCondition nCondition;
70  sal_uInt32 nSubCondition;
71 
72  sal_Int32 nPos;
73  sal_Int32 nLength;
74 
75  inline bool SkipWS();
76  inline bool MatchChar( sal_Unicode c );
77  inline bool MatchName( OUString& rName );
78  inline bool MatchNumber( sal_uInt32& rNumber );
79 
80 public:
81 
82  explicit SwXMLConditionParser_Impl( const OUString& rInp );
83 
84  bool IsValid() const { return Master_CollCondition::NONE != nCondition; }
85 
86  Master_CollCondition GetCondition() const { return nCondition; }
87  sal_uInt32 GetSubCondition() const { return nSubCondition; }
88 };
89 
90 }
91 
92 inline bool SwXMLConditionParser_Impl::SkipWS()
93 {
94  while( nPos < nLength && ' ' == sInput[nPos] )
95  nPos++;
96  return true;
97 }
98 
99 inline bool SwXMLConditionParser_Impl::MatchChar( sal_Unicode c )
100 {
101  bool bRet = false;
102  if( nPos < nLength && c == sInput[nPos] )
103  {
104  nPos++;
105  bRet = true;
106  }
107  return bRet;
108 }
109 
110 inline bool SwXMLConditionParser_Impl::MatchName( OUString& rName )
111 {
112  OUStringBuffer sBuffer( nLength );
113  while( nPos < nLength &&
114  ( ('a' <= sInput[nPos] && sInput[nPos] <= 'z') ||
115  '-' == sInput[nPos] ) )
116  {
117  sBuffer.append( sInput[nPos] );
118  nPos++;
119  }
120  rName = sBuffer.makeStringAndClear();
121  return !rName.isEmpty();
122 }
123 
124 inline bool SwXMLConditionParser_Impl::MatchNumber( sal_uInt32& rNumber )
125 {
126  OUStringBuffer sBuffer( nLength );
127  while( nPos < nLength && '0' <= sInput[nPos] && sInput[nPos] <= '9' )
128  {
129  sBuffer.append( sInput[nPos] );
130  nPos++;
131  }
132 
133  OUString sNum( sBuffer.makeStringAndClear() );
134  if( !sNum.isEmpty() )
135  rNumber = sNum.toInt32();
136  return !sNum.isEmpty();
137 }
138 
139 SwXMLConditionParser_Impl::SwXMLConditionParser_Impl( const OUString& rInp ) :
140  sInput( rInp ),
141  nCondition( Master_CollCondition::NONE ),
142  nSubCondition( 0 ),
143  nPos( 0 ),
144  nLength( rInp.getLength() )
145 {
146  OUString sFunc;
147  bool bHasSub = false;
148  sal_uInt32 nSub = 0;
149  bool bOK = SkipWS() && MatchName( sFunc ) && SkipWS() &&
150  MatchChar( '(' ) && SkipWS() && MatchChar( ')' ) && SkipWS();
151  if( bOK && MatchChar( '=' ) )
152  {
153  bOK = SkipWS() && MatchNumber( nSub ) && SkipWS();
154  bHasSub = true;
155  }
156 
157  bOK &= nPos == nLength;
158 
159  if( bOK )
160  {
161  if( IsXMLToken( sFunc, XML_ENDNOTE ) && !bHasSub )
163  else if( IsXMLToken( sFunc, XML_FOOTER ) && !bHasSub )
165  else if( IsXMLToken( sFunc, XML_FOOTNOTE ) && !bHasSub )
167  else if( IsXMLToken( sFunc, XML_HEADER ) && !bHasSub )
169  else if( IsXMLToken( sFunc, XML_LIST_LEVEL) &&
170  nSub >=1 && nSub <= MAXLEVEL )
171  {
173  nSubCondition = nSub-1;
174  }
175  else if( IsXMLToken( sFunc, XML_OUTLINE_LEVEL) &&
176  nSub >=1 && nSub <= MAXLEVEL )
177  {
179  nSubCondition = nSub-1;
180  }
181  else if( IsXMLToken( sFunc, XML_SECTION ) && !bHasSub )
182  {
184  }
185  else if( IsXMLToken( sFunc, XML_TABLE ) && !bHasSub )
186  {
188  }
189  else if( IsXMLToken( sFunc, XML_TABLE_HEADER ) && !bHasSub )
190  {
192  }
193  else if( IsXMLToken( sFunc, XML_TEXT_BOX ) && !bHasSub )
194  {
196  }
197  }
198 }
199 
200 namespace {
201 
202 class SwXMLConditionContext_Impl : public SvXMLImportContext
203 {
204  Master_CollCondition nCondition;
205  sal_uInt32 nSubCondition;
206 
207  OUString sApplyStyle;
208 
209 public:
210 
211  SwXMLConditionContext_Impl(
212  SvXMLImport& rImport, sal_uInt16 nPrfx,
213  const OUString& rLName,
214  const uno::Reference< xml::sax::XAttributeList > & xAttrList );
215 
216  bool IsValid() const { return Master_CollCondition::NONE != nCondition; }
217 
218  Master_CollCondition getCondition() const { return nCondition; }
219  sal_uInt32 getSubCondition() const { return nSubCondition; }
220  OUString const &getApplyStyle() const { return sApplyStyle; }
221 };
222 
223 }
224 
225 SwXMLConditionContext_Impl::SwXMLConditionContext_Impl(
226  SvXMLImport& rImport, sal_uInt16 nPrfx,
227  const OUString& rLName,
228  const uno::Reference< xml::sax::XAttributeList > & xAttrList ) :
229  SvXMLImportContext( rImport, nPrfx, rLName ),
230  nCondition( Master_CollCondition::NONE ),
231  nSubCondition( 0 )
232 {
233  sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
234  for( sal_Int16 i=0; i < nAttrCount; i++ )
235  {
236  const OUString& rAttrName = xAttrList->getNameByIndex( i );
237  OUString aLocalName;
238  const sal_uInt16 nPrefix =
239  GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
240  &aLocalName );
241  const OUString& rValue = xAttrList->getValueByIndex( i );
242 
243  // TODO: use a map here
244  if( XML_NAMESPACE_STYLE == nPrefix )
245  {
246  if( IsXMLToken( aLocalName, XML_CONDITION ) )
247  {
248  SwXMLConditionParser_Impl aCondParser( rValue );
249  if( aCondParser.IsValid() )
250  {
251  nCondition = aCondParser.GetCondition();
252  nSubCondition = aCondParser.GetSubCondition();
253  }
254  }
255  else if( IsXMLToken( aLocalName, XML_APPLY_STYLE_NAME ) )
256  {
257  sApplyStyle = rValue;
258  }
259  }
260  }
261 }
262 
263 typedef std::vector<rtl::Reference<SwXMLConditionContext_Impl>> SwXMLConditions_Impl;
264 
265 namespace {
266 
267 class SwXMLTextStyleContext_Impl : public XMLTextStyleContext
268 {
269  std::unique_ptr<SwXMLConditions_Impl> pConditions;
270  uno::Reference < style::XStyle > xNewStyle;
271 
272 protected:
273 
274  virtual uno::Reference < style::XStyle > Create() override;
275  virtual void Finish( bool bOverwrite ) override;
276 
277 public:
278 
279 
280  SwXMLTextStyleContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx,
281  const OUString& rLName,
282  const uno::Reference< xml::sax::XAttributeList > & xAttrList,
283  XmlStyleFamily nFamily,
284  SvXMLStylesContext& rStyles );
285 
287  sal_uInt16 nPrefix,
288  const OUString& rLocalName,
289  const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override;
290 };
291 
292 }
293 
294 uno::Reference < style::XStyle > SwXMLTextStyleContext_Impl::Create()
295 {
296 
297  if( pConditions && XmlStyleFamily::TEXT_PARAGRAPH == GetFamily() )
298  {
299  uno::Reference< lang::XMultiServiceFactory > xFactory( GetImport().GetModel(),
300  uno::UNO_QUERY );
301  if( xFactory.is() )
302  {
303  uno::Reference < uno::XInterface > xIfc =
304  xFactory->createInstance( "com.sun.star.style.ConditionalParagraphStyle" );
305  if( xIfc.is() )
306  xNewStyle.set( xIfc, uno::UNO_QUERY );
307  }
308  }
309  else
310  {
311  xNewStyle = XMLTextStyleContext::Create();
312  }
313 
314  return xNewStyle;
315 }
316 
317 void
318 SwXMLTextStyleContext_Impl::Finish( bool bOverwrite )
319 {
320 
321  if( pConditions && XmlStyleFamily::TEXT_PARAGRAPH == GetFamily() && xNewStyle.is() )
322  {
323  CommandStruct const*const pCommands = SwCondCollItem::GetCmds();
324 
325  Reference< XPropertySet > xPropSet( xNewStyle, UNO_QUERY );
326 
327  uno::Sequence< beans::NamedValue > aSeq( pConditions->size() );
328 
329  for (std::vector<rtl::Reference<SwXMLConditionContext_Impl>>::size_type i = 0;
330  i < pConditions->size(); ++i)
331  {
332  assert((*pConditions)[i]->IsValid()); // checked before inserting
333  Master_CollCondition nCond = (*pConditions)[i]->getCondition();
334  sal_uInt32 nSubCond = (*pConditions)[i]->getSubCondition();
335 
336  for (size_t j = 0; j < COND_COMMAND_COUNT; ++j)
337  {
338  if (pCommands[j].nCnd == nCond &&
339  pCommands[j].nSubCond == nSubCond)
340  {
341  aSeq[i].Name = GetCommandContextByIndex( j );
342  aSeq[i].Value <<= GetImport().GetStyleDisplayName(
343  GetFamily(), (*pConditions)[i]->getApplyStyle() );
344  break;
345  }
346  }
347  }
348 
349  try
350  {
351  xPropSet->setPropertyValue(UNO_NAME_PARA_STYLE_CONDITIONS, uno::makeAny(aSeq));
352  }
353  catch (uno::Exception const&)
354  {
355  TOOLS_WARN_EXCEPTION("sw.xml", "exception when setting ParaStyleConditions");
356  }
357  }
358  XMLTextStyleContext::Finish( bOverwrite );
359 }
360 
361 SwXMLTextStyleContext_Impl::SwXMLTextStyleContext_Impl( SwXMLImport& rImport,
362  sal_uInt16 nPrfx, const OUString& rLName,
363  const uno::Reference< xml::sax::XAttributeList > & xAttrList,
364  XmlStyleFamily nFamily,
365  SvXMLStylesContext& rStyles ) :
366  XMLTextStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily )
367 {
368 }
369 
370 SvXMLImportContextRef SwXMLTextStyleContext_Impl::CreateChildContext(
371  sal_uInt16 nPrefix,
372  const OUString& rLocalName,
373  const uno::Reference< xml::sax::XAttributeList > & xAttrList )
374 {
375  SvXMLImportContextRef xContext;
376 
377  if( XML_NAMESPACE_STYLE == nPrefix && IsXMLToken( rLocalName, XML_MAP ) )
378  {
380  new SwXMLConditionContext_Impl( GetImport(), nPrefix,
381  rLocalName, xAttrList )};
382  if( xCond->IsValid() )
383  {
384  if( !pConditions )
385  pConditions = std::make_unique<SwXMLConditions_Impl>();
386  pConditions->push_back( xCond );
387  }
388  xContext = xCond.get();
389  }
390 
391  if (!xContext)
392  xContext = XMLTextStyleContext::CreateChildContext( nPrefix, rLocalName,
393  xAttrList );
394 
395  return xContext;
396 }
397 
398 namespace {
399 
400 class SwXMLCellStyleContext : public XMLPropStyleContext
401 {
402  OUString m_sDataStyleName;
403  void AddDataFormat();
404 public:
406  virtual void FillPropertySet(const css::uno::Reference<css::beans::XPropertySet>& rPropSet) override;
407  virtual void SetAttribute(sal_uInt16 nPrefixKey, const OUString& rLocalName, const OUString& rValue) override;
408 };
409 
410 class SwXMLItemSetStyleContext_Impl : public SvXMLStyleContext
411 {
412  OUString sMasterPageName;
413  std::unique_ptr<SfxItemSet> pItemSet;
414  SwXMLTextStyleContext_Impl *pTextStyle;
415  SvXMLStylesContext &rStyles;
416 
417  OUString sDataStyleName;
418 
419  bool bHasMasterPageName : 1;
420  bool bPageDescConnected : 1;
421  bool bDataStyleIsResolved;
422 
423  SvXMLImportContext *CreateItemSetContext(
424  sal_uInt16 nPrefix,
425  const OUString& rLName,
426  const uno::Reference< xml::sax::XAttributeList > & xAttrList);
427 
428 protected:
429 
430  virtual void SetAttribute( sal_uInt16 nPrefixKey,
431  const OUString& rLocalName,
432  const OUString& rValue ) override;
433 
434  SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); }
435 
436 public:
437 
438 
439  SwXMLItemSetStyleContext_Impl(
440  SwXMLImport& rImport, sal_uInt16 nPrfx,
441  const OUString& rLName,
442  const uno::Reference< xml::sax::XAttributeList > & xAttrList,
443  SvXMLStylesContext& rStylesC,
444  XmlStyleFamily nFamily);
445 
446  virtual void CreateAndInsert( bool bOverwrite ) override;
447 
449  sal_uInt16 nPrefix,
450  const OUString& rLocalName,
451  const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override;
452 
453  // The item set may be empty!
454  SfxItemSet *GetItemSet() { return pItemSet.get(); }
455 
456  bool HasMasterPageName() const { return bHasMasterPageName; }
457 
458  bool IsPageDescConnected() const { return bPageDescConnected; }
459  void ConnectPageDesc();
460 
461  bool ResolveDataStyleName();
462 };
463 
464 }
465 
466 void SwXMLCellStyleContext::AddDataFormat()
467 {
468  if (m_sDataStyleName.isEmpty() || IsDefaultStyle())
469  return;
470 
471  const SvXMLNumFormatContext* pStyle = static_cast<const SvXMLNumFormatContext*>(
472  GetStyles()->FindStyleChildContext(XmlStyleFamily::DATA_STYLE, m_sDataStyleName, true));
473 
474  if (!pStyle)
475  {
476  SAL_WARN("sw.xml", "not possible to get data style " << m_sDataStyleName);
477  return;
478  }
479 
480  sal_Int32 nNumberFormat = const_cast<SvXMLNumFormatContext*>(pStyle)->GetKey();
481  if (nNumberFormat < 0)
482  return;
483 
484  rtl::Reference<SvXMLImportPropertyMapper> xPropertyMapper(GetStyles()->GetImportPropertyMapper(GetFamily()));
485  if (!xPropertyMapper.is())
486  {
487  SAL_WARN("sw.xml", "there is no import prop mapper");
488  return;
489  }
490 
491  const rtl::Reference<XMLPropertySetMapper>& xPropertySetMapper(xPropertyMapper->getPropertySetMapper());
492  sal_Int32 nIndex = xPropertySetMapper->GetEntryIndex(XML_NAMESPACE_STYLE, GetXMLToken(XML_DATA_STYLE_NAME), 0);
493  if (nIndex < 0)
494  {
495  SAL_WARN("sw.xml", "could not find id for " << GetXMLToken(XML_DATA_STYLE_NAME));
496  return;
497  }
498 
499  auto aIter = std::find_if(GetProperties().begin(), GetProperties().end(),
500  [&nIndex](const XMLPropertyState& rProp) {
501  return rProp.mnIndex == nIndex;
502  });
503 
504  if (aIter != GetProperties().end())
505  aIter->maValue <<= nNumberFormat;
506  else
507  GetProperties().push_back(XMLPropertyState(nIndex, makeAny(nNumberFormat)));
508 }
509 
510 void SwXMLCellStyleContext::FillPropertySet(const css::uno::Reference<css::beans::XPropertySet>& rPropSet)
511 {
512  AddDataFormat();
514 }
515 
516 void SwXMLCellStyleContext::SetAttribute(sal_uInt16 nPrefixKey, const OUString& rLocalName, const OUString& rValue)
517 {
518  if (IsXMLToken(rLocalName, XML_DATA_STYLE_NAME))
519  m_sDataStyleName = rValue;
520  else
521  XMLPropStyleContext::SetAttribute(nPrefixKey, rLocalName, rValue);
522 }
523 
524 void SwXMLItemSetStyleContext_Impl::SetAttribute( sal_uInt16 nPrefixKey,
525  const OUString& rLocalName,
526  const OUString& rValue )
527 {
528  if( XML_NAMESPACE_STYLE == nPrefixKey )
529  {
530  if ( IsXMLToken( rLocalName, XML_MASTER_PAGE_NAME ) )
531  {
532  sMasterPageName = rValue;
533  bHasMasterPageName = true;
534  }
535  else if ( IsXMLToken( rLocalName, XML_DATA_STYLE_NAME ) )
536  {
537  // if we have a valid data style name
538  if (!rValue.isEmpty())
539  {
540  sDataStyleName = rValue;
541  bDataStyleIsResolved = false; // needs to be resolved
542  }
543  }
544  else
545  {
546  SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
547  }
548  }
549  else
550  {
551  SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
552  }
553 }
554 
555 SvXMLImportContext *SwXMLItemSetStyleContext_Impl::CreateItemSetContext(
556  sal_uInt16 nPrefix, const OUString& rLName,
557  const uno::Reference< xml::sax::XAttributeList > & xAttrList )
558 {
559  OSL_ENSURE( !pItemSet,
560  "SwXMLItemSetStyleContext_Impl::CreateItemSetContext: item set exists" );
561 
562  SvXMLImportContext *pContext = nullptr;
563 
564  SwDoc* pDoc = SwImport::GetDocFromXMLImport( GetSwImport() );
565 
566  SfxItemPool& rItemPool = pDoc->GetAttrPool();
567  switch( GetFamily() )
568  {
569  case XmlStyleFamily::TABLE_TABLE:
570  pItemSet.reset( new SfxItemSet( rItemPool, aTableSetRange ) );
571  break;
572  case XmlStyleFamily::TABLE_COLUMN:
573  pItemSet.reset( new SfxItemSet( rItemPool, svl::Items<RES_FRM_SIZE, RES_FRM_SIZE>{} ) );
574  break;
575  case XmlStyleFamily::TABLE_ROW:
576  pItemSet.reset( new SfxItemSet( rItemPool, aTableLineSetRange ) );
577  break;
578  case XmlStyleFamily::TABLE_CELL:
579  pItemSet.reset( new SfxItemSet( rItemPool, aTableBoxSetRange ) );
580  break;
581  default:
582  OSL_ENSURE( false,
583  "SwXMLItemSetStyleContext_Impl::CreateItemSetContext: unknown family" );
584  break;
585  }
586  if( pItemSet )
587  pContext = GetSwImport().CreateTableItemImportContext(
588  nPrefix, rLName, xAttrList, GetFamily(),
589  *pItemSet );
590  if( !pContext )
591  {
592  pItemSet.reset();
593  }
594 
595  return pContext;
596 }
597 
598 
599 SwXMLItemSetStyleContext_Impl::SwXMLItemSetStyleContext_Impl( SwXMLImport& rImport,
600  sal_uInt16 nPrfx, const OUString& rLName,
601  const uno::Reference< xml::sax::XAttributeList > & xAttrList,
602  SvXMLStylesContext& rStylesC,
603  XmlStyleFamily nFamily ) :
604  SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, nFamily ),
605  pTextStyle( nullptr ),
606  rStyles( rStylesC ),
607  bHasMasterPageName( false ),
608  bPageDescConnected( false ),
609  bDataStyleIsResolved( true )
610 {
611 }
612 
613 void SwXMLItemSetStyleContext_Impl::CreateAndInsert( bool bOverwrite )
614 {
615  if( pTextStyle )
616  pTextStyle->CreateAndInsert( bOverwrite );
617 }
618 
619 SvXMLImportContextRef SwXMLItemSetStyleContext_Impl::CreateChildContext(
620  sal_uInt16 nPrefix,
621  const OUString& rLocalName,
622  const uno::Reference< xml::sax::XAttributeList > & xAttrList )
623 {
624  SvXMLImportContextRef xContext;
625 
626  if( XML_NAMESPACE_STYLE == nPrefix )
627  {
628  if( IsXMLToken( rLocalName, XML_TABLE_PROPERTIES ) ||
629  IsXMLToken( rLocalName, XML_TABLE_COLUMN_PROPERTIES ) ||
630  IsXMLToken( rLocalName, XML_TABLE_ROW_PROPERTIES ) ||
631  IsXMLToken( rLocalName, XML_TABLE_CELL_PROPERTIES ) )
632  {
633  xContext = CreateItemSetContext( nPrefix, rLocalName, xAttrList );
634  }
635  else if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) ||
636  IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ))
637  {
638  if( !pTextStyle )
639  {
641  const OUString aStr = GetImport().GetNamespaceMap().GetQNameByKey(
642  nPrefix, GetXMLToken(XML_NAME) );
643  pTmp->AddAttribute( aStr, GetName() );
644  uno::Reference <xml::sax::XAttributeList> xTmpAttrList = pTmp;
645  pTextStyle = new SwXMLTextStyleContext_Impl( GetSwImport(), nPrefix,
646  rLocalName, xTmpAttrList, XmlStyleFamily::TEXT_PARAGRAPH, rStyles );
647  pTextStyle->StartElement( xTmpAttrList );
648  rStyles.AddStyle( *pTextStyle );
649  }
650  xContext = pTextStyle->CreateChildContext( nPrefix, rLocalName, xAttrList );
651  }
652  }
653 
654  if (!xContext)
655  xContext = SvXMLStyleContext::CreateChildContext( nPrefix, rLocalName,
656  xAttrList );
657 
658  return xContext;
659 }
660 
661 void SwXMLItemSetStyleContext_Impl::ConnectPageDesc()
662 {
663  if( bPageDescConnected || !HasMasterPageName() )
664  return;
665  bPageDescConnected = true;
666 
667  SwDoc *pDoc = SwImport::GetDocFromXMLImport( GetSwImport() );
668 
669  // #i40788# - first determine the display name of the page style,
670  // then map this name to the corresponding user interface name.
671  OUString sName = GetImport().GetStyleDisplayName( XmlStyleFamily::MASTER_PAGE,
672  sMasterPageName );
674  sName,
676  SwPageDesc *pPageDesc = pDoc->FindPageDesc(sName);
677  if( !pPageDesc )
678  {
679  // If the page style is a pool style, then we maybe have to create it
680  // first if it hasn't been used by now.
681  const sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sName, SwGetPoolIdFromName::PageDesc );
682  if( USHRT_MAX != nPoolId )
683  pPageDesc = pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( nPoolId, false );
684  }
685 
686  if( !pPageDesc )
687  return;
688 
689  if( !pItemSet )
690  {
691  SfxItemPool& rItemPool = pDoc->GetAttrPool();
692  pItemSet.reset( new SfxItemSet( rItemPool, aTableSetRange ) );
693  }
694 
695  const SfxPoolItem *pItem;
696  std::unique_ptr<SwFormatPageDesc> pFormatPageDesc;
697  if( SfxItemState::SET == pItemSet->GetItemState( RES_PAGEDESC, false,
698  &pItem ) )
699  {
700  if( static_cast<const SwFormatPageDesc *>(pItem)->GetPageDesc() != pPageDesc )
701  pFormatPageDesc.reset(new SwFormatPageDesc( *static_cast<const SwFormatPageDesc *>(pItem) ));
702  }
703  else
704  pFormatPageDesc.reset(new SwFormatPageDesc());
705 
706  if( pFormatPageDesc )
707  {
708  pFormatPageDesc->RegisterToPageDesc( *pPageDesc );
709  pItemSet->Put( *pFormatPageDesc );
710  }
711 }
712 
713 bool SwXMLItemSetStyleContext_Impl::ResolveDataStyleName()
714 {
715  // resolve, if not already done
716  if (! bDataStyleIsResolved)
717  {
718  // get the format key
719  sal_Int32 nFormat =
720  GetImport().GetTextImport()->GetDataStyleKey(sDataStyleName);
721 
722  // if the key is valid, insert Item into ItemSet
723  if( -1 != nFormat )
724  {
725  if( !pItemSet )
726  {
727  SwDoc *pDoc = SwImport::GetDocFromXMLImport( GetSwImport() );
728 
729  SfxItemPool& rItemPool = pDoc->GetAttrPool();
730  pItemSet.reset( new SfxItemSet( rItemPool, aTableBoxSetRange ) );
731  }
732  SwTableBoxNumFormat aNumFormatItem(nFormat);
733  pItemSet->Put(aNumFormatItem);
734  }
735 
736  // now resolved
737  bDataStyleIsResolved = true;
738  return true;
739  }
740  else
741  {
742  // was already resolved; nothing to do
743  return false;
744  }
745 }
746 
747 namespace {
748 
749 class SwXMLStylesContext_Impl : public SvXMLStylesContext
750 {
751  SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); }
752  const SwXMLImport& GetSwImport() const
753  { return static_cast<const SwXMLImport&>(GetImport()); }
754 
755 protected:
756 
757  virtual SvXMLStyleContext *CreateStyleChildContext( sal_uInt16 nPrefix,
758  const OUString& rLocalName,
759  const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
760 
762  sal_uInt16 nPrefix, const OUString& rLocalName,
763  const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override;
765  XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
766  const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override;
767  // HACK
769  XmlStyleFamily nFamily ) const override;
770 
771  virtual uno::Reference < container::XNameContainer >
772  GetStylesContainer( XmlStyleFamily nFamily ) const override;
773  virtual OUString GetServiceName( XmlStyleFamily nFamily ) const override;
774  // HACK
775 
776 public:
777 
778 
779  SwXMLStylesContext_Impl(
780  SwXMLImport& rImport,
781  bool bAuto );
782 
783  virtual bool InsertStyleFamily( XmlStyleFamily nFamily ) const override;
784 
785  virtual void EndElement() override;
786 };
787 
788 }
789 
790 SvXMLStyleContext *SwXMLStylesContext_Impl::CreateStyleChildContext( sal_uInt16 nPrefix,
791  const OUString& rLocalName,
792  const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList )
793 {
794  SvXMLStyleContext* pContext = nullptr;
795 
796  if(nPrefix == XML_NAMESPACE_TABLE && IsXMLToken(rLocalName, XML_TABLE_TEMPLATE))
797  {
798  rtl::Reference<XMLTableImport> xTableImport = GetImport().GetShapeImport()->GetShapeTableImport();
799  pContext = xTableImport->CreateTableTemplateContext(nPrefix, rLocalName, xAttrList);
800  }
801  if (!pContext)
802  pContext = SvXMLStylesContext::CreateStyleChildContext(nPrefix, rLocalName, xAttrList);
803 
804  return pContext;
805 }
806 
807 SvXMLStyleContext *SwXMLStylesContext_Impl::CreateStyleStyleChildContext(
808  XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
809  const uno::Reference< xml::sax::XAttributeList > & xAttrList )
810 {
811  SvXMLStyleContext *pStyle = nullptr;
812 
813  switch( nFamily )
814  {
815  case XmlStyleFamily::TEXT_PARAGRAPH:
816  pStyle = new SwXMLTextStyleContext_Impl( GetSwImport(), nPrefix,
817  rLocalName, xAttrList, nFamily, *this );
818  break;
819  case XmlStyleFamily::TABLE_TABLE:
820  case XmlStyleFamily::TABLE_COLUMN:
821  case XmlStyleFamily::TABLE_ROW:
822  case XmlStyleFamily::TABLE_CELL:
823  // Distinguish real and automatic styles.
824  if (IsAutomaticStyle())
825  pStyle = new SwXMLItemSetStyleContext_Impl(GetSwImport(), nPrefix, rLocalName, xAttrList, *this, nFamily);
826  else if (nFamily == XmlStyleFamily::TABLE_CELL) // Real cell styles are used for table-template import.
827  pStyle = new SwXMLCellStyleContext(GetSwImport(), nPrefix, rLocalName, xAttrList, *this, nFamily);
828  else
829  SAL_WARN("sw.xml", "Context does not exists for non automatic table, column or row style.");
830  break;
831  case XmlStyleFamily::SD_GRAPHICS_ID:
832  // As long as there are no element items, we can use the text
833  // style class.
834  pStyle = new XMLTextShapeStyleContext( GetImport(), nPrefix,
835  rLocalName, xAttrList, *this, nFamily );
836  break;
837  case XmlStyleFamily::SD_DRAWINGPAGE_ID:
838  pStyle = new XMLDrawingPageStyleContext(GetImport(), nPrefix, rLocalName,
839  xAttrList, *this, g_MasterPageContextIDs, g_MasterPageFamilies);
840  break;
841  default:
843  nPrefix,
844  rLocalName,
845  xAttrList );
846  break;
847  }
848 
849  return pStyle;
850 }
851 
852 SvXMLStyleContext *SwXMLStylesContext_Impl::CreateDefaultStyleStyleChildContext(
853  XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
854  const uno::Reference< xml::sax::XAttributeList > & xAttrList )
855 {
856  SvXMLStyleContext *pStyle = nullptr;
857 
858  switch( nFamily )
859  {
860  case XmlStyleFamily::TEXT_PARAGRAPH:
861  case XmlStyleFamily::TABLE_TABLE:
862  case XmlStyleFamily::TABLE_ROW:
863  pStyle = new XMLTextStyleContext( GetImport(), nPrefix, rLocalName,
864  xAttrList, *this, nFamily,
865  true );
866  break;
867  case XmlStyleFamily::SD_GRAPHICS_ID:
868  // There are no writer specific defaults for graphic styles!
869  pStyle = new XMLGraphicsDefaultStyle( GetImport(), nPrefix,
870  rLocalName, xAttrList, *this );
871  break;
872  default:
874  nPrefix,
875  rLocalName,
876  xAttrList );
877  break;
878  }
879 
880  return pStyle;
881 }
882 
883 SwXMLStylesContext_Impl::SwXMLStylesContext_Impl(
884  SwXMLImport& rImport,
885  bool bAuto ) :
886  SvXMLStylesContext( rImport, bAuto )
887 {
888 }
889 
890 bool SwXMLStylesContext_Impl::InsertStyleFamily( XmlStyleFamily nFamily ) const
891 {
892  const SwXMLImport& rSwImport = GetSwImport();
893  const SfxStyleFamily nStyleFamilyMask = rSwImport.GetStyleFamilyMask();
894 
895  bool bIns = true;
896  switch( nFamily )
897  {
898  case XmlStyleFamily::TEXT_PARAGRAPH:
899  bIns = bool(nStyleFamilyMask & SfxStyleFamily::Para);
900  break;
901  case XmlStyleFamily::TEXT_TEXT:
902  bIns = bool(nStyleFamilyMask & SfxStyleFamily::Char);
903  break;
904  case XmlStyleFamily::SD_GRAPHICS_ID:
905  bIns = bool(nStyleFamilyMask & SfxStyleFamily::Frame);
906  break;
907  case XmlStyleFamily::TEXT_LIST:
908  bIns = bool(nStyleFamilyMask & SfxStyleFamily::Pseudo);
909  break;
910  case XmlStyleFamily::TEXT_OUTLINE:
911  case XmlStyleFamily::TEXT_FOOTNOTECONFIG:
912  case XmlStyleFamily::TEXT_ENDNOTECONFIG:
913  case XmlStyleFamily::TEXT_LINENUMBERINGCONFIG:
914  case XmlStyleFamily::TEXT_BIBLIOGRAPHYCONFIG:
915  bIns = !(rSwImport.IsInsertMode() || rSwImport.IsStylesOnlyMode() ||
916  rSwImport.IsBlockMode());
917  break;
918  default:
919  bIns = SvXMLStylesContext::InsertStyleFamily( nFamily );
920  break;
921  }
922 
923  return bIns;
924 }
925 
926 rtl::Reference < SvXMLImportPropertyMapper > SwXMLStylesContext_Impl::GetImportPropertyMapper(
927  XmlStyleFamily nFamily ) const
928 {
930  if( nFamily == XmlStyleFamily::TABLE_TABLE )
932  const_cast<SwXMLStylesContext_Impl*>( this )->GetImport() );
933  else if( nFamily == XmlStyleFamily::TABLE_ROW )
935  const_cast<SwXMLStylesContext_Impl*>( this )->GetImport() );
936  else if( nFamily == XmlStyleFamily::TABLE_CELL )
938  const_cast<SwXMLStylesContext_Impl*>( this )->GetImport() );
939  else if (nFamily == XmlStyleFamily::SD_DRAWINGPAGE_ID)
940  {
942  const_cast<SwXMLStylesContext_Impl*>(this)->GetImport());
943  }
944  else
945  xMapper = SvXMLStylesContext::GetImportPropertyMapper( nFamily );
946  return xMapper;
947 }
948 
949 uno::Reference < container::XNameContainer > SwXMLStylesContext_Impl::GetStylesContainer(
950  XmlStyleFamily nFamily ) const
951 {
952  uno::Reference < container::XNameContainer > xStyles;
953  if( XmlStyleFamily::SD_GRAPHICS_ID == nFamily )
954  xStyles = const_cast<SvXMLImport *>(&GetImport())->GetTextImport()->GetFrameStyles();
955  else if( XmlStyleFamily::TABLE_CELL == nFamily )
956  xStyles = const_cast<SvXMLImport *>(&GetImport())->GetTextImport()->GetCellStyles();
957 
958  if (!xStyles.is())
959  xStyles = SvXMLStylesContext::GetStylesContainer( nFamily );
960 
961  return xStyles;
962 }
963 
964 OUString SwXMLStylesContext_Impl::GetServiceName( XmlStyleFamily nFamily ) const
965 {
966  if( XmlStyleFamily::SD_GRAPHICS_ID == nFamily )
967  return "com.sun.star.style.FrameStyle";
968  else if( XmlStyleFamily::TABLE_CELL == nFamily )
969  return "com.sun.star.style.CellStyle";
970 
971  return SvXMLStylesContext::GetServiceName( nFamily );
972 }
973 
974 void SwXMLStylesContext_Impl::EndElement()
975 {
976  GetSwImport().InsertStyles( IsAutomaticStyle() );
977 }
978 
979 namespace {
980 
981 class SwXMLMasterStylesContext_Impl : public XMLTextMasterStylesContext
982 {
983 protected:
984  virtual bool InsertStyleFamily( XmlStyleFamily nFamily ) const override;
985 
986  SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); }
987  const SwXMLImport& GetSwImport() const
988  { return static_cast<const SwXMLImport&>(GetImport()); }
989 
990 public:
991 
992 
993  SwXMLMasterStylesContext_Impl( SwXMLImport& rImport );
994 
995  virtual void EndElement() override;
996 };
997 
998 }
999 
1000 SwXMLMasterStylesContext_Impl::SwXMLMasterStylesContext_Impl(
1001  SwXMLImport& rImport ) :
1002  XMLTextMasterStylesContext( rImport )
1003 {
1004 }
1005 
1006 bool SwXMLMasterStylesContext_Impl::InsertStyleFamily( XmlStyleFamily nFamily ) const
1007 {
1008  bool bIns;
1009 
1010  const SwXMLImport& rSwImport = GetSwImport();
1011  const SfxStyleFamily nStyleFamilyMask = rSwImport.GetStyleFamilyMask();
1012  if( XmlStyleFamily::MASTER_PAGE == nFamily )
1013  bIns = bool(nStyleFamilyMask & SfxStyleFamily::Page);
1014  else
1016 
1017  return bIns;
1018 }
1019 
1020 void SwXMLMasterStylesContext_Impl::EndElement()
1021 {
1022  FinishStyles( !GetSwImport().IsInsertMode() );
1023  GetSwImport().FinishStyles();
1024 }
1025 
1027  bool bAuto )
1028 {
1029  SvXMLStylesContext *pContext = new SwXMLStylesContext_Impl( *this, bAuto );
1030  if( bAuto )
1031  SetAutoStyles( pContext );
1032  else
1033  SetStyles( pContext );
1034 
1035  return pContext;
1036 }
1037 
1039 {
1040  SvXMLStylesContext *pContext =
1041  new SwXMLMasterStylesContext_Impl( *this );
1042  SetMasterStyles( pContext );
1043 
1044  return pContext;
1045 }
1046 
1047 void SwXMLImport::InsertStyles( bool bAuto )
1048 {
1049  if( bAuto && GetAutoStyles() )
1051  if( !bAuto && GetStyles() )
1052  GetStyles()->CopyStylesToDoc( !IsInsertMode(), false );
1053 }
1054 
1056 {
1057  if( GetStyles() )
1059 }
1060 
1062 {
1063  if( !pDoc )
1064  pDoc = SwImport::GetDocFromXMLImport( *this );
1065 
1066  const SwTextFormatColls& rColls = *pDoc->GetTextFormatColls();
1067  const size_t nCount = rColls.size();
1068  for( size_t i=0; i < nCount; ++i )
1069  {
1070  SwTextFormatColl *pColl = rColls[i];
1071  if( pColl && RES_CONDTXTFMTCOLL == pColl->Which() )
1072  {
1073  const SwFormatCollConditions& rConditions =
1074  static_cast<const SwConditionTextFormatColl *>(pColl)->GetCondColls();
1075  bool bSendModify = false;
1076  for( size_t j=0; j < rConditions.size() && !bSendModify; ++j )
1077  {
1078  const SwCollCondition& rCond = *rConditions[j];
1079  switch( rCond.GetCondition() )
1080  {
1085  bSendModify = true;
1086  break;
1087  default: break;
1088  }
1089  }
1090  if( bSendModify )
1091  {
1092  SwCondCollCondChg aMsg( pColl );
1093  pColl->ModifyNotification( &aMsg, &aMsg );
1094  }
1095  }
1096  }
1097 }
1098 
1100  XmlStyleFamily nFamily,
1101  const OUString& rName,
1102  const SfxItemSet **ppItemSet ) const
1103 {
1104  SwXMLItemSetStyleContext_Impl *pStyle = nullptr;
1105  if( GetAutoStyles() )
1106  {
1107  pStyle = const_cast<SwXMLItemSetStyleContext_Impl*>(dynamic_cast< const SwXMLItemSetStyleContext_Impl* >(
1108  GetAutoStyles()->
1109  FindStyleChildContext( nFamily, rName,
1110  true ) ) );
1111  if( pStyle )
1112  {
1113  if( ppItemSet )
1114  {
1115  if( XmlStyleFamily::TABLE_TABLE == pStyle->GetFamily() &&
1116  pStyle->HasMasterPageName() &&
1117  !pStyle->IsPageDescConnected() )
1118  pStyle->ConnectPageDesc();
1119  (*ppItemSet) = pStyle->GetItemSet();
1120 
1121  // resolve data style name late
1122  if( XmlStyleFamily::TABLE_CELL == pStyle->GetFamily() &&
1123  pStyle->ResolveDataStyleName() )
1124  {
1125  (*ppItemSet) = pStyle->GetItemSet();
1126  }
1127 
1128  }
1129  }
1130  }
1131 
1132  return pStyle != nullptr;
1133 }
1134 
1135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define UNO_NAME_PARA_STYLE_CONDITIONS
Definition: unoprnms.hxx:775
bool IsXMLToken(const OUString &rString, enum XMLTokenEnum eToken)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
sal_Int32 nIndex
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
void SetStyles(SvXMLStylesContext *pStyles)
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
bool FindAutomaticStyle(XmlStyleFamily nFamily, const OUString &rName, const SfxItemSet **ppItemSet) const
Definition: xmlfmt.cxx:1099
void CopyAutoStylesToDoc()
void FinishStyles()
Definition: xmlfmt.cxx:1055
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
Definition: legacyitem.cxx:32
SvXMLImportContext * CreateMasterStylesContext()
Definition: xmlfmt.cxx:1038
SvXMLImport & GetImport()
bool IsBlockMode() const
Definition: xmlimp.hxx:145
Definition: doc.hxx:184
virtual SvXMLStyleContext * CreateStyleChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
Master_CollCondition GetCondition() const
Definition: fmtcol.hxx:192
Master_CollCondition
Conditional styles.
Definition: fmtcol.hxx:157
virtual void SetAttribute(sal_uInt16 nPrefixKey, const OUString &rLocalName, const OUString &rValue) override
sal_Int32 mnIndex
static const CommandStruct * GetCmds()
Definition: ccoll.hxx:58
css::uno::Any const & rValue
XmlStyleFamily
sal_uInt16 sal_Unicode
bool IsStylesOnlyMode() const
Definition: xmlimp.hxx:144
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
enumrange< T >::Iterator begin(enumrange< T >)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:425
int nCount
virtual css::uno::Reference< css::style::XStyle > Create()
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
virtual bool InsertStyleFamily(XmlStyleFamily nFamily) const override
SfxStyleFamily
std::vector< rtl::Reference< SwXMLConditionContext_Impl > > SwXMLConditions_Impl
Definition: xmlfmt.cxx:263
const char * sName
static SvXMLImportPropertyMapper * CreateTableDefaultExtPropMapper(SvXMLImport &)
SvXMLStylesContext * GetStyles()
virtual void ModifyNotification(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.hxx:154
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:821
sal_uInt16 const aTableSetRange[]
Definition: init.cxx:192
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const
#define TOOLS_WARN_EXCEPTION(area, stream)
int i
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
OUString GetCommandContextByIndex(sal_Int16 nIndex)
Definition: ccoll.cxx:73
virtual void Finish(bool bOverwrite) override
void CopyStylesToDoc(bool bOverwrite, bool bFinish=true)
XMLPropStyleContext(SvXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList, SvXMLStylesContext &rStyles, XmlStyleFamily nFamily, bool bDefaultStyle=false)
void SetMasterStyles(SvXMLStylesContext *pMasterStyles)
void UpdateTextCollConditions(SwDoc *pDoc)
Definition: xmlfmt.cxx:1061
const SfxItemSet * GetItemSet(const SfxPoolItem &rAttr)
Returns the item set associated with a character/inet/auto style.
Definition: atrstck.cxx:133
size_t size() const
Definition: docary.hxx:84
#define COND_COMMAND_COUNT
Definition: ccoll.hxx:29
sal_uInt16 const aTableBoxSetRange[]
Definition: init.cxx:220
void InsertStyles(bool bAuto)
Definition: xmlfmt.cxx:1047
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
virtual bool InsertStyleFamily(XmlStyleFamily nFamily) const
std::vector< std::unique_ptr< SwCollCondition >> SwFormatCollConditions
Definition: fmtcol.hxx:200
enumrange< T >::Iterator end(enumrange< T >)
sal_uInt16 const aTableLineSetRange[]
Definition: init.cxx:208
virtual OUString GetServiceName(XmlStyleFamily nFamily) const
static SvXMLImportPropertyMapper * CreateTableCellExtPropMapper(SvXMLImport &)
SfxStyleFamily GetStyleFamilyMask() const
Definition: xmlimp.hxx:142
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
virtual void CreateAndInsert(bool bOverwrite)
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:775
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:253
virtual void EndElement() override
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(158)
Sequence< sal_Int8 > aSeq
double getLength(const B2DPolygon &rCandidate)
static SvXMLImportPropertyMapper * CreateDrawingPageExtPropMapper(SvXMLImport &)
void SetAutoStyles(SvXMLStylesContext *pAutoStyles)
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
virtual void SetAttribute(sal_uInt16 nPrefixKey, const OUString &rLocalName, const OUString &rValue)
SvXMLImportContext * CreateStylesContext(bool bAuto)
Definition: xmlfmt.cxx:1026
void AddAttribute(const OUString &sName, const OUString &sValue)
#define SAL_WARN(area, stream)
Reference< XSingleServiceFactory > xFactory
sal_Int32 nLength
virtual css::uno::Reference< css::container::XNameContainer > GetStylesContainer(XmlStyleFamily nFamily) const
SwDoc * GetDocFromXMLImport(SvXMLImport const &)
Definition: xmlimp.cxx:1689
static SvXMLImportPropertyMapper * CreateTableRowDefaultExtPropMapper(SvXMLImport &)
SvXMLStylesContext * GetAutoStyles()
aStr
void FinishStyles(bool bOverwrite)
sal_uInt16 nPos
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1315
bool IsInsertMode() const
Definition: xmlimp.hxx:143
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)