Files
libreoffice/dbaccess/source/core/dataaccess/documentdefinition.hxx
Rüdiger Timm 568af9ac86 CWS-TOOLING: integrate CWS dba31d
2008-12-08 16:22:07 +0100 rt  r265005 : Remove DOS lineends
2008-12-05 13:56:24 +0100 fs  r264906 : #i10000# removed unreachable statement
2008-11-20 11:41:26 +0100 fs  r264037 : merged in the fix for #i95865# (it was wrongly committed to CWS dba32a, should have been here)
2008-11-20 11:34:24 +0100 fs  r264036 : line ends
2008-11-14 08:44:50 +0100 lla  r263665 : #i10000# comparsion between int and uint fixed
2008-11-13 13:31:12 +0100 lla  r263641 : #i10000# build problem fixed
2008-11-13 11:20:01 +0100 lla  r263625 : #i96130# hard code name of extension
2008-11-12 11:13:41 +0100 fs  r263582 : #i96096# when opening a SRB-report fails due to the missing SRB extension, log this as warning only, and proceed with the migration
2008-11-12 11:11:35 +0100 fs  r263581 : #i96096# ContentType handling. Now all contents deliver proper results in XContent::getContentType
2008-11-12 11:10:11 +0100 fs  r263580 : #i96096# new ctors taking UNO_QUERY_THROW
2008-11-11 10:10:13 +0100 lla  r263546 : CWS-TOOLING: rebase CWS dba31d to trunk@263288 (milestone: DEV300:m35)
2008-11-06 15:55:39 +0100 oj  r263393 : #i93452# get field from model fallbackis the name
2008-11-06 15:31:47 +0100 oj  r263392 : #i93465# remeber location of floating windows
2008-11-06 13:36:24 +0100 oj  r263381 : #i93450# check typemap for null
2008-11-06 13:28:49 +0100 oj  r263379 : #i93020# empty column list boxes when new relation should be created
2008-11-06 12:33:53 +0100 oj  r263377 : #i93012# set border to default : flat
2008-11-06 12:26:54 +0100 oj  r263375 : #i74927# do some less calls for odbc
2008-11-06 09:34:01 +0100 oj  r263362 : #i93383# grabFocus in suspend to get allmodified cells
2008-11-03 21:01:39 +0100 oj  r263308 : #i86739# check if slash can be valid for tables
2008-11-03 14:40:21 +0100 oj  r263287 : #i86739# check if slash can be valid for tables
2008-11-03 14:32:17 +0100 oj  r263286 : #i95227# column width 
2008-11-03 14:27:26 +0100 oj  r263285 : link fwe
2008-11-03 14:24:54 +0100 oj  r263284 : #i95235# changed to hold no ref only weak
2008-10-31 11:21:48 +0100 oj  r262859 : #i93459# set images add menu entry
2008-10-31 09:06:37 +0100 oj  r262851 : #i88629# correct fileopen filter for database odb files
2008-10-30 15:01:04 +0100 oj  r262828 : #i95229# set filter at the composer
2008-10-29 15:57:41 +0100 oj  r262817 : #i95235# changed to hold no ref only weak
2008-10-29 15:57:19 +0100 oj  r262816 : #i95235# changed to hold no ref only weak
2008-10-29 15:57:03 +0100 oj  r262815 : #i95235# changed to hold no ref only weak
2008-10-29 15:56:15 +0100 oj  r262814 : #i95235# filtermanger changed to hold no ref only weak
2008-10-29 10:32:39 +0100 oj  r262773 : #i93474# use correct table name
2008-10-28 13:49:33 +0100 lla  r262744 : #i95524# make an Invalidate and refresh on Tables
2008-10-28 10:45:02 +0100 fs  r262707 : line ends
2008-10-28 10:34:42 +0100 fs  r262706 : #i95522# don't expect the component to live in a TopWindow
2008-10-28 08:30:40 +0100 lla  r262696 : #i93176# set preview mode on view
2008-10-28 07:56:57 +0100 oj  r262694 : merge cvs svn
2008-10-27 14:13:51 +0100 oj  r262673 : #i94129# use dummy data
2008-10-27 12:38:45 +0100 fs  r262669 : #i94125# rework ScrollColumns
2008-10-23 15:53:57 +0200 oj  r262624 : #i94568# do not load the embeddedobj just copy the storage
2008-10-23 14:39:14 +0200 oj  r262622 : #i94129# handle chart correctly
2008-10-22 10:51:19 +0200 lla  r262582 : #i94115# problem with left walk chart shape fixed
2008-10-22 07:47:48 +0200 oj  r262576 : #i94455# rename now do not use remove insert
2008-10-22 07:47:27 +0200 oj  r262575 : #i94455# rename now do not use remove insert
2008-10-21 12:46:26 +0200 lla  r262567 : #i93845# extra check if default schema doesn't exists, fix assertion
2008-12-09 07:25:38 +00:00

315 lines
13 KiB
C++

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: documentdefinition.hxx,v $
* $Revision: 1.28.6.4 $
*
* 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 _DBA_COREDATAACCESS_DOCUMENTDEFINITION_HXX_
#define _DBA_COREDATAACCESS_DOCUMENTDEFINITION_HXX_
#ifndef _CPPUHELPER_PROPSHLP_HXX
#include <cppuhelper/propshlp.hxx>
#endif
#ifndef _CPPUHELPER_IMPLBASE2_HXX_
#include <cppuhelper/implbase2.hxx>
#endif
#ifndef DBA_CONTENTHELPER_HXX
#include "ContentHelper.hxx"
#endif
#ifndef COMPHELPER_PROPERTYSTATECONTAINER_HXX
#include <comphelper/propertystatecontainer.hxx>
#endif
#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
#include <comphelper/proparrhlp.hxx>
#endif
#ifndef _DBASHARED_APITOOLS_HXX_
#include "apitools.hxx"
#endif
#ifndef _COMPHELPER_UNO3_HXX_
#include <comphelper/uno3.hxx>
#endif
#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
#include <com/sun/star/sdbc/XConnection.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
#include <com/sun/star/frame/XComponentLoader.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
#include <com/sun/star/frame/XController.hpp>
#endif
#ifndef _COM_SUN_STAR_EMBED_XSTATECHANGELISTENER_HPP_
#include <com/sun/star/embed/XStateChangeListener.hpp>
#endif
#include <com/sun/star/sdb/XSubDocument.hpp>
//........................................................................
namespace dbaccess
{
//........................................................................
class OInterceptor;
class OEmbeddedClientHelper;
//==========================================================================
//= ODocumentDefinition - a database "document" which is simply a link to a real
//= document
//==========================================================================
typedef ::cppu::ImplHelper2 < ::com::sun::star::embed::XComponentSupplier
, ::com::sun::star::sdb::XSubDocument
> ODocumentDefinition_Base;
class ODocumentDefinition
:public OContentHelper
,public ::comphelper::OPropertyStateContainer
,public ::comphelper::OPropertyArrayUsageHelper< ODocumentDefinition >
,public ODocumentDefinition_Base
{
::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject> m_xEmbeddedObject;
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener > m_xListener;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier > m_xDesktop;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xLastKnownConnection;
OInterceptor* m_pInterceptor;
sal_Bool m_bForm; // <TRUE/> if it is a form
sal_Bool m_bOpenInDesign;
sal_Bool m_bInExecute;
OEmbeddedClientHelper* m_pClientHelper;
protected:
virtual ~ODocumentDefinition();
public:
ODocumentDefinition(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContainer
,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
,const TContentPtr& _pImpl
,sal_Bool _bForm
,const ::com::sun::star::uno::Sequence< sal_Int8 >& _aClassID = ::com::sun::star::uno::Sequence< sal_Int8 >()
,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>()
);
// com::sun::star::lang::XTypeProvider
DECLARE_TYPEPROVIDER( );
// ::com::sun::star::uno::XInterface
DECLARE_XINTERFACE( )
// ::com::sun::star::lang::XServiceInfo
DECLARE_SERVICE_INFO_STATIC();
// ::com::sun::star::beans::XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
// XComponentSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent( ) throw (::com::sun::star::uno::RuntimeException);
// XSubDocument
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL open( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL openDesign( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL store( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL close( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
// OPropertySetHelper
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
// XCommandProcessor
virtual ::com::sun::star::uno::Any SAL_CALL execute( const ::com::sun::star::ucb::Command& aCommand, sal_Int32 CommandId, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& Environment ) throw (::com::sun::star::uno::Exception, ::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::RuntimeException) ;
// XRename
virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
/** returns the forms/reports container storage, depending on m_bForm. Our own storage
inside this container storage is the one with the name as indicated by m_pImpl->m_aProps.sPersistentName.
*/
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
getContainerStorage() const;
sal_Bool save(sal_Bool _bApprove);
sal_Bool saveAs();
void closeObject();
sal_Bool isModified();
void fillReportData(::osl::ClearableMutexGuard & _aGuard);
inline sal_Bool isNewReport() const { return !m_bForm && !m_pImpl->m_aProps.bAsTemplate; }
/** prepares closing the document component
The method suspends the controller associated with the document, and saves the document
if necessary.
@return
<TRUE/> if and only if the document component can be closed
*/
bool prepareClose();
static ::com::sun::star::uno::Sequence< sal_Int8 > getDefaultDocumentTypeClassId();
static ::rtl::OUString GetDocumentServiceFromMediaType(
const ::rtl::OUString& _rMediaType,
const ::comphelper::ComponentContext& _rContext,
::com::sun::star::uno::Sequence< sal_Int8 >& _rClassId
);
static ::rtl::OUString GetDocumentServiceFromMediaType(
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxContainerStorage,
const ::rtl::OUString& _rEntityName,
const ::comphelper::ComponentContext& _rContext,
::com::sun::star::uno::Sequence< sal_Int8 >& _rClassId
);
private:
/** does necessary initializations after our embedded object has been switched to ACTIVE
@param _bOpenedInDesignMode
determines whether the embedded object has been opened for designing it or for data display
*/
void impl_onActivateEmbeddedObject();
/** initializes a newly created view/controller which is displaying our embedded object
Has only to be called if the respective embedded object has been loaded for design (and
not for data entry)
@param _rxController
the controller which belongs to the XModel of our (active) embedded object
*/
void impl_initObjectEditView( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& _rxController );
/** removes the given frame from the desktop's frame collection
@raises ::com::sun::star::uno::RuntimeException
*/
void impl_removeFrameFromDesktop_throw( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame );
/** opens the UI for this sub document
*/
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
impl_openUI_nolck_throw( bool _bForEditing );
/** stores our document, if it's already loaded
*/
void
impl_store_throw();
/** closes our document, if it's open
*/
bool
impl_close_throw();
private:
// OPropertyArrayUsageHelper
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const;
// helper
virtual void SAL_CALL disposing();
// OContentHelper overridables
virtual ::rtl::OUString determineContentType() const;
private:
/** fills the load arguments
*/
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
fillLoadArgs(
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
const bool _bSuppressMacros,
const bool _bReadOnly,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rAdditionalArgs,
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _out_rEmbeddedObjectDescriptor
);
/** loads the EmbeddedObject if not already loaded
@param _aClassID
If set, it will be used to create the embedded object.
*/
void loadEmbeddedObject(
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
const ::com::sun::star::uno::Sequence< sal_Int8 >& _aClassID,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rAdditionalArgs,
const bool _bSuppressMacros,
const bool _bReadOnly
);
/** loads the embedded object, if not already loaded. No new object can be created with this method.
*/
void loadEmbeddedObject( bool _bSuppressMacros = false )
{
loadEmbeddedObject(
NULL,
::com::sun::star::uno::Sequence< sal_Int8 >(),
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(),
_bSuppressMacros,
false
);
}
/** loads the embedded object for preview. Macros will be suppressed, and the document will
be read-only.
*/
void loadEmbeddedObjectForPreview()
{
loadEmbeddedObject(
NULL,
::com::sun::star::uno::Sequence< sal_Int8 >(),
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(),
true,
true
);
}
/** searches for read-only flag in the args of the model and sets it to the given value,
if the value was not found, it will be appended.
@param _bReadOnly
If <TRUE/> the document will be switched to readonly mode
*/
void updateDocumentTitle();
void registerProperties();
/** determines whether the document we represent supports embedded scripts and macros
*/
sal_Bool objectSupportsEmbeddedScripts() const;
//-------------------------------------------------------------------------
//- commands
//-------------------------------------------------------------------------
void onCommandGetDocumentProperties( ::com::sun::star::uno::Any& _rProps );
void onCommandInsert( const ::rtl::OUString& _sURL, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& Environment ) throw( ::com::sun::star::uno::Exception );
void onCommandPreview( ::com::sun::star::uno::Any& _rImage );
void onCommandOpenSomething( const ::com::sun::star::uno::Any& _rArgument, const bool _bActivate,
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& _rxEnvironment,
::com::sun::star::uno::Any& _out_rComponent,
::osl::ClearableMutexGuard & _aClearableGuard);
};
//........................................................................
} // namespace dbaccess
//........................................................................
#endif // _DBA_COREDATAACCESS_DOCUMENTDEFINITION_HXX_