LibreOffice Module sc (master)  1
xmlstyli.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 "xmlstyli.hxx"
21 #include <xmloff/nmspmap.hxx>
22 #include <xmloff/xmlnmspe.hxx>
23 #include <xmloff/xmlimppr.hxx>
24 #include <xmloff/families.hxx>
25 #include <xmloff/xmlnumfi.hxx>
27 #include <xmloff/xmltoken.hxx>
28 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
29 #include <com/sun/star/table/BorderLine2.hpp>
30 #include <comphelper/extract.hxx>
31 #include <xmloff/xmlprcon.hxx>
33 #include "XMLConverter.hxx"
35 #include <sheetdata.hxx>
36 #include "xmlannoi.hxx"
37 #include <textuno.hxx>
38 #include <cellsuno.hxx>
39 #include "xmlstyle.hxx"
40 
41 #include <docuno.hxx>
42 #include <unonames.hxx>
43 #include <document.hxx>
44 #include <conditio.hxx>
45 #include <rangelst.hxx>
46 
47 #define XML_LINE_LEFT 0
48 #define XML_LINE_RIGHT 1
49 #define XML_LINE_TOP 2
50 #define XML_LINE_BOTTOM 3
51 
52 #define XML_LINE_TLBR 0
53 #define XML_LINE_BLTR 1
54 
55 using namespace ::com::sun::star;
56 using namespace ::com::sun::star::xml::sax;
57 using namespace ::com::sun::star::style;
58 using namespace ::com::sun::star::beans;
59 using namespace ::com::sun::star::container;
60 using namespace xmloff::token;
61 using namespace ::formula;
62 
63 using com::sun::star::uno::UNO_QUERY;
66  SvXMLImport& rImportP) :
67  SvXMLImportPropertyMapper( rMapper, rImportP )
68 {
69 }
70 
72 {
73 }
74 
75 void ScXMLCellImportPropertyMapper::finished(::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const
76 {
77  static const sal_Int16 aPaddingCTF[4] = { CTF_SC_LEFTPADDING, CTF_SC_RIGHTPADDING,
79  static const sal_Int16 aBorderCTF[4] = { CTF_SC_LEFTBORDER, CTF_SC_RIGHTBORDER,
81 
82  SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex);
83  XMLPropertyState* pAllPaddingProperty(nullptr);
84  XMLPropertyState* pPadding[4] = { nullptr, nullptr, nullptr, nullptr };
85  XMLPropertyState* pNewPadding[4] = { nullptr, nullptr, nullptr, nullptr };
86  XMLPropertyState* pAllBorderProperty = nullptr;
87  XMLPropertyState* pBorders[4] = { nullptr, nullptr, nullptr, nullptr };
88  XMLPropertyState* pNewBorders[4] = { nullptr, nullptr, nullptr, nullptr };
89  XMLPropertyState* pAllBorderWidthProperty = nullptr;
90  XMLPropertyState* pBorderWidths[4] = { nullptr, nullptr, nullptr, nullptr };
91  XMLPropertyState* pDiagBorders[2] = { nullptr };
92  XMLPropertyState* pOldDiagBorderWidths[2] = { nullptr }; // old attribute names without "s"
93  XMLPropertyState* pDiagBorderWidths[2] = { nullptr };
94 
95  for (auto& rProperty : rProperties)
96  {
97  XMLPropertyState*property = &rProperty;
98  if (property->mnIndex != -1)
99  {
100  sal_Int16 nContextID = getPropertySetMapper()->GetEntryContextId(property->mnIndex);
101  switch (nContextID)
102  {
103  case CTF_SC_ALLPADDING : pAllPaddingProperty = property; break;
104  case CTF_SC_LEFTPADDING : pPadding[XML_LINE_LEFT] = property; break;
105  case CTF_SC_RIGHTPADDING : pPadding[XML_LINE_RIGHT] = property; break;
106  case CTF_SC_TOPPADDING : pPadding[XML_LINE_TOP] = property; break;
107  case CTF_SC_BOTTOMPADDING : pPadding[XML_LINE_BOTTOM] = property; break;
108  case CTF_SC_ALLBORDER : pAllBorderProperty = property; break;
109  case CTF_SC_LEFTBORDER : pBorders[XML_LINE_LEFT] = property; break;
110  case CTF_SC_RIGHTBORDER : pBorders[XML_LINE_RIGHT] = property; break;
111  case CTF_SC_TOPBORDER : pBorders[XML_LINE_TOP] = property; break;
112  case CTF_SC_BOTTOMBORDER : pBorders[XML_LINE_BOTTOM] = property; break;
113  case CTF_SC_ALLBORDERWIDTH : pAllBorderWidthProperty = property; break;
114  case CTF_SC_LEFTBORDERWIDTH : pBorderWidths[XML_LINE_LEFT] = property; break;
115  case CTF_SC_RIGHTBORDERWIDTH : pBorderWidths[XML_LINE_RIGHT] = property; break;
116  case CTF_SC_TOPBORDERWIDTH : pBorderWidths[XML_LINE_TOP] = property; break;
117  case CTF_SC_BOTTOMBORDERWIDTH : pBorderWidths[XML_LINE_BOTTOM] = property; break;
118  case CTF_SC_DIAGONALTLBR : pDiagBorders[XML_LINE_TLBR] = property; break;
119  case CTF_SC_DIAGONALBLTR : pDiagBorders[XML_LINE_BLTR] = property; break;
120  case CTF_SC_DIAGONALTLBRWIDTH : pOldDiagBorderWidths[XML_LINE_TLBR] = property; break;
121  case CTF_SC_DIAGONALTLBRWIDTHS : pDiagBorderWidths[XML_LINE_TLBR] = property; break;
122  case CTF_SC_DIAGONALBLTRWIDTH : pOldDiagBorderWidths[XML_LINE_BLTR] = property; break;
123  case CTF_SC_DIAGONALBLTRWIDTHS : pDiagBorderWidths[XML_LINE_BLTR] = property; break;
124  }
125  }
126  }
127  sal_uInt16 i;
128 
129  // #i27594#; copy Value, but don't insert
130  if (pAllBorderWidthProperty)
131  pAllBorderWidthProperty->mnIndex = -1;
132  if (pAllBorderProperty)
133  pAllBorderProperty->mnIndex = -1;
134  if (pAllPaddingProperty)
135  pAllPaddingProperty->mnIndex = -1;
136 
137  for (i = 0; i < 4; ++i)
138  {
139  if (pAllPaddingProperty && !pPadding[i])
140  pNewPadding[i] = new XMLPropertyState(maPropMapper->FindEntryIndex(aPaddingCTF[i]), pAllPaddingProperty->maValue);
141  if (pAllBorderProperty && !pBorders[i])
142  {
143  pNewBorders[i] = new XMLPropertyState(maPropMapper->FindEntryIndex(aBorderCTF[i]), pAllBorderProperty->maValue);
144  pBorders[i] = pNewBorders[i];
145  }
146  if( !pBorderWidths[i] )
147  pBorderWidths[i] = pAllBorderWidthProperty;
148  else
149  pBorderWidths[i]->mnIndex = -1;
150  if( pBorders[i] )
151  {
152  table::BorderLine2 aBorderLine;
153  pBorders[i]->maValue >>= aBorderLine;
154  if( pBorderWidths[i] )
155  {
156  // Merge style:border-line-width values to fo:border values. Do
157  // not override fo:border line width or line style with an
158  // empty value!
159  table::BorderLine2 aBorderLineWidth;
160  pBorderWidths[i]->maValue >>= aBorderLineWidth;
161  aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
162  aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
163  aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
164  pBorders[i]->maValue <<= aBorderLine;
165  }
166  }
167  }
168  for( i = 0; i < 2; ++i )
169  {
170  if( pDiagBorders[i] && ( pDiagBorderWidths[i] || pOldDiagBorderWidths[i] ) )
171  {
172  table::BorderLine2 aBorderLine;
173  pDiagBorders[i]->maValue >>= aBorderLine;
174  table::BorderLine2 aBorderLineWidth;
175  if (pDiagBorderWidths[i])
176  pDiagBorderWidths[i]->maValue >>= aBorderLineWidth; // prefer new attribute
177  else
178  pOldDiagBorderWidths[i]->maValue >>= aBorderLineWidth;
179  aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
180  aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
181  aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
182  pDiagBorders[i]->maValue <<= aBorderLine;
183  if (pDiagBorderWidths[i])
184  pDiagBorderWidths[i]->mnIndex = -1;
185  if (pOldDiagBorderWidths[i])
186  pOldDiagBorderWidths[i]->mnIndex = -1; // reset mnIndex for old and new attribute if both are present
187  }
188  }
189 
190  for (i = 0; i < 4; ++i)
191  {
192  if (pNewPadding[i])
193  {
194  rProperties.push_back(*pNewPadding[i]);
195  delete pNewPadding[i];
196  }
197  if (pNewBorders[i])
198  {
199  rProperties.push_back(*pNewBorders[i]);
200  delete pNewBorders[i];
201  }
202  }
203 }
204 
207  SvXMLImport& rImportP) :
208  SvXMLImportPropertyMapper( rMapper, rImportP )
209 {
210 }
211 
213 {
214 }
215 
216 void ScXMLRowImportPropertyMapper::finished(::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const
217 {
218  SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex);
219  XMLPropertyState* pHeight(nullptr);
220  XMLPropertyState* pOptimalHeight(nullptr);
221  XMLPropertyState* pPageBreak(nullptr);
222  for (auto& rProperty : rProperties)
223  {
224  XMLPropertyState* property = &rProperty;
225  if (property->mnIndex != -1)
226  {
227  sal_Int16 nContextID = getPropertySetMapper()->GetEntryContextId(property->mnIndex);
228  switch (nContextID)
229  {
230  case CTF_SC_ROWHEIGHT : pHeight = property; break;
231  case CTF_SC_ROWOPTIMALHEIGHT : pOptimalHeight = property; break;
232  case CTF_SC_ROWBREAKBEFORE : pPageBreak = property; break;
233  }
234  }
235  }
236  if (pPageBreak)
237  {
238  if(!(::cppu::any2bool(pPageBreak->maValue)))
239  pPageBreak->mnIndex = -1;
240  }
241  if (pOptimalHeight)
242  {
243  if (::cppu::any2bool(pOptimalHeight->maValue))
244  {
245  if (pHeight)
246  {
247  // set the stored height, but keep "optimal" flag:
248  // pass the height value as OptimalHeight property (only allowed while loading!)
249  pOptimalHeight->maValue = pHeight->maValue;
250  pHeight->mnIndex = -1;
251  }
252  else
253  pOptimalHeight->mnIndex = -1;
254  }
255  }
256  else if (pHeight)
257  {
258  rProperties.emplace_back(maPropMapper->FindEntryIndex(CTF_SC_ROWOPTIMALHEIGHT), css::uno::Any(false));
259  }
260  // don't access pointers to rProperties elements after push_back!
261 }
262 
263 namespace {
264 
265 class XMLTableCellPropsContext : public SvXMLPropertySetContext
266 {
268  public:
269  XMLTableCellPropsContext(
270  SvXMLImport& rImport, sal_uInt16 nPrfx,
271  const OUString& rLName,
272  const uno::Reference< xml::sax::XAttributeList >& xAttrList,
273  sal_uInt32 nFamily,
274  ::std::vector< XMLPropertyState > &rProps,
276 
277  virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
278  const OUString& rLocalName,
279  const uno::Reference< xml::sax::XAttributeList >& xAttrList,
280  ::std::vector< XMLPropertyState > &rProperties,
281  const XMLPropertyState& rProp ) override;
282 };
283 
284 }
285 
286 XMLTableCellPropsContext::XMLTableCellPropsContext(
287  SvXMLImport& rImport, sal_uInt16 nPrfx,
288  const OUString& rLName,
289  const uno::Reference< xml::sax::XAttributeList >& xAttrList,
290  sal_uInt32 nFamily,
291  ::std::vector< XMLPropertyState > &rProps,
293  : SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFamily,
294  rProps, rMap )
295 {
296 }
297 
298 SvXMLImportContextRef XMLTableCellPropsContext::CreateChildContext( sal_uInt16 nPrefix,
299  const OUString& rLocalName,
300  const uno::Reference< xml::sax::XAttributeList >& xAttrList,
301  ::std::vector< XMLPropertyState > &rProperties,
302  const XMLPropertyState& rProp )
303 {
304  // no need for a custom context or indeed a SvXMLTokenMap to grab just the
305  // single attribute ( href ) that we are interested in.
306  // still though, we will check namespaces etc.
307  if ((XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix)
308  && IsXMLToken(rLocalName, XML_HYPERLINK))
309  {
310  OUString sURL;
311  for ( int i=0; i<xAttrList->getLength(); ++i )
312  {
313  OUString aLocalName;
314  OUString sName = xAttrList->getNameByIndex(i);
315  sal_uInt16 nPrfx = GetImport().GetNamespaceMap().GetKeyByAttrName( sName,
316  &aLocalName );
317  if ( nPrfx == XML_NAMESPACE_XLINK )
318  {
319  if ( IsXMLToken( aLocalName, XML_HREF ) )
320  {
321  sURL = xAttrList->getValueByIndex(i);
322  break;
323  }
324  }
325  }
326  if ( !sURL.isEmpty() )
327  {
328  XMLPropertyState aProp( rProp );
329  aProp.maValue <<= sURL;
330  rProperties.push_back( aProp );
331  }
332  }
333  return SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName, xAttrList, rProperties, rProp );
334 }
335 
336 namespace {
337 
338 class ScXMLMapContext : public SvXMLImportContext
339 {
340  OUString msApplyStyle;
341  OUString msCondition;
342  OUString msBaseCell;
343 
344  ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
345 public:
346 
347  ScXMLMapContext(
348  SvXMLImport& rImport, sal_uInt16 nPrfx,
349  const OUString& rLName,
350  const uno::Reference< xml::sax::XAttributeList > & xAttrList );
351 
352  ScCondFormatEntry* CreateConditionEntry();
353 };
354 
355 }
356 
357 ScXMLMapContext::ScXMLMapContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
358  const OUString& rLName, const uno::Reference< xml::sax::XAttributeList > & xAttrList )
359  : SvXMLImportContext( rImport, nPrfx, rLName )
360 {
361  sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
362  for( sal_Int16 i=0; i < nAttrCount; ++i )
363  {
364  const OUString& rAttrName(xAttrList->getNameByIndex( i ));
365  OUString aLocalName;
366  sal_uInt16 nPrefix(GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName ));
367  const OUString& rValue(xAttrList->getValueByIndex( i ));
368 
369  // TODO: use a map here
370  if( XML_NAMESPACE_STYLE == nPrefix )
371  {
372  if( IsXMLToken(aLocalName, XML_CONDITION ) )
373  msCondition = rValue;
374  else if( IsXMLToken(aLocalName, XML_APPLY_STYLE_NAME ) )
375  msApplyStyle = GetImport().GetStyleDisplayName( XmlStyleFamily::TABLE_CELL, rValue);
376  else if ( IsXMLToken(aLocalName, XML_BASE_CELL_ADDRESS ) )
377  msBaseCell = rValue;
378  }
379  }
380 }
381 
382 ScCondFormatEntry* ScXMLMapContext::CreateConditionEntry()
383 {
384  OUString aCondition, aConditionNmsp;
385  FormulaGrammar::Grammar eGrammar = FormulaGrammar::GRAM_UNSPECIFIED;
386  GetScImport().ExtractFormulaNamespaceGrammar( aCondition, aConditionNmsp, eGrammar, msCondition );
387  bool bHasNmsp = aCondition.getLength() < msCondition.getLength();
388 
389  // parse a condition from the attribute string
390  ScXMLConditionParseResult aParseResult;
391  ScXMLConditionHelper::parseCondition( aParseResult, aCondition, 0 );
392 
393  if( !bHasNmsp )
394  {
395  // the attribute does not contain a namespace: try to find a namespace of an external grammar
396  FormulaGrammar::Grammar eNewGrammar = FormulaGrammar::GRAM_UNSPECIFIED;
397  GetScImport().ExtractFormulaNamespaceGrammar( aCondition, aConditionNmsp, eNewGrammar, aCondition, true );
398  if( eNewGrammar != FormulaGrammar::GRAM_EXTERNAL )
399  eGrammar = eNewGrammar;
400  }
401 
403  ScDocument* pDoc = GetScImport().GetDocument();
404 
405  ScCondFormatEntry* pEntry = new ScCondFormatEntry(eMode, aParseResult.maOperand1, aParseResult.maOperand2, pDoc, ScAddress(), msApplyStyle,
406  OUString(), OUString(), eGrammar, eGrammar);
407 
408  pEntry->SetSrcString(msBaseCell);
409  return pEntry;
410 }
411 
412 void XMLTableStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
413  const OUString& rLocalName,
414  const OUString& rValue )
415 {
416  // TODO: use a map here
417  if( IsXMLToken(rLocalName, XML_DATA_STYLE_NAME ) )
418  sDataStyleName = rValue;
419  else if ( IsXMLToken(rLocalName, XML_MASTER_PAGE_NAME ) )
420  sPageStyle = rValue;
421  else
422  XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
423 }
424 
425 
427  sal_uInt16 nPrfx, const OUString& rLName,
428  const uno::Reference< XAttributeList > & xAttrList,
429  SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefaultStyle ) :
430  XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, bDefaultStyle ),
431  sDataStyleName(),
432  pStyles(&rStyles),
433  nNumberFormat(-1),
434  nLastSheet(-1),
435  bParentSet(false),
436  mpCondFormat(nullptr),
437  mbDeleteCondFormat(true)
438 {
439 }
440 
442 {
444  delete mpCondFormat;
445 }
446 
448  sal_uInt16 nPrefix,
449  const OUString& rLocalName,
450  const uno::Reference< XAttributeList > & xAttrList )
451 {
452  SvXMLImportContextRef xContext;
453 
454  if( (XML_NAMESPACE_STYLE == nPrefix) &&
455  IsXMLToken(rLocalName, XML_MAP ) )
456  {
457  if(!mpCondFormat)
458  mpCondFormat = new ScConditionalFormat( 0, GetScImport().GetDocument() );
459  ScXMLMapContext* pMapContext = new ScXMLMapContext(GetImport(), nPrefix, rLocalName, xAttrList);
460  xContext = pMapContext;
461  mpCondFormat->AddEntry(pMapContext->CreateConditionEntry());
462  }
463  else if ( ( XML_NAMESPACE_STYLE == nPrefix) &&
464  IsXMLToken(rLocalName, XML_TABLE_CELL_PROPERTIES ) )
465  {
468  GetFamily() );
469  if( xImpPrMap.is() )
470  xContext = new XMLTableCellPropsContext( GetImport(), nPrefix,
471  rLocalName, xAttrList,
473  GetProperties(),
474  xImpPrMap );
475  }
476 
477  if (!xContext)
478  xContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
479  xAttrList );
480  return xContext;
481 }
482 
483 void XMLTableStyleContext::ApplyCondFormat( const uno::Sequence<table::CellRangeAddress>& xCellRanges )
484 {
485  if(!mpCondFormat || GetScImport().HasNewCondFormatData())
486  return;
487 
488  ScRangeList aRangeList;
489  for(const table::CellRangeAddress& aAddress : xCellRanges)
490  {
491  ScRange aRange( aAddress.StartColumn, aAddress.StartRow, aAddress.Sheet, aAddress.EndColumn, aAddress.EndRow, aAddress.Sheet );
492  aRangeList.Join( aRange );
493  }
494 
495  ScDocument* pDoc = GetScImport().GetDocument();
497  ScConditionalFormatList* pFormatList = pDoc->GetCondFormList(nTab);
498  auto itr = std::find_if(pFormatList->begin(), pFormatList->end(),
499  [this](const std::unique_ptr<ScConditionalFormat>& rxFormat) { return rxFormat->EqualEntries(*mpCondFormat); });
500  if (itr != pFormatList->end())
501  {
502  ScRangeList& rRangeList = (*itr)->GetRangeList();
503  sal_uInt32 nCondId = (*itr)->GetKey();
504  size_t n = aRangeList.size();
505  for(size_t i = 0; i < n; ++i)
506  {
507  const ScRange & rRange = aRangeList[i];
508  rRangeList.Join(rRange);
509  }
510 
511  pDoc->AddCondFormatData( aRangeList, nTab, nCondId );
512  return;
513  }
514 
516  {
517  sal_uLong nIndex = pDoc->AddCondFormat(std::unique_ptr<ScConditionalFormat>(mpCondFormat), nTab );
518  mpCondFormat->SetKey(nIndex);
519  mpCondFormat->SetRange(aRangeList);
520 
521  pDoc->AddCondFormatData( aRangeList, nTab, nIndex );
522  mbDeleteCondFormat = false;
523  }
524 
525 }
526 
528  const uno::Reference< XPropertySet > & rPropSet )
529 {
530  if (!IsDefaultStyle())
531  {
532  if (GetFamily() == XmlStyleFamily::TABLE_CELL)
533  {
534  if (!bParentSet)
535  {
536  AddProperty(CTF_SC_CELLSTYLE, uno::makeAny(GetImport().GetStyleDisplayName( XmlStyleFamily::TABLE_CELL, GetParentName() )));
537  bParentSet = true;
538  }
539  sal_Int32 nNumFmt = GetNumberFormat();
540  if (nNumFmt >= 0)
541  AddProperty(CTF_SC_NUMBERFORMAT, uno::makeAny(nNumFmt));
542  }
543  else if (GetFamily() == XmlStyleFamily::TABLE_TABLE)
544  {
545  if (!sPageStyle.isEmpty())
546  AddProperty(CTF_SC_MASTERPAGENAME, uno::makeAny(GetImport().GetStyleDisplayName( XmlStyleFamily::MASTER_PAGE, sPageStyle )));
547  }
548  }
550 }
551 
553 {
554  if ((GetFamily() == XmlStyleFamily::TABLE_CELL) && GetImport().GetModel().is())
555  {
556  uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetImport().GetModel(), uno::UNO_QUERY);
557  if (xMultiServiceFactory.is())
558  {
559  uno::Reference <beans::XPropertySet> xProperties(xMultiServiceFactory->createInstance("com.sun.star.sheet.Defaults"), uno::UNO_QUERY);
560  if (xProperties.is())
561  FillPropertySet(xProperties);
562  }
563  }
564 }
565 
566 void XMLTableStyleContext::AddProperty(const sal_Int16 nContextID, const uno::Any& rValue)
567 {
568  XMLPropertyState* property = FindProperty(nContextID);
569  if (property)
570  property->mnIndex = -1; // #i46996# remove old property, so it isn't double
571  sal_Int32 nIndex(static_cast<XMLTableStylesContext *>(pStyles)->GetIndex(nContextID));
572  OSL_ENSURE(nIndex != -1, "Property not found in Map");
573  XMLPropertyState aPropState(nIndex, rValue);
574  GetProperties().push_back(aPropState); // has to be inserted in a sort order later
575 }
576 
578 {
579  XMLPropertyState* pRet = nullptr;
583  OSL_ENSURE( xImpPrMap.is(), "There is the import prop mapper" );
584  if( xImpPrMap.is() )
585  xPrMap = xImpPrMap->getPropertySetMapper();
586  if( xPrMap.is() )
587  {
588  auto aIter = std::find_if(GetProperties().begin(), GetProperties().end(),
589  [&xPrMap, &nContextID](const XMLPropertyState& rProp) {
590  return rProp.mnIndex != -1 && xPrMap->GetEntryContextId(rProp.mnIndex) == nContextID;
591  });
592  if (aIter != GetProperties().end())
593  pRet = &(*aIter);
594  }
595  return pRet;
596 }
597 
599 {
600  if (nNumberFormat < 0 && !sDataStyleName.isEmpty())
601  {
602  const SvXMLNumFormatContext* pStyle = static_cast<const SvXMLNumFormatContext*>(
603  pStyles->FindStyleChildContext(XmlStyleFamily::DATA_STYLE, sDataStyleName, true));
604 
605  if (!pStyle)
606  {
607  XMLTableStylesContext* pMyStyles = static_cast<XMLTableStylesContext*>(GetScImport().GetStyles());
608  if (pMyStyles)
609  pStyle = static_cast<const SvXMLNumFormatContext*>(
610  pMyStyles->FindStyleChildContext(XmlStyleFamily::DATA_STYLE, sDataStyleName, true));
611  else
612  {
613  OSL_FAIL("not possible to get style");
614  }
615  }
616  if (pStyle)
617  nNumberFormat = const_cast<SvXMLNumFormatContext*>(pStyle)->GetKey();
618  }
619  return nNumberFormat;
620 }
621 
623  XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
624  const uno::Reference< xml::sax::XAttributeList > & xAttrList )
625 {
626  SvXMLStyleContext *pStyle;
627  // use own wrapper for text and paragraph, to record style usage
628  if (nFamily == XmlStyleFamily::TEXT_PARAGRAPH || nFamily == XmlStyleFamily::TEXT_TEXT)
629  pStyle = new ScCellTextStyleContext( GetImport(), nPrefix, rLocalName,
630  xAttrList, *this, nFamily );
631  else
633  nFamily, nPrefix, rLocalName, xAttrList );
634 
635  if (!pStyle)
636  {
637  switch( nFamily )
638  {
639  case XmlStyleFamily::TABLE_CELL:
640  case XmlStyleFamily::TABLE_COLUMN:
641  case XmlStyleFamily::TABLE_ROW:
642  case XmlStyleFamily::TABLE_TABLE:
643  pStyle = new XMLTableStyleContext( GetScImport(), nPrefix, rLocalName,
644  xAttrList, *this, nFamily );
645  break;
646  default: break;
647  }
648  }
649 
650  return pStyle;
651 }
652 
654  XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
655  const uno::Reference< xml::sax::XAttributeList > & xAttrList )
656 {
658  rLocalName,
659  xAttrList ));
660  if (!pStyle)
661  {
662  switch( nFamily )
663  {
664  case XmlStyleFamily::TABLE_CELL:
665  pStyle = new XMLTableStyleContext( GetScImport(), nPrefix, rLocalName,
666  xAttrList, *this, nFamily, true);
667  break;
668  case XmlStyleFamily::SD_GRAPHICS_ID:
669  pStyle = new XMLGraphicsDefaultStyle( GetScImport(), nPrefix, rLocalName,
670  xAttrList, *this);
671  break;
672  default: break;
673  }
674  }
675 
676  return pStyle;
677 }
678 
679 const OUStringLiteral gsCellStyleServiceName("com.sun.star.style.CellStyle");
680 const OUStringLiteral gsColumnStyleServiceName(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME);
681 const OUStringLiteral gsRowStyleServiceName(XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME);
682 const OUStringLiteral gsTableStyleServiceName(XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME);
683 
685  const bool bTempAutoStyles )
686  : SvXMLStylesContext( rImport )
687  , nNumberFormatIndex(-1)
688  , nConditionalFormatIndex(-1)
689  , nCellStyleIndex(-1)
690  , nMasterPageNameIndex(-1)
691  , bAutoStyles(bTempAutoStyles)
692 {
693 }
694 
696 {
697 }
698 
700 {
702  if (bAutoStyles)
703  GetImport().GetTextImport()->SetAutoStyles( this );
704  else
706 }
707 
710  XmlStyleFamily nFamily ) const
711 {
713 
714  if (!xMapper.is())
715  {
716  switch( nFamily )
717  {
718  case XmlStyleFamily::TABLE_CELL:
719  {
720  if( !xCellImpPropMapper.is() )
721  {
722  const_cast<XMLTableStylesContext *>(this)->xCellImpPropMapper =
724  xCellImpPropMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(const_cast<SvXMLImport&>(GetImport())));
725  }
726  xMapper = xCellImpPropMapper;
727  }
728  break;
729  case XmlStyleFamily::TABLE_COLUMN:
730  {
731  if( !xColumnImpPropMapper.is() )
732  const_cast<XMLTableStylesContext *>(this)->xColumnImpPropMapper =
733  new SvXMLImportPropertyMapper( GetScImport().GetColumnStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
734  xMapper = xColumnImpPropMapper;
735  }
736  break;
737  case XmlStyleFamily::TABLE_ROW:
738  {
739  if( !xRowImpPropMapper.is() )
740  const_cast<XMLTableStylesContext *>(this)->xRowImpPropMapper =
741  new ScXMLRowImportPropertyMapper( GetScImport().GetRowStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
742  xMapper = xRowImpPropMapper;
743  }
744  break;
745  case XmlStyleFamily::TABLE_TABLE:
746  {
747  if( !xTableImpPropMapper.is() )
748  const_cast<XMLTableStylesContext *>(this)->xTableImpPropMapper =
749  new SvXMLImportPropertyMapper( GetScImport().GetTableStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
750  xMapper = xTableImpPropMapper;
751  }
752  break;
753  default: break;
754  }
755  }
756 
757  return xMapper;
758 }
759 
760 uno::Reference < XNameContainer >
762 {
763  uno::Reference < XNameContainer > xStyles(SvXMLStylesContext::GetStylesContainer(nFamily));
764  if (!xStyles.is())
765  {
766  OUString sName;
767  switch( nFamily )
768  {
769  case XmlStyleFamily::TABLE_TABLE:
770  {
771  if( xTableStyles.is() )
772  xStyles.set(xTableStyles);
773  else
774  sName = "TableStyles";
775  }
776  break;
777  case XmlStyleFamily::TABLE_CELL:
778  {
779  if( xCellStyles.is() )
780  xStyles.set(xCellStyles);
781  else
782  sName = "CellStyles";
783  }
784  break;
785  case XmlStyleFamily::TABLE_COLUMN:
786  {
787  if( xColumnStyles.is() )
788  xStyles.set(xColumnStyles);
789  else
790  sName = "ColumnStyles";
791  }
792  break;
793  case XmlStyleFamily::TABLE_ROW:
794  {
795  if( xRowStyles.is() )
796  xStyles.set(xRowStyles);
797  else
798  sName = "RowStyles";
799  }
800  break;
801  default: break;
802  }
803  if( !xStyles.is() && !sName.isEmpty() && GetScImport().GetModel().is() )
804  {
805  uno::Reference< XStyleFamiliesSupplier > xFamiliesSupp(
806  GetScImport().GetModel(), UNO_QUERY );
807  if (xFamiliesSupp.is())
808  {
809  uno::Reference< XNameAccess > xFamilies(xFamiliesSupp->getStyleFamilies());
810 
811  try
812  {
813  xStyles.set(xFamilies->getByName( sName ), uno::UNO_QUERY);
814  }
815  catch ( uno::Exception& )
816  {
817  // #i97680# Named table/column/row styles aren't supported, getByName will throw an exception.
818  // For better interoperability, these styles should then be handled as automatic styles.
819  // For now, NULL is returned (and the style is ignored).
820  }
821  switch( nFamily )
822  {
823  case XmlStyleFamily::TABLE_TABLE:
824  const_cast<XMLTableStylesContext *>(this)->xTableStyles.set(xStyles);
825  break;
826  case XmlStyleFamily::TABLE_CELL:
827  const_cast<XMLTableStylesContext *>(this)->xCellStyles.set(xStyles);
828  break;
829  case XmlStyleFamily::TABLE_COLUMN:
830  const_cast<XMLTableStylesContext *>(this)->xColumnStyles.set(xStyles);
831  break;
832  case XmlStyleFamily::TABLE_ROW:
833  const_cast<XMLTableStylesContext *>(this)->xRowStyles.set(xStyles);
834  break;
835  default: break;
836  }
837  }
838  }
839  }
840 
841  return xStyles;
842 }
843 
845 {
847  if (sServiceName.isEmpty())
848  {
849  switch( nFamily )
850  {
851  case XmlStyleFamily::TABLE_COLUMN:
852  sServiceName = gsColumnStyleServiceName;
853  break;
854  case XmlStyleFamily::TABLE_ROW:
855  sServiceName = gsRowStyleServiceName;
856  break;
857  case XmlStyleFamily::TABLE_CELL:
858  sServiceName = gsCellStyleServiceName;
859  break;
860  case XmlStyleFamily::TABLE_TABLE:
861  sServiceName = gsTableStyleServiceName;
862  break;
863  default: break;
864  }
865  }
866  return sServiceName;
867 }
868 
869 sal_Int32 XMLTableStylesContext::GetIndex(const sal_Int16 nContextID)
870 {
871  if (nContextID == CTF_SC_CELLSTYLE)
872  {
873  if (nCellStyleIndex == -1)
875  GetImportPropertyMapper(XmlStyleFamily::TABLE_CELL)->getPropertySetMapper()->FindEntryIndex(nContextID);
876  return nCellStyleIndex;
877  }
878  else if (nContextID == CTF_SC_NUMBERFORMAT)
879  {
880  if (nNumberFormatIndex == -1)
882  GetImportPropertyMapper(XmlStyleFamily::TABLE_CELL)->getPropertySetMapper()->FindEntryIndex(nContextID);
883  return nNumberFormatIndex;
884  }
885  else if (nContextID == CTF_SC_IMPORT_MAP)
886  {
887  if (nConditionalFormatIndex == -1)
889  GetImportPropertyMapper(XmlStyleFamily::TABLE_CELL)->getPropertySetMapper()->FindEntryIndex(nContextID);
891  }
892  else if (nContextID == CTF_SC_MASTERPAGENAME)
893  {
894  if (nMasterPageNameIndex == -1)
896  GetImportPropertyMapper(XmlStyleFamily::TABLE_TABLE)->getPropertySetMapper()->FindEntryIndex(nContextID);
897  return nMasterPageNameIndex;
898  }
899  else
900  return -1;
901 }
902 
903 
905 {
906  return true;
907 }
908 
910  SvXMLStylesContext( rImport )
911 {
912 }
913 
915 {
916 }
917 
919  sal_uInt16 nPrefix,
920  const OUString& rLocalName,
921  const uno::Reference< XAttributeList > & xAttrList )
922 {
923  SvXMLStyleContext *pContext(nullptr);
924 
925  if( (XML_NAMESPACE_STYLE == nPrefix) &&
926  IsXMLToken(rLocalName, XML_MASTER_PAGE) &&
927  InsertStyleFamily( XmlStyleFamily::MASTER_PAGE ) )
928  pContext = new ScMasterPageContext(
929  GetImport(), nPrefix, rLocalName, xAttrList,
930  !GetImport().GetTextImport()->IsInsertMode() );
931 
932  // any other style will be ignored here!
933 
934  return pContext;
935 }
936 
938  XmlStyleFamily /* nFamily */,
939  sal_uInt16 /* nPrefix */,
940  const OUString& /* rLocalName */,
941  const uno::Reference< XAttributeList > & /* xAttrList */ )
942 {
943  return nullptr;
944 }
945 
947 {
948  FinishStyles(true);
949 }
950 
951 
953  sal_uInt16 nPrfx, const OUString& rLName,
954  const uno::Reference< XAttributeList > & xAttrList,
955  bool bOverwrite ) :
956  XMLTextMasterPageContext( rImport, nPrfx, rLName, xAttrList, bOverwrite ),
957  bContainsRightHeader(false),
958  bContainsRightFooter(false)
959 {
960 }
961 
963 {
964 }
965 
967  sal_uInt16 nPrefix,
968  const OUString& rLocalName,
969  const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList,
970  const bool bFooter,
971  const bool bLeft,
972  const bool /*bFirst*/ )
973 {
974  if (!bLeft)
975  {
976  if (bFooter)
977  bContainsRightFooter = true;
978  else
979  bContainsRightHeader = true;
980  }
981  if (!xPropSet.is())
982  xPropSet.set(GetStyle(), UNO_QUERY );
984  nPrefix, rLocalName,
985  xAttrList,
986  xPropSet,
987  bFooter, bLeft );
988 }
989 
990 void ScMasterPageContext::ClearContent(const OUString& rContent)
991 {
992  if (!xPropSet.is())
993  xPropSet.set(GetStyle(), UNO_QUERY );
994 
995  if (xPropSet.is())
996  {
997  uno::Reference < sheet::XHeaderFooterContent > xHeaderFooterContent(xPropSet->getPropertyValue( rContent ), uno::UNO_QUERY);
998  if (xHeaderFooterContent.is())
999  {
1000  xHeaderFooterContent->getLeftText()->setString("");
1001  xHeaderFooterContent->getCenterText()->setString("");
1002  xHeaderFooterContent->getRightText()->setString("");
1003  xPropSet->setPropertyValue( rContent, uno::makeAny(xHeaderFooterContent) );
1004  }
1005  }
1006 }
1007 
1008 void ScMasterPageContext::Finish( bool bOverwrite )
1009 {
1011  if (!bContainsRightFooter)
1013  if (!bContainsRightHeader)
1015 }
1016 
1018  const OUString& rLName, const uno::Reference<xml::sax::XAttributeList> & xAttrList,
1019  SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ) :
1020  XMLTextStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, false/*bDefaultStyle*/ ),
1021  nLastSheet(-1)
1022 {
1023 }
1024 
1026 {
1027 }
1028 
1029 void ScCellTextStyleContext::FillPropertySet( const uno::Reference<beans::XPropertySet>& xPropSet )
1030 {
1032 
1033  ScXMLImport& rXMLImport = GetScImport();
1034 
1035  ScCellTextCursor* pCellImp = comphelper::getUnoTunnelImplementation<ScCellTextCursor>( xPropSet );
1036  if (pCellImp)
1037  {
1038  ScAddress aPos = pCellImp->GetCellObj().GetPosition();
1039  if ( aPos.Tab() != nLastSheet )
1040  {
1041  ESelection aSel = pCellImp->GetSelection();
1042 
1043  ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetImport().GetModel())->GetSheetSaveData();
1044  pSheetData->AddTextStyle( GetName(), aPos, aSel );
1045 
1046  nLastSheet = aPos.Tab();
1047  }
1048  }
1049  else if ( rXMLImport.GetTables().GetCurrentSheet() != nLastSheet )
1050  {
1051  ScDrawTextCursor* pDrawImp = comphelper::getUnoTunnelImplementation<ScDrawTextCursor>( xPropSet );
1052  if (pDrawImp)
1053  {
1054  XMLTableShapeImportHelper* pTableShapeImport = static_cast<XMLTableShapeImportHelper*>(GetScImport().GetShapeImport().get());
1055  ScXMLAnnotationContext* pAnnotationContext = pTableShapeImport->GetAnnotationContext();
1056  if (pAnnotationContext)
1057  {
1058  pAnnotationContext->AddContentStyle( GetFamily(), GetName(), pDrawImp->GetSelection() );
1059  nLastSheet = rXMLImport.GetTables().GetCurrentSheet();
1060  }
1061  }
1062 
1063  // if it's a different shape, BlockSheet is called from XMLTableShapeImportHelper::finishShape
1064  // formatted text in page headers/footers can be ignored
1065  }
1066 }
1067 
1068 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XML_MAP
XmlStyleFamily GetFamily() const
bool IsXMLToken(const OUString &rString, enum XMLTokenEnum eToken)
sal_Int32 nNumberFormatIndex
Definition: xmlstyli.hxx:125
constexpr sal_uInt16 XML_NAMESPACE_STYLE
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlstyli.cxx:699
sal_Int32 nIndex
#define XML_LINE_RIGHT
Definition: xmlstyli.cxx:48
#define CTF_SC_RIGHTPADDING
Definition: xmlstyle.hxx:64
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:622
const ScAddress & GetPosition() const
Definition: cellsuno.hxx:676
void AddEntry(ScFormatEntry *pNew)
Definition: conditio.cxx:1747
const OUStringLiteral gsRowStyleServiceName(XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME)
#define XML_LINE_BLTR
Definition: xmlstyli.cxx:53
#define SC_UNO_PAGE_RIGHTFTRCON
Definition: unonames.hxx:448
uno3: SvxUnoTextCursor is not derived from XUnoTunnel, but should be (?)
Definition: textuno.hxx:216
#define XML_LINE_BOTTOM
Definition: xmlstyli.cxx:50
const OUStringLiteral gsCellStyleServiceName("com.sun.star.style.CellStyle")
SCTAB GetCurrentSheet() const
Definition: xmlsubti.hxx:85
#define CTF_SC_DIAGONALBLTRWIDTHS
Definition: xmlstyle.hxx:88
ScCellTextStyleContext(SvXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList, SvXMLStylesContext &rStyles, XmlStyleFamily nFamily)
Definition: xmlstyli.cxx:1017
ScDocument * GetDocument()
Definition: xmlimprt.hxx:296
#define CTF_SC_ROWHEIGHT
Definition: xmlstyle.hxx:90
#define CTF_SC_BOTTOMBORDERWIDTH
Definition: xmlstyle.hxx:75
#define CTF_SC_BOTTOMBORDER
Definition: xmlstyle.hxx:70
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:653
const ::std::vector< XMLPropertyState > & GetProperties() const
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet) override
virtual SvXMLImportContext * CreateHeaderFooterContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList, const bool bFooter, const bool bLeft, const bool bFirst) override
Definition: xmlstyli.cxx:966
sal_uIntPtr sal_uLong
#define CTF_SC_MASTERPAGENAME
Definition: xmlstyle.hxx:95
ScMyTables & GetTables()
Definition: xmlimprt.hxx:299
XMLTableStylesContext(SvXMLImport &rImport, bool bAutoStyles)
Definition: xmlstyli.cxx:684
SvXMLImport & GetImport()
sal_Int64 n
XML_MASTER_PAGE_NAME
virtual css::uno::Reference< css::container::XNameContainer > GetStylesContainer(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:761
virtual void SetAttribute(sal_uInt16 nPrefixKey, const OUString &rLocalName, const OUString &rValue) override
sal_Int32 mnIndex
#define CTF_SC_DIAGONALBLTR
Definition: xmlstyle.hxx:85
css::sheet::ConditionOperator meOperator
A data validation type if existing.
bool IsDefaultStyle() const
Result of an attempt to parse a single condition in a 'condition' attribute value of e...
SC_DLLPUBLIC sal_uLong AddCondFormat(std::unique_ptr< ScConditionalFormat > pNew, SCTAB nTab)
Definition: documen4.cxx:705
ScXMLCellImportPropertyMapper(const rtl::Reference< XMLPropertySetMapper > &rMapper, SvXMLImport &rImport)
Definition: xmlstyli.cxx:64
SvXMLStylesContext * pStyles
Definition: xmlstyli.hxx:70
sal_Int32 nNumberFormat
Definition: xmlstyli.hxx:71
rtl::Reference< XMLTextImportHelper > const & GetTextImport()
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet) override
Definition: xmlstyli.cxx:1029
#define CTF_SC_NUMBERFORMAT
Definition: xmlstyle.hxx:76
css::uno::Reference< css::container::XNameContainer > xCellStyles
Definition: xmlstyli.hxx:121
virtual void SetAttribute(sal_uInt16 nPrefixKey, const OUString &rLocalName, const OUString &rValue) override
Definition: xmlstyli.cxx:412
const rtl::Reference< XMLPropertySetMapper > & getPropertySetMapper() const
sal_Int32 nMasterPageNameIndex
Definition: xmlstyli.hxx:128
#define XML_LINE_LEFT
Definition: xmlstyli.cxx:47
css::uno::Any const & rValue
XmlStyleFamily
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
Definition: documen4.cxx:857
const OUStringLiteral gsColumnStyleServiceName(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME)
XML_TABLE_CELL_PROPERTIES
virtual ~ScMasterPageContext() override
Definition: xmlstyli.cxx:962
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 >)
void SetSrcString(const OUString &rNew)
Definition: conditio.cxx:460
#define CTF_SC_LEFTBORDER
Definition: xmlstyle.hxx:67
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet) override
Definition: xmlstyli.cxx:527
void AddProperty(sal_Int16 nContextID, const css::uno::Any &aValue)
Definition: xmlstyli.cxx:566
const ESelection & GetSelection() const
void AddTextStyle(const OUString &rName, const ScAddress &rCellPos, const ESelection &rSelection)
Definition: sheetdata.cxx:85
virtual ~ScXMLRowImportPropertyMapper() override
Definition: xmlstyli.cxx:212
ScConditionMode
Definition: conditio.hxx:61
#define CTF_SC_ALLPADDING
Definition: xmlstyle.hxx:61
Mode eMode
SCTAB Tab() const
Definition: address.hxx:271
#define CTF_SC_TOPPADDING
Definition: xmlstyle.hxx:65
#define CTF_SC_LEFTPADDING
Definition: xmlstyle.hxx:63
XMLTableStyleContext(ScXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList, SvXMLStylesContext &rStyles, XmlStyleFamily nFamily, bool bDefaultStyle=false)
Definition: xmlstyli.cxx:426
SvXMLImport & GetImport() const
const SvXMLStylesContext * GetStyles() const
ScConditionalFormat * mpCondFormat
Definition: xmlstyli.hxx:74
const char * sName
virtual ~XMLTableStyleContext() override
Definition: xmlstyli.cxx:441
sal_Int32 nConditionalFormatIndex
Definition: xmlstyli.hxx:126
SvXMLStylesContext * GetStyles()
virtual void finished(::std::vector< XMLPropertyState > &rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex) const override
This method is called when all attributes have been processed.
Definition: xmlstyli.cxx:75
XML_DATA_STYLE_NAME
void InsertStyles()
Definition: xmlimprt.cxx:816
void ApplyCondFormat(const css::uno::Sequence< css::table::CellRangeAddress > &xCellRanges)
Definition: xmlstyli.cxx:483
void SetRange(const ScRangeList &rRanges)
Definition: conditio.cxx:1741
css::uno::Reference< css::container::XNameContainer > xTableStyles
Definition: xmlstyli.hxx:124
css::uno::Reference< css::beans::XPropertySet > xPropSet
Definition: xmlstyli.hxx:192
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const
sal_Int32 nCellStyleIndex
Definition: xmlstyli.hxx:127
XMLPropertyState * FindProperty(const sal_Int16 nContextID)
Definition: xmlstyli.cxx:577
sal_Int32 GetNumberFormat()
Definition: xmlstyli.cxx:598
virtual void finished(::std::vector< XMLPropertyState > &rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex) const override
This method is called when all attributes have been processed.
Definition: xmlstyli.cxx:216
int i
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
virtual ~ScXMLCellImportPropertyMapper() override
Definition: xmlstyli.cxx:71
#define CTF_SC_ALLBORDERWIDTH
Definition: xmlstyle.hxx:71
#define CTF_SC_ROWBREAKBEFORE
Definition: xmlstyle.hxx:92
#define CTF_SC_DIAGONALTLBR
Definition: xmlstyle.hxx:83
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:937
virtual void finished(::std::vector< XMLPropertyState > &rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex) const
rtl::Reference< SvXMLImportPropertyMapper > xColumnImpPropMapper
Definition: xmlstyli.hxx:132
const rtl::Reference< XMLPropertySetMapper > & GetCellStylesPropertySetMapper() const
Definition: xmlimprt.hxx:307
size_t size() const
Definition: rangelst.hxx:90
#define CTF_SC_TOPBORDERWIDTH
Definition: xmlstyle.hxx:74
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
void ClearContent(const OUString &rContent)
Definition: xmlstyli.cxx:990
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:77
const css::uno::Reference< css::style::XStyle > & GetStyle() const
rtl::Reference< XMLPropertySetMapper > maPropMapper
OUString maOperand2
First operand of the token or comparison value.
css::uno::Reference< css::container::XNameContainer > xColumnStyles
Definition: xmlstyli.hxx:122
#define CTF_SC_LEFTBORDERWIDTH
Definition: xmlstyle.hxx:72
rtl::Reference< SvXMLImportPropertyMapper > xTableImpPropMapper
Definition: xmlstyli.hxx:134
#define CTF_SC_RIGHTBORDER
Definition: xmlstyle.hxx:68
css::uno::Reference< css::container::XNameContainer > xRowStyles
Definition: xmlstyli.hxx:123
enumrange< T >::Iterator end(enumrange< T >)
OUString maOperand1
A comparison operator if existing.
virtual OUString GetServiceName(XmlStyleFamily nFamily) const
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:221
virtual ~ScCellTextStyleContext() override
Definition: xmlstyli.cxx:1025
virtual OUString GetServiceName(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:844
OUString sDataStyleName
Definition: xmlstyli.hxx:68
rtl::Reference< SvXMLImportPropertyMapper > xRowImpPropMapper
Definition: xmlstyli.hxx:133
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
#define CTF_SC_DIAGONALTLBRWIDTH
Definition: xmlstyle.hxx:84
void parseCondition(ScXMLConditionParseResult &rParseResult, const OUString &rAttribute, sal_Int32 nStartIndex)
Parses the next condition in a 'condition' attribute value of e.g.
#define CTF_SC_ROWOPTIMALHEIGHT
Definition: xmlstyle.hxx:91
virtual bool InsertStyleFamily(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:904
css::uno::Any maValue
const OUString & GetParentName() const
virtual void SAL_CALL endFastElement(sal_Int32 Element) override
#define CTF_SC_DIAGONALBLTRWIDTH
Definition: xmlstyle.hxx:86
#define XML_TYPE_PROP_TABLE_CELL
ScXMLRowImportPropertyMapper(const rtl::Reference< XMLPropertySetMapper > &rMapper, SvXMLImport &rImport)
Definition: xmlstyli.cxx:205
OUString GetStyleDisplayName(XmlStyleFamily nFamily, const OUString &rName) const
const OUString & GetName() const
void Join(const ScRange &, bool bIsInList=false)
Definition: rangelst.cxx:166
#define CTF_SC_IMPORT_MAP
Definition: xmlstyle.hxx:80
#define CTF_SC_CELLSTYLE
Definition: xmlstyle.hxx:81
virtual ~XMLTableStylesContext() override
Definition: xmlstyli.cxx:695
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlstyli.cxx:946
const OUStringLiteral gsTableStyleServiceName(XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME)
virtual ~ScXMLMasterStylesContext() override
Definition: xmlstyli.cxx:914
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:709
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
const css::uno::Reference< css::frame::XModel > & GetModel() const
virtual void Finish(bool bOverwrite) override
#define XML_LINE_TOP
Definition: xmlstyli.cxx:49
ScXMLAnnotationContext * GetAnnotationContext() const
virtual void Finish(bool bOverwrite) override
Definition: xmlstyli.cxx:1008
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:136
static ScConditionMode GetModeFromApi(css::sheet::ConditionOperator nOperator)
Definition: conditio.cxx:1396
rtl::Reference< SvXMLImportPropertyMapper > xCellImpPropMapper
Definition: xmlstyli.hxx:131
const char sServiceName[]
ScMasterPageContext(SvXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList, bool bOverwrite)
Definition: xmlstyli.cxx:952
XML_MASTER_PAGE
virtual void SetDefaults() override
Definition: xmlstyli.cxx:552
#define CTF_SC_TOPBORDER
Definition: xmlstyle.hxx:69
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:447
static SvXMLImportPropertyMapper * CreateParaExtPropMapper(SvXMLImport &)
virtual css::uno::Reference< css::container::XNameContainer > GetStylesContainer(XmlStyleFamily nFamily) const
virtual SvXMLStyleContext * CreateStyleChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:918
sal_Int32 GetIndex(const sal_Int16 nContextID)
Definition: xmlstyli.cxx:869
void SetKey(sal_uInt32 nNew)
Definition: conditio.hxx:593
#define CTF_SC_DIAGONALTLBRWIDTHS
Definition: xmlstyle.hxx:87
#define XML_LINE_TLBR
Definition: xmlstyli.cxx:52
void FinishStyles(bool bOverwrite)
#define SC_UNO_PAGE_RIGHTHDRCON
Definition: unonames.hxx:447
ScCellObj & GetCellObj() const
Definition: textuno.hxx:229
#define CTF_SC_RIGHTBORDERWIDTH
Definition: xmlstyle.hxx:73
#define CTF_SC_ALLBORDER
Definition: xmlstyle.hxx:66
sal_Int16 SCTAB
Definition: types.hxx:23
bool any2bool(const css::uno::Any &rAny)
SC_DLLPUBLIC void AddCondFormatData(const ScRangeList &rRange, SCTAB nTab, sal_uInt32 nIndex)
Definition: document.cxx:4809
rtl::Reference< XMLShapeImportHelper > const & GetShapeImport()
ScXMLMasterStylesContext(SvXMLImport &rImport)
Definition: xmlstyli.cxx:909
void AddContentStyle(XmlStyleFamily nFamily, const OUString &rName, const ESelection &rSelection)
Definition: xmlannoi.cxx:176
#define CTF_SC_BOTTOMPADDING
Definition: xmlstyle.hxx:62