[Libreoffice-commits] .: Branch 'integration/dev300_m101' - sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Mon Mar 14 23:01:16 PDT 2011
sc/source/ui/vba/excelvbahelper.cxx | 16 +++--
sc/source/ui/vba/excelvbahelper.hxx | 56 ++++++--------------
sc/source/ui/vba/makefile.mk | 7 --
sc/source/ui/vba/service.cxx | 10 ---
sc/source/ui/vba/vbaaxis.cxx | 2
sc/source/ui/vba/vbachart.cxx | 14 ++---
sc/source/ui/vba/vbaeventshelper.cxx | 8 +-
sc/source/ui/vba/vbaeventshelper.hxx | 2
sc/source/ui/vba/vbaformat.cxx | 2
sc/source/ui/vba/vbapagebreak.cxx | 4 -
sc/source/ui/vba/vbarange.cxx | 97 ++++++++++++++++++++---------------
sc/source/ui/vba/vbasheetobject.cxx | 6 +-
12 files changed, 107 insertions(+), 117 deletions(-)
New commits:
commit 95f97618f13f4c0f0a4b0ef074c00b243f3e176b
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Mar 15 01:58:39 2011 -0400
Some attempts to get the VBA code to build.
diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx
index 5ec8fd1..989ca46 100644
--- a/sc/source/ui/vba/excelvbahelper.cxx
+++ b/sc/source/ui/vba/excelvbahelper.cxx
@@ -44,6 +44,10 @@
using namespace ::com::sun::star;
using namespace ::ooo::vba;
+namespace ooo {
+namespace vba {
+namespace excel {
+
// ============================================================================
uno::Reference< sheet::XDatabaseRanges >
@@ -331,8 +335,8 @@ sal_Bool IsR1C1ReferFormat( ScDocument* pDoc, const rtl::OUString& sRangeStr )
return false;
}
-uno::Reference< XHelperInterface >
-getUnoSheetModuleObj( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
+uno::Reference< vba::XHelperInterface >
+getUnoSheetModuleObj( const uno::Reference< sheet::XSpreadsheet >& xSheet ) throw ( uno::RuntimeException )
{
uno::Reference< beans::XPropertySet > xProps( xSheet, uno::UNO_QUERY_THROW );
rtl::OUString sCodeName;
@@ -458,8 +462,6 @@ ScVbaCellRangeAccess::GetDataSet( ScCellRangesBase* pRangeObj )
// ============================================================================
-} //excel
-} //vba
-} //ooo
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+} // namespace excel
+} // namespace vba
+} // namespace ooo
diff --git a/sc/source/ui/vba/excelvbahelper.hxx b/sc/source/ui/vba/excelvbahelper.hxx
index 5d2b02c..2100f4a 100644
--- a/sc/source/ui/vba/excelvbahelper.hxx
+++ b/sc/source/ui/vba/excelvbahelper.hxx
@@ -28,8 +28,8 @@
#ifndef SC_EXCEL_VBA_HELPER_HXX
#define SC_EXCEL_VBA_HELPER_HXX
-#include<vbahelper/vbahelper.hxx>
-#include <docsh.hxx>
+#include <vbahelper/vbahelper.hxx>
+#include "docsh.hxx"
#include <com/sun/star/sheet/XDatabaseRanges.hpp>
#include <com/sun/star/sheet/XDatabaseRange.hpp>
#include <com/sun/star/table/XCellRange.hpp>
@@ -52,11 +52,19 @@ void implnCopy( const css::uno::Reference< css::frame::XModel>& xModel );
void implnPaste ( const css::uno::Reference< css::frame::XModel>& xModel );
void implnCut( const css::uno::Reference< css::frame::XModel>& xModel );
void implnPasteSpecial( const css::uno::Reference< css::frame::XModel>& xModel, sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose);
+void implnCopyRange( const css::uno::Reference< css::frame::XModel>& xModel, const ScRange& rRange );
ScTabViewShell* getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel ) ;
ScDocShell* getDocShell( const css::uno::Reference< css::frame::XModel>& xModel ) ;
ScTabViewShell* getCurrentBestViewShell( const css::uno::Reference< css::uno::XComponentContext >& xContext );
SfxViewFrame* getViewFrame( const css::uno::Reference< css::frame::XModel >& xModel );
+sal_Bool IsR1C1ReferFormat( ScDocument* pDoc, const ::rtl::OUString& sRangeStr );
+formula::FormulaGrammar::Grammar GetFormulaGrammar( ScDocument* pDoc, const ScAddress& sAddress, const css::uno::Any& aFormula );
+void CompileExcelFormulaToODF( ScDocument* pDoc, const String& rOldFormula, String& rNewFormula );
+void CompileODFFormulaToExcel( ScDocument* pDoc, const String& rOldFormula, String& rNewFormula, const formula::FormulaGrammar::Grammar eGrammar );
+css::uno::Reference< css::sheet::XDatabaseRanges > GetDataBaseRanges( ScDocShell* pShell ) throw ( css::uno::RuntimeException );
+
+css::uno::Reference< css::sheet::XDatabaseRange > GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName ) throw ( css::uno::RuntimeException );
css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::sheet::XSpreadsheet >& xSheet ) throw ( css::uno::RuntimeException );
css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges ) throw ( css::uno::RuntimeException );
css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::table::XCellRange >& xRange ) throw ( css::uno::RuntimeException );
@@ -64,6 +72,7 @@ css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const cs
css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::frame::XModel >& xModel, SCTAB nTab ) throw ( css::uno::RuntimeException );
ScDocShell* GetDocShellFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
+ScDocShell* GetDocShellFromRanges( const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges ) throw ( css::uno::RuntimeException );
ScDocument* GetDocumentFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
css::uno::Reference< css::frame::XModel > GetModelFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
@@ -71,43 +80,16 @@ css::uno::Reference< css::frame::XModel > GetModelFromRange( const css::uno::Ref
class ScVbaCellRangeAccess
{
- namespace vba
- {
- namespace excel
- {
- // nTabs empty means apply zoom to all sheets
- void implSetZoom( const css::uno::Reference< css::frame::XModel >& xModel, sal_Int16 nZoom, std::vector< SCTAB >& nTabs );
- void implnCopy( const css::uno::Reference< css::frame::XModel>& xModel );
- void implnPaste ( const css::uno::Reference< css::frame::XModel>& xModel );
- void implnCut( const css::uno::Reference< css::frame::XModel>& xModel );
- void implnPasteSpecial( const css::uno::Reference< css::frame::XModel>& xModel, sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose);
- void implnCopyRange( const css::uno::Reference< css::frame::XModel>& xModel, const ScRange& rRange );
- ScTabViewShell* getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel ) ;
- ScDocShell* getDocShell( const css::uno::Reference< css::frame::XModel>& xModel ) ;
- ScTabViewShell* getCurrentBestViewShell( const css::uno::Reference< css::uno::XComponentContext >& xContext );
- SfxViewFrame* getViewFrame( const css::uno::Reference< css::frame::XModel >& xModel );
- sal_Bool IsR1C1ReferFormat( ScDocument* pDoc, const ::rtl::OUString& sRangeStr );
- formula::FormulaGrammar::Grammar GetFormulaGrammar( ScDocument* pDoc, const ScAddress& sAddress, const css::uno::Any& aFormula );
- void CompileExcelFormulaToODF( ScDocument* pDoc, const String& rOldFormula, String& rNewFormula );
- void CompileODFFormulaToExcel( ScDocument* pDoc, const String& rOldFormula, String& rNewFormula, const formula::FormulaGrammar::Grammar eGrammar );
- css::uno::Reference< css::sheet::XDatabaseRanges > GetDataBaseRanges( ScDocShell* pShell ) throw ( css::uno::RuntimeException );
+public:
+ static SfxItemSet* GetDataSet( ScCellRangesBase* pRangeObj );
+};
+
+// ============================================================================
- css::uno::Reference< css::sheet::XDatabaseRange > GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName ) throw ( css::uno::RuntimeException );
- css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges ) throw ( css::uno::RuntimeException );
- css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::table::XCellRange >& xRange ) throw ( css::uno::RuntimeException );
- ScDocShell* GetDocShellFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
- ScDocShell* GetDocShellFromRanges( const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges ) throw ( css::uno::RuntimeException );
- ScDocument* GetDocumentFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
- css::uno::Reference< css::frame::XModel > GetModelFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
+} // namespace excel
+} // namespace vba
+} // namespace ooo
- class ScVbaCellRangeAccess
- {
- public:
- static SfxItemSet* GetDataSet( ScCellRangesBase* pRangeObj );
- };
- }
- }
-}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/makefile.mk b/sc/source/ui/vba/makefile.mk
index 67d6001..bd355b1 100644
--- a/sc/source/ui/vba/makefile.mk
+++ b/sc/source/ui/vba/makefile.mk
@@ -37,13 +37,6 @@ VISIBILITY_HIDDEN=TRUE
.INCLUDE : settings.mk
DLLPRE =
-.IF "$(ENABLE_VBA)"!="YES"
-dummy:
- @echo "not building vba..."
-.ENDIF
-
-CDEFS+=-DVBA_OOBUILD_HACK
-
.IF "$(L10N_framework)"==""
INCPRE=$(INCCOM)$/$(TARGET)
diff --git a/sc/source/ui/vba/service.cxx b/sc/source/ui/vba/service.cxx
index 05dc4ab..56ed8a3 100644
--- a/sc/source/ui/vba/service.cxx
+++ b/sc/source/ui/vba/service.cxx
@@ -85,16 +85,6 @@ extern "C"
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
- SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
- lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
- {
- OSL_TRACE("In component_writeInfo");
-
- // Component registration
- return component_writeInfoHelper( pServiceManager, pRegistryKey,
- range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl, textframe::serviceDecl );
- }
-
SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
registry::XRegistryKey * pRegistryKey )
diff --git a/sc/source/ui/vba/vbaaxis.cxx b/sc/source/ui/vba/vbaaxis.cxx
index 7e3135c..37149f9 100644
--- a/sc/source/ui/vba/vbaaxis.cxx
+++ b/sc/source/ui/vba/vbaaxis.cxx
@@ -572,7 +572,7 @@ ScVbaAxis::setScaleType( ::sal_Int32 _nScaleType ) throw (script::BasicErrorExce
switch (_nScaleType)
{
case xlScaleLinear:
- mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Logarithmic" ) ), uno::makeAny( false ) );
+ mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Logarithmic" ) ), uno::makeAny( sal_False ) );
break;
case xlScaleLogarithmic:
mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Logarithmic" ) ), uno::makeAny( sal_True ) );
diff --git a/sc/source/ui/vba/vbachart.cxx b/sc/source/ui/vba/vbachart.cxx
index 6ed1b5f..fc91f1d 100644
--- a/sc/source/ui/vba/vbachart.cxx
+++ b/sc/source/ui/vba/vbachart.cxx
@@ -331,7 +331,7 @@ try
case xlXYScatter:
case xlBubble: // not possible
case xlBubble3DEffect: // not possible
- mxDiagramPropertySet->setPropertyValue(LINES, uno::makeAny( false ));
+ mxDiagramPropertySet->setPropertyValue(LINES, uno::makeAny( sal_False ));
break;
case xlXYScatterLines:
case xlXYScatterLinesNoMarkers:
@@ -385,7 +385,7 @@ try
default:
if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(DEEP))
{
- mxDiagramPropertySet->setPropertyValue(DEEP, uno::makeAny( false));
+ mxDiagramPropertySet->setPropertyValue(DEEP, uno::makeAny( sal_False));
}
break;
}
@@ -455,7 +455,7 @@ try
default:
if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(VERTICAL))
{
- mxDiagramPropertySet->setPropertyValue(VERTICAL, uno::makeAny(false));
+ mxDiagramPropertySet->setPropertyValue(VERTICAL, uno::makeAny(sal_False));
}
break;
}
@@ -476,7 +476,7 @@ try
case xlConeBarStacked:
case xlPyramidColStacked:
case xlPyramidBarStacked:
- mxDiagramPropertySet->setPropertyValue(PERCENT, uno::makeAny( false ));
+ mxDiagramPropertySet->setPropertyValue(PERCENT, uno::makeAny( sal_False ));
mxDiagramPropertySet->setPropertyValue(STACKED, uno::makeAny( sal_True ));
break;
case xlPyramidColStacked100:
@@ -497,8 +497,8 @@ try
mxDiagramPropertySet->setPropertyValue(PERCENT, uno::makeAny( sal_True ));
break;
default:
- mxDiagramPropertySet->setPropertyValue(PERCENT, uno::makeAny( false));
- mxDiagramPropertySet->setPropertyValue(STACKED, uno::makeAny( false));
+ mxDiagramPropertySet->setPropertyValue(PERCENT, uno::makeAny( sal_False));
+ mxDiagramPropertySet->setPropertyValue(STACKED, uno::makeAny( sal_False));
break;
}
switch (_nChartType)
@@ -542,7 +542,7 @@ try
default:
if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(DIM3D))
{
- mxDiagramPropertySet->setPropertyValue(DIM3D, uno::makeAny( false));
+ mxDiagramPropertySet->setPropertyValue(DIM3D, uno::makeAny( sal_False));
}
break;
}
diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx
index ad60039..b140a1f 100644
--- a/sc/source/ui/vba/vbaeventshelper.cxx
+++ b/sc/source/ui/vba/vbaeventshelper.cxx
@@ -137,6 +137,7 @@ private:
uno::Reference< awt::XWindow > getContainerWindow();
bool isMouseReleased();
DECL_LINK( fireResizeMacro, void* );
+ void processWindowResizeMacro();
private:
::osl::Mutex maMutex;
@@ -689,13 +690,13 @@ namespace {
bool lclSelectionChanged( const ScRangeList& rLeft, const ScRangeList& rRight )
{
// one of the range lists empty? -> return false, if both lists empty
- bool bLeftEmpty = rLeft.Count() == 0;
- bool bRightEmpty = rRight.Count() == 0;
+ bool bLeftEmpty = rLeft.empty();
+ bool bRightEmpty = rRight.empty();
if( bLeftEmpty || bRightEmpty )
return !(bLeftEmpty && bRightEmpty);
// check sheet indexes of the range lists (assuming that all ranges in a list are on the same sheet)
- if( rLeft.GetObject( 0 )->aStart.Tab() != rRight.GetObject( 0 )->aStart.Tab() )
+ if( rLeft.front()->aStart.Tab() != rRight.front()->aStart.Tab() )
return false;
// compare all ranges
@@ -706,7 +707,6 @@ bool lclSelectionChanged( const ScRangeList& rLeft, const ScRangeList& rRight )
bool ScVbaEventsHelper::isSelectionChanged( const uno::Sequence< uno::Any >& rArgs, sal_Int32 nIndex ) throw (lang::IllegalArgumentException, uno::RuntimeException)
{
- uno::Reference< uno::XInterface > xOldSelection( maOldSelection, uno::UNO_QUERY );
uno::Reference< uno::XInterface > xNewSelection = getXSomethingFromArgs< uno::XInterface >( rArgs, nIndex, false );
if( ScCellRangesBase* pNewCellRanges = ScCellRangesBase::getImplementation( xNewSelection ) )
{
diff --git a/sc/source/ui/vba/vbaeventshelper.hxx b/sc/source/ui/vba/vbaeventshelper.hxx
index a3a2832..b4408d0 100644
--- a/sc/source/ui/vba/vbaeventshelper.hxx
+++ b/sc/source/ui/vba/vbaeventshelper.hxx
@@ -71,9 +71,9 @@ private:
private:
::rtl::Reference< ScVbaEventsListener > mxListener;
- css::uno::Any maOldSelection;
ScDocShell* mpDocShell;
ScDocument* mpDoc;
+ ScRangeList maOldSelection;
bool mbOpened;
};
diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx
index a19e8de..3681c67 100644
--- a/sc/source/ui/vba/vbaformat.cxx
+++ b/sc/source/ui/vba/vbaformat.cxx
@@ -59,7 +59,7 @@ using namespace ::com::sun::star;
#define LOCALE "Locale"
template< typename Ifc1 >
-ScVbaFormat< Ifc1 >::ScVbaFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet, const uno::Reference< frame::XModel >& xModel, bool bCheckAmbiguoity ) throw ( script::BasicErrorException ) : ScVbaFormat_BASE( xParent, xContext ), m_aDefaultLocale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "US") ), rtl::OUString() ), mxPropertySet( _xPropertySet ), mxModel( xModel ), mbCheckAmbiguoity( bCheckAmbiguoity ), mbAddIndent( false )
+ScVbaFormat< Ifc1 >::ScVbaFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet, const uno::Reference< frame::XModel >& xModel, bool bCheckAmbiguoity ) throw ( script::BasicErrorException ) : ScVbaFormat_BASE( xParent, xContext ), m_aDefaultLocale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "US") ), rtl::OUString() ), mxPropertySet( _xPropertySet ), mxModel( xModel ), mbCheckAmbiguoity( bCheckAmbiguoity ), mbAddIndent( sal_False )
{
try
{
diff --git a/sc/source/ui/vba/vbapagebreak.cxx b/sc/source/ui/vba/vbapagebreak.cxx
index 3369b72..01c570f 100644
--- a/sc/source/ui/vba/vbapagebreak.cxx
+++ b/sc/source/ui/vba/vbapagebreak.cxx
@@ -70,7 +70,7 @@ void ScVbaPageBreak<Ifc1>::setType(sal_Int32 type) throw (uno::RuntimeException)
if( type == excel::XlPageBreak::xlPageBreakNone )
{
- mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(false));
+ mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_False));
return;
}
@@ -84,7 +84,7 @@ void ScVbaPageBreak<Ifc1>::setType(sal_Int32 type) throw (uno::RuntimeException)
template< typename Ifc1 >
void ScVbaPageBreak<Ifc1>::Delete() throw ( script::BasicErrorException, uno::RuntimeException)
{
- mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(false));
+ mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_False));
}
template< typename Ifc1 >
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index e13dc73..a10bd30 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -176,6 +176,7 @@
#include "dbdocfun.hxx"
#include "patattr.hxx"
#include "olinetab.hxx"
+#include "transobj.hxx"
#include <comphelper/anytostring.hxx>
#include <global.hxx>
@@ -539,11 +540,9 @@ public:
bool setNumberFormat( const rtl::OUString& rFormat )
{
- lang::Locale aLocale;
- uno::Reference< beans::XPropertySet > xNumProps = getNumberProps();
- xNumProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Locale" )) ) >>= aLocale;
- sal_Int32 nNewIndex = mxFormats->queryKey(rFormat, aLocale, false );
- if ( nNewIndex == -1 ) // format not defined
+ // #163288# treat "General" as "Standard" format
+ sal_Int32 nNewIndex = 0;
+ if( !rFormat.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "General" ) ) )
{
lang::Locale aLocale;
uno::Reference< beans::XPropertySet > xNumProps = getNumberProps();
@@ -1607,7 +1606,7 @@ ScVbaRange::getValue() throw (uno::RuntimeException)
void
-ScVbaRange::setValue( const uno::Any &aValue, ValueSetter& valueSetter ) throw (uno::RuntimeException)
+ScVbaRange::setValue( const uno::Any& aValue, ValueSetter& valueSetter, bool bFireEvent ) throw (uno::RuntimeException)
{
uno::TypeClass aClass = aValue.getValueTypeClass();
if ( aClass == uno::TypeClass_SEQUENCE )
@@ -1657,10 +1656,12 @@ ScVbaRange::setValue( const uno::Any &aValue ) throw (uno::RuntimeException)
return;
}
CellValueSetter valueSetter( aValue );
- setValue( aValue, valueSetter );
+ setValue( aValue, valueSetter, true );
+#if 0 // TODO: Noel, do we still need this?
// Fires the range change event.
lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
+#endif
}
void SAL_CALL
@@ -1668,10 +1669,12 @@ ScVbaRange::Clear() throw (uno::RuntimeException)
{
using namespace ::com::sun::star::sheet::CellFlags;
sal_Int32 nFlags = VALUE | DATETIME | STRING | FORMULA | HARDATTR | EDITATTR | FORMATTED;
- ClearContents( nFlags );
+ ClearContents( nFlags, true );
+#if 0 // TODO: do we still need this?
// Fires the range change event.
lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
+#endif
}
//helper ClearContent
@@ -1690,7 +1693,7 @@ ScVbaRange::ClearContents( sal_Int32 nFlags, bool bFireEvent ) throw (uno::Runti
uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
ScVbaRange* pRange = getImplementation( xRange );
if ( pRange )
- pRange->ClearContents( nFlags );
+ pRange->ClearContents( nFlags, false ); // do not fire for single ranges
}
// fire change event for the entire range list
if( bFireEvent ) fireChangeEvent();
@@ -1715,10 +1718,12 @@ ScVbaRange::ClearContents() throw (uno::RuntimeException)
sal_Int32 nClearFlags = ( sheet::CellFlags::VALUE |
sheet::CellFlags::STRING | sheet::CellFlags::DATETIME |
sheet::CellFlags::FORMULA );
- ClearContents( nClearFlags );
+ ClearContents( nClearFlags, true );
+#if 0 // TODO: do we still need this?
// Fires the range change event.
lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
+#endif
}
void SAL_CALL
@@ -1726,10 +1731,12 @@ ScVbaRange::ClearFormats() throw (uno::RuntimeException)
{
//FIXME: need to check if we need to combine sheet::CellFlags::FORMATTED
sal_Int32 nClearFlags = sheet::CellFlags::HARDATTR | sheet::CellFlags::FORMATTED | sheet::CellFlags::EDITATTR;
- ClearContents( nClearFlags );
+ ClearContents( nClearFlags, false );
+#if 0 // TODO: do we still need this?
// Fires the range change event.
lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
+#endif
}
void
@@ -1744,10 +1751,12 @@ ScVbaRange::setFormulaValue( const uno::Any& rFormula, formula::FormulaGrammar::
return;
}
CellFormulaValueSetter formulaValueSetter( rFormula, getScDocument(), eGram );
- setValue( rFormula, formulaValueSetter );
+ setValue( rFormula, formulaValueSetter, bFireEvent );
+#if 0 // TODO: ditto
// Fires the range change event.
lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
+#endif
}
uno::Any
@@ -1771,7 +1780,7 @@ void
ScVbaRange::setFormula(const uno::Any &rFormula ) throw (uno::RuntimeException)
{
// #FIXME converting "=$a$1" e.g. CONV_XL_A1 -> CONV_OOO // results in "=$a$1:a1", temporalily disable conversion
- setFormulaValue( rFormula,formula::FormulaGrammar::GRAM_NATIVE_XL_A1 );;
+ setFormulaValue( rFormula,formula::FormulaGrammar::GRAM_NATIVE_XL_A1, true );
}
uno::Any
@@ -1877,7 +1886,7 @@ ScVbaRange::HasFormula() throw (uno::RuntimeException)
ScCellRangesBase* pFormulaRanges = dynamic_cast< ScCellRangesBase * > ( xRanges.get() );
// check if there are no formula cell, return false
if ( pFormulaRanges->GetRangeList().empty() )
- return uno::makeAny(false);
+ return uno::makeAny(sal_False);
// chech if there are holes (where some cells are not formulas)
// or returned range is not equal to this range
@@ -2125,7 +2134,7 @@ ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolut
// force external to be false
// only first address should have the
// document and sheet specifications
- aExternalCopy = uno::makeAny(false);
+ aExternalCopy = uno::makeAny(sal_False);
}
sAddress += xRange->Address( RowAbsolute, ColumnAbsolute, ReferenceStyle, aExternalCopy, RelativeTo );
}
@@ -2273,7 +2282,7 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent,
{
ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
ScRange tmpRange;
- sal_uInt16 flags = tmpRange.ParseCols( sCol, excel::GetDocumentFromRange( mxRange ), dDetails );
+ sal_uInt16 flags = tmpRange.ParseCols( sCol, excel::GetDocumentFromRange( xRange ), dDetails );
if ( ( flags & 0x200 ) != 0x200 )
throw uno::RuntimeException();
nColumn = tmpRange.aStart.Col() + 1;
@@ -2290,7 +2299,7 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent,
}
if ( !( aColumnAny >>= nColumn ) )
{
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( xContext );
uno::Any aConverted;
try
{
@@ -2301,7 +2310,7 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent,
}
}
}
- RangeHelper thisRange( mxRange );
+ RangeHelper thisRange( xRange );
table::CellRangeAddress thisRangeAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
uno::Reference< table::XCellRange > xSheetRange = thisRange.getCellRangeFromSheet();
if( !bIsIndex && !bIsColumnIndex ) // .Cells
@@ -2324,7 +2333,7 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent,
--nColumn;
nRow = nRow + thisRangeAddress.StartRow;
nColumn = nColumn + thisRangeAddress.StartColumn;
- return new ScVbaRange( mxParent, mxContext, xSheetRange->getCellRangeByPosition( nColumn, nRow, nColumn, nRow ) );
+ return new ScVbaRange( xParent, xContext, xSheetRange->getCellRangeByPosition( nColumn, nRow, nColumn, nRow ) );
}
void
@@ -3850,6 +3859,18 @@ double getDefaultCharWidth( const uno::Reference< frame::XModel >& xModel ) thro
return lcl_TwipsToPoints( (sal_uInt16)nCharWidth );
}
+double getDefaultCharWidth( ScDocShell* pDocShell )
+{
+ ScDocument* pDoc = pDocShell->GetDocument();
+ OutputDevice* pRefDevice = pDoc->GetRefDevice();
+ ScPatternAttr* pAttr = pDoc->GetDefPattern();
+ ::Font aDefFont;
+ pAttr->GetFont( aDefFont, SC_AUTOCOL_BLACK, pRefDevice );
+ pRefDevice->SetFont( aDefFont );
+ long nCharWidth = pRefDevice->GetTextWidth( String( '0' ) ); // 1/100th mm
+ return lcl_hmmToPoints( nCharWidth );
+}
+
uno::Any SAL_CALL
ScVbaRange::getColumnWidth() throw (uno::RuntimeException)
{
@@ -3865,7 +3886,7 @@ ScVbaRange::getColumnWidth() throw (uno::RuntimeException)
if ( pShell )
{
uno::Reference< frame::XModel > xModel = pShell->GetModel();
- double defaultCharWidth = getDefaultCharWidth( pShell );
+ double defaultCharWidth = getDefaultCharWidth( xModel );
RangeHelper thisRange( mxRange );
table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
sal_Int32 nStartCol = thisAddress.StartColumn;
@@ -3904,26 +3925,24 @@ ScVbaRange::setColumnWidth( const uno::Any& _columnwidth ) throw (uno::RuntimeEx
double nColWidth = 0;
_columnwidth >>= nColWidth;
nColWidth = lcl_Round2DecPlaces( nColWidth );
- ScDocShell* pDocShell = getScDocShell();
- if ( pDocShell )
- {
- uno::Reference< frame::XModel > xModel = pDocShell->GetModel();
- if ( xModel.is() )
- {
-
- nColWidth = ( nColWidth * getDefaultCharWidth( xModel ) );
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- sal_uInt16 nTwips = lcl_pointsToTwips( nColWidth );
+ ScDocShell* pDocShell = getScDocShell();
+ if ( pDocShell )
+ {
+ if ( nColWidth != 0.0 )
+ nColWidth = ( nColWidth + fExtraWidth ) * getDefaultCharWidth( pDocShell );
+ RangeHelper thisRange( mxRange );
+ table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
+ sal_uInt16 nTwips = lcl_pointsToTwips( nColWidth );
- ScDocFunc aFunc(*pDocShell);
- SCCOLROW nColArr[2];
- nColArr[0] = thisAddress.StartColumn;
- nColArr[1] = thisAddress.EndColumn;
- aFunc.SetWidthOrHeight( true, 1, nColArr, thisAddress.Sheet, SC_SIZE_ORIGINAL,
- nTwips, true, true );
+ ScDocFunc aFunc(*pDocShell);
+ SCCOLROW nColArr[2];
+ nColArr[0] = thisAddress.StartColumn;
+ nColArr[1] = thisAddress.EndColumn;
+ // #163561# use mode SC_SIZE_DIRECT: hide for width 0, show for other values
+ aFunc.SetWidthOrHeight( true, 1, nColArr, thisAddress.Sheet,
+ SC_SIZE_DIRECT, nTwips, true, true );
- }
+ }
}
uno::Any SAL_CALL
@@ -4740,7 +4759,7 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
}
void SAL_CALL
-ScVbaRange::Insert( const uno::Any& Shift, const uno::Any& CopyOrigin ) throw (uno::RuntimeException)
+ScVbaRange::Insert( const uno::Any& Shift, const uno::Any& /*CopyOrigin*/ ) throw (uno::RuntimeException)
{
// It appears ( from the web ) that the undocumented CopyOrigin
// param should contain member of enum XlInsertFormatOrigin
diff --git a/sc/source/ui/vba/vbasheetobject.cxx b/sc/source/ui/vba/vbasheetobject.cxx
index d5f943e..5802705 100644
--- a/sc/source/ui/vba/vbasheetobject.cxx
+++ b/sc/source/ui/vba/vbasheetobject.cxx
@@ -241,6 +241,7 @@ void SAL_CALL ScVbaSheetObjectBase::setName( const OUString& rName ) throw (uno:
sal_Int32 SAL_CALL ScVbaSheetObjectBase::getPlacement() throw (uno::RuntimeException)
{
sal_Int32 nRet = excel::XlPlacement::xlMoveAndSize;
+#if 0 // TODO: not working at the moment.
SvxShape* pShape = SvxShape::getImplementation( mxShape );
if(pShape)
{
@@ -252,11 +253,13 @@ sal_Int32 SAL_CALL ScVbaSheetObjectBase::getPlacement() throw (uno::RuntimeExcep
nRet = excel::XlPlacement::xlFreeFloating;
}
}
+#endif
return nRet;
}
-void SAL_CALL ScVbaSheetObjectBase::setPlacement( sal_Int32 nPlacement ) throw (uno::RuntimeException)
+void SAL_CALL ScVbaSheetObjectBase::setPlacement( sal_Int32 /*nPlacement*/ ) throw (uno::RuntimeException)
{
+#if 0 // TODO: not working at the moment.
SvxShape* pShape = SvxShape::getImplementation( mxShape );
if(pShape)
{
@@ -272,6 +275,7 @@ void SAL_CALL ScVbaSheetObjectBase::setPlacement( sal_Int32 nPlacement ) throw (
ScDrawLayer::SetAnchor(pObj, eType);
}
}
+#endif
}
sal_Bool SAL_CALL ScVbaSheetObjectBase::getPrintObject() throw (uno::RuntimeException)
More information about the Libreoffice-commits
mailing list