49 sal_uInt32 nData1, sal_uInt16 nData2, sal_uInt16 nData3,
54 UInt32ToSVBT32( nData1,
mpnData );
55 ShortToSVBT16( nData2,
mpnData + 4 );
56 ShortToSVBT16( nData3,
mpnData + 6 );
88 0x79EAC9D0, 0xBAF9, 0x11CE, 0x8C, 0x82, 0x00, 0xAA, 0x00, 0x4B, 0xA9, 0x0B );
91 0x79EAC9E0, 0xBAF9, 0x11CE, 0x8C, 0x82, 0x00, 0xAA, 0x00, 0x4B, 0xA9, 0x0B );
94 0x00000303, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 );
109 sal_Int32 nTemp = nRKValue >> 2;
110 ::set_flag< sal_Int32 >( nTemp, 0xE0000000, nRKValue < 0 );
129 fFrac = modf( fValue, &fInt );
130 if( (fFrac == 0.0) && (fInt >= -536870912.0) && (fInt <= 536870911.0) )
133 =
static_cast<sal_Int32
>(
134 static_cast<sal_uInt32
>(
static_cast<sal_Int32
>(fInt)) << 2)
140 fFrac = modf( fValue * 100.0, &fInt );
141 if( (fFrac == 0.0) && (fInt >= -536870912.0) && (fInt <= 536870911.0) )
144 =
static_cast<sal_Int32
>(
145 static_cast<sal_uInt32
>(
static_cast<sal_Int32
>(fInt)) << 2)
157 return nRotForStacked;
158 OSL_ENSURE( nXclRot <= 180,
"XclTools::GetScRotation - illegal rotation angle" );
159 return Degree100(
static_cast< sal_Int32
>( (nXclRot <= 180) ? (100 * ((nXclRot > 90) ? (450 - nXclRot) : nXclRot)) : 0 ));
164 sal_Int32 nXclRot = nScRot.
get() / 100;
165 if( (0 <= nXclRot) && (nXclRot <= 90) )
166 return static_cast< sal_uInt8 >( nXclRot );
168 return static_cast< sal_uInt8 >( 270 - nXclRot );
170 return static_cast< sal_uInt8 >( nXclRot - 180 );
172 return static_cast< sal_uInt8 >( 450 - nXclRot );
184 default: OSL_FAIL(
"XclTools::GetXclRotFromOrient - unknown text orientation" );
193 OSL_ENSURE( nXclRot <= 180,
"XclTools::GetXclOrientFromRot - unknown text rotation" );
194 if( (45 < nXclRot) && (nXclRot <= 90) )
196 if( (135 < nXclRot) && (nXclRot <= 180) )
206 case FormulaError::IllegalFPOperation:
return EXC_ERR_NUM;
220 case FormulaError::NotAvailable:
return EXC_ERR_NA;
235 case EXC_ERR_NUM:
return FormulaError::IllegalFPOperation;
236 case EXC_ERR_NA:
return FormulaError::NotAvailable;
237 default: OSL_FAIL(
"XclTools::GetScErrorCode - unknown error code" );
239 return FormulaError::NotAvailable;
270 rfDblValue =
nValue ? 1.0 : 0.0;
275template <
typename N>
static N to(
double f) {
return limit_cast<N>(f + 0.5); }
309 double fScWidth =
static_cast< double >( nXclWidth ) / 256.0 * nScCharWidth - 0.5;
310 return limit_cast< sal_uInt16 >( fScWidth );
315 double fXclWidth = (
static_cast< double >( nScWidth ) + 0.5 ) * 256.0 / nScCharWidth;
316 return limit_cast< sal_uInt16 >( fXclWidth );
345 return 40960.0 / ::std::max( nXclDefFontHeight - 15,
tools::Long(60) ) + 50.0;
356 0x80, 0x00, 0x40, 0x20, 0x60, 0x40, 0x40, 0x40,
357 0x40, 0x40, 0x20, 0x60, 0x60, 0x60, 0x60, 0x48,
368const struct XclCodePageEntry
370 sal_uInt16 mnCodePage;
371 rtl_TextEncoding meTextEnc;
375 { 437, RTL_TEXTENCODING_IBM_437 },
377 { 737, RTL_TEXTENCODING_IBM_737 },
378 { 775, RTL_TEXTENCODING_IBM_775 },
379 { 850, RTL_TEXTENCODING_IBM_850 },
380 { 852, RTL_TEXTENCODING_IBM_852 },
381 { 855, RTL_TEXTENCODING_IBM_855 },
382 { 857, RTL_TEXTENCODING_IBM_857 },
384 { 860, RTL_TEXTENCODING_IBM_860 },
385 { 861, RTL_TEXTENCODING_IBM_861 },
386 { 862, RTL_TEXTENCODING_IBM_862 },
387 { 863, RTL_TEXTENCODING_IBM_863 },
388 { 864, RTL_TEXTENCODING_IBM_864 },
389 { 865, RTL_TEXTENCODING_IBM_865 },
390 { 866, RTL_TEXTENCODING_IBM_866 },
391 { 869, RTL_TEXTENCODING_IBM_869 },
392 { 874, RTL_TEXTENCODING_MS_874 },
393 { 932, RTL_TEXTENCODING_MS_932 },
394 { 936, RTL_TEXTENCODING_MS_936 },
395 { 949, RTL_TEXTENCODING_MS_949 },
396 { 950, RTL_TEXTENCODING_MS_950 },
397 { 1200, RTL_TEXTENCODING_DONTKNOW },
398 { 1250, RTL_TEXTENCODING_MS_1250 },
399 { 1251, RTL_TEXTENCODING_MS_1251 },
400 { 1252, RTL_TEXTENCODING_MS_1252 },
401 { 1253, RTL_TEXTENCODING_MS_1253 },
402 { 1254, RTL_TEXTENCODING_MS_1254 },
403 { 1255, RTL_TEXTENCODING_MS_1255 },
404 { 1256, RTL_TEXTENCODING_MS_1256 },
405 { 1257, RTL_TEXTENCODING_MS_1257 },
406 { 1258, RTL_TEXTENCODING_MS_1258 },
407 { 1361, RTL_TEXTENCODING_MS_1361 },
408 { 10000, RTL_TEXTENCODING_APPLE_ROMAN },
409 { 32768, RTL_TEXTENCODING_APPLE_ROMAN },
410 { 32769, RTL_TEXTENCODING_MS_1252 }
412const XclCodePageEntry*
const pCodePageTableEnd = std::end(pCodePageTable);
414struct XclCodePageEntry_CPPred
416 explicit XclCodePageEntry_CPPred( sal_uInt16 nCodePage ) : mnCodePage( nCodePage ) {}
417 bool operator()(
const XclCodePageEntry& rEntry )
const {
return rEntry.mnCodePage == mnCodePage; }
418 sal_uInt16 mnCodePage;
421struct XclCodePageEntry_TEPred
423 explicit XclCodePageEntry_TEPred( rtl_TextEncoding eTextEnc ) : meTextEnc( eTextEnc ) {}
424 bool operator()(
const XclCodePageEntry& rEntry )
const {
return rEntry.meTextEnc == meTextEnc; }
425 rtl_TextEncoding meTextEnc;
432 const XclCodePageEntry* pEntry = ::std::find_if( pCodePageTable, pCodePageTableEnd, XclCodePageEntry_CPPred( nCodePage ) );
433 if( pEntry == pCodePageTableEnd )
435 SAL_WARN(
"sc",
"XclTools::GetTextEncoding - unknown code page: 0x" << std::hex << nCodePage );
436 return RTL_TEXTENCODING_DONTKNOW;
438 return pEntry->meTextEnc;
443 if( eTextEnc == RTL_TEXTENCODING_UNICODE )
446 const XclCodePageEntry* pEntry = ::std::find_if( pCodePageTable, pCodePageTableEnd, XclCodePageEntry_TEPred( eTextEnc ) );
447 if( pEntry == pCodePageTableEnd )
449 SAL_WARN(
"sc",
"XclTools::GetXclCodePage - unsupported text encoding: 0x" << std::hex << eTextEnc );
452 return pEntry->mnCodePage;
458 OUString aNewName =
GetSubsFontName(rFontName, SubsFontFlags::ONLYONE | SubsFontFlags::MS);
459 return aNewName.isEmpty() ? rFontName : aNewName;
487 "XclTools::GetXclBuiltInDefName - built-in defined name list modified" );
490 return OUString::createFromAscii(
ppcDefNames[cBuiltIn]);
492 return OUString::number(cBuiltIn);
507 sal_Int32 nPrefixLen = 0;
517 sal_Int32 nBuiltInLen = aBuiltInName.getLength();
518 if( rDefName.matchIgnoreAsciiCase( aBuiltInName, nPrefixLen ) )
521 sal_Int32 nNextCharPos = nPrefixLen + nBuiltInLen;
522 sal_Unicode cNextChar = (rDefName.getLength() > nNextCharPos) ? rDefName[nNextCharPos] :
'\0';
523 if( (cNextChar ==
'\0') || (cNextChar ==
' ') || (cNextChar ==
'_') )
556 aStyleName =
ScResId( STR_STYLENAME_STANDARD );
563 else if (!rName.empty())
566 aBuf.append(
static_cast<sal_Int32
>(nStyleId));
569 aBuf.append(
static_cast<sal_Int32
>(nLevel+1));
571 aStyleName =
aBuf.makeStringAndClear();
580 if (rStyleName ==
ScResId(STR_STYLENAME_STANDARD))
583 if( pnNextChar ) *pnNextChar = rStyleName.getLength();
589 sal_Int32 nNextChar = 0;
591 sal_Int32 nPrefixLen = 0;
603 if( rStyleName.matchIgnoreAsciiCase( aShortName, nPrefixLen ) &&
604 (nNextChar < nPrefixLen + aShortName.getLength()))
607 nNextChar = nPrefixLen + aShortName.getLength();
615 if( pnStyleId ) *pnStyleId = nFoundId;
616 if( pnNextChar ) *pnNextChar = nNextChar;
621 if( pnNextChar ) *pnNextChar = 0;
622 return nPrefixLen > 0;
633 std::u16string_view aLevel = rStyleName.subView(nNextChar);
635 if (std::u16string_view(OUString::number(nLevel)) == aLevel
638 rnStyleId = nStyleId;
639 rnLevel =
static_cast< sal_uInt8 >( nLevel - 1 );
643 else if( rStyleName.getLength() == nNextChar )
645 rnStyleId = nStyleId;
665 OUString::number(
static_cast<sal_Int32
>(nScTab+1)) +
667 OUString::number(
static_cast<sal_Int32
>(nFormat+1)) +
669 OUString::number(
static_cast<sal_Int32
>(nCondition+1));
691 while( bLoop &&
rStrm.StartNextRecord() )
693 sal_uInt16 nRecId =
rStrm.GetRecId();
707 OSL_ENSURE( !rMacroName.isEmpty(),
"XclTools::GetSbMacroUrl - macro name is empty" );
716 sal_Int32 nSbMacroUrlLen = rSbMacroUrl.getLength();
718 if( (nMacroNameLen > 0) && rSbMacroUrl.startsWithIgnoreAsciiCase(
maSbMacroPrefix ) &&
721 sal_Int32 nPrjDot = rSbMacroUrl.indexOf(
'.', strlen(
maSbMacroPrefix) ) + 1;
722 return rSbMacroUrl.copy( nPrjDot, nSbMacroUrlLen - nPrjDot - strlen(
maSbMacroSuffix) );
735 rColor =
Color( nR, nG, nB );
sal_uInt8 GetBlue() const
sal_uInt8 GetGreen() const
This class is used to export Excel record streams.
This class is used to import record oriented streams.
double CreateDoubleError(FormulaError nErr)
UNOTOOLS_DLLPUBLIC OUString GetSubsFontName(std::u16string_view rName, SubsFontFlags nFlags)
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
OUString ScResId(TranslateId aId)
This struct stores a GUID (class ID) and supports reading, writing and comparison.
XclGuid()
Stores GUID always in little endian.
UNDERLYING_TYPE get() const
const sal_uInt8 EXC_ORIENT_90CW
Text orientation: 90 deg counterclockwise.
const sal_Int32 EXC_RK_100FLAG
const sal_Int32 EXC_RK_INTFLAG
const sal_uInt8 EXC_ORIENT_NONE
const sal_uInt16 EXC_ID2_BOF
Text rotation: vertically stacked.
const sal_uInt8 EXC_ERR_NA
const sal_uInt8 EXC_ERR_REF
const sal_uInt8 EXC_ROT_NONE
Text orientation: 90 deg clockwise.
const sal_uInt8 EXC_ROT_90CCW
Text rotation: not rotated.
const sal_uInt8 EXC_ERR_NAME
const sal_uInt8 EXC_ERR_NULL
DDE application-topic delimiter.
const sal_uInt8 EXC_ERR_VALUE
const sal_uInt8 EXC_ORIENT_90CCW
Text orientation: vertically stacked.
const sal_uInt16 EXC_ID4_BOF
const sal_Int32 EXC_RK_INT100
const sal_uInt8 EXC_ORIENT_STACKED
Text orientation: not rotated.
const sal_uInt8 EXC_ERR_DIV0
const sal_Int32 EXC_RK_INT
const sal_Int32 EXC_RK_VALUEMASK
const sal_uInt16 EXC_ID5_BOF
const sal_uInt16 EXC_ID3_BOF
const sal_uInt8 EXC_ROT_90CW
Text rotation: 90 deg counterclockwise.
const sal_uInt8 EXC_ROT_STACKED
Text rotation: 90 deg clockwise.
const sal_uInt16 EXC_ID_EOF
Internal use only.
const sal_uInt8 EXC_ERR_NUM
const sal_Unicode EXC_BUILTIN_UNKNOWN
const sal_uInt8 EXC_STYLE_COLLEVEL
"RowLevel_*" styles.
const sal_uInt8 EXC_STYLE_LEVELCOUNT
No built-in style.
const sal_uInt8 EXC_STYLE_ROWLEVEL
"Normal" style.
const sal_uInt8 EXC_STYLE_NOLEVEL
Number of outline level styles.
const sal_uInt8 EXC_STYLE_NORMAL
const sal_uInt8 EXC_STYLE_USERDEF
"Followed_Hyperlink" style.