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