Merge commit 'ooo/DEV300_m106' into integration/dev300_m106

Conflicts:
	avmedia/source/gstreamer/gstframegrabber.cxx
	avmedia/source/gstreamer/gstplayer.cxx
	avmedia/source/gstreamer/gstplayer.hxx
	basic/inc/basic/sbxdef.hxx
	basic/source/classes/sbxmod.cxx
	basic/source/comp/makefile.mk
	basic/source/comp/sbcomp.cxx
	basic/source/inc/namecont.hxx
	basic/source/inc/scriptcont.hxx
	basic/source/runtime/methods.cxx
	basic/source/runtime/runtime.cxx
	basic/source/runtime/stdobj.cxx
	basic/source/runtime/step1.cxx
	basic/source/uno/namecont.cxx
	basic/util/makefile.mk
	connectivity/source/commontools/predicateinput.cxx
	connectivity/source/drivers/dbase/DNoException.cxx
	connectivity/source/drivers/dbase/DTable.cxx
	connectivity/source/drivers/file/fcomp.cxx
	connectivity/source/drivers/jdbc/JConnection.cxx
	connectivity/source/drivers/odbcbase/OResultSet.cxx
	connectivity/source/drivers/odbcbase/OStatement.cxx
	connectivity/source/parse/sqlnode.cxx
	desktop/source/app/app.cxx
	drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
	drawinglayer/source/processor2d/vclprocessor2d.cxx
	formula/inc/formula/token.hxx
	formula/source/core/api/token.cxx
	fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
	fpicker/source/win32/filepicker/platform_vista.h
	framework/source/helper/persistentwindowstate.cxx
	framework/source/uielement/menubarmanager.cxx
	oovbaapi/ooo/vba/XFoundFiles.idl
	oovbaapi/ooo/vba/excel/XApplication.idl
	oovbaapi/ooo/vba/msforms/XCheckBox.idl
	oovbaapi/ooo/vba/msforms/XComboBox.idl
	oovbaapi/ooo/vba/msforms/XControl.idl
	oovbaapi/ooo/vba/msforms/XGroupBox.idl
	oovbaapi/ooo/vba/msforms/XLabel.idl
	oovbaapi/ooo/vba/msforms/XListBox.idl
	oovbaapi/ooo/vba/msforms/XNewFont.idl
	oovbaapi/ooo/vba/msforms/XRadioButton.idl
	oovbaapi/ooo/vba/msforms/XTextBox.idl
	oovbaapi/ooo/vba/msforms/XToggleButton.idl
	scripting/source/dlgprov/dlgevtatt.cxx
	sfx2/source/control/unoctitm.cxx
	sfx2/source/doc/objstor.cxx
	sfx2/source/doc/objxtor.cxx
	svx/inc/svx/svdograf.hxx
	svx/source/form/fmpage.cxx
	svx/source/form/fmpgeimp.cxx
	svx/source/svdraw/svdedtv.cxx
	svx/source/svdraw/svdfmtf.cxx
	svx/source/svdraw/svdograf.cxx
	svx/source/svdraw/svdouno.cxx
	svx/source/xml/xmlgrhlp.cxx
	uui/source/iahndl-ssl.cxx
	vbahelper/Library_msforms.mk
	vbahelper/Library_vbahelper.mk
	vbahelper/inc/vbahelper/vbahelper.hxx
	vbahelper/prj/build.lst
	vbahelper/source/msforms/vbacombobox.cxx
	vbahelper/source/msforms/vbacontrol.cxx
	vbahelper/source/msforms/vbacontrols.cxx
	vbahelper/source/msforms/vbaframe.cxx
	vbahelper/source/msforms/vbaframe.hxx
	vbahelper/source/msforms/vbalabel.cxx
	vbahelper/source/msforms/vbalabel.hxx
	vbahelper/source/msforms/vbalistbox.cxx
	vbahelper/source/msforms/vbalistbox.hxx
	vbahelper/source/msforms/vbamultipage.cxx
	vbahelper/source/msforms/vbatogglebutton.cxx
	vbahelper/source/msforms/vbauserform.cxx
	vbahelper/source/vbahelper/vbacommandbar.cxx
	vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
	vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
	vbahelper/source/vbahelper/vbahelper.cxx
	vbahelper/source/vbahelper/vbawindowbase.cxx
	xmloff/source/meta/xmlmetai.cxx
	xmloff/source/style/PageMasterExportPropMapper.cxx
	xmloff/source/style/PageMasterStyleMap.cxx
	xmloff/source/text/txtexppr.cxx
	xmloff/source/text/txtprmap.cxx
This commit is contained in:
Thorsten Behrens 2011-04-28 00:12:58 +02:00
commit f51c3f66b1
233 changed files with 6484 additions and 1879 deletions

View File

@ -66,6 +66,8 @@ SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(PKGCONFIG_
SHL1IMPLIB=i$(TARGET)
SHL1LIBS=$(SLB)$/$(TARGET).lib
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
# on Solaris checkdll does not work: LD_LIBRARY_PATH breaks the 2 libxml2.so.2
SHL1NOCHECK=t
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp

View File

@ -114,6 +114,8 @@ enum SbxDataType {
const sal_uInt32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000;
const sal_uInt32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000;
const sal_uInt32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible
const sal_uInt32 SBX_TYPE_VAR_TO_DIM_FLAG = 0x40000;
#endif
#ifndef _SBX_OPERATOR
@ -261,6 +263,8 @@ typedef sal_uIntPtr SbxError; // Preserve old type
#define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN
#define SBX_DIM_AS_NEW 0x0800 // Same value as SBX_GBLSEARCH, cannot conflict as one
// is used for objects, the other for variables only
#define SBX_VAR_TO_DIM 0x2000 // Same value as SBX_NO_BROADCAST, cannot conflict as
// used for variables without broadcaster only
// Broadcaster-IDs:
#define SBX_HINT_DYING SFX_HINT_DYING

View File

@ -28,7 +28,9 @@
#ifndef BASIC_VBAHELPR_HXX
#define BASIC_VBAHELPR_HXX
#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <rtl/ustring.hxx>
namespace basic {
namespace vba {
@ -39,6 +41,21 @@ namespace vba {
// ============================================================================
/** Creates and returns an enumeration of all open documents of the same type
as the specified document.
First, the global module manager (com.sun.star.frame.ModuleManager) is
asked for the type of the passed model, and all open documents with the
same type will be stored in an enumeration object.
@param rxModel
A document model determining the type of the documents.
*/
::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > createDocumentsEnumeration(
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
// ============================================================================
/** Locks or unlocks the controllers of all documents that have the same type
as the specified document.
@ -80,6 +97,38 @@ void enableContainerWindowsOfAllDocuments(
// ============================================================================
/** Registers the passed path as working directory for the application the
passed document belongs to.
@param rxModel
A document model determining the type of the application whose working
directory has been changed.
@param rPath
The new working directory.
*/
void registerCurrentDirectory(
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
const ::rtl::OUString& rPath );
// ============================================================================
/** Returns the working directory of the application the passed document
belongs to.
@param rxModel
A document model determining the type of the application whose working
directory is querried.
@return
The working directory of the specified application, or an empty string
on error (e.g. if the passed document reference is empty).
*/
::rtl::OUString getCurrentDirectory(
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
// ============================================================================
} // namespace vba
} // namespace basic

View File

@ -28,13 +28,18 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
#include "basic/vbahelper.hxx"
#include <basic/vbahelper.hxx>
#include <map>
#include <vector>
#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/implbase1.hxx>
#include <rtl/instance.hxx>
namespace basic {
namespace vba {
@ -45,64 +50,71 @@ using namespace ::com::sun::star;
namespace {
/** Creates the global module manager needed to identify the type of documents.
/** Create an instance of a module manager.
*/
uno::Reference< frame::XModuleManager > lclCreateModuleManager()
{
uno::Reference< frame::XModuleManager > xModuleManager;
try
{
uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
xModuleManager.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ) ) ), uno::UNO_QUERY );
}
catch( uno::Exception& )
{
}
OSL_ENSURE( xModuleManager.is(), "::basic::vba::lclCreateModuleManager - cannot create module manager" );
return xModuleManager;
}
// ----------------------------------------------------------------------------
/** Returns the document service name of the specified document.
/** Implementation of an enumeration of all open documents of the same type.
*/
::rtl::OUString lclIdentifyDocument( const uno::Reference< frame::XModuleManager >& rxModuleManager, const uno::Reference< frame::XModel >& rxModel )
class DocumentsEnumeration : public ::cppu::WeakImplHelper1< container::XEnumeration >
{
::rtl::OUString aServiceName;
if( rxModuleManager.is() )
{
try
{
aServiceName = rxModuleManager->identify( rxModel );
}
catch( uno::Exception& )
{
}
OSL_ENSURE( aServiceName.getLength() > 0, "::basic::vba::lclIdentifyDocument - cannot identify document" );
}
return aServiceName;
}
public:
DocumentsEnumeration( const uno::Reference< frame::XModel >& rxModel );
virtual sal_Bool SAL_CALL hasMoreElements() throw (uno::RuntimeException);
virtual uno::Any SAL_CALL nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
private:
typedef ::std::vector< uno::Reference< frame::XModel > > ModelVector;
ModelVector maModels;
ModelVector::iterator maModelIt;
};
// ----------------------------------------------------------------------------
/** Returns an enumeration of all open documents.
*/
uno::Reference< container::XEnumeration > lclCreateDocumentEnumeration()
DocumentsEnumeration::DocumentsEnumeration( const uno::Reference< frame::XModel >& rxModel )
{
uno::Reference< container::XEnumeration > xEnumeration;
try
{
uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
uno::Reference< frame::XModuleManager > xModuleManager( lclCreateModuleManager(), uno::UNO_SET_THROW );
::rtl::OUString aIdentifier = xModuleManager->identify( rxModel );
uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
uno::Reference< frame::XDesktop > xDesktop( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), uno::UNO_QUERY_THROW );
uno::Reference< container::XEnumerationAccess > xComponentsEA( xDesktop->getComponents(), uno::UNO_SET_THROW );
xEnumeration = xComponentsEA->createEnumeration();
uno::Reference< container::XEnumeration > xEnumeration( xComponentsEA->createEnumeration(), uno::UNO_SET_THROW );
while( xEnumeration->hasMoreElements() )
{
uno::Reference< frame::XModel > xCurrModel( xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
if( xModuleManager->identify( xCurrModel ) == aIdentifier )
maModels.push_back( xCurrModel );
}
}
catch( uno::Exception& )
{
}
OSL_ENSURE( xEnumeration.is(), "::basic::vba::lclCreateDocumentEnumeration - cannot create enumeration of all documents" );
return xEnumeration;
maModelIt = maModels.begin();
}
sal_Bool SAL_CALL DocumentsEnumeration::hasMoreElements() throw (uno::RuntimeException)
{
return maModelIt != maModels.end();
}
uno::Any SAL_CALL DocumentsEnumeration::nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
if( maModelIt == maModels.end() )
throw container::NoSuchElementException();
return uno::Any( *maModelIt++ );
}
// ----------------------------------------------------------------------------
@ -163,37 +175,39 @@ typedef void (*ModifyDocumentFunc)( const uno::Reference< frame::XModel >&, sal_
*/
void lclIterateDocuments( ModifyDocumentFunc pModifyDocumentFunc, const uno::Reference< frame::XModel >& rxModel, sal_Bool bModificator )
{
uno::Reference< frame::XModuleManager > xModuleManager = lclCreateModuleManager();
uno::Reference< container::XEnumeration > xDocumentsEnum = lclCreateDocumentEnumeration();
::rtl::OUString aIdentifier = lclIdentifyDocument( xModuleManager, rxModel );
if( xModuleManager.is() && xDocumentsEnum.is() && (aIdentifier.getLength() > 0) )
uno::Reference< container::XEnumeration > xDocumentsEnum( new DocumentsEnumeration( rxModel ) );
// iterate over all open documents
while( xDocumentsEnum->hasMoreElements() ) try
{
// iterate over all open documents
while( xDocumentsEnum->hasMoreElements() )
{
try
{
uno::Reference< frame::XModel > xCurrModel( xDocumentsEnum->nextElement(), uno::UNO_QUERY_THROW );
::rtl::OUString aCurrIdentifier = lclIdentifyDocument( xModuleManager, xCurrModel );
if( aCurrIdentifier == aIdentifier )
pModifyDocumentFunc( xCurrModel, bModificator );
}
catch( uno::Exception& )
{
}
}
uno::Reference< frame::XModel > xCurrModel( xDocumentsEnum->nextElement(), uno::UNO_QUERY_THROW );
pModifyDocumentFunc( xCurrModel, bModificator );
}
else
catch( uno::Exception& )
{
// no module manager, no documents enumeration, no identifier -> at least process the passed document
pModifyDocumentFunc( rxModel, bModificator );
}
}
// ----------------------------------------------------------------------------
struct CurrDirPool
{
::osl::Mutex maMutex;
::std::map< ::rtl::OUString, ::rtl::OUString > maCurrDirs;
};
struct StaticCurrDirPool : public ::rtl::Static< CurrDirPool, StaticCurrDirPool > {};
} // namespace
// ============================================================================
uno::Reference< container::XEnumeration > createDocumentsEnumeration( const uno::Reference< frame::XModel >& rxModel )
{
return new DocumentsEnumeration( rxModel );
}
// ============================================================================
void lockControllersOfAllDocuments( const uno::Reference< frame::XModel >& rxModel, sal_Bool bLockControllers )
{
lclIterateDocuments( &lclLockControllers, rxModel, bLockControllers );
@ -208,5 +222,45 @@ void enableContainerWindowsOfAllDocuments( const uno::Reference< frame::XModel >
// ============================================================================
void registerCurrentDirectory( const uno::Reference< frame::XModel >& rxModel, const ::rtl::OUString& rPath )
{
if( rPath.getLength() > 0 )
{
CurrDirPool& rPool = StaticCurrDirPool::get();
::osl::MutexGuard aGuard( rPool.maMutex );
try
{
uno::Reference< frame::XModuleManager > xModuleManager( lclCreateModuleManager(), uno::UNO_SET_THROW );
::rtl::OUString aIdentifier = xModuleManager->identify( rxModel );
if( aIdentifier.getLength() > 0 )
rPool.maCurrDirs[ aIdentifier ] = rPath;
}
catch( uno::Exception& )
{
}
}
}
// ============================================================================
::rtl::OUString getCurrentDirectory( const uno::Reference< frame::XModel >& rxModel )
{
::rtl::OUString aPath;
CurrDirPool& rPool = StaticCurrDirPool::get();
::osl::MutexGuard aGuard( rPool.maMutex );
try
{
uno::Reference< frame::XModuleManager > xModuleManager( lclCreateModuleManager(), uno::UNO_SET_THROW );
::rtl::OUString aIdentifier = xModuleManager->identify( rxModel );
aPath = rPool.maCurrDirs[ aIdentifier ];
}
catch( uno::Exception& )
{
}
return aPath;
}
// ============================================================================
} // namespace vba
} // namespace basic

View File

@ -40,6 +40,7 @@
#include <tools/shl.hxx>
#include <tools/rc.hxx>
#include <vcl/svapp.hxx>
#include <comphelper/processfactory.hxx>
#include "sbunoobj.hxx"
#include "sbjsmeth.hxx"
#include "sbjsmod.hxx"
@ -128,6 +129,7 @@ void DocBasicItem::startListening()
Any aThisComp;
mrDocBasic.GetUNOConstant( "ThisComponent", aThisComp );
Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY );
mbDisposed = !xCloseBC.is();
if( xCloseBC.is() )
try { xCloseBC->addCloseListener( this ); } catch( uno::Exception& ) {}
}
@ -433,7 +435,20 @@ SbxObject* SbiFactory::CreateObject( const String& rClass )
return new BasicCollection( aCollectionName );
}
else
return NULL;
if( rClass.EqualsIgnoreCaseAscii( "FileSystemObject" ) )
{
try
{
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), UNO_SET_THROW );
::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.FileSystemObject" ) );
Reference< XInterface > xInterface( xFactory->createInstance( aServiceName ), UNO_SET_THROW );
return new SbUnoObject( aServiceName, uno::makeAny( xInterface ) );
}
catch( Exception& )
{}
}
return NULL;
}
@ -929,8 +944,14 @@ void StarBASIC::SetModified( sal_Bool b )
SbxBase::SetModified( b );
}
extern void lcl_closeTraceFile();
StarBASIC::~StarBASIC()
{
#ifdef DBG_TRACE_BASIC
lcl_closeTraceFile();
#endif
// Needs to be first action as it can trigger events
disposeComVariablesForBasic( this );
@ -2264,7 +2285,22 @@ void BasicCollection::CollRemove( SbxArray* pPar_ )
SbxVariable* p = pPar_->Get( 1 );
sal_Int32 nIndex = implGetIndex( p );
if( nIndex >= 0 && nIndex < (sal_Int32)xItemArray->Count32() )
{
xItemArray->Remove32( nIndex );
// Correct for stack if necessary
SbiInstance* pInst = pINST;
SbiRuntime* pRT = pInst ? pInst->pRun : NULL;
if( pRT )
{
SbiForStack* pStack = pRT->FindForStackItemForCollection( this );
if( pStack != NULL )
{
if( pStack->nCurCollectionIndex >= nIndex )
--pStack->nCurCollectionIndex;
}
}
}
else
SetError( SbERR_BAD_ARGUMENT );
}

View File

@ -1761,8 +1761,7 @@ String getBasicObjectTypeName( SbxObject* pObj )
return aName;
}
bool checkUnoObjectType( SbUnoObject* pUnoObj,
const String& aClass )
bool checkUnoObjectType( SbUnoObject* pUnoObj, const ::rtl::OUString& rClass )
{
Any aToInspectObj = pUnoObj->getUnoAny();
TypeClass eType = aToInspectObj.getValueType().getTypeClass();
@ -1779,6 +1778,21 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj,
Reference< XTypeProvider > xTypeProvider( x, UNO_QUERY );
if( xTypeProvider.is() )
{
/* Although interfaces in the ooo.vba namespace obey the IDL rules and
have a leading 'X', in Basic we want to be able to do something
like 'Dim wb As Workbooks' or 'Dim lb As MSForms.Label'. Here we
add a leading 'X' to the class name and a leading dot to the entire
type name. This results e.g. in '.XWorkbooks' or '.MSForms.XLabel'
which matches the interface names 'ooo.vba.excel.XWorkbooks' or
'ooo.vba.msforms.XLabel'.
*/
::rtl::OUString aClassName( sal_Unicode( '.' ) );
sal_Int32 nClassNameDot = rClass.lastIndexOf( '.' );
if( nClassNameDot >= 0 )
aClassName += rClass.copy( 0, nClassNameDot + 1 ) + ::rtl::OUString( sal_Unicode( 'X' ) ) + rClass.copy( nClassNameDot + 1 );
else
aClassName += ::rtl::OUString( sal_Unicode( 'X' ) ) + rClass;
Sequence< Type > aTypeSeq = xTypeProvider->getTypes();
const Type* pTypeArray = aTypeSeq.getConstArray();
sal_uInt32 nIfaceCount = aTypeSeq.getLength();
@ -1792,8 +1806,8 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj,
OSL_FAIL("failed to get XIdlClass for type");
break;
}
::rtl::OUString sClassName = xClass->getName();
if ( sClassName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.oleautomation.XAutomationObject" ) ) ) )
::rtl::OUString aInterfaceName = xClass->getName();
if ( aInterfaceName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.oleautomation.XAutomationObject" ) ) ) )
{
// there is a hack in the extensions/source/ole/oleobj.cxx to return the typename of the automation object, lets check if it
// matches
@ -1806,20 +1820,15 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj,
// can't check type, leave it pass
result = true;
else
result = sTypeName.equals( aClass );
result = sTypeName.equals( rClass );
}
break; // finished checking automation object
}
OSL_TRACE("Checking if object implements %s",
OUStringToOString( defaultNameSpace + aClass,
RTL_TEXTENCODING_UTF8 ).getStr() );
// although interfaces in the ooo.vba.vba namespace
// obey the idl rules and have a leading X, in basic we
// want to be able to do something like
// 'dim wrkbooks as WorkBooks'
// so test assumes the 'X' has been dropped
sal_Int32 indexLastDot = sClassName.lastIndexOf('.');
if ( indexLastDot > -1 && sClassName.copy( indexLastDot + 1).equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("X") ) + aClass ) )
// match interface name with passed class name
OSL_TRACE("Checking if object implements %s", OUStringToOString( aClassName, RTL_TEXTENCODING_UTF8 ).getStr() );
if ( (aClassName.getLength() < aInterfaceName.getLength()) &&
aInterfaceName.matchIgnoreAsciiCase( aClassName, aInterfaceName.getLength() - aClassName.getLength() ) )
{
result = true;
break;

View File

@ -59,6 +59,7 @@
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <com/sun/star/document/XVbaMethodParameter.hpp>
#include <com/sun/star/script/vba/VBAScriptEventId.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/document/XEventBroadcaster.hpp>
#include <com/sun/star/document/XEventListener.hpp>
@ -86,10 +87,9 @@ using namespace com::sun::star;
#include <cppuhelper/implbase1.hxx>
#include <basic/sbobjmod.hxx>
#include <com/sun/star/uno/XAggregation.hpp>
#include <map>
#include <com/sun/star/script/XInvocation.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star;
using namespace com::sun::star::lang;
using namespace com::sun::star::reflection;
using namespace com::sun::star::beans;
@ -105,6 +105,7 @@ using namespace com::sun::star::script;
#include <cppuhelper/implbase1.hxx>
#include <comphelper/anytostring.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <ooo/vba/VbQueryClose.hpp>
typedef ::cppu::WeakImplHelper1< XInvocation > DocObjectWrapper_BASE;
typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
@ -448,24 +449,36 @@ TYPEINIT1(SbUserFormModule,SbObjModule)
typedef std::vector<HighlightPortion> HighlightPortions;
bool getDefaultVBAMode( StarBASIC* pb )
uno::Reference< frame::XModel > getDocumentModel( StarBASIC* pb )
{
bool bResult = false;
if ( pb && pb->IsDocBasic() )
uno::Reference< frame::XModel > xModel;
if( pb && pb->IsDocBasic() )
{
uno::Any aDoc;
if ( pb->GetUNOConstant( "ThisComponent", aDoc ) )
{
uno::Reference< beans::XPropertySet > xProp( aDoc, uno::UNO_QUERY );
if ( xProp.is() )
{
uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY );
if ( xVBAMode.is() )
bResult = xVBAMode->getVBACompatibilityMode() == sal_True;
}
}
if( pb->GetUNOConstant( "ThisComponent", aDoc ) )
xModel.set( aDoc, uno::UNO_QUERY );
}
return bResult;
return xModel;
}
uno::Reference< vba::XVBACompatibility > getVBACompatibility( const uno::Reference< frame::XModel >& rxModel )
{
uno::Reference< vba::XVBACompatibility > xVBACompat;
try
{
uno::Reference< beans::XPropertySet > xModelProps( rxModel, uno::UNO_QUERY_THROW );
xVBACompat.set( xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) ), uno::UNO_QUERY );
}
catch( uno::Exception& )
{
}
return xVBACompat;
}
bool getDefaultVBAMode( StarBASIC* pb )
{
uno::Reference< vba::XVBACompatibility > xVBACompat = getVBACompatibility( getDocumentModel( pb ) );
return xVBACompat.is() && xVBACompat->getVBACompatibilityMode();
}
class AsyncQuitHandler
@ -512,7 +525,6 @@ void VBAUnlockDocuments( StarBASIC* pBasic )
}
}
// A Basic module has set EXTSEARCH, so that the elements, that the modul contains,
// could be found from other module.
@ -903,7 +915,7 @@ void SbModule::SetSource( const String& r )
void SbModule::SetSource32( const ::rtl::OUString& r )
{
// Default basic mode to library container mode, but.. allow Option VBASupport 0/1 override
SetVBACompat( getDefaultVBAMode( static_cast< StarBASIC*>( GetParent() ) ) );
SetVBACompat( getDefaultVBAMode( static_cast< StarBASIC*>( GetParent() ) ) );
aOUSource = r;
StartDefinitions();
SbiTokenizer aTok( r );
@ -1104,6 +1116,8 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
sal_Bool bDelInst = sal_Bool( pINST == NULL );
bool bQuit = false;
StarBASICRef xBasic;
uno::Reference< frame::XModel > xModel;
uno::Reference< script::vba::XVBACompatibility > xVBACompat;
if( bDelInst )
{
// #32779: Hold Basic during the execution
@ -1111,6 +1125,46 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
pINST = new SbiInstance( (StarBASIC*) GetParent() );
/* If a VBA script in a document is started, get the VBA compatibility
interface from the document Basic library container, and notify all
VBA script listeners about the started script. */
if( mbVBACompat )
{
StarBASIC* pBasic = static_cast< StarBASIC* >( GetParent() );
if( pBasic && pBasic->IsDocBasic() ) try
{
xModel.set( getDocumentModel( pBasic ), uno::UNO_SET_THROW );
xVBACompat.set( getVBACompatibility( xModel ), uno::UNO_SET_THROW );
xVBACompat->broadcastVBAScriptEvent( script::vba::VBAScriptEventId::SCRIPT_STARTED, GetName() );
}
catch( uno::Exception& )
{
}
}
// Launcher problem
// i80726 The Find below will genarate an error in Testtool so we reset it unless there was one before already
sal_Bool bWasError = SbxBase::GetError() != 0;
SbxVariable* pMSOMacroRuntimeLibVar = Find( aMSOMacroRuntimeLibName, SbxCLASS_OBJECT );
if ( !bWasError && (SbxBase::GetError() == SbxERR_PROC_UNDEFINED) )
SbxBase::ResetError();
if( pMSOMacroRuntimeLibVar )
{
StarBASIC* pMSOMacroRuntimeLib = PTR_CAST(StarBASIC,pMSOMacroRuntimeLibVar);
if( pMSOMacroRuntimeLib )
{
sal_uInt16 nGblFlag = pMSOMacroRuntimeLib->GetFlags() & SBX_GBLSEARCH;
pMSOMacroRuntimeLib->ResetFlag( SBX_GBLSEARCH );
SbxVariable* pAppSymbol = pMSOMacroRuntimeLib->Find( aMSOMacroRuntimeAppSymbol, SbxCLASS_METHOD );
pMSOMacroRuntimeLib->SetFlag( nGblFlag );
if( pAppSymbol )
{
pMSOMacroRuntimeLib->SetFlag( SBX_EXTSEARCH ); // Could have been disabled before
GetSbData()->pMSOMacroRuntimLib = pMSOMacroRuntimeLib;
}
}
}
// Delete the Error-Stack
SbErrorStack*& rErrStack = GetSbData()->pErrStack;
delete rErrStack;
@ -1220,9 +1274,20 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
ResetCapturedAssertions();
#endif
// VBA always ensures screenupdating is enabled after completing
if ( mbVBACompat )
VBAUnlockDocuments( PTR_CAST( StarBASIC, GetParent() ) );
if( xVBACompat.is() )
{
// notify all VBA script listeners about the stopped script
try
{
xVBACompat->broadcastVBAScriptEvent( script::vba::VBAScriptEventId::SCRIPT_STOPPED, GetName() );
}
catch( uno::Exception& )
{
}
// VBA always ensures screenupdating is enabled after completing
::basic::vba::lockControllersOfAllDocuments( xModel, sal_False );
::basic::vba::enableContainerWindowsOfAllDocuments( xModel, sal_True );
}
#ifdef DBG_TRACE_BASIC
dbg_DeInitTrace();
@ -2320,7 +2385,7 @@ public:
if ( xVbaMethodParameter.is() )
{
sal_Int8 nCancel = 0;
sal_Int8 nCloseMode = 0;
sal_Int8 nCloseMode = ::ooo::vba::VbQueryClose::vbFormControlMenu;
Sequence< Any > aParams;
aParams.realloc(2);
@ -2445,14 +2510,14 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun )
Sequence< Any > aArguments;
triggerMethod( aMethodToRun, aArguments );
}
void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& aArguments)
void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& aArguments )
{
OSL_TRACE("*** trigger %s ***", rtl::OUStringToOString( aMethodToRun, RTL_TEXTENCODING_UTF8 ).getStr() );
// Search method
SbxVariable* pMeth = SbObjModule::Find( aMethodToRun, SbxCLASS_METHOD );
if( pMeth )
{
if ( aArguments.getLength() > 0 ) // Setup parameters
{
SbxArrayRef xArray = new SbxArray;
@ -2480,7 +2545,6 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any
pMeth->SetParameters( NULL );
}
else
{
SbxValues aVals;
pMeth->Get( aVals );
@ -2572,7 +2636,7 @@ void SbUserFormModule::Unload()
OSL_TRACE("** Unload() ");
sal_Int8 nCancel = 0;
sal_Int8 nCloseMode = 1;
sal_Int8 nCloseMode = ::ooo::vba::VbQueryClose::vbFormCode;
Sequence< Any > aParams;
aParams.realloc(2);
@ -2628,6 +2692,9 @@ void SbUserFormModule::InitObject()
SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
if ( m_xModel.is() && pGlobs )
{
// broadcast INITIALIZE_USERFORM script event before the dialog is created
Reference< script::vba::XVBACompatibility > xVBACompat( getVBACompatibility( m_xModel ), uno::UNO_SET_THROW );
xVBACompat->broadcastVBAScriptEvent( script::vba::VBAScriptEventId::INITIALIZE_USERFORM, GetName() );
uno::Reference< lang::XMultiServiceFactory > xVBAFactory( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW );
uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();

View File

@ -302,6 +302,8 @@ void SbiCodeGen::Save()
nUserData |= nDefaultId;
if( pPar->IsParamArray() )
nUserData |= PARAM_INFO_PARAMARRAY;
if( pPar->IsWithBrackets() )
nUserData |= PARAM_INFO_WITHBRACKETS;
if( nUserData )
{
SbxParamInfo* pParam = (SbxParamInfo*)pInfo->GetParam( i );

View File

@ -54,7 +54,11 @@ SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, sal_Bool bStatic, sal_Bool bC
SbiDimList* pDim = NULL;
// Brackets?
if( Peek() == LPAREN )
{
pDim = new SbiDimList( this );
if( !pDim->GetDims() )
pDef->SetWithBrackets();
}
pDef->SetType( t );
if( bStatic )
pDef->SetStatic();
@ -385,6 +389,9 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
if( nFixedStringLength >= 0 )
nOpnd2 |= (SBX_FIXED_LEN_STRING_FLAG + (sal_uInt32(nFixedStringLength) << 17)); // len = all bits above 0x10000
if( pDim != NULL && pDim->GetDims() > 0 )
nOpnd2 |= SBX_TYPE_VAR_TO_DIM_FLAG;
aGen.Gen( eOp2, pDef->GetId(), nOpnd2 );
}

View File

@ -46,11 +46,12 @@ SLOFILES= \
$(SLO)$/token.obj
EXCEPTIONSFILES= \
$(SLO)$/codegen.obj \
$(SLO)$/dim.obj \
$(SLO)$/exprtree.obj \
$(SLO)$/parser.obj \
$(SLO)$/scanner.obj
$(SLO)$/codegen.obj \
$(SLO)$/dim.obj \
$(SLO)$/exprtree.obj \
$(SLO)$/parser.obj \
$(SLO)$/scanner.obj \
$(SLO)$/sbcomp.obj
# --- Targets --------------------------------------------------------------

View File

@ -33,12 +33,18 @@
#include "sbcomp.hxx"
#include "image.hxx"
#include <basic/sbobjmod.hxx>
#include <stdio.h>
// To activate tracing enable in sbtrace.hxx
#ifdef DBG_TRACE_BASIC
// Trace ini file (set NULL to ignore)
// can be overridden with the environment variable OOO_BASICTRACEINI
static char GpTraceIniFile[] = "~/BasicTrace.ini";
//static char* GpTraceIniFile = NULL;
// Trace Settings, used if no ini file / not found in ini file
static char GpTraceFileNameDefault[] = "d:\\zBasic.Asm\\BasicTrace.txt";
static char GpTraceFileNameDefault[] = "~/BasicTrace.txt";
static char* GpTraceFileName = GpTraceFileNameDefault;
// GbTraceOn:
@ -52,6 +58,12 @@ static bool GbTraceOn = true;
// with TraceCommand( "PCodeOn" / "PCodeOff" ), see below
static bool GbIncludePCodes = false;
// GbInitOnlyAtOfficeStart:
// true = Tracing is only intialized onces after Office start when
// Basic runs the first time. Further calls to Basic, e.g. via events
// use the same output file. The trace ini file is not read again.
static bool GbInitOnlyAtOfficeStart = false;
static int GnIndentPerCallLevel = 4;
static int GnIndentForPCode = 2;
@ -73,6 +85,37 @@ static int GnIndentForPCode = 2;
long as it can be converted to string
*/
#ifdef DBG_TRACE_PROFILING
#include <algorithm>
#include <stack>
#include "canvas/elapsedtime.hxx"
//*** Profiling ***
// GbTimerOn:
// true = including time stamps
static bool GbTimerOn = true;
// GbTimeStampForEachStep:
// true = prints time stamp after each command / pcode (very slow)
static bool GbTimeStampForEachStep = false;
// GbBlockAllAfterFirstFunctionUsage:
// true = everything (commands, pcodes, functions) is only printed
// for the first usage (improves performance when tracing / pro-
// filing large macros)
static bool GbBlockAllAfterFirstFunctionUsage = false;
// GbBlockStepsAfterFirstFunctionUsage:
// true = commands / pcodes are only printed for the first time
// a function is executed. Afterwards only the entering/leaving
// messages are logged (improves performance when tracing / pro-
// filing large macros)
static bool GbBlockStepsAfterFirstFunctionUsage = false;
#endif
static void lcl_skipWhites( char*& rpc )
{
while( *rpc == ' ' || *rpc == '\t' )
@ -163,15 +206,643 @@ static void lcl_ReadIniFile( const char* pIniFileName )
if( strcmp( VarNameBuffer, "GbIncludePCodes") == 0 )
GbIncludePCodes = (strcmp( ValBuffer, "true" ) == 0);
else
if( strcmp( VarNameBuffer, "GbInitOnlyAtOfficeStart") == 0 )
GbInitOnlyAtOfficeStart = (strcmp( ValBuffer, "true" ) == 0);
else
if( strcmp( VarNameBuffer, "GnIndentPerCallLevel") == 0 )
GnIndentPerCallLevel = strtol( ValBuffer, NULL, 10 );
else
if( strcmp( VarNameBuffer, "GnIndentForPCode") == 0 )
GnIndentForPCode = strtol( ValBuffer, NULL, 10 );
#ifdef DBG_TRACE_PROFILING
else
if( strcmp( VarNameBuffer, "GbTimerOn") == 0 )
GbTimerOn = (strcmp( ValBuffer, "true" ) == 0);
else
if( strcmp( VarNameBuffer, "GbTimeStampForEachStep") == 0 )
GbTimeStampForEachStep = (strcmp( ValBuffer, "true" ) == 0);
else
if( strcmp( VarNameBuffer, "GbBlockAllAfterFirstFunctionUsage") == 0 )
GbBlockAllAfterFirstFunctionUsage = (strcmp( ValBuffer, "true" ) == 0);
else
if( strcmp( VarNameBuffer, "GbBlockStepsAfterFirstFunctionUsage") == 0 )
GbBlockStepsAfterFirstFunctionUsage = (strcmp( ValBuffer, "true" ) == 0);
#endif
}
fclose( pFile );
}
struct TraceTextData
{
rtl::OString m_aTraceStr_STMNT;
rtl::OString m_aTraceStr_PCode;
};
typedef std::hash_map< sal_Int32, TraceTextData > PCToTextDataMap;
typedef std::hash_map< ::rtl::OUString, PCToTextDataMap*, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleTraceMap;
ModuleTraceMap GaModuleTraceMap;
ModuleTraceMap& rModuleTraceMap = GaModuleTraceMap;
static void lcl_PrepareTraceForModule( SbModule* pModule )
{
String aModuleName = pModule->GetName();
ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
if( it != rModuleTraceMap.end() )
{
PCToTextDataMap* pInnerMap = it->second;
delete pInnerMap;
rModuleTraceMap.erase( it );
}
String aDisassemblyStr;
pModule->Disassemble( aDisassemblyStr );
}
static FILE* GpGlobalFile = NULL;
static void lcl_lineOut( const char* pStr, const char* pPreStr = NULL, const char* pPostStr = NULL )
{
if( GpGlobalFile != NULL )
{
fprintf( GpGlobalFile, "%s%s%s\n", pPreStr ? pPreStr : "", pStr, pPostStr ? pPostStr : "" );
fflush( GpGlobalFile );
}
}
const char* lcl_getSpaces( int nSpaceCount )
{
static sal_Char Spaces[] = " "
" "
" ";
static int nAvailableSpaceCount = strlen( Spaces );
static sal_Char* pSpacesEnd = Spaces + nAvailableSpaceCount;
if( nSpaceCount > nAvailableSpaceCount )
nSpaceCount = nAvailableSpaceCount;
return pSpacesEnd - nSpaceCount;
}
static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr )
{
static sal_Char Buffer[1000];
rtl::OString aOStr = OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US );
const sal_Char* pStr = aOStr.getStr();
// Skip whitespace
sal_Char c = *pStr;
while( c == ' ' || c == '\t' )
{
pStr++;
c = *pStr;
}
int nLen = strlen( pStr );
strncpy( Buffer, pStr, nLen );
Buffer[nLen] = 0;
rtl::OString aORetStr( Buffer );
return aORetStr;
}
String lcl_dumpMethodParameters( SbMethod* pMethod )
{
String aStr;
if( pMethod == NULL )
return aStr;
SbxError eOld = SbxBase::GetError();
SbxArray* pParams = pMethod->GetParameters();
SbxInfo* pInfo = pMethod->GetInfo();
if ( pParams )
{
aStr += '(';
// 0 is sub itself
for ( sal_uInt16 nParam = 1; nParam < pParams->Count(); nParam++ )
{
SbxVariable* pVar = pParams->Get( nParam );
DBG_ASSERT( pVar, "Parameter?!" );
if ( pVar->GetName().Len() )
aStr += pVar->GetName();
else if ( pInfo )
{
const SbxParamInfo* pParam = pInfo->GetParam( nParam );
if ( pParam )
aStr += pParam->aName;
}
aStr += '=';
SbxDataType eType = pVar->GetType();
if( eType & SbxARRAY )
aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
else if( eType != SbxOBJECT )
aStr += pVar->GetString();
if ( nParam < ( pParams->Count() - 1 ) )
aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
}
aStr += ')';
}
SbxBase::ResetError();
if( eOld != SbxERR_OK )
SbxBase::SetError( eOld );
return aStr;
}
// Public functions
static bool GbSavTraceOn = false;
#ifdef DBG_TRACE_PROFILING
static canvas::tools::ElapsedTime* GpTimer = NULL;
static double GdStartTime = 0.0;
static double GdLastTime = 0.0;
static bool GbBlockSteps = false;
static bool GbBlockAll = false;
struct FunctionItem
{
String m_aCompleteFunctionName;
double m_dTotalTime;
double m_dNetTime;
int m_nCallCount;
bool m_bBlockAll;
bool m_bBlockSteps;
FunctionItem( void )
: m_dTotalTime( 0.0 )
, m_dNetTime( 0.0 )
, m_nCallCount( 0 )
, m_bBlockAll( false )
, m_bBlockSteps( false )
{}
};
typedef std::hash_map< ::rtl::OUString, FunctionItem*, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > FunctionItemMap;
static std::stack< double > GaCallEnterTimeStack;
static std::stack< FunctionItem* > GaFunctionItemStack;
static FunctionItemMap GaFunctionItemMap;
bool compareFunctionNetTime( FunctionItem* p1, FunctionItem* p2 )
{
return (p1->m_dNetTime > p2->m_dNetTime);
}
void lcl_printTimeOutput( void )
{
// Overall time output
lcl_lineOut( "" );
lcl_lineOut( "***** Time Output *****" );
char TimeBuffer[500];
double dTotalTime = GpTimer->getElapsedTime() - GdStartTime;
sprintf( TimeBuffer, "Total execution time = %f ms", dTotalTime*1000.0 );
lcl_lineOut( TimeBuffer );
lcl_lineOut( "" );
if( GbTimerOn )
{
lcl_lineOut( "Functions:" );
std::vector<FunctionItem*> avFunctionItems;
FunctionItemMap::iterator it;
for( it = GaFunctionItemMap.begin() ; it != GaFunctionItemMap.end() ; ++it )
{
FunctionItem* pFunctionItem = it->second;
if( pFunctionItem != NULL )
avFunctionItems.push_back( pFunctionItem );
}
std::sort( avFunctionItems.begin(), avFunctionItems.end(), compareFunctionNetTime );
std::vector<FunctionItem*>::iterator itv;
for( itv = avFunctionItems.begin() ; itv != avFunctionItems.end() ; ++itv )
{
FunctionItem* pFunctionItem = *itv;
if( pFunctionItem != NULL )
{
rtl::OUString aCompleteFunctionName = pFunctionItem->m_aCompleteFunctionName;
const char* pName = OUStringToOString( aCompleteFunctionName, RTL_TEXTENCODING_ASCII_US ).getStr();
int nNameLen = aCompleteFunctionName.getLength();
double dFctTotalTime = pFunctionItem->m_dTotalTime;
double dFctNetTime = pFunctionItem->m_dNetTime;
double dFctTotalTimePercent = 100.0 * dFctTotalTime / dTotalTime;
double dFctNetTimePercent = 100.0 * dFctNetTime / dTotalTime;
int nSpaceCount = 30 - nNameLen;
if( nSpaceCount < 0 )
nSpaceCount = 2;
sprintf( TimeBuffer, "%s:%sCalled %d times\t%f ms (%f%%) / net %f (%f%%) ms",
pName, lcl_getSpaces( nSpaceCount ), pFunctionItem->m_nCallCount,
dFctTotalTime*1000.0, dFctTotalTimePercent, dFctNetTime*1000.0, dFctNetTimePercent );
lcl_lineOut( TimeBuffer );
}
}
}
}
#endif
static bool GbInitTraceAlreadyCalled = false;
void dbg_InitTrace( void )
{
if( GbInitOnlyAtOfficeStart && GbInitTraceAlreadyCalled )
{
#ifdef DBG_TRACE_PROFILING
if( GbTimerOn )
GpTimer->continueTimer();
#endif
GpGlobalFile = fopen( GpTraceFileName, "a+" );
return;
}
GbInitTraceAlreadyCalled = true;
if( const sal_Char* pcIniFileName = ::getenv( "OOO_BASICTRACEINI" ) )
lcl_ReadIniFile( pcIniFileName );
else if( GpTraceIniFile != NULL )
lcl_ReadIniFile( GpTraceIniFile );
GpGlobalFile = fopen( GpTraceFileName, "w" );
GbSavTraceOn = GbTraceOn;
if( !GbTraceOn )
lcl_lineOut( "### Program started with trace off ###" );
#ifdef DBG_TRACE_PROFILING
GpTimer = new canvas::tools::ElapsedTime();
GdStartTime = GpTimer->getElapsedTime();
GdLastTime = GdStartTime;
GbBlockSteps = false;
GbBlockAll = false;
#endif
}
void dbg_DeInitTrace( void )
{
GbTraceOn = GbSavTraceOn;
#ifdef DBG_TRACE_PROFILING
while( !GaCallEnterTimeStack.empty() )
GaCallEnterTimeStack.pop();
while( !GaFunctionItemStack.empty() )
GaFunctionItemStack.pop();
lcl_printTimeOutput();
for( FunctionItemMap::iterator it = GaFunctionItemMap.begin() ; it != GaFunctionItemMap.end() ; ++it )
delete it->second;
GaFunctionItemMap.clear();
if( GpGlobalFile )
{
fclose( GpGlobalFile );
GpGlobalFile = NULL;
}
if( GbInitOnlyAtOfficeStart )
{
if( GbTimerOn )
GpTimer->pauseTimer();
}
else
{
delete GpTimer;
}
#endif
}
static sal_Int32 GnLastCallLvl = 0;
void dbg_tracePrint( const String& aStr, sal_Int32 nCallLvl, bool bCallLvlRelativeToCurrent )
{
if( bCallLvlRelativeToCurrent )
nCallLvl += GnLastCallLvl;
int nIndent = nCallLvl * GnIndentPerCallLevel;
lcl_lineOut( OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) );
}
void dbg_traceStep( SbModule* pModule, sal_uInt32 nPC, sal_Int32 nCallLvl )
{
if( !GbTraceOn )
return;
#ifdef DBG_TRACE_PROFILING
if( GbBlockSteps || GbBlockAll )
return;
double dCurTime = 0.0;
bool bPrintTimeStamp = false;
if( GbTimerOn )
{
GpTimer->pauseTimer();
dCurTime = GpTimer->getElapsedTime();
bPrintTimeStamp = GbTimeStampForEachStep;
}
#else
bool bPrintTimeStamp = false;
#endif
GnLastCallLvl = nCallLvl;
SbModule* pTraceMod = pModule;
if( pTraceMod->ISA(SbClassModuleObject) )
{
SbClassModuleObject* pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod;
pTraceMod = pClassModuleObj->getClassModule();
}
String aModuleName = pTraceMod->GetName();
ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
if( it == rModuleTraceMap.end() )
{
const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
char Buffer[200];
sprintf( Buffer, "TRACE ERROR: Unknown module \"%s\"", pModuleNameStr );
lcl_lineOut( Buffer );
return;
}
PCToTextDataMap* pInnerMap = it->second;
if( pInnerMap == NULL )
{
lcl_lineOut( "TRACE INTERNAL ERROR: No inner map" );
return;
}
PCToTextDataMap::iterator itInner = pInnerMap->find( nPC );
if( itInner == pInnerMap->end() )
{
const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
char Buffer[200];
sprintf( Buffer, "TRACE ERROR: No info for PC = %d in module \"%s\"", (int)nPC, pModuleNameStr );
lcl_lineOut( Buffer );
return;
}
int nIndent = nCallLvl * GnIndentPerCallLevel;
const TraceTextData& rTraceTextData = itInner->second;
const rtl::OString& rStr_STMNT = rTraceTextData.m_aTraceStr_STMNT;
bool bSTMT = false;
if( rStr_STMNT.getLength() )
bSTMT = true;
char TimeBuffer[200];
#ifdef DBG_TRACE_PROFILING
if( bPrintTimeStamp )
{
double dDiffTime = dCurTime - GdLastTime;
GdLastTime = dCurTime;
sprintf( TimeBuffer, "\t\t// Time = %f ms / += %f ms", dCurTime*1000.0, dDiffTime*1000.0 );
}
#endif
if( bSTMT )
{
lcl_lineOut( rStr_STMNT.getStr(), lcl_getSpaces( nIndent ),
(bPrintTimeStamp && !GbIncludePCodes) ? TimeBuffer : NULL );
}
if( !GbIncludePCodes )
{
#ifdef DBG_TRACE_PROFILING
if( GbTimerOn )
GpTimer->continueTimer();
#endif
return;
}
nIndent += GnIndentForPCode;
const rtl::OString& rStr_PCode = rTraceTextData.m_aTraceStr_PCode;
if( rStr_PCode.getLength() )
{
lcl_lineOut( rStr_PCode.getStr(), lcl_getSpaces( nIndent ),
bPrintTimeStamp ? TimeBuffer : NULL );
}
#ifdef DBG_TRACE_PROFILING
if( GbTimerOn )
GpTimer->continueTimer();
#endif
}
void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallLvl, bool bLeave )
{
static const char* pSeparator = "' ================================================================================";
if( !GbTraceOn )
return;
#ifdef DBG_TRACE_PROFILING
double dCurTime = 0.0;
double dExecutionTime = 0.0;
if( GbTimerOn )
{
dCurTime = GpTimer->getElapsedTime();
GpTimer->pauseTimer();
}
#endif
GnLastCallLvl = nCallLvl;
SbModule* pTraceMod = pModule;
SbClassModuleObject* pClassModuleObj = NULL;
if( pTraceMod->ISA(SbClassModuleObject) )
{
pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod;
pTraceMod = pClassModuleObj->getClassModule();
}
String aCompleteFunctionName = pTraceMod->GetName();
if( pMethod != NULL )
{
aCompleteFunctionName.AppendAscii( "::" );
String aMethodName = pMethod->GetName();
aCompleteFunctionName += aMethodName;
}
else
{
aCompleteFunctionName.AppendAscii( "/RunInit" );
}
bool bOwnBlockSteps = false;
#ifdef DBG_TRACE_PROFILING
bool bOwnBlockAll = false;
FunctionItem* pFunctionItem = NULL;
if( GbTimerOn )
{
FunctionItemMap::iterator itFunctionItem = GaFunctionItemMap.find( aCompleteFunctionName );
if( itFunctionItem != GaFunctionItemMap.end() )
pFunctionItem = itFunctionItem->second;
if( pFunctionItem == NULL )
{
DBG_ASSERT( !bLeave, "No FunctionItem in leave!" );
pFunctionItem = new FunctionItem();
pFunctionItem->m_aCompleteFunctionName = aCompleteFunctionName;
GaFunctionItemMap[ aCompleteFunctionName ] = pFunctionItem;
}
else if( GbBlockAllAfterFirstFunctionUsage && !bLeave )
{
pFunctionItem->m_bBlockAll = true;
}
else if( GbBlockStepsAfterFirstFunctionUsage && !bLeave )
{
pFunctionItem->m_bBlockSteps = true;
}
if( bLeave )
{
bOwnBlockAll = GbBlockAll;
bOwnBlockSteps = GbBlockSteps;
GbBlockAll = false;
GbBlockSteps = false;
dExecutionTime = dCurTime - GaCallEnterTimeStack.top();
GaCallEnterTimeStack.pop();
pFunctionItem->m_dTotalTime += dExecutionTime;
pFunctionItem->m_dNetTime += dExecutionTime;
pFunctionItem->m_nCallCount++;
GaFunctionItemStack.pop();
if( !GaFunctionItemStack.empty() )
{
FunctionItem* pParentItem = GaFunctionItemStack.top();
if( pParentItem != NULL )
{
pParentItem->m_dNetTime -= dExecutionTime;
GbBlockSteps = pParentItem->m_bBlockSteps;
GbBlockAll = pParentItem->m_bBlockAll;
}
}
}
else
{
GbBlockSteps = bOwnBlockSteps = pFunctionItem->m_bBlockSteps;
GbBlockAll = bOwnBlockAll = pFunctionItem->m_bBlockAll;
GaCallEnterTimeStack.push( dCurTime );
GaFunctionItemStack.push( pFunctionItem );
}
}
if( bOwnBlockAll )
{
if( GbTimerOn )
GpTimer->continueTimer();
return;
}
#endif
if( nCallLvl > 0 )
nCallLvl--;
int nIndent = nCallLvl * GnIndentPerCallLevel;
if( !bLeave && !bOwnBlockSteps )
{
lcl_lineOut( "" );
lcl_lineOut( pSeparator, lcl_getSpaces( nIndent ) );
}
String aStr;
if( bLeave )
{
if( !bOwnBlockSteps )
{
lcl_lineOut( "}", lcl_getSpaces( nIndent ) );
aStr.AppendAscii( "' Leaving " );
}
}
else
{
aStr.AppendAscii( "Entering " );
}
if( !bLeave || !bOwnBlockSteps )
aStr += aCompleteFunctionName;
if( !bOwnBlockSteps && pClassModuleObj != NULL )
{
aStr.AppendAscii( "[this=" );
aStr += pClassModuleObj->GetName();
aStr.AppendAscii( "]" );
}
if( !bLeave )
aStr += lcl_dumpMethodParameters( pMethod );
const char* pPostStr = NULL;
#ifdef DBG_TRACE_PROFILING
char TimeBuffer[200];
if( GbTimerOn && bLeave )
{
sprintf( TimeBuffer, " // Execution Time = %f ms", dExecutionTime*1000.0 );
pPostStr = TimeBuffer;
}
#endif
lcl_lineOut( (!bLeave || !bOwnBlockSteps) ? OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr() : "}",
lcl_getSpaces( nIndent ), pPostStr );
if( !bLeave )
lcl_lineOut( "{", lcl_getSpaces( nIndent ) );
if( bLeave && !bOwnBlockSteps )
lcl_lineOut( "" );
#ifdef DBG_TRACE_PROFILING
if( GbTimerOn )
GpTimer->continueTimer();
#endif
}
void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, sal_Int32 nCallLvl )
{
if( !GbTraceOn )
return;
#ifdef DBG_TRACE_PROFILING
if( GbBlockSteps || GbBlockAll )
return;
#endif
GnLastCallLvl = nCallLvl;
rtl::OString aOTraceErrMsg = OUStringToOString( rtl::OUString( aTraceErrMsg ), RTL_TEXTENCODING_ASCII_US );
char Buffer[200];
const char* pHandledStr = bTraceErrHandled ? " / HANDLED" : "";
sprintf( Buffer, "*** ERROR%s, Id = %d, Msg = \"%s\" ***", pHandledStr, (int)nTraceErr, aOTraceErrMsg.getStr() );
int nIndent = nCallLvl * GnIndentPerCallLevel;
lcl_lineOut( Buffer, lcl_getSpaces( nIndent ) );
}
void dbg_RegisterTraceTextForPC( SbModule* pModule, sal_uInt32 nPC,
const String& aTraceStr_STMNT, const String& aTraceStr_PCode )
{
String aModuleName = pModule->GetName();
ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
PCToTextDataMap* pInnerMap;
if( it == rModuleTraceMap.end() )
{
pInnerMap = new PCToTextDataMap();
rModuleTraceMap[ aModuleName ] = pInnerMap;
}
else
{
pInnerMap = it->second;
}
TraceTextData aData;
rtl::OString aOTraceStr_STMNT = lcl_toOStringSkipLeadingWhites( aTraceStr_STMNT );
aData.m_aTraceStr_STMNT = aOTraceStr_STMNT;
rtl::OString aOTraceStr_PCode = lcl_toOStringSkipLeadingWhites( aTraceStr_PCode );
aData.m_aTraceStr_PCode = aOTraceStr_PCode;
(*pInnerMap)[nPC] = aData;
}
void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
{
@ -223,7 +894,7 @@ void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
sprintf( Buffer, "### TRACE_PRINT: %s ###", pValStr );
int nIndent = GnLastCallLvl * GnIndentPerCallLevel;
lcl_lineOut( GpTraceFileName, Buffer, lcl_getSpaces( nIndent ) );
lcl_lineOut( Buffer, lcl_getSpaces( nIndent ) );
if( eOld != SbxERR_OK )
SbxBase::SetError( eOld );

View File

@ -303,6 +303,7 @@ SbiSymDef::SbiSymDef( const String& rName ) : aName( rName )
bOpt =
bParamArray =
bWithEvents =
bWithBrackets =
bByVal =
bChained =
bGlobal = sal_False;

View File

@ -399,7 +399,8 @@ SbiToken SbiTokenizer::Next()
}
special:
// #i92642
if( eCurTok != NIL && eCurTok != REM && eCurTok != EOLN && (tp->t == NAME || tp->t == LINE) )
bool bStartOfLine = (eCurTok == NIL || eCurTok == REM || eCurTok == EOLN);
if( !bStartOfLine && (tp->t == NAME || tp->t == LINE) )
return eCurTok = SYMBOL;
else if( tp->t == TEXT )
return eCurTok = SYMBOL;
@ -466,6 +467,9 @@ special:
// #129904 Suppress system
if( eTok == STOP && aSym.CompareIgnoreCaseToAscii( "system" ) == COMPARE_EQUAL )
eCurTok = SYMBOL;
if( eTok == GET && bStartOfLine )
eCurTok = SYMBOL;
}
else
{

View File

@ -88,7 +88,8 @@ public:
// #111897 PARAM_INFO flags start at 0x00010000 to not
// conflict with DefaultId in SbxParamInfo::nUserData
#define PARAM_INFO_PARAMARRAY 0x0010000
#define PARAM_INFO_PARAMARRAY 0x0010000
#define PARAM_INFO_WITHBRACKETS 0x0020000
#endif

View File

@ -48,14 +48,23 @@
#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/deployment/XPackage.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <com/sun/star/script/vba/XVBAScriptListener.hpp>
#include <com/sun/star/util/XChangesNotifier.hpp>
#include <osl/mutex.hxx>
#include <unotools/eventlisteneradapter.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/compbase8.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <cppuhelper/weakref.hxx>
#include <cppuhelper/component.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <cppuhelper/basemutex.hxx>
#include <sot/storage.hxx>
#include <comphelper/listenernotification.hxx>
#include <xmlscript/xmllib_imexp.hxx>
#include <com/sun/star/deployment/XPackage.hpp>
@ -84,16 +93,12 @@ typedef ::cppu::WeakComponentImplHelper9<
typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
::com::sun::star::container::XContainer > NameContainerHelper;
typedef ::cppu::WeakImplHelper3<
::com::sun::star::container::XNameContainer,
::com::sun::star::container::XContainer,
::com::sun::star::util::XChangesNotifier > NameContainer_BASE;
struct hashName_Impl
{
size_t operator()(const ::rtl::OUString Str) const
{
return (size_t)Str.hashCode();
}
};
struct eqName_Impl
class NameContainer : public ::cppu::BaseMutex, public NameContainer_BASE
{
sal_Bool operator()(const ::rtl::OUString Str1, const ::rtl::OUString Str2) const
{
@ -113,8 +118,6 @@ NameContainerNameMap;
//============================================================================
class NameContainer : public ::cppu::BaseMutex, public NameContainerHelper
{
NameContainerNameMap mHashMap;
::com::sun::star::uno::Sequence< ::rtl::OUString > mNames;
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > mValues;
@ -123,14 +126,16 @@ class NameContainer : public ::cppu::BaseMutex, public NameContainerHelper
::com::sun::star::uno::Type mType;
::com::sun::star::uno::XInterface* mpxEventSource;
::cppu::OInterfaceContainerHelper maListenerContainer;
::cppu::OInterfaceContainerHelper maContainerListeners;
::cppu::OInterfaceContainerHelper maChangesListeners;
public:
NameContainer( const ::com::sun::star::uno::Type& rType )
: mnElementCount( 0 )
, mType( rType )
, mpxEventSource( NULL )
, maListenerContainer( m_aMutex )
, maContainerListeners( m_aMutex )
, maChangesListeners( m_aMutex )
{}
void setEventSource( ::com::sun::star::uno::XInterface* pxEventSource )
@ -177,21 +182,18 @@ public:
virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
// Methods XChangesNotifier
virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference<
::com::sun::star::util::XChangesListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference<
::com::sun::star::util::XChangesListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
};
//============================================================================
class SfxLibrary;
enum InitMode
{
DEFAULT,
CONTAINER_INIT_FILE,
LIBRARY_INIT_FILE,
OFFICE_DOCUMENT,
OLD_BASIC_STORAGE
};
class ModifiableHelper
{
private:
@ -221,9 +223,42 @@ public:
}
};
class SfxLibraryContainer :public LibraryContainerHelper
,public ::utl::OEventListenerAdapter
//============================================================================
typedef ::comphelper::OListenerContainerBase<
::com::sun::star::script::vba::XVBAScriptListener,
::com::sun::star::script::vba::VBAScriptEvent > VBAScriptListenerContainer_BASE;
class VBAScriptListenerContainer : public VBAScriptListenerContainer_BASE
{
public:
explicit VBAScriptListenerContainer( ::osl::Mutex& rMutex );
private:
virtual bool implTypedNotify(
const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAScriptListener >& rxListener,
const ::com::sun::star::script::vba::VBAScriptEvent& rEvent )
throw (::com::sun::star::uno::Exception);
};
//============================================================================
class SfxLibrary;
typedef ::cppu::WeakComponentImplHelper8<
::com::sun::star::lang::XInitialization,
::com::sun::star::script::XStorageBasedLibraryContainer,
::com::sun::star::script::XLibraryContainerPassword,
::com::sun::star::script::XLibraryContainerExport,
::com::sun::star::script::XLibraryContainer3,
::com::sun::star::container::XContainer,
::com::sun::star::script::vba::XVBACompatibility,
::com::sun::star::lang::XServiceInfo > SfxLibraryContainer_BASE;
class SfxLibraryContainer : public SfxLibraryContainer_BASE, public ::utl::OEventListenerAdapter
{
VBAScriptListenerContainer maVBAScriptListeners;
sal_Int32 mnRunningVBAScripts;
sal_Bool mbVBACompat;
rtl::OUString msProjectName;
protected:
@ -251,7 +286,14 @@ protected:
BasicManager* mpBasMgr;
sal_Bool mbOwnBasMgr;
InitMode meInitMode;
enum InitMode
{
DEFAULT,
CONTAINER_INIT_FILE,
LIBRARY_INIT_FILE,
OFFICE_DOCUMENT,
OLD_BASIC_STORAGE
} meInitMode;
void implStoreLibrary( SfxLibrary* pLib,
const ::rtl::OUString& aName,
@ -517,8 +559,20 @@ public:
virtual void SAL_CALL setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getProjectName() throw (::com::sun::star::uno::RuntimeException) { return msProjectName; }
virtual void SAL_CALL setProjectName( const ::rtl::OUString& _projectname ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Int32 SAL_CALL getRunningVBAScripts()
throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addVBAScriptListener(
const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAScriptListener >& Listener )
throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeVBAScriptListener(
const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAScriptListener >& Listener )
throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL broadcastVBAScriptEvent( sal_Int32 nIdentifier, const ::rtl::OUString& rModuleName )
throw (::com::sun::star::uno::RuntimeException);
};
//============================================================================
class LibraryContainerMethodGuard
{
private:
@ -536,12 +590,12 @@ public:
}
};
//============================================================================
class SfxLibrary
: public ::com::sun::star::container::XNameContainer
, public ::com::sun::star::container::XContainer
, public ::com::sun::star::util::XChangesNotifier
, public ::cppu::BaseMutex
, public ::cppu::OComponentHelper
{
@ -677,6 +731,14 @@ public:
::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
// Methods XChangesNotifier
virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference<
::com::sun::star::util::XChangesListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference<
::com::sun::star::util::XChangesListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
public:
struct LibraryContainerAccess { friend class SfxLibraryContainer; private: LibraryContainerAccess() { } };
void removeElementWithoutChecks( const ::rtl::OUString& _rElementName, LibraryContainerAccess )
@ -688,18 +750,19 @@ protected:
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
};
//===================================================================
//============================================================================
class ScriptSubPackageIterator
{
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > m_xMainPackage;
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > m_xMainPackage;
bool m_bIsValid;
bool m_bIsBundle;
bool m_bIsValid;
bool m_bIsBundle;
com::sun::star::uno::Sequence< com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage > > m_aSubPkgSeq;
sal_Int32 m_nSubPkgCount;
sal_Int32 m_iNextSubPkg;
< com::sun::star::deployment::XPackage > > m_aSubPkgSeq;
sal_Int32 m_nSubPkgCount;
sal_Int32 m_iNextSubPkg;
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >
implDetectScriptPackage( const com::sun::star::uno::Reference
@ -711,13 +774,7 @@ public:
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > getNextScriptSubPackage( bool& rbPureDialogLib );
};
enum IteratorState
{
USER_EXTENSIONS,
SHARED_EXTENSIONS,
BUNDLED_EXTENSIONS,
END_REACHED
};
//============================================================================
class ScriptExtensionIterator
{
@ -738,34 +795,37 @@ protected:
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >
implGetNextBundledScriptPackage( bool& rbPureDialogLib );
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
IteratorState m_eState;
enum IteratorState
{
USER_EXTENSIONS,
SHARED_EXTENSIONS,
BUNDLED_EXTENSIONS,
END_REACHED
} m_eState;
com::sun::star::uno::Sequence< com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage > > m_aUserPackagesSeq;
bool m_bUserPackagesLoaded;
< com::sun::star::deployment::XPackage > > m_aUserPackagesSeq;
bool m_bUserPackagesLoaded;
com::sun::star::uno::Sequence< com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq;
bool m_bSharedPackagesLoaded;
< com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq;
bool m_bSharedPackagesLoaded;
com::sun::star::uno::Sequence< com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq;
bool m_bBundledPackagesLoaded;
< com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq;
bool m_bBundledPackagesLoaded;
int m_iUserPackage;
int m_iSharedPackage;
int m_iBundledPackage;
int m_iUserPackage;
int m_iSharedPackage;
int m_iBundledPackage;
ScriptSubPackageIterator* m_pScriptSubPackageIterator;
ScriptSubPackageIterator* m_pScriptSubPackageIterator;
}; // end class ScriptExtensionIterator
//============================================================================
} // namespace basic

View File

@ -438,6 +438,8 @@ public:
SbxArray* GetParams();
SbxVariable* GetExternalCaller(){ return mpExtCaller; }
SbiForStack* FindForStackItemForCollection( class BasicCollection* pCollection );
SbxBase* FindElementExtern( const String& rName );
static bool isVBAEnabled();

View File

@ -30,6 +30,19 @@
//#define DBG_TRACE_BASIC
// ###############################################################################
// ###
// ### ATTENTION:
// ###
// ### - DBG_TRACE_PROFILING can only be activated together with DBG_TRACE_BASIC
// ###
// ### - If you activate DBG_TRACE_PROFILING you also need to uncomment line
// ### # SHL1STDLIBS+=$(CANVASTOOLSLIB) in basic/util/makefile.mk (search
// ### for DBG_TRACE_PROFILING there)
// ###
// ###############################################################################
//#define DBG_TRACE_PROFILING
#ifdef DBG_TRACE_BASIC
void dbg_InitTrace( void );
void dbg_DeInitTrace( void );

View File

@ -36,11 +36,11 @@
class BasicManager;
//============================================================================
namespace basic
{
//============================================================================
class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPassword
{
::rtl::OUString maScriptLanguage;
@ -145,14 +145,14 @@ public:
//============================================================================
typedef boost::unordered_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInfoMap;
typedef ::cppu::ImplHelper1 < ::com::sun::star::script::vba::XVBAModuleInfo
> SfxScriptLibrary_BASE;
typedef ::cppu::ImplHelper1< ::com::sun::star::script::vba::XVBAModuleInfo > SfxScriptLibrary_BASE;
class SfxScriptLibrary : public SfxLibrary
, public SfxScriptLibrary_BASE
class SfxScriptLibrary : public SfxLibrary, public SfxScriptLibrary_BASE
{
friend class SfxScriptLibraryContainer;
typedef std::hash_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash > ModuleInfoMap;
sal_Bool mbLoadedSource;
sal_Bool mbLoadedBinary;
ModuleInfoMap mModuleInfos;
@ -197,7 +197,9 @@ protected:
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
};
} // namespace base
//============================================================================
} // namespace basic
#endif

View File

@ -131,6 +131,7 @@ protected:
sal_Bool bGlobal : 1; // sal_True: Global-Variable
sal_Bool bParamArray : 1; // sal_True: ParamArray parameter
sal_Bool bWithEvents : 1; // sal_True: Declared WithEvents
sal_Bool bWithBrackets : 1; // sal_True: Followed by ()
sal_uInt16 nDefaultId; // Symbol number of default value
short nFixedStringLength; // String length in: Dim foo As String*Length
public:
@ -157,6 +158,7 @@ public:
void SetOptional() { bOpt = sal_True; }
void SetParamArray() { bParamArray = sal_True; }
void SetWithEvents() { bWithEvents = sal_True; }
void SetWithBrackets(){ bWithBrackets = sal_True; }
void SetByVal( sal_Bool bByVal_ = sal_True )
{ bByVal = bByVal_; }
void SetStatic( sal_Bool bAsStatic = sal_True ) { bStatic = bAsStatic; }
@ -168,6 +170,7 @@ public:
sal_Bool IsOptional() const{ return bOpt; }
sal_Bool IsParamArray() const{ return bParamArray; }
sal_Bool IsWithEvents() const{ return bWithEvents; }
sal_Bool IsWithBrackets() const{ return bWithBrackets; }
sal_Bool IsByVal() const { return bByVal; }
sal_Bool IsStatic() const { return bStatic; }
sal_Bool IsNew() const { return bNew; }

View File

@ -79,6 +79,7 @@ using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
using namespace com::sun::star::io;
using namespace com::sun::star::script;
using namespace com::sun::star::frame;
#include "stdobj.hxx"
#include <basic/sbstdobj.hxx>
@ -89,6 +90,7 @@ using namespace com::sun::star::script;
#include "iosys.hxx"
#include "ddectrl.hxx"
#include <sbintern.hxx>
#include <basic/vbahelper.hxx>
#include <list>
#include <math.h>
@ -383,22 +385,48 @@ RTLFUNC(Asc)
}
}
RTLFUNC(Chr)
void implChr( SbxArray& rPar, bool bChrW )
{
(void)pBasic;
(void)bWrite;
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
SbxVariableRef pArg = rPar.Get( 1 );
sal_Unicode aCh = (sal_Unicode)pArg->GetUShort();
String aStr( aCh );
String aStr;
if( !bChrW && SbiRuntime::isVBAEnabled() )
{
sal_Char c = (sal_Char)pArg->GetByte();
ByteString s( c );
aStr = String( s, gsl_getSystemTextEncoding() );
}
else
{
sal_Unicode aCh = (sal_Unicode)pArg->GetUShort();
aStr = String( aCh );
}
rPar.Get(0)->PutString( aStr );
}
}
RTLFUNC(Chr)
{
(void)pBasic;
(void)bWrite;
bool bChrW = false;
implChr( rPar, bChrW );
}
RTLFUNC(ChrW)
{
(void)pBasic;
(void)bWrite;
bool bChrW = true;
implChr( rPar, bChrW );
}
#ifdef UNX
#define _MAX_PATH 260
@ -481,11 +509,16 @@ RTLFUNC(CurDir)
RTLFUNC(ChDir)
{
(void)pBasic;
(void)bWrite;
rPar.Get(0)->PutEmpty();
if (rPar.Count() != 2)
if (rPar.Count() == 2)
{
// VBA: track current directory per document type (separately for Writer, Calc, Impress, etc.)
if( SbiRuntime::isVBAEnabled() )
::basic::vba::registerCurrentDirectory( getDocumentModel( pBasic ), rPar.Get(1)->GetString() );
}
else
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
@ -689,7 +722,7 @@ void implRemoveDirRecursive( const String& aDirPath )
FileBase::RC nRet = DirectoryItem::get( aDirPath, aItem );
sal_Bool bExists = (nRet == FileBase::E_None);
FileStatus aFileStatus( FileStatusMask_Type );
FileStatus aFileStatus( osl_FileStatus_Mask_Type );
nRet = aItem.getFileStatus( aFileStatus );
FileStatus::Type aType = aFileStatus.getFileType();
sal_Bool bFolder = isFolder( aType );
@ -716,7 +749,7 @@ void implRemoveDirRecursive( const String& aDirPath )
break;
// Handle flags
FileStatus aFileStatus2( FileStatusMask_Type | FileStatusMask_FileURL );
FileStatus aFileStatus2( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL );
nRet = aItem2.getFileStatus( aFileStatus2 );
::rtl::OUString aPath = aFileStatus2.getFileURL();
@ -845,7 +878,7 @@ RTLFUNC(FileLen)
{
DirectoryItem aItem;
DirectoryItem::get( getFullPathUNC( aStr ), aItem );
FileStatus aFileStatus( FileStatusMask_FileSize );
FileStatus aFileStatus( osl_FileStatus_Mask_FileSize );
aItem.getFileStatus( aFileStatus );
nLen = (sal_Int32)aFileStatus.getFileSize();
}
@ -2459,7 +2492,7 @@ String getDirectoryPath( String aPathStr )
FileBase::RC nRet = DirectoryItem::get( aPathStr, aItem );
if( nRet == FileBase::E_None )
{
FileStatus aFileStatus( FileStatusMask_Type );
FileStatus aFileStatus( osl_FileStatus_Mask_Type );
nRet = aItem.getFileStatus( aFileStatus );
if( nRet == FileBase::E_None )
{
@ -2470,7 +2503,7 @@ String getDirectoryPath( String aPathStr )
}
else if( aType == FileStatus::Link )
{
FileStatus aFileStatus2( FileStatusMask_LinkTargetURL );
FileStatus aFileStatus2( osl_FileStatus_Mask_LinkTargetURL );
nRet = aItem.getFileStatus( aFileStatus2 );
if( nRet == FileBase::E_None )
aRetStr = getDirectoryPath( aFileStatus2.getLinkTargetURL() );
@ -2817,7 +2850,7 @@ RTLFUNC(Dir)
}
// Handle flags
FileStatus aFileStatus( FileStatusMask_Type | FileStatusMask_FileName );
FileStatus aFileStatus( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName );
nRet = aItem.getFileStatus( aFileStatus );
// Only directories?
@ -2917,7 +2950,7 @@ RTLFUNC(GetAttr)
{
DirectoryItem aItem;
DirectoryItem::get( getFullPathUNC( rPar.Get(1)->GetString() ), aItem );
FileStatus aFileStatus( FileStatusMask_Attributes | FileStatusMask_Type );
FileStatus aFileStatus( osl_FileStatus_Mask_Attributes | osl_FileStatus_Mask_Type );
aItem.getFileStatus( aFileStatus );
sal_uInt64 nAttributes = aFileStatus.getAttributes();
sal_Bool bReadOnly = (nAttributes & Attribute_ReadOnly) != 0;
@ -2969,7 +3002,7 @@ RTLFUNC(FileDateTime)
{
DirectoryItem aItem;
DirectoryItem::get( getFullPathUNC( aPath ), aItem );
FileStatus aFileStatus( FileStatusMask_ModifyTime );
FileStatus aFileStatus( osl_FileStatus_Mask_ModifyTime );
aItem.getFileStatus( aFileStatus );
TimeValue aTimeVal = aFileStatus.getModifyTime();
oslDateTime aDT;

View File

@ -1063,6 +1063,10 @@ sal_Bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
{
sal_uInt8 aByte;
*pStrm >> aByte;
if( bBinary && SbiRuntime::isVBAEnabled() && aByte == 1 && pStrm->IsEof() )
aByte = 0;
rVar.PutByte( aByte );
}
break;
@ -1178,7 +1182,8 @@ void PutGet( SbxArray& rPar, sal_Bool bPut )
}
sal_Int16 nFileNo = rPar.Get(1)->GetInteger();
SbxVariable* pVar2 = rPar.Get(2);
sal_Bool bHasRecordNo = (sal_Bool)(pVar2->GetType() != SbxEMPTY);
SbxDataType eType2 = pVar2->GetType();
sal_Bool bHasRecordNo = (sal_Bool)(eType2 != SbxEMPTY && eType2 != SbxERROR);
long nRecordNo = pVar2->GetLong();
if ( nFileNo < 1 || ( bHasRecordNo && nRecordNo < 1 ) )
{

View File

@ -158,6 +158,7 @@ extern RTLFUNC(Abs);
extern RTLFUNC(Asc);
extern RTLFUNC(Atn);
extern RTLFUNC(Chr);
extern RTLFUNC(ChrW);
extern RTLFUNC(Cos);
extern RTLFUNC(CurDir);
extern RTLFUNC(ChDir); // JSM

View File

@ -652,6 +652,7 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
// Methoden sind immer byval!
sal_Bool bByVal = v->IsA( TYPE(SbxMethod) );
SbxDataType t = v->GetType();
bool bTargetTypeIsArray = false;
if( p )
{
bByVal |= sal_Bool( ( p->eType & SbxBYREF ) == 0 );
@ -660,9 +661,13 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
if( !bByVal && t != SbxVARIANT &&
(!v->IsFixed() || (SbxDataType)(v->GetType() & 0x0FFF ) != t) )
bByVal = sal_True;
bTargetTypeIsArray = (p->nUserData & PARAM_INFO_WITHBRACKETS) != 0;
}
if( bByVal )
{
if( bTargetTypeIsArray )
t = SbxOBJECT;
SbxVariable* v2 = new SbxVariable( t );
v2->SetFlag( SBX_READWRITE );
*v2 = *v;
@ -1230,6 +1235,28 @@ void SbiRuntime::ClearForStack()
PopFor();
}
SbiForStack* SbiRuntime::FindForStackItemForCollection( class BasicCollection* pCollection )
{
SbiForStack* pRet = NULL;
SbiForStack* p = pForStk;
while( p )
{
SbxVariable* pVar = p->refEnd.Is() ? (SbxVariable*)p->refEnd : NULL;
if( p->eForType == FOR_EACH_COLLECTION && pVar != NULL &&
(pCollection = PTR_CAST(BasicCollection,pVar)) == pCollection )
{
pRet = p;
break;
}
}
return pRet;
}
//////////////////////////////////////////////////////////////////////////
//
// DLL-Aufrufe
void SbiRuntime::DllCall

View File

@ -148,7 +148,7 @@ static Methods aMethods[] = {
{ "Chr", SbxSTRING, 1 | _FUNCTION, RTLNAME(Chr),0 },
{ "string", SbxINTEGER, 0,NULL,0 },
{ "ChrW", SbxSTRING, 1 | _FUNCTION | _COMPATONLY, RTLNAME(Chr),0},
{ "ChrW", SbxSTRING, 1 | _FUNCTION | _COMPATONLY, RTLNAME(ChrW),0},
{ "string", SbxINTEGER, 0,NULL,0 },
{ "CInt", SbxINTEGER, 1 | _FUNCTION, RTLNAME(CInt),0 },

View File

@ -802,6 +802,8 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar )
// auch Arrays ohne Dimensionsangaben zulassen (VB-komp.)
if( pDims )
{
refVar->ResetFlag( SBX_VAR_TO_DIM );
for( sal_uInt16 i = 1; i < pDims->Count(); )
{
sal_Int32 lb = pDims->Get( i++ )->GetLong();

View File

@ -39,8 +39,7 @@
#include "sbunoobj.hxx"
#include "errobject.hxx"
bool checkUnoObjectType( SbUnoObject* refVal,
const String& aClass );
bool checkUnoObjectType( SbUnoObject* refVal, const ::rtl::OUString& aClass );
// Laden einer numerischen Konstanten (+ID)
@ -437,15 +436,15 @@ void SbiRuntime::StepPRCHAR( sal_uInt32 nOp1 )
// Check, ob TOS eine bestimmte Objektklasse ist (+StringID)
bool SbiRuntime::implIsClass( SbxObject* pObj, const String& aClass )
bool SbiRuntime::implIsClass( SbxObject* pObj, const ::rtl::String& aClass )
{
bool bRet = true;
if( aClass.Len() != 0 )
if( aClass.getLenth() != 0 )
{
bRet = pObj->IsClass( aClass );
if( !bRet )
bRet = aClass.EqualsIgnoreCaseAscii( String( RTL_CONSTASCII_USTRINGPARAM("object") ) );
bRet = aClass.equalsIgnoreCaseAscii( String( RTL_CONSTASCII_USTRINGPARAM("object") ) );
if( !bRet )
{
String aObjClass = pObj->GetClassName();
@ -463,7 +462,7 @@ bool SbiRuntime::implIsClass( SbxObject* pObj, const String& aClass )
}
bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
const String& aClass, bool bRaiseErrors, bool bDefault )
const ::rtl::OUString& aClass, bool bRaiseErrors, bool bDefault )
{
bool bOk = bDefault;

View File

@ -621,7 +621,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
else if( bVBAEnabled ) // !pObj
{
SbxArray* pParam = pElem->GetParameters();
if( pParam != NULL )
if( pParam != NULL && !pElem->IsSet( SBX_VAR_TO_DIM ) )
Error( SbERR_NO_OBJECT );
}
}
@ -1131,6 +1131,10 @@ void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt3
aStr.Fill( nCount, 0 );
pVar->PutString( aStr );
}
bool bVarToDim = ((nOp2 & SBX_TYPE_VAR_TO_DIM_FLAG) != 0);
if( bVarToDim )
pVar->SetFlag( SBX_VAR_TO_DIM );
}
// Einrichten einer lokalen Variablen (+StringID+Typ)

View File

@ -35,9 +35,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
#ifndef __RSC //autogen
#include <tools/errinf.hxx>
#endif
#include <osl/mutex.hxx>
#include <osl/diagnose.h>
#include <rtl/uri.hxx>
@ -64,7 +62,8 @@
#include <com/sun/star/uno/DeploymentException.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/script/LibraryNotLoadedException.hpp>
#include "com/sun/star/deployment/ExtensionManager.hpp"
#include <com/sun/star/script/vba/VBAScriptEventId.hpp>
#include <com/sun/star/deployment/ExtensionManager.hpp>
#include <comphelper/storagehelper.hxx>
#include <comphelper/anytostring.hxx>
#include <cppuhelper/exc_hlp.hxx>
@ -167,25 +166,29 @@ void NameContainer::replaceByName( const OUString& aName, const Any& aElement )
// Fire event
ContainerEvent aEvent;
aEvent.Source = mpxEventSource;
aEvent.Accessor <<= aName;
aEvent.Element = aElement;
aEvent.ReplacedElement = aOldElement;
OInterfaceIteratorHelper aIterator( maListenerContainer );
while( aIterator.hasMoreElements() )
if( maContainerListeners.getLength() > 0 )
{
Reference< XInterface > xIface = aIterator.next();
Reference< XContainerListener > xListener( xIface, UNO_QUERY );
try
{
xListener->elementReplaced( aEvent );
}
catch(RuntimeException&)
{
aIterator.remove();
}
ContainerEvent aEvent;
aEvent.Source = mpxEventSource;
aEvent.Accessor <<= aName;
aEvent.Element = aElement;
aEvent.ReplacedElement = aOldElement;
maContainerListeners.notifyEach( &XContainerListener::elementReplaced, aEvent );
}
/* After the container event has been fired (one listener will update the
core Basic manager), fire change event. Listeners can rely that the
Basic source code of the core Basic manager is up-to-date. */
if( maChangesListeners.getLength() > 0 )
{
ChangesEvent aEvent;
aEvent.Source = mpxEventSource;
aEvent.Base <<= aEvent.Source;
aEvent.Changes.realloc( 1 );
aEvent.Changes[ 0 ].Accessor <<= aName;
aEvent.Changes[ 0 ].Element <<= aElement;
aEvent.Changes[ 0 ].ReplacedElement = aOldElement;
maChangesListeners.notifyEach( &XChangesListener::changesOccurred, aEvent );
}
}
@ -213,33 +216,35 @@ void NameContainer::insertByName( const OUString& aName, const Any& aElement )
mHashMap[ aName ] = nCount;
mnElementCount++;
// Fire event
ContainerEvent aEvent;
aEvent.Source = mpxEventSource;
aEvent.Accessor <<= aName;
aEvent.Element = aElement;
OInterfaceIteratorHelper aIterator( maListenerContainer );
while( aIterator.hasMoreElements() )
if( maContainerListeners.getLength() > 0 )
{
Reference< XInterface > xIface = aIterator.next();
Reference< XContainerListener > xListener( xIface, UNO_QUERY );
try
{
xListener->elementInserted( aEvent );
}
catch(RuntimeException&)
{
aIterator.remove();
}
ContainerEvent aEvent;
aEvent.Source = mpxEventSource;
aEvent.Accessor <<= aName;
aEvent.Element = aElement;
maContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent );
}
/* After the container event has been fired (one listener will update the
core Basic manager), fire change event. Listeners can rely that the
Basic source code of the core Basic manager is up-to-date. */
if( maChangesListeners.getLength() > 0 )
{
ChangesEvent aEvent;
aEvent.Source = mpxEventSource;
aEvent.Base <<= aEvent.Source;
aEvent.Changes.realloc( 1 );
aEvent.Changes[ 0 ].Accessor <<= aName;
aEvent.Changes[ 0 ].Element <<= aElement;
maChangesListeners.notifyEach( &XChangesListener::changesOccurred, aEvent );
}
}
void NameContainer::removeByName( const OUString& Name )
void NameContainer::removeByName( const OUString& aName )
throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
NameContainerNameMap::iterator aIt = mHashMap.find( Name );
NameContainerNameMap::iterator aIt = mHashMap.find( aName );
if( aIt == mHashMap.end() )
{
throw NoSuchElementException();
@ -261,26 +266,29 @@ void NameContainer::removeByName( const OUString& Name )
mValues.realloc( iLast );
mnElementCount--;
// Fire event
ContainerEvent aEvent;
aEvent.Source = mpxEventSource;
aEvent.Accessor <<= Name;
aEvent.Element = aOldElement;
OInterfaceIteratorHelper aIterator( maListenerContainer );
while( aIterator.hasMoreElements() )
if( maContainerListeners.getLength() > 0 )
{
Reference< XInterface > xIface = aIterator.next();
Reference< XContainerListener > xListener( xIface, UNO_QUERY );
try
{
xListener->elementRemoved( aEvent );
}
catch(RuntimeException&)
{
aIterator.remove();
}
ContainerEvent aEvent;
aEvent.Source = mpxEventSource;
aEvent.Accessor <<= aName;
aEvent.Element = aOldElement;
maContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvent );
}
/* After the container event has been fired (one listener will update the
core Basic manager), fire change event. Listeners can rely that the
Basic source code of the core Basic manager is up-to-date. */
if( maChangesListeners.getLength() > 0 )
{
ChangesEvent aEvent;
aEvent.Source = mpxEventSource;
aEvent.Base <<= aEvent.Source;
aEvent.Changes.realloc( 1 );
aEvent.Changes[ 0 ].Accessor <<= aName;
// aEvent.Changes[ 0 ].Element remains empty (meaning "replaced with nothing")
aEvent.Changes[ 0 ].ReplacedElement = aOldElement;
maChangesListeners.notifyEach( &XChangesListener::changesOccurred, aEvent );
}
}
@ -292,7 +300,7 @@ void SAL_CALL NameContainer::addContainerListener( const Reference< XContainerLi
if( !xListener.is() )
throw RuntimeException();
Reference< XInterface > xIface( xListener, UNO_QUERY );
maListenerContainer.addInterface( xIface );
maContainerListeners.addInterface( xIface );
}
void SAL_CALL NameContainer::removeContainerListener( const Reference< XContainerListener >& xListener )
@ -301,7 +309,26 @@ void SAL_CALL NameContainer::removeContainerListener( const Reference< XContaine
if( !xListener.is() )
throw RuntimeException();
Reference< XInterface > xIface( xListener, UNO_QUERY );
maListenerContainer.removeInterface( xIface );
maContainerListeners.removeInterface( xIface );
}
// Methods XChangesNotifier
void SAL_CALL NameContainer::addChangesListener( const Reference< XChangesListener >& xListener )
throw (RuntimeException)
{
if( !xListener.is() )
throw RuntimeException();
Reference< XInterface > xIface( xListener, UNO_QUERY );
maChangesListeners.addInterface( xIface );
}
void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesListener >& xListener )
throw (RuntimeException)
{
if( !xListener.is() )
throw RuntimeException();
Reference< XInterface > xIface( xListener, UNO_QUERY );
maChangesListeners.removeInterface( xIface );
}
//============================================================================
@ -322,12 +349,28 @@ void ModifiableHelper::setModified( sal_Bool _bModified )
//============================================================================
VBAScriptListenerContainer::VBAScriptListenerContainer( ::osl::Mutex& rMutex ) :
VBAScriptListenerContainer_BASE( rMutex )
{
}
bool VBAScriptListenerContainer::implTypedNotify( const Reference< vba::XVBAScriptListener >& rxListener, const vba::VBAScriptEvent& rEvent ) throw (Exception)
{
rxListener->notifyVBAScriptEvent( rEvent );
return true; // notify all other listeners too
}
//============================================================================
// Implementation class SfxLibraryContainer
DBG_NAME( SfxLibraryContainer )
// Ctor
SfxLibraryContainer::SfxLibraryContainer( void )
: LibraryContainerHelper( maMutex )
: SfxLibraryContainer_BASE( maMutex )
, maVBAScriptListeners( maMutex )
, mnRunningVBAScripts( 0 )
, mbVBACompat( sal_False )
, maModifiable( *this, maMutex )
, maNameContainer( getCppuType( (Reference< XNameAccess >*) NULL ) )
@ -2628,6 +2671,9 @@ void SfxLibraryContainer::_disposing( const EventObject& _rSource )
// OComponentHelper
void SAL_CALL SfxLibraryContainer::disposing()
{
Reference< XModel > xModel = mxOwnerDocument;
EventObject aEvent( xModel.get() );
maVBAScriptListeners.disposing( aEvent );
stopAllComponentListening();
mxOwnerDocument = WeakReference< XModel >();
}
@ -2817,7 +2863,7 @@ void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompa
*/
if( mbVBACompat ) try
{
Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref
Reference< XModel > xModel( mxOwnerDocument ); // weak-ref -> ref
Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW );
xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) );
}
@ -2839,6 +2885,43 @@ void SAL_CALL SfxLibraryContainer::setProjectName( const ::rtl::OUString& _proje
pBasMgr->SetName( msProjectName );
}
sal_Int32 SAL_CALL SfxLibraryContainer::getRunningVBAScripts() throw (RuntimeException)
{
LibraryContainerMethodGuard aGuard( *this );
return mnRunningVBAScripts;
}
void SAL_CALL SfxLibraryContainer::addVBAScriptListener( const Reference< vba::XVBAScriptListener >& rxListener ) throw (RuntimeException)
{
maVBAScriptListeners.addTypedListener( rxListener );
}
void SAL_CALL SfxLibraryContainer::removeVBAScriptListener( const Reference< vba::XVBAScriptListener >& rxListener ) throw (RuntimeException)
{
maVBAScriptListeners.removeTypedListener( rxListener );
}
void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifier, const ::rtl::OUString& rModuleName ) throw (RuntimeException)
{
// own lock for accessing the number of running scripts
enterMethod();
switch( nIdentifier )
{
case vba::VBAScriptEventId::SCRIPT_STARTED:
++mnRunningVBAScripts;
break;
case vba::VBAScriptEventId::SCRIPT_STOPPED:
--mnRunningVBAScripts;
break;
}
leaveMethod();
Reference< XModel > xModel = mxOwnerDocument; // weak-ref -> ref
Reference< XInterface > xSender( xModel, UNO_QUERY_THROW );
vba::VBAScriptEvent aEvent( xSender, nIdentifier, rModuleName );
maVBAScriptListeners.notify( aEvent );
}
// Methods XServiceInfo
::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName )
throw (RuntimeException)
@ -2919,11 +3002,14 @@ Any SAL_CALL SfxLibrary::queryInterface( const Type& rType )
{
Any aRet;
aRet = Any( ::cppu::queryInterface( rType,
static_cast< XContainer * >( this ),
static_cast< XNameContainer * >( this ),
static_cast< XNameAccess * >( this ) ) );
aRet = Any(
::cppu::queryInterface(
rType,
static_cast< XContainer * >( this ),
static_cast< XNameContainer * >( this ),
static_cast< XNameAccess * >( this ),
static_cast< XElementAccess * >( this ),
static_cast< XChangesNotifier * >( this ) ) );
if( !aRet.hasValue() )
aRet = OComponentHelper::queryInterface( rType );
return aRet;
@ -3064,6 +3150,7 @@ Sequence< Type > SfxLibrary::getTypes()
static OTypeCollection s_aTypes_NameContainer(
::getCppuType( (const Reference< XNameContainer > *)0 ),
::getCppuType( (const Reference< XContainer > *)0 ),
::getCppuType( (const Reference< XChangesNotifier > *)0 ),
OComponentHelper::getTypes() );
s_pTypes_NameContainer = &s_aTypes_NameContainer;
}
@ -3091,9 +3178,6 @@ Sequence< sal_Int8 > SfxLibrary::getImplementationId()
}
}
//============================================================================
// Methods XContainer
void SAL_CALL SfxLibrary::addContainerListener( const Reference< XContainerListener >& xListener )
throw (RuntimeException)
@ -3108,6 +3192,19 @@ void SAL_CALL SfxLibrary::removeContainerListener( const Reference< XContainerLi
maNameContainer.removeContainerListener( xListener );
}
// Methods XChangesNotifier
void SAL_CALL SfxLibrary::addChangesListener( const Reference< XChangesListener >& xListener )
throw (RuntimeException)
{
maNameContainer.setEventSource( static_cast< XInterface* >( (OWeakObject*)this ) );
maNameContainer.addChangesListener( xListener );
}
void SAL_CALL SfxLibrary::removeChangesListener( const Reference< XChangesListener >& xListener )
throw (RuntimeException)
{
maNameContainer.removeChangesListener( xListener );
}
//============================================================================
// Implementation class ScriptExtensionIterator

View File

@ -64,6 +64,9 @@ SHL1STDLIBS= \
$(SOTLIB) \
$(XMLSCRIPTLIB)
# Uncomment the following line if DBG_TRACE_PROFILING is active in source/inc/sbtrace.hxx
# SHL1STDLIBS+=$(CANVASTOOLSLIB)
.IF "$(GUI)"=="WNT"
SHL1STDLIBS+= \
$(UWINAPILIB) \

View File

@ -105,6 +105,12 @@ namespace dbtools
::rtl::OUString* _pErrorMessage = NULL
) const;
::rtl::OUString getPredicateValue(
const ::rtl::OUString& _sField
, const ::rtl::OUString& _rPredicateValue
, sal_Bool _bForStatementUse
, ::rtl::OUString* _pErrorMessage = NULL) const;
private:
::connectivity::OSQLParseNode* implPredicateTree(
::rtl::OUString& _rErrorMessage,
@ -117,6 +123,8 @@ namespace dbtools
sal_Unicode& _rDecSep,
sal_Unicode& _rThdSep
) const;
::rtl::OUString implParseNode(::connectivity::OSQLParseNode* pParseNode,sal_Bool _bForStatementUse) const;
};
//.........................................................................

View File

@ -66,6 +66,8 @@ namespace rtl
{
class OUStringBuffer;
}
#define ORDER_BY_CHILD_POS 5
#define TABLE_EXPRESSION_CHILD_COUNT 9
namespace connectivity
{

View File

@ -224,6 +224,7 @@ public class CRMDatabase
// --------------------------------------------------------------------------------------------------------
private void validateUnparseable()
{
/*
// The "unparseable" query should be indeed be unparseable by OOo (though a valid HSQL query)
XSingleSelectQueryComposer composer;
QueryDefinition unparseableQuery;
@ -253,6 +254,7 @@ public class CRMDatabase
if ( !caughtExpected )
throw new RuntimeException( "Somebody improved the parser! This is bad :), since we need an unparsable query here!" );
*/
}
// --------------------------------------------------------------------------------------------------------
@ -284,9 +286,10 @@ public class CRMDatabase
m_database.getDataSource().createQuery( "parseable", "SELECT * FROM \"customers\"" );
m_database.getDataSource().createQuery( "parseable native", "SELECT * FROM INFORMATION_SCHEMA.SYSTEM_VIEWS", false );
/*
m_database.getDataSource().createQuery( "unparseable",
"SELECT {fn DAYOFMONTH ('2001-01-01')} AS \"ID_VARCHAR\" FROM \"products\"", false );
*/
validateUnparseable();
}
}

View File

@ -35,9 +35,16 @@ PACKAGE = complex/connectivity
#----- compile .java files -----------------------------------------
JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar hsqldb.jar
JAVAFILES := $(shell @$(FIND) complex -name "*.java")
JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
.IF "$(SYSTEM_HSQLDB)" == "YES"
EXTRAJARFILES = $(HSQLDB_JAR)
.ELSE
JARFILES += hsqldb.jar
.ENDIF
#----- make a jar from compiled files ------------------------------
JARCLASSDIRS = $(PACKAGE)

View File

@ -788,12 +788,30 @@ sal_Bool operator==(const DateTime& _rLH,const DateTime& _rRH)
bool ORowSetValue::operator==(const ORowSetValue& _rRH) const
{
if(m_eTypeKind != _rRH.m_eTypeKind)
return false;
if ( m_bSigned != _rRH.m_bSigned )
return false;
if(m_bNull != _rRH.isNull())
if ( m_eTypeKind != _rRH.m_eTypeKind )
{
switch(m_eTypeKind)
{
case DataType::FLOAT:
case DataType::DOUBLE:
case DataType::REAL:
return getDouble() == _rRH.getDouble();
default:
switch(_rRH.m_eTypeKind)
{
case DataType::FLOAT:
case DataType::DOUBLE:
case DataType::REAL:
return getDouble() == _rRH.getDouble();
default:
break;
}
break;
}
return false;
}
if ( m_bNull != _rRH.isNull() )
return false;
if(m_bNull && _rRH.isNull())
return true;
@ -803,16 +821,28 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const
{
case DataType::VARCHAR:
case DataType::CHAR:
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::LONGVARCHAR:
{
::rtl::OUString aVal1(m_aValue.m_pString);
::rtl::OUString aVal2(_rRH.m_aValue.m_pString);
bRet = aVal1 == aVal2;
break;
return aVal1 == aVal2;
}
default:
if ( m_bSigned != _rRH.m_bSigned )
return false;
break;
}
switch(m_eTypeKind)
{
case DataType::DECIMAL:
case DataType::NUMERIC:
{
::rtl::OUString aVal1(m_aValue.m_pString);
::rtl::OUString aVal2(_rRH.m_aValue.m_pString);
bRet = aVal1 == aVal2;
}
break;
case DataType::FLOAT:
bRet = *(float*)m_aValue.m_pValue == *(float*)_rRH.m_aValue.m_pValue;
break;

View File

@ -32,8 +32,10 @@
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <osl/diagnose.h>
#include <connectivity/sqlnode.hxx>
#include <connectivity/PColumn.hxx>
#include <comphelper/numbers.hxx>
//.........................................................................
@ -326,63 +328,116 @@ namespace dbtools
::rtl::OUString sError;
OSQLParseNode* pParseNode = implPredicateTree( sError, sValue, _rxField );
if ( _pErrorMessage ) *_pErrorMessage = sError;
if ( _pErrorMessage )
*_pErrorMessage = sError;
if ( pParseNode )
sReturn = implParseNode(pParseNode,_bForStatementUse);
}
return sReturn;
}
::rtl::OUString OPredicateInputController::getPredicateValue(
const ::rtl::OUString& _sField, const ::rtl::OUString& _rPredicateValue, sal_Bool _bForStatementUse, ::rtl::OUString* _pErrorMessage ) const
{
::rtl::OUString sReturn = _rPredicateValue;
::rtl::OUString sError;
::rtl::OUString sField = _sField;
sal_Int32 nIndex = 0;
sField = sField.getToken(0,'(',nIndex);
if(nIndex == -1)
sField = _sField;
sal_Int32 nType = ::connectivity::OSQLParser::getFunctionReturnType(sField,&m_aParser.getContext());
if ( nType == DataType::OTHER || !sField.getLength() )
{
// first try the international version
::rtl::OUString sSql;
sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT * "));
sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM x WHERE "));
sSql += sField;
sSql += _rPredicateValue;
::std::auto_ptr<OSQLParseNode> pParseNode( const_cast< OSQLParser& >( m_aParser ).parseTree( sError, sSql, sal_True ) );
nType = DataType::DOUBLE;
if ( pParseNode.get() )
{
OSQLParseNode* pOdbcSpec = pParseNode->getByRule( OSQLParseNode::odbc_fct_spec );
if ( pOdbcSpec )
OSQLParseNode* pColumnRef = pParseNode->getByRule(OSQLParseNode::column_ref);
if ( pColumnRef )
{
if ( !_bForStatementUse )
{
if ( ( pOdbcSpec->count() >= 2 )
&& ( SQL_NODE_STRING == pOdbcSpec->getChild(1)->getNodeType() )
)
{
}
}
}
sReturn = pOdbcSpec->getChild(1)->getTokenValue();
}
else
OSL_FAIL( "OPredicateInputController::getPredicateValue: unknown/invalid structure (odbc + param use)!" );
}
else
{
OSQLParseNode* pFuncSpecParent = pOdbcSpec->getParent();
OSL_ENSURE( pFuncSpecParent, "OPredicateInputController::getPredicateValue: an ODBC func spec node without parent?" );
if ( pFuncSpecParent )
pFuncSpecParent->parseNodeToStr(
sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True
);
}
Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
parse::OParseColumn* pColumn = new parse::OParseColumn( sField,
::rtl::OUString(),
::rtl::OUString(),
::rtl::OUString(),
ColumnValue::NULLABLE_UNKNOWN,
0,
0,
nType,
sal_False,
sal_False,
xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
Reference<XPropertySet> xColumn = pColumn;
pColumn->setFunction(sal_True);
pColumn->setRealName(sField);
OSQLParseNode* pParseNode = implPredicateTree( sError, _rPredicateValue, xColumn );
if ( _pErrorMessage )
*_pErrorMessage = sError;
return pParseNode ? implParseNode(pParseNode,_bForStatementUse) : sReturn;
}
::rtl::OUString OPredicateInputController::implParseNode(OSQLParseNode* pParseNode,sal_Bool _bForStatementUse) const
{
::rtl::OUString sReturn;
if ( pParseNode )
{
::std::auto_ptr<OSQLParseNode> pTemp(pParseNode);
OSQLParseNode* pOdbcSpec = pParseNode->getByRule( OSQLParseNode::odbc_fct_spec );
if ( pOdbcSpec )
{
if ( _bForStatementUse )
{
OSQLParseNode* pFuncSpecParent = pOdbcSpec->getParent();
OSL_ENSURE( pFuncSpecParent, "OPredicateInputController::getPredicateValue: an ODBC func spec node without parent?" );
if ( pFuncSpecParent )
pFuncSpecParent->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True);
}
else
{
if ( pParseNode->count() >= 3 )
OSQLParseNode* pValueNode = pOdbcSpec->getChild(1);
if ( SQL_NODE_STRING == pValueNode->getNodeType() )
sReturn = pValueNode->getTokenValue();
else
pValueNode->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True);
}
}
else
{
if ( pParseNode->count() >= 3 )
{
OSQLParseNode* pValueNode = pParseNode->getChild(2);
OSL_ENSURE( pValueNode, "OPredicateInputController::getPredicateValue: invalid node child!" );
if ( !_bForStatementUse )
{
OSQLParseNode* pValueNode = pParseNode->getChild(2);
OSL_ENSURE( pValueNode, "OPredicateInputController::getPredicateValue: invalid node child!" );
if ( !_bForStatementUse )
{
if ( SQL_NODE_STRING == pValueNode->getNodeType() )
sReturn = pValueNode->getTokenValue();
else
pValueNode->parseNodeToStr(
sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True
);
}
if ( SQL_NODE_STRING == pValueNode->getNodeType() )
sReturn = pValueNode->getTokenValue();
else
pValueNode->parseNodeToStr(
sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True
);
}
else
OSL_FAIL( "OPredicateInputController::getPredicateValue: unknown/invalid structure (noodbc)!" );
pValueNode->parseNodeToStr(
sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True
);
}
delete pParseNode;
else
OSL_FAIL( "OPredicateInputController::getPredicateValue: unknown/invalid structure (noodbc)!" );
}
}
return sReturn;
}
//.........................................................................

View File

@ -168,7 +168,8 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r
{
sal_Int32 nVal=0;
rValue >>= nVal;
m_aColumn.put_NumericScale((sal_Int8)nVal);
if ( !m_IsCurrency )
m_aColumn.put_NumericScale((sal_Int8)nVal);
}
break;
case PROPERTY_ID_ISNULLABLE:
@ -215,6 +216,8 @@ void OAdoColumn::fillPropertyValues()
DataTypeEnum eType = m_aColumn.get_Type();
m_IsCurrency = (eType == adCurrency);
if ( m_IsCurrency && !m_Scale)
m_Scale = 4;
m_Type = ADOS::MapADOType2Jdbc(eType);
sal_Bool bForceTo = sal_True;

View File

@ -469,6 +469,11 @@ void OConnection::buildTypeInfo() throw( SQLException)
aInfo->aSimpleType.aLocalTypeName = ADOS::getField(pRecordset,nPos++).get_Value();
aInfo->aSimpleType.nMinimumScale = ADOS::getField(pRecordset,nPos++).get_Value();
aInfo->aSimpleType.nMaximumScale = ADOS::getField(pRecordset,nPos++).get_Value();
if ( adCurrency == aInfo->eType && !aInfo->aSimpleType.nMaximumScale)
{
aInfo->aSimpleType.nMinimumScale = 4;
aInfo->aSimpleType.nMaximumScale = 4;
}
aInfo->aSimpleType.nNumPrecRadix = ADOS::getField(pRecordset,nPos++).get_Value();
// Now that we have the type info, save it
// in the Hashtable if we don't already have an

View File

@ -401,7 +401,7 @@ void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
if(first())
previous();
m_bOnFirstAfterOpen = !previous();
}
// -------------------------------------------------------------------------
void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)

View File

@ -117,6 +117,11 @@
<value>true</value>
</prop>
</node>
<node oor:name="RespectDriverResultSetType" oor:op="replace">
<prop oor:name="Value" oor:type="xs:boolean">
<value>true</value>
</prop>
</node>
</node>
<node oor:name="MetaData">
<node oor:name="SupportsTableCreation" oor:op="replace">

View File

@ -225,7 +225,7 @@ void ODbaseTable::AllocBuffer()
}
// If no buffer available: allocate
if (m_pBuffer == NULL && nSize)
if (m_pBuffer == NULL && nSize > 0)
{
m_nBufferSize = nSize;
m_pBuffer = new sal_uInt8[m_nBufferSize+1];
@ -484,11 +484,14 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r
sal_uIntPtr nTell = rStream.Tell() % 512;
sal_uInt16 nBufferSize = rStream.GetBufferSize();
sal_uIntPtr nSize = nBufferSize - nTell;
char* pEmptyData = new char[nSize];
memset(pEmptyData,0x00,nSize);
rStream.Write((sal_uInt8*)pEmptyData,nSize);
rStream.Seek(nTell);
delete [] pEmptyData;
if ( nSize <= nBufferSize )
{
char* pEmptyData = new char[nSize];
memset(pEmptyData,0x00,nSize);
rStream.Write((sal_uInt8*)pEmptyData,nSize);
rStream.Seek(nTell);
delete [] pEmptyData;
}
}
return rStream;
}

View File

@ -2775,7 +2775,7 @@ void ODbaseTable::AllocBuffer()
}
// if there is no buffer available: allocate:
if (m_pBuffer == NULL && nSize)
if (m_pBuffer == NULL && nSize > 0)
{
m_nBufferSize = nSize;
m_pBuffer = new sal_uInt8[m_nBufferSize+1];

View File

@ -883,11 +883,14 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r
sal_uIntPtr nTell = rStream.Tell() % PAGE_SIZE;
sal_uInt16 nBufferSize = rStream.GetBufferSize();
sal_uIntPtr nRemainSize = nBufferSize - nTell;
char* pEmptyData = new char[nRemainSize];
memset(pEmptyData,0x00,nRemainSize);
rStream.Write((sal_uInt8*)pEmptyData,nRemainSize);
rStream.Seek(nTell);
delete [] pEmptyData;
if ( nRemainSize <= nBufferSize )
{
char* pEmptyData = new char[nRemainSize];
memset(pEmptyData,0x00,nRemainSize);
rStream.Write((sal_uInt8*)pEmptyData,nRemainSize);
rStream.Seek(nTell);
delete [] pEmptyData;
}
}
return rStream;
}

View File

@ -97,7 +97,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode)
OSQLParseNode * pTableExp = pSQLParseNode->getChild(3);
DBG_ASSERT(pTableExp != NULL,"Fehler im Parse Tree");
DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp)," Fehler im Parse Tree");
DBG_ASSERT(pTableExp->count() == 5,"Fehler im Parse Tree");
DBG_ASSERT(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"Fehler im Parse Tree");
// check that we don't use anything other than count(*) as function
OSQLParseNode* pSelection = pSQLParseNode->getChild(2);
@ -115,7 +115,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode)
pWhereClause = pTableExp->getChild(1);
pOrderbyClause = pTableExp->getChild(4);
pOrderbyClause = pTableExp->getChild(ORDER_BY_CHILD_POS);
(void)pOrderbyClause;
}
else if (SQL_ISRULE(pSQLParseNode,update_statement_searched))
@ -295,10 +295,19 @@ OOperand* OPredicateCompiler::execute_LIKE(OSQLParseNode* pPredicateNode) throw(
OSQLParseNode* pAtom = pPart2->getChild(pPart2->count()-2);
OSQLParseNode* pOptEscape = pPart2->getChild(pPart2->count()-1);
if (!(pAtom->getNodeType() == SQL_NODE_STRING || SQL_ISRULE(pAtom,parameter)))
if (!(pAtom->getNodeType() == SQL_NODE_STRING ||
SQL_ISRULE(pAtom,parameter) ||
// odbc date
SQL_ISRULE(pAtom,set_fct_spec) ||
SQL_ISRULE(pAtom,position_exp) ||
SQL_ISRULE(pAtom,char_substring_fct) ||
// upper, lower etc.
SQL_ISRULE(pAtom,fold)) )
{
m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,NULL);
m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,NULL);
return NULL;
}
if (pOptEscape->count() != 0)
{
if (pOptEscape->count() != 2)

View File

@ -160,7 +160,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
}
++nRowCount;
}
while(nRowCount < nMaxRowsToScan && m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding));
while(nRowCount < nMaxRowsToScan && m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding) && !m_pFileStream->IsEof());
for (xub_StrLen i = 0; i < nFieldCount; i++)
{
@ -495,7 +495,8 @@ String OFlatTable::getEntry()
// name and extension have to coincide
if ( m_pConnection->matchesExtension( sExt ) )
{
sName = sName.replaceAt(sName.getLength()-(sExt.getLength()+1),sExt.getLength()+1,::rtl::OUString());
if ( sExt.getLength() )
sName = sName.replaceAt(sName.getLength()-(sExt.getLength()+1),sExt.getLength()+1,::rtl::OUString());
if ( sName == m_Name )
{
Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY );

View File

@ -44,6 +44,7 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/util/XFlushable.hpp>
#include "HTerminateListener.hxx"
#include "hsqldb/HCatalog.hxx"
#include "diagnose_ex.h"
@ -73,6 +74,7 @@ namespace connectivity
using namespace ::com::sun::star::embed;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::reflection;
namespace hsqldb
@ -619,6 +621,22 @@ namespace connectivity
m_bInShutDownConnections = sal_True;
}
//------------------------------------------------------------------
void ODriverDelegator::flushConnections()
{
TWeakPairVector::iterator aEnd = m_aConnections.end();
for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i)
{
try
{
Reference<XFlushable> xCon(i->second.second.first.get(),UNO_QUERY);
xCon->flush();
}
catch(Exception&)
{
}
}
}
//------------------------------------------------------------------
void SAL_CALL ODriverDelegator::preCommit( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
::osl::MutexGuard aGuard(m_aMutex);

View File

@ -52,6 +52,7 @@ throw( RuntimeException )
void SAL_CALL OConnectionController::queryTermination( const EventObject& /*aEvent*/ )
throw( TerminationVetoException, RuntimeException )
{
m_pDriver->flushConnections();
}
void SAL_CALL OConnectionController::notifyTermination( const EventObject& /*aEvent*/ )

View File

@ -823,7 +823,7 @@ sal_Bool java_sql_Connection::construct(const ::rtl::OUString& url,
static const char * cSignature = "(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;";
static const char * cMethodName = "connect";
// Java-Call
static jmethodID mID = NULL;
jmethodID mID = NULL;
if ( !mID )
mID = t.pEnv->GetMethodID( m_Driver_theClass, cMethodName, cSignature );
if ( mID )

View File

@ -147,6 +147,11 @@
<value>true</value>
</prop>
</node>
<node oor:name="RespectDriverResultSetType" oor:op="replace">
<prop oor:name="Value" oor:type="xs:boolean">
<value>true</value>
</prop>
</node>
</node>
<node oor:name="MetaData">
<node oor:name="SupportsTableCreation" oor:op="replace">

View File

@ -152,6 +152,7 @@ java_util_Properties* connectivity::createStringPropertyArray(const Sequence< Pr
&& pBegin->Name.compareToAscii( "Authentication" )
&& pBegin->Name.compareToAscii( "PreferDosLikeLineEnds" )
&& pBegin->Name.compareToAscii( "PrimaryKeySupport" )
&& pBegin->Name.compareToAscii( "RespectDriverResultSetType" )
)
{
::rtl::OUString aStr;

View File

@ -203,7 +203,7 @@ sal_Int32 MacabRecord::compareFields(const macabfield *_field1, const macabfield
result = CFStringCompare(
(CFStringRef) _field1->value,
(CFStringRef) _field2->value,
0); // 0 = no options (like ignore case)
kCFCompareLocalized); // Specifies that the comparison should take into account differences related to locale, such as the thousands separator character.
break;
case kABDateProperty:

View File

@ -152,6 +152,11 @@
<value>true</value>
</prop>
</node>
<node oor:name="RespectDriverResultSetType" oor:op="replace">
<prop oor:name="Value" oor:type="xs:boolean">
<value>true</value>
</prop>
</node>
</node>
<node oor:name="MetaData">
<node oor:name="SupportsTableCreation" oor:op="replace">

View File

@ -979,7 +979,8 @@ void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, cons
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding);
aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding);
aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding);
@ -1013,7 +1014,8 @@ void ODatabaseMetaDataResultSet::openColumns( const Any& catalog,
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding);
aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding);
@ -1081,7 +1083,8 @@ void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog,
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding);
aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding);
@ -1116,7 +1119,8 @@ void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const ::rtl:
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding);
@ -1146,6 +1150,7 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(sal_Bool _bRowVer,const Any&
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding);
aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding);
@ -1236,7 +1241,8 @@ void ODatabaseMetaDataResultSet::openPrimaryKeys(const Any& catalog, const ::rtl
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding);
const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
@ -1265,7 +1271,8 @@ void ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const :
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN;
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
@ -1295,7 +1302,8 @@ void ODatabaseMetaDataResultSet::openIndexInfo( const Any& catalog, const ::rtl:
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN;
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding);
const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,

View File

@ -1368,15 +1368,24 @@ sal_Bool OResultSet::isBookmarkable() const
//------------------------------------------------------------------------------
void OResultSet::setFetchDirection(sal_Int32 _par0)
{
N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
OSL_ENSURE(_par0>0,"Illegal fetch direction!");
if ( _par0 > 0 )
{
N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
}
}
//------------------------------------------------------------------------------
void OResultSet::setFetchSize(sal_Int32 _par0)
{
N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
delete m_pRowStatusArray;
m_pRowStatusArray = new SQLUSMALLINT[_par0];
N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
OSL_ENSURE(_par0>0,"Illegal fetch size!");
if ( _par0 > 0 )
{
N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
delete m_pRowStatusArray;
m_pRowStatusArray = new SQLUSMALLINT[_par0];
N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
}
}
// -------------------------------------------------------------------------
IPropertyArrayHelper* OResultSet::createArrayHelper( ) const

View File

@ -61,7 +61,11 @@ OResultSetMetaData::~OResultSetMetaData()
);
::rtl::OUString sValue;
if ( nRet == SQL_SUCCESS )
{
if ( nRealLen < 0 )
nRealLen = BUFFER_LEN;
sValue = ::rtl::OUString(pName,nRealLen,m_pConnection->getTextEncoding());
}
delete [] pName;
OTools::ThrowException(m_pConnection,nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
if(nRealLen > BUFFER_LEN)
@ -75,7 +79,7 @@ OResultSetMetaData::~OResultSetMetaData()
&nRealLen,
NULL
);
if ( nRet == SQL_SUCCESS )
if ( nRet == SQL_SUCCESS && nRealLen > 0)
sValue = ::rtl::OUString(pName,nRealLen,m_pConnection->getTextEncoding());
delete [] pName;
OTools::ThrowException(m_pConnection,nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);

View File

@ -877,13 +877,15 @@ void OStatement_Base::setFetchDirection(sal_Int32 _par0)
void OStatement_Base::setFetchSize(sal_Int32 _par0)
{
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
OSL_ENSURE(_par0>0,"Illegal fetch size!");
if ( _par0 > 0 )
{
SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
delete m_pRowStatusArray;
m_pRowStatusArray = new SQLUSMALLINT[_par0];
nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
OSL_UNUSED( nRetCode );
delete m_pRowStatusArray;
m_pRowStatusArray = new SQLUSMALLINT[_par0];
nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
}
}
//------------------------------------------------------------------------------
void OStatement_Base::setMaxFieldSize(sal_Int32 _par0)

View File

@ -124,6 +124,7 @@ namespace connectivity
virtual void SAL_CALL reverted( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
void shutdownConnections();
void flushConnections();
protected:
/// dtor
virtual ~ODriverDelegator();

View File

@ -156,13 +156,15 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe
_rxResMetaData->isCurrency( _nColumnPos ),
_rxDBMetaData->supportsMixedCaseQuotedIdentifiers()
);
pColumn->setTableName( ::dbtools::composeTableName( _rxDBMetaData,
_rxResMetaData->getCatalogName( _nColumnPos ),
_rxResMetaData->getSchemaName( _nColumnPos ),
_rxResMetaData->getTableName( _nColumnPos ),
sal_False,
eComplete
) );
const ::rtl::OUString sTableName = _rxResMetaData->getTableName( _nColumnPos );
if ( sTableName.getLength() )
pColumn->setTableName( ::dbtools::composeTableName( _rxDBMetaData,
_rxResMetaData->getCatalogName( _nColumnPos ),
_rxResMetaData->getSchemaName( _nColumnPos ),
sTableName,
sal_False,
eComplete
) );
pColumn->setIsSearchable( _rxResMetaData->isSearchable( _nColumnPos ) );
pColumn->setRealName(_rxResMetaData->getColumnName( _nColumnPos ));
pColumn->setLabel(sLabel);

View File

@ -218,6 +218,14 @@ using namespace connectivity;
%token <pParseNode> SQL_TOKEN_VALUE SQL_TOKEN_CURRENT_CATALOG SQL_TOKEN_CURRENT_DEFAULT_TRANSFORM_GROUP SQL_TOKEN_CURRENT_PATH SQL_TOKEN_CURRENT_ROLE SQL_TOKEN_CURRENT_SCHEMA SQL_TOKEN_CURRENT_USER
%token <pParseNode> SQL_TOKEN_SESSION_USER SQL_TOKEN_SYSTEM_USER SQL_TOKEN_VARCHAR SQL_TOKEN_VARBINARY SQL_TOKEN_VARYING SQL_TOKEN_OBJECT SQL_TOKEN_NCLOB SQL_TOKEN_NATIONAL
%token <pParseNode> SQL_TOKEN_LARGE SQL_TOKEN_CLOB SQL_TOKEN_BLOB SQL_TOKEN_BIGINT SQL_TOKEN_BINARY SQL_TOKEN_WITHOUT SQL_TOKEN_BOOLEAN SQL_TOKEN_INTERVAL
// window function
%token <pParseNode> SQL_TOKEN_OVER SQL_TOKEN_ROW_NUMBER SQL_TOKEN_NTILE SQL_TOKEN_LEAD SQL_TOKEN_LAG SQL_TOKEN_RESPECT SQL_TOKEN_IGNORE SQL_TOKEN_NULLS
%token <pParseNode> SQL_TOKEN_FIRST_VALUE SQL_TOKEN_LAST_VALUE SQL_TOKEN_NTH_VALUE SQL_TOKEN_FIRST SQL_TOKEN_LAST
%token <pParseNode> SQL_TOKEN_EXCLUDE SQL_TOKEN_OTHERS SQL_TOKEN_TIES SQL_TOKEN_FOLLOWING SQL_TOKEN_UNBOUNDED SQL_TOKEN_PRECEDING SQL_TOKEN_RANGE SQL_TOKEN_ROWS
%token <pParseNode> SQL_TOKEN_PARTITION SQL_TOKEN_WINDOW SQL_TOKEN_NO
// LIMIT and OFFSEt
%token <pParseNode> SQL_TOKEN_LIMIT SQL_TOKEN_OFFSET SQL_TOKEN_NEXT SQL_TOKEN_ONLY
/* operators */
%left SQL_TOKEN_NAME
%left <pParseNode> SQL_TOKEN_OR
@ -272,7 +280,7 @@ using namespace connectivity;
%type <pParseNode> form_conversion char_translation trim_fct trim_operands trim_spec bit_value_fct bit_substring_fct op_column_commalist
%type <pParseNode> /*bit_concatenation*/ bit_value_exp bit_factor bit_primary collate_clause char_value_fct unique_spec value_exp_commalist in_predicate_value unique_test update_source
%type <pParseNode> function_arg_commalist3 string_function_3Argument function_arg_commalist4 string_function_4Argument function_arg_commalist2 string_function_1Argument string_function_2Argument
%type <pParseNode> date_function_0Argument date_function_1Argument function_name12 function_name23 function_name1 function_name2 function_name3 function_name0 numeric_function_0Argument numeric_function_1Argument numeric_function_2Argument date_function_3Argument
%type <pParseNode> date_function_0Argument date_function_1Argument function_name12 function_name23 function_name1 function_name2 function_name3 function_name0 numeric_function_0Argument numeric_function_1Argument numeric_function_2Argument
%type <pParseNode> all query_primary sql_not for_length upper_lower comparison column_val cross_union /*opt_schema_element_list*/
%type <pParseNode> /*op_authorization op_schema*/ nil_fkt schema_element base_table_def base_table_element base_table_element_commalist
%type <pParseNode> column_def odbc_fct_spec odbc_call_spec odbc_fct_type op_parameter union_statement
@ -287,6 +295,16 @@ using namespace connectivity;
%type <pParseNode> binary_string_type numeric_type boolean_type datetime_type interval_type opt_paren_precision paren_char_length opt_paren_char_large_length paren_character_large_object_length
%type <pParseNode> large_object_length opt_multiplier character_large_object_type national_character_large_object_type binary_large_object_string_type opt_with_or_without_time_zone
%type <pParseNode> approximate_numeric_type exact_numeric_type opt_paren_precision_scale
/* window function rules */
%type <pParseNode> window_function window_function_type ntile_function number_of_tiles lead_or_lag_function lead_or_lag lead_or_lag_extent offset default_expression null_treatment
%type <pParseNode> first_or_last_value_function first_or_last_value nth_value_function nth_row from_first_or_last window_name_or_specification in_line_window_specification opt_lead_or_lag_function
%type <pParseNode> opt_null_treatment opt_from_first_or_last simple_value_specification dynamic_parameter_specification window_name window_clause window_definition_list window_definition
%type <pParseNode> new_window_name window_specification_details existing_window_name window_partition_clause window_partition_column_reference_list window_partition_column_reference window_frame_clause
%type <pParseNode> window_frame_units window_frame_extent window_frame_start window_frame_preceding window_frame_between window_frame_bound_1 window_frame_bound_2 window_frame_bound window_frame_following window_frame_exclusion
%type <pParseNode> opt_window_frame_clause opt_window_partition_clause opt_existing_window_name window_specification opt_window_frame_exclusion opt_window_clause opt_offset
%type <pParseNode> opt_fetch_first_row_count fetch_first_clause offset_row_count fetch_first_row_count first_or_next row_or_rows opt_result_offset_clause result_offset_clause
/* LIMIT and OFFSET */
%type <pParseNode> opt_limit_offset_clause limit_offset_clause opt_fetch_first_clause
%%
/* Parse Tree an OSQLParser zurueckliefern
@ -921,19 +939,89 @@ selection:
}
| scalar_exp_commalist
;
opt_result_offset_clause:
/* empty */ {$$ = SQL_NEW_RULE;}
| result_offset_clause
;
result_offset_clause:
SQL_TOKEN_OFFSET offset_row_count row_or_rows
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
}
;
opt_fetch_first_row_count:
/* empty */ {$$ = SQL_NEW_RULE;}
| fetch_first_row_count
;
first_or_next:
SQL_TOKEN_FIRST
| SQL_TOKEN_NEXT
;
row_or_rows:
SQL_TOKEN_ROW
| SQL_TOKEN_ROWS
;
opt_fetch_first_clause:
/* empty */ {$$ = SQL_NEW_RULE;}
| fetch_first_clause
;
fetch_first_clause:
SQL_TOKEN_FETCH first_or_next opt_fetch_first_row_count row_or_rows SQL_TOKEN_ONLY
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
$$->append($4);
$$->append($5);
}
;
offset_row_count:
literal
;
fetch_first_row_count:
literal
;
opt_limit_offset_clause:
/* empty */ {$$ = SQL_NEW_RULE;}
| limit_offset_clause
;
opt_offset:
/* empty */ {$$ = SQL_NEW_RULE;}
| SQL_TOKEN_OFFSET SQL_TOKEN_INTNUM
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
;
limit_offset_clause:
SQL_TOKEN_LIMIT SQL_TOKEN_INTNUM opt_offset
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
}
;
table_exp:
from_clause
opt_where_clause
opt_group_by_clause
opt_having_clause
opt_order_by_clause
{$$ = SQL_NEW_RULE;
from_clause opt_where_clause opt_group_by_clause opt_having_clause opt_window_clause opt_order_by_clause opt_limit_offset_clause opt_result_offset_clause opt_fetch_first_clause
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
$$->append($4);
$$->append($5);}
$$->append($5);
$$->append($6);
$$->append($7);
$$->append($8);
$$->append($9);
}
;
from_clause:
@ -1852,10 +1940,10 @@ function_name12:
;
function_name23:
SQL_TOKEN_LOCATE
| SQL_TOKEN_DATEDIFF
;
function_name3:
string_function_3Argument
| date_function_3Argument
;
function_name:
string_function
@ -1913,8 +2001,6 @@ date_function_1Argument:
| SQL_TOKEN_TIMEVALUE
| SQL_TOKEN_DATEVALUE
;
date_function_3Argument:
SQL_TOKEN_DATEDIFF
date_function:
SQL_TOKEN_TIMESTAMPADD
@ -1952,6 +2038,362 @@ numeric_function:
SQL_TOKEN_RAND
| SQL_TOKEN_TRUNCATE
;
window_function:
window_function_type SQL_TOKEN_OVER window_name_or_specification
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
}
;
window_function_type :
rank_function_type '(' ')'
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
$$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));
}
| SQL_TOKEN_ROW_NUMBER '(' ')'
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
$$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));
}
| general_set_fct
| ntile_function
| lead_or_lag_function
| first_or_last_value_function
| nth_value_function
;
ntile_function :
SQL_TOKEN_NTILE '(' number_of_tiles ')'
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
$$->append($3);
$$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));
}
;
dynamic_parameter_specification:
parameter
;
simple_value_specification:
literal
;
number_of_tiles :
simple_value_specification
| dynamic_parameter_specification
;
opt_lead_or_lag_function:
/* empty */ {$$ = SQL_NEW_RULE;}
| ',' offset
{
$$ = SQL_NEW_RULE;
$$->append($1 = newNode(",", SQL_NODE_PUNCTUATION));
$$->append($2);
}
| ',' offset ',' default_expression
{
$$ = SQL_NEW_RULE;
$$->append($1 = newNode(",", SQL_NODE_PUNCTUATION));
$$->append($2);
$$->append($3 = newNode(",", SQL_NODE_PUNCTUATION));
$$->append($4);
}
;
opt_null_treatment:
/* empty */ {$$ = SQL_NEW_RULE;}
| null_treatment
;
lead_or_lag_function:
lead_or_lag '(' lead_or_lag_extent opt_lead_or_lag_function ')' opt_null_treatment
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
$$->append($3);
$$->append($4);
$$->append($5 = newNode(")", SQL_NODE_PUNCTUATION));
$$->append($6);
}
;
lead_or_lag:
SQL_TOKEN_LEAD
| SQL_TOKEN_LAG
;
lead_or_lag_extent:
value_exp
;
offset:
SQL_TOKEN_INTNUM
;
default_expression:
value_exp
;
null_treatment:
SQL_TOKEN_RESPECT SQL_TOKEN_NULLS
| SQL_TOKEN_IGNORE SQL_TOKEN_NULLS
;
first_or_last_value_function:
first_or_last_value '(' value_exp ')' opt_null_treatment
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
$$->append($3);
$$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));
$$->append($5);
}
;
first_or_last_value :
SQL_TOKEN_FIRST_VALUE
| SQL_TOKEN_LAST_VALUE
;
opt_from_first_or_last:
/* empty */ {$$ = SQL_NEW_RULE;}
| from_first_or_last
;
nth_value_function:
SQL_TOKEN_NTH_VALUE '(' value_exp ',' nth_row ')' opt_from_first_or_last opt_null_treatment
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
$$->append($3);
$$->append($4 = newNode(",", SQL_NODE_PUNCTUATION));
$$->append($5);
$$->append($6 = newNode(")", SQL_NODE_PUNCTUATION));
$$->append($7);
$$->append($8);
}
;
nth_row:
simple_value_specification
| dynamic_parameter_specification
;
from_first_or_last:
SQL_TOKEN_FROM SQL_TOKEN_FIRST
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
| SQL_TOKEN_FROM SQL_TOKEN_LAST
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
;
window_name:
SQL_TOKEN_NAME
;
window_name_or_specification:
window_name
| in_line_window_specification
;
in_line_window_specification:
window_specification
;
opt_window_clause:
/* empty */ {$$ = SQL_NEW_RULE;}
| window_clause
;
window_clause:
SQL_TOKEN_WINDOW window_definition_list
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
;
window_definition_list:
window_definition_list ',' window_definition
{$1->append($3);
$$ = $1;}
| window_definition
{$$ = SQL_NEW_COMMALISTRULE;
$$->append($1);}
;
window_definition:
new_window_name SQL_TOKEN_AS window_specification
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
}
;
new_window_name:
window_name
;
window_specification:
'(' window_specification_details ')'
{
$$ = SQL_NEW_RULE;
$$->append($1 = newNode("(", SQL_NODE_PUNCTUATION));
$$->append($2);
$$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));
}
;
opt_existing_window_name:
/* empty */ {$$ = SQL_NEW_RULE;}
| existing_window_name
;
opt_window_partition_clause:
/* empty */ {$$ = SQL_NEW_RULE;}
| window_partition_clause
;
opt_window_frame_clause:
/* empty */ {$$ = SQL_NEW_RULE;}
| window_frame_clause
;
window_specification_details:
opt_existing_window_name
opt_window_partition_clause
opt_order_by_clause
opt_window_frame_clause
;
existing_window_name:
window_name
;
window_partition_clause:
SQL_TOKEN_PARTITION SQL_TOKEN_BY window_partition_column_reference_list
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
}
;
window_partition_column_reference_list:
window_partition_column_reference_list ',' window_partition_column_reference
{$1->append($3);
$$ = $1;}
| window_partition_column_reference
{$$ = SQL_NEW_COMMALISTRULE;
$$->append($1);}
;
window_partition_column_reference:
column_ref opt_collate_clause
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
;
opt_window_frame_exclusion:
/* empty */ {$$ = SQL_NEW_RULE;}
| window_frame_exclusion
;
window_frame_clause:
window_frame_units window_frame_extent opt_window_frame_exclusion
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
}
;
window_frame_units:
SQL_TOKEN_ROWS
| SQL_TOKEN_RANGE
;
window_frame_extent:
window_frame_start
| window_frame_between
;
window_frame_start:
SQL_TOKEN_UNBOUNDED SQL_TOKEN_PRECEDING
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
| window_frame_preceding
| SQL_TOKEN_CURRENT SQL_TOKEN_ROW
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
;
window_frame_preceding:
unsigned_value_spec SQL_TOKEN_PRECEDING
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
;
window_frame_between:
SQL_TOKEN_BETWEEN window_frame_bound_1 SQL_TOKEN_AND window_frame_bound_2
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
$$->append($4);
}
;
window_frame_bound_1:
window_frame_bound
;
window_frame_bound_2:
window_frame_bound
;
window_frame_bound:
window_frame_start
| SQL_TOKEN_UNBOUNDED SQL_TOKEN_FOLLOWING
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
| window_frame_following
;
window_frame_following:
unsigned_value_spec SQL_TOKEN_FOLLOWING
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
;
window_frame_exclusion:
SQL_TOKEN_EXCLUDE SQL_TOKEN_CURRENT SQL_TOKEN_ROW
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
}
| SQL_TOKEN_EXCLUDE SQL_TOKEN_GROUP
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
| SQL_TOKEN_EXCLUDE SQL_TOKEN_TIES
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
| SQL_TOKEN_EXCLUDE SQL_TOKEN_NO SQL_TOKEN_OTHERS
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
}
;
op_parameter:
{$$ = SQL_NEW_RULE;}
| '?' SQL_EQUAL
@ -2006,11 +2448,16 @@ odbc_fct_spec:
$$->append($1);
$$->append($2);
}
| SQL_TOKEN_FN set_fct_spec
{
$$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
}
;
odbc_fct_type:
SQL_TOKEN_FN
| SQL_TOKEN_D
SQL_TOKEN_D
| SQL_TOKEN_T
| SQL_TOKEN_TS
;
@ -2316,6 +2763,7 @@ value_exp_primary:
| set_fct_spec
| scalar_subquery
| case_expression
| window_function
| '(' value_exp ')'
{
$$ = SQL_NEW_RULE;

View File

@ -212,15 +212,19 @@ END {SQL_NEW_KEYWORD(SQL_TOKEN_END); }
EVERY {SQL_NEW_KEYWORD(SQL_TOKEN_EVERY); }
ESCAPE {SQL_NEW_KEYWORD(SQL_TOKEN_ESCAPE); }
EXCEPT {SQL_NEW_KEYWORD(SQL_TOKEN_EXCEPT); }
EXCLUDE {SQL_NEW_KEYWORD(SQL_TOKEN_EXCLUDE); }
EXISTS {SQL_NEW_KEYWORD(SQL_TOKEN_EXISTS); }
EXP {SQL_NEW_KEYWORD(SQL_TOKEN_EXP); }
EXTRACT {SQL_NEW_KEYWORD(SQL_TOKEN_EXTRACT); }
FALSE {SQL_NEW_KEYWORD(SQL_TOKEN_FALSE); }
FETCH {SQL_NEW_KEYWORD(SQL_TOKEN_FETCH); }
FIRST {SQL_NEW_KEYWORD(SQL_TOKEN_FIRST); }
FIRST_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_FIRST_VALUE); }
FLOAT {SQL_NEW_KEYWORD(SQL_TOKEN_FLOAT); }
FLOOR {SQL_NEW_KEYWORD(SQL_TOKEN_FLOOR); }
FN {SQL_NEW_KEYWORD(SQL_TOKEN_FN); }
FOLLOWING {SQL_NEW_KEYWORD(SQL_TOKEN_FOLLOWING); }
FOR {SQL_NEW_KEYWORD(SQL_TOKEN_FOR); }
FOREIGN {SQL_NEW_KEYWORD(SQL_TOKEN_FOREIGN); }
FOUND {SQL_NEW_KEYWORD(SQL_TOKEN_FOUND); }
@ -234,6 +238,7 @@ GROUP {SQL_NEW_KEYWORD(SQL_TOKEN_GROUP); }
HAVING {SQL_NEW_KEYWORD(SQL_TOKEN_HAVING); }
HOUR {SQL_NEW_KEYWORD(SQL_TOKEN_HOUR); }
IGNORE {SQL_NEW_KEYWORD(SQL_TOKEN_IGNORE); }
IN {SQL_NEW_KEYWORD(SQL_TOKEN_IN); }
INNER {SQL_NEW_KEYWORD(SQL_TOKEN_INNER); }
INSERT {SQL_NEW_KEYWORD(SQL_TOKEN_INSERT); }
@ -249,12 +254,17 @@ JOIN {SQL_NEW_KEYWORD(SQL_TOKEN_JOIN); }
KEY {SQL_NEW_KEYWORD(SQL_TOKEN_KEY); }
LAG {SQL_NEW_KEYWORD(SQL_TOKEN_LAG); }
LARGE {SQL_NEW_KEYWORD(SQL_TOKEN_LARGE); }
LAST {SQL_NEW_KEYWORD(SQL_TOKEN_LAST); }
LAST_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_LAST_VALUE); }
LCASE {SQL_NEW_KEYWORD(SQL_TOKEN_LCASE); }
LEAD {SQL_NEW_KEYWORD(SQL_TOKEN_LEAD); }
LEADING {SQL_NEW_KEYWORD(SQL_TOKEN_LEADING); }
LEFT {SQL_NEW_KEYWORD(SQL_TOKEN_LEFT); }
LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_LENGTH); }
LIKE {SQL_NEW_KEYWORD(SQL_TOKEN_LIKE); }
LIMIT {SQL_NEW_KEYWORD(SQL_TOKEN_LIMIT); }
LN {SQL_NEW_KEYWORD(SQL_TOKEN_LN); }
LOCAL {SQL_NEW_KEYWORD(SQL_TOKEN_LOCAL); }
LOCATE {SQL_NEW_KEYWORD(SQL_TOKEN_LOCATE); }
@ -276,29 +286,40 @@ NATURAL {SQL_NEW_KEYWORD(SQL_TOKEN_NATURAL); }
NCHAR {SQL_NEW_KEYWORD(SQL_TOKEN_NCHAR); }
NCLOB {SQL_NEW_KEYWORD(SQL_TOKEN_NCLOB); }
NEW {SQL_NEW_KEYWORD(SQL_TOKEN_NEW); }
NEXT {SQL_NEW_KEYWORD(SQL_TOKEN_NEXT); }
NO {SQL_NEW_KEYWORD(SQL_TOKEN_NO); }
NOT {SQL_NEW_KEYWORD(SQL_TOKEN_NOT); }
NOW {SQL_NEW_KEYWORD(SQL_TOKEN_NOW); }
NTH_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_NTH_VALUE); }
NTILE {SQL_NEW_KEYWORD(SQL_TOKEN_NTILE); }
NULL {SQL_NEW_KEYWORD(SQL_TOKEN_NULL); }
NULLIF {SQL_NEW_KEYWORD(SQL_TOKEN_NULLIF); }
NULLS {SQL_NEW_KEYWORD(SQL_TOKEN_NULLS); }
NUMERIC {SQL_NEW_KEYWORD(SQL_TOKEN_NUMERIC); }
OBJECT {SQL_NEW_KEYWORD(SQL_TOKEN_OBJECT); }
OCTET_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_OCTET_LENGTH); }
OF {SQL_NEW_KEYWORD(SQL_TOKEN_OF); }
OFFSET {SQL_NEW_KEYWORD(SQL_TOKEN_OFFSET); }
OJ {SQL_NEW_KEYWORD(SQL_TOKEN_OJ); }
OLD {SQL_NEW_KEYWORD(SQL_TOKEN_OLD); }
ON {SQL_NEW_KEYWORD(SQL_TOKEN_ON); }
ONLY {SQL_NEW_KEYWORD(SQL_TOKEN_ONLY); }
OPTION {SQL_NEW_KEYWORD(SQL_TOKEN_OPTION); }
OR {SQL_NEW_KEYWORD(SQL_TOKEN_OR); }
ORDER {SQL_NEW_KEYWORD(SQL_TOKEN_ORDER); }
OTHERS {SQL_NEW_KEYWORD(SQL_TOKEN_OTHERS); }
OUTER {SQL_NEW_KEYWORD(SQL_TOKEN_OUTER); }
OVER {SQL_NEW_KEYWORD(SQL_TOKEN_OVER); }
PARTITION {SQL_NEW_KEYWORD(SQL_TOKEN_PARTITION); }
PERCENT_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENT_RANK); }
PERCENTILE_CONT {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_CONT); }
PERCENTILE_DISC {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_DISC); }
PI {SQL_NEW_KEYWORD(SQL_TOKEN_PI); }
POSITION {SQL_NEW_KEYWORD(SQL_TOKEN_POSITION); }
POWER {SQL_NEW_KEYWORD(SQL_TOKEN_POWER); }
PRECEDING {SQL_NEW_KEYWORD(SQL_TOKEN_PRECEDING); }
PRECISION {SQL_NEW_KEYWORD(SQL_TOKEN_PRECISION); }
PRIMARY {SQL_NEW_KEYWORD(SQL_TOKEN_PRIMARY); }
PRIVILEGES {SQL_NEW_KEYWORD(SQL_TOKEN_PRIVILEGES); }
@ -309,16 +330,20 @@ QUARTER {SQL_NEW_KEYWORD(SQL_TOKEN_QUARTER); }
RADIANS {SQL_NEW_KEYWORD(SQL_TOKEN_RADIANS); }
RAND {SQL_NEW_KEYWORD(SQL_TOKEN_RAND); }
RANGE {SQL_NEW_KEYWORD(SQL_TOKEN_RANGE); }
RANK {SQL_NEW_KEYWORD(SQL_TOKEN_RANK); }
REAL {SQL_NEW_KEYWORD(SQL_TOKEN_REAL); }
REFERENCES {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCES); }
REFERENCING {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCING); }
REPEAT {SQL_NEW_KEYWORD(SQL_TOKEN_REPEAT); }
REPLACE {SQL_NEW_KEYWORD(SQL_TOKEN_REPLACE); }
RESPECT {SQL_NEW_KEYWORD(SQL_TOKEN_RESPECT); }
ROLLBACK {SQL_NEW_KEYWORD(SQL_TOKEN_ROLLBACK); }
ROUND {SQL_NEW_KEYWORD(SQL_TOKEN_ROUND); }
ROUNDMAGIC {SQL_NEW_KEYWORD(SQL_TOKEN_ROUNDMAGIC); }
ROW {SQL_NEW_KEYWORD(SQL_TOKEN_ROW); }
ROWS {SQL_NEW_KEYWORD(SQL_TOKEN_ROWS); }
ROW_NUMBER {SQL_NEW_KEYWORD(SQL_TOKEN_ROW_NUMBER); }
RIGHT {SQL_NEW_KEYWORD(SQL_TOKEN_RIGHT); }
RTRIM {SQL_NEW_KEYWORD(SQL_TOKEN_RTRIM); }
@ -345,6 +370,7 @@ SYSTEM_USER {SQL_NEW_KEYWORD(SQL_TOKEN_SYSTEM_USER); }
TABLE {SQL_NEW_KEYWORD(SQL_TOKEN_TABLE); }
TAN {SQL_NEW_KEYWORD(SQL_TOKEN_TAN); }
THEN {SQL_NEW_KEYWORD(SQL_TOKEN_THEN); }
TIES {SQL_NEW_KEYWORD(SQL_TOKEN_TIES); }
TIME {SQL_NEW_KEYWORD(SQL_TOKEN_TIME); }
TIMESTAMP {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMP); }
TIMESTAMPADD {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPADD); }
@ -363,6 +389,7 @@ TS {SQL_NEW_KEYWORD(SQL_TOKEN_TS); }
T {SQL_NEW_KEYWORD(SQL_TOKEN_T); }
UCASE {SQL_NEW_KEYWORD(SQL_TOKEN_UCASE); }
UNBOUNDED {SQL_NEW_KEYWORD(SQL_TOKEN_UNBOUNDED); }
UNION {SQL_NEW_KEYWORD(SQL_TOKEN_UNION); }
UNIQUE {SQL_NEW_KEYWORD(SQL_TOKEN_UNIQUE); }
UNKNOWN {SQL_NEW_KEYWORD(SQL_TOKEN_UNKNOWN); }

View File

@ -1069,9 +1069,9 @@ void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNo
OSQLParseNode * pTableExp = pSelectNode->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator:table_exp error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
sal_uInt32 nPos = ( _bOrder ? 4 : 2 );
sal_uInt32 nPos = ( _bOrder ? ORDER_BY_CHILD_POS : 2 );
OSQLParseNode * pOptByClause = pTableExp->getChild(nPos);
OSL_ENSURE(pOptByClause != NULL,"OSQLParseTreeIterator: error in parse tree!");
@ -1234,7 +1234,7 @@ bool OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSele
OSQLParseNode * pTableExp = pSelectNode->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pWhereClause = pTableExp->getChild(1);
} else if (SQL_ISRULE(pSelectNode,update_statement_searched)) {
@ -1452,7 +1452,7 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
,const OSQLParseNode* _pColumnRef
,const OSQLParseNode* _pParentNode
,const ::rtl::OUString& _aColumnName
,const ::rtl::OUString& _aTableRange
,const ::rtl::OUString& _rColumnAlias)
@ -1491,18 +1491,18 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
}
// found a parameter
if ( _pColumnRef && (SQL_ISRULE(_pColumnRef,general_set_fct) || SQL_ISRULE(_pColumnRef,set_fct_spec)) )
if ( _pParentNode && (SQL_ISRULE(_pParentNode,general_set_fct) || SQL_ISRULE(_pParentNode,set_fct_spec)) )
{// found a function as column_ref
::rtl::OUString sFunctionName;
_pColumnRef->getChild(0)->parseNodeToStr( sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
const sal_uInt32 nCount = _pColumnRef->count();
_pParentNode->getChild(0)->parseNodeToStr( sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
const sal_uInt32 nCount = _pParentNode->count();
sal_uInt32 i = 0;
for(; i < nCount;++i)
{
if ( _pColumnRef->getChild(i) == _pParseNode )
if ( _pParentNode->getChild(i) == _pParseNode )
break;
}
sal_Int32 nType = ::connectivity::OSQLParser::getFunctionParameterType( _pColumnRef->getParent()->getChild(0)->getTokenID(), i+1);
sal_Int32 nType = ::connectivity::OSQLParser::getFunctionParameterType( _pParentNode->getChild(0)->getTokenID(), i-1);
OParseColumn* pColumn = new OParseColumn( sParameterName,
::rtl::OUString(),
@ -1553,14 +1553,14 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
if ( bNotFound )
{
sal_Int32 nType = DataType::VARCHAR;
OSQLParseNode* pParent = _pColumnRef ? _pColumnRef->getParent() : NULL;
OSQLParseNode* pParent = _pParentNode ? _pParentNode->getParent() : NULL;
if ( pParent && (SQL_ISRULE(pParent,general_set_fct) || SQL_ISRULE(pParent,set_fct_spec)) )
{
const sal_uInt32 nCount = _pColumnRef->count();
const sal_uInt32 nCount = _pParentNode->count();
sal_uInt32 i = 0;
for(; i < nCount;++i)
{
if ( _pColumnRef->getChild(i) == _pParseNode )
if ( _pParentNode->getChild(i) == _pParseNode )
break;
}
nType = ::connectivity::OSQLParser::getFunctionParameterType( pParent->getChild(0)->getTokenID(), i+1);
@ -1968,7 +1968,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pWhereClause = pTableExp->getChild(1);
}
@ -1998,9 +1998,9 @@ const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pOrderClause = pTableExp->getChild(4);
pOrderClause = pTableExp->getChild(ORDER_BY_CHILD_POS);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
if(pOrderClause->count() != 3)
pOrderClause = NULL;
@ -2020,7 +2020,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pGroupClause = pTableExp->getChild(2);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
@ -2041,7 +2041,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pHavingClause = pTableExp->getChild(3);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:

View File

@ -2470,7 +2470,7 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode
if (rString.getLength())
rString.appendAscii(" ");
const ::rtl::OString sT = OSQLParser::TokenIDToStr(m_nNodeID, &rParam.m_rContext);
const ::rtl::OString sT = OSQLParser::TokenIDToStr(m_nNodeID, rParam.bInternational ? &rParam.m_rContext : NULL);
rString.append(::rtl::OStringToOUString(sT,RTL_TEXTENCODING_UTF8));
} break;
case SQL_NODE_STRING:

View File

@ -1724,6 +1724,14 @@ int Desktop::Main()
if ( bAbort )
return EXIT_FAILURE;
{
::comphelper::ComponentContext aContext( xSMgr );
xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY );
}
// check whether the shutdown is caused by restart
pExecGlobals->bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
Migration::migrateSettingsIfNecessary();
// keep a language options instance...

View File

@ -85,8 +85,6 @@ bool singleton_entries( uno::Reference<registry::XRegistryKey> const& );
extern "C" {
struct uno_Environment;
void SAL_CALL component_getImplementationEnvironment(
const sal_Char ** ppEnvTypeName, uno_Environment ** )
{

View File

@ -1924,17 +1924,23 @@ void BackendImpl::ComponentsPackageImpl::processPackage_(
if (doRegisterPackage) {
ComponentBackendDb::Data data;
data.javaTypeLibrary = false;
std::vector< css::uno::Reference< css::uno::XInterface > > factories;
css::uno::Reference< css::uno::XComponentContext > context(
that->getObject(url), css::uno::UNO_QUERY);
if (!context.is()) {
context.set(
that->insertObject(
url,
raise_uno_process(
that->getComponentContext(), abortChannel)),
css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::uno::XComponentContext > context;
if (startup) {
context = that->getComponentContext();
} else {
context.set(that->getObject(url), css::uno::UNO_QUERY);
if (!context.is()) {
context.set(
that->insertObject(
url,
raise_uno_process(
that->getComponentContext(), abortChannel)),
css::uno::UNO_QUERY_THROW);
}
}
std::vector< css::uno::Reference< css::uno::XInterface > > factories;
css::uno::Reference< css::registry::XSimpleRegistry > registry(
css::uno::Reference< css::lang::XMultiComponentFactory >(
that->getComponentContext()->getServiceManager(),

View File

@ -105,6 +105,7 @@
#define PRIMITIVE2D_ID_DISCRETESHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 61)
#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 62)
#define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 63)
#define PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 64)
//////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,95 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_RENDERGRAPHICPRIMITIVE2D_HXX
#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_RENDERGRAPHICPRIMITIVE2D_HXX
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <vcl/rendergraphic.hxx>
#include <memory>
//////////////////////////////////////////////////////////////////////////////
// RenderGraphicPrimitive2D class
namespace vcl { class RenderGraphicRasterizer; }
namespace drawinglayer
{
namespace primitive2d
{
/** RenderGraphicPrimitive2D class
This class is the central primitive for RenderGraphic-based primitives.
*/
class RenderGraphicPrimitive2D : public BasePrimitive2D
{
private:
/// the RenderGraphic data
vcl::RenderGraphic maRenderGraphic;
mutable std::auto_ptr< vcl::RenderGraphicRasterizer > mapCurrentRasterizer;
/** the object transformation from unit coordinates, defining
size, shear, rotate and position
*/
basegfx::B2DHomMatrix maTransform;
public:
/// constructor
RenderGraphicPrimitive2D(
const vcl::RenderGraphic& rRenderGraphic,
const basegfx::B2DHomMatrix& rTransform);
/// data read access
inline const vcl::RenderGraphic& getRenderGraphic() const { return maRenderGraphic; }
inline const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
// access to latest used vcl::GraphicRasterizer for possibly reusing
// an already rendered vcl::RenderGraphic with the same transform
// properties during the next rendering process
void setCurrentRasterizer() const;
void setCurrentRasterizer( const vcl::RenderGraphicRasterizer& rCurrentGraphicRasterizer ) const;
inline const vcl::RenderGraphicRasterizer* getCurrentRasterizer() const { return( mapCurrentRasterizer.get() ); }
/// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
/// get range
virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
/// provide unique ID
DeclPrimitrive2DIDBlock()
};
} // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_RENDERGRAPHICPRIMITIVE2D_HXX
//////////////////////////////////////////////////////////////////////////////
// eof

View File

@ -57,6 +57,7 @@ namespace drawinglayer { namespace primitive2d {
class MetafilePrimitive2D;
class TextSimplePortionPrimitive2D;
class BitmapPrimitive2D;
class RenderGraphicPrimitive2D;
class TransparencePrimitive2D;
class PolygonStrokePrimitive2D;
class FillBitmapPrimitive2D;
@ -109,6 +110,7 @@ namespace drawinglayer
void impRenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate);
void impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate);
void impRenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
void impRenderRenderGraphicPrimitive2D(const primitive2d::RenderGraphicPrimitive2D& rRenderGraphicCandidate);
void impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate);
void impRenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokePrimitive);
void impRenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapPrimitive2D);

View File

@ -42,6 +42,7 @@ namespace drawinglayer { namespace primitive2d {
class TextSimplePortionPrimitive2D;
class PolygonHairlinePrimitive2D;
class BitmapPrimitive2D;
class RenderGraphicPrimitive2D;
class FillBitmapPrimitive2D;
class PolyPolygonGradientPrimitive2D;
class PolyPolygonBitmapPrimitive2D;
@ -98,6 +99,7 @@ namespace drawinglayer
void RenderTextSimpleOrDecoratedPortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate);
void RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate, bool bPixelBased);
void RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
void RenderRenderGraphicPrimitive2D(const primitive2d::RenderGraphicPrimitive2D& rRenderGraphicCandidate);
void RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate);
void RenderPolyPolygonGradientPrimitive2D(const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate);
void RenderPolyPolygonBitmapPrimitive2D(const primitive2d::PolyPolygonBitmapPrimitive2D& rPolygonCandidate);

View File

@ -13,6 +13,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d
..\inc\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx
..\inc\drawinglayer\primitive2d\baseprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\baseprimitive2d.hxx
..\inc\drawinglayer\primitive2d\bitmapprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\bitmapprimitive2d.hxx
..\inc\drawinglayer\primitive2d\rendergraphicprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\rendergraphicprimitive2d.hxx
..\inc\drawinglayer\primitive2d\borderlineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\borderlineprimitive2d.hxx
..\inc\drawinglayer\primitive2d\clippedborderlineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\clippedborderlineprimitive2d.hxx
..\inc\drawinglayer\primitive2d\chartprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\chartprimitive2d.hxx

View File

@ -32,6 +32,7 @@
#include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
#include <drawinglayer/animation/animationtiming.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <drawinglayer/primitive2d/animatedprimitive2d.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
@ -47,6 +48,7 @@
#include <vcl/graph.hxx>
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
#include <vcl/metaact.hxx>
//////////////////////////////////////////////////////////////////////////////
// includes for testing MetafilePrimitive2D::create2DDecomposition
@ -247,7 +249,9 @@ namespace drawinglayer
aSuppressGraphicAttr.SetCrop(0, 0, 0, 0);
aSuppressGraphicAttr.SetRotation(0);
aSuppressGraphicAttr.SetMirrorFlags(0);
const Graphic aTransformedGraphic(getGraphicObject().GetTransformedGraphic(&aSuppressGraphicAttr));
const GraphicObject& rGraphicObject = getGraphicObject();
const Graphic aTransformedGraphic(rGraphicObject.GetTransformedGraphic(&aSuppressGraphicAttr));
switch(aTransformedGraphic.GetType())
{
@ -291,34 +295,43 @@ namespace drawinglayer
case GRAPHIC_GDIMETAFILE :
{
// create MetafilePrimitive2D
const Graphic aGraphic(getGraphicObject().GetGraphic());
const GDIMetaFile& rMetafile = aTransformedGraphic.GetGDIMetaFile();
xPrimitive = Primitive2DReference(
new MetafilePrimitive2D(
aTransform,
rMetafile));
// #i100357# find out if clipping is needed for this primitive. Unfortunately,
// there exist Metafiles who's content is bigger than the proposed PrefSize set
// at them. This is an error, but we need to work around this
const Size aMetaFilePrefSize(rMetafile.GetPrefSize());
const Size aMetaFileRealSize(
const_cast< GDIMetaFile& >(rMetafile).GetBoundRect(
*Application::GetDefaultDevice()).GetSize());
if(aMetaFileRealSize.getWidth() > aMetaFilePrefSize.getWidth()
|| aMetaFileRealSize.getHeight() > aMetaFilePrefSize.getHeight())
if( aTransformedGraphic.IsRenderGraphic() )
{
// clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon
const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1);
basegfx::B2DPolygon aMaskPolygon(basegfx::tools::createUnitPolygon());
aMaskPolygon.transform(aTransform);
xPrimitive = Primitive2DReference(
new MaskPrimitive2D(
basegfx::B2DPolyPolygon(aMaskPolygon),
aChildContent));
new RenderGraphicPrimitive2D(
static_cast< MetaRenderGraphicAction* >(rMetafile.GetAction(0))->GetRenderGraphic(),
aTransform));
}
else
{
xPrimitive = Primitive2DReference(
new MetafilePrimitive2D(
aTransform,
rMetafile));
// #i100357# find out if clipping is needed for this primitive. Unfortunately,
// there exist Metafiles who's content is bigger than the proposed PrefSize set
// at them. This is an error, but we need to work around this
const Size aMetaFilePrefSize(rMetafile.GetPrefSize());
const Size aMetaFileRealSize(
const_cast< GDIMetaFile& >(rMetafile).GetBoundRect(
*Application::GetDefaultDevice()).GetSize());
if(aMetaFileRealSize.getWidth() > aMetaFilePrefSize.getWidth()
|| aMetaFileRealSize.getHeight() > aMetaFilePrefSize.getHeight())
{
// clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon
const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1);
basegfx::B2DPolygon aMaskPolygon(basegfx::tools::createUnitPolygon());
aMaskPolygon.transform(aTransform);
xPrimitive = Primitive2DReference(
new MaskPrimitive2D(
basegfx::B2DPolyPolygon(aMaskPolygon),
aChildContent));
}
}
break;
@ -353,16 +366,16 @@ namespace drawinglayer
{
const MapMode aMapMode100thmm(MAP_100TH_MM);
Size aBitmapSize(getGraphicObject().GetPrefSize());
Size aBitmapSize(rGraphicObject.GetPrefSize());
// #i95968# better support PrefMapMode; special for MAP_PIXEL was missing
if(MAP_PIXEL == getGraphicObject().GetPrefMapMode().GetMapUnit())
if(MAP_PIXEL == rGraphicObject.GetPrefMapMode().GetMapUnit())
{
aBitmapSize = Application::GetDefaultDevice()->PixelToLogic(aBitmapSize, aMapMode100thmm);
}
else
{
aBitmapSize = Application::GetDefaultDevice()->LogicToLogic(aBitmapSize, getGraphicObject().GetPrefMapMode(), aMapMode100thmm);
aBitmapSize = Application::GetDefaultDevice()->LogicToLogic(aBitmapSize, rGraphicObject.GetPrefMapMode(), aMapMode100thmm);
}
const double fDivX(aBitmapSize.Width() - getGraphicAttr().GetLeftCrop() - getGraphicAttr().GetRightCrop());

View File

@ -42,6 +42,7 @@ SLOFILES= \
$(SLO)$/baseprimitive2d.obj \
$(SLO)$/backgroundcolorprimitive2d.obj \
$(SLO)$/bitmapprimitive2d.obj \
$(SLO)$/rendergraphicprimitive2d.obj \
$(SLO)$/borderlineprimitive2d.obj \
$(SLO)$/clippedborderlineprimitive2d.obj \
$(SLO)$/chartprimitive2d.obj \

View File

@ -64,6 +64,7 @@
#include <drawinglayer/primitive2d/textlineprimitive2d.hxx>
#include <drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx>
#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <numeric>
//////////////////////////////////////////////////////////////////////////////
@ -3069,6 +3070,33 @@ namespace
break;
}
case META_RENDERGRAPHIC_ACTION :
{
const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*)pAction;
const Rectangle aRectangle(pA->GetPoint(), pA->GetSize());
if(!aRectangle.IsEmpty())
{
// create object transform
basegfx::B2DHomMatrix aObjectTransform;
aObjectTransform.set(0, 0, aRectangle.GetWidth());
aObjectTransform.set(1, 1, aRectangle.GetHeight());
aObjectTransform.set(0, 2, aRectangle.Left());
aObjectTransform.set(1, 2, aRectangle.Top());
// add current transformation
aObjectTransform = rPropertyHolders.Current().getTransformation() * aObjectTransform;
// embed using EpsPrimitive
rTargetHolders.Current().append(
new drawinglayer::primitive2d::RenderGraphicPrimitive2D(
pA->GetRenderGraphic(),
aObjectTransform ) );
}
break;
}
case META_COMMENT_ACTION :
{
/** CHECKED, WORKS WELL */

View File

@ -0,0 +1,92 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_drawinglayer.hxx"
#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <vcl/rendergraphicrasterizer.hxx>
//////////////////////////////////////////////////////////////////////////////
using namespace com::sun::star;
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
namespace primitive2d
{
RenderGraphicPrimitive2D::RenderGraphicPrimitive2D(
const vcl::RenderGraphic& rRenderGraphic,
const basegfx::B2DHomMatrix& rTransform)
: BasePrimitive2D(),
maRenderGraphic(rRenderGraphic),
maTransform(rTransform)
{
}
void RenderGraphicPrimitive2D::setCurrentRasterizer() const
{
mapCurrentRasterizer.reset();
}
void RenderGraphicPrimitive2D::setCurrentRasterizer( const vcl::RenderGraphicRasterizer& rCurrentRasterizer ) const
{
mapCurrentRasterizer.reset( new vcl::RenderGraphicRasterizer( rCurrentRasterizer ) );
}
bool RenderGraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
{
if(BasePrimitive2D::operator==(rPrimitive))
{
const RenderGraphicPrimitive2D& rCompare = (RenderGraphicPrimitive2D&)rPrimitive;
return (getRenderGraphic() == rCompare.getRenderGraphic()
&& getTransform() == rCompare.getTransform());
}
return false;
}
basegfx::B2DRange RenderGraphicPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
aRetval.transform(maTransform);
return aRetval;
}
// provide unique ID
ImplPrimitrive2DIDBlock(RenderGraphicPrimitive2D, PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D)
} // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
// eof

View File

@ -529,6 +529,8 @@ namespace drawinglayer
case PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D :
case PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D :
case PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D :
case PRIMITIVE2D_ID_MEDIAPRIMITIVE2D:
case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D:
{
if(!getHitTextOnly())
{

View File

@ -124,6 +124,7 @@ namespace drawinglayer
case PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D :
case PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D :
case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
{

View File

@ -215,6 +215,7 @@ namespace drawinglayer
case PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D :
case PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D :
case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
{

View File

@ -39,6 +39,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygonclipper.hxx>
@ -866,7 +867,7 @@ namespace drawinglayer
// I have now moved describePDFControl to toolkit, thus i can implement the PDF
// form control support now as follows
::std::auto_ptr< ::vcl::PDFWriter::AnyWidget > pPDFControl;
::toolkitform::describePDFControl(rXControl, pPDFControl);
::toolkitform::describePDFControl( rXControl, pPDFControl, *mpPDFExtOutDevData );
if(pPDFControl.get())
{
@ -1288,6 +1289,12 @@ namespace drawinglayer
RenderBitmapPrimitive2D(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate));
break;
}
case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
{
// direct draw of transformed RenderGraphic primitive; use default processing
RenderRenderGraphicPrimitive2D(static_cast< const primitive2d::RenderGraphicPrimitive2D& >(rCandidate));
break;
}
case PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D :
{
// need to handle PolyPolygonBitmapPrimitive2D here to support XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END

View File

@ -36,6 +36,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
@ -194,6 +195,12 @@ namespace drawinglayer
RenderBitmapPrimitive2D(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate));
break;
}
case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
{
// direct draw of transformed BitmapEx primitive
RenderRenderGraphicPrimitive2D(static_cast< const primitive2d::RenderGraphicPrimitive2D& >(rCandidate));
break;
}
case PRIMITIVE2D_ID_FILLBITMAPPRIMITIVE2D :
{
// direct draw of fillBitmapPrimitive

View File

@ -36,6 +36,7 @@
#include <vcl/outdev.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <vclhelperbitmaptransform.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <vclhelperbitmaprender.hxx>
@ -61,6 +62,7 @@
#include <vcl/metric.hxx>
#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
#include <vcl/rendergraphicrasterizer.hxx>
//////////////////////////////////////////////////////////////////////////////
// control support
@ -449,6 +451,75 @@ namespace drawinglayer
}
}
void VclProcessor2D::RenderRenderGraphicPrimitive2D(const primitive2d::RenderGraphicPrimitive2D& rRenderGraphicCandidate)
{
// create local transform
basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rRenderGraphicCandidate.getTransform());
vcl::RenderGraphic aRenderGraphic(rRenderGraphicCandidate.getRenderGraphic());
bool bPainted(false);
if(maBColorModifierStack.count())
{
// !!! TODO
// aRenderGraphic = impModifyRenderGraphic(maBColorModifierStack, aRenderGraphic);
if(aRenderGraphic.IsEmpty())
{
// color gets completely replaced, get it
const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor()));
basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon());
aPolygon.transform(aLocalTransform);
mpOutputDevice->SetFillColor(Color(aModifiedColor));
mpOutputDevice->SetLineColor();
mpOutputDevice->DrawPolygon(aPolygon);
bPainted = true;
}
}
if(!bPainted)
{
// decompose matrix to check for shear, rotate and mirroring
basegfx::B2DVector aScale, aTranslate;
double fRotate, fShearX;
aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0);
if( basegfx::fTools::equalZero( fRotate ) )
{
aOutlineRange.transform( aLocalTransform );
}
else
{
// !!! TODO
// if rotated, create the unrotated output rectangle for the GraphicManager paint
/*
const basegfx::B2DHomMatrix aSimpleObjectMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(
fabs(aScale.getX()), fabs(aScale.getY()),
aTranslate.getX(), aTranslate.getY()));
aOutlineRange.transform(aSimpleObjectMatrix);
*/
}
// prepare dest coordinates
const Point aPoint( basegfx::fround(aOutlineRange.getMinX() ),
basegfx::fround(aOutlineRange.getMinY() ) );
const Size aSize( basegfx::fround(aOutlineRange.getWidth() ),
basegfx::fround(aOutlineRange.getHeight() ) );
const Size aSizePixel( mpOutputDevice->LogicToPixel( aSize ) );
const vcl::RenderGraphicRasterizer aRasterizer( aRenderGraphic );
const BitmapEx aBitmapEx( aRasterizer.Rasterize( aSizePixel, fRotate, fShearX ) );
if( !aBitmapEx.IsEmpty() )
{
mpOutputDevice->DrawBitmapEx( aPoint, aSize, aBitmapEx );
}
}
}
void VclProcessor2D::RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate)
{
const attribute::FillBitmapAttribute& rFillBitmapAttribute(rFillBitmapCandidate.getFillBitmap());

View File

@ -2698,7 +2698,10 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS
// get word boundaries in order to clear possible WrongList entries
// and invalidate all the necessary text (everything after and including the
// start of the word)
EditSelection aCurWord( SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD ) );
// #i107201# do the expensive SelectWord call only if online spelling is active
EditSelection aCurWord;
if ( GetStatus().DoOnlineSpelling() )
aCurWord = SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD );
XubString aText( rStr );
aText.ConvertLineEnd( LINEEND_LF );
@ -2752,12 +2755,17 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS
ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() );
OSL_ENSURE( pPortion, "Blind Portion in InsertText" );
// now remove the Wrongs (red spell check marks) from both words...
WrongList *pWrongs = aCurPaM.GetNode()->GetWrongList();
if (pWrongs && pWrongs->HasWrongs())
pWrongs->ClearWrongs( aCurWord.Min().GetIndex(), aPaM.GetIndex(), aPaM.GetNode() );
// ... and mark both words as 'to be checked again'
pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.Len() );
if ( GetStatus().DoOnlineSpelling() )
{
// now remove the Wrongs (red spell check marks) from both words...
WrongList *pWrongs = aCurPaM.GetNode()->GetWrongList();
if (pWrongs && pWrongs->HasWrongs())
pWrongs->ClearWrongs( aCurWord.Min().GetIndex(), aPaM.GetIndex(), aPaM.GetNode() );
// ... and mark both words as 'to be checked again'
pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.Len() );
}
else
pPortion->MarkInvalid( aCurPaM.GetIndex(), aLine.Len() );
}
if ( nEnd < aText.Len() )
aPaM = ImpInsertParaBreak( aPaM );

View File

@ -130,67 +130,71 @@
#define SC_OPCODE_ARC_COS_HYP 95
#define SC_OPCODE_ARC_TAN_HYP 96
#define SC_OPCODE_ARC_COT_HYP 97
#define SC_OPCODE_EXP 98
#define SC_OPCODE_LN 99
#define SC_OPCODE_SQRT 100
#define SC_OPCODE_FACT 101
#define SC_OPCODE_GET_YEAR 102 /* date and time */
#define SC_OPCODE_GET_MONTH 103
#define SC_OPCODE_GET_DAY 104
#define SC_OPCODE_GET_HOUR 105
#define SC_OPCODE_GET_MIN 106
#define SC_OPCODE_GET_SEC 107
#define SC_OPCODE_PLUS_MINUS 108 /* miscellaneous */
#define SC_OPCODE_ABS 109
#define SC_OPCODE_INT 110
#define SC_OPCODE_PHI 111
#define SC_OPCODE_GAUSS 112
#define SC_OPCODE_IS_EMPTY 113 /* obtain type */
#define SC_OPCODE_IS_STRING 114
#define SC_OPCODE_IS_NON_STRING 115
#define SC_OPCODE_IS_LOGICAL 116
#define SC_OPCODE_TYPE 117
#define SC_OPCODE_IS_REF 118
#define SC_OPCODE_IS_VALUE 119
#define SC_OPCODE_IS_FORMULA 120
#define SC_OPCODE_IS_NV 121
#define SC_OPCODE_IS_ERR 122
#define SC_OPCODE_IS_ERROR 123
#define SC_OPCODE_IS_EVEN 124
#define SC_OPCODE_IS_ODD 125
#define SC_OPCODE_N 126
#define SC_OPCODE_GET_DATE_VALUE 127 /* string functions */
#define SC_OPCODE_GET_TIME_VALUE 128
#define SC_OPCODE_CODE 129
#define SC_OPCODE_TRIM 130
#define SC_OPCODE_UPPER 131
#define SC_OPCODE_PROPPER 132
#define SC_OPCODE_LOWER 133
#define SC_OPCODE_LEN 134
#define SC_OPCODE_T 135 /* miscellaneous, part 21 */
#define SC_OPCODE_VALUE 136
#define SC_OPCODE_CLEAN 137
#define SC_OPCODE_CHAR 138
#define SC_OPCODE_LOG10 139
#define SC_OPCODE_EVEN 140
#define SC_OPCODE_ODD 141
#define SC_OPCODE_STD_NORM_DIST 142
#define SC_OPCODE_FISHER 143
#define SC_OPCODE_FISHER_INV 144
#define SC_OPCODE_S_NORM_INV 145
#define SC_OPCODE_GAMMA_LN 146
#define SC_OPCODE_ERROR_TYPE 147
#define SC_OPCODE_ERR_CELL 148
#define SC_OPCODE_FORMULA 149
#define SC_OPCODE_ARABIC 150
#define SC_OPCODE_INFO 151
#define SC_OPCODE_BAHTTEXT 152
#define SC_OPCODE_JIS 153
#define SC_OPCODE_ASC 154
#define SC_OPCODE_UNICODE 155
#define SC_OPCODE_UNICHAR 156
#define SC_OPCODE_GAMMA 157
#define SC_OPCODE_STOP_1_PAR 158
#define SC_OPCODE_COSECANT 98
#define SC_OPCODE_SECANT 99
#define SC_OPCODE_COSECANT_HYP 100
#define SC_OPCODE_SECANT_HYP 101
#define SC_OPCODE_EXP 102
#define SC_OPCODE_LN 103
#define SC_OPCODE_SQRT 104
#define SC_OPCODE_FACT 105
#define SC_OPCODE_GET_YEAR 106 /* date and time */
#define SC_OPCODE_GET_MONTH 107
#define SC_OPCODE_GET_DAY 108
#define SC_OPCODE_GET_HOUR 109
#define SC_OPCODE_GET_MIN 110
#define SC_OPCODE_GET_SEC 111
#define SC_OPCODE_PLUS_MINUS 112 /* miscellaneous */
#define SC_OPCODE_ABS 113
#define SC_OPCODE_INT 114
#define SC_OPCODE_PHI 115
#define SC_OPCODE_GAUSS 116
#define SC_OPCODE_IS_EMPTY 117 /* obtain type */
#define SC_OPCODE_IS_STRING 118
#define SC_OPCODE_IS_NON_STRING 119
#define SC_OPCODE_IS_LOGICAL 120
#define SC_OPCODE_TYPE 121
#define SC_OPCODE_IS_REF 122
#define SC_OPCODE_IS_VALUE 123
#define SC_OPCODE_IS_FORMULA 124
#define SC_OPCODE_IS_NV 125
#define SC_OPCODE_IS_ERR 126
#define SC_OPCODE_IS_ERROR 127
#define SC_OPCODE_IS_EVEN 128
#define SC_OPCODE_IS_ODD 129
#define SC_OPCODE_N 130
#define SC_OPCODE_GET_DATE_VALUE 131 /* string functions */
#define SC_OPCODE_GET_TIME_VALUE 132
#define SC_OPCODE_CODE 133
#define SC_OPCODE_TRIM 134
#define SC_OPCODE_UPPER 135
#define SC_OPCODE_PROPPER 136
#define SC_OPCODE_LOWER 137
#define SC_OPCODE_LEN 138
#define SC_OPCODE_T 139 /* miscellaneous, part 21 */
#define SC_OPCODE_VALUE 140
#define SC_OPCODE_CLEAN 141
#define SC_OPCODE_CHAR 142
#define SC_OPCODE_LOG10 143
#define SC_OPCODE_EVEN 144
#define SC_OPCODE_ODD 145
#define SC_OPCODE_STD_NORM_DIST 146
#define SC_OPCODE_FISHER 147
#define SC_OPCODE_FISHER_INV 148
#define SC_OPCODE_S_NORM_INV 149
#define SC_OPCODE_GAMMA_LN 150
#define SC_OPCODE_ERROR_TYPE 151
#define SC_OPCODE_ERR_CELL 152
#define SC_OPCODE_FORMULA 153
#define SC_OPCODE_ARABIC 154
#define SC_OPCODE_INFO 155
#define SC_OPCODE_BAHTTEXT 156
#define SC_OPCODE_JIS 157
#define SC_OPCODE_ASC 158
#define SC_OPCODE_UNICODE 159
#define SC_OPCODE_UNICHAR 160
#define SC_OPCODE_GAMMA 161
#define SC_OPCODE_STOP_1_PAR 162
/*** Functions with more than one parameters ***/
#define SC_OPCODE_START_2_PAR 201

View File

@ -122,6 +122,10 @@ enum OpCodeEnum
ocArcCosHyp = SC_OPCODE_ARC_COS_HYP,
ocArcTanHyp = SC_OPCODE_ARC_TAN_HYP,
ocArcCotHyp = SC_OPCODE_ARC_COT_HYP,
ocCosecant = SC_OPCODE_COSECANT,
ocSecant = SC_OPCODE_SECANT,
ocCosecantHyp = SC_OPCODE_COSECANT_HYP,
ocSecantHyp = SC_OPCODE_SECANT_HYP,
ocExp = SC_OPCODE_EXP,
ocLn = SC_OPCODE_LN,
ocSqrt = SC_OPCODE_SQRT,

View File

@ -70,6 +70,7 @@ enum StackVarEnum
svExternalSingleRef,
svExternalDoubleRef,
svExternalName,
svSubroutine, // A token with a subroutine token array.
svError, // error token
svMissing = 0x70, // 0 or ""
svSep, // separator, ocSep, ocOpen, ocClose
@ -89,6 +90,8 @@ class FormulaToken;
typedef ::boost::intrusive_ptr<FormulaToken> FormulaTokenRef;
typedef ::boost::intrusive_ptr<const FormulaToken> FormulaConstTokenRef;
class FormulaTokenArray;
class FORMULA_DLLPUBLIC FormulaToken : public IFormulaToken
{
OpCode eOp;
@ -374,6 +377,23 @@ public:
};
class FORMULA_DLLPUBLIC FormulaSubroutineToken : public FormulaToken
{
public:
/** Takes ownership of pArray and deletes it upon destruction! */
FormulaSubroutineToken( const FormulaTokenArray* pArray ) :
FormulaToken( svSubroutine, ocCall ), mpArray( pArray) {}
FormulaSubroutineToken( const FormulaSubroutineToken& r );
virtual ~FormulaSubroutineToken();
virtual FormulaToken* Clone() const { return new FormulaSubroutineToken(*this); }
virtual bool operator==( const FormulaToken& rToken ) const;
const FormulaTokenArray* GetTokenArray() const;
private:
const FormulaTokenArray* mpArray;
};
class FORMULA_DLLPUBLIC FormulaUnknownToken : public FormulaToken
{
public:

View File

@ -259,6 +259,7 @@ public:
void Reset();
const FormulaToken* First();
const FormulaToken* Next();
const FormulaToken* PeekNextOperator();
bool IsEndOfPath() const; /// if a jump or subroutine path is done
bool HasStacked() const { return pCur->pNext != 0; }
short GetPC() const { return pCur->nPC; }
@ -279,6 +280,9 @@ public:
void Jump( short nStart, short nNext, short nStop = SHRT_MAX );
void Push( const FormulaTokenArray* );
void Pop();
private:
const FormulaToken* GetNonEndOfPathToken( short nIdx ) const;
};
// =============================================================================
} // formula

View File

@ -1258,15 +1258,7 @@ const FormulaToken* FormulaTokenIterator::First()
const FormulaToken* FormulaTokenIterator::Next()
{
const FormulaToken* t = NULL;
++pCur->nPC;
if( pCur->nPC < pCur->pArr->nRPN && pCur->nPC < pCur->nStop )
{
t = pCur->pArr->pRPN[ pCur->nPC ];
// such an OpCode ends an IF() or CHOOSE() path
if( t->GetOpCode() == ocSep || t->GetOpCode() == ocClose )
t = NULL;
}
const FormulaToken* t = GetNonEndOfPathToken( ++pCur->nPC );
if( !t && pCur->pNext )
{
Pop();
@ -1275,6 +1267,25 @@ const FormulaToken* FormulaTokenIterator::Next()
return t;
}
const FormulaToken* FormulaTokenIterator::PeekNextOperator()
{
const FormulaToken* t = NULL;
short nIdx = pCur->nPC;
while (!t && ((t = GetNonEndOfPathToken( ++nIdx)) != NULL))
{
if (t->GetOpCode() == ocPush)
t = NULL; // ignore operands
}
if (!t && pCur->pNext)
{
ImpTokenIterator* pHere = pCur;
pCur = pCur->pNext;
t = PeekNextOperator();
pCur = pHere;
}
return t;
}
//! The nPC counts after a Push() are -1
void FormulaTokenIterator::Jump( short nStart, short nNext, short nStop )
@ -1288,17 +1299,22 @@ void FormulaTokenIterator::Jump( short nStart, short nNext, short nStop )
}
}
const FormulaToken* FormulaTokenIterator::GetNonEndOfPathToken( short nIdx ) const
{
if (nIdx < pCur->pArr->nRPN && nIdx < pCur->nStop)
{
const FormulaToken* t = pCur->pArr->pRPN[ nIdx ];
// such an OpCode ends an IF() or CHOOSE() path
return (t->GetOpCode() == ocSep || t->GetOpCode() == ocClose) ? NULL : t;
}
return NULL;
}
bool FormulaTokenIterator::IsEndOfPath() const
{
sal_uInt16 nTest = pCur->nPC + 1;
if( nTest < pCur->pArr->nRPN && nTest < pCur->nStop )
{
const FormulaToken* t = pCur->pArr->pRPN[ nTest ];
// such an OpCode ends an IF() or CHOOSE() path
return t->GetOpCode() == ocSep || t->GetOpCode() == ocClose;
}
return true;
return GetNonEndOfPathToken( pCur->nPC + 1) != NULL;
}
// -----------------------------------------------------------------------------
// ==========================================================================
// real implementations of virtual functions
@ -1360,6 +1376,27 @@ bool FormulaMissingToken::operator==( const FormulaToken& r ) const
}
FormulaSubroutineToken::FormulaSubroutineToken( const FormulaSubroutineToken& r ) :
FormulaToken( r ),
mpArray( r.mpArray->Clone())
{
}
FormulaSubroutineToken::~FormulaSubroutineToken()
{
delete mpArray;
}
const FormulaTokenArray* FormulaSubroutineToken::GetTokenArray() const
{
return mpArray;
}
bool FormulaSubroutineToken::operator==( const FormulaToken& r ) const
{
// Arrays don't equal..
return FormulaToken::operator==( r ) &&
(mpArray == static_cast<const FormulaSubroutineToken&>(r).mpArray);
}
bool FormulaUnknownToken::operator==( const FormulaToken& r ) const
{
return FormulaToken::operator==( r );

View File

@ -88,6 +88,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
String SC_OPCODE_ARC_COS_HYP { Text = "ACOSH" ; };
String SC_OPCODE_ARC_TAN_HYP { Text = "ATANH" ; };
String SC_OPCODE_ARC_COT_HYP { Text = "ACOTH" ; };
String SC_OPCODE_COSECANT { Text = "CSC" ; };
String SC_OPCODE_SECANT { Text = "SEC" ; };
String SC_OPCODE_COSECANT_HYP { Text = "CSCH" ; };
String SC_OPCODE_SECANT_HYP { Text = "SECH" ; };
String SC_OPCODE_EXP { Text = "EXP" ; };
String SC_OPCODE_LN { Text = "LN" ; };
String SC_OPCODE_SQRT { Text = "SQRT" ; };
@ -412,6 +416,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
String SC_OPCODE_ARC_COS_HYP { Text = "ACOSH" ; };
String SC_OPCODE_ARC_TAN_HYP { Text = "ATANH" ; };
String SC_OPCODE_ARC_COT_HYP { Text = "ACOTH" ; };
String SC_OPCODE_COSECANT { Text = "CSC" ; };
String SC_OPCODE_SECANT { Text = "SEC" ; };
String SC_OPCODE_COSECANT_HYP { Text = "CSCH" ; };
String SC_OPCODE_SECANT_HYP { Text = "SECH" ; };
String SC_OPCODE_EXP { Text = "EXP" ; };
String SC_OPCODE_LN { Text = "LN" ; };
String SC_OPCODE_SQRT { Text = "SQRT" ; };
@ -830,6 +838,22 @@ Resource RID_STRLIST_FUNCTION_NAMES
{
Text [ en-US ] = "ACOTH" ;
};
String SC_OPCODE_COSECANT
{
Text = "CSC" ;
};
String SC_OPCODE_SECANT
{
Text = "SEC" ;
};
String SC_OPCODE_COSECANT_HYP
{
Text = "CSCH" ;
};
String SC_OPCODE_SECANT_HYP
{
Text = "SECH" ;
};
String SC_OPCODE_EXP
{
Text [ en-US ] = "EXP";

View File

@ -67,6 +67,8 @@ class IVistaFilePickerInternalNotify
public:
virtual void onAutoExtensionChanged (bool bChecked) = 0;
virtual bool onFileTypeChanged( UINT nTypeIndex ) = 0;
};
}}}

View File

@ -225,7 +225,7 @@ void SAL_CALL VistaFilePicker::setTitle(const ::rtl::OUString& sTitle)
//-----------------------------------------------------------------------------------------
void SAL_CALL VistaFilePicker::appendFilter(const ::rtl::OUString& sTitle ,
const ::rtl::OUString& sFilter)
const ::rtl::OUString& sFilter)
throw(css::lang::IllegalArgumentException,
css::uno::RuntimeException )
{
@ -264,17 +264,15 @@ void SAL_CALL VistaFilePicker::setCurrentFilter(const ::rtl::OUString& sTitle)
//-----------------------------------------------------------------------------------------
void SAL_CALL VistaFilePicker::appendFilterGroup(const ::rtl::OUString& /*sGroupTitle*/,
const css::uno::Sequence< css::beans::StringPair >& lFilters )
const css::uno::Sequence< css::beans::StringPair >& rFilters )
throw (css::lang::IllegalArgumentException,
css::uno::RuntimeException )
{
::sal_Int32 c = lFilters.getLength();
::sal_Int32 i = 0;
for (i=0; i<c; ++i)
{
const css::beans::StringPair& rFilter = lFilters[i];
appendFilter(rFilter.First, rFilter.Second);
}
RequestRef rRequest(new Request());
rRequest->setRequest (VistaFilePickerImpl::E_APPEND_FILTERGROUP);
rRequest->setArgument(PROP_FILTER_GROUP, rFilters);
m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
}
//-----------------------------------------------------------------------------------------

View File

@ -264,33 +264,16 @@ STDMETHODIMP VistaFilePickerEventHandler::OnShareViolation(IFileDialog*
}
//-----------------------------------------------------------------------------------------
STDMETHODIMP VistaFilePickerEventHandler::OnTypeChange(IFileDialog* /*pDialog*/)
STDMETHODIMP VistaFilePickerEventHandler::OnTypeChange(IFileDialog* pDialog)
{
/*
IFileDialogCustomize *iCustomize;
pDialog->QueryInterface(IID_IFileDialogCustomize, (void**)(&iCustomize));
UINT nFileTypeIndex;
HRESULT hResult = pDialog->GetFileTypeIndex( &nFileTypeIndex );
BOOL bValue = FALSE;
HRESULT hResult = iCustomize->GetCheckButtonState( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &bValue);
if ( bValue )
if ( hResult == S_OK )
{
UINT nIndex;
pDialog->GetFileTypeIndex( &nIndex );
LPCWSTR lpFilterExt = lFilters[nIndex].pszSpec;
lpFilterExt = wcschr( lpFilterExt, '.' );
if ( lpFilterExt )
lpFilterExt++;
pDialog->SetDefaultExtension( lpFilterExt );
if ( m_pInternalNotify->onFileTypeChanged( nFileTypeIndex ))
impl_sendEvent(E_CONTROL_STATE_CHANGED, css::ui::dialogs::CommonFilePickerElementIds::LISTBOX_FILTER);
}
return S_OK;
*/
impl_sendEvent(E_CONTROL_STATE_CHANGED, css::ui::dialogs::CommonFilePickerElementIds::LISTBOX_FILTER);
return S_OK;
}
@ -329,32 +312,9 @@ STDMETHODIMP VistaFilePickerEventHandler::OnCheckButtonToggled(IFileDialogCustom
DWORD nIDCtl ,
BOOL bChecked )
{
/*
if (nIDCtl == css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION)
{
LPCWSTR lpFilterExt = 0;
if ( bChecked )
{
UINT nIndex;
if (m_pDialog)
{
m_pDialog->GetFileTypeIndex( &nIndex );
lpFilterExt = lFilters[nIndex].pszSpec;
lpFilterExt = wcschr( lpFilterExt, '.' );
if ( lpFilterExt )
lpFilterExt++;
}
}
if (m_pDialog)
m_pDialog->SetDefaultExtension( lpFilterExt );
}
*/
if (nIDCtl == css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION)
m_pInternalNotify->onAutoExtensionChanged(bChecked);
impl_sendEvent(E_CONTROL_STATE_CHANGED, static_cast<sal_Int16>( nIDCtl));
return S_OK;

View File

@ -35,6 +35,7 @@
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#include <com/sun/star/ui/dialogs/ControlActions.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/beans/StringPair.hpp>
#include <comphelper/sequenceasvector.hxx>
#include <osl/file.hxx>
#include <osl/mutex.hxx>
@ -43,6 +44,8 @@
#endif
#include "..\misc\WinImplHelper.hxx"
#include <Shlguid.h>
inline bool is_current_process_window(HWND hwnd)
{
DWORD pid;
@ -200,6 +203,10 @@ void VistaFilePickerImpl::doRequest(const RequestRef& rRequest)
impl_sta_appendFilter(rRequest);
break;
case E_APPEND_FILTERGROUP :
impl_sta_appendFilterGroup(rRequest);
break;
case E_SET_CURRENT_FILTER :
impl_sta_setCurrentFilter(rRequest);
break;
@ -331,6 +338,28 @@ void VistaFilePickerImpl::impl_sta_appendFilter(const RequestRef& rRequest)
m_lFilters.addFilter(sTitle, sFilter);
}
//-------------------------------------------------------------------------------
void VistaFilePickerImpl::impl_sta_appendFilterGroup(const RequestRef& rRequest)
{
const css::uno::Sequence< css::beans::StringPair > aFilterGroup =
rRequest->getArgumentOrDefault(PROP_FILTER_GROUP, css::uno::Sequence< css::beans::StringPair >());
// SYNCHRONIZED->
::rtl::OUString aEmpty;
::osl::ResettableMutexGuard aLock(m_aMutex);
if ( m_lFilters.numFilter() > 0 && aFilterGroup.getLength() > 0 )
m_lFilters.addFilter( STRING_SEPARATOR, aEmpty, sal_True );
::sal_Int32 c = aFilterGroup.getLength();
::sal_Int32 i = 0;
for (i=0; i<c; ++i)
{
const css::beans::StringPair& rFilter = aFilterGroup[i];
m_lFilters.addFilter(rFilter.First, rFilter.Second);
}
}
//-------------------------------------------------------------------------------
void VistaFilePickerImpl::impl_sta_setCurrentFilter(const RequestRef& rRequest)
{
@ -942,7 +971,7 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest)
return;
impl_sta_getSelectedFiles(rRequest);
rRequest->setArgument(PROP_DIALOG_SHOW_RESULT, (::sal_Bool)sal_True);
rRequest->setArgument(PROP_DIALOG_SHOW_RESULT, sal_True);
}
//-------------------------------------------------------------------------------
@ -1180,6 +1209,23 @@ void VistaFilePickerImpl::impl_SetDefaultExtension( const rtl::OUString& current
}
}
static void impl_refreshFileDialog( TFileDialog iDialog )
{
if ( SUCCEEDED(iDialog->SetFileName(L"")) &&
SUCCEEDED(iDialog->SetFileName(L"*.*")) )
{
IOleWindow* iOleWindow;
if (SUCCEEDED(iDialog->QueryInterface(IID_PPV_ARGS(&iOleWindow))))
{
HWND hwnd;
if (SUCCEEDED(iOleWindow->GetWindow(&hwnd)))
{
PostMessage(hwnd, WM_COMMAND, IDOK, 0);
}
iOleWindow->Release();
}
}
}
//-------------------------------------------------------------------------------
void VistaFilePickerImpl::onAutoExtensionChanged (bool bChecked)
@ -1208,6 +1254,11 @@ void VistaFilePickerImpl::onAutoExtensionChanged (bool bChecked)
iDialog->SetDefaultExtension( pExt );
}
bool VistaFilePickerImpl::onFileTypeChanged( UINT /*nTypeIndex*/ )
{
return true;
}
} // namespace vista
} // namespace win32
} // namespace fpicker

View File

@ -105,12 +105,14 @@ static const ::rtl::OUString PROP_TEMPLATE_DESCR(RTL_CONSTASCII_USTRINGPARAM("te
static const ::rtl::OUString PROP_FILTER_TITLE(RTL_CONSTASCII_USTRINGPARAM("filter_title" )); // [OUString]
static const ::rtl::OUString PROP_FILTER_VALUE(RTL_CONSTASCII_USTRINGPARAM("filter_value" )); // [OUString]
static const ::rtl::OUString PROP_FORCE(RTL_CONSTASCII_USTRINGPARAM("force" )); // [sal_Bool]
static const ::rtl::OUString PROP_FILTER_GROUP(RTL_CONSTASCII_USTRINGPARAM("filter-group" )); // [seq< css:beans::StringPair >] contains a group of filters
static const ::rtl::OUString PROP_CONTROL_ID(RTL_CONSTASCII_USTRINGPARAM("control_id" )); // [sal_Int16]
static const ::rtl::OUString PROP_CONTROL_ACTION(RTL_CONSTASCII_USTRINGPARAM("control_action" )); // [sal_Int16]
static const ::rtl::OUString PROP_CONTROL_VALUE(RTL_CONSTASCII_USTRINGPARAM("control_value" )); // [Any]
static const ::rtl::OUString PROP_CONTROL_LABEL(RTL_CONSTASCII_USTRINGPARAM("control_label" )); // [OUString]
static const ::rtl::OUString PROP_CONTROL_ENABLE(RTL_CONSTASCII_USTRINGPARAM("control_enable" )); // [sal_Bool] true=ON, false=OFF
static const ::rtl::OUString STRING_SEPARATOR(RTL_CONSTASCII_USTRINGPARAM("------------------------------------------" ));
//-----------------------------------------------------------------------------
/** native implementation of the file picker on Vista and upcoming windows versions.
@ -150,7 +152,8 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
E_GET_CONTROL_VALUE,
E_SET_CONTROL_LABEL,
E_GET_CONTROL_LABEL,
E_ENABLE_CONTROL
E_ENABLE_CONTROL,
E_APPEND_FILTERGROUP
};
public:
@ -169,8 +172,11 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
virtual void doRequest(const RequestRef& rRequest);
virtual void after();
//---------------------------------------------------------------------
// IVistaFilePickerInternalNotify
//---------------------------------------------------------------------
virtual void onAutoExtensionChanged (bool bChecked);
virtual bool onFileTypeChanged( UINT nTypeIndex );
private:
@ -186,6 +192,10 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
/// implementation of request E_APPEND_FILTER
void impl_sta_appendFilter(const RequestRef& rRequest);
//---------------------------------------------------------------------
/// implementation of request E_APPEND_FILTERGROUP
void impl_sta_appendFilterGroup(const RequestRef& rRequest);
//---------------------------------------------------------------------
/// implementation of request E_SET_CURRENT_FILTER
void impl_sta_setCurrentFilter(const RequestRef& rRequest);

View File

@ -315,11 +315,24 @@ void SAL_CALL CWinFileOpenImpl::appendFilterGroup(const rtl::OUString& sGroupTit
// XExtendedFilePicker
//=================================================================================================================
// #i90917: Due to a different feature set for the system-dependent file pickers
// it's possible that generic code (e.g. sfx2) provides control ids
// (see ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR) which are NOT
// available on all platforms. This filter function should filter out control ids
// which are only available on KDE/GTK file pickers.
static bool filterControlCommand( sal_Int16 nControlId )
{
if ( nControlId == LISTBOX_FILTER_SELECTOR )
return true;
return false;
}
void SAL_CALL CWinFileOpenImpl::setValue(sal_Int16 aControlId, sal_Int16 aControlAction, const uno::Any& aValue)
throw(uno::RuntimeException)
{
OSL_ASSERT(m_FilePickerState);
m_FilePickerState->setValue(aControlId, aControlAction, aValue);
if ( !filterControlCommand( aControlId ))
m_FilePickerState->setValue(aControlId, aControlAction, aValue);
}
//-----------------------------------------------------------------------------------------
@ -331,7 +344,10 @@ uno::Any SAL_CALL CWinFileOpenImpl::getValue(sal_Int16 aControlId, sal_Int16 aCo
throw(uno::RuntimeException)
{
OSL_ASSERT(m_FilePickerState);
return m_FilePickerState->getValue(aControlId, aControlAction);
if ( !filterControlCommand( aControlId ))
return m_FilePickerState->getValue(aControlId, aControlAction);
else
return uno::Any();
}
//-----------------------------------------------------------------------------------------
@ -342,7 +358,8 @@ void SAL_CALL CWinFileOpenImpl::enableControl(sal_Int16 ControlID, sal_Bool bEna
throw(uno::RuntimeException)
{
OSL_ASSERT(m_FilePickerState);
m_FilePickerState->enableControl(ControlID, bEnable);
if ( !filterControlCommand( ControlID ))
m_FilePickerState->enableControl(ControlID, bEnable);
}
//-----------------------------------------------------------------------------------------
@ -352,7 +369,9 @@ void SAL_CALL CWinFileOpenImpl::enableControl(sal_Int16 ControlID, sal_Bool bEna
void SAL_CALL CWinFileOpenImpl::setLabel( sal_Int16 aControlId, const rtl::OUString& aLabel )
throw (uno::RuntimeException)
{
m_FilePickerState->setLabel(aControlId, aLabel);
OSL_ASSERT(m_FilePickerState);
if ( !filterControlCommand( aControlId ))
m_FilePickerState->setLabel(aControlId, aLabel);
}
//-----------------------------------------------------------------------------------------
@ -362,7 +381,11 @@ void SAL_CALL CWinFileOpenImpl::setLabel( sal_Int16 aControlId, const rtl::OUStr
rtl::OUString SAL_CALL CWinFileOpenImpl::getLabel( sal_Int16 aControlId )
throw (uno::RuntimeException)
{
return m_FilePickerState->getLabel(aControlId);
OSL_ASSERT(m_FilePickerState);
if ( !filterControlCommand( aControlId ))
return m_FilePickerState->getLabel(aControlId);
else
return rtl::OUString();
}
//-----------------------------------------------------------------------------------------

View File

@ -48,7 +48,6 @@
#pragma warning(pop)
#endif
#if defined _M_IX86
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64

View File

@ -307,7 +307,7 @@ void SAL_CALL CPreviewAdapterImpl::rearrangeLayout()
// style bit of the FileOpen dialog must be set after that
// message
LONG lStyle = GetWindowLong(prvwnd,GWL_STYLE);
sal_Bool bIsVisible = (sal_Bool)(lStyle & WS_VISIBLE);
bool bIsVisible = ((lStyle & WS_VISIBLE) != 0);
int cx = 0;

View File

@ -81,8 +81,6 @@ $(eval $(call gb_Library_add_exception_objects,fwe,\
framework/source/fwe/interaction/preventduplicateinteraction \
framework/source/fwe/xml/eventsconfiguration \
framework/source/fwe/xml/eventsdocumenthandler \
framework/source/fwe/xml/imagesconfiguration \
framework/source/fwe/xml/imagesdocumenthandler \
framework/source/fwe/xml/menuconfiguration \
framework/source/fwe/xml/menudocumenthandler \
framework/source/fwe/xml/saxnamespacefilter \

View File

@ -182,6 +182,8 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
framework/source/uifactory/windowcontentfactorymanager \
framework/source/xml/acceleratorconfigurationreader \
framework/source/xml/acceleratorconfigurationwriter \
framework/source/xml/imagesconfiguration \
framework/source/xml/imagesdocumenthandler \
))
# vim: set noet sw=4 ts=4:

View File

@ -39,7 +39,6 @@ $(eval $(call gb_Package_add_file,framework_inc,inc/framework/undomanagerhelper.
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/imutex.hxx,framework/imutex.hxx))
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/iguard.hxx,framework/iguard.hxx))
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/imageproducer.hxx,framework/imageproducer.hxx))
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/imagesconfiguration.hxx,framework/imagesconfiguration.hxx))
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/interaction.hxx,framework/interaction.hxx))
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/menuconfiguration.hxx,framework/menuconfiguration.hxx))
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/menuextensionsupplier.hxx,framework/menuextensionsupplier.hxx))

View File

@ -26,8 +26,8 @@
*
************************************************************************/
#ifndef __FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_
#define __FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_
#ifndef FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_
#define FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_
#include <framework/fwedllapi.h>
#include <svl/svarray.hxx>
@ -50,7 +50,7 @@ enum ImageMaskMode
ImageMaskMode_Bitmap
};
struct FWE_DLLPUBLIC ImageItemDescriptor
struct ImageItemDescriptor
{
ImageItemDescriptor() : nIndex( -1 ) {}
@ -58,7 +58,7 @@ struct FWE_DLLPUBLIC ImageItemDescriptor
long nIndex; // index of the bitmap inside the bitmaplist
};
struct FWE_DLLPUBLIC ExternalImageItemDescriptor
struct ExternalImageItemDescriptor
{
String aCommandURL; // URL command to dispatch
String aURL; // a URL to an external bitmap
@ -70,7 +70,7 @@ SV_DECL_PTRARR_DEL( ImageItemListDescriptor, ImageItemDescriptorPtr, 10, 2)
typedef ExternalImageItemDescriptor* ExternalImageItemDescriptorPtr;
SV_DECL_PTRARR_DEL( ExternalImageItemListDescriptor, ExternalImageItemDescriptorPtr, 10, 2)
struct FWE_DLLPUBLIC ImageListItemDescriptor
struct ImageListItemDescriptor
{
ImageListItemDescriptor() : nMaskMode( ImageMaskMode_Color ),
pImageItemList( 0 ) {}
@ -89,7 +89,7 @@ struct FWE_DLLPUBLIC ImageListItemDescriptor
typedef ImageListItemDescriptor* ImageListItemDescriptorPtr;
SV_DECL_PTRARR_DEL( ImageListDescriptor, ImageListItemDescriptorPtr, 10, 2)
struct FWE_DLLPUBLIC ImageListsDescriptor
struct ImageListsDescriptor
{
ImageListsDescriptor() : pImageList( 0 ),
pExternalImageList( 0 ) {}
@ -99,7 +99,7 @@ struct FWE_DLLPUBLIC ImageListsDescriptor
ExternalImageItemListDescriptor* pExternalImageList;
};
class FWE_DLLPUBLIC ImagesConfiguration
class ImagesConfiguration
{
public:
static sal_Bool LoadImages(

View File

@ -26,8 +26,8 @@
*
************************************************************************/
#ifndef __FRAMEWORK_XML_IMAGEDOCUMENTHANDLER_HXX_
#define __FRAMEWORK_XML_IMAGEDOCUMENTHANDLER_HXX_
#ifndef FRAMEWORK_XML_IMAGEDOCUMENTHANDLER_HXX_
#define FRAMEWORK_XML_IMAGEDOCUMENTHANDLER_HXX_
#include <framework/fwedllapi.h>
@ -40,7 +40,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
#include <framework/imagesconfiguration.hxx>
#include <xml/imagesconfiguration.hxx>
#include <threadhelp/threadhelpbase.hxx>
#include <rtl/ustring.hxx>
#include <cppuhelper/implbase1.hxx>
@ -58,7 +58,7 @@ namespace framework{
//*****************************************************************************************************************
// Hash code function for using in all hash maps of follow implementation.
class FWE_DLLPUBLIC OReadImagesDocumentHandler : private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
class OReadImagesDocumentHandler : private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler >
{
public:
@ -159,7 +159,7 @@ class FWE_DLLPUBLIC OReadImagesDocumentHandler : private ThreadHelpBase, // S
::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator;
};
class FWE_DLLPUBLIC OWriteImagesDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses.
class OWriteImagesDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses.
{
public:
OWriteImagesDocumentHandler(

View File

@ -58,6 +58,7 @@
#include <toolkit/unohlp.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
#include <rtl/string.hxx>
//_________________________________________________________________________________________________________________
// namespace
@ -338,7 +339,9 @@ void PersistentWindowState::implst_setWindowStateOnWindow(const css::uno::Refere
if (pWorkWindow->IsMinimized())
return;
pSystemWindow->SetWindowState(U2B_ENC(sWindowState,RTL_TEXTENCODING_UTF8));
::rtl::OUString sOldWindowState = ::rtl::OStringToOUString( pSystemWindow->GetWindowState(), RTL_TEXTENCODING_ASCII_US );
if ( sOldWindowState != sWindowState )
pSystemWindow->SetWindowState(U2B_ENC(sWindowState,RTL_TEXTENCODING_UTF8));
// <- SOLAR SAFE ------------------------
}

Some files were not shown because too many files have changed in this diff Show More