summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oovbaapi/ooo/vba/excel/XRange.idl1
-rw-r--r--sc/qa/extras/testdocuments/vba.xlsbin33280 -> 10752 bytes
-rw-r--r--sc/source/ui/vba/vbarange.cxx41
-rw-r--r--sc/source/ui/vba/vbarange.hxx5
4 files changed, 36 insertions, 11 deletions
diff --git a/oovbaapi/ooo/vba/excel/XRange.idl b/oovbaapi/ooo/vba/excel/XRange.idl
index e640f39eb33e..9dcc41f95166 100644
--- a/oovbaapi/ooo/vba/excel/XRange.idl
+++ b/oovbaapi/ooo/vba/excel/XRange.idl
@@ -43,6 +43,7 @@ interface XRange
//interface ::ooo::vba::XHelperInterface;
[attribute] any Value;
+ [attribute] any Value2;
[attribute] any Formula;
[attribute] any FormulaArray;
[attribute] any FormulaR1C1;
diff --git a/sc/qa/extras/testdocuments/vba.xls b/sc/qa/extras/testdocuments/vba.xls
index 399b1ec20675..22bee379caf1 100644
--- a/sc/qa/extras/testdocuments/vba.xls
+++ b/sc/qa/extras/testdocuments/vba.xls
Binary files differ
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index d94bd7b04a35..99bcce81ba00 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -781,13 +781,13 @@ namespace {
class CellValueGetter : public ValueGetter
{
protected:
+ RangeValueType meValueType;
uno::Any maValue;
public:
- CellValueGetter() {}
+ CellValueGetter(RangeValueType eValueType) { meValueType = eValueType; }
virtual void visitNode( sal_Int32 x, sal_Int32 y, const uno::Reference< table::XCell >& xCell ) override;
virtual void processValue( const uno::Any& aValue ) override;
const uno::Any& getValue() const override { return maValue; }
-
};
}
@@ -800,10 +800,10 @@ CellValueGetter::processValue( const uno::Any& aValue )
void CellValueGetter::visitNode( sal_Int32 /*x*/, sal_Int32 /*y*/, const uno::Reference< table::XCell >& xCell )
{
uno::Any aValue;
- table::CellContentType eType = xCell->getType();
- if( eType == table::CellContentType_VALUE || eType == table::CellContentType_FORMULA )
+ table::CellContentType eCellContentType = xCell->getType();
+ if( eCellContentType == table::CellContentType_VALUE || eCellContentType == table::CellContentType_FORMULA )
{
- if ( eType == table::CellContentType_FORMULA )
+ if ( eCellContentType == table::CellContentType_FORMULA )
{
OUString sFormula = xCell->getFormula();
@@ -834,13 +834,13 @@ void CellValueGetter::visitNode( sal_Int32 /*x*/, sal_Int32 /*y*/, const uno::Re
NumFormatHelper cellFormat( xRange );
if ( cellFormat.isBooleanType() )
aValue <<= ( xCell->getValue() != 0.0 );
- else if ( cellFormat.isDateType() )
+ else if ( cellFormat.isDateType() && meValueType == RangeValueType::value)
aValue <<= bridge::oleautomation::Date( xCell->getValue() );
else
aValue <<= xCell->getValue();
}
}
- if( eType == table::CellContentType_TEXT )
+ if( eCellContentType == table::CellContentType_TEXT )
{
uno::Reference< text::XTextRange > xTextRange(xCell, ::uno::UNO_QUERY_THROW);
aValue <<= xTextRange->getString();
@@ -908,7 +908,8 @@ private:
ScDocument& m_rDoc;
formula::FormulaGrammar::Grammar m_eGrammar;
public:
- CellFormulaValueGetter(ScDocument& rDoc, formula::FormulaGrammar::Grammar eGram ) : m_rDoc( rDoc ), m_eGrammar( eGram ) {}
+ CellFormulaValueGetter(ScDocument& rDoc, formula::FormulaGrammar::Grammar eGram ) :
+ CellValueGetter( RangeValueType::value ), m_rDoc( rDoc ), m_eGrammar( eGram ) {}
virtual void visitNode( sal_Int32 /*x*/, sal_Int32 /*y*/, const uno::Reference< table::XCell >& xCell ) override
{
uno::Any aValue;
@@ -1524,8 +1525,7 @@ ScVbaRange::getValue( ValueGetter& valueGetter)
return uno::Any( script::ArrayWrapper( false, arrayGetter.getValue() ) );
}
-uno::Any SAL_CALL
-ScVbaRange::getValue()
+css::uno::Any ScVbaRange::DoGetValue( RangeValueType eValueType )
{
// #TODO code within the test below "if ( m_Areas... " can be removed
// Test is performed only because m_xRange is NOT set to be
@@ -1537,11 +1537,23 @@ ScVbaRange::getValue()
return xRange->getValue();
}
- CellValueGetter valueGetter;
+ CellValueGetter valueGetter( eValueType );
return getValue( valueGetter );
+}
+uno::Any SAL_CALL
+ScVbaRange::getValue()
+{
+ return DoGetValue( RangeValueType::value );
}
+uno::Any SAL_CALL
+ScVbaRange::getValue2()
+{
+ return DoGetValue( RangeValueType::value2 );
+}
+
+
void
ScVbaRange::setValue( const uno::Any& aValue, ValueSetter& valueSetter )
{
@@ -1595,6 +1607,13 @@ ScVbaRange::setValue( const uno::Any &aValue )
}
void SAL_CALL
+ScVbaRange::setValue2( const uno::Any &aValue )
+{
+ return setValue( aValue );
+}
+
+
+void SAL_CALL
ScVbaRange::Clear()
{
using namespace ::com::sun::star::sheet::CellFlags;
diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx
index 118ad044cf47..7a2d186f5edb 100644
--- a/sc/source/ui/vba/vbarange.hxx
+++ b/sc/source/ui/vba/vbarange.hxx
@@ -69,6 +69,8 @@ public:
typedef ScVbaFormat< ov::excel::XRange > ScVbaRange_BASE;
+enum class RangeValueType { value, value2 };
+
class ScVbaRange : public ScVbaRange_BASE
{
css::uno::Reference< ov::XCollection > m_Areas;
@@ -95,6 +97,7 @@ class ScVbaRange : public ScVbaRange_BASE
/// @throws css::uno::RuntimeException
css::uno::Any getValue( ValueGetter& rValueGetter );
+ css::uno::Any DoGetValue( RangeValueType eValueType );
/// @throws css::uno::RuntimeException
void setValue( const css::uno::Any& aValue, ValueSetter& setter );
@@ -174,7 +177,9 @@ public:
// Attributes
virtual css::uno::Any SAL_CALL getValue() override;
+ virtual css::uno::Any SAL_CALL getValue2() override;
virtual void SAL_CALL setValue( const css::uno::Any& aValue ) override;
+ virtual void SAL_CALL setValue2( const css::uno::Any& aValue2 ) override;
virtual css::uno::Any SAL_CALL getFormula() override;
virtual void SAL_CALL setFormula( const css::uno::Any& rFormula ) override;
virtual css::uno::Any SAL_CALL getFormulaArray() override;