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