LibreOffice Module sc (master) 1
xmlsceni.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <document.hxx>
21#include "xmlimprt.hxx"
22#include "xmlsceni.hxx"
23#include <attrib.hxx>
24#include <rangeutl.hxx>
25
26#include <xmloff/xmltoken.hxx>
28
30
31using namespace com::sun::star;
32using namespace xmloff::token;
33
35 ScXMLImport& rImport,
37 ScXMLImportContext( rImport ),
38 aBorderColor( COL_BLACK ),
39 bDisplayBorder( true ),
40 bCopyBack( true ),
41 bCopyStyles( true ),
42 bCopyFormulas( true ),
43 bIsActive( false ),
44 bProtected( false )
45{
46 rImport.LockSolarMutex();
47
48 if ( !rAttrList.is() )
49 return;
50
51 for (auto &aIter : *rAttrList)
52 {
53 switch (aIter.getToken())
54 {
57 break;
60 break;
63 break;
66 break;
69 break;
72 break;
74 {
76 assert(pDoc);
78 aScenarioRanges, aIter.toString(), *pDoc, ::formula::FormulaGrammar::CONV_OOO );
79 break;
80 }
82 sComment = aIter.toString();
83 break;
86 break;
87 }
88 }
89}
90
92{
94}
95
96void SAL_CALL ScXMLTableScenarioContext::endFastElement( sal_Int32 /*nElement*/ )
97{
98 SCTAB nCurrTable( GetScImport().GetTables().GetCurrentSheet() );
99 ScDocument* pDoc(GetScImport().GetDocument());
100 if (!pDoc)
101 return;
102
103 pDoc->SetScenario( nCurrTable, true );
105 if( bDisplayBorder )
107 if( bCopyBack )
108 nFlags |= ScScenarioFlags::TwoWay;
109 if( bCopyStyles )
110 nFlags |= ScScenarioFlags::Attrib;
111 if( !bCopyFormulas )
112 nFlags |= ScScenarioFlags::Value;
113 if( bProtected )
115 pDoc->SetScenarioData( nCurrTable, sComment, aBorderColor, nFlags );
116 for( size_t i = 0; i < aScenarioRanges.size(); ++i )
117 {
118 ScRange const & rRange = aScenarioRanges[ i ];
119 pDoc->ApplyFlagsTab( rRange.aStart.Col(), rRange.aStart.Row(),
120 rRange.aEnd.Col(), rRange.aEnd.Row(), nCurrTable, ScMF::Scenario );
121 }
122 pDoc->SetActiveScenario( nCurrTable, bIsActive );
123}
124
125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ Scenario
field button for datapilot
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
SC_DLLPUBLIC void SetScenarioData(SCTAB nTab, const OUString &rComment, const Color &rColor, ScScenarioFlags nFlags)
Definition: documen3.cxx:438
SC_DLLPUBLIC bool ApplyFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
Definition: document.cxx:4970
SC_DLLPUBLIC void SetActiveScenario(SCTAB nTab, bool bActive)
Definition: documen3.cxx:886
SC_DLLPUBLIC void SetScenario(SCTAB nTab, bool bFlag)
Definition: documen3.cxx:426
size_t size() const
Definition: rangelst.hxx:89
static bool GetRangeListFromString(ScRangeList &rRangeList, std::u16string_view rRangeListStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator=' ', sal_Unicode cQuote='\'')
Definition: rangeutl.cxx:552
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
This class exists only to provide GetScImport() to its derived classes.
ScXMLImport & GetScImport()
void LockSolarMutex()
Definition: xmlimprt.cxx:1519
ScDocument * GetDocument()
Definition: xmlimprt.hxx:205
void UnlockSolarMutex()
Definition: xmlimprt.cxx:1537
ScXMLTableScenarioContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList)
Definition: xmlsceni.cxx:34
virtual ~ScXMLTableScenarioContext() override
Definition: xmlsceni.cxx:91
ScRangeList aScenarioRanges
Definition: xmlsceni.hxx:34
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlsceni.cxx:96
static bool convertColor(sal_Int32 &rColor, std::u16string_view rValue)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
ScScenarioFlags
Definition: global.hxx:226
TABLE
int i
XML_COPY_BACK
XML_COPY_STYLES
XML_TRUE
XML_DISPLAY_BORDER
XML_BORDER_COLOR
XML_IS_ACTIVE
XML_COMMENT
XML_COPY_FORMULAS
XML_SCENARIO_RANGES
XML_PROTECTED
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
sal_Int16 SCTAB
Definition: types.hxx:22
#define XML_ELEMENT(prefix, name)