LibreOffice Module sc (master)  1
autoform.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 <memory>
21 #include <autoform.hxx>
22 
23 #include <sfx2/docfile.hxx>
24 #include <unotools/pathoptions.hxx>
25 #include <svl/intitem.hxx>
26 #include <svl/itemset.hxx>
27 #include <vcl/outdev.hxx>
28 #include <svx/algitem.hxx>
29 #include <svx/dialmgr.hxx>
30 #include <svx/rotmodit.hxx>
31 #include <svx/strings.hrc>
32 #include <editeng/adjustitem.hxx>
33 #include <editeng/borderline.hxx>
34 #include <editeng/boxitem.hxx>
35 #include <editeng/brushitem.hxx>
36 #include <editeng/colritem.hxx>
37 #include <editeng/contouritem.hxx>
39 #include <editeng/fhgtitem.hxx>
40 #include <editeng/fontitem.hxx>
41 #include <editeng/justifyitem.hxx>
42 #include <editeng/langitem.hxx>
43 #include <editeng/lineitem.hxx>
44 #include <editeng/postitem.hxx>
45 #include <editeng/shdditem.hxx>
46 #include <editeng/udlnitem.hxx>
47 #include <editeng/wghtitem.hxx>
48 #include <tools/urlobj.hxx>
49 #include <comphelper/fileformat.h>
52 #include <tools/tenccvt.hxx>
53 #include <osl/diagnose.h>
54 #include <osl/thread.hxx>
55 
56 #include <attrib.hxx>
57 #include <globstr.hrc>
58 #include <scitems.hxx>
59 #include <scresid.hxx>
60 #include <document.hxx>
61 
62 /*
63  * XXX: BIG RED NOTICE! Changes MUST be binary file format compatible and MUST
64  * be synchronized with Writer's SwTableAutoFmtTbl sw/source/core/doc/tblafmt.cxx
65  */
66 
67 constexpr OUStringLiteral sAutoTblFmtName = u"autotbl.fmt";
68 
69 // till SO5PF
70 const sal_uInt16 AUTOFORMAT_ID_X = 9501;
71 const sal_uInt16 AUTOFORMAT_ID_358 = 9601;
72 const sal_uInt16 AUTOFORMAT_DATA_ID_X = 9502;
73 
74 // from SO5 on
75 // in following versions the value of the IDs must be higher
76 const sal_uInt16 AUTOFORMAT_ID_504 = 9801;
77 const sal_uInt16 AUTOFORMAT_DATA_ID_504 = 9802;
78 
79 const sal_uInt16 AUTOFORMAT_DATA_ID_552 = 9902;
80 
81 // --- from 680/dr25 on: store strings as UTF-8
82 const sal_uInt16 AUTOFORMAT_ID_680DR25 = 10021;
83 
84 // --- Bug fix to fdo#31005: Table Autoformats does not save/apply all properties (Writer and Calc)
85 const sal_uInt16 AUTOFORMAT_ID_31005 = 10041;
86 const sal_uInt16 AUTOFORMAT_DATA_ID_31005 = 10042;
87 
88 // current version
91 
92 namespace
93 {
96  {
97  blob.Reset();
98 
99  sal_uInt64 endOfBlob = 0;
100  stream.ReadUInt64( endOfBlob );
101 
102  const sal_uInt64 currentPosition = stream.Tell();
103  const sal_uInt64 blobSize = endOfBlob - currentPosition;
104  // A zero-size indicates an empty blob. This happens when Calc creates a new autoformat,
105  // since it (naturally) doesn't have any writer-specific data to write.
106  if (blobSize)
107  {
108  blob.pData.reset(new sal_uInt8[blobSize]);
109  blob.size = static_cast<std::size_t>(blobSize);
110  stream.ReadBytes(blob.pData.get(), blob.size);
111  }
112 
113  return stream;
114  }
115 
117  SvStream& WriteAutoFormatSwBlob(SvStream &stream, const AutoFormatSwBlob &blob)
118  {
119  const sal_uInt64 endOfBlob = stream.Tell() + sizeof(sal_uInt64) + blob.size;
120  stream.WriteUInt64( endOfBlob );
121  if (blob.size)
122  stream.WriteBytes(blob.pData.get(), blob.size);
123 
124  return stream;
125  }
126 }
127 
129 {
130 }
131 
132 void ScAfVersions::Load( SvStream& rStream, sal_uInt16 nVer )
133 {
134  LoadBlockA(rStream, nVer);
135  if (nVer >= AUTOFORMAT_ID_31005)
136  {
137  rStream >> swVersions;
138  }
139  LoadBlockB(rStream, nVer);
140 }
141 
142 void ScAfVersions::Write(SvStream& rStream, sal_uInt16 fileVersion)
143 {
144  AutoFormatVersions::WriteBlockA(rStream, fileVersion);
145 
146  if (fileVersion >= SOFFICE_FILEFORMAT_50)
147  {
148  WriteAutoFormatSwBlob( rStream, swVersions );
149  }
150 
151  AutoFormatVersions::WriteBlockB(rStream, fileVersion);
152 }
153 
155 {
156  // need to set default instances for base class AutoFormatBase here
157  // due to resource defines (e.g. ATTR_FONT) which are not available
158  // in svx and different in the different usages of derivations
159  m_aFont = std::make_unique<SvxFontItem>(ATTR_FONT);
160  m_aHeight = std::make_unique<SvxFontHeightItem>(240, 100, ATTR_FONT_HEIGHT);
161  m_aWeight = std::make_unique<SvxWeightItem>(WEIGHT_NORMAL, ATTR_FONT_WEIGHT);
162  m_aPosture = std::make_unique<SvxPostureItem>(ITALIC_NONE, ATTR_FONT_POSTURE);
163  m_aCJKFont = std::make_unique<SvxFontItem>(ATTR_CJK_FONT);
164  m_aCJKHeight = std::make_unique<SvxFontHeightItem>(240, 100, ATTR_CJK_FONT_HEIGHT);
165  m_aCJKWeight = std::make_unique<SvxWeightItem>(WEIGHT_NORMAL, ATTR_CJK_FONT_WEIGHT);
166  m_aCJKPosture = std::make_unique<SvxPostureItem>(ITALIC_NONE, ATTR_CJK_FONT_POSTURE);
167  m_aCTLFont = std::make_unique<SvxFontItem>(ATTR_CTL_FONT);
168  m_aCTLHeight = std::make_unique<SvxFontHeightItem>(240, 100, ATTR_CTL_FONT_HEIGHT);
169  m_aCTLWeight = std::make_unique<SvxWeightItem>(WEIGHT_NORMAL, ATTR_CTL_FONT_WEIGHT);
170  m_aCTLPosture = std::make_unique<SvxPostureItem>(ITALIC_NONE, ATTR_CTL_FONT_POSTURE);
171  m_aUnderline = std::make_unique<SvxUnderlineItem>(LINESTYLE_NONE,ATTR_FONT_UNDERLINE);
172  m_aOverline = std::make_unique<SvxOverlineItem>(LINESTYLE_NONE,ATTR_FONT_OVERLINE);
173  m_aCrossedOut = std::make_unique<SvxCrossedOutItem>(STRIKEOUT_NONE, ATTR_FONT_CROSSEDOUT);
174  m_aContour = std::make_unique<SvxContourItem>(false, ATTR_FONT_CONTOUR);
175  m_aShadowed = std::make_unique<SvxShadowedItem>(false, ATTR_FONT_SHADOWED);
176  m_aColor = std::make_unique<SvxColorItem>(ATTR_FONT_COLOR);
177  m_aBox = std::make_unique<SvxBoxItem>(ATTR_BORDER);
178  m_aTLBR = std::make_unique<SvxLineItem>(ATTR_BORDER_TLBR);
179  m_aBLTR = std::make_unique<SvxLineItem>(ATTR_BORDER_BLTR);
180  m_aBackground = std::make_unique<SvxBrushItem>(ATTR_BACKGROUND);
181  m_aAdjust = std::make_unique<SvxAdjustItem>(SvxAdjust::Left, 0);
182  m_aHorJustify = std::make_unique<SvxHorJustifyItem>(SvxCellHorJustify::Standard, ATTR_HOR_JUSTIFY);
183  m_aVerJustify = std::make_unique<SvxVerJustifyItem>(SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY);
184  m_aStacked = std::make_unique<ScVerticalStackCell>();
185  m_aMargin = std::make_unique<SvxMarginItem>(ATTR_MARGIN);
186  m_aLinebreak = std::make_unique<ScLineBreakCell>();
187  m_aRotateAngle = std::make_unique<ScRotateValueItem>(0_deg100);
188  m_aRotateMode = std::make_unique<SvxRotateModeItem>(SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE);
189 }
190 
192 : AutoFormatBase(rCopy),
193  // m_swFields was not copied in original, needed?
194  aNumFormat( rCopy.aNumFormat )
195 {
196 }
197 
199 {
200 }
201 
202 bool ScAutoFormatDataField::Load( SvStream& rStream, const ScAfVersions& rVersions, sal_uInt16 nVer )
203 {
204  LoadBlockA( rStream, rVersions, nVer );
205 
206  if (nVer >= AUTOFORMAT_DATA_ID_31005)
207  {
208  rStream >> m_swFields;
209  }
210 
211  LoadBlockB( rStream, rVersions, nVer );
212 
213  if( 0 == rVersions.nNumFormatVersion )
214  {
215  // --- from 680/dr25 on: store strings as UTF-8
216  rtl_TextEncoding eCharSet = (nVer >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
217  aNumFormat.Load( rStream, eCharSet );
218  }
219 
220  // adjust charset in font
221  rtl_TextEncoding eSysSet = osl_getThreadTextEncoding();
222  rtl_TextEncoding eSrcSet = rStream.GetStreamCharSet();
223  if( eSrcSet != eSysSet && m_aFont->GetCharSet() == eSrcSet )
224  m_aFont->SetCharSet(eSysSet);
225 
226  return (rStream.GetError() == ERRCODE_NONE);
227 }
228 
229 bool ScAutoFormatDataField::Save( SvStream& rStream, sal_uInt16 fileVersion )
230 {
231  SaveBlockA( rStream, fileVersion );
232 
233  if (fileVersion >= SOFFICE_FILEFORMAT_50)
234  {
235  WriteAutoFormatSwBlob( rStream, m_swFields );
236  }
237 
238  SaveBlockB( rStream, fileVersion );
239 
240  // --- from 680/dr25 on: store strings as UTF-8
241  aNumFormat.Save( rStream, RTL_TEXTENCODING_UTF8 );
242 
243  return (rStream.GetError() == ERRCODE_NONE);
244 }
245 
247 {
248  nStrResId = USHRT_MAX;
249 
251  bIncludeFont =
253  bIncludeFrame =
255  bIncludeWidthHeight = true;
256 
257  for( sal_uInt16 nIndex = 0; nIndex < 16; ++nIndex )
258  ppDataField[ nIndex ].reset( new ScAutoFormatDataField );
259 }
260 
262  aName( rData.aName ),
263  nStrResId( rData.nStrResId ),
264  bIncludeFont( rData.bIncludeFont ),
265  bIncludeJustify( rData.bIncludeJustify ),
266  bIncludeFrame( rData.bIncludeFrame ),
267  bIncludeBackground( rData.bIncludeBackground ),
268  bIncludeValueFormat( rData.bIncludeValueFormat ),
269  bIncludeWidthHeight( rData.bIncludeWidthHeight )
270 {
271  for( sal_uInt16 nIndex = 0; nIndex < 16; ++nIndex )
272  ppDataField[ nIndex ].reset( new ScAutoFormatDataField( rData.GetField( nIndex ) ) );
273 }
274 
276 {
277 }
278 
280 {
281  OSL_ENSURE( nIndex < 16, "ScAutoFormatData::GetField - illegal index" );
282  OSL_ENSURE( ppDataField[ nIndex ], "ScAutoFormatData::GetField - no data" );
283  return *ppDataField[ nIndex ];
284 }
285 
286 const ScAutoFormatDataField& ScAutoFormatData::GetField( sal_uInt16 nIndex ) const
287 {
288  OSL_ENSURE( nIndex < 16, "ScAutoFormatData::GetField - illegal index" );
289  OSL_ENSURE( ppDataField[ nIndex ], "ScAutoFormatData::GetField - no data" );
290  return *ppDataField[ nIndex ];
291 }
292 
293 const SfxPoolItem* ScAutoFormatData::GetItem( sal_uInt16 nIndex, sal_uInt16 nWhich ) const
294 {
295  const ScAutoFormatDataField& rField = GetField( nIndex );
296  switch( nWhich )
297  {
298  case ATTR_FONT: return &rField.GetFont();
299  case ATTR_FONT_HEIGHT: return &rField.GetHeight();
300  case ATTR_FONT_WEIGHT: return &rField.GetWeight();
301  case ATTR_FONT_POSTURE: return &rField.GetPosture();
302  case ATTR_CJK_FONT: return &rField.GetCJKFont();
303  case ATTR_CJK_FONT_HEIGHT: return &rField.GetCJKHeight();
304  case ATTR_CJK_FONT_WEIGHT: return &rField.GetCJKWeight();
305  case ATTR_CJK_FONT_POSTURE: return &rField.GetCJKPosture();
306  case ATTR_CTL_FONT: return &rField.GetCTLFont();
307  case ATTR_CTL_FONT_HEIGHT: return &rField.GetCTLHeight();
308  case ATTR_CTL_FONT_WEIGHT: return &rField.GetCTLWeight();
309  case ATTR_CTL_FONT_POSTURE: return &rField.GetCTLPosture();
310  case ATTR_FONT_UNDERLINE: return &rField.GetUnderline();
311  case ATTR_FONT_OVERLINE: return &rField.GetOverline();
312  case ATTR_FONT_CROSSEDOUT: return &rField.GetCrossedOut();
313  case ATTR_FONT_CONTOUR: return &rField.GetContour();
314  case ATTR_FONT_SHADOWED: return &rField.GetShadowed();
315  case ATTR_FONT_COLOR: return &rField.GetColor();
316  case ATTR_BORDER: return &rField.GetBox();
317  case ATTR_BORDER_TLBR: return &rField.GetTLBR();
318  case ATTR_BORDER_BLTR: return &rField.GetBLTR();
319  case ATTR_BACKGROUND: return &rField.GetBackground();
320  case ATTR_HOR_JUSTIFY: return &rField.GetHorJustify();
321  case ATTR_VER_JUSTIFY: return &rField.GetVerJustify();
322  case ATTR_STACKED: return &rField.GetStacked();
323  case ATTR_MARGIN: return &rField.GetMargin();
324  case ATTR_LINEBREAK: return &rField.GetLinebreak();
325  case ATTR_ROTATE_VALUE: return &rField.GetRotateAngle();
326  case ATTR_ROTATE_MODE: return &rField.GetRotateMode();
327  }
328  return nullptr;
329 }
330 
331 void ScAutoFormatData::PutItem( sal_uInt16 nIndex, const SfxPoolItem& rItem )
332 {
333  ScAutoFormatDataField& rField = GetField( nIndex );
334  switch( rItem.Which() )
335  {
336  case ATTR_FONT: rField.SetFont( rItem.StaticWhichCast(ATTR_FONT) ); break;
337  case ATTR_FONT_HEIGHT: rField.SetHeight( rItem.StaticWhichCast(ATTR_FONT_HEIGHT) ); break;
338  case ATTR_FONT_WEIGHT: rField.SetWeight( rItem.StaticWhichCast(ATTR_FONT_WEIGHT) ); break;
339  case ATTR_FONT_POSTURE: rField.SetPosture( rItem.StaticWhichCast(ATTR_FONT_POSTURE) ); break;
340  case ATTR_CJK_FONT: rField.SetCJKFont( rItem.StaticWhichCast(ATTR_CJK_FONT) ); break;
344  case ATTR_CTL_FONT: rField.SetCTLFont( rItem.StaticWhichCast(ATTR_CTL_FONT) ); break;
351  case ATTR_FONT_CONTOUR: rField.SetContour( rItem.StaticWhichCast(ATTR_FONT_CONTOUR) ); break;
353  case ATTR_FONT_COLOR: rField.SetColor( rItem.StaticWhichCast(ATTR_FONT_COLOR) ); break;
354  case ATTR_BORDER: rField.SetBox( rItem.StaticWhichCast(ATTR_BORDER) ); break;
355  case ATTR_BORDER_TLBR: rField.SetTLBR( rItem.StaticWhichCast(ATTR_BORDER_TLBR) ); break;
356  case ATTR_BORDER_BLTR: rField.SetBLTR( rItem.StaticWhichCast(ATTR_BORDER_BLTR) ); break;
357  case ATTR_BACKGROUND: rField.SetBackground( rItem.StaticWhichCast(ATTR_BACKGROUND) ); break;
358  case ATTR_HOR_JUSTIFY: rField.SetHorJustify( rItem.StaticWhichCast(ATTR_HOR_JUSTIFY) ); break;
359  case ATTR_VER_JUSTIFY: rField.SetVerJustify( rItem.StaticWhichCast(ATTR_VER_JUSTIFY) ); break;
360  case ATTR_STACKED: rField.SetStacked( rItem.StaticWhichCast(ATTR_STACKED) ); break;
361  case ATTR_MARGIN: rField.SetMargin( rItem.StaticWhichCast(ATTR_MARGIN) ); break;
362  case ATTR_LINEBREAK: rField.SetLinebreak( rItem.StaticWhichCast(ATTR_LINEBREAK) ); break;
364  case ATTR_ROTATE_MODE: rField.SetRotateMode( rItem.StaticWhichCast(ATTR_ROTATE_MODE) ); break;
365  }
366 }
367 
368 void ScAutoFormatData::CopyItem( sal_uInt16 nToIndex, sal_uInt16 nFromIndex, sal_uInt16 nWhich )
369 {
370  const SfxPoolItem* pItem = GetItem( nFromIndex, nWhich );
371  if( pItem )
372  PutItem( nToIndex, *pItem );
373 }
374 
375 const ScNumFormatAbbrev& ScAutoFormatData::GetNumFormat( sal_uInt16 nIndex ) const
376 {
377  return GetField( nIndex ).GetNumFormat();
378 }
379 
380 bool ScAutoFormatData::IsEqualData( sal_uInt16 nIndex1, sal_uInt16 nIndex2 ) const
381 {
382  bool bEqual = true;
383  const ScAutoFormatDataField& rField1 = GetField( nIndex1 );
384  const ScAutoFormatDataField& rField2 = GetField( nIndex2 );
385 
386  if( bIncludeValueFormat )
387  {
388  bEqual = bEqual
389  && (rField1.GetNumFormat() == rField2.GetNumFormat());
390  }
391  if( bIncludeFont )
392  {
393  bEqual = bEqual
394  && (rField1.GetFont() == rField2.GetFont())
395  && (rField1.GetHeight() == rField2.GetHeight())
396  && (rField1.GetWeight() == rField2.GetWeight())
397  && (rField1.GetPosture() == rField2.GetPosture())
398  && (rField1.GetCJKFont() == rField2.GetCJKFont())
399  && (rField1.GetCJKHeight() == rField2.GetCJKHeight())
400  && (rField1.GetCJKWeight() == rField2.GetCJKWeight())
401  && (rField1.GetCJKPosture() == rField2.GetCJKPosture())
402  && (rField1.GetCTLFont() == rField2.GetCTLFont())
403  && (rField1.GetCTLHeight() == rField2.GetCTLHeight())
404  && (rField1.GetCTLWeight() == rField2.GetCTLWeight())
405  && (rField1.GetCTLPosture() == rField2.GetCTLPosture())
406  && (rField1.GetUnderline() == rField2.GetUnderline())
407  && (rField1.GetOverline() == rField2.GetOverline())
408  && (rField1.GetCrossedOut() == rField2.GetCrossedOut())
409  && (rField1.GetContour() == rField2.GetContour())
410  && (rField1.GetShadowed() == rField2.GetShadowed())
411  && (rField1.GetColor() == rField2.GetColor());
412  }
413  if( bIncludeJustify )
414  {
415  bEqual = bEqual
416  && (rField1.GetHorJustify() == rField2.GetHorJustify())
417  && (rField1.GetVerJustify() == rField2.GetVerJustify())
418  && (rField1.GetStacked() == rField2.GetStacked())
419  && (rField1.GetLinebreak() == rField2.GetLinebreak())
420  && (rField1.GetMargin() == rField2.GetMargin())
421  && (rField1.GetRotateAngle() == rField2.GetRotateAngle())
422  && (rField1.GetRotateMode() == rField2.GetRotateMode());
423  }
424  if( bIncludeFrame )
425  {
426  bEqual = bEqual
427  && (rField1.GetBox() == rField2.GetBox())
428  && (rField1.GetTLBR() == rField2.GetTLBR())
429  && (rField1.GetBLTR() == rField2.GetBLTR());
430  }
431  if( bIncludeBackground )
432  {
433  bEqual = bEqual
434  && (rField1.GetBackground() == rField2.GetBackground());
435  }
436  return bEqual;
437 }
438 
439 void ScAutoFormatData::FillToItemSet( sal_uInt16 nIndex, SfxItemSet& rItemSet, const ScDocument& rDoc ) const
440 {
441  const ScAutoFormatDataField& rField = GetField( nIndex );
442 
443  if( bIncludeValueFormat )
444  {
445  ScNumFormatAbbrev& rNumFormat = const_cast<ScNumFormatAbbrev&>(rField.GetNumFormat());
446  SfxUInt32Item aValueFormat( ATTR_VALUE_FORMAT, 0 );
447  aValueFormat.SetValue( rNumFormat.GetFormatIndex( *rDoc.GetFormatTable() ) );
448  rItemSet.Put( aValueFormat );
449  rItemSet.Put( SvxLanguageItem( rNumFormat.GetLanguage(), ATTR_LANGUAGE_FORMAT ) );
450  }
451  if( bIncludeFont )
452  {
453  rItemSet.Put( rField.GetFont() );
454  rItemSet.Put( rField.GetHeight() );
455  rItemSet.Put( rField.GetWeight() );
456  rItemSet.Put( rField.GetPosture() );
457  // do not insert empty CJK font
458  const SvxFontItem& rCJKFont = rField.GetCJKFont();
459  if (!rCJKFont.GetStyleName().isEmpty())
460  {
461  rItemSet.Put( rCJKFont );
462  rItemSet.Put( rField.GetCJKHeight() );
463  rItemSet.Put( rField.GetCJKWeight() );
464  rItemSet.Put( rField.GetCJKPosture() );
465  }
466  else
467  {
468  SvxFontHeightItem aFontHeightItem(rField.GetHeight());
469  aFontHeightItem.SetWhich(ATTR_CJK_FONT_HEIGHT);
470  rItemSet.Put( aFontHeightItem );
471  SvxWeightItem aWeightItem(rField.GetWeight());
472  aWeightItem.SetWhich(ATTR_CJK_FONT_WEIGHT);
473  rItemSet.Put( aWeightItem );
474  SvxPostureItem aPostureItem(rField.GetPosture());
475  aPostureItem.SetWhich(ATTR_CJK_FONT_POSTURE);
476  rItemSet.Put( aPostureItem );
477  }
478  // do not insert empty CTL font
479  const SvxFontItem& rCTLFont = rField.GetCTLFont();
480  if (!rCTLFont.GetStyleName().isEmpty())
481  {
482  rItemSet.Put( rCTLFont );
483  rItemSet.Put( rField.GetCTLHeight() );
484  rItemSet.Put( rField.GetCTLWeight() );
485  rItemSet.Put( rField.GetCTLPosture() );
486  }
487  else
488  {
489  SvxFontHeightItem aFontHeightItem(rField.GetHeight());
490  aFontHeightItem.SetWhich(ATTR_CTL_FONT_HEIGHT);
491  rItemSet.Put( aFontHeightItem );
492  SvxWeightItem aWeightItem(rField.GetWeight());
493  aWeightItem.SetWhich(ATTR_CTL_FONT_WEIGHT);
494  rItemSet.Put( aWeightItem );
495  SvxPostureItem aPostureItem(rField.GetPosture());
496  aPostureItem.SetWhich(ATTR_CTL_FONT_POSTURE);
497  rItemSet.Put( aPostureItem );
498  }
499  rItemSet.Put( rField.GetUnderline() );
500  rItemSet.Put( rField.GetOverline() );
501  rItemSet.Put( rField.GetCrossedOut() );
502  rItemSet.Put( rField.GetContour() );
503  rItemSet.Put( rField.GetShadowed() );
504  rItemSet.Put( rField.GetColor() );
505  }
506  if( bIncludeJustify )
507  {
508  rItemSet.Put( rField.GetHorJustify() );
509  rItemSet.Put( rField.GetVerJustify() );
510  rItemSet.Put( rField.GetStacked() );
511  rItemSet.Put( rField.GetLinebreak() );
512  rItemSet.Put( rField.GetMargin() );
513  rItemSet.Put( rField.GetRotateAngle() );
514  rItemSet.Put( rField.GetRotateMode() );
515  }
516  if( bIncludeFrame )
517  {
518  rItemSet.Put( rField.GetBox() );
519  rItemSet.Put( rField.GetTLBR() );
520  rItemSet.Put( rField.GetBLTR() );
521  }
522  if( bIncludeBackground )
523  rItemSet.Put( rField.GetBackground() );
524 }
525 
526 void ScAutoFormatData::GetFromItemSet( sal_uInt16 nIndex, const SfxItemSet& rItemSet, const ScNumFormatAbbrev& rNumFormat )
527 {
528  ScAutoFormatDataField& rField = GetField( nIndex );
529 
530  rField.SetNumFormat ( rNumFormat);
531  rField.SetFont ( rItemSet.Get( ATTR_FONT ) );
532  rField.SetHeight ( rItemSet.Get( ATTR_FONT_HEIGHT ) );
533  rField.SetWeight ( rItemSet.Get( ATTR_FONT_WEIGHT ) );
534  rField.SetPosture ( rItemSet.Get( ATTR_FONT_POSTURE ) );
535  rField.SetCJKFont ( rItemSet.Get( ATTR_CJK_FONT ) );
536  rField.SetCJKHeight ( rItemSet.Get( ATTR_CJK_FONT_HEIGHT ) );
537  rField.SetCJKWeight ( rItemSet.Get( ATTR_CJK_FONT_WEIGHT ) );
538  rField.SetCJKPosture ( rItemSet.Get( ATTR_CJK_FONT_POSTURE ) );
539  rField.SetCTLFont ( rItemSet.Get( ATTR_CTL_FONT ) );
540  rField.SetCTLHeight ( rItemSet.Get( ATTR_CTL_FONT_HEIGHT ) );
541  rField.SetCTLWeight ( rItemSet.Get( ATTR_CTL_FONT_WEIGHT ) );
542  rField.SetCTLPosture ( rItemSet.Get( ATTR_CTL_FONT_POSTURE ) );
543  rField.SetUnderline ( rItemSet.Get( ATTR_FONT_UNDERLINE ) );
544  rField.SetOverline ( rItemSet.Get( ATTR_FONT_OVERLINE ) );
545  rField.SetCrossedOut ( rItemSet.Get( ATTR_FONT_CROSSEDOUT ) );
546  rField.SetContour ( rItemSet.Get( ATTR_FONT_CONTOUR ) );
547  rField.SetShadowed ( rItemSet.Get( ATTR_FONT_SHADOWED ) );
548  rField.SetColor ( rItemSet.Get( ATTR_FONT_COLOR ) );
549  rField.SetTLBR ( rItemSet.Get( ATTR_BORDER_TLBR ) );
550  rField.SetBLTR ( rItemSet.Get( ATTR_BORDER_BLTR ) );
551  rField.SetHorJustify ( rItemSet.Get( ATTR_HOR_JUSTIFY ) );
552  rField.SetVerJustify ( rItemSet.Get( ATTR_VER_JUSTIFY ) );
553  rField.SetStacked ( rItemSet.Get( ATTR_STACKED ) );
554  rField.SetLinebreak ( rItemSet.Get( ATTR_LINEBREAK ) );
555  rField.SetMargin ( rItemSet.Get( ATTR_MARGIN ) );
556  rField.SetBackground ( rItemSet.Get( ATTR_BACKGROUND ) );
557  rField.SetRotateAngle ( rItemSet.Get( ATTR_ROTATE_VALUE ) );
558  rField.SetRotateMode ( rItemSet.Get( ATTR_ROTATE_MODE ) );
559 }
560 
562 {
563  RID_SVXSTR_TBLAFMT_3D,
564  RID_SVXSTR_TBLAFMT_BLACK1,
565  RID_SVXSTR_TBLAFMT_BLACK2,
566  RID_SVXSTR_TBLAFMT_BLUE,
567  RID_SVXSTR_TBLAFMT_BROWN,
568  RID_SVXSTR_TBLAFMT_CURRENCY,
569  RID_SVXSTR_TBLAFMT_CURRENCY_3D,
570  RID_SVXSTR_TBLAFMT_CURRENCY_GRAY,
571  RID_SVXSTR_TBLAFMT_CURRENCY_LAVENDER,
572  RID_SVXSTR_TBLAFMT_CURRENCY_TURQUOISE,
573  RID_SVXSTR_TBLAFMT_GRAY,
574  RID_SVXSTR_TBLAFMT_GREEN,
575  RID_SVXSTR_TBLAFMT_LAVENDER,
576  RID_SVXSTR_TBLAFMT_RED,
577  RID_SVXSTR_TBLAFMT_TURQUOISE,
578  RID_SVXSTR_TBLAFMT_YELLOW,
579  RID_SVXSTR_TBLAFMT_LO6_ACADEMIC,
580  RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_BLUE,
581  RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_GREEN,
582  RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_RED,
583  RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_YELLOW,
584  RID_SVXSTR_TBLAFMT_LO6_ELEGANT,
585  RID_SVXSTR_TBLAFMT_LO6_FINANCIAL,
586  RID_SVXSTR_TBLAFMT_LO6_SIMPLE_GRID_COLUMNS,
587  RID_SVXSTR_TBLAFMT_LO6_SIMPLE_GRID_ROWS,
588  RID_SVXSTR_TBLAFMT_LO6_SIMPLE_LIST_SHADED
589 };
590 
591 bool ScAutoFormatData::Load( SvStream& rStream, const ScAfVersions& rVersions )
592 {
593  sal_uInt16 nVer = 0;
594  rStream.ReadUInt16( nVer );
595  bool bRet = ERRCODE_NONE == rStream.GetError();
596  if( bRet && (nVer == AUTOFORMAT_DATA_ID_X ||
597  (AUTOFORMAT_DATA_ID_504 <= nVer && nVer <= AUTOFORMAT_DATA_ID)) )
598  {
599  // --- from 680/dr25 on: store strings as UTF-8
600  if (nVer >= AUTOFORMAT_ID_680DR25)
601  {
603  RTL_TEXTENCODING_UTF8);
604  }
605  else
606  aName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
607 
608  if( AUTOFORMAT_DATA_ID_552 <= nVer )
609  {
610  rStream.ReadUInt16( nStrResId );
611  if (nStrResId < SAL_N_ELEMENTS(RID_SVXSTR_TBLAFMT))
612  aName = SvxResId(RID_SVXSTR_TBLAFMT[nStrResId]);
613  else
614  nStrResId = USHRT_MAX;
615  }
616 
617  bool b;
618  rStream.ReadCharAsBool( b ); bIncludeFont = b;
619  rStream.ReadCharAsBool( b ); bIncludeJustify = b;
620  rStream.ReadCharAsBool( b ); bIncludeFrame = b;
621  rStream.ReadCharAsBool( b ); bIncludeBackground = b;
622  rStream.ReadCharAsBool( b ); bIncludeValueFormat = b;
623  rStream.ReadCharAsBool( b ); bIncludeWidthHeight = b;
624 
625  if (nVer >= AUTOFORMAT_DATA_ID_31005)
626  rStream >> m_swFields;
627 
628  bRet = ERRCODE_NONE == rStream.GetError();
629  for( sal_uInt16 i = 0; bRet && i < 16; ++i )
630  bRet = GetField( i ).Load( rStream, rVersions, nVer );
631  }
632  else
633  bRet = false;
634  return bRet;
635 }
636 
637 bool ScAutoFormatData::Save(SvStream& rStream, sal_uInt16 fileVersion)
638 {
639  rStream.WriteUInt16( AUTOFORMAT_DATA_ID );
640  // --- from 680/dr25 on: store strings as UTF-8
641  write_uInt16_lenPrefixed_uInt8s_FromOUString(rStream, aName, RTL_TEXTENCODING_UTF8);
642 
643  rStream.WriteUInt16( nStrResId );
644  rStream.WriteBool( bIncludeFont );
645  rStream.WriteBool( bIncludeJustify );
646  rStream.WriteBool( bIncludeFrame );
647  rStream.WriteBool( bIncludeBackground );
648  rStream.WriteBool( bIncludeValueFormat );
649  rStream.WriteBool( bIncludeWidthHeight );
650 
651  if (fileVersion >= SOFFICE_FILEFORMAT_50)
652  WriteAutoFormatSwBlob( rStream, m_swFields );
653 
654  bool bRet = ERRCODE_NONE == rStream.GetError();
655  for (sal_uInt16 i = 0; bRet && (i < 16); i++)
656  bRet = GetField( i ).Save( rStream, fileVersion );
657 
658  return bRet;
659 }
660 
662  mbSaveLater(false)
663 {
664  // create default autoformat
665  std::unique_ptr<ScAutoFormatData> pData(new ScAutoFormatData);
666  OUString aName(ScResId(STR_STYLENAME_STANDARD));
667  pData->SetName(aName);
668 
669  // default font, default height
671  DefaultFontType::LATIN_SPREADSHEET, LANGUAGE_ENGLISH_US, GetDefaultFontFlags::OnlyOne );
672  SvxFontItem aFontItem(
673  aStdFont.GetFamilyType(), aStdFont.GetFamilyName(), aStdFont.GetStyleName(),
674  aStdFont.GetPitch(), aStdFont.GetCharSet(), ATTR_FONT );
675 
676  aStdFont = OutputDevice::GetDefaultFont(
677  DefaultFontType::CJK_SPREADSHEET, LANGUAGE_ENGLISH_US, GetDefaultFontFlags::OnlyOne );
678  SvxFontItem aCJKFontItem(
679  aStdFont.GetFamilyType(), aStdFont.GetFamilyName(), aStdFont.GetStyleName(),
680  aStdFont.GetPitch(), aStdFont.GetCharSet(), ATTR_CJK_FONT );
681 
682  aStdFont = OutputDevice::GetDefaultFont(
683  DefaultFontType::CTL_SPREADSHEET, LANGUAGE_ENGLISH_US, GetDefaultFontFlags::OnlyOne );
684  SvxFontItem aCTLFontItem(
685  aStdFont.GetFamilyType(), aStdFont.GetFamilyName(), aStdFont.GetStyleName(),
686  aStdFont.GetPitch(), aStdFont.GetCharSet(), ATTR_CTL_FONT );
687 
688  SvxFontHeightItem aHeight( 200, 100, ATTR_FONT_HEIGHT ); // 10 pt;
689 
690  // black thin border
691  Color aBlack( COL_BLACK );
692  ::editeng::SvxBorderLine aLine( &aBlack, DEF_LINE_WIDTH_0 );
693  SvxBoxItem aBox( ATTR_BORDER );
694  aBox.SetLine(&aLine, SvxBoxItemLine::LEFT);
695  aBox.SetLine(&aLine, SvxBoxItemLine::TOP);
696  aBox.SetLine(&aLine, SvxBoxItemLine::RIGHT);
697  aBox.SetLine(&aLine, SvxBoxItemLine::BOTTOM);
698 
699  Color aWhite(COL_WHITE);
700  SvxColorItem aWhiteText( aWhite, ATTR_FONT_COLOR );
701  SvxColorItem aBlackText( aBlack, ATTR_FONT_COLOR );
702  SvxBrushItem aBlueBack( COL_BLUE, ATTR_BACKGROUND );
703  SvxBrushItem aWhiteBack( aWhite, ATTR_BACKGROUND );
704  SvxBrushItem aGray70Back( Color(0x4d, 0x4d, 0x4d), ATTR_BACKGROUND );
705  SvxBrushItem aGray20Back( Color(0xcc, 0xcc, 0xcc), ATTR_BACKGROUND );
706 
707  for (sal_uInt16 i=0; i<16; i++)
708  {
709  pData->PutItem( i, aBox );
710  pData->PutItem( i, aFontItem );
711  pData->PutItem( i, aCJKFontItem );
712  pData->PutItem( i, aCTLFontItem );
713  aHeight.SetWhich( ATTR_FONT_HEIGHT );
714  pData->PutItem( i, aHeight );
715  aHeight.SetWhich( ATTR_CJK_FONT_HEIGHT );
716  pData->PutItem( i, aHeight );
717  aHeight.SetWhich( ATTR_CTL_FONT_HEIGHT );
718  pData->PutItem( i, aHeight );
719  if (i<4) // top: white on blue
720  {
721  pData->PutItem( i, aWhiteText );
722  pData->PutItem( i, aBlueBack );
723  }
724  else if ( i%4 == 0 ) // left: white on gray70
725  {
726  pData->PutItem( i, aWhiteText );
727  pData->PutItem( i, aGray70Back );
728  }
729  else if ( i%4 == 3 || i >= 12 ) // right and bottom: black on gray20
730  {
731  pData->PutItem( i, aBlackText );
732  pData->PutItem( i, aGray20Back );
733  }
734  else // center: black on white
735  {
736  pData->PutItem( i, aBlackText );
737  pData->PutItem( i, aWhiteBack );
738  }
739  }
740 
741  insert(std::move(pData));
742 }
743 
744 bool DefaultFirstEntry::operator() (const OUString& left, const OUString& right) const
745 {
746  OUString aStrStandard(ScResId(STR_STYLENAME_STANDARD));
747  if (ScGlobal::GetTransliteration().isEqual( left, right ) )
748  return false;
749  if ( ScGlobal::GetTransliteration().isEqual( left, aStrStandard ) )
750  return true;
751  if ( ScGlobal::GetTransliteration().isEqual( right, aStrStandard ) )
752  return false;
753  return ScGlobal::GetCollator().compareString( left, right) < 0;
754 }
755 
756 void ScAutoFormat::SetSaveLater( bool bSet )
757 {
758  mbSaveLater = bSet;
759 }
760 
761 const ScAutoFormatData* ScAutoFormat::findByIndex(size_t nIndex) const
762 {
763  if (nIndex >= m_Data.size())
764  return nullptr;
765 
766  MapType::const_iterator it = m_Data.begin();
767  std::advance(it, nIndex);
768  return it->second.get();
769 }
770 
772 {
773  if (nIndex >= m_Data.size())
774  return nullptr;
775 
776  MapType::iterator it = m_Data.begin();
777  std::advance(it, nIndex);
778  return it->second.get();
779 }
780 
782 {
783  return m_Data.find(rName);
784 }
785 
786 ScAutoFormat::iterator ScAutoFormat::insert(std::unique_ptr<ScAutoFormatData> pNew)
787 {
788  OUString aName = pNew->GetName();
789  return m_Data.insert(std::make_pair(aName, std::move(pNew))).first;
790 }
791 
793 {
794  m_Data.erase(it);
795 }
796 
797 size_t ScAutoFormat::size() const
798 {
799  return m_Data.size();
800 }
801 
803 {
804  return m_Data.begin();
805 }
806 
808 {
809  return m_Data.end();
810 }
811 
813 {
814  return m_Data.begin();
815 }
816 
818 {
819  return m_Data.end();
820 }
821 
823 {
825  SvtPathOptions aPathOpt;
826  aURL.SetSmartURL( aPathOpt.GetUserConfigPath() );
827  aURL.setFinalSlash();
828  aURL.Append( sAutoTblFmtName );
829 
830  SfxMedium aMedium( aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ );
831  SvStream* pStream = aMedium.GetInStream();
832  bool bRet = (pStream && pStream->GetError() == ERRCODE_NONE);
833  if (bRet)
834  {
835  SvStream& rStream = *pStream;
836  // Attention: A common header has to be read
837  sal_uInt16 nVal = 0;
838  rStream.ReadUInt16( nVal );
839  bRet = ERRCODE_NONE == rStream.GetError();
840 
841  if (bRet)
842  {
843  if( nVal == AUTOFORMAT_ID_358 ||
844  (AUTOFORMAT_ID_504 <= nVal && nVal <= AUTOFORMAT_ID) )
845  {
846  sal_uInt8 nChrSet, nCnt;
847  tools::Long nPos = rStream.Tell();
848  rStream.ReadUChar( nCnt ).ReadUChar( nChrSet );
849  if( rStream.Tell() != sal_uLong(nPos + nCnt) )
850  {
851  OSL_FAIL( "header contains more/newer data" );
852  rStream.Seek( nPos + nCnt );
853  }
854  rStream.SetStreamCharSet( GetSOLoadTextEncoding( nChrSet ) );
856  }
857 
858  if( nVal == AUTOFORMAT_ID_358 || nVal == AUTOFORMAT_ID_X ||
859  (AUTOFORMAT_ID_504 <= nVal && nVal <= AUTOFORMAT_ID) )
860  {
861  m_aVersions.Load( rStream, nVal ); // item versions
862 
863  sal_uInt16 nCnt = 0;
864  rStream.ReadUInt16( nCnt );
865  bRet = (rStream.GetError() == ERRCODE_NONE);
866 
867  // there has to at least be a sal_uInt16 header
868  const size_t nMaxRecords = rStream.remainingSize() / sizeof(sal_uInt16);
869  if (nCnt > nMaxRecords)
870  {
871  SAL_WARN("sc", "Parsing error: " << nMaxRecords <<
872  " max possible entries, but " << nCnt << " claimed, truncating");
873  nCnt = nMaxRecords;
874  }
875 
876  for (sal_uInt16 i=0; bRet && (i < nCnt); i++)
877  {
878  std::unique_ptr<ScAutoFormatData> pData(new ScAutoFormatData());
879  bRet = pData->Load(rStream, m_aVersions);
880  insert(std::move(pData));
881  }
882  }
883  }
884  }
885  mbSaveLater = false;
886 }
887 
889 {
891  SvtPathOptions aPathOpt;
892  aURL.SetSmartURL( aPathOpt.GetUserConfigPath() );
893  aURL.setFinalSlash();
894  aURL.Append(sAutoTblFmtName);
895 
896  SfxMedium aMedium( aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::WRITE );
897  SvStream* pStream = aMedium.GetOutStream();
898  bool bRet = (pStream && pStream->GetError() == ERRCODE_NONE);
899  if (bRet)
900  {
901  const sal_uInt16 fileVersion = SOFFICE_FILEFORMAT_50;
902  SvStream& rStream = *pStream;
903  rStream.SetVersion( fileVersion );
904 
905  // Attention: A common header has to be saved
906  rStream.WriteUInt16( AUTOFORMAT_ID )
907  .WriteUChar( 2 ) // Number of chars of the header including this
909  osl_getThreadTextEncoding() ) );
910  m_aVersions.Write(rStream, fileVersion);
911 
912  bRet &= (rStream.GetError() == ERRCODE_NONE);
913 
914  rStream.WriteUInt16( m_Data.size() - 1 );
915  bRet &= (rStream.GetError() == ERRCODE_NONE);
916  MapType::iterator it = m_Data.begin(), itEnd = m_Data.end();
917  if (it != itEnd)
918  {
919  for (++it; bRet && it != itEnd; ++it) // Skip the first item.
920  {
921  bRet &= it->second->Save(rStream, fileVersion);
922  }
923  }
924 
925  rStream.Flush();
926 
927  aMedium.Commit();
928  }
929  mbSaveLater = false;
930  return bRet;
931 }
932 
933 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvStream & WriteBool(bool b)
constexpr TypedWhichId< SvxWeightItem > ATTR_CTL_FONT_WEIGHT(118)
std::unique_ptr< SvxBrushItem > m_aBackground
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
URL aURL
std::unique_ptr< SfxBoolItem > m_aStacked
const SvxRotateModeItem & GetRotateMode() const
SvStream & WriteUInt64(sal_uInt64 nuInt64)
sal_Int32 nIndex
SAL_DLLPRIVATE ScAutoFormatDataField & GetField(sal_uInt16 nIndex)
Definition: autoform.cxx:279
void SetBackground(const SvxBrushItem &rNew)
void Load(SvStream &rStream, rtl_TextEncoding eByteStrSet)
Definition: zforauto.cxx:43
void erase(const iterator &it)
Definition: autoform.cxx:792
std::unique_ptr< SvxPostureItem > m_aCTLPosture
const SfxBoolItem & GetLinebreak() const
void SetOverline(const SvxOverlineItem &rNew)
constexpr TypedWhichId< SvxLanguageItem > ATTR_LANGUAGE_FORMAT(147)
const OUString & GetFamilyName() const
sal_Int32 compareString(const OUString &s1, const OUString &s2) const
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:89
std::unique_ptr< SvxFontHeightItem > m_aHeight
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
void CopyItem(sal_uInt16 nToIndex, sal_uInt16 nFromIndex, sal_uInt16 nWhich)
Definition: autoform.cxx:368
void SetCJKPosture(const SvxPostureItem &rNew)
void SetCJKFont(const SvxFontItem &rNew)
sal_uInt16 nStrResId
Definition: autoform.hxx:115
void SetMargin(const SvxMarginItem &rNew)
bool LoadBlockB(SvStream &rStream, const AutoFormatVersions &rVersions, sal_uInt16 nVer)
#define LANGUAGE_ENGLISH_US
size_t size() const
Definition: autoform.cxx:797
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
bool Save(SvStream &rStream, sal_uInt16 fileVersion)
Definition: autoform.cxx:637
std::unique_ptr< ContentProperties > pData
std::unique_ptr< SfxInt32Item > m_aRotateAngle
const OUString & GetStyleName() const
void LoadBlockB(SvStream &rStream, sal_uInt16 nVer)
bool Save(SvStream &rStream, sal_uInt16 fileVersion)
Definition: autoform.cxx:229
std::unique_ptr< SvxFontItem > m_aFont
iterator insert(std::unique_ptr< ScAutoFormatData > pNew)
Definition: autoform.cxx:786
std::size_t size
Definition: autoform.hxx:57
std::unique_ptr< SvxContourItem > m_aContour
const SvxFontHeightItem & GetCTLHeight() const
const SvxShadowedItem & GetShadowed() const
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
void Save(SvStream &rStream, rtl_TextEncoding eByteStrSet) const
Definition: zforauto.cxx:54
sal_uIntPtr sal_uLong
long Long
constexpr TypedWhichId< SvxRotateModeItem > ATTR_ROTATE_MODE(136)
const sal_uInt16 AUTOFORMAT_ID_358
Definition: autoform.cxx:71
SvStream & ReadCharAsBool(bool &rBool)
SVX_ROTATE_MODE_STANDARD
void SetSaveLater(bool bSet)
Definition: autoform.cxx:756
const SvxWeightItem & GetCTLWeight() const
const SvxFontItem & GetCTLFont() const
sal_uInt64 Seek(sal_uInt64 nPos)
std::unique_ptr< SvxFontHeightItem > m_aCJKHeight
bool SaveBlockB(SvStream &rStream, sal_uInt16 fileVersion) const
static void WriteBlockB(SvStream &rStream, sal_uInt16 fileVersion)
void Flush()
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
constexpr TypedWhichId< ScLineBreakCell > ATTR_LINEBREAK(139)
void SetContour(const SvxContourItem &rNew)
ScAfVersions m_aVersions
Definition: autoform.hxx:184
const SvxBrushItem & GetBackground() const
void SetCTLPosture(const SvxPostureItem &rNew)
rtl_TextEncoding GetSOStoreTextEncoding(rtl_TextEncoding eEncoding)
SvStream & ReadUInt64(sal_uInt64 &rUInt64)
const SvxPostureItem & GetCTLPosture() const
void SetCTLWeight(const SvxWeightItem &rNew)
bool Load(SvStream &rStream, const ScAfVersions &rVersions)
Definition: autoform.cxx:591
const SfxBoolItem & GetStacked() const
const SvxWeightItem & GetCJKWeight() const
static void WriteBlockA(SvStream &rStream, sal_uInt16 fileVersion)
FontFamily GetFamilyType()
bool IsEqualData(sal_uInt16 nIndex1, sal_uInt16 nIndex2) const
Definition: autoform.cxx:380
bool mbSaveLater
Definition: autoform.hxx:183
std::unique_ptr< SvxUnderlineItem > m_aUnderline
std::unique_ptr< SvxShadowedItem > m_aShadowed
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
const SvxFontItem & GetFont() const
AutoFormatSwBlob m_swFields
Definition: autoform.hxx:88
std::unique_ptr< SvxOverlineItem > m_aOverline
void FillToItemSet(sal_uInt16 nIndex, SfxItemSet &rItemSet, const ScDocument &rDoc) const
Definition: autoform.cxx:439
void SetHeight(const SvxFontHeightItem &rNew)
bool setFinalSlash()
ErrCode GetError() const
LINESTYLE_NONE
void SetUnderline(const SvxUnderlineItem &rNew)
bool LoadBlockA(SvStream &rStream, const AutoFormatVersions &rVersions, sal_uInt16 nVer)
std::size_t write_uInt16_lenPrefixed_uInt8s_FromOUString(SvStream &rStrm, std::u16string_view rStr, rtl_TextEncoding eEnc)
std::unique_ptr< SvxPostureItem > m_aCJKPosture
std::unique_ptr< SvxCrossedOutItem > m_aCrossedOut
std::unique_ptr< SvxHorJustifyItem > m_aHorJustify
void SetCJKWeight(const SvxWeightItem &rNew)
std::unique_ptr< SvxMarginItem > m_aMargin
OUString SvxResId(TranslateId aId)
ScNumFormatAbbrev aNumFormat
Definition: autoform.hxx:91
const SvxUnderlineItem & GetUnderline() const
MapType::iterator iterator
Definition: autoform.hxx:191
std::array< std::unique_ptr< ScAutoFormatDataField >, 16 > ppDataField
Definition: autoform.hxx:129
AutoFormatSwBlob swVersions
Definition: autoform.hxx:76
void SetLinebreak(const SfxBoolItem &rNew)
void SetTLBR(const SvxLineItem &rNew)
sal_uInt16 nNumFormatVersion
const SvxWeightItem & GetWeight() const
std::unique_ptr< SfxBoolItem > m_aLinebreak
sal_uInt64 remainingSize()
const_iterator begin() const
Definition: autoform.cxx:802
constexpr TypedWhichId< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)
const OUString & GetStyleName() const
void SetVerJustify(const SvxVerJustifyItem &rNew)
bool bIncludeValueFormat
Definition: autoform.hxx:123
const sal_uInt16 AUTOFORMAT_DATA_ID_552
Definition: autoform.cxx:79
#define SAL_N_ELEMENTS(arr)
void SetShadowed(const SvxShadowedItem &rNew)
AutoFormatSwBlob m_swFields
Definition: autoform.hxx:127
const SvxContourItem & GetContour() const
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_TLBR(141)
std::unique_ptr< sal_uInt8[]> pData
Definition: autoform.hxx:56
void SetCrossedOut(const SvxCrossedOutItem &rNew)
bool bIncludeBackground
Definition: autoform.hxx:120
bool bIncludeWidthHeight
Definition: autoform.hxx:124
constexpr TypedWhichId< SvxPostureItem > ATTR_FONT_POSTURE(103)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:441
const ScNumFormatAbbrev & GetNumFormat(sal_uInt16 nIndex) const
Definition: autoform.cxx:375
const sal_uInt16 AUTOFORMAT_DATA_ID_504
Definition: autoform.cxx:77
Contains all items for one cell of a table autoformat.
Definition: autoform.hxx:85
constexpr TypedWhichId< SvxShadowedItem > ATTR_FONT_SHADOWED(108)
#define SOFFICE_FILEFORMAT_50
LanguageType GetLanguage() const
Definition: zforauto.hxx:46
const OUString & GetUserConfigPath() const
OUString read_uInt16_lenPrefixed_uInt8s_ToOUString(SvStream &rStrm, rtl_TextEncoding eEnc)
FontPitch GetPitch()
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CJK_FONT_HEIGHT(112)
void SetWeight(const SvxWeightItem &rNew)
int i
T & StaticWhichCast(TypedWhichId< T > nId)
const SvxFontHeightItem & GetCJKHeight() const
void SetBox(const SvxBoxItem &rNew)
constexpr OUStringLiteral sAutoTblFmtName
Definition: autoform.cxx:67
void LoadBlockA(SvStream &rStream, sal_uInt16 nVer)
void SetBLTR(const SvxLineItem &rNew)
const ScNumFormatAbbrev & GetNumFormat() const
Definition: autoform.hxx:102
std::unique_ptr< SvxLineItem > m_aTLBR
std::unique_ptr< SvxBoxItem > m_aBox
constexpr TypedWhichId< SvxVerJustifyItem > ATTR_VER_JUSTIFY(132)
void SetRotateMode(const SvxRotateModeItem &rNew)
std::unique_ptr< SvxVerJustifyItem > m_aVerJustify
std::unique_ptr< SvxWeightItem > m_aCTLWeight
const sal_uInt16 AUTOFORMAT_ID_680DR25
Definition: autoform.cxx:82
void SetCTLHeight(const SvxFontHeightItem &rNew)
A binary blob of writer-specific data.
Definition: autoform.hxx:54
void SetCJKHeight(const SvxFontHeightItem &rNew)
const sal_uInt16 AUTOFORMAT_DATA_ID_31005
Definition: autoform.cxx:86
const sal_uInt16 AUTOFORMAT_ID_X
Definition: autoform.cxx:70
std::size_t WriteBytes(const void *pData, std::size_t nSize)
WEIGHT_NORMAL
float u
std::unique_ptr< SvxAdjustItem > m_aAdjust
OUString aName
Definition: autoform.hxx:114
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
void PutItem(sal_uInt16 nIndex, const SfxPoolItem &rItem)
Definition: autoform.cxx:331
XclImpStream & operator>>(XclImpStream &rStrm, XclImpDffPropSet &rPropSet)
Definition: xiescher.cxx:4447
void SetNumFormat(const ScNumFormatAbbrev &rNumFormat)
Definition: autoform.hxx:105
bool SaveBlockA(SvStream &rStream, sal_uInt16 fileVersion) const
const ScAutoFormatData * findByIndex(size_t nIndex) const
Definition: autoform.cxx:761
void SetHorJustify(const SvxHorJustifyItem &rNew)
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
SvStream & ReadUChar(unsigned char &rChar)
std::unique_ptr< SvxFontItem > m_aCTLFont
ITALIC_NONE
void SetVersion(sal_Int32 n)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CTL_FONT_HEIGHT(117)
constexpr TypedWhichId< SvxFontItem > ATTR_CTL_FONT(116)
rtl_TextEncoding GetSOLoadTextEncoding(rtl_TextEncoding eEncoding)
const SvxPostureItem & GetCJKPosture() const
bool Save()
Definition: autoform.cxx:888
std::unique_ptr< SvxPostureItem > m_aPosture
void SetFont(const SvxFontItem &rNew)
Reference< XOutputStream > stream
const SvxVerJustifyItem & GetVerJustify() const
std::size_t ReadBytes(void *pData, std::size_t nSize)
constexpr TypedWhichId< SvxFontItem > ATTR_CJK_FONT(111)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
const sal_uInt16 AUTOFORMAT_ID
Definition: autoform.cxx:89
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
MapType m_Data
Definition: autoform.hxx:182
iterator find(const OUString &rName)
Definition: autoform.cxx:781
void SetStacked(const SfxBoolItem &rNew)
void Load()
Definition: autoform.cxx:822
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SvxHorJustifyItem & GetHorJustify() const
const_iterator end() const
Definition: autoform.cxx:807
const SvxCrossedOutItem & GetCrossedOut() const
void GetFromItemSet(sal_uInt16 nIndex, const SfxItemSet &rItemSet, const ScNumFormatAbbrev &rNumFormat)
Definition: autoform.cxx:526
const SfxPoolItem * GetItem(sal_uInt16 nIndex, sal_uInt16 nWhich) const
Definition: autoform.cxx:293
void SetRotateAngle(const SfxInt32Item &rNew)
constexpr TypedWhichId< SvxPostureItem > ATTR_CTL_FONT_POSTURE(119)
sal_uInt32 GetFormatIndex(SvNumberFormatter &rFormatter)
Definition: zforauto.cxx:79
const sal_uInt16 AUTOFORMAT_ID_504
Definition: autoform.cxx:76
const SvxLineItem & GetBLTR() const
#define SOFFICE_FILEFORMAT_40
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void Load(SvStream &rStream, sal_uInt16 nVer)
Definition: autoform.cxx:132
#define ERRCODE_NONE
const SvxOverlineItem & GetOverline() const
constexpr TypedWhichId< SvxOverlineItem > ATTR_FONT_OVERLINE(105)
static SC_DLLPUBLIC CollatorWrapper & GetCollator()
case-insensitive collator
Definition: global.cxx:1047
const SvxLineItem & GetTLBR() const
unsigned char sal_uInt8
std::unique_ptr< SvxRotateModeItem > m_aRotateMode
std::unique_ptr< SvxLineItem > m_aBLTR
std::unique_ptr< SvxFontItem > m_aCJKFont
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
OUString aName
SvStream & WriteUChar(unsigned char nChar)
constexpr TypedWhichId< SvxPostureItem > ATTR_CJK_FONT_POSTURE(114)
MapType::const_iterator const_iterator
Definition: autoform.hxx:190
void SetStreamCharSet(rtl_TextEncoding eCharSet)
rtl_TextEncoding GetStreamCharSet() const
constexpr TypedWhichId< SvxWeightItem > ATTR_FONT_WEIGHT(102)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
const SvxFontItem & GetCJKFont() const
sal_uInt64 Tell() const
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
bool Append(std::u16string_view rTheSegment, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
std::unique_ptr< SvxColorItem > m_aColor
bool operator()(const OUString &left, const OUString &right) const
Definition: autoform.cxx:744
Struct with version numbers of the Items.
Definition: autoform.hxx:73
void SetValue(sal_uInt32 nTheValue)
std::unique_ptr< SvxWeightItem > m_aCJKWeight
const sal_uInt16 AUTOFORMAT_DATA_ID_X
Definition: autoform.cxx:72
std::unique_ptr< SvxWeightItem > m_aWeight
void SetPosture(const SvxPostureItem &rNew)
#define SAL_WARN(area, stream)
constexpr::Color COL_BLUE(0x00, 0x00, 0x80)
#define DEF_LINE_WIDTH_0
const SvxMarginItem & GetMargin() const
STRIKEOUT_NONE
static SC_DLLPUBLIC::utl::TransliterationWrapper & GetTransliteration()
Definition: global.cxx:978
const SvxPostureItem & GetPosture() const
const SvxColorItem & GetColor() const
const sal_uInt16 AUTOFORMAT_DATA_ID
Definition: autoform.cxx:90
void SetCTLFont(const SvxFontItem &rNew)
std::unique_ptr< SvxFontHeightItem > m_aCTLHeight
constexpr TypedWhichId< SvxColorItem > ATTR_FONT_COLOR(109)
constexpr TypedWhichId< SvxWeightItem > ATTR_CJK_FONT_WEIGHT(113)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
constexpr TypedWhichId< SvxContourItem > ATTR_FONT_CONTOUR(107)
sal_uInt16 Which() const
void Write(SvStream &rStream, sal_uInt16 fileVersion)
Definition: autoform.cxx:142
const SvxBoxItem & GetBox() const
const SvxFontHeightItem & GetHeight() const
bool Load(SvStream &rStream, const ScAfVersions &rVersions, sal_uInt16 nVer)
Definition: autoform.cxx:202
rtl_TextEncoding GetCharSet() const
const TranslateId RID_SVXSTR_TBLAFMT[]
Definition: autoform.cxx:561
const sal_uInt16 AUTOFORMAT_ID_31005
Definition: autoform.cxx:85
sal_uInt16 nPos
constexpr TypedWhichId< SvxMarginItem > ATTR_MARGIN(143)
bool SetSmartURL(OUString const &rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
const SfxInt32Item & GetRotateAngle() const
void SetColor(const SvxColorItem &rNew)
OUString ReadUniOrByteString(rtl_TextEncoding eSrcCharSet)
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)