use more concrete UNO class in the form of ScModelObj
Change-Id: I9ad26f05635583e203ff338a88add65838c9188e Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/555 Reviewed-by: Noel Grandin <noel.grandin@collabora.com> Tested-by: Jenkins CPCI <releng@collaboraoffice.com> (cherry picked from commit 0a6ee7a99d6a5d624c4303256cc385ca6e23d456) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211619 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
This commit is contained in:
committed by
Xisco Fauli
parent
e5856e9912
commit
ce16bc37fd
@@ -47,7 +47,7 @@ protected:
|
|||||||
virtual ~VbaApplicationBase() override;
|
virtual ~VbaApplicationBase() override;
|
||||||
|
|
||||||
/// @throws css::uno::RuntimeException
|
/// @throws css::uno::RuntimeException
|
||||||
virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() = 0;
|
virtual css::frame::XModel* getCurrentDocument() = 0;
|
||||||
public:
|
public:
|
||||||
// XHelperInterface ( parent is itself )
|
// XHelperInterface ( parent is itself )
|
||||||
virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) override { return this; }
|
virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) override { return this; }
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class VBAHELPER_DLLPUBLIC VbaDocumentBase : public VbaDocumentBase_BASE
|
|||||||
protected:
|
protected:
|
||||||
css::uno::Reference< css::uno::XInterface > mxVBProject;
|
css::uno::Reference< css::uno::XInterface > mxVBProject;
|
||||||
protected:
|
protected:
|
||||||
virtual css::uno::Reference< css::frame::XModel > getModel() const = 0;
|
virtual css::frame::XModel* getModel() const = 0;
|
||||||
public:
|
public:
|
||||||
VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext );
|
VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext );
|
||||||
VbaDocumentBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
|
VbaDocumentBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
|
||||||
|
|||||||
@@ -2036,12 +2036,12 @@ static OUString getFileNameFromDoc( const ScDocument* pDoc )
|
|||||||
// TODO : er points at ScGlobal::GetAbsDocName()
|
// TODO : er points at ScGlobal::GetAbsDocName()
|
||||||
// as a better template. Look into it
|
// as a better template. Look into it
|
||||||
OUString sFileName;
|
OUString sFileName;
|
||||||
SfxObjectShell* pShell;
|
ScDocShell* pShell;
|
||||||
|
|
||||||
if( nullptr != pDoc &&
|
if( nullptr != pDoc &&
|
||||||
nullptr != (pShell = pDoc->GetDocumentShell() ) )
|
nullptr != (pShell = pDoc->GetDocumentShell() ) )
|
||||||
{
|
{
|
||||||
uno::Reference< frame::XModel > xModel = pShell->GetModel();
|
rtl::Reference< ScModelObj > xModel = pShell->GetModel();
|
||||||
if( xModel.is() )
|
if( xModel.is() )
|
||||||
{
|
{
|
||||||
if( !xModel->getURL().isEmpty() )
|
if( !xModel->getURL().isEmpty() )
|
||||||
|
|||||||
@@ -244,14 +244,13 @@ void XclExpRoot::InitializeGlobals()
|
|||||||
SAL_WARN( "sc", "XclExpRoot::InitializeGlobals - no object shell");
|
SAL_WARN( "sc", "XclExpRoot::InitializeGlobals - no object shell");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
uno::Reference< lang::XComponent > xComponent = pShell->GetModel();
|
rtl::Reference< ScModelObj > xModel = pShell->GetModel();
|
||||||
if (!xComponent.is())
|
if (!xModel.is())
|
||||||
{
|
{
|
||||||
SAL_WARN( "sc", "XclExpRoot::InitializeGlobals - no component");
|
SAL_WARN( "sc", "XclExpRoot::InitializeGlobals - no component");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
uno::Reference< lang::XMultiServiceFactory > xModelFactory( xComponent, uno::UNO_QUERY);
|
oox::xls::OpCodeProvider aOpCodeProvider(xModel, false);
|
||||||
oox::xls::OpCodeProvider aOpCodeProvider(xModelFactory, false);
|
|
||||||
// Compiler mocks about non-matching ctor or conversion from
|
// Compiler mocks about non-matching ctor or conversion from
|
||||||
// Sequence<...> to Sequence<const ...> if directly created or passed,
|
// Sequence<...> to Sequence<const ...> if directly created or passed,
|
||||||
// conversion through Any works around.
|
// conversion through Any works around.
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ std::unique_ptr<XclExpOcxControlObj> XclEscherEx::CreateOCXCtrlObj( Reference< X
|
|||||||
|
|
||||||
// writes from xCtrlModel into mxCtlsStrm, raw class name returned in aClassName
|
// writes from xCtrlModel into mxCtlsStrm, raw class name returned in aClassName
|
||||||
Reference< XOutputStream > xOut( new utl::OSeekableOutputStreamWrapper( *mxCtlsStrm ) );
|
Reference< XOutputStream > xOut( new utl::OSeekableOutputStreamWrapper( *mxCtlsStrm ) );
|
||||||
Reference< css::frame::XModel > xModel( GetDocShell() ? GetDocShell()->GetModel() : nullptr );
|
rtl::Reference< ScModelObj > xModel( GetDocShell() ? GetDocShell()->GetModel() : nullptr );
|
||||||
if( xModel.is() && xOut.is() && oox::ole::MSConvertOCXControls::WriteOCXExcelKludgeStream( xModel, xOut, xCtrlModel, xShape->getSize(), aClassName ) )
|
if( xModel.is() && xOut.is() && oox::ole::MSConvertOCXControls::WriteOCXExcelKludgeStream( xModel, xOut, xCtrlModel, xShape->getSize(), aClassName ) )
|
||||||
{
|
{
|
||||||
sal_uInt32 nStrmSize = static_cast< sal_uInt32 >( mxCtlsStrm->Tell() - nStrmStart );
|
sal_uInt32 nStrmSize = static_cast< sal_uInt32 >( mxCtlsStrm->Tell() - nStrmStart );
|
||||||
|
|||||||
@@ -1687,9 +1687,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportFODS(SvStream &rStream)
|
|||||||
{
|
{
|
||||||
ScDLL::Init();
|
ScDLL::Init();
|
||||||
|
|
||||||
SfxObjectShellLock xDocSh(new ScDocShell);
|
rtl::Reference<ScDocShell> xDocSh(new ScDocShell);
|
||||||
|
SfxObjectShellLock xLock(xDocSh.get());
|
||||||
xDocSh->DoInitNew();
|
xDocSh->DoInitNew();
|
||||||
uno::Reference<frame::XModel> xModel(xDocSh->GetModel());
|
rtl::Reference<ScModelObj> xModel(xDocSh->GetModel());
|
||||||
|
|
||||||
uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
|
uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
|
||||||
uno::Reference<io::XInputStream> xStream(new ::utl::OSeekableInputStreamWrapper(rStream));
|
uno::Reference<io::XInputStream> xStream(new ::utl::OSeekableInputStreamWrapper(rStream));
|
||||||
@@ -1740,9 +1741,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestFODSExportXLS(SvStream &rStream)
|
|||||||
{
|
{
|
||||||
ScDLL::Init();
|
ScDLL::Init();
|
||||||
|
|
||||||
SfxObjectShellLock xDocSh(new ScDocShell);
|
rtl::Reference<ScDocShell> xDocSh(new ScDocShell);
|
||||||
|
SfxObjectShellLock xLock(xDocSh.get());
|
||||||
xDocSh->DoInitNew();
|
xDocSh->DoInitNew();
|
||||||
uno::Reference<frame::XModel> xModel(xDocSh->GetModel());
|
rtl::Reference<ScModelObj> xModel(xDocSh->GetModel());
|
||||||
|
|
||||||
uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
|
uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
|
||||||
uno::Reference<io::XInputStream> xStream(new ::utl::OSeekableInputStreamWrapper(rStream));
|
uno::Reference<io::XInputStream> xStream(new ::utl::OSeekableInputStreamWrapper(rStream));
|
||||||
@@ -1814,9 +1816,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportXLSX(SvStream &rStream)
|
|||||||
{
|
{
|
||||||
ScDLL::Init();
|
ScDLL::Init();
|
||||||
|
|
||||||
SfxObjectShellLock xDocSh(new ScDocShell);
|
rtl::Reference<ScDocShell> xDocSh(new ScDocShell);
|
||||||
|
SfxObjectShellLock xLock(xDocSh.get());
|
||||||
xDocSh->DoInitNew();
|
xDocSh->DoInitNew();
|
||||||
uno::Reference<frame::XModel> xModel(xDocSh->GetModel());
|
rtl::Reference<ScModelObj> xModel(xDocSh->GetModel());
|
||||||
|
|
||||||
uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
|
uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
|
||||||
uno::Reference<io::XInputStream> xStream(new utl::OSeekableInputStreamWrapper(rStream));
|
uno::Reference<io::XInputStream> xStream(new utl::OSeekableInputStreamWrapper(rStream));
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCodeMsg& rError )
|
|||||||
xStorage = pMedium->GetStorage();
|
xStorage = pMedium->GetStorage();
|
||||||
|
|
||||||
// get filter
|
// get filter
|
||||||
uno::Reference<frame::XModel> xModel = mrDocShell.GetModel();
|
rtl::Reference<ScModelObj> xModel = mrDocShell.GetModel();
|
||||||
|
|
||||||
/** property map for export info set */
|
/** property map for export info set */
|
||||||
static comphelper::PropertyMapEntry const aImportInfoMap[] =
|
static comphelper::PropertyMapEntry const aImportInfoMap[] =
|
||||||
@@ -318,10 +318,9 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCodeMsg& rError )
|
|||||||
|
|
||||||
// ---- get BuildId from parent container if available
|
// ---- get BuildId from parent container if available
|
||||||
|
|
||||||
uno::Reference< container::XChild > xChild( xModel, uno::UNO_QUERY );
|
if( xModel.is() )
|
||||||
if( xChild.is() )
|
|
||||||
{
|
{
|
||||||
uno::Reference< beans::XPropertySet > xParentSet( xChild->getParent(), uno::UNO_QUERY );
|
uno::Reference< beans::XPropertySet > xParentSet( xModel->getParent(), uno::UNO_QUERY );
|
||||||
if( xParentSet.is() )
|
if( xParentSet.is() )
|
||||||
{
|
{
|
||||||
uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xParentSet->getPropertySetInfo() );
|
uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xParentSet->getPropertySetInfo() );
|
||||||
@@ -382,13 +381,11 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCodeMsg& rError )
|
|||||||
// RDF metadata: ODF >= 1.2
|
// RDF metadata: ODF >= 1.2
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const uno::Reference< rdf::XDocumentMetadataAccess > xDMA(
|
|
||||||
xModel, uno::UNO_QUERY_THROW );
|
|
||||||
const uno::Reference< rdf::XURI > xBaseURI(
|
const uno::Reference< rdf::XURI > xBaseURI(
|
||||||
::sfx2::createBaseURI( xContext, xModel, aBaseURL, aName ) );
|
::sfx2::createBaseURI( xContext, xModel, aBaseURL, aName ) );
|
||||||
uno::Reference<task::XInteractionHandler> xHandler =
|
uno::Reference<task::XInteractionHandler> xHandler =
|
||||||
mrDocShell.GetMedium()->GetInteractionHandler();
|
mrDocShell.GetMedium()->GetInteractionHandler();
|
||||||
xDMA->loadMetadataFromStorage( xStorage, xBaseURI, xHandler );
|
xModel->loadMetadataFromStorage( xStorage, xBaseURI, xHandler );
|
||||||
}
|
}
|
||||||
catch ( const lang::WrappedTargetException & e)
|
catch ( const lang::WrappedTargetException & e)
|
||||||
{
|
{
|
||||||
@@ -534,19 +531,18 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCodeMsg& rError )
|
|||||||
|
|
||||||
bool bRet = !rError.IsError();
|
bool bRet = !rError.IsError();
|
||||||
|
|
||||||
::svx::DropUnusedNamedItems(xModel);
|
::svx::DropUnusedNamedItems(cppu::getXWeak(xModel.get()));
|
||||||
|
|
||||||
// set BuildId on XModel for later OLE object loading
|
// set BuildId on XModel for later OLE object loading
|
||||||
if( xInfoSet.is() )
|
if( xInfoSet.is() )
|
||||||
{
|
{
|
||||||
uno::Reference< beans::XPropertySet > xModelSet( xModel, uno::UNO_QUERY );
|
if( xModel.is() )
|
||||||
if( xModelSet.is() )
|
|
||||||
{
|
{
|
||||||
uno::Reference< beans::XPropertySetInfo > xModelSetInfo( xModelSet->getPropertySetInfo() );
|
uno::Reference< beans::XPropertySetInfo > xModelSetInfo( xModel->getPropertySetInfo() );
|
||||||
OUString sBuildPropName(u"BuildId"_ustr );
|
OUString sBuildPropName(u"BuildId"_ustr );
|
||||||
if( xModelSetInfo.is() && xModelSetInfo->hasPropertyByName(sBuildPropName) )
|
if( xModelSetInfo.is() && xModelSetInfo->hasPropertyByName(sBuildPropName) )
|
||||||
{
|
{
|
||||||
xModelSet->setPropertyValue( sBuildPropName, xInfoSet->getPropertyValue(sBuildPropName) );
|
xModel->setPropertyValue( sBuildPropName, xInfoSet->getPropertyValue(sBuildPropName) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,9 +559,9 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCodeMsg& rError )
|
|||||||
/* Set library container to VBA compatibility mode, this
|
/* Set library container to VBA compatibility mode, this
|
||||||
forces loading the Basic project, which in turn creates the
|
forces loading the Basic project, which in turn creates the
|
||||||
VBA Globals object and does all related initialization. */
|
VBA Globals object and does all related initialization. */
|
||||||
if ( xModelSet.is() ) try
|
if ( xModel.is() ) try
|
||||||
{
|
{
|
||||||
uno::Reference< script::vba::XVBACompatibility > xVBACompat( xModelSet->getPropertyValue(
|
uno::Reference< script::vba::XVBACompatibility > xVBACompat( xModel->getPropertyValue(
|
||||||
u"BasicLibraries"_ustr ), uno::UNO_QUERY_THROW );
|
u"BasicLibraries"_ustr ), uno::UNO_QUERY_THROW );
|
||||||
xVBACompat->setVBACompatibilityMode( true );
|
xVBACompat->setVBACompatibilityMode( true );
|
||||||
}
|
}
|
||||||
@@ -763,11 +759,10 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
|
|||||||
|
|
||||||
if ( pObjSh && xStorage.is() )
|
if ( pObjSh && xStorage.is() )
|
||||||
{
|
{
|
||||||
uno::Reference<frame::XModel> xModel(pObjSh->GetModel());
|
rtl::Reference<ScModelObj> xModel(pObjSh->GetModel());
|
||||||
// sorting wants to create undo actions
|
// sorting wants to create undo actions
|
||||||
assert(SfxObjectCreateMode::STANDARD != pObjSh->GetCreateMode() || rDoc.GetDrawLayer()->IsUndoEnabled());
|
assert(SfxObjectCreateMode::STANDARD != pObjSh->GetCreateMode() || rDoc.GetDrawLayer()->IsUndoEnabled());
|
||||||
uno::Reference<drawing::XDrawPagesSupplier> const xDPS(xModel, uno::UNO_QUERY);
|
uno::Reference<container::XIndexAccess> const xDPs(xModel->getDrawPages());
|
||||||
uno::Reference<container::XIndexAccess> const xDPs(xDPS->getDrawPages());
|
|
||||||
assert(xDPs.is());
|
assert(xDPs.is());
|
||||||
for (auto i = xDPs->getCount(); 0 < i; )
|
for (auto i = xDPs->getCount(); 0 < i; )
|
||||||
{
|
{
|
||||||
@@ -852,9 +847,7 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
|
|||||||
&& aVersion != ODFVER_010_TEXT
|
&& aVersion != ODFVER_010_TEXT
|
||||||
&& aVersion != ODFVER_011_TEXT )
|
&& aVersion != ODFVER_011_TEXT )
|
||||||
{
|
{
|
||||||
const uno::Reference< rdf::XDocumentMetadataAccess > xDMA(
|
xModel->storeMetadataToStorage( xStorage );
|
||||||
xModel, uno::UNO_QUERY_THROW );
|
|
||||||
xDMA->storeMetadataToStorage( xStorage );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( const beans::UnknownPropertyException &)
|
catch ( const beans::UnknownPropertyException &)
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ ScVbaApplication::hasProperty( const OUString& Name )
|
|||||||
uno::Reference< excel::XWorkbook >
|
uno::Reference< excel::XWorkbook >
|
||||||
ScVbaApplication::getActiveWorkbook()
|
ScVbaApplication::getActiveWorkbook()
|
||||||
{
|
{
|
||||||
uno::Reference< frame::XModel > xModel( getCurrentExcelDoc( mxContext ), uno::UNO_SET_THROW );
|
rtl::Reference< ScModelObj > xModel( dynamic_cast<ScModelObj*>(getCurrentExcelDoc( mxContext ).get()) );
|
||||||
uno::Reference< excel::XWorkbook > xWorkbook( getVBADocument( xModel ), uno::UNO_QUERY );
|
uno::Reference< excel::XWorkbook > xWorkbook( getVBADocument( xModel ), uno::UNO_QUERY );
|
||||||
if( xWorkbook.is() ) return xWorkbook;
|
if( xWorkbook.is() ) return xWorkbook;
|
||||||
// #i116936# getVBADocument() may return null in documents without global VBA mode enabled
|
// #i116936# getVBADocument() may return null in documents without global VBA mode enabled
|
||||||
@@ -266,7 +266,7 @@ ScVbaApplication::getActiveWorkbook()
|
|||||||
uno::Reference< excel::XWorkbook > SAL_CALL
|
uno::Reference< excel::XWorkbook > SAL_CALL
|
||||||
ScVbaApplication::getThisWorkbook()
|
ScVbaApplication::getThisWorkbook()
|
||||||
{
|
{
|
||||||
uno::Reference< frame::XModel > xModel( getThisExcelDoc( mxContext ), uno::UNO_SET_THROW );
|
rtl::Reference< ScModelObj > xModel( dynamic_cast<ScModelObj*>(getThisExcelDoc( mxContext ).get()) );
|
||||||
uno::Reference< excel::XWorkbook > xWorkbook( getVBADocument( xModel ), uno::UNO_QUERY );
|
uno::Reference< excel::XWorkbook > xWorkbook( getVBADocument( xModel ), uno::UNO_QUERY );
|
||||||
if( xWorkbook.is() ) return xWorkbook;
|
if( xWorkbook.is() ) return xWorkbook;
|
||||||
// #i116936# getVBADocument() may return null in documents without global VBA mode enabled
|
// #i116936# getVBADocument() may return null in documents without global VBA mode enabled
|
||||||
@@ -481,7 +481,7 @@ ScVbaApplication::Dialogs( const uno::Any &aIndex )
|
|||||||
uno::Reference< excel::XWindow > SAL_CALL
|
uno::Reference< excel::XWindow > SAL_CALL
|
||||||
ScVbaApplication::getActiveWindow()
|
ScVbaApplication::getActiveWindow()
|
||||||
{
|
{
|
||||||
uno::Reference< frame::XModel > xModel = getCurrentDocument();
|
rtl::Reference< ScModelObj > xModel = getCurrentDocument();
|
||||||
uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
|
uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
|
||||||
uno::Reference< XHelperInterface > xParent( getActiveWorkbook(), uno::UNO_QUERY_THROW );
|
uno::Reference< XHelperInterface > xParent( getActiveWorkbook(), uno::UNO_QUERY_THROW );
|
||||||
uno::Reference< excel::XWindow > xWin( new ScVbaWindow( xParent, mxContext, xModel, xController ) );
|
uno::Reference< excel::XWindow > xWin( new ScVbaWindow( xParent, mxContext, xModel, xController ) );
|
||||||
@@ -551,7 +551,7 @@ ScVbaApplication::setStatusBar( const uno::Any& _statusbar )
|
|||||||
ScVbaApplication::getCalculation()
|
ScVbaApplication::getCalculation()
|
||||||
{
|
{
|
||||||
// TODO: in Excel, this is an application-wide setting
|
// TODO: in Excel, this is an application-wide setting
|
||||||
uno::Reference<sheet::XCalculatable> xCalc(getCurrentDocument(), uno::UNO_QUERY_THROW);
|
rtl::Reference<ScModelObj> xCalc(getCurrentDocument());
|
||||||
if(xCalc->isAutomaticCalculationEnabled())
|
if(xCalc->isAutomaticCalculationEnabled())
|
||||||
return excel::XlCalculation::xlCalculationAutomatic;
|
return excel::XlCalculation::xlCalculationAutomatic;
|
||||||
else
|
else
|
||||||
@@ -562,7 +562,7 @@ void SAL_CALL
|
|||||||
ScVbaApplication::setCalculation( ::sal_Int32 _calculation )
|
ScVbaApplication::setCalculation( ::sal_Int32 _calculation )
|
||||||
{
|
{
|
||||||
// TODO: in Excel, this is an application-wide setting
|
// TODO: in Excel, this is an application-wide setting
|
||||||
uno::Reference< sheet::XCalculatable > xCalc(getCurrentDocument(), uno::UNO_QUERY_THROW);
|
rtl::Reference< ScModelObj > xCalc(getCurrentDocument());
|
||||||
switch(_calculation)
|
switch(_calculation)
|
||||||
{
|
{
|
||||||
case excel::XlCalculation::xlCalculationManual:
|
case excel::XlCalculation::xlCalculationManual:
|
||||||
@@ -978,9 +978,8 @@ ScVbaApplication::setIteration( sal_Bool bSet )
|
|||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
ScVbaApplication::Calculate()
|
ScVbaApplication::Calculate()
|
||||||
{
|
{
|
||||||
uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_SET_THROW );
|
rtl::Reference< ScModelObj > xModel( getCurrentDocument() );
|
||||||
uno::Reference< sheet::XCalculatable > xCalculatable( getCurrentDocument(), uno::UNO_QUERY_THROW );
|
xModel->calculateAll();
|
||||||
xCalculatable->calculateAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @throws uno::RuntimeException
|
/// @throws uno::RuntimeException
|
||||||
@@ -1429,10 +1428,10 @@ ScVbaApplication::Caller( const uno::Any& /*aIndex*/ )
|
|||||||
return aRet;
|
return aRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Reference< frame::XModel >
|
ScModelObj*
|
||||||
ScVbaApplication::getCurrentDocument()
|
ScVbaApplication::getCurrentDocument()
|
||||||
{
|
{
|
||||||
return getCurrentExcelDoc(mxContext);
|
return dynamic_cast<ScModelObj*>(getCurrentExcelDoc(mxContext).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Any SAL_CALL
|
uno::Any SAL_CALL
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <vbahelper/vbaapplicationbase.hxx>
|
#include <vbahelper/vbaapplicationbase.hxx>
|
||||||
#include <comphelper/invocationhelper.hxx>
|
#include <comphelper/invocationhelper.hxx>
|
||||||
#include <cppuhelper/implbase.hxx>
|
#include <cppuhelper/implbase.hxx>
|
||||||
|
#include <docuno.hxx>
|
||||||
|
|
||||||
namespace com::sun::star::uno { class XComponentContext; }
|
namespace com::sun::star::uno { class XComponentContext; }
|
||||||
namespace ooo::vba { class XSink; }
|
namespace ooo::vba { class XSink; }
|
||||||
@@ -53,7 +54,7 @@ private:
|
|||||||
comphelper::InvocationHelper m_aInvocationHelper;
|
comphelper::InvocationHelper m_aInvocationHelper;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() override;
|
virtual ScModelObj* getCurrentDocument() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ScVbaApplication( const css::uno::Reference< css::uno::XComponentContext >& m_xContext );
|
explicit ScVbaApplication( const css::uno::Reference< css::uno::XComponentContext >& m_xContext );
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ template< typename... Ifc >
|
|||||||
ScVbaFormat< Ifc... >::ScVbaFormat( const uno::Reference< XHelperInterface >& xParent,
|
ScVbaFormat< Ifc... >::ScVbaFormat( const uno::Reference< XHelperInterface >& xParent,
|
||||||
const uno::Reference< uno::XComponentContext > & xContext,
|
const uno::Reference< uno::XComponentContext > & xContext,
|
||||||
uno::Reference< beans::XPropertySet > _xPropertySet,
|
uno::Reference< beans::XPropertySet > _xPropertySet,
|
||||||
uno::Reference< frame::XModel > xModel,
|
const rtl::Reference< ScModelObj >& xModel,
|
||||||
bool bCheckAmbiguoity )
|
bool bCheckAmbiguoity )
|
||||||
: ScVbaFormat_BASE( xParent, xContext ),
|
: ScVbaFormat_BASE( xParent, xContext ),
|
||||||
m_aDefaultLocale( u"en"_ustr, u"US"_ustr, OUString() ),
|
m_aDefaultLocale( u"en"_ustr, u"US"_ustr, OUString() ),
|
||||||
mxPropertySet(std::move( _xPropertySet )),
|
mxPropertySet(std::move( _xPropertySet )),
|
||||||
mxModel(std::move( xModel )),
|
mxModel( xModel ),
|
||||||
mbCheckAmbiguoity( bCheckAmbiguoity ),
|
mbCheckAmbiguoity( bCheckAmbiguoity ),
|
||||||
mbAddIndent( false )
|
mbAddIndent( false )
|
||||||
{
|
{
|
||||||
@@ -773,7 +773,7 @@ ScVbaFormat< Ifc... >::initializeNumberFormats()
|
|||||||
{
|
{
|
||||||
if ( !xNumberFormats.is() )
|
if ( !xNumberFormats.is() )
|
||||||
{
|
{
|
||||||
mxNumberFormatsSupplier.set( mxModel, uno::UNO_QUERY_THROW );
|
mxNumberFormatsSupplier.set( cppu::getXWeak(mxModel.get()), uno::UNO_QUERY_THROW );
|
||||||
xNumberFormats = mxNumberFormatsSupplier->getNumberFormats();
|
xNumberFormats = mxNumberFormatsSupplier->getNumberFormats();
|
||||||
xNumberFormatTypes.set( xNumberFormats, uno::UNO_QUERY ); // _THROW?
|
xNumberFormatTypes.set( xNumberFormats, uno::UNO_QUERY ); // _THROW?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <com/sun/star/lang/Locale.hpp>
|
#include <com/sun/star/lang/Locale.hpp>
|
||||||
#include <vbahelper/vbahelperinterface.hxx>
|
#include <vbahelper/vbahelperinterface.hxx>
|
||||||
|
#include <rtl/ref.hxx>
|
||||||
|
|
||||||
namespace com::sun::star::beans { class XPropertySet; }
|
namespace com::sun::star::beans { class XPropertySet; }
|
||||||
namespace com::sun::star::beans { class XPropertyState; }
|
namespace com::sun::star::beans { class XPropertyState; }
|
||||||
@@ -31,6 +32,7 @@ namespace ooo::vba::excel { class XFont; }
|
|||||||
namespace ooo::vba::excel { class XInterior; }
|
namespace ooo::vba::excel { class XInterior; }
|
||||||
|
|
||||||
class ScCellRangesBase;
|
class ScCellRangesBase;
|
||||||
|
class ScModelObj;
|
||||||
class SfxItemSet;
|
class SfxItemSet;
|
||||||
|
|
||||||
template< typename... Ifc >
|
template< typename... Ifc >
|
||||||
@@ -43,7 +45,7 @@ protected:
|
|||||||
css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
|
css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
|
||||||
css::uno::Reference< css::util::XNumberFormats > xNumberFormats;
|
css::uno::Reference< css::util::XNumberFormats > xNumberFormats;
|
||||||
css::uno::Reference< css::util::XNumberFormatTypes > xNumberFormatTypes;
|
css::uno::Reference< css::util::XNumberFormatTypes > xNumberFormatTypes;
|
||||||
css::uno::Reference< css::frame::XModel > mxModel;
|
rtl::Reference< ScModelObj > mxModel;
|
||||||
css::uno::Reference< css::beans::XPropertyState > xPropertyState;
|
css::uno::Reference< css::beans::XPropertyState > xPropertyState;
|
||||||
bool mbCheckAmbiguoity;
|
bool mbCheckAmbiguoity;
|
||||||
bool mbAddIndent;
|
bool mbAddIndent;
|
||||||
@@ -61,7 +63,7 @@ protected:
|
|||||||
virtual ScCellRangesBase* getCellRangesBase();
|
virtual ScCellRangesBase* getCellRangesBase();
|
||||||
public:
|
public:
|
||||||
/// @throws css::script::BasicErrorException
|
/// @throws css::script::BasicErrorException
|
||||||
ScVbaFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, css::uno::Reference< css::beans::XPropertySet > _xPropertySet, css::uno::Reference< css::frame::XModel > xModel, bool bCheckAmbiguoity );
|
ScVbaFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, css::uno::Reference< css::beans::XPropertySet > _xPropertySet, const rtl::Reference<ScModelObj>& xModel, bool bCheckAmbiguoity );
|
||||||
virtual css::uno::Reference< ov::XHelperInterface > thisHelperIface() = 0;
|
virtual css::uno::Reference< ov::XHelperInterface > thisHelperIface() = 0;
|
||||||
/// @throws css::uno::RuntimeException
|
/// @throws css::uno::RuntimeException
|
||||||
void SAL_CALL setAddIndent( const css::uno::Any& BAddIndent) { BAddIndent >>= mbAddIndent; }
|
void SAL_CALL setAddIndent( const css::uno::Any& BAddIndent) { BAddIndent >>= mbAddIndent; }
|
||||||
|
|||||||
@@ -388,14 +388,14 @@ getDocShellFromRanges( const uno::Reference< sheet::XSheetCellRangeContainer >&
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @throws uno::RuntimeException
|
/// @throws uno::RuntimeException
|
||||||
static uno::Reference< frame::XModel > getModelFromXIf( const uno::Reference< uno::XInterface >& xIf )
|
static rtl::Reference< ScModelObj > getModelFromXIf( const uno::Reference< uno::XInterface >& xIf )
|
||||||
{
|
{
|
||||||
ScDocShell* pDocShell = getDocShellFromIf(xIf );
|
ScDocShell* pDocShell = getDocShellFromIf(xIf );
|
||||||
return pDocShell->GetModel();
|
return pDocShell->GetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @throws uno::RuntimeException
|
/// @throws uno::RuntimeException
|
||||||
static uno::Reference< frame::XModel > getModelFromRange( const uno::Reference< table::XCellRange >& xRange )
|
static rtl::Reference< ScModelObj > getModelFromRange( const uno::Reference< table::XCellRange >& xRange )
|
||||||
{
|
{
|
||||||
// the XInterface for getImplementation can be any derived interface, no need for queryInterface
|
// the XInterface for getImplementation can be any derived interface, no need for queryInterface
|
||||||
uno::Reference< uno::XInterface > xIf( xRange );
|
uno::Reference< uno::XInterface > xIf( xRange );
|
||||||
@@ -480,7 +480,7 @@ class NumFormatHelper
|
|||||||
public:
|
public:
|
||||||
explicit NumFormatHelper( const uno::Reference< table::XCellRange >& xRange )
|
explicit NumFormatHelper( const uno::Reference< table::XCellRange >& xRange )
|
||||||
{
|
{
|
||||||
mxSupplier.set( getModelFromRange( xRange ), uno::UNO_QUERY_THROW );
|
mxSupplier.set( cppu::getXWeak(getModelFromRange( xRange ).get()), uno::UNO_QUERY_THROW );
|
||||||
mxRangeProps.set( xRange, uno::UNO_QUERY_THROW);
|
mxRangeProps.set( xRange, uno::UNO_QUERY_THROW);
|
||||||
mxFormats = mxSupplier->getNumberFormats();
|
mxFormats = mxSupplier->getNumberFormats();
|
||||||
}
|
}
|
||||||
@@ -1418,7 +1418,14 @@ lcl_setupBorders( const uno::Reference< excel::XRange >& xParentRange, const uno
|
|||||||
}
|
}
|
||||||
|
|
||||||
ScVbaRange::ScVbaRange( uno::Sequence< uno::Any> const & args,
|
ScVbaRange::ScVbaRange( uno::Sequence< uno::Any> const & args,
|
||||||
uno::Reference< uno::XComponentContext> const & xContext ) : ScVbaRange_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< beans::XPropertySet >( args, 1, false ), getModelFromXIf( getXSomethingFromArgs< uno::XInterface >( args, 1 ) ), true ), mbIsRows( false ), mbIsColumns( false )
|
uno::Reference< uno::XComponentContext> const & xContext )
|
||||||
|
: ScVbaRange_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ),
|
||||||
|
xContext,
|
||||||
|
getXSomethingFromArgs< beans::XPropertySet >( args, 1, false ),
|
||||||
|
getModelFromXIf( getXSomethingFromArgs< uno::XInterface >( args, 1 ) ),
|
||||||
|
true ),
|
||||||
|
mbIsRows( false ),
|
||||||
|
mbIsColumns( false )
|
||||||
{
|
{
|
||||||
mxRange.set( mxPropertySet, uno::UNO_QUERY );
|
mxRange.set( mxPropertySet, uno::UNO_QUERY );
|
||||||
mxRanges.set( mxPropertySet, uno::UNO_QUERY );
|
mxRanges.set( mxPropertySet, uno::UNO_QUERY );
|
||||||
@@ -5374,8 +5381,8 @@ ScVbaRange::getStyle()
|
|||||||
OUString sStyleName;
|
OUString sStyleName;
|
||||||
xProps->getPropertyValue( CELLSTYLE ) >>= sStyleName;
|
xProps->getPropertyValue( CELLSTYLE ) >>= sStyleName;
|
||||||
ScDocShell* pShell = getScDocShell();
|
ScDocShell* pShell = getScDocShell();
|
||||||
uno::Reference< frame::XModel > xModel( pShell->GetModel() );
|
ScModelObj* pModel( pShell->GetModel() );
|
||||||
uno::Reference< excel::XStyle > xStyle = new ScVbaStyle( this, mxContext, sStyleName, xModel );
|
uno::Reference< excel::XStyle > xStyle = new ScVbaStyle( this, mxContext, sStyleName, pModel );
|
||||||
return uno::Any( xStyle );
|
return uno::Any( xStyle );
|
||||||
}
|
}
|
||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <basic/sberrors.hxx>
|
#include <basic/sberrors.hxx>
|
||||||
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
|
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
|
||||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||||
|
#include <docuno.hxx>
|
||||||
|
|
||||||
using namespace ::ooo::vba;
|
using namespace ::ooo::vba;
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
@@ -28,17 +29,18 @@ using namespace ::com::sun::star;
|
|||||||
constexpr OUString DISPLAYNAME = u"DisplayName"_ustr;
|
constexpr OUString DISPLAYNAME = u"DisplayName"_ustr;
|
||||||
|
|
||||||
uno::Reference< container::XNameAccess >
|
uno::Reference< container::XNameAccess >
|
||||||
ScVbaStyle::getStylesNameContainer( const uno::Reference< frame::XModel >& xModel )
|
ScVbaStyle::getStylesNameContainer( const rtl::Reference<ScModelObj>& xModel )
|
||||||
{
|
{
|
||||||
uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( xModel, uno::UNO_QUERY_THROW);
|
if (!xModel)
|
||||||
uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName(u"CellStyles"_ustr), uno::UNO_QUERY_THROW );
|
throw uno::RuntimeException();
|
||||||
|
uno::Reference< container::XNameAccess > xStylesAccess( xModel->getStyleFamilies()->getByName(u"CellStyles"_ustr), uno::UNO_QUERY_THROW );
|
||||||
return xStylesAccess;
|
return xStylesAccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @throws script::BasicErrorException
|
/// @throws script::BasicErrorException
|
||||||
/// @throws uno::RuntimeException
|
/// @throws uno::RuntimeException
|
||||||
static uno::Reference< beans::XPropertySet >
|
static uno::Reference< beans::XPropertySet >
|
||||||
lcl_getStyleProps( const OUString& sStyleName, const uno::Reference< frame::XModel >& xModel )
|
lcl_getStyleProps( const OUString& sStyleName, const rtl::Reference<ScModelObj>& xModel )
|
||||||
{
|
{
|
||||||
|
|
||||||
uno::Reference< beans::XPropertySet > xStyleProps( ScVbaStyle::getStylesNameContainer( xModel )->getByName( sStyleName ), uno::UNO_QUERY_THROW );
|
uno::Reference< beans::XPropertySet > xStyleProps( ScVbaStyle::getStylesNameContainer( xModel )->getByName( sStyleName ), uno::UNO_QUERY_THROW );
|
||||||
@@ -56,14 +58,12 @@ void ScVbaStyle::initialise()
|
|||||||
}
|
}
|
||||||
mxStyle.set( mxPropertySet, uno::UNO_QUERY_THROW );
|
mxStyle.set( mxPropertySet, uno::UNO_QUERY_THROW );
|
||||||
|
|
||||||
uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxModel, uno::UNO_QUERY_THROW );
|
|
||||||
mxStyleFamilyNameContainer.set( ScVbaStyle::getStylesNameContainer( mxModel ), uno::UNO_QUERY_THROW );
|
mxStyleFamilyNameContainer.set( ScVbaStyle::getStylesNameContainer( mxModel ), uno::UNO_QUERY_THROW );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScVbaStyle::ScVbaStyle( const uno::Reference< ov::XHelperInterface >& xParent,
|
ScVbaStyle::ScVbaStyle( const uno::Reference< ov::XHelperInterface >& xParent,
|
||||||
const uno::Reference< uno::XComponentContext > & xContext,
|
const uno::Reference< uno::XComponentContext > & xContext,
|
||||||
const OUString& sStyleName, const uno::Reference< frame::XModel >& _xModel )
|
const OUString& sStyleName, const rtl::Reference<ScModelObj>& _xModel )
|
||||||
: ScVbaStyle_BASE( xParent, xContext, lcl_getStyleProps( sStyleName, _xModel ), _xModel, false )
|
: ScVbaStyle_BASE( xParent, xContext, lcl_getStyleProps( sStyleName, _xModel ), _xModel, false )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -79,7 +79,7 @@ ScVbaStyle::ScVbaStyle( const uno::Reference< ov::XHelperInterface >& xParent,
|
|||||||
ScVbaStyle::ScVbaStyle( const uno::Reference< XHelperInterface >& xParent,
|
ScVbaStyle::ScVbaStyle( const uno::Reference< XHelperInterface >& xParent,
|
||||||
const uno::Reference< uno::XComponentContext > & xContext,
|
const uno::Reference< uno::XComponentContext > & xContext,
|
||||||
const uno::Reference< beans::XPropertySet >& _xPropertySet,
|
const uno::Reference< beans::XPropertySet >& _xPropertySet,
|
||||||
const uno::Reference< frame::XModel >& _xModel )
|
const rtl::Reference<ScModelObj>& _xModel )
|
||||||
: ScVbaStyle_BASE( xParent, xContext, _xPropertySet, _xModel, false )
|
: ScVbaStyle_BASE( xParent, xContext, _xPropertySet, _xModel, false )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
#include <com/sun/star/container/XNameContainer.hpp>
|
#include <com/sun/star/container/XNameContainer.hpp>
|
||||||
#include "vbaformat.hxx"
|
#include "vbaformat.hxx"
|
||||||
|
|
||||||
|
class ScModelObj;
|
||||||
|
|
||||||
typedef ScVbaFormat< ov::excel::XStyle > ScVbaStyle_BASE;
|
typedef ScVbaFormat< ov::excel::XStyle > ScVbaStyle_BASE;
|
||||||
|
|
||||||
class ScVbaStyle final : public ScVbaStyle_BASE
|
class ScVbaStyle final : public ScVbaStyle_BASE
|
||||||
@@ -37,12 +39,12 @@ class ScVbaStyle final : public ScVbaStyle_BASE
|
|||||||
public:
|
public:
|
||||||
/// @throws css::script::BasicErrorException
|
/// @throws css::script::BasicErrorException
|
||||||
/// @throws css::uno::RuntimeException
|
/// @throws css::uno::RuntimeException
|
||||||
ScVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const OUString& sStyleName, const css::uno::Reference< css::frame::XModel >& _xModel );
|
ScVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const OUString& sStyleName, const rtl::Reference<ScModelObj>& _xModel );
|
||||||
/// @throws css::script::BasicErrorException
|
/// @throws css::script::BasicErrorException
|
||||||
/// @throws css::uno::RuntimeException
|
/// @throws css::uno::RuntimeException
|
||||||
ScVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet, const css::uno::Reference< css::frame::XModel >& _xModel );
|
ScVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet, const rtl::Reference<ScModelObj>& _cModel );
|
||||||
/// @throws css::uno::RuntimeException
|
/// @throws css::uno::RuntimeException
|
||||||
static css::uno::Reference< css::container::XNameAccess > getStylesNameContainer( const css::uno::Reference< css::frame::XModel >& xModel );
|
static css::uno::Reference< css::container::XNameAccess > getStylesNameContainer( const rtl::Reference<ScModelObj>& xModel );
|
||||||
virtual css::uno::Reference< ov::XHelperInterface > thisHelperIface() override { return this; };
|
virtual css::uno::Reference< ov::XHelperInterface > thisHelperIface() override { return this; };
|
||||||
// XStyle Methods
|
// XStyle Methods
|
||||||
virtual sal_Bool SAL_CALL BuiltIn() override;
|
virtual sal_Bool SAL_CALL BuiltIn() override;
|
||||||
|
|||||||
@@ -24,12 +24,13 @@
|
|||||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <docuno.hxx>
|
||||||
|
|
||||||
using namespace ::ooo::vba;
|
using namespace ::ooo::vba;
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
|
|
||||||
static css::uno::Any
|
static css::uno::Any
|
||||||
lcl_createAPIStyleToVBAObject( const css::uno::Any& aObject, const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel )
|
lcl_createAPIStyleToVBAObject( const css::uno::Any& aObject, const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const rtl::Reference<ScModelObj>& xModel )
|
||||||
{
|
{
|
||||||
uno::Reference< beans::XPropertySet > xStyleProps( aObject, uno::UNO_QUERY_THROW );
|
uno::Reference< beans::XPropertySet > xStyleProps( aObject, uno::UNO_QUERY_THROW );
|
||||||
uno::Reference< excel::XStyle > xStyle( new ScVbaStyle( xParent, xContext, xStyleProps, xModel ) );
|
uno::Reference< excel::XStyle > xStyle( new ScVbaStyle( xParent, xContext, xStyleProps, xModel ) );
|
||||||
@@ -38,15 +39,15 @@ lcl_createAPIStyleToVBAObject( const css::uno::Any& aObject, const uno::Referenc
|
|||||||
|
|
||||||
ScVbaStyles::ScVbaStyles( const uno::Reference< XHelperInterface >& xParent,
|
ScVbaStyles::ScVbaStyles( const uno::Reference< XHelperInterface >& xParent,
|
||||||
const uno::Reference< css::uno::XComponentContext > & xContext,
|
const uno::Reference< css::uno::XComponentContext > & xContext,
|
||||||
const uno::Reference< frame::XModel >& xModel )
|
ScModelObj* pModel )
|
||||||
: ScVbaStyles_BASE( xParent,
|
: ScVbaStyles_BASE( xParent,
|
||||||
xContext,
|
xContext,
|
||||||
uno::Reference< container::XIndexAccess >( ScVbaStyle::getStylesNameContainer( xModel ), uno::UNO_QUERY_THROW ) ),
|
uno::Reference< container::XIndexAccess >( ScVbaStyle::getStylesNameContainer( pModel ), uno::UNO_QUERY_THROW ) ),
|
||||||
mxModel( xModel )
|
mxModel( pModel )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mxMSF.set( mxModel, uno::UNO_QUERY_THROW );
|
mxMSF = mxModel;
|
||||||
mxNameContainerCellStyles.set( m_xNameAccess, uno::UNO_QUERY_THROW );
|
mxNameContainerCellStyles.set( m_xNameAccess, uno::UNO_QUERY_THROW );
|
||||||
}
|
}
|
||||||
catch (uno::Exception& )
|
catch (uno::Exception& )
|
||||||
@@ -80,11 +81,11 @@ class EnumWrapper : public EnumerationHelper_BASE
|
|||||||
uno::Reference<container::XIndexAccess > m_xIndexAccess;
|
uno::Reference<container::XIndexAccess > m_xIndexAccess;
|
||||||
uno::Reference<XHelperInterface > m_xParent;
|
uno::Reference<XHelperInterface > m_xParent;
|
||||||
uno::Reference<uno::XComponentContext > m_xContext;
|
uno::Reference<uno::XComponentContext > m_xContext;
|
||||||
uno::Reference<frame::XModel > m_xModel;
|
rtl::Reference<ScModelObj > m_xModel;
|
||||||
|
|
||||||
sal_Int32 nIndex;
|
sal_Int32 nIndex;
|
||||||
public:
|
public:
|
||||||
EnumWrapper( uno::Reference< container::XIndexAccess > xIndexAccess, uno::Reference<XHelperInterface > xParent, uno::Reference<uno::XComponentContext > xContext, uno::Reference<frame::XModel > xModel ) : m_xIndexAccess(std::move( xIndexAccess )), m_xParent(std::move( xParent )), m_xContext(std::move( xContext )), m_xModel(std::move( xModel )), nIndex( 0 ) {}
|
EnumWrapper( uno::Reference< container::XIndexAccess > xIndexAccess, uno::Reference<XHelperInterface > xParent, uno::Reference<uno::XComponentContext > xContext, rtl::Reference<ScModelObj > xModel ) : m_xIndexAccess(std::move( xIndexAccess )), m_xParent(std::move( xParent )), m_xContext(std::move( xContext )), m_xModel(std::move( xModel )), nIndex( 0 ) {}
|
||||||
virtual sal_Bool SAL_CALL hasMoreElements( ) override
|
virtual sal_Bool SAL_CALL hasMoreElements( ) override
|
||||||
{
|
{
|
||||||
return ( nIndex < m_xIndexAccess->getCount() );
|
return ( nIndex < m_xIndexAccess->getCount() );
|
||||||
|
|||||||
@@ -19,19 +19,21 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <ooo/vba/excel/XStyles.hpp>
|
#include <ooo/vba/excel/XStyles.hpp>
|
||||||
#include <vbahelper/vbacollectionimpl.hxx>
|
#include <vbahelper/vbacollectionimpl.hxx>
|
||||||
|
#include <rtl/ref.hxx>
|
||||||
|
|
||||||
namespace com::sun::star::lang { class XMultiServiceFactory; }
|
namespace com::sun::star::lang { class XMultiServiceFactory; }
|
||||||
namespace com::sun::star::container { class XNameContainer; }
|
namespace com::sun::star::container { class XNameContainer; }
|
||||||
|
class ScModelObj;
|
||||||
|
|
||||||
typedef CollTestImplHelper< ov::excel::XStyles > ScVbaStyles_BASE;
|
typedef CollTestImplHelper< ov::excel::XStyles > ScVbaStyles_BASE;
|
||||||
class ScVbaStyles: public ScVbaStyles_BASE
|
class ScVbaStyles: public ScVbaStyles_BASE
|
||||||
{
|
{
|
||||||
css::uno::Reference< css::frame::XModel > mxModel;
|
rtl::Reference< ScModelObj > mxModel;
|
||||||
css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
|
css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
|
||||||
css::uno::Reference< css::container::XNameContainer > mxNameContainerCellStyles;
|
css::uno::Reference< css::container::XNameContainer > mxNameContainerCellStyles;
|
||||||
public:
|
public:
|
||||||
/// @throws css::script::BasicErrorException
|
/// @throws css::script::BasicErrorException
|
||||||
ScVbaStyles( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
|
ScVbaStyles( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, ScModelObj* pModel );
|
||||||
/// @throws css::uno::RuntimeException
|
/// @throws css::uno::RuntimeException
|
||||||
css::uno::Sequence< OUString > getStyleNames();
|
css::uno::Sequence< OUString > getStyleNames();
|
||||||
/// @throws css::script::BasicErrorException
|
/// @throws css::script::BasicErrorException
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public:
|
|||||||
ScVbaWindow::ScVbaWindow(
|
ScVbaWindow::ScVbaWindow(
|
||||||
const uno::Reference< XHelperInterface >& xParent,
|
const uno::Reference< XHelperInterface >& xParent,
|
||||||
const uno::Reference< uno::XComponentContext >& xContext,
|
const uno::Reference< uno::XComponentContext >& xContext,
|
||||||
const uno::Reference< frame::XModel >& xModel,
|
const rtl::Reference< ScModelObj >& xModel,
|
||||||
const uno::Reference< frame::XController >& xController ) :
|
const uno::Reference< frame::XController >& xController ) :
|
||||||
WindowImpl_BASE( xParent, xContext, xController ),
|
WindowImpl_BASE( xParent, xContext, xController ),
|
||||||
m_xModel(xModel)
|
m_xModel(xModel)
|
||||||
@@ -202,7 +202,7 @@ ScVbaWindow::ScVbaWindow(
|
|||||||
const uno::Sequence< uno::Any >& args,
|
const uno::Sequence< uno::Any >& args,
|
||||||
const uno::Reference< uno::XComponentContext >& xContext ) :
|
const uno::Reference< uno::XComponentContext >& xContext ) :
|
||||||
WindowImpl_BASE( args, xContext ),
|
WindowImpl_BASE( args, xContext ),
|
||||||
m_xModel(getXSomethingFromArgs< frame::XModel >( args, 1, false ))
|
m_xModel(dynamic_cast<ScModelObj*>(getXSomethingFromArgs< frame::XModel >( args, 1, false ).get()))
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@@ -729,7 +729,7 @@ void SAL_CALL ScVbaWindow::setZoom(const uno::Any& _zoom)
|
|||||||
{
|
{
|
||||||
sal_Int16 nZoom = 100;
|
sal_Int16 nZoom = 100;
|
||||||
_zoom >>= nZoom;
|
_zoom >>= nZoom;
|
||||||
uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( m_xModel, uno::UNO_QUERY_THROW );
|
uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( m_xModel );
|
||||||
uno::Reference< excel::XWorksheet > xActiveSheet = ActiveSheet();
|
uno::Reference< excel::XWorksheet > xActiveSheet = ActiveSheet();
|
||||||
SCTAB nTab = 0;
|
SCTAB nTab = 0;
|
||||||
if ( !ScVbaWorksheets::nameExists (xSpreadDoc, xActiveSheet->getName(), nTab) )
|
if ( !ScVbaWorksheets::nameExists (xSpreadDoc, xActiveSheet->getName(), nTab) )
|
||||||
|
|||||||
@@ -27,12 +27,14 @@
|
|||||||
|
|
||||||
#include <vbahelper/vbawindowbase.hxx>
|
#include <vbahelper/vbawindowbase.hxx>
|
||||||
|
|
||||||
|
class ScModelObj;
|
||||||
|
|
||||||
typedef cppu::ImplInheritanceHelper< VbaWindowBase, ov::excel::XWindow > WindowImpl_BASE;
|
typedef cppu::ImplInheritanceHelper< VbaWindowBase, ov::excel::XWindow > WindowImpl_BASE;
|
||||||
|
|
||||||
class ScVbaWindow : public WindowImpl_BASE
|
class ScVbaWindow : public WindowImpl_BASE
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
css::uno::Reference<css::frame::XModel> m_xModel;
|
rtl::Reference<ScModelObj> m_xModel;
|
||||||
css::uno::Reference< ov::excel::XPane > m_xPane;
|
css::uno::Reference< ov::excel::XPane > m_xPane;
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
@@ -55,7 +57,7 @@ public:
|
|||||||
ScVbaWindow(
|
ScVbaWindow(
|
||||||
const css::uno::Reference< ov::XHelperInterface >& xParent,
|
const css::uno::Reference< ov::XHelperInterface >& xParent,
|
||||||
const css::uno::Reference< css::uno::XComponentContext >& xContext,
|
const css::uno::Reference< css::uno::XComponentContext >& xContext,
|
||||||
const css::uno::Reference< css::frame::XModel >& xModel,
|
const rtl::Reference< ScModelObj >& xModel,
|
||||||
const css::uno::Reference< css::frame::XController >& xController );
|
const css::uno::Reference< css::frame::XController >& xController );
|
||||||
/// @throws css::uno::RuntimeException
|
/// @throws css::uno::RuntimeException
|
||||||
ScVbaWindow(
|
ScVbaWindow(
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ using namespace ::ooo::vba;
|
|||||||
typedef std::unordered_map< OUString,
|
typedef std::unordered_map< OUString,
|
||||||
sal_Int32 > NameIndexHash;
|
sal_Int32 > NameIndexHash;
|
||||||
|
|
||||||
static uno::Reference< XHelperInterface > lcl_createWorkbookHIParent( const uno::Reference< frame::XModel >& xModel, const uno::Reference< uno::XComponentContext >& xContext, const uno::Any& aApplication )
|
static uno::Reference< XHelperInterface > lcl_createWorkbookHIParent( const rtl::Reference< ScModelObj >& xModel, const uno::Reference< uno::XComponentContext >& xContext, const uno::Any& aApplication )
|
||||||
{
|
{
|
||||||
return new ScVbaWorkbook( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel );
|
return new ScVbaWorkbook( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel );
|
||||||
}
|
}
|
||||||
@@ -49,9 +49,10 @@ static uno::Reference< XHelperInterface > lcl_createWorkbookHIParent( const uno:
|
|||||||
static uno::Any ComponentToWindow( const uno::Any& aSource, const uno::Reference< uno::XComponentContext > & xContext, const uno::Any& aApplication )
|
static uno::Any ComponentToWindow( const uno::Any& aSource, const uno::Reference< uno::XComponentContext > & xContext, const uno::Any& aApplication )
|
||||||
{
|
{
|
||||||
uno::Reference< frame::XModel > xModel( aSource, uno::UNO_QUERY_THROW );
|
uno::Reference< frame::XModel > xModel( aSource, uno::UNO_QUERY_THROW );
|
||||||
|
ScModelObj* pModel = dynamic_cast<ScModelObj*>(xModel.get());
|
||||||
// !! TODO !! iterate over all controllers
|
// !! TODO !! iterate over all controllers
|
||||||
uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
|
uno::Reference< frame::XController > xController( pModel->getCurrentController(), uno::UNO_SET_THROW );
|
||||||
uno::Reference< excel::XWindow > xWin( new ScVbaWindow( lcl_createWorkbookHIParent( xModel, xContext, aApplication ), xContext, xModel, xController ) );
|
uno::Reference< excel::XWindow > xWin( new ScVbaWindow( lcl_createWorkbookHIParent( pModel, xContext, aApplication ), xContext, pModel, xController ) );
|
||||||
return uno::Any( xWin );
|
return uno::Any( xWin );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +145,10 @@ public:
|
|||||||
if ( xNext.is() )
|
if ( xNext.is() )
|
||||||
{
|
{
|
||||||
m_windows.push_back( xNext );
|
m_windows.push_back( xNext );
|
||||||
uno::Reference< frame::XModel > xModel( xNext, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given
|
// that the spreadsheetdocument is a xmodel is a given
|
||||||
|
rtl::Reference<ScModelObj> xModel = dynamic_cast<ScModelObj*>(xNext.get());
|
||||||
|
if (!xModel)
|
||||||
|
throw uno::RuntimeException();
|
||||||
|
|
||||||
// tdf#126457 - add workbook name to window titles
|
// tdf#126457 - add workbook name to window titles
|
||||||
rtl::Reference<ScVbaWorkbook> workbook(new ScVbaWorkbook(
|
rtl::Reference<ScVbaWorkbook> workbook(new ScVbaWorkbook(
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ ScVbaWorkbook::init()
|
|||||||
|
|
||||||
ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent,
|
ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent,
|
||||||
const css::uno::Reference< css::uno::XComponentContext >& xContext,
|
const css::uno::Reference< css::uno::XComponentContext >& xContext,
|
||||||
css::uno::Reference< css::frame::XModel > const & xModel )
|
rtl::Reference< ScModelObj > const & xModel )
|
||||||
: ScVbaWorkbook_BASE( xParent, xContext ),
|
: ScVbaWorkbook_BASE( xParent, xContext ),
|
||||||
mxModel(xModel)
|
mxModel(xModel)
|
||||||
{
|
{
|
||||||
@@ -200,7 +200,7 @@ ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >&
|
|||||||
ScVbaWorkbook::ScVbaWorkbook( uno::Sequence< uno::Any> const & args,
|
ScVbaWorkbook::ScVbaWorkbook( uno::Sequence< uno::Any> const & args,
|
||||||
uno::Reference< uno::XComponentContext> const & xContext )
|
uno::Reference< uno::XComponentContext> const & xContext )
|
||||||
: ScVbaWorkbook_BASE( args, xContext ),
|
: ScVbaWorkbook_BASE( args, xContext ),
|
||||||
mxModel(getXSomethingFromArgs< frame::XModel >( args, 1 ))
|
mxModel(dynamic_cast<ScModelObj*>(getXSomethingFromArgs< frame::XModel >( args, 1 ).get()))
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@@ -263,8 +263,7 @@ ScVbaWorkbook::Protect( const uno::Any &aPassword )
|
|||||||
sal_Bool
|
sal_Bool
|
||||||
ScVbaWorkbook::getProtectStructure()
|
ScVbaWorkbook::getProtectStructure()
|
||||||
{
|
{
|
||||||
uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
|
return getModel()->isProtected();
|
||||||
return xProt->isProtected();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Bool SAL_CALL ScVbaWorkbook::getPrecisionAsDisplayed()
|
sal_Bool SAL_CALL ScVbaWorkbook::getPrecisionAsDisplayed()
|
||||||
@@ -290,7 +289,7 @@ void SAL_CALL ScVbaWorkbook::setPrecisionAsDisplayed( sal_Bool _precisionAsDispl
|
|||||||
|
|
||||||
OUString SAL_CALL ScVbaWorkbook::getAuthor()
|
OUString SAL_CALL ScVbaWorkbook::getAuthor()
|
||||||
{
|
{
|
||||||
uno::Reference<document::XDocumentPropertiesSupplier> xDPS( getModel(), uno::UNO_QUERY );
|
rtl::Reference<ScModelObj> xDPS( getModel() );
|
||||||
if (!xDPS.is())
|
if (!xDPS.is())
|
||||||
return u"?"_ustr;
|
return u"?"_ustr;
|
||||||
uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
|
uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
|
||||||
@@ -299,7 +298,7 @@ OUString SAL_CALL ScVbaWorkbook::getAuthor()
|
|||||||
|
|
||||||
void SAL_CALL ScVbaWorkbook::setAuthor( const OUString& _author )
|
void SAL_CALL ScVbaWorkbook::setAuthor( const OUString& _author )
|
||||||
{
|
{
|
||||||
uno::Reference<document::XDocumentPropertiesSupplier> xDPS( getModel(), uno::UNO_QUERY );
|
rtl::Reference<ScModelObj> xDPS( getModel() );
|
||||||
if (!xDPS.is())
|
if (!xDPS.is())
|
||||||
return;
|
return;
|
||||||
uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
|
uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
|
||||||
@@ -311,7 +310,7 @@ ScVbaWorkbook::SaveCopyAs( const OUString& sFileName )
|
|||||||
{
|
{
|
||||||
OUString aURL;
|
OUString aURL;
|
||||||
osl::FileBase::getFileURLFromSystemPath( sFileName, aURL );
|
osl::FileBase::getFileURLFromSystemPath( sFileName, aURL );
|
||||||
uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
|
rtl::Reference< ScModelObj > xStor( getModel() );
|
||||||
uno::Sequence< beans::PropertyValue > storeProps{ comphelper::makePropertyValue(
|
uno::Sequence< beans::PropertyValue > storeProps{ comphelper::makePropertyValue(
|
||||||
u"FilterName"_ustr, SC_XL97_FILTER_NAME) };
|
u"FilterName"_ustr, SC_XL97_FILTER_NAME) };
|
||||||
xStor->storeToURL( aURL, storeProps );
|
xStor->storeToURL( aURL, storeProps );
|
||||||
@@ -358,7 +357,7 @@ ScVbaWorkbook::SaveAs( const uno::Any& FileName, const uno::Any& FileFormat, con
|
|||||||
uno::Sequence storeProps{ comphelper::makePropertyValue(u"FilterName"_ustr, uno::Any()) };
|
uno::Sequence storeProps{ comphelper::makePropertyValue(u"FilterName"_ustr, uno::Any()) };
|
||||||
setFilterPropsFromFormat( nFileFormat, storeProps );
|
setFilterPropsFromFormat( nFileFormat, storeProps );
|
||||||
|
|
||||||
uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
|
rtl::Reference< ScModelObj > xStor( getModel() );
|
||||||
xStor->storeAsURL( sURL, storeProps );
|
xStor->storeAsURL( sURL, storeProps );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,7 +416,7 @@ ScVbaWorkbook::getServiceNames()
|
|||||||
OUString SAL_CALL
|
OUString SAL_CALL
|
||||||
ScVbaWorkbook::getCodeName()
|
ScVbaWorkbook::getCodeName()
|
||||||
{
|
{
|
||||||
uno::Reference< beans::XPropertySet > xModelProp( getModel(), uno::UNO_QUERY_THROW );
|
rtl::Reference< ScModelObj > xModelProp( getModel() );
|
||||||
return xModelProp->getPropertyValue(u"CodeName"_ustr).get< OUString >();
|
return xModelProp->getPropertyValue(u"CodeName"_ustr).get< OUString >();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <ooo/vba/excel/XWorkbook.hpp>
|
#include <ooo/vba/excel/XWorkbook.hpp>
|
||||||
#include <cppuhelper/implbase.hxx>
|
#include <cppuhelper/implbase.hxx>
|
||||||
#include <vbahelper/vbadocumentbase.hxx>
|
#include <vbahelper/vbadocumentbase.hxx>
|
||||||
|
#include <docuno.hxx>
|
||||||
|
|
||||||
typedef cppu::ImplInheritanceHelper< VbaDocumentBase, ov::excel::XWorkbook > ScVbaWorkbook_BASE;
|
typedef cppu::ImplInheritanceHelper< VbaDocumentBase, ov::excel::XWorkbook > ScVbaWorkbook_BASE;
|
||||||
|
|
||||||
@@ -31,14 +32,14 @@ class ScVbaWorkbook : public ScVbaWorkbook_BASE
|
|||||||
static bool setFilterPropsFromFormat( sal_Int32 nFormat, css::uno::Sequence< css::beans::PropertyValue >& rProps );
|
static bool setFilterPropsFromFormat( sal_Int32 nFormat, css::uno::Sequence< css::beans::PropertyValue >& rProps );
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
css::uno::Reference< css::frame::XModel > mxModel;
|
rtl::Reference< ScModelObj > mxModel;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual css::uno::Reference< css::frame::XModel > getModel() const override { return mxModel; }
|
virtual ScModelObj* getModel() const override { return mxModel.get(); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
|
ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
|
||||||
css::uno::Reference< css::frame::XModel > const & xModel );
|
rtl::Reference< ScModelObj > const & xModel );
|
||||||
ScVbaWorkbook( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
|
ScVbaWorkbook( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
|
|||||||
@@ -42,11 +42,10 @@ const sal_Int16 CUSTOM_CHAR = 5;
|
|||||||
|
|
||||||
static uno::Any
|
static uno::Any
|
||||||
getWorkbook( const uno::Reference< uno::XComponentContext >& xContext,
|
getWorkbook( const uno::Reference< uno::XComponentContext >& xContext,
|
||||||
const uno::Reference< sheet::XSpreadsheetDocument > &xDoc,
|
const rtl::Reference< ScModelObj > &xModel,
|
||||||
const uno::Reference< XHelperInterface >& xParent )
|
const uno::Reference< XHelperInterface >& xParent )
|
||||||
{
|
{
|
||||||
// FIXME: fine as long as ScVbaWorkbook is stateless ...
|
// FIXME: fine as long as ScVbaWorkbook is stateless ...
|
||||||
uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY );
|
|
||||||
if( !xModel.is() )
|
if( !xModel.is() )
|
||||||
return uno::Any();
|
return uno::Any();
|
||||||
|
|
||||||
@@ -71,7 +70,7 @@ public:
|
|||||||
virtual uno::Any SAL_CALL nextElement( ) override
|
virtual uno::Any SAL_CALL nextElement( ) override
|
||||||
{
|
{
|
||||||
uno::Reference< sheet::XSpreadsheetDocument > xDoc( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
|
uno::Reference< sheet::XSpreadsheetDocument > xDoc( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
|
||||||
return getWorkbook( m_xContext, xDoc, m_xParent );
|
return getWorkbook( m_xContext, static_cast<ScModelObj*>(xDoc.get()), m_xParent );
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -102,7 +101,7 @@ uno::Any
|
|||||||
ScVbaWorkbooks::createCollectionObject( const css::uno::Any& aSource )
|
ScVbaWorkbooks::createCollectionObject( const css::uno::Any& aSource )
|
||||||
{
|
{
|
||||||
uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY_THROW );
|
uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY_THROW );
|
||||||
return getWorkbook( mxContext, xDoc, mxParent );
|
return getWorkbook( mxContext, dynamic_cast<ScModelObj*>(xDoc.get()), mxParent );
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Any SAL_CALL
|
uno::Any SAL_CALL
|
||||||
@@ -147,7 +146,7 @@ ScVbaWorkbooks::Add( const uno::Any& Template )
|
|||||||
if (!xSpreadDoc.is())
|
if (!xSpreadDoc.is())
|
||||||
return uno::Any();
|
return uno::Any();
|
||||||
|
|
||||||
uno::Any aRet = getWorkbook( mxContext, xSpreadDoc, mxParent );
|
uno::Any aRet = getWorkbook( mxContext, dynamic_cast<ScModelObj*>(xSpreadDoc.get()), mxParent );
|
||||||
uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY );
|
uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY );
|
||||||
if (xWBook.is())
|
if (xWBook.is())
|
||||||
xWBook->Activate();
|
xWBook->Activate();
|
||||||
@@ -266,7 +265,7 @@ ScVbaWorkbooks::Open( const OUString& rFileName, const uno::Any& /*UpdateLinks*/
|
|||||||
throw uno::RuntimeException(u"Bad Format"_ustr );
|
throw uno::RuntimeException(u"Bad Format"_ustr );
|
||||||
|
|
||||||
uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( openDocument( rFileName, ReadOnly, sProps ), uno::UNO_QUERY_THROW );
|
uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( openDocument( rFileName, ReadOnly, sProps ), uno::UNO_QUERY_THROW );
|
||||||
uno::Any aRet = getWorkbook( mxContext, xSpreadDoc, mxParent );
|
uno::Any aRet = getWorkbook( mxContext, dynamic_cast<ScModelObj*>(xSpreadDoc.get()), mxParent );
|
||||||
uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY );
|
uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY );
|
||||||
if ( xWBook.is() )
|
if ( xWBook.is() )
|
||||||
xWBook->Activate();
|
xWBook->Activate();
|
||||||
|
|||||||
@@ -1881,8 +1881,8 @@ static bool lcl_CheckInArrayCols(std::vector<uno::Sequence<uno::Any>>& nUniqueRe
|
|||||||
rtl::Reference<ScTableSheetObj> ScTabViewShell::GetRangeWithSheet(css::table::CellRangeAddress& rRangeData, bool& bHasData, bool bHasUnoArguments)
|
rtl::Reference<ScTableSheetObj> ScTabViewShell::GetRangeWithSheet(css::table::CellRangeAddress& rRangeData, bool& bHasData, bool bHasUnoArguments)
|
||||||
{
|
{
|
||||||
// get spreadsheet document model & controller
|
// get spreadsheet document model & controller
|
||||||
uno::Reference<frame::XModel> xModel(GetViewData().GetDocShell()->GetModel());
|
ScModelObj* pModel(GetViewData().GetDocShell()->GetModel());
|
||||||
uno::Reference<frame::XController> xController(xModel->getCurrentController());
|
uno::Reference<frame::XController> xController(pModel->getCurrentController());
|
||||||
|
|
||||||
// spreadsheet's extension of com.sun.star.frame.Controller service
|
// spreadsheet's extension of com.sun.star.frame.Controller service
|
||||||
ScTabViewObj* pSpreadsheetDocument = dynamic_cast<ScTabViewObj*>(xController.get());
|
ScTabViewObj* pSpreadsheetDocument = dynamic_cast<ScTabViewObj*>(xController.get());
|
||||||
@@ -1952,30 +1952,27 @@ void ScTabViewShell::HandleDuplicateRecordsHighlight(const rtl::Reference<ScTabl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Reference<frame::XModel> xModel(GetViewData().GetDocShell()->GetModel());
|
ScModelObj* pModel(GetViewData().GetDocShell()->GetModel());
|
||||||
rtl::Reference<ScCellRangeObj> xSheetRange(
|
rtl::Reference<ScCellRangeObj> xSheetRange(
|
||||||
ActiveSheet->getScCellRangeByPosition(aRange.StartColumn, aRange.StartRow, aRange.EndColumn, aRange.EndRow));
|
ActiveSheet->getScCellRangeByPosition(aRange.StartColumn, aRange.StartRow, aRange.EndColumn, aRange.EndRow));
|
||||||
|
|
||||||
uno::Sequence<uno::Sequence<uno::Any>> aDataArray = xSheetRange->getDataArray();
|
uno::Sequence<uno::Sequence<uno::Any>> aDataArray = xSheetRange->getDataArray();
|
||||||
|
|
||||||
uno::Reference< document::XUndoManagerSupplier > xUndoManager( xModel, uno::UNO_QUERY );
|
|
||||||
uno::Reference<document::XActionLockable> xLockable(xModel, uno::UNO_QUERY);
|
|
||||||
|
|
||||||
ScDocument& rDoc = GetViewData().GetDocShell()->GetDocument();
|
ScDocument& rDoc = GetViewData().GetDocShell()->GetDocument();
|
||||||
|
|
||||||
comphelper::ScopeGuard aUndoContextGuard(
|
comphelper::ScopeGuard aUndoContextGuard(
|
||||||
[&xUndoManager, &xLockable, &xModel, &rDoc] {
|
[pModel, &rDoc] {
|
||||||
xUndoManager->getUndoManager()->leaveUndoContext();
|
pModel->getUndoManager()->leaveUndoContext();
|
||||||
xLockable->removeActionLock();
|
pModel->removeActionLock();
|
||||||
if (xModel->hasControllersLocked())
|
if (pModel->hasControllersLocked())
|
||||||
xModel->unlockControllers();
|
pModel->unlockControllers();
|
||||||
rDoc.UnlockAdjustHeight();
|
rDoc.UnlockAdjustHeight();
|
||||||
});
|
});
|
||||||
|
|
||||||
rDoc.LockAdjustHeight();
|
rDoc.LockAdjustHeight();
|
||||||
xModel->lockControllers();
|
pModel->lockControllers();
|
||||||
xLockable->addActionLock();
|
pModel->addActionLock();
|
||||||
xUndoManager->getUndoManager()->enterUndoContext("HandleDuplicateRecords");
|
pModel->getUndoManager()->enterUndoContext("HandleDuplicateRecords");
|
||||||
|
|
||||||
bool nModifier = false; // modifier key pressed?
|
bool nModifier = false; // modifier key pressed?
|
||||||
bool bNoDuplicatesForSelection = true;
|
bool bNoDuplicatesForSelection = true;
|
||||||
@@ -2052,34 +2049,30 @@ void ScTabViewShell::HandleDuplicateRecordsRemove(const rtl::Reference<ScTableSh
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Reference<frame::XModel> xModel(GetViewData().GetDocShell()->GetModel());
|
ScModelObj* pModel(GetViewData().GetDocShell()->GetModel());
|
||||||
rtl::Reference<ScCellRangeObj> xSheetRange(
|
rtl::Reference<ScCellRangeObj> xSheetRange(
|
||||||
ActiveSheet->getScCellRangeByPosition(aRange.StartColumn, aRange.StartRow, aRange.EndColumn, aRange.EndRow));
|
ActiveSheet->getScCellRangeByPosition(aRange.StartColumn, aRange.StartRow, aRange.EndColumn, aRange.EndRow));
|
||||||
|
|
||||||
uno::Sequence<uno::Sequence<uno::Any>> aDataArray = xSheetRange->getDataArray();
|
uno::Sequence<uno::Sequence<uno::Any>> aDataArray = xSheetRange->getDataArray();
|
||||||
|
|
||||||
uno::Reference< document::XUndoManagerSupplier > xUndoManager( xModel, uno::UNO_QUERY );
|
bool bAutoCalc = pModel->isAutomaticCalculationEnabled();
|
||||||
uno::Reference<document::XActionLockable> xLockable(xModel, uno::UNO_QUERY);
|
|
||||||
|
|
||||||
uno::Reference<sheet::XCalculatable> xCalculatable(xModel, uno::UNO_QUERY);
|
|
||||||
bool bAutoCalc = xCalculatable->isAutomaticCalculationEnabled();
|
|
||||||
ScDocument& rDoc = GetViewData().GetDocShell()->GetDocument();
|
ScDocument& rDoc = GetViewData().GetDocShell()->GetDocument();
|
||||||
|
|
||||||
comphelper::ScopeGuard aUndoContextGuard(
|
comphelper::ScopeGuard aUndoContextGuard(
|
||||||
[&xUndoManager, &xLockable, &xModel, &xCalculatable, &bAutoCalc, &rDoc] {
|
[pModel, &bAutoCalc, &rDoc] {
|
||||||
xUndoManager->getUndoManager()->leaveUndoContext();
|
pModel->getUndoManager()->leaveUndoContext();
|
||||||
xCalculatable->enableAutomaticCalculation(bAutoCalc);
|
pModel->enableAutomaticCalculation(bAutoCalc);
|
||||||
xLockable->removeActionLock();
|
pModel->removeActionLock();
|
||||||
if (xModel->hasControllersLocked())
|
if (pModel->hasControllersLocked())
|
||||||
xModel->unlockControllers();
|
pModel->unlockControllers();
|
||||||
rDoc.UnlockAdjustHeight();
|
rDoc.UnlockAdjustHeight();
|
||||||
});
|
});
|
||||||
|
|
||||||
rDoc.LockAdjustHeight();
|
rDoc.LockAdjustHeight();
|
||||||
xModel->lockControllers();
|
pModel->lockControllers();
|
||||||
xLockable->addActionLock();
|
pModel->addActionLock();
|
||||||
xCalculatable->enableAutomaticCalculation(true);
|
pModel->enableAutomaticCalculation(true);
|
||||||
xUndoManager->getUndoManager()->enterUndoContext("HandleDuplicateRecords");
|
pModel->getUndoManager()->enterUndoContext("HandleDuplicateRecords");
|
||||||
|
|
||||||
if (bDuplicateRows)
|
if (bDuplicateRows)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -490,10 +490,10 @@ SwVbaApplication::getServiceNames()
|
|||||||
return aServiceNames;
|
return aServiceNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Reference< frame::XModel >
|
SfxBaseModel*
|
||||||
SwVbaApplication::getCurrentDocument()
|
SwVbaApplication::getCurrentDocument()
|
||||||
{
|
{
|
||||||
return static_cast<SfxBaseModel*>(getCurrentWordDoc( mxContext ).get());
|
return getCurrentWordDoc( mxContext ).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
rtl::Reference< SwXTextDocument >
|
rtl::Reference< SwXTextDocument >
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include <vbahelper/vbaapplicationbase.hxx>
|
#include <vbahelper/vbaapplicationbase.hxx>
|
||||||
#include <cppuhelper/implbase.hxx>
|
#include <cppuhelper/implbase.hxx>
|
||||||
#include <rtl/ref.hxx>
|
#include <rtl/ref.hxx>
|
||||||
|
#include <sfx2/sfxbasemodel.hxx>
|
||||||
|
|
||||||
#include "vbawindow.hxx"
|
#include "vbawindow.hxx"
|
||||||
|
|
||||||
@@ -124,7 +125,8 @@ public:
|
|||||||
// XSinkCaller
|
// XSinkCaller
|
||||||
virtual void SAL_CALL CallSinks( const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments ) override;
|
virtual void SAL_CALL CallSinks( const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments ) override;
|
||||||
|
|
||||||
virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() override;
|
// this should be SwXTextDocument, but the inheritance hierarchy makes that impossoble
|
||||||
|
virtual SfxBaseModel* getCurrentDocument() override;
|
||||||
|
|
||||||
rtl::Reference<SwXTextDocument> getCurrentSwDocument();
|
rtl::Reference<SwXTextDocument> getCurrentSwDocument();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -221,8 +221,7 @@ SwVbaDocument::CustomDocumentProperties( const uno::Any& index )
|
|||||||
uno::Any SAL_CALL
|
uno::Any SAL_CALL
|
||||||
SwVbaDocument::Bookmarks( const uno::Any& rIndex )
|
SwVbaDocument::Bookmarks( const uno::Any& rIndex )
|
||||||
{
|
{
|
||||||
uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( getModel(),uno::UNO_QUERY_THROW );
|
uno::Reference<container::XIndexAccess > xBookmarks( mxTextDocument->getBookmarks(), uno::UNO_QUERY_THROW );
|
||||||
uno::Reference<container::XIndexAccess > xBookmarks( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
|
|
||||||
uno::Reference< XCollection > xBookmarksVba( new SwVbaBookmarks( this, mxContext, xBookmarks, mxTextDocument ) );
|
uno::Reference< XCollection > xBookmarksVba( new SwVbaBookmarks( this, mxContext, xBookmarks, mxTextDocument ) );
|
||||||
if ( rIndex.getValueTypeClass() == uno::TypeClass_VOID )
|
if ( rIndex.getValueTypeClass() == uno::TypeClass_VOID )
|
||||||
return uno::Any( xBookmarksVba );
|
return uno::Any( xBookmarksVba );
|
||||||
@@ -230,7 +229,7 @@ SwVbaDocument::Bookmarks( const uno::Any& rIndex )
|
|||||||
return xBookmarksVba->Item( rIndex, uno::Any() );
|
return xBookmarksVba->Item( rIndex, uno::Any() );
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Reference< frame::XModel > SwVbaDocument::getModel() const
|
SfxBaseModel* SwVbaDocument::getModel() const
|
||||||
{ return static_cast<SfxBaseModel*>(mxTextDocument.get()); }
|
{ return static_cast<SfxBaseModel*>(mxTextDocument.get()); }
|
||||||
|
|
||||||
uno::Any SwVbaDocument::ContentControls(const uno::Any& index)
|
uno::Any SwVbaDocument::ContentControls(const uno::Any& index)
|
||||||
@@ -286,8 +285,7 @@ uno::Reference<word::XWindow> SwVbaDocument::getActiveWindow()
|
|||||||
uno::Any SAL_CALL
|
uno::Any SAL_CALL
|
||||||
SwVbaDocument::Variables( const uno::Any& rIndex )
|
SwVbaDocument::Variables( const uno::Any& rIndex )
|
||||||
{
|
{
|
||||||
uno::Reference< css::document::XDocumentPropertiesSupplier > xDocumentPropertiesSupplier( getModel(),uno::UNO_QUERY_THROW );
|
uno::Reference< css::document::XDocumentProperties > xDocumentProperties = mxTextDocument->getDocumentProperties();
|
||||||
uno::Reference< css::document::XDocumentProperties > xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties();
|
|
||||||
uno::Reference< beans::XPropertyAccess > xUserDefined( xDocumentProperties->getUserDefinedProperties(), uno::UNO_QUERY_THROW );
|
uno::Reference< beans::XPropertyAccess > xUserDefined( xDocumentProperties->getUserDefinedProperties(), uno::UNO_QUERY_THROW );
|
||||||
|
|
||||||
uno::Reference< XCollection > xVariables( new SwVbaVariables( this, mxContext, xUserDefined ) );
|
uno::Reference< XCollection > xVariables( new SwVbaVariables( this, mxContext, xUserDefined ) );
|
||||||
@@ -386,9 +384,7 @@ uno::Any SAL_CALL
|
|||||||
SwVbaDocument::getAttachedTemplate()
|
SwVbaDocument::getAttachedTemplate()
|
||||||
{
|
{
|
||||||
uno::Reference< word::XTemplate > xTemplate;
|
uno::Reference< word::XTemplate > xTemplate;
|
||||||
uno::Reference<css::document::XDocumentPropertiesSupplier> const xDocPropSupp(
|
uno::Reference< css::document::XDocumentProperties > xDocProps( mxTextDocument->getDocumentProperties(), uno::UNO_SET_THROW );
|
||||||
getModel(), uno::UNO_QUERY_THROW);
|
|
||||||
uno::Reference< css::document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_SET_THROW );
|
|
||||||
|
|
||||||
xTemplate = new SwVbaTemplate( this, mxContext, xDocProps->getTemplateURL() );
|
xTemplate = new SwVbaTemplate( this, mxContext, xDocProps->getTemplateURL() );
|
||||||
return uno::Any( xTemplate );
|
return uno::Any( xTemplate );
|
||||||
@@ -411,9 +407,7 @@ SwVbaDocument::setAttachedTemplate( const css::uno::Any& _attachedtemplate )
|
|||||||
else
|
else
|
||||||
osl::FileBase::getFileURLFromSystemPath( sTemplate, aURL );
|
osl::FileBase::getFileURLFromSystemPath( sTemplate, aURL );
|
||||||
|
|
||||||
uno::Reference<css::document::XDocumentPropertiesSupplier> const xDocPropSupp(
|
uno::Reference< css::document::XDocumentProperties > xDocProps( mxTextDocument->getDocumentProperties(), uno::UNO_SET_THROW );
|
||||||
getModel(), uno::UNO_QUERY_THROW );
|
|
||||||
uno::Reference< css::document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_SET_THROW );
|
|
||||||
xDocProps->setTemplateURL( aURL );
|
xDocProps->setTemplateURL( aURL );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,8 +589,7 @@ SwVbaDocument::SaveAs2000( const uno::Any& FileName, const uno::Any& FileFormat,
|
|||||||
|
|
||||||
setFilterPropsFromFormat( nFileFormat, storeProps );
|
setFilterPropsFromFormat( nFileFormat, storeProps );
|
||||||
|
|
||||||
uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
|
mxTextDocument->storeAsURL( sURL, storeProps );
|
||||||
xStor->storeAsURL( sURL, storeProps );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
@@ -622,8 +615,7 @@ SwVbaDocument::SavePreviewPngAs( const uno::Any& FileName )
|
|||||||
uno::Sequence storeProps{ comphelper::makePropertyValue(u"FilterName"_ustr,
|
uno::Sequence storeProps{ comphelper::makePropertyValue(u"FilterName"_ustr,
|
||||||
u"writer_png_Export"_ustr) };
|
u"writer_png_Export"_ustr) };
|
||||||
|
|
||||||
uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
|
mxTextDocument->storeToURL( sURL, storeProps );
|
||||||
xStor->storeToURL( sURL, storeProps );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Any
|
uno::Any
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <com/sun/star/text/XTextDocument.hpp>
|
#include <com/sun/star/text/XTextDocument.hpp>
|
||||||
#include <cppuhelper/implbase.hxx>
|
#include <cppuhelper/implbase.hxx>
|
||||||
#include <rtl/ref.hxx>
|
#include <rtl/ref.hxx>
|
||||||
|
#include <sfx2/sfxbasemodel.hxx>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -45,7 +46,8 @@ private:
|
|||||||
css::uno::Reference< css::container::XNameAccess > getFormControls() const;
|
css::uno::Reference< css::container::XNameAccess > getFormControls() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual css::uno::Reference< css::frame::XModel > getModel() const override;
|
// this should be SwXTextDocument, but the inheritance hierarchy makes that impossoble
|
||||||
|
virtual SfxBaseModel* getModel() const override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SwVbaDocument( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& m_xContext, rtl::Reference< SwXTextDocument > const & xModel );
|
SwVbaDocument( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& m_xContext, rtl::Reference< SwXTextDocument > const & xModel );
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ uno::Any SAL_CALL VbaApplicationBase::getVBE()
|
|||||||
try // return empty object on error
|
try // return empty object on error
|
||||||
{
|
{
|
||||||
// "VBE" object does not have a parent, but pass document model to be able to determine application type
|
// "VBE" object does not have a parent, but pass document model to be able to determine application type
|
||||||
uno::Sequence< uno::Any > aArgs{ uno::Any(getCurrentDocument()) };
|
uno::Sequence< uno::Any > aArgs{ uno::Any(uno::Reference(getCurrentDocument())) };
|
||||||
uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
|
uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
|
||||||
uno::Reference< uno::XInterface > xVBE = xServiceManager->createInstanceWithArgumentsAndContext(
|
uno::Reference< uno::XInterface > xVBE = xServiceManager->createInstanceWithArgumentsAndContext(
|
||||||
u"ooo.vba.vbide.VBE"_ustr , aArgs, mxContext );
|
u"ooo.vba.vbide.VBE"_ustr , aArgs, mxContext );
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ VbaDocumentBase::getVBProject()
|
|||||||
if (xVBE)
|
if (xVBE)
|
||||||
{
|
{
|
||||||
uno::Sequence< uno::Any > aArgs{ uno::Any(xVBE), // the VBE
|
uno::Sequence< uno::Any > aArgs{ uno::Any(xVBE), // the VBE
|
||||||
uno::Any(getModel()) }; // document model for script container access
|
uno::Any(uno::Reference(getModel())) }; // document model for script container access
|
||||||
uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager() );
|
uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager() );
|
||||||
if (xServiceManager)
|
if (xServiceManager)
|
||||||
mxVBProject = xServiceManager->createInstanceWithArgumentsAndContext(
|
mxVBProject = xServiceManager->createInstanceWithArgumentsAndContext(
|
||||||
|
|||||||
Reference in New Issue
Block a user