LibreOffice Module sc (master) 1
interface.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
10#include <limits>
11#include <memory>
12#include <orcusinterface.hxx>
13
14#include <document.hxx>
15#include <formulacell.hxx>
16#include <rangenam.hxx>
17#include <tokenarray.hxx>
18#include <globalnames.hxx>
19#include <globstr.hrc>
20#include <scresid.hxx>
21#include <compiler.hxx>
22#include <stlpool.hxx>
23#include <scitems.hxx>
24#include <patattr.hxx>
25#include <docpool.hxx>
26#include <attrib.hxx>
27
28#include <editeng/postitem.hxx>
29#include <editeng/wghtitem.hxx>
30#include <editeng/colritem.hxx>
31#include <editeng/brushitem.hxx>
32#include <editeng/udlnitem.hxx>
33#include <editeng/boxitem.hxx>
35#include <editeng/fontitem.hxx>
36#include <editeng/fhgtitem.hxx>
37#include <editeng/lineitem.hxx>
40
42#include <svl/numformat.hxx>
43#include <svl/zforlist.hxx>
44#include <svl/intitem.hxx>
45#include <com/sun/star/task/XStatusIndicator.hpp>
46#include <i18nlangtag/lang.h>
47#include <tools/fontenum.hxx>
48#include <sal/log.hxx>
49
50#include <stylesbuffer.hxx>
51#include <orcus/exception.hpp>
52#include <stylehelper.hxx>
53#include <utility>
54
55using namespace com::sun::star;
56
57namespace os = orcus::spreadsheet;
58
59namespace {
60
61formula::FormulaGrammar::Grammar getCalcGrammarFromOrcus( os::formula_grammar_t grammar )
62{
64 switch(grammar)
65 {
66 case orcus::spreadsheet::formula_grammar_t::ods:
68 break;
69 case orcus::spreadsheet::formula_grammar_t::xlsx:
71 break;
72 case orcus::spreadsheet::formula_grammar_t::gnumeric:
74 break;
75 case orcus::spreadsheet::formula_grammar_t::xls_xml:
77 break;
78 case orcus::spreadsheet::formula_grammar_t::unknown:
79 break;
80 }
81
82 return eGrammar;
83}
84
85}
86
88 : mrDoc(rDoc)
89 , meCalcGrammar(formula::FormulaGrammar::GRAM_UNSPECIFIED)
90 , meOrcusGrammar(os::formula_grammar_t::unknown)
91 , mnTextEncoding(RTL_TEXTENCODING_UTF8)
92{
93}
94
95void ScOrcusGlobalSettings::set_origin_date(int year, int month, int day)
96{
98}
99
100void ScOrcusGlobalSettings::set_character_set(orcus::character_set_t cs)
101{
102 switch (cs)
103 {
104 case orcus::character_set_t::iso_2022_jp:
105 case orcus::character_set_t::iso_2022_jp_2:
106 mnTextEncoding = RTL_TEXTENCODING_ISO_2022_JP;
107 break;
108 case orcus::character_set_t::jis_x0201:
109 mnTextEncoding = RTL_TEXTENCODING_JIS_X_0201;
110 break;
111 case orcus::character_set_t::shift_jis:
112 mnTextEncoding = RTL_TEXTENCODING_SHIFT_JIS;
113 break;
114 case orcus::character_set_t::us_ascii:
115 mnTextEncoding = RTL_TEXTENCODING_ASCII_US;
116 break;
117 case orcus::character_set_t::utf_7:
118 mnTextEncoding = RTL_TEXTENCODING_UTF7;
119 break;
120 case orcus::character_set_t::windows_1250:
121 mnTextEncoding = RTL_TEXTENCODING_MS_1250;
122 break;
123 case orcus::character_set_t::windows_1251:
124 mnTextEncoding = RTL_TEXTENCODING_MS_1251;
125 break;
126 case orcus::character_set_t::windows_1252:
127 mnTextEncoding = RTL_TEXTENCODING_MS_1252;
128 break;
129 case orcus::character_set_t::windows_1253:
130 mnTextEncoding = RTL_TEXTENCODING_MS_1253;
131 break;
132 case orcus::character_set_t::windows_1254:
133 mnTextEncoding = RTL_TEXTENCODING_MS_1254;
134 break;
135 case orcus::character_set_t::windows_1255:
136 mnTextEncoding = RTL_TEXTENCODING_MS_1255;
137 break;
138 case orcus::character_set_t::windows_1256:
139 mnTextEncoding = RTL_TEXTENCODING_MS_1256;
140 break;
141 case orcus::character_set_t::windows_1257:
142 mnTextEncoding = RTL_TEXTENCODING_MS_1257;
143 break;
144 case orcus::character_set_t::windows_1258:
145 mnTextEncoding = RTL_TEXTENCODING_MS_1258;
146 break;
147 default:
148 ; // Add more as needed.
149 }
150}
151
152void ScOrcusGlobalSettings::set_default_formula_grammar(os::formula_grammar_t grammar)
153{
154 meCalcGrammar = getCalcGrammarFromOrcus(grammar);
155 meOrcusGrammar = grammar;
156}
157
158orcus::spreadsheet::formula_grammar_t ScOrcusGlobalSettings::get_default_formula_grammar() const
159{
160 return meOrcusGrammar;
161}
162
164 mrGlobalSettings(rGS) {}
165
166os::src_address_t ScOrcusRefResolver::resolve_address(std::string_view address)
167{
168 OUString aStr(address.data(), address.size(), mrGlobalSettings.getTextEncoding());
169
170 ScAddress aAddr;
174
175 if (!aAddr.IsValid())
176 {
177 std::ostringstream os;
178 os << "'" << address << "' is not a valid address expression.";
179 throw orcus::invalid_arg_error(os.str());
180 }
181
182 os::src_address_t ret;
183 ret.sheet = aAddr.Tab();
184 ret.column = aAddr.Col();
185 ret.row = aAddr.Row();
186
187 return ret;
188}
189
190os::src_range_t ScOrcusRefResolver::resolve_range(std::string_view range)
191{
192 OUString aStr(range.data(), range.size(), mrGlobalSettings.getTextEncoding());
193
194 ScRange aRange;
198
199 if (!aRange.IsValid())
200 {
201 std::ostringstream os;
202 os << "'" << range << "' is not a valid range expression.";
203 throw orcus::invalid_arg_error(os.str());
204 }
205
206 os::src_range_t ret;
207 ret.first.sheet = aRange.aStart.Tab();
208 ret.first.column = aRange.aStart.Col();
209 ret.first.row = aRange.aStart.Row();
210 ret.last.sheet = aRange.aEnd.Tab();
211 ret.last.column = aRange.aEnd.Col();
212 ret.last.row = aRange.aEnd.Row();
213
214 return ret;
215}
216
218 ScDocumentImport& rDoc, const ScOrcusGlobalSettings& rGS, SCTAB nTab ) :
219 mrDoc(rDoc), mrGlobalSettings(rGS), mnTab(nTab) {}
220
222{
223 maBasePos.SetTab(0);
224 maBasePos.SetCol(0);
225 maBasePos.SetRow(0);
226 maName.clear();
227 maExpr.clear();
228}
229
230void ScOrcusNamedExpression::set_base_position(const orcus::spreadsheet::src_address_t& pos)
231{
232 maBasePos.SetTab(pos.sheet);
233 maBasePos.SetCol(pos.column);
234 maBasePos.SetRow(pos.row);
235}
236
237void ScOrcusNamedExpression::set_named_expression(std::string_view name, std::string_view expression)
238{
239 maName = OUString(name.data(), name.size(), mrGlobalSettings.getTextEncoding());
240 maExpr = OUString(expression.data(), expression.size(), mrGlobalSettings.getTextEncoding());
241}
242
243void ScOrcusNamedExpression::set_named_range(std::string_view /*name*/, std::string_view /*range*/)
244{
245 throw std::runtime_error("ScOrcusNamedExpression::set_named_range not implemented yet.");
246}
247
249{
251 if (!pNames)
252 return;
253
254 ScRangeData* pRange = new ScRangeData(
257
258 pNames->insert(pRange, false);
259
260 reset(); // make sure to reset the state for the next run.
261}
262
264 : mfValue(std::numeric_limits<double>::quiet_NaN())
265 , maPos(rPos)
266 , meType(eType)
267 , mnIndex1(0)
268 , mnIndex2(0)
269 , meGrammar(formula::FormulaGrammar::GRAM_UNSPECIFIED)
270{
271}
272
274 : mfValue(fValue)
275 , maPos(rPos)
277 , mnIndex1(0)
278 , mnIndex2(0)
279 , meGrammar(formula::FormulaGrammar::GRAM_UNSPECIFIED)
280{
281}
282
284 : mfValue(std::numeric_limits<double>::quiet_NaN())
285 , maPos(rPos)
286 , meType(Type::String)
287 , mnIndex1(nIndex)
288 , mnIndex2(0)
289 , meGrammar(formula::FormulaGrammar::GRAM_UNSPECIFIED)
290{
291}
292
295 : maStr1(std::move(aFormula))
296 , mfValue(std::numeric_limits<double>::quiet_NaN())
297 , maPos(rPos)
299 , mnIndex1(0)
300 , mnIndex2(0)
301 , meGrammar(eGrammar)
302{
303}
304
305ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc, bool bSkipDefaultStyles) :
306 maDoc(rDoc),
308 maSharedStrings(*this),
310 maStyles(*this, bSkipDefaultStyles),
311 mnProgress(0) {}
312
313orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(
314 orcus::spreadsheet::sheet_t sheet_index, std::string_view sheet_name)
315{
316 OUString aTabName(sheet_name.data(), sheet_name.size(), maGlobalSettings.getTextEncoding());
317
318 if (sheet_index == 0)
319 {
320 // The calc document initializes with one sheet already present.
321 assert(maDoc.getSheetCount() == 1);
322 maDoc.setSheetName(0, aTabName);
323 maSheets.push_back(std::make_unique<ScOrcusSheet>(maDoc, 0, *this));
324 return maSheets.back().get();
325 }
326
327 if (!maDoc.appendSheet(aTabName))
328 return nullptr;
329
330 SCTAB nTab = maDoc.getSheetCount() - 1;
331 maSheets.push_back(std::make_unique<ScOrcusSheet>(maDoc, nTab, *this));
332 return maSheets.back().get();
333}
334
335namespace {
336
337class FindSheetByIndex
338{
339 SCTAB mnTab;
340public:
341 explicit FindSheetByIndex(SCTAB nTab) : mnTab(nTab) {}
342 bool operator() (const std::unique_ptr<ScOrcusSheet>& rSheet) const
343 {
344 return rSheet->getIndex() == mnTab;
345 }
346};
347
348}
349
350orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(std::string_view sheet_name)
351{
352 OUString aTabName(sheet_name.data(), sheet_name.size(), maGlobalSettings.getTextEncoding());
353 SCTAB nTab = maDoc.getSheetIndex(aTabName);
354 if (nTab < 0)
355 // Sheet by that name not found.
356 return nullptr;
357
358 // See if we already have an orcus sheet instance by that index.
359 std::vector< std::unique_ptr<ScOrcusSheet> >::iterator it =
360 std::find_if(maSheets.begin(), maSheets.end(), FindSheetByIndex(nTab));
361
362 if (it != maSheets.end())
363 // We already have one. Return it.
364 return it->get();
365
366 // Create a new orcus sheet instance for this.
367 maSheets.push_back(std::make_unique<ScOrcusSheet>(maDoc, nTab, *this));
368 return maSheets.back().get();
369}
370
371orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(orcus::spreadsheet::sheet_t sheet_index)
372{
373 SCTAB nTab = static_cast<SCTAB>(sheet_index);
374 // See if we already have an orcus sheet instance by that index.
375 std::vector< std::unique_ptr<ScOrcusSheet> >::iterator it =
376 std::find_if(maSheets.begin(), maSheets.end(), FindSheetByIndex(nTab));
377
378 if (it != maSheets.end())
379 // We already have one. Return it.
380 return it->get();
381
382 // Create a new orcus sheet instance for this.
383 maSheets.push_back(std::make_unique<ScOrcusSheet>(maDoc, nTab, *this));
384 return maSheets.back().get();
385}
386
387orcus::spreadsheet::iface::import_global_settings* ScOrcusFactory::get_global_settings()
388{
389 return &maGlobalSettings;
390}
391
392orcus::spreadsheet::iface::import_shared_strings* ScOrcusFactory::get_shared_strings()
393{
394 return &maSharedStrings;
395}
396
397orcus::spreadsheet::iface::import_named_expression* ScOrcusFactory::get_named_expression()
398{
399 return &maNamedExpressions;
400}
401
402orcus::spreadsheet::iface::import_styles* ScOrcusFactory::get_styles()
403{
404 return &maStyles;
405}
406
408{
409 auto toFormulaCell = [this]( const CellStoreToken& rToken ) -> std::unique_ptr<ScFormulaCell>
410 {
411 const ScOrcusSheet& rSheet = *maSheets.at(rToken.maPos.Tab());
412 const sc::SharedFormulaGroups& rSFG = rSheet.getSharedFormulaGroups();
413 const ScTokenArray* pArray = rSFG.get(rToken.mnIndex1);
414 if (!pArray)
415 return std::unique_ptr<ScFormulaCell>();
416
417 return std::make_unique<ScFormulaCell>(maDoc.getDoc(), rToken.maPos, *pArray);
418 };
419
420 int nCellCount = 0;
421
422 for (const CellStoreToken& rToken : maCellStoreTokens)
423 {
424 switch (rToken.meType)
425 {
427 {
428 maDoc.setAutoInput(rToken.maPos, rToken.maStr1);
429 ++nCellCount;
430 break;
431 }
433 {
434 if (rToken.mnIndex1 >= maStrings.size())
435 // String index out-of-bound! Something is up.
436 break;
437
438 maDoc.setStringCell(rToken.maPos, maStrings[rToken.mnIndex1]);
439 ++nCellCount;
440 break;
441 }
443 {
444 maDoc.setNumericCell(rToken.maPos, rToken.mfValue);
445 ++nCellCount;
446 break;
447 }
449 {
451 rToken.maPos, rToken.maStr1, rToken.meGrammar);
452
453 ++nCellCount;
454 break;
455 }
457 {
458 if (std::isfinite(rToken.mfValue))
459 maDoc.setFormulaCell(rToken.maPos, rToken.maStr1, rToken.meGrammar, &rToken.mfValue);
460 else
461 maDoc.setFormulaCell(rToken.maPos, rToken.maStr1, rToken.meGrammar, rToken.maStr2);
462
463 ++nCellCount;
464 break;
465 }
467 {
468 std::unique_ptr<ScFormulaCell> pCell = toFormulaCell(rToken);
469 if (!pCell)
470 break;
471
472 maDoc.setFormulaCell(rToken.maPos, pCell.release());
473
474 ++nCellCount;
475 break;
476 }
478 {
479 std::unique_ptr<ScFormulaCell> pCell = toFormulaCell(rToken);
480 if (!pCell)
481 break;
482
483 if (std::isfinite(rToken.mfValue))
484 pCell->SetResultDouble(rToken.mfValue);
485 else
486 pCell->SetHybridString(
487 maDoc.getDoc().GetSharedStringPool().intern(rToken.maStr2));
488
489 maDoc.setFormulaCell(rToken.maPos, pCell.release());
490
491 ++nCellCount;
492 break;
493 }
495 {
496 if (!rToken.mnIndex1 || !rToken.mnIndex2)
497 break;
498
499 ScRange aRange(rToken.maPos);
500 aRange.aEnd.IncCol(rToken.mnIndex1-1);
501 aRange.aEnd.IncRow(rToken.mnIndex2-1);
502
503 ScCompiler aComp(maDoc.getDoc(), aRange.aStart, rToken.meGrammar);
504 std::unique_ptr<ScTokenArray> pArray(aComp.CompileString(rToken.maStr1));
505 if (!pArray)
506 break;
507
508 maDoc.setMatrixCells(aRange, *pArray, rToken.meGrammar);
509 break;
510 }
512 {
513 if (!rToken.mnIndex1)
514 break;
515
516 maDoc.fillDownCells(rToken.maPos, rToken.mnIndex1);
517 break;
518 }
519 default:
520 ;
521 }
522
523 if (nCellCount == 100000)
524 {
526 nCellCount = 0;
527 }
528 }
529
530 if (mxStatusIndicator.is())
531 mxStatusIndicator->end();
532
533 maDoc.finalize();
534}
535
537{
538 return maDoc;
539}
540
541size_t ScOrcusFactory::appendString(const OUString& rStr)
542{
543 size_t nPos = maStrings.size();
544 maStrings.push_back(rStr);
545 maStringHash.emplace(rStr, nPos);
546
547 return nPos;
548}
549
550size_t ScOrcusFactory::addString(const OUString& rStr)
551{
552 // Add only if the string is not yet present in the string pool.
553 StringHashType::iterator it = maStringHash.find(rStr);
554 if (it != maStringHash.end())
555 return it->second;
556
557 return appendString(rStr);
558}
559
560const OUString* ScOrcusFactory::getString(size_t nIndex) const
561{
562 return nIndex < maStrings.size() ? &maStrings[nIndex] : nullptr;
563}
564
565void ScOrcusFactory::pushCellStoreAutoToken( const ScAddress& rPos, const OUString& rVal )
566{
568 maCellStoreTokens.back().maStr1 = rVal;
569}
570
571void ScOrcusFactory::pushCellStoreToken( const ScAddress& rPos, uint32_t nStrIndex )
572{
573 maCellStoreTokens.emplace_back(rPos, nStrIndex);
574}
575
576void ScOrcusFactory::pushCellStoreToken( const ScAddress& rPos, double fValue )
577{
578 maCellStoreTokens.emplace_back(rPos, fValue);
579}
580
582 const ScAddress& rPos, const OUString& rFormula, formula::FormulaGrammar::Grammar eGrammar )
583{
584 maCellStoreTokens.emplace_back(rPos, rFormula, eGrammar);
585}
586
587void ScOrcusFactory::pushFillDownCellsToken( const ScAddress& rPos, uint32_t nFillSize )
588{
590 maCellStoreTokens.back().mnIndex1 = nFillSize;
591}
592
593void ScOrcusFactory::pushSharedFormulaToken( const ScAddress& rPos, uint32_t nIndex )
594{
596 maCellStoreTokens.back().mnIndex1 = nIndex;
597}
598
600 const ScAddress& rPos, const OUString& rFormula, formula::FormulaGrammar::Grammar eGrammar,
601 uint32_t nRowRange, uint32_t nColRange )
602{
605 rT.maStr1 = rFormula;
606 rT.meGrammar = eGrammar;
607 rT.mnIndex1 = nColRange;
608 rT.mnIndex2 = nRowRange;
609}
610
611void ScOrcusFactory::pushFormulaResult( const ScAddress& rPos, double fValue )
612{
613 // Formula result is expected to be pushed immediately following the
614 // formula token it belongs.
615 if (maCellStoreTokens.empty())
616 return;
617
618 CellStoreToken& rToken = maCellStoreTokens.back();
619 if (rToken.maPos != rPos)
620 return;
621
622 switch (rToken.meType)
623 {
626 break;
629 break;
630 default:
631 return;
632 }
633
634 rToken.mfValue = fValue;
635}
636
637void ScOrcusFactory::pushFormulaResult( const ScAddress& rPos, const OUString& rValue )
638{
639 // Formula result is expected to be pushed immediately following the
640 // formula token it belongs.
641 if (maCellStoreTokens.empty())
642 return;
643
644 CellStoreToken& rToken = maCellStoreTokens.back();
645 if (rToken.maPos != rPos)
646 return;
647
648 switch (rToken.meType)
649 {
652 break;
655 break;
656 default:
657 return;
658 }
659
660 rToken.maStr2 = rValue;
661}
662
664{
665 if (!mxStatusIndicator.is())
666 // Status indicator object not set.
667 return;
668
669 // For now, we'll hard-code the progress range to be 100, and stops at 99
670 // in all cases.
671
672 if (!mnProgress)
673 mxStatusIndicator->start(ScResId(STR_LOAD_DOC), 100);
674
675 if (mnProgress == 99)
676 return;
677
678 ++mnProgress;
679 mxStatusIndicator->setValue(mnProgress);
680}
681
682void ScOrcusFactory::setStatusIndicator(const uno::Reference<task::XStatusIndicator>& rIndicator)
683{
684 mxStatusIndicator = rIndicator;
685}
686
688{
689 return maGlobalSettings;
690}
691
693 mrDoc(rDoc),
694 mnTab(nTab)
695{
696}
697
699{
700}
701
702namespace {
703
704double translateToInternal(double nVal, orcus::length_unit_t unit)
705{
706 switch(unit)
707 {
708 case orcus::length_unit_t::inch:
709 return nVal * 72.0 * 20.0;
710 case orcus::length_unit_t::twip:
711 return nVal;
712 case orcus::length_unit_t::point:
713 return nVal * 20.0;
714 case orcus::length_unit_t::centimeter:
715 return nVal * 20.0 * 72.0 / 2.54;
716 case orcus::length_unit_t::unknown:
717 if (nVal != 0)
718 SAL_WARN("sc.orcus", "unknown unit");
719 break;
720 default:
721 break;
722 }
723 return nVal;
724}
725
726
727}
728
729void ScOrcusSheetProperties::set_column_width(os::col_t col, double width, orcus::length_unit_t unit)
730{
731 double nNewWidth = translateToInternal(width, unit);
732 mrDoc.getDoc().SetColWidthOnly(col, mnTab, nNewWidth);
733}
734
735void ScOrcusSheetProperties::set_column_hidden(os::col_t col, bool hidden)
736{
737 if (hidden)
738 mrDoc.getDoc().SetColHidden(col, col, mnTab, hidden);
739}
740
741void ScOrcusSheetProperties::set_row_height(os::row_t row, double height, orcus::length_unit_t unit)
742{
743 double nNewHeight = translateToInternal(height, unit);
744 mrDoc.getDoc().SetRowHeightOnly(row, row,mnTab, nNewHeight);
745}
746
747void ScOrcusSheetProperties::set_row_hidden(os::row_t row, bool hidden)
748{
749 if (hidden)
750 mrDoc.getDoc().SetRowHidden(row, row, mnTab, hidden);
751}
752
753void ScOrcusSheetProperties::set_merge_cell_range(const orcus::spreadsheet::range_t& range)
754{
755 mrDoc.setMergedCells(mnTab, range.first.column, range.first.row, range.last.column, range.last.row);
756}
757
759 mnTab(nTab),
760 mrDoc(rDoc),
761 mpCurrentFormat(new ScConditionalFormat(0, &mrDoc)),
762 meEntryType(ScFormatEntry::Type::Condition)
763{
764}
765
767{
768}
769
770void ScOrcusConditionalFormat::set_color(os::color_elem_t /*alpha*/, os::color_elem_t /*red*/,
771 os::color_elem_t /*green*/, os::color_elem_t /*blue*/)
772{
773 SAL_INFO("sc.orcus.condformat", "set_color");
774}
775
776void ScOrcusConditionalFormat::set_condition_type(os::condition_type_t /*type*/)
777{
779 SAL_INFO("sc.orcus.condformat", "set_condition_type");
780}
781
782void ScOrcusConditionalFormat::set_formula(std::string_view /*formula*/)
783{
784 SAL_INFO("sc.orcus.condformat", "set_formula");
785}
786
787void ScOrcusConditionalFormat::set_date(os::condition_date_t /*date*/)
788{
790 SAL_INFO("sc.orcus.condformat", "set_date");
791}
792
794{
795 SAL_INFO("sc.orcus.condformat", "commit_condition");
796}
797
798void ScOrcusConditionalFormat::set_icon_name(std::string_view /*name*/)
799{
801 SAL_INFO("sc.orcus.condformat", "set_icon_name");
802}
803
805{
807 SAL_INFO("sc.orcus.condformat", "set_databar_gradient");
808}
809
810void ScOrcusConditionalFormat::set_databar_axis(os::databar_axis_t /*axis*/)
811{
813 SAL_INFO("sc.orcus.condformat", "set_databar_axis");
814}
815
816void ScOrcusConditionalFormat::set_databar_color_positive(os::color_elem_t /*alpha*/, os::color_elem_t /*red*/,
817 os::color_elem_t /*green*/, os::color_elem_t /*blue*/)
818{
820 SAL_INFO("sc.orcus.condformat", "set_databar_color_positive");
821}
822
823void ScOrcusConditionalFormat::set_databar_color_negative(os::color_elem_t /*alpha*/, os::color_elem_t /*red*/,
824 os::color_elem_t /*green*/, os::color_elem_t /*blue*/)
825{
827 SAL_INFO("sc.orcus.condformat", "set_databar_color_negative");
828}
829
831{
833 SAL_INFO("sc.orcus.condformat", "set_min_databar_length");
834}
835
837{
839 SAL_INFO("sc.orcus.condformat", "set_max_databar_length");
840}
841
843{
844 SAL_INFO("sc.orcus.condformat", "set_show_value");
845}
846
848{
850 SAL_INFO("sc.orcus.condformat", "set_iconset_reverse");
851}
852
854{
855 SAL_INFO("sc.orcus.condformat", "set_xf_id");
856}
857
858void ScOrcusConditionalFormat::set_operator(os::condition_operator_t /*condition_type*/)
859{
860 SAL_INFO("sc.orcus.condformat", "set_operator");
861}
862
863void ScOrcusConditionalFormat::set_type(os::conditional_format_t type)
864{
865 switch (type)
866 {
867 case os::conditional_format_t::condition:
868 case os::conditional_format_t::formula:
870 // mpCurrentEntry.reset(new ScCondFormatEntry());
871 break;
872 case os::conditional_format_t::date:
873 break;
874 case os::conditional_format_t::colorscale:
875 break;
876 case os::conditional_format_t::databar:
877 break;
878 case os::conditional_format_t::iconset:
879 break;
880 default:
881 SAL_INFO("sc.orcus.condformat", "unknown conditional_format_t value");
882 break;
883 }
884 SAL_INFO("sc.orcus.condformat", "set_type");
885}
886
888{
889 SAL_INFO("sc.orcus.condformat", "commit_entry");
890}
891
892void ScOrcusConditionalFormat::set_range(std::string_view /*range*/)
893{
894 SAL_INFO("sc.orcus.condformat", "set_range");
895}
896
897void ScOrcusConditionalFormat::set_range(os::row_t row_start, os::col_t col_start,
898 os::row_t row_end, os::col_t col_end)
899{
900 SAL_INFO("sc.orcus.condformat", "set_range");
901 ScRange aRange(col_start, row_start, mnTab, col_end, row_end, mnTab);
902 mpCurrentFormat->SetRange(aRange);
903}
904
906{
907 SAL_INFO("sc.orcus.condformat", "commit_format");
909}
910
912 mrDoc(rDoc),
913 mnTab(nTab),
914 mrFactory(rFactory),
915 mrStyles(static_cast<ScOrcusStyles&>(*mrFactory.get_styles())),
916 maAutoFilter(rFactory.getGlobalSettings()),
917 maProperties(mnTab, mrDoc),
918 maConditionalFormat(mnTab, rDoc.getDoc()),
919 maNamedExpressions(rDoc, rFactory.getGlobalSettings(), nTab),
920 maFormula(*this),
921 maArrayFormula(*this),
922 mnCellCount(0)
923{
924}
925
927{
928 mnCol = -1;
929 mnRow = -1;
930 maFormula.clear();
933 mbShared = false;
935 maResult.clear();
936 mfResult = 0.0;
937}
938
940 mrSheet(rSheet),
941 mnCol(-1),
942 mnRow(-1),
943 meGrammar(formula::FormulaGrammar::GRAM_UNSPECIFIED),
944 mnSharedFormulaIndex(0),
945 mbShared(false),
946 meResType(ResultType::NotSet),
947 mfResult(0.0) {}
948
950
951void ScOrcusFormula::set_position(os::row_t row, os::col_t col)
952{
953 mnCol = col;
954 mnRow = row;
955}
956
957void ScOrcusFormula::set_formula(os::formula_grammar_t grammar, std::string_view formula)
958{
960 meGrammar = getCalcGrammarFromOrcus(grammar);
961}
962
964{
966 mbShared = true;
967}
968
970{
972 mfResult = value;
973}
974
975void ScOrcusFormula::set_result_string(std::string_view value)
976{
978 maResult = OUString(value.data(), value.size(), mrSheet.getFactory().getGlobalSettings().getTextEncoding());
979}
980
982{
984}
985
987{
989 mfResult = value ? 1.0 : 0.0;
990}
991
993{
994 ScOrcusFactory& rFactory = mrSheet.getFactory();
997
998 if (mbShared)
999 {
1000 if (maFormula.isEmpty())
1001 {
1002 // shared formula that references existing formula token.
1003 const ScTokenArray* pArray = rGroups.get(mnSharedFormulaIndex);
1004 if (!pArray)
1005 return;
1006 }
1007 else
1008 {
1009 // topmost shared formula with new formula token.
1010
1011 // Compile the formula expression into tokens.
1012 ScCompiler aComp(mrSheet.getDoc().getDoc(), aPos, meGrammar);
1013 std::unique_ptr<ScTokenArray> pArray = aComp.CompileString(maFormula);
1014 if (!pArray)
1015 // Tokenization failed.
1016 return;
1017
1018 rGroups.set(mnSharedFormulaIndex, std::move(pArray));
1019 }
1021 }
1022 else
1023 {
1024 // non-shared formula
1025 rFactory.pushCellStoreToken(aPos, maFormula, meGrammar);
1026 }
1027
1028 switch (meResType)
1029 {
1030 case ResultType::String:
1031 {
1032 rFactory.pushFormulaResult(aPos, maResult);
1033 break;
1034 }
1035 case ResultType::Value:
1036 rFactory.pushFormulaResult(aPos, mfResult);
1037 break;
1038 default:
1039 ;
1040 }
1041
1043}
1044
1046{
1047 mnCol = -1;
1048 mnRow = -1;
1049 mnColRange = 0;
1050 mnRowRange = 0;
1051
1052 maFormula.clear();
1054}
1055
1057 mrSheet(rSheet),
1058 mnCol(-1),
1059 mnRow(-1),
1060 mnColRange(0),
1061 mnRowRange(0),
1062 meGrammar(formula::FormulaGrammar::GRAM_UNSPECIFIED) {}
1063
1065
1066void ScOrcusArrayFormula::set_range(const os::range_t& range)
1067{
1068 mnCol = range.first.column;
1069 mnRow = range.first.row;
1070
1071 mnColRange = range.last.column - range.first.column + 1;
1072 mnRowRange = range.last.row - range.first.column + 1;
1073}
1074
1075void ScOrcusArrayFormula::set_formula(os::formula_grammar_t grammar, std::string_view formula)
1076{
1077 meGrammar = getCalcGrammarFromOrcus(grammar);
1079}
1080
1081void ScOrcusArrayFormula::set_result_value(os::row_t /*row*/, os::col_t /*col*/, double /*value*/)
1082{
1083 // TODO : implement result cache for matrix
1084}
1085
1086void ScOrcusArrayFormula::set_result_string(os::row_t /*row*/, os::col_t /*col*/, std::string_view /*value*/)
1087{
1088 // TODO : implement result cache for matrix
1089}
1090
1091void ScOrcusArrayFormula::set_result_empty(os::row_t /*row*/, os::col_t /*col*/)
1092{
1093 // TODO : implement result cache for matrix
1094}
1095
1096void ScOrcusArrayFormula::set_result_bool(os::row_t /*row*/, os::col_t /*col*/, bool /*value*/)
1097{
1098 // TODO : implement result cache for matrix
1099}
1100
1102{
1106}
1107
1109{
1110 ++mnCellCount;
1111 if (mnCellCount == 100000)
1112 {
1114 mnCellCount = 0;
1115 }
1116}
1117
1119{
1120 return mrDoc;
1121}
1122
1123os::iface::import_auto_filter* ScOrcusSheet::get_auto_filter()
1124{
1125 return &maAutoFilter;
1126}
1127
1128os::iface::import_table* ScOrcusSheet::get_table()
1129{
1130 return nullptr;
1131}
1132
1133os::iface::import_sheet_properties* ScOrcusSheet::get_sheet_properties()
1134{
1135 return &maProperties;
1136}
1137
1138os::iface::import_conditional_format* ScOrcusSheet::get_conditional_format()
1139{
1140 return &maConditionalFormat;
1141}
1142
1143os::iface::import_named_expression* ScOrcusSheet::get_named_expression()
1144{
1145 return &maNamedExpressions;
1146}
1147
1148os::iface::import_formula* ScOrcusSheet::get_formula()
1149{
1150 maFormula.reset();
1151 return &maFormula;
1152}
1153
1154os::iface::import_array_formula* ScOrcusSheet::get_array_formula()
1155{
1157 return &maArrayFormula;
1158}
1159
1160void ScOrcusSheet::set_auto(os::row_t row, os::col_t col, std::string_view value)
1161{
1162 OUString aVal(value.data(), value.size(), mrFactory.getGlobalSettings().getTextEncoding());
1164 cellInserted();
1165}
1166
1167void ScOrcusSheet::set_string(os::row_t row, os::col_t col, os::string_id_t sindex)
1168{
1169 mrFactory.pushCellStoreToken(ScAddress(col, row, mnTab), sindex);
1170 cellInserted();
1171}
1172
1173void ScOrcusSheet::set_value(os::row_t row, os::col_t col, double value)
1174{
1176 cellInserted();
1177}
1178
1179void ScOrcusSheet::set_bool(os::row_t row, os::col_t col, bool value)
1180{
1181 mrFactory.pushCellStoreToken(ScAddress(col, row, mnTab), value ? 1.0 : 0.0);
1182 cellInserted();
1183}
1184
1186 os::row_t row, os::col_t col, int year, int month, int day, int hour, int minute, double second)
1187{
1188 SvNumberFormatter* pFormatter = mrDoc.getDoc().GetFormatTable();
1189
1190 Date aDate(day, month, year);
1191 sal_uInt32 nSec = floor(second);
1192 sal_uInt32 nNanoSec = (second - nSec) * ::tools::Time::nanoSecPerSec;
1193 tools::Time aTime(hour, minute, nSec, nNanoSec);
1194 tools::Long nDateDiff = aDate - pFormatter->GetNullDate();
1195
1196 double fTime =
1197 static_cast<double>(aTime.GetNanoSec()) / ::tools::Time::nanoSecPerSec +
1198 aTime.GetSec() +
1201
1202 fTime /= DATE_TIME_FACTOR;
1203
1204 mrFactory.pushCellStoreToken(ScAddress(col, row, mnTab), nDateDiff + fTime);
1205 cellInserted();
1206}
1207
1208void ScOrcusSheet::set_format(os::row_t row, os::col_t col, size_t xf_index)
1209{
1210 SAL_INFO("sc.orcus.style", "set format: " << xf_index);
1211
1212 ScPatternAttr aPattern(mrDoc.getDoc().GetPool());
1213 mrStyles.applyXfToItemSet(aPattern.GetItemSet(), xf_index);
1214 mrDoc.getDoc().ApplyPattern(col, row, mnTab, aPattern);
1215}
1216
1217void ScOrcusSheet::set_format(os::row_t row_start, os::col_t col_start,
1218 os::row_t row_end, os::col_t col_end, size_t xf_index)
1219{
1220 SAL_INFO("sc.orcus.style", "set format range: " << xf_index);
1221 ScPatternAttr aPattern(mrDoc.getDoc().GetPool());
1222 mrStyles.applyXfToItemSet(aPattern.GetItemSet(), xf_index);
1223 mrDoc.getDoc().ApplyPatternAreaTab(col_start, row_start, col_end, row_end, mnTab, aPattern);
1224}
1225
1226orcus::spreadsheet::range_size_t ScOrcusSheet::get_sheet_size() const
1227{
1228 orcus::spreadsheet::range_size_t ret;
1229 ret.rows = MAXROWCOUNT;
1230 ret.columns = MAXCOLCOUNT;
1231
1232 return ret;
1233}
1234
1235void ScOrcusSheet::fill_down_cells(os::row_t row, os::col_t col, os::row_t range_size)
1236{
1237 mrFactory.pushFillDownCellsToken(ScAddress(col, row, mnTab), range_size);
1238 cellInserted();
1239}
1240
1242{
1243 return maFormulaGroups;
1244}
1245
1247{
1248 return maFormulaGroups;
1249}
1250
1252{
1253 return mrFactory;
1254}
1255
1257 mrFactory(rFactory) {}
1258
1259size_t ScOrcusSharedStrings::append(std::string_view s)
1260{
1261 OUString aNewString(s.data(), s.size(), mrFactory.getGlobalSettings().getTextEncoding());
1262 return mrFactory.appendString(aNewString);
1263}
1264
1265size_t ScOrcusSharedStrings::add(std::string_view s)
1266{
1267 OUString aNewString(s.data(), s.size(), mrFactory.getGlobalSettings().getTextEncoding());
1268 return mrFactory.addString(aNewString);
1269}
1270
1272{
1273}
1274
1276{
1277}
1278
1280{
1281}
1282
1284{
1285}
1286
1288{
1289}
1290
1291void ScOrcusSharedStrings::set_segment_font_color(orcus::spreadsheet::color_elem_t,
1292 orcus::spreadsheet::color_elem_t,
1293 orcus::spreadsheet::color_elem_t,
1294 orcus::spreadsheet::color_elem_t)
1295{
1296}
1297
1299{
1300 maCurSegment.append(s.data(), s.size());
1301}
1302
1304{
1305 OString aStr = maCurSegment.makeStringAndClear();
1306 return mrFactory.addString(
1307 OStringToOUString(aStr, mrFactory.getGlobalSettings().getTextEncoding()));
1308}
1309
1310ScOrcusStyles::ScOrcusStyles( ScOrcusFactory& rFactory, bool bSkipDefaultStyles ) :
1311 mrFactory(rFactory)
1312{
1313 ScDocument& rDoc = rFactory.getDoc().getDoc();
1314 if (!bSkipDefaultStyles && !rDoc.GetStyleSheetPool()->HasStandardStyles())
1316}
1317
1318/*
1319namespace {
1320
1321std::ostream& operator<<(std::ostream& rStrm, const Color& rColor)
1322{
1323 rStrm << "Red: " << (int)rColor.GetRed() << ", Green: " << (int)rColor.GetGreen() << ", Blue: " << (int)rColor.GetBlue();
1324 return rStrm;
1325}
1326
1327}
1328*/
1329
1331{
1332 if (mbItalic)
1333 {
1338 }
1339
1340 if (mbBold)
1341 {
1346 }
1347
1348 if (maColor)
1350
1351 if (maName && !maName->isEmpty())
1352 rSet.Put( SvxFontItem( FAMILY_DONTKNOW, *maName, *maName, PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, ATTR_FONT ));
1353
1354 if (mnSize)
1355 {
1356 double fSize = translateToInternal(*mnSize, orcus::length_unit_t::point);
1360 }
1361
1362 if (meUnderline)
1363 {
1365 if (maUnderlineColor)
1366 aUnderline.SetColor(*maUnderlineColor);
1367 rSet.Put(aUnderline);
1368 }
1369
1370 if (meStrikeout)
1372}
1373
1375{
1376 if (!mePattern || !maFgColor)
1377 return;
1378
1379 if (*mePattern == os::fill_pattern_t::solid)
1380 rSet.Put(SvxBrushItem(*maFgColor, ATTR_BACKGROUND));
1381}
1382
1384{
1385 if (!mbLocked && !mbHidden && !mbPrintContent && !mbFormulaHidden)
1386 return;
1387
1388 bool bLocked = mbLocked.value_or(true); // defaults to true.
1389 bool bHidden = mbHidden.value_or(false);
1390 bool bFormulaHidden = mbFormulaHidden.value_or(false);
1391 bool bPrintContent = mbPrintContent.value_or(false);
1392 rSet.Put(ScProtectionAttr(bLocked, bFormulaHidden, bHidden, bPrintContent));
1393}
1394
1395namespace {
1396
1397SvxBoxItemLine getDirection(os::border_direction_t dir)
1398{
1399 switch (dir)
1400 {
1401 case os::border_direction_t::right:
1402 return SvxBoxItemLine::RIGHT;
1403 case os::border_direction_t::left:
1404 return SvxBoxItemLine::LEFT;
1405 case os::border_direction_t::top:
1406 return SvxBoxItemLine::TOP;
1407 case os::border_direction_t::bottom:
1408 return SvxBoxItemLine::BOTTOM;
1409 default:
1410 break;
1411 }
1412 return SvxBoxItemLine::RIGHT;
1413}
1414
1415}
1416
1418{
1419 if (maBorders.empty())
1420 return;
1421
1422 SvxBoxItem aBoxItem(ATTR_BORDER);
1423 SvxLineItem aDiagonal_TLBR(ATTR_BORDER_TLBR);
1424 SvxLineItem aDiagonal_BLTR(ATTR_BORDER_BLTR);
1425
1426 for (const auto& [dir, attrs] : maBorders)
1427 {
1428 SvxBoxItemLine eDir = getDirection(dir);
1429
1430 SvxBorderLineStyle eStyle = attrs.meStyle.value_or(SvxBorderLineStyle::SOLID);
1431 Color aColor = attrs.maColor.value_or(COL_BLACK);
1432 double nWidth = attrs.mnWidth.value_or(0.0);
1433
1434 switch (dir)
1435 {
1436 case os::border_direction_t::diagonal_tl_br:
1437 {
1438 editeng::SvxBorderLine aLine(&aColor, nWidth, eStyle);
1439 aDiagonal_TLBR.SetLine(&aLine);
1440 break;
1441 }
1442 case os::border_direction_t::diagonal_bl_tr:
1443 {
1444 editeng::SvxBorderLine aLine(&aColor, nWidth, eStyle);
1445 aDiagonal_BLTR.SetLine(&aLine);
1446 break;
1447 }
1448 default:
1449 {
1450 editeng::SvxBorderLine aLine(&aColor, nWidth, eStyle);
1451 aBoxItem.SetLine(&aLine, eDir);
1452 }
1453 }
1454 }
1455
1456 rSet.Put(aDiagonal_BLTR);
1457 rSet.Put(aDiagonal_TLBR);
1458 rSet.Put(aBoxItem);
1459}
1460
1462{
1463 if (!maCode)
1464 return;
1465
1466 sal_uInt32 nKey;
1467 sal_Int32 nCheckPos;
1468 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
1469 OUString Code = *maCode; /* <-- Done because the SvNumberFormatter::PutEntry demands a non const NumFormat Code*/
1470 SvNumFormatType type = SvNumFormatType::ALL;
1471
1472 pFormatter->PutEntry(Code, nCheckPos, type, nKey, LANGUAGE_ENGLISH_US);
1473 if (!nCheckPos)
1475}
1476
1478 mnFontId(0),
1479 mnFillId(0),
1480 mnBorderId(0),
1481 mnProtectionId(0),
1482 mnNumberFormatId(0),
1483 mnStyleXf(0),
1484 mbAlignment(false),
1485 meHorAlignment(SvxCellHorJustify::Standard),
1486 meVerAlignment(SvxCellVerJustify::Standard),
1487 meHorAlignMethod(SvxCellJustifyMethod::Auto),
1488 meVerAlignMethod(SvxCellJustifyMethod::Auto)
1489{
1490}
1491
1493 maParentName(OUString(SC_STYLE_PROG_STANDARD)),
1494 mnXFId(0),
1495 mnBuiltInId(0)
1496{
1497}
1498
1500{
1501 size_t nFontId = rXf.mnFontId;
1502 if (nFontId >= maFonts.size())
1503 {
1504 SAL_WARN("sc.orcus.style", "invalid font id");
1505 return;
1506 }
1507
1508 maFonts[nFontId].applyToItemSet(rSet);
1509
1510 size_t nFillId = rXf.mnFillId;
1511 if (nFillId >= maFills.size())
1512 {
1513 SAL_WARN("sc.orcus.style", "invalid fill id");
1514 return;
1515 }
1516
1517 const fill& rFill = maFills[nFillId];
1518 rFill.applyToItemSet(rSet);
1519
1520 size_t nBorderId = rXf.mnBorderId;
1521 if (nBorderId >= maBorders.size())
1522 {
1523 SAL_WARN("sc.orcus.style", "invalid border id");
1524 return;
1525 }
1526 maBorders[nBorderId].applyToItemSet(rSet);
1527
1528 size_t nProtectionId = rXf.mnProtectionId;
1529 if (nProtectionId >= maProtections.size())
1530 {
1531 SAL_WARN("sc.orcus.style", "invalid protection id");
1532 return;
1533 }
1534
1535 maProtections[nProtectionId].applyToItemSet(rSet);
1536
1537 size_t nNumberFormatId = rXf.mnNumberFormatId;
1538 if (nNumberFormatId >= maNumberFormats.size())
1539 {
1540 SAL_WARN("sc.orcus.style", "invalid number format id");
1541 return;
1542 }
1543 const number_format& rFormat = maNumberFormats[nNumberFormatId];
1545
1546 if(rXf.mbAlignment)
1547 {
1552 }
1553}
1554
1556{
1557 SAL_INFO("sc.orcus.style", "applyXfToitemSet: " << xfId);
1558 if (maCellXfs.size() <= xfId)
1559 {
1560 SAL_WARN("sc.orcus.style", "invalid xf id");
1561 return;
1562 }
1563
1564 const xf& rXf = maCellXfs[xfId];
1565 applyXfToItemSet(rSet, rXf);
1566}
1567
1569{
1570 // needed at all?
1571}
1572
1574{
1576}
1577
1579{
1581}
1582
1583void ScOrcusStyles::set_font_name(std::string_view name)
1584{
1585 OUString aName(name.data(), name.size(), mrFactory.getGlobalSettings().getTextEncoding());
1587}
1588
1590{
1592}
1593
1594void ScOrcusStyles::set_font_underline(orcus::spreadsheet::underline_t e)
1595{
1596 switch(e)
1597 {
1598 case orcus::spreadsheet::underline_t::single_line:
1599 case orcus::spreadsheet::underline_t::single_accounting:
1601 break;
1602 case orcus::spreadsheet::underline_t::double_line:
1603 case orcus::spreadsheet::underline_t::double_accounting:
1605 break;
1606 case orcus::spreadsheet::underline_t::none:
1608 break;
1609 case orcus::spreadsheet::underline_t::dotted:
1611 break;
1612 case orcus::spreadsheet::underline_t::dash:
1614 break;
1615 case orcus::spreadsheet::underline_t::long_dash:
1617 break;
1618 case orcus::spreadsheet::underline_t::dot_dash:
1620 break;
1621 case orcus::spreadsheet::underline_t::dot_dot_dot_dash:
1622 maCurrentFont.meUnderline = LINESTYLE_DASHDOTDOT; // dot-dot-dot-dash is absent from underline types in libo
1623 break;
1624 case orcus::spreadsheet::underline_t::wave:
1626 break;
1627 default:
1628 ;
1629 }
1630}
1631
1632void ScOrcusStyles::set_font_underline_width(orcus::spreadsheet::underline_width_t e )
1633{
1634 if (e == orcus::spreadsheet::underline_width_t::bold || e == orcus::spreadsheet::underline_width_t::thick)
1635 {
1637 {
1638 switch (*maCurrentFont.meUnderline)
1639 {
1640 case LINESTYLE_NONE:
1641 case LINESTYLE_SINGLE:
1643 break;
1644 case LINESTYLE_DOTTED:
1646 break;
1647 case LINESTYLE_DASH:
1649 break;
1650 case LINESTYLE_LONGDASH:
1652 break;
1653 case LINESTYLE_DASHDOT:
1655 break;
1658 break;
1659 case LINESTYLE_WAVE:
1661 break;
1662 default:
1663 ;
1664 }
1665 }
1666 else
1668 }
1669}
1670
1671void ScOrcusStyles::set_font_underline_mode(orcus::spreadsheet::underline_mode_t /*e*/)
1672{
1673}
1674
1675void ScOrcusStyles::set_font_underline_type(orcus::spreadsheet::underline_type_t e )
1676{
1677 if (e == orcus::spreadsheet::underline_type_t::double_type)
1678 {
1680 {
1681 switch (*maCurrentFont.meUnderline)
1682 {
1683 case LINESTYLE_NONE:
1684 case LINESTYLE_SINGLE:
1686 break;
1687 case LINESTYLE_WAVE:
1689 break;
1690 default:
1691 ;
1692 }
1693 }
1694 else
1696 }
1697}
1698
1699void ScOrcusStyles::set_font_underline_color(orcus::spreadsheet::color_elem_t alpha,
1700 orcus::spreadsheet::color_elem_t red,
1701 orcus::spreadsheet::color_elem_t green,
1702 orcus::spreadsheet::color_elem_t blue)
1703{
1704 maCurrentFont.maUnderlineColor = Color(ColorAlpha, alpha, red, green, blue);
1705}
1706
1707void ScOrcusStyles::set_font_color(orcus::spreadsheet::color_elem_t alpha,
1708 orcus::spreadsheet::color_elem_t red,
1709 orcus::spreadsheet::color_elem_t green,
1710 orcus::spreadsheet::color_elem_t blue)
1711{
1712 maCurrentFont.maColor = Color(ColorAlpha, alpha, red, green, blue);
1713}
1714
1715void ScOrcusStyles::set_strikethrough_style(orcus::spreadsheet::strikethrough_style_t /*s*/)
1716{
1717}
1718
1719void ScOrcusStyles::set_strikethrough_type(orcus::spreadsheet::strikethrough_type_t s)
1720{
1722 {
1726 return;
1727 }
1728
1729 switch (s)
1730 {
1731 case os::strikethrough_type_t::unknown:
1733 break;
1734 case os::strikethrough_type_t::none:
1736 break;
1737 case os::strikethrough_type_t::single:
1739 break;
1740 case os::strikethrough_type_t::double_type:
1742 break;
1743 default:
1744 ;
1745 }
1746}
1747
1748void ScOrcusStyles::set_strikethrough_width(orcus::spreadsheet::strikethrough_width_t s)
1749{
1750 switch (s)
1751 {
1752 case os::strikethrough_width_t::bold:
1754 break;
1755 default:
1756 ;
1757 }
1758}
1759
1760void ScOrcusStyles::set_strikethrough_text(orcus::spreadsheet::strikethrough_text_t s)
1761{
1762 switch (s)
1763 {
1764 case os::strikethrough_text_t::slash:
1766 break;
1767 case os::strikethrough_text_t::cross:
1769 break;
1770 default:
1771 ;
1772 }
1773}
1774
1776{
1777 SAL_INFO("sc.orcus.style", "commit font");
1778 maFonts.push_back(maCurrentFont);
1780 return maFonts.size() - 1;
1781}
1782
1783// fill
1784
1786{
1787 // needed at all?
1788}
1789
1790void ScOrcusStyles::set_fill_pattern_type(orcus::spreadsheet::fill_pattern_t fp)
1791{
1793}
1794
1796 orcus::spreadsheet::color_elem_t alpha, orcus::spreadsheet::color_elem_t red, orcus::spreadsheet::color_elem_t green, orcus::spreadsheet::color_elem_t blue)
1797{
1798 maCurrentFill.maFgColor = Color(ColorAlpha, alpha, red, green, blue);
1799}
1800
1802 orcus::spreadsheet::color_elem_t alpha, orcus::spreadsheet::color_elem_t red, orcus::spreadsheet::color_elem_t green, orcus::spreadsheet::color_elem_t blue)
1803{
1804 maCurrentFill.maBgColor = Color(ColorAlpha, alpha, red, green, blue);
1805}
1806
1808{
1809 SAL_INFO("sc.orcus.style", "commit fill");
1810 maFills.push_back(maCurrentFill);
1812 return maFills.size() - 1;
1813}
1814
1815// border
1816
1818{
1819 // needed at all?
1820}
1821
1823 orcus::spreadsheet::border_direction_t dir, orcus::spreadsheet::border_style_t style)
1824{
1826
1827 switch (style)
1828 {
1829 case orcus::spreadsheet::border_style_t::solid:
1830 rBorder.meStyle = SvxBorderLineStyle::SOLID;
1832 break;
1833 case orcus::spreadsheet::border_style_t::hair:
1834 rBorder.meStyle = SvxBorderLineStyle::SOLID;
1836 break;
1837 case orcus::spreadsheet::border_style_t::medium:
1838 rBorder.meStyle = SvxBorderLineStyle::SOLID;
1840 break;
1841 case orcus::spreadsheet::border_style_t::thick:
1842 rBorder.meStyle = SvxBorderLineStyle::SOLID;
1844 break;
1845 case orcus::spreadsheet::border_style_t::thin:
1846 rBorder.meStyle = SvxBorderLineStyle::SOLID;
1848 break;
1849 case orcus::spreadsheet::border_style_t::dash_dot:
1850 rBorder.meStyle = SvxBorderLineStyle::DASH_DOT;
1852 break;
1853 case orcus::spreadsheet::border_style_t::dash_dot_dot:
1854 rBorder.meStyle = SvxBorderLineStyle::DASH_DOT_DOT;
1856 break;
1857 case orcus::spreadsheet::border_style_t::dashed:
1858 rBorder.meStyle = SvxBorderLineStyle::DASHED;
1860 break;
1861 case orcus::spreadsheet::border_style_t::dotted:
1862 rBorder.meStyle = SvxBorderLineStyle::DOTTED;
1864 break;
1865 case orcus::spreadsheet::border_style_t::double_border:
1866 rBorder.meStyle = SvxBorderLineStyle::DOUBLE;
1868 break;
1869 case orcus::spreadsheet::border_style_t::medium_dash_dot:
1870 case orcus::spreadsheet::border_style_t::slant_dash_dot:
1871 rBorder.meStyle = SvxBorderLineStyle::DASH_DOT;
1873 break;
1874 case orcus::spreadsheet::border_style_t::medium_dash_dot_dot:
1875 rBorder.meStyle = SvxBorderLineStyle::DASH_DOT_DOT;
1877 break;
1878 case orcus::spreadsheet::border_style_t::medium_dashed:
1879 rBorder.meStyle = SvxBorderLineStyle::DASHED;
1881 break;
1882 case orcus::spreadsheet::border_style_t::unknown:
1883 case orcus::spreadsheet::border_style_t::none:
1885 break;
1886 default:
1887 ;
1888 }
1889}
1890
1891void ScOrcusStyles::set_border_color(orcus::spreadsheet::border_direction_t dir,
1892 orcus::spreadsheet::color_elem_t alpha,
1893 orcus::spreadsheet::color_elem_t red,
1894 orcus::spreadsheet::color_elem_t green,
1895 orcus::spreadsheet::color_elem_t blue)
1896{
1897 border::border_line& current_line = maCurrentBorder.maBorders[dir];
1898 current_line.maColor = Color(ColorAlpha, alpha, red, green, blue);
1899}
1900
1901void ScOrcusStyles::set_border_width(orcus::spreadsheet::border_direction_t dir, double val, orcus::length_unit_t unit )
1902{
1903 border::border_line& current_line = maCurrentBorder.maBorders[dir];
1904 current_line.mnWidth = translateToInternal(val, unit);
1905}
1906
1908{
1909 SAL_INFO("sc.orcus.style", "commit border");
1910 maBorders.push_back(maCurrentBorder);
1912 return maBorders.size() - 1;
1913}
1914
1915// cell protection
1917{
1919}
1920
1922{
1924}
1925
1927{
1929}
1930
1932{
1934}
1935
1937{
1938 SAL_INFO("sc.orcus.style", "commit cell protection");
1941 return maProtections.size() - 1;
1942}
1943
1945{
1946}
1947
1949{
1950}
1951
1953{
1954 OUString aCode(s.data(), s.size(), mrFactory.getGlobalSettings().getTextEncoding());
1956}
1957
1959{
1960 SAL_INFO("sc.orcus.style", "commit number format");
1963 return maNumberFormats.size() - 1;
1964}
1965
1966// cell style xf
1967
1969{
1970 // needed at all?
1971}
1972
1974{
1975 SAL_INFO("sc.orcus.style", "commit cell style xf");
1976 maCellStyleXfs.push_back(maCurrentXF);
1977 return maCellStyleXfs.size() - 1;
1978}
1979
1980// cell xf
1981
1983{
1984 // needed at all?
1985}
1986
1988{
1989 SAL_INFO("sc.orcus.style", "commit cell xf");
1990 maCellXfs.push_back(maCurrentXF);
1991 return maCellXfs.size() - 1;
1992}
1993
1994// dxf
1995
1997{
1998}
1999
2001{
2002 return 0;
2003}
2004
2005// xf (cell format) - used both by cell xf and cell style xf.
2006
2008{
2010}
2011
2013{
2015}
2016
2018{
2020}
2021
2023{
2025}
2026
2028{
2030}
2031
2033{
2035}
2036
2038{
2039}
2040
2041void ScOrcusStyles::set_xf_horizontal_alignment(orcus::spreadsheet::hor_alignment_t align)
2042{
2043 switch (align)
2044 {
2045 case os::hor_alignment_t::left:
2046 maCurrentXF.meHorAlignment = SvxCellHorJustify::Left;
2047 break;
2048 case os::hor_alignment_t::right:
2049 maCurrentXF.meHorAlignment = SvxCellHorJustify::Right;
2050 break;
2051 case os::hor_alignment_t::center:
2052 maCurrentXF.meHorAlignment = SvxCellHorJustify::Center;
2053 break;
2054 case os::hor_alignment_t::justified:
2055 maCurrentXF.meHorAlignment = SvxCellHorJustify::Block;
2056 break;
2057 case os::hor_alignment_t::distributed:
2058 maCurrentXF.meHorAlignment = SvxCellHorJustify::Block;
2059 maCurrentXF.meHorAlignMethod = SvxCellJustifyMethod::Distribute;
2060 break;
2061 case os::hor_alignment_t::unknown:
2062 maCurrentXF.meHorAlignment = SvxCellHorJustify::Standard;
2063 break;
2064 default:
2065 ;
2066 }
2067 maCurrentXF.mbAlignment = true;
2068}
2069
2070void ScOrcusStyles::set_xf_vertical_alignment(orcus::spreadsheet::ver_alignment_t align)
2071{
2072 switch (align)
2073 {
2074 case os::ver_alignment_t::top:
2075 maCurrentXF.meVerAlignment = SvxCellVerJustify::Top;
2076 break;
2077 case os::ver_alignment_t::bottom:
2078 maCurrentXF.meVerAlignment = SvxCellVerJustify::Bottom;
2079 break;
2080 case os::ver_alignment_t::middle:
2081 maCurrentXF.meVerAlignment = SvxCellVerJustify::Center;
2082 break;
2083 case os::ver_alignment_t::justified:
2084 maCurrentXF.meVerAlignment = SvxCellVerJustify::Block;
2085 break;
2086 case os::ver_alignment_t::distributed:
2087 maCurrentXF.meVerAlignment = SvxCellVerJustify::Block;
2088 maCurrentXF.meVerAlignMethod = SvxCellJustifyMethod::Distribute;
2089 break;
2090 case os::ver_alignment_t::unknown:
2091 maCurrentXF.meVerAlignment = SvxCellVerJustify::Standard;
2092 break;
2093 default:
2094 ;
2095 }
2096 maCurrentXF.mbAlignment = true;
2097}
2098
2099// cell style entry
2100// not needed for now for gnumeric
2101
2103{
2104 // needed at all?
2105}
2106
2107void ScOrcusStyles::set_cell_style_name(std::string_view name)
2108{
2109 OUString aName(name.data(), name.size(), mrFactory.getGlobalSettings().getTextEncoding());
2111}
2112
2114{
2116}
2117
2119{
2120 // not needed for gnumeric
2122}
2123
2125{
2126 const OUString aParentName(name.data(), name.size(), mrFactory.getGlobalSettings().getTextEncoding());
2127 maCurrentCellStyle.maParentName = aParentName;
2128}
2129
2131{
2132 SAL_INFO("sc.orcus.style", "commit cell style: " << maCurrentCellStyle.maName);
2134 {
2135 SAL_WARN("sc.orcus.style", "invalid xf id for commit cell style");
2136 return 0;
2137 }
2138 if (maCurrentCellStyle.mnXFId == 0)
2139 {
2140 return 0;
2141 }
2142
2144 SfxStyleSheetBase& rBase = pPool->Make(maCurrentCellStyle.maName, SfxStyleFamily::Para);
2145 // Need to convert the parent name to localized UI name, see tdf#139205.
2147 SfxStyleFamily::Para));
2148 SfxItemSet& rSet = rBase.GetItemSet();
2149
2151 applyXfToItemSet(rSet, rXf);
2152
2155
2156 return 0;
2157}
2158
2159// auto filter import
2160
2162 mrGlobalSettings(rGS)
2163{
2164}
2165
2167{
2168}
2169
2170void ScOrcusAutoFilter::set_range(const orcus::spreadsheet::range_t& range)
2171{
2172 maRange.aStart.SetRow(range.first.row);
2173 maRange.aStart.SetCol(range.first.column);
2174 maRange.aEnd.SetRow(range.last.row);
2175 maRange.aEnd.SetCol(range.last.column);
2176}
2177
2178void ScOrcusAutoFilter::set_column(orcus::spreadsheet::col_t col)
2179{
2180 SAL_INFO("sc.orcus.autofilter", "set_column: " << col);
2181}
2182
2184{
2185 OUString aString(value.data(), value.size(), mrGlobalSettings.getTextEncoding());
2186 SAL_INFO("sc.orcus.autofilter", "append_column_match_value: " << aString);
2187}
2188
2190{
2191 SAL_INFO("sc.orcus.autofilter", "commit column");
2192}
2193
2195{
2196 SAL_INFO("sc.orcus.autofilter", "commit");
2197}
2198
2199/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SCCOL MAXCOLCOUNT
Definition: address.hxx:63
const SCROW MAXROWCOUNT
Definition: address.hxx:62
OUString maFormula
SvxBorderLineStyle
SvxBoxItemLine
sal_Int32 day
sal_Int32 year
sal_Int32 month
SCTAB Tab() const
Definition: address.hxx:283
void SetCol(SCCOL nColP)
Definition: address.hxx:291
void IncCol(SCCOL nDelta=1)
Definition: address.hxx:316
bool IsValid() const
Definition: address.hxx:305
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const Details &rDetails=detailsOOOa1, ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, sal_Int32 *pSheetEndPos=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1537
SCROW Row() const
Definition: address.hxx:274
void SetRow(SCROW nRowP)
Definition: address.hxx:287
void SetTab(SCTAB nTabP)
Definition: address.hxx:295
void IncRow(SCROW nDelta=1)
Definition: address.hxx:312
SCCOL Col() const
Definition: address.hxx:279
std::unique_ptr< ScTokenArray > CompileString(const OUString &rFormula)
Tokenize formula expression string into an array of tokens.
Definition: compiler.cxx:4687
Accessor class to ScDocument.
void setMatrixCells(const ScRange &rRange, const ScTokenArray &rArray, formula::FormulaGrammar::Grammar eGrammar)
void setOriginDate(sal_uInt16 nYear, sal_uInt16 nMonth, sal_uInt16 nDay)
void setMergedCells(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
void setStringCell(const ScAddress &rPos, const OUString &rStr)
bool appendSheet(const OUString &rName)
void setFormulaCell(const ScAddress &rPos, const OUString &rFormula, formula::FormulaGrammar::Grammar eGrammar, const double *pResult=nullptr)
ScDocument & getDoc()
void setSheetName(SCTAB nTab, const OUString &rName)
SCTAB getSheetCount() const
SCTAB getSheetIndex(const OUString &rName) const
void setNumericCell(const ScAddress &rPos, double fVal)
void fillDownCells(const ScAddress &rPos, SCROW nFillSize)
void setAutoInput(const ScAddress &rPos, const OUString &rStr, const ScSetStringParam *pStringParam=nullptr)
SC_DLLPUBLIC void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bHidden)
Definition: document.cxx:4531
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6170
SC_DLLPUBLIC void ApplyPatternAreaTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, const ScPatternAttr &rAttr)
Definition: document.cxx:4864
SC_DLLPUBLIC void ApplyPattern(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr &rAttr)
Definition: document.cxx:4841
SC_DLLPUBLIC void SetColWidthOnly(SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth)
Definition: document.cxx:4153
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6175
SC_DLLPUBLIC void SetRowHeightOnly(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt16 nNewHeight)
Definition: document.cxx:4172
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
Definition: documen2.cxx:603
SC_DLLPUBLIC void SetRowHidden(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHidden)
Definition: document.cxx:4523
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:467
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:174
virtual void set_formula(orcus::spreadsheet::formula_grammar_t grammar, std::string_view formula) override
Definition: interface.cxx:1075
virtual void set_range(const orcus::spreadsheet::range_t &range) override
Definition: interface.cxx:1066
ScOrcusArrayFormula(ScOrcusSheet &rSheet)
Definition: interface.cxx:1056
virtual void set_result_empty(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col) override
Definition: interface.cxx:1091
virtual void commit() override
Definition: interface.cxx:1101
ScOrcusSheet & mrSheet
virtual void set_result_bool(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, bool value) override
Definition: interface.cxx:1096
virtual void set_result_string(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, std::string_view value) override
Definition: interface.cxx:1086
virtual void set_result_value(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, double value) override
Definition: interface.cxx:1081
formula::FormulaGrammar::Grammar meGrammar
virtual ~ScOrcusArrayFormula() override
Definition: interface.cxx:1064
virtual void set_column(orcus::spreadsheet::col_t col) override
Definition: interface.cxx:2178
virtual void commit() override
Definition: interface.cxx:2194
const ScOrcusGlobalSettings & mrGlobalSettings
virtual void append_column_match_value(std::string_view value) override
Definition: interface.cxx:2183
ScOrcusAutoFilter(const ScOrcusGlobalSettings &rGS)
Definition: interface.cxx:2161
virtual void commit_column() override
Definition: interface.cxx:2189
virtual void set_range(const orcus::spreadsheet::range_t &range) override
Definition: interface.cxx:2170
virtual ~ScOrcusAutoFilter() override
Definition: interface.cxx:2166
virtual ~ScOrcusConditionalFormat() override
Definition: interface.cxx:766
virtual void commit_entry() override
Definition: interface.cxx:887
ScOrcusConditionalFormat(SCTAB nTab, ScDocument &rDoc)
Definition: interface.cxx:758
virtual void set_iconset_reverse(bool reverse) override
Definition: interface.cxx:847
virtual void set_databar_color_positive(orcus::spreadsheet::color_elem_t alpha, orcus::spreadsheet::color_elem_t red, orcus::spreadsheet::color_elem_t green, orcus::spreadsheet::color_elem_t blue) override
Definition: interface.cxx:816
virtual void set_show_value(bool show) override
Definition: interface.cxx:842
virtual void set_type(orcus::spreadsheet::conditional_format_t type) override
Definition: interface.cxx:863
virtual void set_xf_id(size_t xf) override
Definition: interface.cxx:853
virtual void set_databar_gradient(bool gradient) override
Definition: interface.cxx:804
virtual void commit_format() override
Definition: interface.cxx:905
virtual void set_operator(orcus::spreadsheet::condition_operator_t condition_type) override
Definition: interface.cxx:858
virtual void set_databar_color_negative(orcus::spreadsheet::color_elem_t alpha, orcus::spreadsheet::color_elem_t red, orcus::spreadsheet::color_elem_t green, orcus::spreadsheet::color_elem_t blue) override
Definition: interface.cxx:823
virtual void set_range(std::string_view range) override
Definition: interface.cxx:892
virtual void set_date(orcus::spreadsheet::condition_date_t date) override
Definition: interface.cxx:787
virtual void set_formula(std::string_view formula) override
Definition: interface.cxx:782
virtual void set_icon_name(std::string_view name) override
Definition: interface.cxx:798
virtual void commit_condition() override
Definition: interface.cxx:793
virtual void set_databar_axis(orcus::spreadsheet::databar_axis_t axis) override
Definition: interface.cxx:810
virtual void set_condition_type(orcus::spreadsheet::condition_type_t type) override
Definition: interface.cxx:776
std::unique_ptr< ScConditionalFormat > mpCurrentFormat
ScFormatEntry::Type meEntryType
virtual void set_color(orcus::spreadsheet::color_elem_t alpha, orcus::spreadsheet::color_elem_t red, orcus::spreadsheet::color_elem_t green, orcus::spreadsheet::color_elem_t blue) override
Definition: interface.cxx:770
virtual void set_min_databar_length(double length) override
Definition: interface.cxx:830
virtual void set_max_databar_length(double length) override
Definition: interface.cxx:836
ScOrcusGlobalSettings maGlobalSettings
void pushSharedFormulaToken(const ScAddress &rPos, uint32_t nIndex)
Definition: interface.cxx:593
virtual void finalize() override
Definition: interface.cxx:407
StringHashType maStringHash
virtual orcus::spreadsheet::iface::import_shared_strings * get_shared_strings() override
Definition: interface.cxx:392
std::vector< std::unique_ptr< ScOrcusSheet > > maSheets
void pushMatrixFormulaToken(const ScAddress &rPos, const OUString &rFormula, formula::FormulaGrammar::Grammar eGrammar, uint32_t nRowRange, uint32_t nColRange)
Definition: interface.cxx:599
virtual orcus::spreadsheet::iface::import_named_expression * get_named_expression() override
Definition: interface.cxx:397
ScOrcusStyles maStyles
ScDocumentImport maDoc
void pushCellStoreToken(const ScAddress &rPos, uint32_t nStrIndex)
Definition: interface.cxx:571
size_t addString(const OUString &rStr)
Definition: interface.cxx:550
virtual orcus::spreadsheet::iface::import_global_settings * get_global_settings() override
Definition: interface.cxx:387
void pushFillDownCellsToken(const ScAddress &rPos, uint32_t nFillSize)
Definition: interface.cxx:587
void pushFormulaResult(const ScAddress &rPos, double fValue)
Definition: interface.cxx:611
const ScOrcusGlobalSettings & getGlobalSettings() const
Definition: interface.cxx:687
void setStatusIndicator(const css::uno::Reference< css::task::XStatusIndicator > &rIndicator)
Definition: interface.cxx:682
ScOrcusSharedStrings maSharedStrings
ScDocumentImport & getDoc()
Definition: interface.cxx:536
void incrementProgress()
Definition: interface.cxx:663
virtual orcus::spreadsheet::iface::import_styles * get_styles() override
Definition: interface.cxx:402
ScOrcusFactory(ScDocument &rDoc, bool bSkipDefaultStyles=false)
Definition: interface.cxx:305
std::vector< OUString > maStrings
size_t appendString(const OUString &rStr)
Definition: interface.cxx:541
ScOrcusNamedExpression maNamedExpressions
virtual orcus::spreadsheet::iface::import_sheet * append_sheet(orcus::spreadsheet::sheet_t sheet_index, std::string_view sheet_name) override
Definition: interface.cxx:313
CellStoreTokensType maCellStoreTokens
virtual orcus::spreadsheet::iface::import_sheet * get_sheet(std::string_view sheet_name) override
Definition: interface.cxx:350
void pushCellStoreAutoToken(const ScAddress &rPos, const OUString &rVal)
Definition: interface.cxx:565
const OUString * getString(size_t nIndex) const
Definition: interface.cxx:560
css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator
ScOrcusFormula(ScOrcusSheet &rSheet)
Definition: interface.cxx:939
virtual ~ScOrcusFormula() override
Definition: interface.cxx:949
virtual void set_result_value(double value) override
Definition: interface.cxx:969
virtual void set_formula(orcus::spreadsheet::formula_grammar_t grammar, std::string_view formula) override
Definition: interface.cxx:957
virtual void set_result_bool(bool value) override
Definition: interface.cxx:986
size_t mnSharedFormulaIndex
formula::FormulaGrammar::Grammar meGrammar
virtual void set_result_empty() override
Definition: interface.cxx:981
virtual void set_shared_formula_index(size_t index) override
Definition: interface.cxx:963
ResultType meResType
virtual void set_result_string(std::string_view value) override
Definition: interface.cxx:975
ScOrcusSheet & mrSheet
virtual void set_position(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col) override
Definition: interface.cxx:951
virtual void commit() override
Definition: interface.cxx:992
virtual void set_character_set(orcus::character_set_t cs) override
Definition: interface.cxx:100
orcus::spreadsheet::formula_grammar_t meOrcusGrammar
ScOrcusGlobalSettings(ScDocumentImport &rDoc)
Definition: interface.cxx:87
formula::FormulaGrammar::Grammar getCalcGrammar() const
ScDocumentImport & getDoc() const
virtual orcus::spreadsheet::formula_grammar_t get_default_formula_grammar() const override
Definition: interface.cxx:158
rtl_TextEncoding mnTextEncoding
virtual void set_default_formula_grammar(orcus::spreadsheet::formula_grammar_t grammar) override
Definition: interface.cxx:152
formula::FormulaGrammar::Grammar meCalcGrammar
rtl_TextEncoding getTextEncoding() const
ScDocumentImport & mrDoc
virtual void set_origin_date(int year, int month, int day) override
Definition: interface.cxx:95
virtual void set_base_position(const orcus::spreadsheet::src_address_t &pos) override
Definition: interface.cxx:230
const ScOrcusGlobalSettings & mrGlobalSettings
virtual void set_named_range(std::string_view name, std::string_view range) override
Definition: interface.cxx:243
ScDocumentImport & mrDoc
virtual void set_named_expression(std::string_view name, std::string_view expression) override
Definition: interface.cxx:237
ScOrcusNamedExpression(ScDocumentImport &rDoc, const ScOrcusGlobalSettings &rGS, SCTAB nTab=-1)
Definition: interface.cxx:217
virtual void commit() override
Definition: interface.cxx:248
const ScOrcusGlobalSettings & mrGlobalSettings
orcus::spreadsheet::src_range_t resolve_range(std::string_view range) override
Definition: interface.cxx:190
orcus::spreadsheet::src_address_t resolve_address(std::string_view address) override
Definition: interface.cxx:166
ScOrcusRefResolver(const ScOrcusGlobalSettings &rGS)
Definition: interface.cxx:163
virtual void append_segment(std::string_view s) override
Definition: interface.cxx:1298
virtual size_t append(std::string_view s) override
Definition: interface.cxx:1259
virtual void set_segment_italic(bool b) override
Definition: interface.cxx:1279
virtual size_t add(std::string_view s) override
Definition: interface.cxx:1265
OStringBuffer maCurSegment
virtual void set_segment_bold(bool b) override
Definition: interface.cxx:1275
virtual void set_segment_font_color(orcus::spreadsheet::color_elem_t alpha, orcus::spreadsheet::color_elem_t red, orcus::spreadsheet::color_elem_t green, orcus::spreadsheet::color_elem_t blue) override
Definition: interface.cxx:1291
ScOrcusFactory & mrFactory
virtual void set_segment_font_size(double point) override
Definition: interface.cxx:1287
virtual size_t commit_segments() override
Definition: interface.cxx:1303
ScOrcusSharedStrings(ScOrcusFactory &rFactory)
Definition: interface.cxx:1256
virtual void set_segment_font(size_t font_index) override
Definition: interface.cxx:1271
virtual void set_segment_font_name(std::string_view s) override
Definition: interface.cxx:1283
virtual void set_column_hidden(orcus::spreadsheet::col_t col, bool hidden) override
Definition: interface.cxx:735
virtual void set_merge_cell_range(const orcus::spreadsheet::range_t &range) override
Definition: interface.cxx:753
virtual void set_column_width(orcus::spreadsheet::col_t col, double width, orcus::length_unit_t unit) override
Definition: interface.cxx:729
virtual void set_row_hidden(orcus::spreadsheet::row_t row, bool hidden) override
Definition: interface.cxx:747
virtual ~ScOrcusSheetProperties() override
Definition: interface.cxx:698
virtual void set_row_height(orcus::spreadsheet::row_t row, double height, orcus::length_unit_t unit) override
Definition: interface.cxx:741
ScOrcusSheetProperties(SCTAB nTab, ScDocumentImport &rDoc)
Definition: interface.cxx:692
ScDocumentImport & mrDoc
virtual orcus::spreadsheet::iface::import_formula * get_formula() override
Definition: interface.cxx:1148
virtual orcus::spreadsheet::iface::import_conditional_format * get_conditional_format() override
Definition: interface.cxx:1138
virtual void set_bool(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, bool value) override
Definition: interface.cxx:1179
ScOrcusSheetProperties maProperties
ScOrcusFactory & mrFactory
void cellInserted()
Definition: interface.cxx:1108
ScDocumentImport & mrDoc
ScOrcusConditionalFormat maConditionalFormat
SCTAB getIndex() const
virtual void fill_down_cells(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::row_t range_size) override
Definition: interface.cxx:1235
ScOrcusArrayFormula maArrayFormula
ScOrcusFactory & getFactory()
Definition: interface.cxx:1251
virtual orcus::spreadsheet::iface::import_sheet_properties * get_sheet_properties() override
Definition: interface.cxx:1133
virtual void set_value(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, double value) override
Definition: interface.cxx:1173
virtual void set_auto(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, std::string_view value) override
Definition: interface.cxx:1160
virtual void set_date_time(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, int year, int month, int day, int hour, int minute, double second) override
Definition: interface.cxx:1185
virtual orcus::spreadsheet::iface::import_table * get_table() override
Definition: interface.cxx:1128
virtual orcus::spreadsheet::iface::import_array_formula * get_array_formula() override
Definition: interface.cxx:1154
sc::SharedFormulaGroups maFormulaGroups
virtual void set_format(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t xf_index) override
ScOrcusAutoFilter maAutoFilter
const sc::SharedFormulaGroups & getSharedFormulaGroups() const
Definition: interface.cxx:1241
virtual orcus::spreadsheet::iface::import_auto_filter * get_auto_filter() override
Definition: interface.cxx:1123
virtual orcus::spreadsheet::iface::import_named_expression * get_named_expression() override
Definition: interface.cxx:1143
virtual orcus::spreadsheet::range_size_t get_sheet_size() const override
Definition: interface.cxx:1226
ScOrcusNamedExpression maNamedExpressions
ScOrcusFormula maFormula
ScOrcusSheet(ScDocumentImport &rDoc, SCTAB nTab, ScOrcusFactory &rFactory)
Definition: interface.cxx:911
ScDocumentImport & getDoc()
Definition: interface.cxx:1118
virtual void set_string(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::string_id_t sindex) override
Definition: interface.cxx:1167
ScOrcusStyles & mrStyles
virtual void set_fill_fg_color(orcus::spreadsheet::color_elem_t alpha, orcus::spreadsheet::color_elem_t red, orcus::spreadsheet::color_elem_t green, orcus::spreadsheet::color_elem_t blue) override
Definition: interface.cxx:1795
virtual void set_cell_formula_hidden(bool b) override
Definition: interface.cxx:1931
virtual void set_dxf_count(size_t count) override
Definition: interface.cxx:1996
std::vector< font > maFonts
cell_style maCurrentCellStyle
std::vector< fill > maFills
virtual void set_fill_bg_color(orcus::spreadsheet::color_elem_t alpha, orcus::spreadsheet::color_elem_t red, orcus::spreadsheet::color_elem_t green, orcus::spreadsheet::color_elem_t blue) override
Definition: interface.cxx:1801
virtual void set_strikethrough_type(orcus::spreadsheet::strikethrough_type_t s) override
Definition: interface.cxx:1719
virtual void set_cell_hidden(bool b) override
Definition: interface.cxx:1916
virtual void set_xf_apply_alignment(bool b) override
Definition: interface.cxx:2037
std::vector< number_format > maNumberFormats
virtual void set_cell_xf_count(size_t n) override
Definition: interface.cxx:1982
protection maCurrentProtection
virtual void set_border_width(orcus::spreadsheet::border_direction_t dir, double val, orcus::length_unit_t unit) override
Definition: interface.cxx:1901
virtual void set_cell_style_xf(size_t index) override
Definition: interface.cxx:2113
std::vector< xf > maCellXfs
virtual void set_xf_number_format(size_t index) override
Definition: interface.cxx:2007
virtual void set_font_name(std::string_view name) override
Definition: interface.cxx:1583
virtual void set_font_italic(bool b) override
Definition: interface.cxx:1578
virtual void set_strikethrough_text(orcus::spreadsheet::strikethrough_text_t s) override
Definition: interface.cxx:1760
std::vector< protection > maProtections
virtual void set_font_underline(orcus::spreadsheet::underline_t e) override
Definition: interface.cxx:1594
virtual size_t commit_dxf() override
Definition: interface.cxx:2000
virtual void set_border_style(orcus::spreadsheet::border_direction_t dir, orcus::spreadsheet::border_style_t style) override
Definition: interface.cxx:1822
virtual size_t commit_cell_style_xf() override
Definition: interface.cxx:1973
number_format maCurrentNumberFormat
virtual void set_cell_style_xf_count(size_t n) override
Definition: interface.cxx:1968
std::vector< xf > maCellStyleXfs
virtual size_t commit_cell_protection() override
Definition: interface.cxx:1936
virtual void set_xf_horizontal_alignment(orcus::spreadsheet::hor_alignment_t align) override
Definition: interface.cxx:2041
virtual void set_strikethrough_style(orcus::spreadsheet::strikethrough_style_t s) override
Definition: interface.cxx:1715
virtual void set_border_count(size_t n) override
Definition: interface.cxx:1817
ScOrcusStyles(ScOrcusFactory &rFactory, bool bSkipDefaultStyles=false)
Definition: interface.cxx:1310
virtual void set_strikethrough_width(orcus::spreadsheet::strikethrough_width_t s) override
Definition: interface.cxx:1748
virtual void set_cell_style_name(std::string_view name) override
Definition: interface.cxx:2107
virtual void set_xf_protection(size_t index) override
Definition: interface.cxx:2027
virtual size_t commit_fill() override
Definition: interface.cxx:1807
virtual void set_xf_font(size_t index) override
Definition: interface.cxx:2012
virtual size_t commit_number_format() override
Definition: interface.cxx:1958
virtual void set_font_size(double point) override
Definition: interface.cxx:1589
virtual void set_font_underline_width(orcus::spreadsheet::underline_width_t e) override
Definition: interface.cxx:1632
ScOrcusFactory & mrFactory
virtual void set_font_color(orcus::spreadsheet::color_elem_t alpha, orcus::spreadsheet::color_elem_t red, orcus::spreadsheet::color_elem_t green, orcus::spreadsheet::color_elem_t blue) override
Definition: interface.cxx:1707
virtual void set_cell_style_count(size_t n) override
Definition: interface.cxx:2102
virtual void set_xf_vertical_alignment(orcus::spreadsheet::ver_alignment_t align) override
Definition: interface.cxx:2070
virtual size_t commit_font() override
Definition: interface.cxx:1775
virtual void set_font_bold(bool b) override
Definition: interface.cxx:1573
virtual void set_cell_print_content(bool b) override
Definition: interface.cxx:1926
virtual void set_cell_locked(bool b) override
Definition: interface.cxx:1921
void applyXfToItemSet(SfxItemSet &rSet, const xf &rXf)
Definition: interface.cxx:1499
virtual size_t commit_cell_xf() override
Definition: interface.cxx:1987
virtual void set_cell_style_builtin(size_t index) override
Definition: interface.cxx:2118
virtual void set_font_underline_mode(orcus::spreadsheet::underline_mode_t e) override
Definition: interface.cxx:1671
virtual void set_number_format_code(std::string_view s) override
Definition: interface.cxx:1952
virtual void set_border_color(orcus::spreadsheet::border_direction_t dir, orcus::spreadsheet::color_elem_t alpha, orcus::spreadsheet::color_elem_t red, orcus::spreadsheet::color_elem_t green, orcus::spreadsheet::color_elem_t blue) override
Definition: interface.cxx:1891
std::vector< border > maBorders
virtual void set_font_underline_type(orcus::spreadsheet::underline_type_t e) override
Definition: interface.cxx:1675
virtual void set_xf_fill(size_t index) override
Definition: interface.cxx:2017
virtual size_t commit_border() override
Definition: interface.cxx:1907
virtual void set_number_format_identifier(size_t n) override
Definition: interface.cxx:1948
virtual void set_xf_border(size_t index) override
Definition: interface.cxx:2022
virtual void set_number_format_count(size_t n) override
Definition: interface.cxx:1944
virtual void set_fill_count(size_t n) override
Definition: interface.cxx:1785
virtual void set_fill_pattern_type(orcus::spreadsheet::fill_pattern_t fp) override
Definition: interface.cxx:1790
virtual void set_cell_style_parent_name(std::string_view name) override
Definition: interface.cxx:2124
virtual void set_font_count(size_t n) override
Definition: interface.cxx:1568
virtual void set_xf_style_xf(size_t index) override
Definition: interface.cxx:2032
virtual size_t commit_cell_style() override
Definition: interface.cxx:2130
virtual void set_font_underline_color(orcus::spreadsheet::color_elem_t alpha, orcus::spreadsheet::color_elem_t red, orcus::spreadsheet::color_elem_t green, orcus::spreadsheet::color_elem_t blue) override
Definition: interface.cxx:1699
SC_DLLPUBLIC bool insert(ScRangeData *p, bool bReuseFreeIndex=true)
Insert object into set.
Definition: rangenam.cxx:802
ScAddress aEnd
Definition: address.hxx:498
bool IsValid() const
Definition: address.hxx:544
ScRefFlags Parse(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, ScAddress::ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1700
ScAddress aStart
Definition: address.hxx:497
static SC_DLLPUBLIC OUString ProgrammaticToDisplayName(const OUString &rProgName, SfxStyleFamily nType)
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All) override
Definition: stlpool.cxx:72
void CreateStandardStyles()
Definition: stlpool.cxx:207
bool HasStandardStyles() const
Definition: stlpool.hxx:51
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual bool SetParent(const OUString &)
virtual SfxItemSet & GetItemSet()
bool PutEntry(OUString &rString, sal_Int32 &nCheckPos, SvNumFormatType &nType, sal_uInt32 &nKey, LanguageType eLnge=LANGUAGE_DONTKNOW, bool bReplaceBooleanEquivalent=true)
const Date & GetNullDate() const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
void SetLine(const editeng::SvxBorderLine *pNew)
void SetColor(const Color &rCol)
static AddressConvention extractRefConvention(const Grammar eGrammar)
void set(size_t nSharedId, std::unique_ptr< ScTokenArray > pArray)
const ScTokenArray * get(size_t nSharedId) const
SharedString intern(const OUString &rStr)
sal_uInt16 GetSec() const
static const sal_Int64 nanoSecPerSec
sal_uInt16 GetMin() const
static const sal_Int64 secondPerMinute
sal_uInt16 GetHour() const
sal_uInt32 GetNanoSec() const
static const sal_Int64 secondPerHour
ColorAlpha
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
sal_Int32 mnRow
sal_Int32 mnCol
DocumentType eType
LINESTYLE_BOLDDASHDOT
LINESTYLE_BOLDDASHDOTDOT
LINESTYLE_SINGLE
LINESTYLE_BOLDLONGDASH
LINESTYLE_BOLDWAVE
LINESTYLE_DASHDOTDOT
LINESTYLE_BOLDDASH
LINESTYLE_BOLDDOTTED
LINESTYLE_DOUBLEWAVE
LINESTYLE_DOUBLE
LINESTYLE_NONE
LINESTYLE_DASH
LINESTYLE_DASHDOT
LINESTYLE_DOTTED
LINESTYLE_WAVE
LINESTYLE_LONGDASH
LINESTYLE_BOLD
STRIKEOUT_BOLD
STRIKEOUT_DOUBLE
STRIKEOUT_SINGLE
STRIKEOUT_X
STRIKEOUT_SLASH
STRIKEOUT_NONE
STRIKEOUT_DONTKNOW
PITCH_DONTKNOW
FontItalic
ITALIC_NORMAL
ITALIC_NONE
FAMILY_DONTKNOW
WEIGHT_BOLD
WEIGHT_NORMAL
#define DATE_TIME_FACTOR
Definition: globalnames.hxx:21
const char * name
sal_Int32 nIndex
OUString aName
#define LANGUAGE_ENGLISH_US
sal_uInt16 nPos
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
aStr
SvGenericNameContainerMapImpl maProperties
def point()
Type
index
const sal_Int16 API_LINE_THICK
const sal_Int16 API_LINE_MEDIUM
const sal_Int16 API_LINE_THIN
const sal_Int16 API_LINE_NONE
Font auto color (system window text color).
const sal_Int16 API_LINE_HAIR
FontWeight
long Long
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
constexpr TypedWhichId< SvxPostureItem > ATTR_CTL_FONT_POSTURE(119)
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< SvxBrushItem > ATTR_BACKGROUND(148)
constexpr TypedWhichId< SvxJustifyMethodItem > ATTR_VER_JUSTIFY_METHOD(133)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
constexpr TypedWhichId< SvxJustifyMethodItem > ATTR_HOR_JUSTIFY_METHOD(130)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
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< SvxPostureItem > ATTR_CJK_FONT_POSTURE(114)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CTL_FONT_HEIGHT(117)
constexpr TypedWhichId< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)
static SfxItemSet & rSet
CellStoreToken(const ScAddress &rPos, Type eType)
Definition: interface.cxx:263
formula::FormulaGrammar::Grammar meGrammar
std::optional< SvxBorderLineStyle > meStyle
std::map< orcus::spreadsheet::border_direction_t, border_line > maBorders
void applyToItemSet(SfxItemSet &rSet) const
Definition: interface.cxx:1417
std::optional< Color > maBgColor
std::optional< Color > maFgColor
void applyToItemSet(SfxItemSet &rSet) const
Definition: interface.cxx:1374
std::optional< orcus::spreadsheet::fill_pattern_t > mePattern
std::optional< bool > mbItalic
void applyToItemSet(SfxItemSet &rSet) const
Definition: interface.cxx:1330
std::optional< OUString > maName
std::optional< Color > maColor
std::optional< Color > maUnderlineColor
std::optional< FontLineStyle > meUnderline
std::optional< bool > mbBold
std::optional< double > mnSize
std::optional< FontStrikeout > meStrikeout
void applyToItemSet(SfxItemSet &rSet, const ScDocument &rDoc) const
Definition: interface.cxx:1461
std::optional< OUString > maCode
std::optional< bool > mbHidden
void applyToItemSet(SfxItemSet &rSet) const
Definition: interface.cxx:1383
std::optional< bool > mbPrintContent
std::optional< bool > mbLocked
std::optional< bool > mbFormulaHidden
SvxCellJustifyMethod meHorAlignMethod
SvxCellVerJustify meVerAlignment
SvxCellJustifyMethod meVerAlignMethod
SvxCellHorJustify meHorAlignment
constexpr OUStringLiteral SC_STYLE_PROG_STANDARD
Definition: stylehelper.hxx:30
SvxCellJustifyMethod
SvxCellHorJustify
SvxCellVerJustify
sal_Int16 SCTAB
Definition: types.hxx:22
ResultType type
size_t pos
RedlineType meType
SvNumFormatType