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