LibreOffice Module sc (master) 1
xistyle.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 <xistyle.hxx>
22#include <sfx2/objsh.hxx>
23#include <svtools/ctrltool.hxx>
24#include <editeng/editobj.hxx>
25#include <scitems.hxx>
26#include <editeng/fontitem.hxx>
27#include <editeng/fhgtitem.hxx>
28#include <editeng/wghtitem.hxx>
29#include <editeng/udlnitem.hxx>
30#include <editeng/postitem.hxx>
33#include <editeng/shdditem.hxx>
35#include <svx/algitem.hxx>
37#include <editeng/boxitem.hxx>
38#include <editeng/lineitem.hxx>
39#include <svx/rotmodit.hxx>
40#include <editeng/colritem.hxx>
41#include <editeng/brushitem.hxx>
43#include <editeng/eeitem.hxx>
44#include <editeng/flstitem.hxx>
46#include <editeng/editids.hrc>
47#include <sal/macros.h>
48#include <sal/log.hxx>
50#include <vcl/fontcharmap.hxx>
51#include <vcl/outdev.hxx>
52#include <document.hxx>
53#include <documentimport.hxx>
54#include <docpool.hxx>
55#include <attrib.hxx>
56#include <patattr.hxx>
57#include <stlpool.hxx>
58#include <stlsheet.hxx>
59#include <globstr.hrc>
60#include <scresid.hxx>
61#include <attarray.hxx>
62#include <xladdress.hxx>
63#include <xlcontent.hxx>
64#include <xltracer.hxx>
65#include <xltools.hxx>
66#include <xistream.hxx>
67#include <xicontent.hxx>
68
69#include <root.hxx>
70#include <colrowst.hxx>
71
72#include <string_view>
73#include <vector>
74
76#include <com/sun/star/container/XIndexAccess.hpp>
77#include <com/sun/star/beans/XPropertySet.hpp>
78#include <com/sun/star/frame/XModel.hpp>
79#include <svl/numformat.hxx>
80#include <o3tl/string_view.hxx>
81
82using ::std::vector;
83using namespace ::com::sun::star;
84
85typedef ::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE;
86typedef ::std::vector< Color > ColorVec;
87
88namespace {
89
90class PaletteIndex : public XIndexAccess_BASE
91{
92public:
93 explicit PaletteIndex( ColorVec&& rColorTable ) : maColor( std::move(rColorTable) ) {}
94
95 // Methods XIndexAccess
96 virtual ::sal_Int32 SAL_CALL getCount() override
97 {
98 return maColor.size();
99 }
100
101 virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override
102 {
103 //--Index; // apparently the palette is already 1 based
104 return uno::Any( sal_Int32( maColor[ Index ] ) );
105 }
106
107 // Methods XElementAccess
108 virtual uno::Type SAL_CALL getElementType() override
109 {
110 return ::cppu::UnoType<sal_Int32>::get();
111 }
112 virtual sal_Bool SAL_CALL hasElements() override
113 {
114 return (!maColor.empty());
115 }
116
117private:
119};
120
121}
122
123void
125{
126 SfxObjectShell* pDocShell = mrRoot.GetDocShell();
127 if(!pDocShell)
128 return;
129
130 // copy values in color palette
131 sal_Int16 nColors = maColorTable.size();
132 ColorVec aColors;
133 aColors.resize( nColors );
134 for( sal_uInt16 nIndex = 0; nIndex < nColors; ++nIndex )
135 aColors[ nIndex ] = GetColor( nIndex );
136
137 uno::Reference< beans::XPropertySet > xProps( pDocShell->GetModel(), uno::UNO_QUERY );
138 if ( xProps.is() )
139 {
140 uno::Reference< container::XIndexAccess > xIndex( new PaletteIndex( std::move(aColors) ) );
141 xProps->setPropertyValue( "ColorPalette", uno::Any( xIndex ) );
142 }
143
144}
145// PALETTE record - color information =========================================
146
148 XclDefaultPalette( rRoot ), mrRoot( rRoot )
149{
150}
151
153{
154 maColorTable.clear();
155}
156
157Color XclImpPalette::GetColor( sal_uInt16 nXclIndex ) const
158{
159 if( nXclIndex >= EXC_COLOR_USEROFFSET )
160 {
161 sal_uInt32 nIx = nXclIndex - EXC_COLOR_USEROFFSET;
162 if( nIx < maColorTable.size() )
163 return maColorTable[ nIx ];
164 }
165 return GetDefColor( nXclIndex );
166}
167
169{
170 sal_uInt16 nCount;
171 nCount = rStrm.ReaduInt16();
172
173 const size_t nMinRecordSize = 4;
174 const size_t nMaxRecords = rStrm.GetRecLeft() / nMinRecordSize;
175 if (nCount > nMaxRecords)
176 {
177 SAL_WARN("sc", "Parsing error: " << nMaxRecords <<
178 " max possible entries, but " << nCount << " claimed, truncating");
179 nCount = nMaxRecords;
180 }
181
182 maColorTable.resize( nCount );
183 Color aColor;
184 for( sal_uInt16 nIndex = 0; nIndex < nCount; ++nIndex )
185 {
186 rStrm >> aColor;
187 maColorTable[ nIndex ] = aColor;
188 }
190}
191
192// FONT record - font information =============================================
194 XclImpRoot( rRoot ),
195 mbHasCharSet( false ),
196 mbHasWstrn( true ),
197 mbHasAsian( false ),
198 mbHasCmplx( false )
199{
200 SetAllUsedFlags( false );
201}
202
203XclImpFont::XclImpFont( const XclImpRoot& rRoot, const XclFontData& rFontData ) :
204 XclImpRoot( rRoot )
205{
206 SetFontData( rFontData, false );
207}
208
210{
213}
214
215void XclImpFont::SetFontData( const XclFontData& rFontData, bool bHasCharSet )
216{
217 maData = rFontData;
218 mbHasCharSet = bHasCharSet;
219 if( !maData.maStyle.isEmpty() )
220 {
221 if( SfxObjectShell* pDocShell = GetDocShell() )
222 {
223 if( const SvxFontListItem* pInfoItem = static_cast< const SvxFontListItem* >(
224 pDocShell->GetItem( SID_ATTR_CHAR_FONTLIST ) ) )
225 {
226 if( const FontList* pFontList = pInfoItem->GetFontList() )
227 {
228 FontMetric aFontMetric( pFontList->Get( maData.maName, maData.maStyle ) );
229 maData.SetScWeight( aFontMetric.GetWeight() );
230 maData.SetScPosture( aFontMetric.GetItalic() );
231 }
232 }
233 }
234 maData.maStyle.clear();
235 }
237 SetAllUsedFlags( true );
238}
239
240rtl_TextEncoding XclImpFont::GetFontEncoding() const
241{
242 // #i63105# use text encoding from FONT record
243 // #i67768# BIFF2-BIFF4 FONT records do not contain character set
244 rtl_TextEncoding eFontEnc = mbHasCharSet ? maData.GetFontEncoding() : GetTextEncoding();
245 return (eFontEnc == RTL_TEXTENCODING_DONTKNOW) ? GetTextEncoding() : eFontEnc;
246}
247
249{
250 switch( GetBiff() )
251 {
252 case EXC_BIFF2:
255 break;
256 case EXC_BIFF3:
257 case EXC_BIFF4:
261 break;
262 case EXC_BIFF5:
265 break;
266 case EXC_BIFF8:
269 break;
270 default:
272 return;
273 }
275 SetAllUsedFlags( true );
276}
277
279{
281}
282
284{
286 if( GetBiff() != EXC_BIFF8 )
287 return;
288
289 rStrm.Ignore( 64 );
290 sal_uInt32 nHeight = rStrm.ReaduInt32();
291 sal_uInt32 nStyle = rStrm.ReaduInt32();
292 sal_uInt16 nWeight = rStrm.ReaduInt16();
293 rStrm.Ignore( 2 ); //nEscapem
294 sal_uInt8 nUnderl = rStrm.ReaduInt8();
295 rStrm.Ignore( 3 );
296 sal_uInt32 nColor = rStrm.ReaduInt32();
297 rStrm.Ignore( 4 );
298 sal_uInt32 nFontFlags1 = rStrm.ReaduInt32();
299 rStrm.Ignore( 4 ); //nFontFlags2
300 sal_uInt32 nFontFlags3 = rStrm.ReaduInt32();
301 rStrm.Ignore( 18 );
302
303 if( (mbHeightUsed = (nHeight <= 0x7FFF)) )
304 maData.mnHeight = static_cast< sal_uInt16 >( nHeight );
305 if( (mbWeightUsed = !::get_flag( nFontFlags1, EXC_CF_FONT_STYLE ) && (nWeight < 0x7FFF)) )
306 maData.mnWeight = nWeight;
307 if( (mbItalicUsed = !::get_flag( nFontFlags1, EXC_CF_FONT_STYLE )) )
309 if( (mbUnderlUsed = !::get_flag( nFontFlags3, EXC_CF_FONT_UNDERL ) && (nUnderl <= 0x7F)) )
310 maData.mnUnderline = nUnderl;
311 if( (mbColorUsed = (nColor <= 0x7FFF)) )
312 maData.maColor = GetPalette().GetColor( static_cast< sal_uInt16 >( nColor ) );
313 if( (mbStrikeUsed = !::get_flag( nFontFlags1, EXC_CF_FONT_STRIKEOUT )) )
315}
316
317void XclImpFont::FillToItemSet( SfxItemSet& rItemSet, XclFontItemType eType, bool bSkipPoolDefs ) const
318{
319 // true = edit engine Which-IDs (EE_CHAR_*); false = Calc Which-IDs (ATTR_*)
320 bool bEE = eType != XclFontItemType::Cell;
321
322// item = the item to put into the item set
323// sc_which = the Calc Which-ID of the item
324// ee_which = the edit engine Which-ID of the item
325#define PUTITEM( item, sc_which, ee_which ) \
326 ScfTools::PutItem( rItemSet, item, (bEE ? (static_cast<sal_uInt16>(ee_which)) : (sc_which)), bSkipPoolDefs )
327
328// Font item
329 if( mbFontNameUsed )
330 {
331 rtl_TextEncoding eFontEnc = maData.GetFontEncoding();
332 rtl_TextEncoding eTempTextEnc = (bEE && (eFontEnc == GetTextEncoding())) ?
334
335 //add corresponding pitch for FontFamily
336 FontPitch ePitch = PITCH_DONTKNOW;
338 switch( eFtFamily ) //refer http://msdn.microsoft.com/en-us/library/aa246306(v=VS.60).aspx
339 {
340 case FAMILY_ROMAN: ePitch = PITCH_VARIABLE; break;
341 case FAMILY_SWISS: ePitch = PITCH_VARIABLE; break;
342 case FAMILY_MODERN: ePitch = PITCH_FIXED; break;
343 default: break;
344 }
345 SvxFontItem aFontItem( eFtFamily , maData.maName, OUString(), ePitch, eTempTextEnc, ATTR_FONT );
346
347 // set only for valid script types
348 if( mbHasWstrn )
349 PUTITEM( aFontItem, ATTR_FONT, EE_CHAR_FONTINFO );
350 if( mbHasAsian )
352 if( mbHasCmplx )
354 }
355
356// Font height (for all script types)
357 if( mbHeightUsed )
358 {
359 sal_Int32 nHeight = maData.mnHeight;
360 if( bEE && (eType != XclFontItemType::HeaderFooter) ) // do not convert header/footer height
361 nHeight = convertTwipToMm100(nHeight);
362
363 SvxFontHeightItem aHeightItem( nHeight, 100, ATTR_FONT_HEIGHT );
367 }
368
369// Font color - pass AUTO_COL to item
370 if( mbColorUsed )
372
373// Font weight (for all script types)
374 if( mbWeightUsed )
375 {
377 PUTITEM( aWeightItem, ATTR_FONT_WEIGHT, EE_CHAR_WEIGHT );
380 }
381
382// Font underline
383 if( mbUnderlUsed )
384 {
387 }
388
389// Font posture (for all script types)
390 if( mbItalicUsed )
391 {
396 }
397
398// Boolean attributes crossed out, contoured, shadowed
399 if( mbStrikeUsed )
401 if( mbOutlineUsed )
403 if( mbShadowUsed )
405
406// Super-/subscript: only on edit engine objects
407 if( mbEscapemUsed && bEE )
409
410#undef PUTITEM
411}
412
414 XclFontPropSetType eType, const Color* pFontColor ) const
415{
417 rPropSet, eType, maData, mbHasWstrn, mbHasAsian, mbHasCmplx, pFontColor );
418}
419
421{
422 sal_uInt16 nFlags;
423 maData.mnHeight = rStrm.ReaduInt16();
424 nFlags = rStrm.ReaduInt16();
425
432 mbHasCharSet = false;
433}
434
436{
437 sal_uInt16 nFlags;
438
439 maData.mnHeight = rStrm.ReaduInt16();
440 nFlags = rStrm.ReaduInt16();
442 maData.mnWeight = rStrm.ReaduInt16();
443 maData.mnEscapem = rStrm.ReaduInt16();
444 maData.mnUnderline = rStrm.ReaduInt8();
445 maData.mnFamily = rStrm.ReaduInt8();
446 maData.mnCharSet = rStrm.ReaduInt8();
447 rStrm.Ignore( 1 );
448
454}
455
457{
458 maData.maColor = GetPalette().GetColor( rStrm.ReaduInt16() );
459}
460
462{
463 maData.maName = rStrm.ReadByteString( false );
464}
465
467{
468 maData.maName = rStrm.ReadUniString( rStrm.ReaduInt8() );
469}
470
472{
473 mbHasWstrn = true;
474 mbHasAsian = mbHasCmplx = false;
475
476 // find the script types for which the font contains characters
477 OutputDevice* pPrinter = GetPrinter();
478 if(!pPrinter)
479 return;
480
481 vcl::Font aFont( maData.maName, Size( 0, 10 ) );
482 FontCharMapRef xFontCharMap;
483
484 pPrinter->SetFont( aFont );
485 if( !pPrinter->GetFontCharMap( xFontCharMap ) )
486 return;
487
488 // CJK fonts
489 mbHasAsian =
490 xFontCharMap->HasChar( 0x3041 ) || // 3040-309F: Hiragana
491 xFontCharMap->HasChar( 0x30A1 ) || // 30A0-30FF: Katakana
492 xFontCharMap->HasChar( 0x3111 ) || // 3100-312F: Bopomofo
493 xFontCharMap->HasChar( 0x3131 ) || // 3130-318F: Hangul Compatibility Jamo
494 xFontCharMap->HasChar( 0x3301 ) || // 3300-33FF: CJK Compatibility
495 xFontCharMap->HasChar( 0x3401 ) || // 3400-4DBF: CJK Unified Ideographs Extension A
496 xFontCharMap->HasChar( 0x4E01 ) || // 4E00-9FFF: CJK Unified Ideographs
497 xFontCharMap->HasChar( 0x7E01 ) || // 4E00-9FFF: CJK Unified Ideographs
498 xFontCharMap->HasChar( 0xA001 ) || // A001-A48F: Yi Syllables
499 xFontCharMap->HasChar( 0xAC01 ) || // AC00-D7AF: Hangul Syllables
500 xFontCharMap->HasChar( 0xCC01 ) || // AC00-D7AF: Hangul Syllables
501 xFontCharMap->HasChar( 0xF901 ) || // F900-FAFF: CJK Compatibility Ideographs
502 xFontCharMap->HasChar( 0xFF71 ); // FF00-FFEF: Halfwidth/Fullwidth Forms
503 // CTL fonts
504 mbHasCmplx =
505 xFontCharMap->HasChar( 0x05D1 ) || // 0590-05FF: Hebrew
506 xFontCharMap->HasChar( 0x0631 ) || // 0600-06FF: Arabic
507 xFontCharMap->HasChar( 0x0721 ) || // 0700-074F: Syriac
508 xFontCharMap->HasChar( 0x0911 ) || // 0900-0DFF: Indic scripts
509 xFontCharMap->HasChar( 0x0E01 ) || // 0E00-0E7F: Thai
510 xFontCharMap->HasChar( 0xFB21 ) || // FB1D-FB4F: Hebrew Presentation Forms
511 xFontCharMap->HasChar( 0xFB51 ) || // FB50-FDFF: Arabic Presentation Forms-A
512 xFontCharMap->HasChar( 0xFE71 ); // FE70-FEFF: Arabic Presentation Forms-B
513 // Western fonts
514 mbHasWstrn = (!mbHasAsian && !mbHasCmplx) || xFontCharMap->HasChar( 'A' );
515}
516
518 XclImpRoot( rRoot ),
519 maFont4( rRoot ),
520 maCtrlFont( rRoot )
521{
522 Initialize();
523
524 // default font for form controls without own font information
525 XclFontData aCtrlFontData;
526 switch( GetBiff() )
527 {
528 case EXC_BIFF2:
529 case EXC_BIFF3:
530 case EXC_BIFF4:
531 case EXC_BIFF5:
532 aCtrlFontData.maName = "Helv";
533 aCtrlFontData.mnHeight = 160;
534 aCtrlFontData.mnWeight = EXC_FONTWGHT_BOLD;
535 break;
536 case EXC_BIFF8:
537 aCtrlFontData.maName = "Tahoma";
538 aCtrlFontData.mnHeight = 160;
539 aCtrlFontData.mnWeight = EXC_FONTWGHT_NORMAL;
540 break;
541 default:
543 }
544 maCtrlFont.SetFontData( aCtrlFontData, false );
545}
546
548{
549 maFontList.clear();
550
551 // application font for column width calculation, later filled with first font from font list
552 XclFontData aAppFontData;
553 aAppFontData.maName = "Arial";
554 aAppFontData.mnHeight = 200;
555 aAppFontData.mnWeight = EXC_FONTWGHT_NORMAL;
556 UpdateAppFont( aAppFontData, false );
557}
558
559const XclImpFont* XclImpFontBuffer::GetFont( sal_uInt16 nFontIndex ) const
560{
561 /* Font with index 4 is not stored in an Excel file, but used e.g. by
562 BIFF5 form pushbutton objects. It is the bold default font.
563 This also means that entries above 4 are out by one in the list. */
564
565 if (nFontIndex == 4)
566 return &maFont4;
567
568 if (nFontIndex < 4)
569 {
570 // Font ID is zero-based when it's less than 4.
571 return nFontIndex >= maFontList.size() ? nullptr : &maFontList[nFontIndex];
572 }
573
574 // Font ID is greater than 4. It is now 1-based.
575 return nFontIndex > maFontList.size() ? nullptr : &maFontList[nFontIndex-1];
576}
577
579{
580 maFontList.emplace_back( GetRoot() );
581 XclImpFont& rFont = maFontList.back();
582 rFont.ReadFont( rStrm );
583
584 if( maFontList.size() == 1 )
585 {
586 UpdateAppFont( rFont.GetFontData(), rFont.HasCharSet() );
587 }
588}
589
591{
592 if( !maFontList.empty() )
593 maFontList.back().ReadEfont( rStrm );
594}
595
597 SfxItemSet& rItemSet, XclFontItemType eType,
598 sal_uInt16 nFontIdx, bool bSkipPoolDefs ) const
599{
600 if( const XclImpFont* pFont = GetFont( nFontIdx ) )
601 pFont->FillToItemSet( rItemSet, eType, bSkipPoolDefs );
602}
603
605 XclFontPropSetType eType, sal_uInt16 nFontIdx, const Color* pFontColor ) const
606{
607 if( const XclImpFont* pFont = GetFont( nFontIdx ) )
608 pFont->WriteFontProperties( rPropSet, eType, pFontColor );
609}
610
612{
614}
615
616void XclImpFontBuffer::UpdateAppFont( const XclFontData& rFontData, bool bHasCharSet )
617{
618 maAppFont = rFontData;
619 // #i3006# Calculate the width of '0' from first font and current printer.
621
622 // font 4 is bold font 0
623 XclFontData aFont4Data( maAppFont );
624 aFont4Data.mnWeight = EXC_FONTWGHT_BOLD;
625 maFont4.SetFontData( aFont4Data, bHasCharSet );
626}
627
628// FORMAT record - number formats =============================================
629
631 XclNumFmtBuffer( rRoot ),
632 XclImpRoot( rRoot ),
633 mnNextXclIdx( 0 )
634{
635}
636
638{
639 maIndexMap.clear();
640 mnNextXclIdx = 0;
641 InitializeImport(); // base class
642}
643
645{
646 OUString aFormat;
647 switch( GetBiff() )
648 {
649 case EXC_BIFF2:
650 case EXC_BIFF3:
651 aFormat = rStrm.ReadByteString( false );
652 break;
653
654 case EXC_BIFF4:
655 rStrm.Ignore( 2 ); // in BIFF4 the index field exists, but is undefined
656 aFormat = rStrm.ReadByteString( false );
657 break;
658
659 case EXC_BIFF5:
660 mnNextXclIdx = rStrm.ReaduInt16();
661 aFormat = rStrm.ReadByteString( false );
662 break;
663
664 case EXC_BIFF8:
665 mnNextXclIdx = rStrm.ReaduInt16();
666 aFormat = rStrm.ReadUniString();
667 break;
668
669 default:
671 return;
672 }
673
674 if( mnNextXclIdx < 0xFFFF )
675 {
676 InsertFormat( mnNextXclIdx, aFormat );
677 ++mnNextXclIdx;
678 }
679}
680
681sal_uInt16 XclImpNumFmtBuffer::ReadCFFormat( XclImpStream& rStrm, bool bIFmt )
682{
683 // internal number format ?
684 if(bIFmt)
685 {
686 rStrm.Ignore(1);
688 nIndex = rStrm.ReaduInt8();
689 return nIndex;
690 }
691 else
692 {
693 OUString aFormat = rStrm.ReadUniString();
694 InsertFormat( mnNextXclIdx, aFormat );
695 ++mnNextXclIdx;
696 return mnNextXclIdx - 1;
697 }
698}
699
701{
702 OSL_ENSURE( maIndexMap.empty(), "XclImpNumFmtBuffer::CreateScFormats - already created" );
703
704 SvNumberFormatter& rFormatter = GetFormatter();
705 for( const auto& [rXclNumFmt, rNumFmt] : GetFormatMap() )
706 {
707 // insert/convert the Excel number format
708 sal_uInt32 nKey;
709 if( !rNumFmt.maFormat.isEmpty() )
710 {
711 OUString aFormat( rNumFmt.maFormat );
712 sal_Int32 nCheckPos;
713 SvNumFormatType nType = SvNumFormatType::DEFINED;
714 rFormatter.PutandConvertEntry( aFormat, nCheckPos,
715 nType, nKey, LANGUAGE_ENGLISH_US, rNumFmt.meLanguage, false);
716 }
717 else
718 nKey = rFormatter.GetFormatIndex( rNumFmt.meOffset, rNumFmt.meLanguage );
719
720 // insert the resulting format key into the Excel->Calc index map
721 maIndexMap[ rXclNumFmt ] = nKey;
722 }
723}
724
725sal_uInt32 XclImpNumFmtBuffer::GetScFormat( sal_uInt16 nXclNumFmt ) const
726{
727 XclImpIndexMap::const_iterator aIt = maIndexMap.find( nXclNumFmt );
728 return (aIt != maIndexMap.end()) ? aIt->second : NUMBERFORMAT_ENTRY_NOT_FOUND;
729}
730
731void XclImpNumFmtBuffer::FillToItemSet( SfxItemSet& rItemSet, sal_uInt16 nXclNumFmt, bool bSkipPoolDefs ) const
732{
733 sal_uInt32 nScNumFmt = GetScFormat( nXclNumFmt );
734 if( nScNumFmt == NUMBERFORMAT_ENTRY_NOT_FOUND )
735 nScNumFmt = GetStdScNumFmt();
736 FillScFmtToItemSet( rItemSet, nScNumFmt, bSkipPoolDefs );
737}
738
739void XclImpNumFmtBuffer::FillScFmtToItemSet( SfxItemSet& rItemSet, sal_uInt32 nScNumFmt, bool bSkipPoolDefs ) const
740{
741 OSL_ENSURE( nScNumFmt != NUMBERFORMAT_ENTRY_NOT_FOUND, "XclImpNumFmtBuffer::FillScFmtToItemSet - invalid number format" );
742 ScfTools::PutItem( rItemSet, SfxUInt32Item( ATTR_VALUE_FORMAT, nScNumFmt ), bSkipPoolDefs );
743 if( rItemSet.GetItemState( ATTR_VALUE_FORMAT, false ) == SfxItemState::SET )
744 ScGlobal::AddLanguage( rItemSet, GetFormatter() );
745}
746
747// XF, STYLE record - Cell formatting =========================================
748
750{
751 mbLocked = ::get_flag( nNumFmt, EXC_XF2_LOCKED );
752 mbHidden = ::get_flag( nNumFmt, EXC_XF2_HIDDEN );
753}
754
755void XclImpCellProt::FillFromXF3( sal_uInt16 nProt )
756{
759}
760
761void XclImpCellProt::FillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
762{
763 ScfTools::PutItem( rItemSet, ScProtectionAttr( mbLocked, mbHidden ), bSkipPoolDefs );
764}
765
767{
768 mnHorAlign = ::extract_value< sal_uInt8 >( nFlags, 0, 3 );
769}
770
771void XclImpCellAlign::FillFromXF3( sal_uInt16 nAlign )
772{
773 mnHorAlign = ::extract_value< sal_uInt8 >( nAlign, 0, 3 );
774 mbLineBreak = ::get_flag( nAlign, EXC_XF_LINEBREAK ); // new in BIFF3
775}
776
777void XclImpCellAlign::FillFromXF4( sal_uInt16 nAlign )
778{
779 FillFromXF3( nAlign );
780 mnVerAlign = ::extract_value< sal_uInt8 >( nAlign, 4, 2 ); // new in BIFF4
781 mnOrient = ::extract_value< sal_uInt8 >( nAlign, 6, 2 ); // new in BIFF4
782}
783
784void XclImpCellAlign::FillFromXF5( sal_uInt16 nAlign )
785{
786 mnHorAlign = ::extract_value< sal_uInt8 >( nAlign, 0, 3 );
787 mnVerAlign = ::extract_value< sal_uInt8 >( nAlign, 4, 3 );
789 mnOrient = ::extract_value< sal_uInt8 >( nAlign, 8, 2 );
790}
791
792void XclImpCellAlign::FillFromXF8( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib )
793{
794 mnHorAlign = ::extract_value< sal_uInt8 >( nAlign, 0, 3 );
795 mnVerAlign = ::extract_value< sal_uInt8 >( nAlign, 4, 3 );
797 mnRotation = ::extract_value< sal_uInt8 >( nAlign, 8, 8 ); // new in BIFF8
798 mnIndent = ::extract_value< sal_uInt8 >( nMiscAttrib, 0, 4 ); // new in BIFF8
799 mbShrink = ::get_flag( nMiscAttrib, EXC_XF8_SHRINK ); // new in BIFF8
800 mnTextDir = ::extract_value< sal_uInt8 >( nMiscAttrib, 6, 2 ); // new in BIFF8
801}
802
803void XclImpCellAlign::FillFromCF( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib )
804{
805 mnHorAlign = extract_value< sal_uInt8 >( nAlign, 0, 3 );
806 mbLineBreak = get_flag< sal_uInt8 >( nAlign, EXC_XF_LINEBREAK );
807 mnVerAlign = ::extract_value< sal_uInt8 >( nAlign, 4, 3 );
808 mnRotation = ::extract_value< sal_uInt8 >( nAlign, 8, 8 );
809 mnIndent = ::extract_value< sal_uInt8 >( nMiscAttrib, 0, 4 );
810 mbShrink = ::get_flag( nMiscAttrib, EXC_XF8_SHRINK );
811 mnTextDir = ::extract_value< sal_uInt8 >( nMiscAttrib, 6, 2 );
812}
813
814void XclImpCellAlign::FillToItemSet( SfxItemSet& rItemSet, const XclImpFont* pFont, bool bSkipPoolDefs ) const
815{
816 // horizontal alignment
817 ScfTools::PutItem( rItemSet, SvxHorJustifyItem( GetScHorAlign(), ATTR_HOR_JUSTIFY ), bSkipPoolDefs );
819
820 // text wrap (#i74508# always if vertical alignment is justified or distributed)
822 ScfTools::PutItem( rItemSet, ScLineBreakCell( bLineBreak ), bSkipPoolDefs );
823
824 // vertical alignment
825 ScfTools::PutItem( rItemSet, SvxVerJustifyItem( GetScVerAlign(), ATTR_VER_JUSTIFY ), bSkipPoolDefs );
827
828 // indent
829 sal_uInt16 nScIndent = mnIndent * 200; // 1 Excel unit == 10 pt == 200 twips
830 ScfTools::PutItem( rItemSet, ScIndentItem( nScIndent ), bSkipPoolDefs );
831
832 // shrink to fit
833 ScfTools::PutItem( rItemSet, ScShrinkToFitCell( mbShrink ), bSkipPoolDefs );
834
835 // text orientation/rotation (BIFF2-BIFF7 sets mnOrient)
837 bool bStacked = (nXclRot == EXC_ROT_STACKED);
838 ScfTools::PutItem( rItemSet, ScVerticalStackCell( bStacked ), bSkipPoolDefs );
839 // set an angle in the range from -90 to 90 degrees
840 Degree100 nAngle = XclTools::GetScRotation( nXclRot, 0_deg100 );
841 ScfTools::PutItem( rItemSet, ScRotateValueItem( nAngle ), bSkipPoolDefs );
842 // set "Use asian vertical layout", if cell is stacked and font contains CKJ characters
843 bool bAsianVert = bStacked && pFont && pFont->HasAsianChars();
844 ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_VERTICAL_ASIAN, bAsianVert ), bSkipPoolDefs );
845
846 // CTL text direction
848}
849
851{
852 SetUsedFlags( false, false );
853}
854
855void XclImpCellBorder::SetUsedFlags( bool bOuterUsed, bool bDiagUsed )
856{
857 mbLeftUsed = mbRightUsed = mbTopUsed = mbBottomUsed = bOuterUsed;
858 mbDiagUsed = bDiagUsed;
859}
860
862{
868 SetUsedFlags( true, false );
869}
870
871void XclImpCellBorder::FillFromXF3( sal_uInt32 nBorder )
872{
873 mnTopLine = ::extract_value< sal_uInt8 >( nBorder, 0, 3 );
874 mnLeftLine = ::extract_value< sal_uInt8 >( nBorder, 8, 3 );
875 mnBottomLine = ::extract_value< sal_uInt8 >( nBorder, 16, 3 );
876 mnRightLine = ::extract_value< sal_uInt8 >( nBorder, 24, 3 );
877 mnTopColor = ::extract_value< sal_uInt16 >( nBorder, 3, 5 );
878 mnLeftColor = ::extract_value< sal_uInt16 >( nBorder, 11, 5 );
879 mnBottomColor = ::extract_value< sal_uInt16 >( nBorder, 19, 5 );
880 mnRightColor = ::extract_value< sal_uInt16 >( nBorder, 27, 5 );
881 SetUsedFlags( true, false );
882}
883
884void XclImpCellBorder::FillFromXF5( sal_uInt32 nBorder, sal_uInt32 nArea )
885{
886 mnTopLine = ::extract_value< sal_uInt8 >( nBorder, 0, 3 );
887 mnLeftLine = ::extract_value< sal_uInt8 >( nBorder, 3, 3 );
888 mnBottomLine = ::extract_value< sal_uInt8 >( nArea, 22, 3 );
889 mnRightLine = ::extract_value< sal_uInt8 >( nBorder, 6, 3 );
890 mnTopColor = ::extract_value< sal_uInt16 >( nBorder, 9, 7 );
891 mnLeftColor = ::extract_value< sal_uInt16 >( nBorder, 16, 7 );
892 mnBottomColor = ::extract_value< sal_uInt16 >( nArea, 25, 7 );
893 mnRightColor = ::extract_value< sal_uInt16 >( nBorder, 23, 7 );
894 SetUsedFlags( true, false );
895}
896
897void XclImpCellBorder::FillFromXF8( sal_uInt32 nBorder1, sal_uInt32 nBorder2 )
898{
899 mnLeftLine = ::extract_value< sal_uInt8 >( nBorder1, 0, 4 );
900 mnRightLine = ::extract_value< sal_uInt8 >( nBorder1, 4, 4 );
901 mnTopLine = ::extract_value< sal_uInt8 >( nBorder1, 8, 4 );
902 mnBottomLine = ::extract_value< sal_uInt8 >( nBorder1, 12, 4 );
903 mnLeftColor = ::extract_value< sal_uInt16 >( nBorder1, 16, 7 );
904 mnRightColor = ::extract_value< sal_uInt16 >( nBorder1, 23, 7 );
905 mnTopColor = ::extract_value< sal_uInt16 >( nBorder2, 0, 7 );
906 mnBottomColor = ::extract_value< sal_uInt16 >( nBorder2, 7, 7 );
910 {
911 mnDiagLine = ::extract_value< sal_uInt8 >( nBorder2, 21, 4 );
912 mnDiagColor = ::extract_value< sal_uInt16 >( nBorder2, 14, 7 );
913 }
914 SetUsedFlags( true, true );
915}
916
917void XclImpCellBorder::FillFromCF8( sal_uInt16 nLineStyle, sal_uInt32 nLineColor, sal_uInt32 nFlags )
918{
919 mnLeftLine = ::extract_value< sal_uInt8 >( nLineStyle, 0, 4 );
920 mnRightLine = ::extract_value< sal_uInt8 >( nLineStyle, 4, 4 );
921 mnTopLine = ::extract_value< sal_uInt8 >( nLineStyle, 8, 4 );
922 mnBottomLine = ::extract_value< sal_uInt8 >( nLineStyle, 12, 4 );
923 mnLeftColor = ::extract_value< sal_uInt16 >( nLineColor, 0, 7 );
924 mnRightColor = ::extract_value< sal_uInt16 >( nLineColor, 7, 7 );
925 mnTopColor = ::extract_value< sal_uInt16 >( nLineColor, 16, 7 );
926 mnBottomColor = ::extract_value< sal_uInt16 >( nLineColor, 23, 7 );
931 mbDiagUsed = false;
932}
933
935{
936 return
941}
942
943namespace {
944
946bool lclConvertBorderLine( ::editeng::SvxBorderLine& rLine, const XclImpPalette& rPalette, sal_uInt8 nXclLine, sal_uInt16 nXclColor )
947{
948 static const sal_uInt16 ppnLineParam[][ 4 ] =
949 {
950 // outer width, type
951 { 0, table::BorderLineStyle::SOLID }, // 0 = none
952 { EXC_BORDER_THIN, table::BorderLineStyle::SOLID }, // 1 = thin
953 { EXC_BORDER_MEDIUM, table::BorderLineStyle::SOLID }, // 2 = medium
954 { EXC_BORDER_THIN, table::BorderLineStyle::FINE_DASHED }, // 3 = dashed
955 { EXC_BORDER_THIN, table::BorderLineStyle::DOTTED }, // 4 = dotted
956 { EXC_BORDER_THICK, table::BorderLineStyle::SOLID }, // 5 = thick
957 { EXC_BORDER_THICK, table::BorderLineStyle::DOUBLE_THIN }, // 6 = double
958 { EXC_BORDER_HAIR, table::BorderLineStyle::SOLID }, // 7 = hair
959 { EXC_BORDER_MEDIUM, table::BorderLineStyle::DASHED }, // 8 = med dash
960 { EXC_BORDER_THIN, table::BorderLineStyle::DASH_DOT }, // 9 = thin dashdot
961 { EXC_BORDER_MEDIUM, table::BorderLineStyle::DASH_DOT }, // A = med dashdot
962 { EXC_BORDER_THIN, table::BorderLineStyle::DASH_DOT_DOT }, // B = thin dashdotdot
963 { EXC_BORDER_MEDIUM, table::BorderLineStyle::DASH_DOT_DOT }, // C = med dashdotdot
964 { EXC_BORDER_MEDIUM, table::BorderLineStyle::DASH_DOT } // D = med slant dashdot
965 };
966
967 if( nXclLine == EXC_LINE_NONE )
968 return false;
969 if( nXclLine >= SAL_N_ELEMENTS( ppnLineParam ) )
970 nXclLine = EXC_LINE_THIN;
971
972 rLine.SetColor( rPalette.GetColor( nXclColor ) );
973 rLine.SetWidth( ppnLineParam[ nXclLine ][ 0 ] );
974 rLine.SetBorderLineStyle( static_cast< SvxBorderLineStyle>(
975 ppnLineParam[ nXclLine ][ 1 ]) );
976 return true;
977}
978
979} // namespace
980
981void XclImpCellBorder::FillToItemSet( SfxItemSet& rItemSet, const XclImpPalette& rPalette, bool bSkipPoolDefs ) const
982{
984 {
985 SvxBoxItem aBoxItem( ATTR_BORDER );
987 if( mbLeftUsed && lclConvertBorderLine( aLine, rPalette, mnLeftLine, mnLeftColor ) )
988 aBoxItem.SetLine( &aLine, SvxBoxItemLine::LEFT );
989 if( mbRightUsed && lclConvertBorderLine( aLine, rPalette, mnRightLine, mnRightColor ) )
990 aBoxItem.SetLine( &aLine, SvxBoxItemLine::RIGHT );
991 if( mbTopUsed && lclConvertBorderLine( aLine, rPalette, mnTopLine, mnTopColor ) )
992 aBoxItem.SetLine( &aLine, SvxBoxItemLine::TOP );
993 if( mbBottomUsed && lclConvertBorderLine( aLine, rPalette, mnBottomLine, mnBottomColor ) )
994 aBoxItem.SetLine( &aLine, SvxBoxItemLine::BOTTOM );
995 ScfTools::PutItem( rItemSet, aBoxItem, bSkipPoolDefs );
996 }
997 if( !mbDiagUsed )
998 return;
999
1000 SvxLineItem aTLBRItem( ATTR_BORDER_TLBR );
1001 SvxLineItem aBLTRItem( ATTR_BORDER_BLTR );
1003 if( lclConvertBorderLine( aLine, rPalette, mnDiagLine, mnDiagColor ) )
1004 {
1005 if( mbDiagTLtoBR )
1006 aTLBRItem.SetLine( &aLine );
1007 if( mbDiagBLtoTR )
1008 aBLTRItem.SetLine( &aLine );
1009 }
1010 ScfTools::PutItem( rItemSet, aTLBRItem, bSkipPoolDefs );
1011 ScfTools::PutItem( rItemSet, aBLTRItem, bSkipPoolDefs );
1012}
1013
1015{
1016 SetUsedFlags( false );
1017}
1018
1020{
1021 mbForeUsed = mbBackUsed = mbPattUsed = bUsed;
1022}
1023
1025{
1029 SetUsedFlags( true );
1030}
1031
1032void XclImpCellArea::FillFromXF3( sal_uInt16 nArea )
1033{
1034 mnPattern = ::extract_value< sal_uInt8 >( nArea, 0, 6 );
1035 mnForeColor = ::extract_value< sal_uInt16 >( nArea, 6, 5 );
1036 mnBackColor = ::extract_value< sal_uInt16 >( nArea, 11, 5 );
1037 SetUsedFlags( true );
1038}
1039
1040void XclImpCellArea::FillFromXF5( sal_uInt32 nArea )
1041{
1042 mnPattern = ::extract_value< sal_uInt8 >( nArea, 16, 6 );
1043 mnForeColor = ::extract_value< sal_uInt16 >( nArea, 0, 7 );
1044 mnBackColor = ::extract_value< sal_uInt16 >( nArea, 7, 7 );
1045 SetUsedFlags( true );
1046}
1047
1048void XclImpCellArea::FillFromXF8( sal_uInt32 nBorder2, sal_uInt16 nArea )
1049{
1050 mnPattern = ::extract_value< sal_uInt8 >( nBorder2, 26, 6 );
1051 mnForeColor = ::extract_value< sal_uInt16 >( nArea, 0, 7 );
1052 mnBackColor = ::extract_value< sal_uInt16 >( nArea, 7, 7 );
1053 SetUsedFlags( true );
1054}
1055
1056void XclImpCellArea::FillFromCF8( sal_uInt16 nPattern, sal_uInt16 nColor, sal_uInt32 nFlags )
1057{
1058 mnForeColor = ::extract_value< sal_uInt16 >( nColor, 0, 7 );
1059 mnBackColor = ::extract_value< sal_uInt16 >( nColor, 7, 7 );
1060 mnPattern = ::extract_value< sal_uInt8 >( nPattern, 10, 6 );
1064
1065 if( mbBackUsed && (!mbPattUsed || (mnPattern == EXC_PATT_SOLID)) )
1066 {
1069 mbForeUsed = mbPattUsed = true;
1070 }
1071 else if( !mbBackUsed && mbPattUsed && (mnPattern == EXC_PATT_SOLID) )
1072 {
1073 mbPattUsed = false;
1074 }
1075}
1076
1077void XclImpCellArea::FillToItemSet( SfxItemSet& rItemSet, const XclImpPalette& rPalette, bool bSkipPoolDefs ) const
1078{
1079 if( !mbPattUsed ) // colors may be both unused in cond. formats
1080 return;
1081
1082 SvxBrushItem aBrushItem( ATTR_BACKGROUND );
1083
1084 // do not use IsTransparent() - old Calc filter writes transparency with different color indexes
1085 if( mnPattern == EXC_PATT_NONE )
1086 {
1087 aBrushItem.SetColor( COL_TRANSPARENT );
1088 }
1089 else
1090 {
1091 Color aFore( rPalette.GetColor( mbForeUsed ? mnForeColor : EXC_COLOR_WINDOWTEXT ) );
1092 Color aBack( rPalette.GetColor( mbBackUsed ? mnBackColor : EXC_COLOR_WINDOWBACK ) );
1093 aBrushItem.SetColor( XclTools::GetPatternColor( aFore, aBack, mnPattern ) );
1094 }
1095
1096 ScfTools::PutItem( rItemSet, aBrushItem, bSkipPoolDefs );
1097}
1098
1100 XclXFBase( true ), // default is cell XF
1101 XclImpRoot( rRoot ),
1102 mpStyleSheet( nullptr ),
1103 mnXclNumFmt( 0 ),
1104 mnXclFont( 0 )
1105{
1106}
1107
1109{
1110}
1111
1113{
1114 sal_uInt8 nReadFont, nReadNumFmt, nFlags;
1115 nReadFont = rStrm.ReaduInt8();
1116 rStrm.Ignore( 1 );
1117 nReadNumFmt = rStrm.ReaduInt8();
1118 nFlags = rStrm.ReaduInt8();
1119
1120 // XF type always cell, no parent, used flags always true
1121 SetAllUsedFlags( true );
1122
1123 // attributes
1124 maProtection.FillFromXF2( nReadNumFmt );
1125 mnXclFont = nReadFont;
1126 mnXclNumFmt = nReadNumFmt & EXC_XF2_VALFMT_MASK;
1127 maAlignment.FillFromXF2( nFlags );
1128 maBorder.FillFromXF2( nFlags );
1129 maArea.FillFromXF2( nFlags );
1130}
1131
1133{
1134 sal_uInt32 nBorder;
1135 sal_uInt16 nTypeProt, nAlign, nArea;
1136 sal_uInt8 nReadFont, nReadNumFmt;
1137 nReadFont = rStrm.ReaduInt8();
1138 nReadNumFmt = rStrm.ReaduInt8();
1139 nTypeProt = rStrm.ReaduInt16();
1140 nAlign = rStrm.ReaduInt16();
1141 nArea = rStrm.ReaduInt16();
1142 nBorder = rStrm.ReaduInt32();
1143
1144 // XF type/parent, attribute used flags
1145 mbCellXF = !::get_flag( nTypeProt, EXC_XF_STYLE ); // new in BIFF3
1146 mnParent = ::extract_value< sal_uInt16 >( nAlign, 4, 12 ); // new in BIFF3
1147 SetUsedFlags( ::extract_value< sal_uInt8 >( nTypeProt, 10, 6 ) );
1148
1149 // attributes
1150 maProtection.FillFromXF3( nTypeProt );
1151 mnXclFont = nReadFont;
1152 mnXclNumFmt = nReadNumFmt;
1153 maAlignment.FillFromXF3( nAlign );
1155 maArea.FillFromXF3( nArea ); // new in BIFF3
1156}
1157
1159{
1160 sal_uInt32 nBorder;
1161 sal_uInt16 nTypeProt, nAlign, nArea;
1162 sal_uInt8 nReadFont, nReadNumFmt;
1163 nReadFont = rStrm.ReaduInt8();
1164 nReadNumFmt = rStrm.ReaduInt8();
1165 nTypeProt = rStrm.ReaduInt16();
1166 nAlign = rStrm.ReaduInt16();
1167 nArea = rStrm.ReaduInt16();
1168 nBorder = rStrm.ReaduInt32();
1169
1170 // XF type/parent, attribute used flags
1171 mbCellXF = !::get_flag( nTypeProt, EXC_XF_STYLE );
1172 mnParent = ::extract_value< sal_uInt16 >( nTypeProt, 4, 12 );
1173 SetUsedFlags( ::extract_value< sal_uInt8 >( nAlign, 10, 6 ) );
1174
1175 // attributes
1176 maProtection.FillFromXF3( nTypeProt );
1177 mnXclFont = nReadFont;
1178 mnXclNumFmt = nReadNumFmt;
1179 maAlignment.FillFromXF4( nAlign );
1181 maArea.FillFromXF3( nArea );
1182}
1183
1185{
1186 sal_uInt32 nArea, nBorder;
1187 sal_uInt16 nTypeProt, nAlign;
1188 mnXclFont = rStrm.ReaduInt16();
1189 mnXclNumFmt = rStrm.ReaduInt16();
1190 nTypeProt = rStrm.ReaduInt16();
1191 nAlign = rStrm.ReaduInt16();
1192 nArea = rStrm.ReaduInt32();
1193 nBorder = rStrm.ReaduInt32();
1194
1195 // XF type/parent, attribute used flags
1196 mbCellXF = !::get_flag( nTypeProt, EXC_XF_STYLE );
1197 mnParent = ::extract_value< sal_uInt16 >( nTypeProt, 4, 12 );
1198 SetUsedFlags( ::extract_value< sal_uInt8 >( nAlign, 10, 6 ) );
1199
1200 // attributes
1201 maProtection.FillFromXF3( nTypeProt );
1202 maAlignment.FillFromXF5( nAlign );
1203 maBorder.FillFromXF5( nBorder, nArea );
1204 maArea.FillFromXF5( nArea );
1205}
1206
1208{
1209 sal_uInt32 nBorder1, nBorder2;
1210 sal_uInt16 nTypeProt, nAlign, nMiscAttrib, nArea;
1211 mnXclFont = rStrm.ReaduInt16();
1212 mnXclNumFmt = rStrm.ReaduInt16();
1213 nTypeProt = rStrm.ReaduInt16();
1214 nAlign = rStrm.ReaduInt16();
1215 nMiscAttrib = rStrm.ReaduInt16();
1216 nBorder1 = rStrm.ReaduInt32();
1217 nBorder2 = rStrm.ReaduInt32( );
1218 nArea = rStrm.ReaduInt16();
1219
1220 // XF type/parent, attribute used flags
1221 mbCellXF = !::get_flag( nTypeProt, EXC_XF_STYLE );
1222 mnParent = ::extract_value< sal_uInt16 >( nTypeProt, 4, 12 );
1223 SetUsedFlags( ::extract_value< sal_uInt8 >( nMiscAttrib, 10, 6 ) );
1224
1225 // attributes
1226 maProtection.FillFromXF3( nTypeProt );
1227 maAlignment.FillFromXF8( nAlign, nMiscAttrib );
1228 maBorder.FillFromXF8( nBorder1, nBorder2 );
1229 maArea.FillFromXF8( nBorder2, nArea );
1230}
1231
1233{
1234 switch( GetBiff() )
1235 {
1236 case EXC_BIFF2: ReadXF2( rStrm ); break;
1237 case EXC_BIFF3: ReadXF3( rStrm ); break;
1238 case EXC_BIFF4: ReadXF4( rStrm ); break;
1239 case EXC_BIFF5: ReadXF5( rStrm ); break;
1240 case EXC_BIFF8: ReadXF8( rStrm ); break;
1241 default: DBG_ERROR_BIFF();
1242 }
1243}
1244
1245const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs )
1246{
1247 if( mpPattern )
1248 return *mpPattern;
1249
1250 // create new pattern attribute set
1251 mpPattern.reset( new ScPatternAttr( GetDoc().GetPool() ) );
1252 SfxItemSet& rItemSet = mpPattern->GetItemSet();
1253 XclImpXF* pParentXF = IsCellXF() ? GetXFBuffer().GetXF( mnParent ) : nullptr;
1254
1255 // parent cell style
1256 if( IsCellXF() && !mpStyleSheet )
1257 {
1259
1260 /* Enables mb***Used flags, if the formatting attributes differ from
1261 the passed XF record. In cell XFs Excel uses the cell attributes,
1262 if they differ from the parent style XF.
1263 ...or if the respective flag is not set in parent style XF. */
1264 if( pParentXF )
1265 {
1266 if( !mbProtUsed )
1267 mbProtUsed = !pParentXF->mbProtUsed || !(maProtection == pParentXF->maProtection);
1268 if( !mbFontUsed )
1269 mbFontUsed = !pParentXF->mbFontUsed || (mnXclFont != pParentXF->mnXclFont);
1270 if( !mbFmtUsed )
1271 mbFmtUsed = !pParentXF->mbFmtUsed || (mnXclNumFmt != pParentXF->mnXclNumFmt);
1272 if( !mbAlignUsed )
1273 mbAlignUsed = !pParentXF->mbAlignUsed || !(maAlignment == pParentXF->maAlignment);
1274 if( !mbBorderUsed )
1275 mbBorderUsed = !pParentXF->mbBorderUsed || !(maBorder == pParentXF->maBorder);
1276 if( !mbAreaUsed )
1277 mbAreaUsed = !pParentXF->mbAreaUsed || !(maArea == pParentXF->maArea);
1278 }
1279 }
1280
1281 // cell protection
1282 if( mbProtUsed )
1283 maProtection.FillToItemSet( rItemSet, bSkipPoolDefs );
1284
1285 // font
1286 if( mbFontUsed )
1287 GetFontBuffer().FillToItemSet( rItemSet, XclFontItemType::Cell, mnXclFont, bSkipPoolDefs );
1288
1289 // value format
1290 if( mbFmtUsed )
1291 {
1292 GetNumFmtBuffer().FillToItemSet( rItemSet, mnXclNumFmt, bSkipPoolDefs );
1293 // Trace occurrences of Windows date formats
1295 }
1296
1297 // alignment
1298 if( mbAlignUsed )
1299 maAlignment.FillToItemSet( rItemSet, GetFontBuffer().GetFont( mnXclFont ), bSkipPoolDefs );
1300
1301 // border
1302 if( mbBorderUsed )
1303 {
1304 maBorder.FillToItemSet( rItemSet, GetPalette(), bSkipPoolDefs );
1308 }
1309
1310 // area
1311 if( mbAreaUsed )
1312 {
1313 maArea.FillToItemSet( rItemSet, GetPalette(), bSkipPoolDefs );
1316 }
1317
1318 /* #i38709# Decide which rotation reference mode to use. If any outer
1319 border line of the cell is set (either explicitly or via cell style),
1320 and the cell contents are rotated, set rotation reference to bottom of
1321 cell. This causes the borders to be painted rotated with the text. */
1322 if( mbAlignUsed || mbBorderUsed )
1323 {
1325 const XclImpCellAlign* pAlign = mbAlignUsed ? &maAlignment : (pParentXF ? &pParentXF->maAlignment : nullptr);
1326 const XclImpCellBorder* pBorder = mbBorderUsed ? &maBorder : (pParentXF ? &pParentXF->maBorder : nullptr);
1327 if( pAlign && pBorder && (0 < pAlign->mnRotation) && (pAlign->mnRotation <= 180) && pBorder->HasAnyOuterBorder() )
1328 eRotateMode = SVX_ROTATE_MODE_BOTTOM;
1329 ScfTools::PutItem( rItemSet, SvxRotateModeItem( eRotateMode, ATTR_ROTATE_MODE ), bSkipPoolDefs );
1330 }
1331
1332 // Excel's cell margins are different from Calc's default margins.
1333 SvxMarginItem aItem(40, 40, 40, 40, ATTR_MARGIN);
1334 ScfTools::PutItem(rItemSet, aItem, bSkipPoolDefs);
1335
1336 return *mpPattern;
1337}
1338
1340 std::vector<ScAttrEntry>& rAttrs, SCROW nRow1, SCROW nRow2, sal_uInt32 nForceScNumFmt)
1341{
1342 // force creation of cell style and hard formatting, do it here to have mpStyleSheet
1343 CreatePattern();
1344 ScPatternAttr& rPat = *mpPattern;
1345
1346 // insert into document
1347 ScDocument& rDoc = GetDoc();
1348
1349 if (IsCellXF())
1350 {
1351 if (mpStyleSheet)
1352 {
1353 // Apply style sheet. Don't clear the direct formats.
1354 rPat.SetStyleSheet(mpStyleSheet, false);
1355 }
1356 else
1357 {
1358 // When the cell format is not associated with any style, use the
1359 // 'Default' style. Some buggy XLS docs generated by apps other
1360 // than Excel (such as 1C) may not have any built-in styles at
1361 // all.
1362 ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
1363 if (pStylePool)
1364 {
1365 ScStyleSheet* pStyleSheet = static_cast<ScStyleSheet*>(
1366 pStylePool->Find(
1367 ScResId(STR_STYLENAME_STANDARD), SfxStyleFamily::Para));
1368
1369 if (pStyleSheet)
1370 rPat.SetStyleSheet(pStyleSheet, false);
1371 }
1372
1373 }
1374 }
1375
1376 if (nForceScNumFmt != NUMBERFORMAT_ENTRY_NOT_FOUND)
1377 {
1378 ScPatternAttr aNumPat(rDoc.GetPool());
1379 GetNumFmtBuffer().FillScFmtToItemSet(aNumPat.GetItemSet(), nForceScNumFmt);
1380 rPat.GetItemSet().Put(aNumPat.GetItemSet());
1381 }
1382
1383 // Make sure we skip unnamed styles.
1384 if (!rPat.GetStyleName())
1385 return;
1386
1387 // Check for a gap between the last entry and this one.
1388 bool bHasGap = false;
1389 if (rAttrs.empty() && nRow1 > 0)
1390 // First attribute range doesn't start at row 0.
1391 bHasGap = true;
1392
1393 if (!rAttrs.empty() && rAttrs.back().nEndRow + 1 < nRow1)
1394 bHasGap = true;
1395
1396 if (bHasGap)
1397 {
1398 // Fill this gap with the default pattern.
1399 ScAttrEntry aEntry;
1400 aEntry.nEndRow = nRow1 - 1;
1401 aEntry.pPattern = rDoc.GetDefPattern();
1402 rAttrs.push_back(aEntry);
1403 }
1404
1405 ScAttrEntry aEntry;
1406 aEntry.nEndRow = nRow2;
1407 aEntry.pPattern = &rDoc.GetPool()->Put(rPat);
1408 rAttrs.push_back(aEntry);
1409}
1410
1412 SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2,
1413 SCTAB nScTab )
1414{
1415 // force creation of cell style and hard formatting, do it here to have mpStyleSheet
1416 const ScPatternAttr& rPattern = CreatePattern();
1417
1418 // insert into document
1419 ScDocument& rDoc = GetDoc();
1420 if( IsCellXF() && mpStyleSheet )
1421 rDoc.ApplyStyleAreaTab( nScCol1, nScRow1, nScCol2, nScRow2, nScTab, *mpStyleSheet );
1422 if( HasUsedFlags() )
1423 rDoc.ApplyPatternAreaTab( nScCol1, nScRow1, nScCol2, nScRow2, nScTab, rPattern );
1424
1425}
1426
1428 const ScAddress& rScPos, sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 )
1429{
1430 /* Create an XF object and let it do the work. We will have access to its
1431 private members here. */
1432 XclImpXF aXF( rRoot );
1433
1434 // no used flags available in BIFF2 (always true)
1435 aXF.SetAllUsedFlags( true );
1436
1437 // set the attributes
1438 aXF.maProtection.FillFromXF2( nFlags1 );
1439 aXF.maAlignment.FillFromXF2( nFlags3 );
1440 aXF.maBorder.FillFromXF2( nFlags3 );
1441 aXF.maArea.FillFromXF2( nFlags3 );
1442 aXF.mnXclNumFmt = ::extract_value< sal_uInt16 >( nFlags2, 0, 6 );
1443 aXF.mnXclFont = ::extract_value< sal_uInt16 >( nFlags2, 6, 2 );
1444
1445 // write the attributes to the cell
1446 aXF.ApplyPattern( rScPos.Col(), rScPos.Row(), rScPos.Col(), rScPos.Row(), rScPos.Tab() );
1447}
1448
1450{
1451 /* Notes about finding the mb***Used flags:
1452 - In cell XFs a *set* bit means a used attribute.
1453 - In style XFs a *cleared* bit means a used attribute.
1454 The mb***Used members always store true, if the attribute is used.
1455 The "mbCellXF == ::get_flag(...)" construct evaluates to true in
1456 both mentioned cases: cell XF and set bit; or style XF and cleared bit.
1457 */
1458 mbProtUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_PROT ));
1459 mbFontUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_FONT ));
1460 mbFmtUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_VALFMT ));
1461 mbAlignUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_ALIGN ));
1462 mbBorderUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_BORDER ));
1463 mbAreaUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_AREA ));
1464}
1465
1467 XclImpRoot( rRoot ),
1468 mnXfId( EXC_XF_NOTFOUND ),
1469 mnBuiltinId( EXC_STYLE_USERDEF ),
1471 mbBuiltin( false ),
1472 mbCustom( false ),
1473 mbHidden( false ),
1474 mpStyleSheet( nullptr )
1475{
1476}
1477
1479{
1481
1482 sal_uInt16 nXFIndex;
1483 nXFIndex = rStrm.ReaduInt16();
1484 mnXfId = nXFIndex & EXC_STYLE_XFMASK;
1485 mbBuiltin = ::get_flag( nXFIndex, EXC_STYLE_BUILTIN );
1486
1487 if( mbBuiltin )
1488 {
1489 mnBuiltinId = rStrm.ReaduInt8();
1490 mnLevel = rStrm.ReaduInt8();
1491 }
1492 else
1493 {
1494 maName = (GetBiff() <= EXC_BIFF5) ? rStrm.ReadByteString( false ) : rStrm.ReadUniString();
1495 // #i103281# check if this is a new built-in style introduced in XL2007
1496 if( (GetBiff() == EXC_BIFF8) && (rStrm.GetNextRecId() == EXC_ID_STYLEEXT) && rStrm.StartNextRecord() )
1497 {
1498 sal_uInt8 nExtFlags;
1499 rStrm.Ignore( 12 );
1500 nExtFlags = rStrm.ReaduInt8();
1502 mbCustom = ::get_flag( nExtFlags, EXC_STYLEEXT_CUSTOM );
1503 mbHidden = ::get_flag( nExtFlags, EXC_STYLEEXT_HIDDEN );
1504 if( mbBuiltin )
1505 {
1506 rStrm.Ignore( 1 ); // category
1507 mnBuiltinId = rStrm.ReaduInt8();
1508 mnLevel = rStrm.ReaduInt8();
1509 }
1510 }
1511 }
1512}
1513
1515{
1516 // #i1624# #i1768# ignore unnamed user styles
1517 if( !mpStyleSheet && (!maFinalName.isEmpty()) )
1518 {
1519 bool bCreatePattern = false;
1520 XclImpXF* pXF = GetXFBuffer().GetXF( mnXfId );
1521
1522 bool bDefStyle = mbBuiltin && (mnBuiltinId == EXC_STYLE_NORMAL);
1523 if( bDefStyle )
1524 {
1525 // set all flags to true to get all items in XclImpXF::CreatePattern()
1526 if( pXF ) pXF->SetAllUsedFlags( true );
1527 // use existing "Default" style sheet
1528 mpStyleSheet = static_cast< ScStyleSheet* >( GetStyleSheetPool().Find(
1529 ScResId( STR_STYLENAME_STANDARD ), SfxStyleFamily::Para ) );
1530 OSL_ENSURE( mpStyleSheet, "XclImpStyle::CreateStyleSheet - Default style not found" );
1531 bCreatePattern = true;
1532 }
1533 else
1534 {
1535 /* #i103281# do not create another style sheet of the same name,
1536 if it exists already. This is needed to prevent that styles
1537 pasted from clipboard get duplicated over and over. */
1538 mpStyleSheet = static_cast< ScStyleSheet* >( GetStyleSheetPool().Find( maFinalName, SfxStyleFamily::Para ) );
1539 if( !mpStyleSheet )
1540 {
1541 mpStyleSheet = &static_cast< ScStyleSheet& >( GetStyleSheetPool().Make( maFinalName, SfxStyleFamily::Para, SfxStyleSearchBits::UserDefined ) );
1542 bCreatePattern = true;
1543 }
1544 }
1545
1546 // bDefStyle==true omits default pool items in CreatePattern()
1547 if( bCreatePattern && mpStyleSheet && pXF )
1548 mpStyleSheet->GetItemSet().Put( pXF->CreatePattern( bDefStyle ).GetItemSet() );
1549 }
1550 return mpStyleSheet;
1551}
1552
1553void XclImpStyle::CreateUserStyle( const OUString& rFinalName )
1554{
1555 maFinalName = rFinalName;
1556 if( !IsBuiltin() || mbCustom )
1558}
1559
1561 XclImpRoot( rRoot )
1562{
1563}
1564
1566{
1567 maXFList.clear();
1568 maBuiltinStyles.clear();
1569 maUserStyles.clear();
1570 maStylesByXf.clear();
1571}
1572
1574{
1575 std::unique_ptr<XclImpXF> xXF = std::make_unique<XclImpXF>(GetRoot());
1576 xXF->ReadXF(rStrm);
1577 maXFList.emplace_back(std::move(xXF));
1578}
1579
1581{
1582 std::unique_ptr<XclImpStyle> xStyle(std::make_unique<XclImpStyle>(GetRoot()));
1583 xStyle->ReadStyle(rStrm);
1584 XclImpStyleList& rStyleList = (xStyle->IsBuiltin() ? maBuiltinStyles : maUserStyles);
1585 rStyleList.emplace_back(std::move(xStyle));
1586 XclImpStyle* pStyle = rStyleList.back().get();
1587 OSL_ENSURE( maStylesByXf.count( pStyle->GetXfId() ) == 0, "XclImpXFBuffer::ReadStyle - multiple styles with equal XF identifier" );
1588 maStylesByXf[ pStyle->GetXfId() ] = pStyle;
1589}
1590
1591sal_uInt16 XclImpXFBuffer::GetFontIndex( sal_uInt16 nXFIndex ) const
1592{
1593 const XclImpXF* pXF = GetXF( nXFIndex );
1594 return pXF ? pXF->GetFontIndex() : EXC_FONT_NOTFOUND;
1595}
1596
1597const XclImpFont* XclImpXFBuffer::GetFont( sal_uInt16 nXFIndex ) const
1598{
1599 return GetFontBuffer().GetFont( GetFontIndex( nXFIndex ) );
1600}
1601
1602namespace {
1603
1605struct IgnoreCaseCompare
1606{
1607 bool operator()( std::u16string_view rName1, std::u16string_view rName2 ) const
1608 { return o3tl::compareToIgnoreAsciiCase( rName1, rName2 ) < 0; }
1609};
1610
1611} // namespace
1612
1614{
1615 // calculate final names of all styles
1616 std::map< OUString, XclImpStyle*, IgnoreCaseCompare > aCellStyles;
1617 std::vector< XclImpStyle* > aConflictNameStyles;
1618
1619 /* First, reserve style names that are built-in in Calc. This causes that
1620 imported cell styles get different unused names and thus do not try to
1621 overwrite these built-in styles. For BIFF4 workbooks (which contain a
1622 separate list of cell styles per sheet), reserve all existing styles if
1623 current sheet is not the first sheet (this styles buffer will be
1624 initialized again for every new sheet). This will create unique names
1625 for styles in different sheets with the same name. Assuming that the
1626 BIFF4W import filter is never used to import from clipboard... */
1627 bool bReserveAll = (GetBiff() == EXC_BIFF4) && (GetCurrScTab() > 0);
1628 SfxStyleSheetIterator aStyleIter( GetDoc().GetStyleSheetPool(), SfxStyleFamily::Para );
1629 OUString aStandardName = ScResId( STR_STYLENAME_STANDARD );
1630 for( SfxStyleSheetBase* pStyleSheet = aStyleIter.First(); pStyleSheet; pStyleSheet = aStyleIter.Next() )
1631 if( (pStyleSheet->GetName() != aStandardName) && (bReserveAll || !pStyleSheet->IsUserDefined()) )
1632 if( aCellStyles.count( pStyleSheet->GetName() ) == 0 )
1633 aCellStyles[ pStyleSheet->GetName() ] = nullptr;
1634
1635 /* Calculate names of built-in styles. Store styles with reserved names
1636 in the aConflictNameStyles list. */
1637 for( const auto& rxStyle : maBuiltinStyles )
1638 {
1639 OUString aStyleName = XclTools::GetBuiltInStyleName( rxStyle->GetBuiltinId(), rxStyle->GetName(), rxStyle->GetLevel() );
1640 OSL_ENSURE( bReserveAll || (aCellStyles.count( aStyleName ) == 0),
1641 "XclImpXFBuffer::CreateUserStyles - multiple styles with equal built-in identifier" );
1642 if( aCellStyles.count( aStyleName ) > 0 )
1643 aConflictNameStyles.push_back( rxStyle.get() );
1644 else
1645 aCellStyles[ aStyleName ] = rxStyle.get();
1646 }
1647
1648 /* Calculate names of user defined styles. Store styles with reserved
1649 names in the aConflictNameStyles list. */
1650 for( const auto& rxStyle : maUserStyles )
1651 {
1652 // #i1624# #i1768# ignore unnamed user styles
1653 if( !rxStyle->GetName().isEmpty() )
1654 {
1655 if( aCellStyles.count( rxStyle->GetName() ) > 0 )
1656 aConflictNameStyles.push_back( rxStyle.get() );
1657 else
1658 aCellStyles[ rxStyle->GetName() ] = rxStyle.get();
1659 }
1660 }
1661
1662 // find unused names for all styles with conflicting names
1663 for( XclImpStyle* pStyle : aConflictNameStyles )
1664 {
1665 OUString aUnusedName;
1666 sal_Int32 nIndex = 0;
1667 do
1668 {
1669 aUnusedName = pStyle->GetName() + " " + OUString::number( ++nIndex );
1670 }
1671 while( aCellStyles.count( aUnusedName ) > 0 );
1672 aCellStyles[ aUnusedName ] = pStyle;
1673 }
1674
1675 // set final names and create user-defined and modified built-in cell styles
1676 for( auto& [rStyleName, rpStyle] : aCellStyles )
1677 if( rpStyle )
1678 rpStyle->CreateUserStyle( rStyleName );
1679}
1680
1682{
1683 XclImpStyleMap::iterator aIt = maStylesByXf.find( nXFIndex );
1684 return (aIt == maStylesByXf.end()) ? nullptr : aIt->second->CreateStyleSheet();
1685}
1686
1687// Buffer for XF indexes in cells =============================================
1688
1689bool XclImpXFRange::Expand( SCROW nScRow, const XclImpXFIndex& rXFIndex )
1690{
1691 if( maXFIndex != rXFIndex )
1692 return false;
1693
1694 if( mnScRow2 + 1 == nScRow )
1695 {
1696 ++mnScRow2;
1697 return true;
1698 }
1699 if( mnScRow1 > 0 && (mnScRow1 - 1 == nScRow) )
1700 {
1701 --mnScRow1;
1702 return true;
1703 }
1704
1705 return false;
1706}
1707
1708bool XclImpXFRange::Expand( const XclImpXFRange& rNextRange )
1709{
1710 OSL_ENSURE( mnScRow2 < rNextRange.mnScRow1, "XclImpXFRange::Expand - rows out of order" );
1711 if( (maXFIndex == rNextRange.maXFIndex) && (mnScRow2 + 1 == rNextRange.mnScRow1) )
1712 {
1713 mnScRow2 = rNextRange.mnScRow2;
1714 return true;
1715 }
1716 return false;
1717}
1718
1720{
1721 // List should be empty when inserting the default column format.
1722 // Later explicit SetXF() calls will break up this range.
1723 OSL_ENSURE( maIndexList.empty(), "XclImpXFRangeColumn::SetDefaultXF - Setting Default Column XF is not empty" );
1724
1725 // insert a complete row range with one insert.
1726 maIndexList.push_back( std::make_unique<XclImpXFRange>( 0, rRoot.GetDoc().MaxRow(), rXFIndex ) );
1727}
1728
1729void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex )
1730{
1731 XclImpXFRange* pPrevRange;
1732 XclImpXFRange* pNextRange;
1733 sal_uLong nNextIndex;
1734
1735 Find( pPrevRange, pNextRange, nNextIndex, nScRow );
1736
1737 // previous range:
1738 // try to overwrite XF (if row is contained in) or try to expand range
1739 if( pPrevRange )
1740 {
1741 if( pPrevRange->Contains( nScRow ) ) // overwrite old XF
1742 {
1743 if( rXFIndex == pPrevRange->maXFIndex )
1744 return;
1745
1746 SCROW nFirstScRow = pPrevRange->mnScRow1;
1747 SCROW nLastScRow = pPrevRange->mnScRow2;
1748 sal_uLong nIndex = nNextIndex - 1;
1749 XclImpXFRange* pThisRange = pPrevRange;
1750 pPrevRange = (nIndex > 0 && nIndex <= maIndexList.size()) ? maIndexList[ nIndex - 1 ].get() : nullptr;
1751
1752 if( nFirstScRow == nLastScRow ) // replace solely XF
1753 {
1754 pThisRange->maXFIndex = rXFIndex;
1755 TryConcatPrev( nNextIndex ); // try to concat. next with this
1756 TryConcatPrev( nIndex ); // try to concat. this with previous
1757 }
1758 else if( nFirstScRow == nScRow ) // replace first XF
1759 {
1760 ++(pThisRange->mnScRow1);
1761 // try to concatenate with previous of this
1762 if( !pPrevRange || !pPrevRange->Expand( nScRow, rXFIndex ) )
1763 Insert( new XclImpXFRange( nScRow, rXFIndex ), nIndex );
1764 }
1765 else if( nLastScRow == nScRow ) // replace last XF
1766 {
1767 --(pThisRange->mnScRow2);
1768 if( !pNextRange || !pNextRange->Expand( nScRow, rXFIndex ) )
1769 Insert( new XclImpXFRange( nScRow, rXFIndex ), nNextIndex );
1770 }
1771 else // insert in the middle of the range
1772 {
1773 pThisRange->mnScRow1 = nScRow + 1;
1774 // List::Insert() moves entries towards end of list, so insert twice at nIndex
1775 Insert( new XclImpXFRange( nScRow, rXFIndex ), nIndex );
1776 Insert( new XclImpXFRange( nFirstScRow, nScRow - 1, pThisRange->maXFIndex ), nIndex );
1777 }
1778 return;
1779 }
1780 else if( pPrevRange->Expand( nScRow, rXFIndex ) ) // try to expand
1781 {
1782 TryConcatPrev( nNextIndex ); // try to concatenate next with expanded
1783 return;
1784 }
1785 }
1786
1787 // try to expand next range
1788 if( pNextRange && pNextRange->Expand( nScRow, rXFIndex ) )
1789 return;
1790
1791 // create new range
1792 Insert( new XclImpXFRange( nScRow, rXFIndex ), nNextIndex );
1793}
1794
1796{
1797 maIndexList.insert( maIndexList.begin() + nIndex, std::unique_ptr<XclImpXFRange>(pXFRange) );
1798}
1799
1801 XclImpXFRange*& rpPrevRange, XclImpXFRange*& rpNextRange,
1802 sal_uLong& rnNextIndex, SCROW nScRow )
1803{
1804
1805 // test whether list is empty
1806 if( maIndexList.empty() )
1807 {
1808 rpPrevRange = rpNextRange = nullptr;
1809 rnNextIndex = 0;
1810 return;
1811 }
1812
1813 rpPrevRange = maIndexList.front().get();
1814 rpNextRange = maIndexList.back().get();
1815
1816 // test whether row is at end of list (contained in or behind last range)
1817 // rpPrevRange will contain a possible existing row
1818 if( rpNextRange->mnScRow1 <= nScRow )
1819 {
1820 rpPrevRange = rpNextRange;
1821 rpNextRange = nullptr;
1822 rnNextIndex = maIndexList.size();
1823 return;
1824 }
1825
1826 // test whether row is at beginning of list (really before first range)
1827 if( nScRow < rpPrevRange->mnScRow1 )
1828 {
1829 rpNextRange = rpPrevRange;
1830 rpPrevRange = nullptr;
1831 rnNextIndex = 0;
1832 return;
1833 }
1834
1835 // loop: find range entries before and after new row
1836 // break the loop if there is no more range between first and last -or-
1837 // if rpPrevRange contains nScRow (rpNextRange will never contain nScRow)
1838 sal_uLong nPrevIndex = 0;
1839 sal_uLong nMidIndex;
1840 rnNextIndex = maIndexList.size() - 1;
1841 XclImpXFRange* pMidRange;
1842 while( ((rnNextIndex - nPrevIndex) > 1) && (rpPrevRange->mnScRow2 < nScRow) )
1843 {
1844 nMidIndex = (nPrevIndex + rnNextIndex) / 2;
1845 pMidRange = maIndexList[nMidIndex].get();
1846 OSL_ENSURE( pMidRange, "XclImpXFRangeColumn::Find - missing XF index range" );
1847 if( nScRow < pMidRange->mnScRow1 ) // row is really before pMidRange
1848 {
1849 rpNextRange = pMidRange;
1850 rnNextIndex = nMidIndex;
1851 }
1852 else // row is in or after pMidRange
1853 {
1854 rpPrevRange = pMidRange;
1855 nPrevIndex = nMidIndex;
1856 }
1857 }
1858
1859 // find next rpNextRange if rpPrevRange contains nScRow
1860 if( nScRow <= rpPrevRange->mnScRow2 )
1861 {
1862 rnNextIndex = nPrevIndex + 1;
1863 rpNextRange = maIndexList[rnNextIndex].get();
1864 }
1865}
1866
1868{
1869 if( !nIndex || nIndex >= maIndexList.size() )
1870 return;
1871
1872 XclImpXFRange& prevRange = *maIndexList[ nIndex - 1 ];
1873 XclImpXFRange& nextRange = *maIndexList[ nIndex ];
1874
1875 if( prevRange.Expand( nextRange ) )
1876 maIndexList.erase( maIndexList.begin() + nIndex );
1877}
1878
1880 XclImpRoot( rRoot )
1881{
1882}
1883
1885{
1886}
1887
1889{
1890 maColumns.clear();
1891 maHyperlinks.clear();
1893}
1894
1895void XclImpXFRangeBuffer::SetXF( const ScAddress& rScPos, sal_uInt16 nXFIndex, XclImpXFInsertMode eMode )
1896{
1897 SCCOL nScCol = rScPos.Col();
1898 SCROW nScRow = rScPos.Row();
1899
1900 // set cell XF's
1901 size_t nIndex = static_cast< size_t >( nScCol );
1902 if( maColumns.size() <= nIndex )
1903 maColumns.resize( nIndex + 1 );
1904 if( !maColumns[ nIndex ] )
1905 maColumns[ nIndex ] = std::make_shared<XclImpXFRangeColumn>();
1906 // remember all Boolean cells, they will get 'Standard' number format
1907 maColumns[ nIndex ]->SetXF( nScRow, XclImpXFIndex( nXFIndex, eMode == xlXFModeBoolCell ) );
1908
1909 // set "center across selection" and "fill" attribute for all following empty cells
1910 // ignore it on row default XFs
1911 if( eMode == xlXFModeRow )
1912 return;
1913
1914 const XclImpXF* pXF = GetXFBuffer().GetXF( nXFIndex );
1915 if( pXF && ((pXF->GetHorAlign() == EXC_XF_HOR_CENTER_AS) || (pXF->GetHorAlign() == EXC_XF_HOR_FILL)) )
1916 {
1917 // expand last merged range if this attribute is set repeatedly
1918 ScRange* pRange = maMergeList.empty() ? nullptr : &maMergeList.back();
1919 if (pRange && (pRange->aEnd.Row() == nScRow) && (pRange->aEnd.Col() + 1 == nScCol) && (eMode == xlXFModeBlank))
1920 pRange->aEnd.IncCol();
1921 else if( eMode != xlXFModeBlank ) // do not merge empty cells
1922 maMergeList.push_back( ScRange( nScCol, nScRow, 0 ) );
1923 }
1924}
1925
1926void XclImpXFRangeBuffer::SetXF( const ScAddress& rScPos, sal_uInt16 nXFIndex )
1927{
1928 SetXF( rScPos, nXFIndex, xlXFModeCell );
1929}
1930
1931void XclImpXFRangeBuffer::SetBlankXF( const ScAddress& rScPos, sal_uInt16 nXFIndex )
1932{
1933 SetXF( rScPos, nXFIndex, xlXFModeBlank );
1934}
1935
1936void XclImpXFRangeBuffer::SetBoolXF( const ScAddress& rScPos, sal_uInt16 nXFIndex )
1937{
1938 SetXF( rScPos, nXFIndex, xlXFModeBoolCell );
1939}
1940
1941void XclImpXFRangeBuffer::SetRowDefXF( SCROW nScRow, sal_uInt16 nXFIndex )
1942{
1943 for( SCCOL nScCol = 0; nScCol <= GetDoc().MaxCol(); ++nScCol )
1944 SetXF( ScAddress( nScCol, nScRow, 0 ), nXFIndex, xlXFModeRow );
1945}
1946
1947void XclImpXFRangeBuffer::SetColumnDefXF( SCCOL nScCol, sal_uInt16 nXFIndex )
1948{
1949 // our array should not have values when creating the default column format.
1950 size_t nIndex = static_cast< size_t >( nScCol );
1951 if( maColumns.size() <= nIndex )
1952 maColumns.resize( nIndex + 1 );
1953 OSL_ENSURE( !maColumns[ nIndex ], "XclImpXFRangeBuffer::SetColumnDefXF - default column of XFs already has values" );
1954 maColumns[ nIndex ] = std::make_shared<XclImpXFRangeColumn>();
1955 maColumns[ nIndex ]->SetDefaultXF( XclImpXFIndex( nXFIndex ), GetRoot());
1956}
1957
1959{
1960 SCCOL nFromScCol = (nLine == SvxBoxItemLine::RIGHT) ? rRange.aEnd.Col() : rRange.aStart.Col();
1961 SCROW nFromScRow = (nLine == SvxBoxItemLine::BOTTOM) ? rRange.aEnd.Row() : rRange.aStart.Row();
1962 ScDocument& rDoc = GetDoc();
1963
1964 const SvxBoxItem* pFromItem =
1965 rDoc.GetAttr( nFromScCol, nFromScRow, nScTab, ATTR_BORDER );
1966 const SvxBoxItem* pToItem =
1967 rDoc.GetAttr( rRange.aStart.Col(), rRange.aStart.Row(), nScTab, ATTR_BORDER );
1968
1969 SvxBoxItem aNewItem( *pToItem );
1970 aNewItem.SetLine( pFromItem->GetLine( nLine ), nLine );
1971 rDoc.ApplyAttr( rRange.aStart.Col(), rRange.aStart.Row(), nScTab, aNewItem );
1972}
1973
1974void XclImpXFRangeBuffer::SetHyperlink( const XclRange& rXclRange, const OUString& rUrl )
1975{
1976 maHyperlinks.emplace_back( rXclRange, rUrl );
1977}
1978
1979void XclImpXFRangeBuffer::SetMerge( SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2 )
1980{
1981 if( (nScCol1 < nScCol2) || (nScRow1 < nScRow2) )
1982 maMergeList.push_back( ScRange( nScCol1, nScRow1, 0, nScCol2, nScRow2, 0 ) );
1983}
1984
1986{
1987 ScDocumentImport& rDocImport = GetDocImport();
1988 ScDocument& rDoc = rDocImport.getDoc();
1989 SCTAB nScTab = GetCurrScTab();
1990
1991 // apply patterns
1992 XclImpXFBuffer& rXFBuffer = GetXFBuffer();
1993 ScDocumentImport::Attrs aPendingAttrParam;
1994 SCCOL pendingColStart = -1;
1995 SCCOL pendingColEnd = -1;
1996 SCCOL nScCol = 0;
1997 for( const auto& rxColumn : maColumns )
1998 {
1999 // apply all cell styles of an existing column
2000 if( rxColumn )
2001 {
2002 XclImpXFRangeColumn& rColumn = *rxColumn;
2003 std::vector<ScAttrEntry> aAttrs;
2004 aAttrs.reserve(rColumn.end() - rColumn.begin());
2005
2006 for (const auto& rxStyle : rColumn)
2007 {
2008 XclImpXFRange& rStyle = *rxStyle;
2009 const XclImpXFIndex& rXFIndex = rStyle.maXFIndex;
2010 XclImpXF* pXF = rXFBuffer.GetXF( rXFIndex.GetXFIndex() );
2011 if (!pXF)
2012 continue;
2013
2014 sal_uInt32 nForceScNumFmt = rXFIndex.IsBoolCell() ?
2016
2017 pXF->ApplyPatternToAttrVector(aAttrs, rStyle.mnScRow1, rStyle.mnScRow2, nForceScNumFmt);
2018 }
2019
2020 if (aAttrs.empty() || aAttrs.back().nEndRow != rDoc.MaxRow())
2021 {
2022 ScAttrEntry aEntry;
2023 aEntry.nEndRow = rDoc.MaxRow();
2024 aEntry.pPattern = rDoc.GetDefPattern();
2025 aAttrs.push_back(aEntry);
2026 }
2027
2028 aAttrs.shrink_to_fit();
2029 assert(aAttrs.size() > 0);
2030 ScDocumentImport::Attrs aAttrParam;
2031 aAttrParam.mvData.swap(aAttrs);
2032 aAttrParam.mbLatinNumFmtOnly = false; // when unsure, set it to false.
2033
2034 // Compress setting the attributes, set the same set in one call.
2035 if( pendingColStart != -1 && pendingColEnd == nScCol - 1 && aAttrParam == aPendingAttrParam )
2036 ++pendingColEnd;
2037 else
2038 {
2039 if( pendingColStart != -1 )
2040 rDocImport.setAttrEntries(nScTab, pendingColStart, pendingColEnd, std::move(aPendingAttrParam));
2041 pendingColStart = pendingColEnd = nScCol;
2042 aPendingAttrParam = std::move( aAttrParam );
2043 }
2044 }
2045 ++nScCol;
2046 }
2047 if( pendingColStart != -1 )
2048 rDocImport.setAttrEntries(nScTab, pendingColStart, pendingColEnd, std::move(aPendingAttrParam));
2049
2050 // insert hyperlink cells
2051 for( const auto& [rXclRange, rUrl] : maHyperlinks )
2052 XclImpHyperlink::InsertUrl( GetRoot(), rXclRange, rUrl );
2053
2054 // apply cell merging
2055 for ( size_t i = 0, nRange = maMergeList.size(); i < nRange; ++i )
2056 {
2057 const ScRange & rRange = maMergeList[ i ];
2058 const ScAddress& rStart = rRange.aStart;
2059 const ScAddress& rEnd = rRange.aEnd;
2060 bool bMultiCol = rStart.Col() != rEnd.Col();
2061 bool bMultiRow = rStart.Row() != rEnd.Row();
2062 // set correct right border
2063 if( bMultiCol )
2064 SetBorderLine( rRange, nScTab, SvxBoxItemLine::RIGHT );
2065 // set correct lower border
2066 if( bMultiRow )
2067 SetBorderLine( rRange, nScTab, SvxBoxItemLine::BOTTOM );
2068 // do merge
2069 if( bMultiCol || bMultiRow )
2070 rDoc.DoMerge( rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row(), nScTab );
2071 // #i93609# merged range in a single row: test if manual row height is needed
2072 if( !bMultiRow )
2073 {
2074 bool bTextWrap = rDoc.GetAttr( rStart, ATTR_LINEBREAK )->GetValue();
2075 if( !bTextWrap && (rDoc.GetCellType( rStart ) == CELLTYPE_EDIT) )
2076 if (const EditTextObject* pEditObj = rDoc.GetEditText(rStart))
2077 bTextWrap = pEditObj->GetParagraphCount() > 1;
2078 if( bTextWrap )
2080 }
2081 }
2082}
2083
2084/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
basegfx::BColor maColor
struct _ADOIndex Index
constexpr auto convertTwipToMm100(N n)
SvxBorderLineStyle
SvxBoxItemLine
void SetFont(const vcl::Font &rNewFont)
bool GetFontCharMap(FontCharMapRef &rxFontCharMap) const
SCTAB Tab() const
Definition: address.hxx:283
void IncCol(SCCOL nDelta=1)
Definition: address.hxx:316
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
Accessor class to ScDocument.
ScDocument & getDoc()
void setAttrEntries(SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, Attrs &&rAttrs)
Set an array of cell attributes to specified range of columns.
SC_DLLPUBLIC ScPatternAttr * GetDefPattern() const
Definition: document.cxx:6164
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:891
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6169
SC_DLLPUBLIC void ApplyPatternAreaTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, const ScPatternAttr &rAttr)
Definition: document.cxx:4863
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:892
SC_DLLPUBLIC void DoMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bDeleteCaptions=true)
Definition: documen3.cxx:2079
SC_DLLPUBLIC void ApplyAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, const SfxPoolItem &rAttr)
Definition: document.cxx:4834
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6174
SC_DLLPUBLIC const EditTextObject * GetEditText(const ScAddress &rPos) const
Definition: document.cxx:3654
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3789
SC_DLLPUBLIC void ApplyStyleAreaTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, const ScStyleSheet &rStyle)
Definition: document.cxx:4928
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4777
static SC_DLLPUBLIC void AddLanguage(SfxItemSet &rSet, const SvNumberFormatter &rFormatter)
Adds a language item to the item set, if the number format item contains a language that differs from...
Definition: global.cxx:1001
const OUString * GetStyleName() const
Definition: patattr.cxx:1207
void SetStyleSheet(ScStyleSheet *pNewStyle, bool bClearDirectFormat=true)
Definition: patattr.cxx:1212
SfxItemSet & GetItemSet()
Definition: patattr.hxx:155
void RemoveAll()
Definition: rangelst.cxx:1101
bool empty() const
Definition: rangelst.hxx:88
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1137
size_t size() const
Definition: rangelst.hxx:89
ScRange & back()
Definition: rangelst.hxx:94
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All) override
Definition: stlpool.cxx:72
virtual SC_DLLPUBLIC SfxItemSet & GetItemSet() override
Definition: stlsheet.cxx:128
A wrapper for a UNO property set.
Definition: fapihelper.hxx:104
static rtl_TextEncoding GetSystemTextEncoding()
Returns system text encoding for byte string conversion.
Definition: ftools.cxx:116
static void PutItem(SfxItemSet &rItemSet, const SfxPoolItem &rItem, sal_uInt16 nWhichId, bool bSkipPoolDef)
Puts the item into the passed item set.
Definition: ftools.cxx:214
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
css::uno::Reference< css::frame::XModel3 > GetModel() const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All) const
virtual SfxStyleSheetBase * Next()
virtual SfxStyleSheetBase * First()
bool PutandConvertEntry(OUString &rString, sal_Int32 &nCheckPos, SvNumFormatType &nType, sal_uInt32 &nKey, LanguageType eLnge, LanguageType eNewLnge, bool bConvertDateOrder, bool bReplaceBooleanEquivalent=true)
sal_uInt32 GetFormatIndex(NfIndexTableOffset, LanguageType eLnge=LANGUAGE_DONTKNOW)
const editeng::SvxBorderLine * GetLine(SvxBoxItemLine nLine) const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
void SetColor(const Color &rCol)
void SetLine(const editeng::SvxBorderLine *pNew)
Stores all default colors for a specific BIFF version.
Definition: xlstyle.hxx:251
Color GetDefColor(sal_uInt16 nXclIndex) const
Returns the default color for a (non-zero-based) Excel color or COL_AUTO on error.
Definition: xlstyle.cxx:142
void WriteFontProperties(ScfPropertySet &rPropSet, XclFontPropSetType eType, const XclFontData &rFontData, bool bHasWstrn, bool bHasAsian, bool bHasCmplx, const Color *pFontColor)
Writes all font properties to the passed property set, uses passed color as font color.
Definition: xlstyle.cxx:693
void SetManualRowHeight(SCROW nScRow)
Definition: colrowst.cxx:153
XclImpFontBuffer(const XclImpFontBuffer &)=delete
delete copy constructor
XclImpFont maFont4
Application font (for column width).
Definition: xistyle.hxx:197
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:547
void WriteDefaultCtrlFontProperties(ScfPropertySet &rPropSet) const
Writes default font properties for form controls to the passed property set.
Definition: xistyle.cxx:611
const XclImpFont * GetFont(sal_uInt16 nFontIndex) const
Returns the object that stores all contents of a FONT record.
Definition: xistyle.cxx:559
void UpdateAppFont(const XclFontData &rFontData, bool bHasCharSet)
Updates the application default font.
Definition: xistyle.cxx:616
void ReadFont(XclImpStream &rStrm)
Reads a FONT record.
Definition: xistyle.cxx:578
void FillToItemSet(SfxItemSet &rItemSet, XclFontItemType eType, sal_uInt16 nFontIdx, bool bSkipPoolDefs=false) const
Fills all font properties from a FONT record to the item set.
Definition: xistyle.cxx:596
XclImpFont maCtrlFont
Built-in font with index 4.
Definition: xistyle.hxx:198
XclFontData maAppFont
List of all FONT records in the Excel file.
Definition: xistyle.hxx:196
std::vector< XclImpFont > maFontList
Definition: xistyle.hxx:195
void ReadEfont(XclImpStream &rStrm)
Reads an EFONT record (BIFF2 font color).
Definition: xistyle.cxx:590
void WriteFontProperties(ScfPropertySet &rPropSet, XclFontPropSetType eType, sal_uInt16 nFontIdx, const Color *pFontColor=nullptr) const
Writes all font properties to the passed property set.
Definition: xistyle.cxx:604
Stores all data of an Excel font and provides import of FONT records.
Definition: xistyle.hxx:71
void SetFontData(const XclFontData &rFontData, bool bHasCharSet)
Sets the passed font data and all used flags to 'used'.
Definition: xistyle.cxx:215
XclImpFont(const XclImpRoot &rRoot)
Definition: xistyle.cxx:193
const XclFontData & GetFontData() const
Returns read-only access to font data.
Definition: xistyle.hxx:86
bool HasAsianChars() const
Returns true, if this font contains characters for Asian scripts (CJK).
Definition: xistyle.hxx:95
bool mbHasCmplx
true = Font contains Asian script characters.
Definition: xistyle.hxx:138
void ReadFont(XclImpStream &rStrm)
Reads a FONT record for all BIFF versions.
Definition: xistyle.cxx:248
bool mbWeightUsed
true = Color used.
Definition: xistyle.hxx:142
rtl_TextEncoding GetFontEncoding() const
Returns the text encoding for strings used with this font.
Definition: xistyle.cxx:240
bool mbUnderlUsed
true = Escapement type used.
Definition: xistyle.hxx:144
void GuessScriptType()
Tests whether the font contains CJK or CTL characters.
Definition: xistyle.cxx:471
bool mbEscapemUsed
true = Weight used.
Definition: xistyle.hxx:143
bool mbItalicUsed
true = Underline style used.
Definition: xistyle.hxx:145
void ReadFontColor(XclImpStream &rStrm)
Reads and sets the font color.
Definition: xistyle.cxx:456
bool mbHasCharSet
All font attributes.
Definition: xistyle.hxx:135
bool mbHeightUsed
true = Font name, family, charset used.
Definition: xistyle.hxx:140
void ReadFontData5(XclImpStream &rStrm)
Reads and sets height, flags, color, boldness, script, family and charset.
Definition: xistyle.cxx:435
void ReadCFFontBlock(XclImpStream &rStrm)
Reads the font block from a CF (conditional format) record.
Definition: xistyle.cxx:283
bool mbHasWstrn
true = Font contains own character set info.
Definition: xistyle.hxx:136
void SetAllUsedFlags(bool bUsed)
Sets all font attributes to used or unused.
Definition: xistyle.cxx:209
void ReadFontData2(XclImpStream &rStrm)
Reads and sets height and flags.
Definition: xistyle.cxx:420
void ReadFontName8(XclImpStream &rStrm)
Reads and sets a Unicode string as font name.
Definition: xistyle.cxx:466
void WriteFontProperties(ScfPropertySet &rPropSet, XclFontPropSetType eType, const Color *pFontColor=nullptr) const
Writes all font properties to the passed property set.
Definition: xistyle.cxx:413
bool mbOutlineUsed
true = Strikeout used.
Definition: xistyle.hxx:147
bool HasCharSet() const
Returns true, if the font character set is valid.
Definition: xistyle.hxx:88
void ReadEfont(XclImpStream &rStrm)
Reads an EFONT record (BIFF2 font color).
Definition: xistyle.cxx:278
bool mbHasAsian
true = Font contains Western script characters.
Definition: xistyle.hxx:137
XclFontData maData
Definition: xistyle.hxx:134
bool mbColorUsed
true = Font height used.
Definition: xistyle.hxx:141
bool mbStrikeUsed
true = Italic used.
Definition: xistyle.hxx:146
bool mbFontNameUsed
true = Font contains Complex script characters.
Definition: xistyle.hxx:139
void FillToItemSet(SfxItemSet &rItemSet, XclFontItemType eType, bool bSkipPoolDefs=false) const
Fills all font properties to the item set.
Definition: xistyle.cxx:317
bool mbShadowUsed
true = Outlined used.
Definition: xistyle.hxx:148
void ReadFontName2(XclImpStream &rStrm)
Reads and sets a byte string as font name.
Definition: xistyle.cxx:461
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:637
void FillScFmtToItemSet(SfxItemSet &rItemSet, sal_uInt32 nScNumFmt, bool bSkipPoolDefs=false) const
Fills a Calc number format to the passed item set.
Definition: xistyle.cxx:739
sal_uInt16 mnNextXclIdx
Maps Excel format indexes to Calc formats.
Definition: xistyle.hxx:243
sal_uInt16 ReadCFFormat(XclImpStream &rStrm, bool bIFmt)
Read NumFmt from conditional format record.
Definition: xistyle.cxx:681
XclImpNumFmtBuffer(const XclImpRoot &rRoot)
Definition: xistyle.cxx:630
void FillToItemSet(SfxItemSet &rItemSet, sal_uInt16 nXclNumFmt, bool bSkipPoolDefs=false) const
Fills an Excel number format to the passed item set.
Definition: xistyle.cxx:731
void CreateScFormats()
Creates the number formats in the Calc document.
Definition: xistyle.cxx:700
void ReadFormat(XclImpStream &rStrm)
Reads a FORMAT record.
Definition: xistyle.cxx:644
sal_uInt32 GetScFormat(sal_uInt16 nXclNumFmt) const
Returns the format key with the passed Excel index or NUMBERFORMAT_ENTRY_NOT_FOUND on error.
Definition: xistyle.cxx:725
XclImpIndexMap maIndexMap
Definition: xistyle.hxx:242
Stores the default colors for the current BIFF version and the contents of a PALETTE record.
Definition: xistyle.hxx:45
XclImpPalette(const XclImpRoot &rRoot)
Definition: xistyle.cxx:147
void ExportPalette()
Definition: xistyle.cxx:124
void ReadPalette(XclImpStream &rStrm)
Reads a PALETTE record.
Definition: xistyle.cxx:168
const XclImpRoot & mrRoot
Colors read from file.
Definition: xistyle.hxx:64
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:152
Color GetColor(sal_uInt16 nXclIndex) const
Returns the color for a (non-zero-based) Excel palette entry.
Definition: xistyle.cxx:157
ColorVec maColorTable
Definition: xistyle.hxx:63
::std::vector< Color > ColorVec
Definition: xistyle.hxx:62
Access to global data from other classes.
Definition: xiroot.hxx:129
XclImpXFBuffer & GetXFBuffer() const
Returns the cell formatting attributes buffer.
Definition: xiroot.cxx:160
ScDocumentImport & GetDocImport()
Definition: xiroot.cxx:294
XclImpFontBuffer & GetFontBuffer() const
Returns the font buffer.
Definition: xiroot.cxx:150
XclImpPalette & GetPalette() const
Returns the color buffer.
Definition: xiroot.cxx:145
const XclImpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xiroot.hxx:134
XclImpNumFmtBuffer & GetNumFmtBuffer() const
Returns the number format buffer.
Definition: xiroot.cxx:155
This class is used to import record oriented streams.
Definition: xistream.hxx:278
Contains all data of a cell style associated with an XF record.
Definition: xistyle.hxx:443
XclImpStyle(const XclImpRoot &rRoot)
Definition: xistyle.cxx:1466
ScStyleSheet * mpStyleSheet
Final name used in the Calc document.
Definition: xistyle.hxx:472
void ReadStyle(XclImpStream &rStrm)
Reads a STYLE record.
Definition: xistyle.cxx:1478
OUString maFinalName
True = style not visible in GUI.
Definition: xistyle.hxx:471
sal_uInt16 mnXfId
Cell style name.
Definition: xistyle.hxx:464
sal_uInt16 GetXfId() const
Definition: xistyle.hxx:451
bool IsBuiltin() const
Definition: xistyle.hxx:452
bool mbHidden
True = customized builtin style.
Definition: xistyle.hxx:469
bool mbBuiltin
Level for builtin column/row styles.
Definition: xistyle.hxx:467
sal_uInt8 mnLevel
Identifier for builtin styles.
Definition: xistyle.hxx:466
ScStyleSheet * CreateStyleSheet()
Creates a cell style sheet and inserts it into the Calc document.
Definition: xistyle.cxx:1514
sal_uInt8 mnBuiltinId
Formatting for this cell style.
Definition: xistyle.hxx:465
void CreateUserStyle(const OUString &rFinalName)
Creates the Calc style sheet, if this is a user-defined style.
Definition: xistyle.cxx:1553
OUString maName
Definition: xistyle.hxx:463
bool mbCustom
True = builtin style.
Definition: xistyle.hxx:468
Contains all XF records occurred in the file.
Definition: xistyle.hxx:478
sal_uInt16 GetFontIndex(sal_uInt16 nXFIndex) const
Returns the index to the Excel font used in the specified XF record.
Definition: xistyle.cxx:1591
XclImpXFBuffer(const XclImpXFBuffer &)=delete
make noncopyable
XclImpStyleList maBuiltinStyles
List of contents of all XF record.
Definition: xistyle.hxx:517
void ReadStyle(XclImpStream &rStrm)
Reads a STYLE record.
Definition: xistyle.cxx:1580
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:1565
XclImpXF * GetXF(sal_uInt16 nXFIndex)
Returns the object that stores all contents of an XF record.
Definition: xistyle.hxx:495
const XclImpFont * GetFont(sal_uInt16 nXFIndex) const
Returns the Excel font used in the specified XF record.
Definition: xistyle.cxx:1597
void CreateUserStyles()
Creates all user defined style sheets.
Definition: xistyle.cxx:1613
XclImpStyleMap maStylesByXf
List of user defined cell styles.
Definition: xistyle.hxx:519
std::vector< std::unique_ptr< XclImpStyle > > XclImpStyleList
Definition: xistyle.hxx:513
XclImpStyleList maUserStyles
List of built-in cell styles.
Definition: xistyle.hxx:518
void ReadXF(XclImpStream &rStrm)
Reads an XF record.
Definition: xistyle.cxx:1573
ScStyleSheet * CreateStyleSheet(sal_uInt16 nXFIndex)
Creates a cell style sheet of the passed XF and inserts it into the Calc document.
Definition: xistyle.cxx:1681
std::vector< std::unique_ptr< XclImpXF > > maXFList
Definition: xistyle.hxx:516
Represents an XF record index with additional information.
Definition: xistyle.hxx:357
bool IsBoolCell() const
Definition: xistyle.hxx:363
sal_uInt16 GetXFIndex() const
Definition: xistyle.hxx:362
void SetBoolXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index for boolean cells.
Definition: xistyle.cxx:1936
XclImpXFRangeBuffer(const XclImpXFRangeBuffer &)=delete
make noncopyable
void SetColumnDefXF(SCCOL nScCol, sal_uInt16 nXFIndex)
Inserts a new XF index for all cells in a column.
Definition: xistyle.cxx:1947
virtual ~XclImpXFRangeBuffer() override
Definition: xistyle.cxx:1884
void SetHyperlink(const XclRange &rXclRange, const OUString &rUrl)
Inserts a range of hyperlink cells.
Definition: xistyle.cxx:1974
std::vector< std::pair< XclRange, OUString > > maHyperlinks
Array of column XF index buffers.
Definition: xistyle.hxx:665
void SetBlankXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index for blank cells.
Definition: xistyle.cxx:1931
void Finalize()
Applies styles and cell merging to the current sheet in the document.
Definition: xistyle.cxx:1985
void SetXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index.
Definition: xistyle.cxx:1926
XclImpXFInsertMode
Insertion mode of an XF index.
Definition: xistyle.hxx:642
@ xlXFModeBlank
Cell with a single Boolean value.
Definition: xistyle.hxx:645
@ xlXFModeRow
Blank cell.
Definition: xistyle.hxx:646
@ xlXFModeBoolCell
Filled cell.
Definition: xistyle.hxx:644
void SetRowDefXF(SCROW nScRow, sal_uInt16 nXFIndex)
Inserts a new XF index for all cells in a row.
Definition: xistyle.cxx:1941
ScRangeList maMergeList
Maps URLs to hyperlink cells.
Definition: xistyle.hxx:666
std::vector< std::shared_ptr< XclImpXFRangeColumn > > maColumns
Definition: xistyle.hxx:663
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:1888
void SetMerge(SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2)
Inserts a complete merged cell range.
Definition: xistyle.cxx:1979
void SetBorderLine(const ScRange &rRange, SCTAB nScTab, SvxBoxItemLine nLine)
Copies border of the last cell of the range to the first cell to keep it visible when the range is me...
Definition: xistyle.cxx:1958
Contains the XF indexes for every used cell in a column.
Definition: xistyle.hxx:565
IndexList::iterator end()
Definition: xistyle.hxx:576
void SetXF(SCROW nScRow, const XclImpXFIndex &rXFIndex)
Inserts a new (encoded) XF index (first try to expand the last range).
Definition: xistyle.cxx:1729
void Insert(XclImpXFRange *pXFRange, sal_uLong nIndex)
Insert a range into the list at the specified index.
Definition: xistyle.cxx:1795
void Find(XclImpXFRange *&rpPrevRange, XclImpXFRange *&rpNextRange, sal_uLong &rnNextIndex, SCROW nScRow)
Finds the previous and next row range from row position nScRow.
Definition: xistyle.cxx:1800
void TryConcatPrev(sal_uLong nIndex)
Tries to concatenate a range with its predecessor.
Definition: xistyle.cxx:1867
void SetDefaultXF(const XclImpXFIndex &rXFIndex, const XclImpRoot &rRoot)
Inserts a single row range into the list.
Definition: xistyle.cxx:1719
IndexList maIndexList
Definition: xistyle.hxx:602
IndexList::iterator begin()
Definition: xistyle.hxx:575
Contains an (encoded) XF index for a range of rows in a single column.
Definition: xistyle.hxx:526
bool Contains(SCROW nScRow) const
Returns true, if nScRow is contained in own row range.
Definition: xistyle.hxx:558
bool Expand(SCROW nScRow, const XclImpXFIndex &rXFIndex)
Returns true, if the range has been expanded.
Definition: xistyle.cxx:1689
XclImpXFIndex maXFIndex
The last row of an equal-formatted range.
Definition: xistyle.hxx:530
SCROW mnScRow1
Definition: xistyle.hxx:528
SCROW mnScRow2
The first row of an equal-formatted range.
Definition: xistyle.hxx:529
Contains all data of a XF record and a Calc item set.
Definition: xistyle.hxx:378
const ScPatternAttr & CreatePattern(bool bSkipPoolDefs=false)
Creates a Calc item set containing an item set with all cell properties.
Definition: xistyle.cxx:1245
XclImpCellBorder maBorder
All alignment attributes.
Definition: xistyle.hxx:435
XclImpCellProt maProtection
Calc cell style sheet.
Definition: xistyle.hxx:433
sal_uInt16 mnXclFont
Index to number format.
Definition: xistyle.hxx:438
ScStyleSheet * mpStyleSheet
Calc item set.
Definition: xistyle.hxx:431
virtual ~XclImpXF() override
Definition: xistyle.cxx:1108
XclImpCellArea maArea
Border line style.
Definition: xistyle.hxx:436
ScPatternAttrPtr mpPattern
Definition: xistyle.hxx:430
void ReadXF8(XclImpStream &rStrm)
Definition: xistyle.cxx:1207
void ReadXF3(XclImpStream &rStrm)
Definition: xistyle.cxx:1132
void SetUsedFlags(sal_uInt8 nUsedFlags)
Sets all "attribute used" flags according to the passed mask.
Definition: xistyle.cxx:1449
sal_uInt8 GetHorAlign() const
Definition: xistyle.hxx:390
void ReadXF2(XclImpStream &rStrm)
Definition: xistyle.cxx:1112
sal_uInt16 GetFontIndex() const
Definition: xistyle.hxx:391
void ReadXF(XclImpStream &rStrm)
Reads an XF record.
Definition: xistyle.cxx:1232
void ApplyPatternToAttrVector(::std::vector< ScAttrEntry > &rAttrs, SCROW nRow1, SCROW nRow2, sal_uInt32 nForceScNumFmt)
Definition: xistyle.cxx:1339
void ReadXF5(XclImpStream &rStrm)
Definition: xistyle.cxx:1184
XclImpCellAlign maAlignment
Cell protection flags.
Definition: xistyle.hxx:434
XclImpXF(const XclImpXF &)=delete
make noncopyable
void ReadXF4(XclImpStream &rStrm)
Definition: xistyle.cxx:1158
void ApplyPattern(SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2, SCTAB nScTab)
Inserts all formatting attributes to the specified area in the Calc document.
Definition: xistyle.cxx:1411
sal_uInt16 mnXclNumFmt
Background area style.
Definition: xistyle.hxx:437
static void ApplyPatternForBiff2CellFormat(const XclImpRoot &rRoot, const ScAddress &rScPos, sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3)
Converts formatting information from BIFF2 cell record data directly.
Definition: xistyle.cxx:1427
void InsertFormat(sal_uInt16 nXclNumFmt, const OUString &rFormat)
Inserts a new number format for the specified Excel format index.
Definition: xlstyle.cxx:1470
void InitializeImport()
Clears all buffered data, used to set up for a new sheet.
Definition: xlstyle.cxx:1465
sal_uInt32 GetStdScNumFmt() const
Returns the core index of the current standard number format.
Definition: xlstyle.hxx:450
const XclNumFmtMap & GetFormatMap() const
Returns the current number format map.
Definition: xlstyle.hxx:459
SfxObjectShell * GetDocShell() const
Returns the object shell of the Calc document.
Definition: xlroot.cxx:291
rtl_TextEncoding GetTextEncoding() const
Returns the text encoding to import/export byte strings.
Definition: xlroot.hxx:147
OutputDevice * GetPrinter() const
Returns pointer to the printer of the Calc document.
Definition: xlroot.cxx:302
XclTracer & GetTracer() const
Returns the filter tracer.
Definition: xlroot.cxx:434
SvNumberFormatter & GetFormatter() const
Returns the number formatter of the Calc document.
Definition: xlroot.cxx:323
SCTAB GetCurrScTab() const
Returns the current Calc sheet index.
Definition: xlroot.hxx:162
void SetCharWidth(const XclFontData &rFontData)
Sets the width of the '0' - '9' digit character as well as the ' ' space char (using the default font...
Definition: xlroot.cxx:208
ScStyleSheetPool & GetStyleSheetPool() const
Returns the style sheet pool of the Calc document.
Definition: xlroot.cxx:307
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
Definition: xlroot.hxx:141
RootData & GetOldRoot() const
Returns old RootData struct.
Definition: xlroot.hxx:138
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:286
XclFontPropSetHelper & GetFontPropSetHelper() const
Returns the property set helper for fonts.
Definition: xlroot.cxx:419
static Color GetPatternColor(const Color &rPattColor, const Color &rBackColor, sal_uInt16 nXclPattern)
Returns the best fitting color for an Excel pattern area format.
Definition: xltools.cxx:350
static sal_uInt8 GetXclRotFromOrient(sal_uInt8 nXclOrient)
Calculates BIFF8 rotation angle from BIFF2-BIFF5 text orientation.
Definition: xltools.cxx:176
static Degree100 GetScRotation(sal_uInt16 nXclRot, Degree100 nRotForStacked)
Calculates an angle (in 1/100 of degrees) from an Excel angle value.
Definition: xltools.cxx:154
static OUString GetBuiltInStyleName(sal_uInt8 nStyleId, std::u16string_view rName, sal_uInt8 nLevel)
Returns the specified built-in cell style name.
Definition: xltools.cxx:550
void TraceFillPattern(bool bFillPattern)
Definition: xltracer.cxx:77
void TraceDates(sal_uInt16 nNumFmt)
Definition: xltracer.cxx:64
void TraceBorderLineStyle(bool bBorderLineStyle)
Definition: xltracer.cxx:71
Contains base members for XF record import/export.
Definition: xlstyle.hxx:563
bool mbBorderUsed
true = alignment used.
Definition: xlstyle.hxx:594
bool IsCellXF() const
Returns true, if this is a hard cell format.
Definition: xlstyle.hxx:579
bool mbAreaUsed
true = border data used.
Definition: xlstyle.hxx:595
bool mbProtUsed
true = cell XF, false = style XF.
Definition: xlstyle.hxx:590
bool HasUsedFlags() const
Returns true, if any "attribute used" flags are ste in this XF.
Definition: xlstyle.cxx:1732
bool mbFmtUsed
true = font index used.
Definition: xlstyle.hxx:592
sal_uInt16 mnParent
Definition: xlstyle.hxx:588
bool mbAlignUsed
true = number format used.
Definition: xlstyle.hxx:593
bool mbCellXF
Index to parent style XF.
Definition: xlstyle.hxx:589
void SetAllUsedFlags(bool bUsed)
Sets all "attribute used" flags to the passed state.
Definition: xlstyle.cxx:1727
bool mbFontUsed
true = cell protection used.
Definition: xlstyle.hxx:591
void SetWidth(tools::Long nWidth)
void SetColor(const Color &rColor)
void SetBorderLineStyle(SvxBorderLineStyle nNew)
FontItalic GetItalic()
FontWeight GetWeight()
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
sal_Int16 mnLevel
int nCount
constexpr TypedWhichId< SvxContourItem > EE_CHAR_OUTLINE(EE_CHAR_START+8)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxShadowedItem > EE_CHAR_SHADOW(EE_CHAR_START+9)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CTL(EE_CHAR_START+22)
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CJK(EE_CHAR_START+21)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CJK(EE_CHAR_START+23)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CTL(EE_CHAR_START+24)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
DocumentType eType
FontPitch
PITCH_VARIABLE
PITCH_FIXED
PITCH_DONTKNOW
FontFamily
FAMILY_SWISS
FAMILY_MODERN
FAMILY_ROMAN
ReturnType get_flagvalue(Type nBitField, Type nMask, ReturnType nSet, ReturnType nUnset)
Returns nSet, if at least one bit of nMask is set in nBitField, otherwise nUnset.
Definition: ftools.hxx:80
bool get_flag(Type nBitField, Type nMask)
Returns true, if at least one of the bits set in nMask is set in nBitField.
Definition: ftools.hxx:75
@ CELLTYPE_EDIT
Definition: global.hxx:276
sal_Int32 nIndex
Mode eMode
#define LANGUAGE_ENGLISH_US
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
tools::Long const nBorder
int i
void SvStream & rStrm
int compareToIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
vcl::Font GetFont(vcl::Font const &rFont, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
SvxRotateMode
SVX_ROTATE_MODE_BOTTOM
SVX_ROTATE_MODE_STANDARD
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
constexpr TypedWhichId< SfxBoolItem > ATTR_VERTICAL_ASIAN(137)
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< SvxJustifyMethodItem > ATTR_VER_JUSTIFY_METHOD(133)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
constexpr TypedWhichId< SvxRotateModeItem > ATTR_ROTATE_MODE(136)
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
constexpr TypedWhichId< SvxJustifyMethodItem > ATTR_HOR_JUSTIFY_METHOD(130)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
constexpr TypedWhichId< SvxFrameDirectionItem > ATTR_WRITINGDIR(138)
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
constexpr TypedWhichId< SvxMarginItem > ATTR_MARGIN(143)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
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
XclImpColRowSettings * pColRowBuff
Definition: root.hxx:50
SCROW nEndRow
Definition: attarray.hxx:83
const ScPatternAttr * pPattern
Definition: attarray.hxx:84
std::vector< ScAttrEntry > mvData
sal_uInt8 mnTextDir
Text orientation.
Definition: xlstyle.hxx:492
SvxCellHorJustify GetScHorAlign() const
Returns the Calc horizontal alignment.
Definition: xlstyle.cxx:1558
sal_uInt8 mnOrient
Vertical alignment.
Definition: xlstyle.hxx:491
SvxCellJustifyMethod GetScHorJustifyMethod() const
Returns horizontal justification method as Calc's attribute.
Definition: xlstyle.cxx:1576
sal_uInt8 mnVerAlign
Horizontal alignment.
Definition: xlstyle.hxx:490
sal_uInt8 mnIndent
Text rotation angle.
Definition: xlstyle.hxx:494
SvxCellVerJustify GetScVerAlign() const
Returns the Calc vertical alignment.
Definition: xlstyle.cxx:1581
SvxCellJustifyMethod GetScVerJustifyMethod() const
Returns vertical justification method as Calc's attribute.
Definition: xlstyle.cxx:1596
sal_uInt8 mnRotation
CTL text direction.
Definition: xlstyle.hxx:493
SvxFrameDirection GetScFrameDir() const
Returns the Calc frame direction.
Definition: xlstyle.cxx:1601
sal_uInt8 mnHorAlign
Definition: xlstyle.hxx:489
bool mbLineBreak
Indentation.
Definition: xlstyle.hxx:495
bool mbShrink
true = Multi-line text.
Definition: xlstyle.hxx:496
sal_uInt16 mnBackColor
Palette index to foreground color.
Definition: xlstyle.hxx:546
sal_uInt8 mnPattern
Palette index to background color.
Definition: xlstyle.hxx:547
sal_uInt16 mnForeColor
Definition: xlstyle.hxx:545
sal_uInt8 mnRightLine
Style of left line.
Definition: xlstyle.hxx:530
sal_uInt8 mnDiagLine
Style of bottom line.
Definition: xlstyle.hxx:533
sal_uInt16 mnDiagColor
Palette index for bottom line.
Definition: xlstyle.hxx:528
bool mbDiagTLtoBR
Style of diagonal line(s).
Definition: xlstyle.hxx:534
sal_uInt8 mnTopLine
Style of right line.
Definition: xlstyle.hxx:531
sal_uInt16 mnLeftColor
Definition: xlstyle.hxx:524
sal_uInt8 mnLeftLine
Palette index for diagonal line(s).
Definition: xlstyle.hxx:529
sal_uInt16 mnTopColor
Palette index for right line.
Definition: xlstyle.hxx:526
sal_uInt16 mnRightColor
Palette index for left line.
Definition: xlstyle.hxx:525
sal_uInt16 mnBottomColor
Palette index for top line.
Definition: xlstyle.hxx:527
bool mbDiagBLtoTR
true = Top-left to bottom-right on.
Definition: xlstyle.hxx:535
sal_uInt8 mnBottomLine
Style of top line.
Definition: xlstyle.hxx:532
bool mbLocked
Definition: xlstyle.hxx:478
bool mbHidden
true = Locked against editing.
Definition: xlstyle.hxx:479
This struct helps reading and writing Excel fonts.
Definition: xlstyle.hxx:286
OUString maStyle
Font name.
Definition: xlstyle.hxx:288
Color maColor
String with styles (bold, italic).
Definition: xlstyle.hxx:289
sal_uInt8 mnCharSet
Windows font family.
Definition: xlstyle.hxx:294
sal_uInt16 mnHeight
Font color.
Definition: xlstyle.hxx:290
bool mbOutline
true = Struck out.
Definition: xlstyle.hxx:298
sal_uInt16 mnWeight
Font height in twips (1/20 of a point).
Definition: xlstyle.hxx:291
FontWeight GetScWeight() const
Returns the Calc font weight.
Definition: xlstyle.cxx:260
void SetScPosture(FontItalic eScPosture)
Sets the Calc font posture.
Definition: xlstyle.cxx:336
FontFamily GetScFamily(rtl_TextEncoding eDefTextEnc) const
Returns the Calc font family.
Definition: xlstyle.cxx:229
FontStrikeout GetScStrikeout() const
Returns the Calc strike-out style.
Definition: xlstyle.cxx:303
bool mbItalic
Underline style.
Definition: xlstyle.hxx:296
sal_uInt8 mnUnderline
Windows character set.
Definition: xlstyle.hxx:295
FontLineStyle GetScUnderline() const
Returns the Calc font underline style.
Definition: xlstyle.cxx:279
bool mbStrikeout
true = Italic.
Definition: xlstyle.hxx:297
FontItalic GetScPosture() const
Returns the Calc font posture.
Definition: xlstyle.cxx:255
void SetScWeight(FontWeight eScWeight)
Sets the Calc font weight.
Definition: xlstyle.cxx:341
sal_uInt8 mnFamily
Escapement type.
Definition: xlstyle.hxx:293
sal_uInt16 mnEscapem
Boldness: 400=normal, 700=bold.
Definition: xlstyle.hxx:292
bool mbShadow
true = Outlined.
Definition: xlstyle.hxx:299
rtl_TextEncoding GetFontEncoding() const
Returns the font text encoding.
Definition: xlstyle.cxx:249
SvxEscapement GetScEscapement() const
Returns the Calc escapement style.
Definition: xlstyle.cxx:292
OUString maName
Definition: xlstyle.hxx:287
Extends the XclCellAlign struct for import.
Definition: xistyle.hxx:265
void FillFromCF(sal_uInt16 nAlign, sal_uInt16 nMiscAttrib)
Fills this struct with CF record data.
Definition: xistyle.cxx:803
void FillFromXF8(sal_uInt16 nAlign, sal_uInt16 nMiscAttrib)
Fills this struct with BIFF8 XF record data.
Definition: xistyle.cxx:792
void FillToItemSet(SfxItemSet &rItemSet, const XclImpFont *pFont, bool bSkipPoolDefs=false) const
Inserts items representing this alignment style into the item set.
Definition: xistyle.cxx:814
void FillFromXF4(sal_uInt16 nAlign)
Fills this struct with BIFF4 XF record data.
Definition: xistyle.cxx:777
void FillFromXF3(sal_uInt16 nAlign)
Fills this struct with BIFF3 XF record data.
Definition: xistyle.cxx:771
void FillFromXF2(sal_uInt8 nFlags)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:766
void FillFromXF5(sal_uInt16 nAlign)
Fills this struct with BIFF5/BIFF7 XF record data.
Definition: xistyle.cxx:784
bool mbPattUsed
true = Background color used.
Definition: xistyle.hxx:328
void FillFromXF5(sal_uInt32 nArea)
Fills this struct with BIFF5/BIFF7 XF record data.
Definition: xistyle.cxx:1040
bool mbBackUsed
true = Foreground color used.
Definition: xistyle.hxx:327
void FillFromXF2(sal_uInt8 nFlags)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:1024
void FillFromXF3(sal_uInt16 nArea)
Fills this struct with BIFF3/BIFF4 XF record data.
Definition: xistyle.cxx:1032
void FillFromXF8(sal_uInt32 nBorder2, sal_uInt16 nArea)
Fills this struct with BIFF8 XF record data.
Definition: xistyle.cxx:1048
void FillFromCF8(sal_uInt16 nPattern, sal_uInt16 nColor, sal_uInt32 nFlags)
Fills this struct with BIFF8 CF (conditional format) record data.
Definition: xistyle.cxx:1056
void SetUsedFlags(bool bUsed)
Sets colors and pattern state to used or unused.
Definition: xistyle.cxx:1019
XclImpCellArea()
true = Pattern used.
Definition: xistyle.cxx:1014
void FillToItemSet(SfxItemSet &rItemSet, const XclImpPalette &rPalette, bool bSkipPoolDefs=false) const
Inserts a brush item representing this area style into the item set.
Definition: xistyle.cxx:1077
Extends the XclCellBorder struct for import.
Definition: xistyle.hxx:287
void FillFromXF3(sal_uInt32 nBorder)
Fills this struct with BIFF3/BIFF4 XF record data.
Definition: xistyle.cxx:871
XclImpCellBorder()
true = Diagonal line style used.
Definition: xistyle.cxx:850
void FillFromXF5(sal_uInt32 nBorder, sal_uInt32 nArea)
Fills this struct with BIFF5/BIFF7 XF record data.
Definition: xistyle.cxx:884
void FillToItemSet(SfxItemSet &rItemSet, const XclImpPalette &rPalette, bool bSkipPoolDefs=false) const
Inserts a box item representing this border style into the item set.
Definition: xistyle.cxx:981
void FillFromXF2(sal_uInt8 nFlags)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:861
void FillFromCF8(sal_uInt16 nLineStyle, sal_uInt32 nLineColor, sal_uInt32 nFlags)
Fills this struct with BIFF8 CF (conditional format) record data.
Definition: xistyle.cxx:917
void FillFromXF8(sal_uInt32 nBorder1, sal_uInt32 nBorder2)
Fills this struct with BIFF8 XF record data.
Definition: xistyle.cxx:897
bool HasAnyOuterBorder() const
Returns true, if any of the outer border lines is visible.
Definition: xistyle.cxx:934
void SetUsedFlags(bool bOuterUsed, bool bDiagUsed)
Sets outer line states and diagonal line states to used or unused.
Definition: xistyle.cxx:855
bool mbDiagUsed
true = Bottom line style used.
Definition: xistyle.hxx:292
bool mbRightUsed
true = Left line style used.
Definition: xistyle.hxx:289
bool mbBottomUsed
true = Top line style used.
Definition: xistyle.hxx:291
bool mbTopUsed
true = Right line style used.
Definition: xistyle.hxx:290
void FillFromXF3(sal_uInt16 nProt)
Fills this struct with BIFF3-BIFF8 XF record data.
Definition: xistyle.cxx:755
void FillFromXF2(sal_uInt8 nNumFmt)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:749
void FillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
Inserts items representing this protection style into the item set.
Definition: xistyle.cxx:761
A 2D cell range address struct with Excel column and row indexes.
Definition: xladdress.hxx:59
unsigned char sal_uInt8
unsigned char sal_Bool
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE
::std::vector< Color > ColorVec
Definition: xistyle.cxx:86
::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE
Definition: xistyle.cxx:85
#define PUTITEM(item, sc_which, ee_which)
const sal_uInt8 EXC_ORIENT_NONE
Definition: xlconst.hxx:133
const sal_uInt16 EXC_BORDER_THICK
Definition: xlconst.hxx:248
const sal_uInt16 EXC_BORDER_MEDIUM
Definition: xlconst.hxx:249
const sal_uInt16 EXC_BORDER_THIN
Definition: xlconst.hxx:250
@ EXC_BIFF5
MS Excel 4.0.
Definition: xlconst.hxx:34
@ EXC_BIFF4
MS Excel 3.0.
Definition: xlconst.hxx:33
@ EXC_BIFF2
Definition: xlconst.hxx:31
@ EXC_BIFF8
MS Excel 5.0, MS Excel 7.0 (95)
Definition: xlconst.hxx:35
@ EXC_BIFF3
MS Excel 2.1.
Definition: xlconst.hxx:32
const sal_uInt8 EXC_ROT_STACKED
Text rotation: 90 deg clockwise.
Definition: xlconst.hxx:141
const sal_uInt16 EXC_BORDER_HAIR
Definition: xlconst.hxx:251
const sal_uInt32 EXC_CF_AREA_PATTERN
Any border line modified?
Definition: xlcontent.hxx:76
const sal_uInt32 EXC_CF_FONT_STYLE
NumberFormat String or Id?
Definition: xlcontent.hxx:89
const sal_uInt32 EXC_CF_AREA_BGCOLOR
Foreground color modified?
Definition: xlcontent.hxx:78
const sal_uInt32 EXC_CF_BORDER_RIGHT
Left border line modified?
Definition: xlcontent.hxx:72
const sal_uInt32 EXC_CF_BORDER_TOP
Right border line modified?
Definition: xlcontent.hxx:73
const sal_uInt32 EXC_CF_AREA_FGCOLOR
Pattern modified?
Definition: xlcontent.hxx:77
const sal_uInt32 EXC_CF_FONT_STRIKEOUT
Font posture or weight modified?
Definition: xlcontent.hxx:90
const sal_uInt32 EXC_CF_BORDER_LEFT
Definition: xlcontent.hxx:71
const sal_uInt32 EXC_CF_BORDER_BOTTOM
Top border line modified?
Definition: xlcontent.hxx:74
const sal_uInt32 EXC_CF_FONT_UNDERL
Default flags.
Definition: xlcontent.hxx:93
const sal_uInt16 EXC_FONTWGHT_NORMAL
Definition: xlstyle.hxx:110
const sal_uInt16 EXC_COLOR_WINDOWBACK
System window text color (>=BIFF5).
Definition: xlstyle.hxx:208
const sal_uInt16 EXC_FONT_NOTFOUND
Application font index.
Definition: xlstyle.hxx:77
const sal_uInt8 EXC_XF2_HIDDEN
Definition: xlstyle.hxx:179
const sal_uInt8 EXC_LINE_HAIR
Definition: xlstyle.hxx:44
const sal_uInt16 EXC_FONTATTR_SHADOW
Definition: xlstyle.hxx:102
const sal_uInt8 EXC_XF2_TOPLINE
Definition: xlstyle.hxx:182
const sal_uInt8 EXC_XF_DIFF_BORDER
Definition: xlstyle.hxx:154
XclFontItemType
Enumerates different types of Which-IDs for font items.
Definition: xlstyle.hxx:388
@ HeaderFooter
Use edit engine Which-IDs (EE_CHAR_*).
const sal_uInt16 EXC_STYLE_XFMASK
Definition: xlstyle.hxx:222
const sal_uInt16 EXC_FONTATTR_UNDERLINE
Definition: xlstyle.hxx:99
const sal_uInt16 EXC_COLOR_USEROFFSET
Definition: xlstyle.hxx:204
const sal_uInt8 EXC_XF_HOR_CENTER_AS
Definition: xlstyle.hxx:164
const sal_uInt8 EXC_XF2_RIGHTLINE
Definition: xlstyle.hxx:181
XclFontPropSetType
Enumerates different types for objects with font settings (using different property names).
Definition: xlstyle.hxx:396
@ EXC_FONTPROPSET_CONTROL
All text objects in charts.
Definition: xlstyle.hxx:398
const sal_uInt8 EXC_STYLEEXT_CUSTOM
Definition: xlstyle.hxx:245
const sal_uInt8 EXC_XF_DIFF_FONT
Definition: xlstyle.hxx:152
const sal_uInt16 EXC_COLOR_BIFF2_WHITE
Definition: xlstyle.hxx:202
const sal_uInt8 EXC_LINE_THIN
Definition: xlstyle.hxx:38
const sal_uInt8 EXC_FONTUNDERL_SINGLE
Definition: xlstyle.hxx:119
const sal_uInt16 EXC_FONTATTR_STRIKEOUT
Definition: xlstyle.hxx:100
const sal_uInt8 EXC_LINE_NONE
Definition: xlstyle.hxx:37
const sal_uInt8 EXC_STYLEEXT_HIDDEN
Definition: xlstyle.hxx:244
const sal_uInt16 EXC_COLOR_WINDOWTEXT
System window background color (BIFF3-BIFF4).
Definition: xlstyle.hxx:207
const sal_uInt16 EXC_XF_NOTFOUND
Excel index to default cell XF.
Definition: xlstyle.hxx:140
const sal_uInt8 EXC_XF_DIFF_VALFMT
Shrink to fit into cell.
Definition: xlstyle.hxx:151
const sal_uInt8 EXC_XF2_BOTTOMLINE
Definition: xlstyle.hxx:183
const sal_uInt8 EXC_STYLE_NOLEVEL
Number of outline level styles.
Definition: xlstyle.hxx:237
const sal_uInt16 EXC_FONTATTR_ITALIC
Definition: xlstyle.hxx:98
const sal_uInt16 EXC_COLOR_BIFF2_BLACK
Definition: xlstyle.hxx:201
const sal_uInt8 EXC_XF2_LOCKED
Definition: xlstyle.hxx:178
const sal_uInt16 EXC_XF_STYLE
Definition: xlstyle.hxx:146
const sal_uInt8 EXC_XF2_LEFTLINE
Definition: xlstyle.hxx:180
const sal_uInt16 EXC_XF_LOCKED
Definition: xlstyle.hxx:144
const sal_uInt8 EXC_XF_VER_JUSTIFY
Definition: xlstyle.hxx:170
const sal_uInt16 EXC_STYLE_BUILTIN
Definition: xlstyle.hxx:221
const sal_uInt16 EXC_ID_STYLEEXT
Default value for unused level.
Definition: xlstyle.hxx:241
const sal_uInt8 EXC_PATT_NONE
Definition: xlstyle.hxx:54
const sal_uInt8 EXC_FONTUNDERL_NONE
Definition: xlstyle.hxx:118
const sal_uInt16 EXC_FONTATTR_BOLD
Definition: xlstyle.hxx:97
const sal_uInt16 EXC_XF_HIDDEN
Definition: xlstyle.hxx:145
const sal_uInt8 EXC_XF_HOR_FILL
Definition: xlstyle.hxx:162
const sal_uInt8 EXC_PATT_SOLID
Definition: xlstyle.hxx:55
const sal_uInt8 EXC_XF2_BACKGROUND
Definition: xlstyle.hxx:184
const sal_uInt16 EXC_XF_LINEBREAK
Styles don't have a parent.
Definition: xlstyle.hxx:148
const sal_uInt32 EXC_XF_DIAGONAL_BL_TO_TR
Top-left to bottom-right.
Definition: xlstyle.hxx:190
const sal_uInt8 EXC_PATT_12_5_PERC
Definition: xlstyle.hxx:59
const sal_uInt8 EXC_XF_VER_DISTRIB
Definition: xlstyle.hxx:171
const sal_uInt8 EXC_STYLEEXT_BUILTIN
Definition: xlstyle.hxx:243
const sal_uInt16 EXC_FONTWGHT_BOLD
Definition: xlstyle.hxx:113
const sal_uInt32 EXC_XF_DIAGONAL_TL_TO_BR
Definition: xlstyle.hxx:189
const sal_uInt8 EXC_XF_DIFF_ALIGN
Definition: xlstyle.hxx:153
const sal_uInt8 EXC_XF_DIFF_AREA
Definition: xlstyle.hxx:155
const sal_uInt16 EXC_FONTATTR_OUTLINE
Definition: xlstyle.hxx:101
const sal_uInt8 EXC_STYLE_NORMAL
Definition: xlstyle.hxx:224
const sal_uInt8 EXC_XF2_VALFMT_MASK
Definition: xlstyle.hxx:177
const sal_uInt8 EXC_STYLE_USERDEF
"Followed_Hyperlink" style.
Definition: xlstyle.hxx:234
const sal_uInt16 EXC_XF8_SHRINK
Definition: xlstyle.hxx:186
const sal_uInt8 EXC_XF_DIFF_PROT
Definition: xlstyle.hxx:156
#define OSL_ENSURE_BIFF(c)
Definition: xltools.hxx:34
#define DBG_ERROR_BIFF()
Definition: xltools.hxx:33
SvNumFormatType
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND