diff --git a/connectivity/inc/connectivity/DriversConfig.hxx b/connectivity/inc/connectivity/DriversConfig.hxx index bd86e9ce4397..da68443bb68e 100755 --- a/connectivity/inc/connectivity/DriversConfig.hxx +++ b/connectivity/inc/connectivity/DriversConfig.hxx @@ -1,92 +1,95 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: makefile,v $ - * - * $Revision: 1.1 $ - * - * last change: $Author: st $ $Date: 2000/11/22 02:32:00 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED -#define CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED - -#include -#include -#include -#include -#include "connectivity/dbtoolsdllapi.hxx" -#include -#include -#include - -namespace connectivity -{ - typedef struct - { - ::comphelper::NamedValueCollection aProperties; - ::comphelper::NamedValueCollection aFeatures; - ::comphelper::NamedValueCollection aMetaData; - ::rtl::OUString sDriverFactory; - ::rtl::OUString sDriverTypeDisplayName; - } TInstalledDriver; - DECLARE_STL_USTRINGACCESS_MAP( TInstalledDriver, TInstalledDrivers); - +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: makefile,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: st $ $Date: 2000/11/22 02:32:00 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED +#define CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED + +#include +#include +#include +#include +#include "connectivity/dbtoolsdllapi.hxx" +#include +#include +#include + +namespace connectivity +{ + typedef struct + { + ::comphelper::NamedValueCollection aProperties; + ::comphelper::NamedValueCollection aFeatures; + ::comphelper::NamedValueCollection aMetaData; + ::rtl::OUString sDriverFactory; + ::rtl::OUString sDriverTypeDisplayName; + } TInstalledDriver; + DECLARE_STL_USTRINGACCESS_MAP( TInstalledDriver, TInstalledDrivers); + class DriversConfigImpl { - ::utl::OConfigurationTreeRoot m_aInstalled; + mutable ::utl::OConfigurationTreeRoot m_aInstalled; + mutable TInstalledDrivers m_aDrivers; + void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) const; public: DriversConfigImpl(); - void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,TInstalledDrivers& _rDrivers); - }; - // - // Allows to access all driver which are located in the configuration - // - class OOO_DLLPUBLIC_DBTOOLS DriversConfig - { - typedef salhelper::SingletonRef OSharedConfigNode; - - const ::comphelper::NamedValueCollection& impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const; - public: - DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); - ~DriversConfig(); - - DriversConfig( const DriversConfig& ); - DriversConfig& operator=( const DriversConfig& ); - - ::rtl::OUString getDriverFactoryName(const ::rtl::OUString& _sUrl) const; - ::rtl::OUString getDriverTypeDisplayName(const ::rtl::OUString& _sUrl) const; - const ::comphelper::NamedValueCollection& getProperties(const ::rtl::OUString& _sURL) const; - const ::comphelper::NamedValueCollection& getFeatures(const ::rtl::OUString& _sURL) const; - const ::comphelper::NamedValueCollection& getMetaData(const ::rtl::OUString& _sURL) const; - ::com::sun::star::uno::Sequence< ::rtl::OUString > getURLs() const; - private: - TInstalledDrivers m_aDrivers; - OSharedConfigNode m_aNode; - }; -} -#endif // CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED + + const TInstalledDrivers& getInstalledDrivers(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) const { Load(_rxORB); return m_aDrivers; } + }; + // + // Allows to access all driver which are located in the configuration + // + class OOO_DLLPUBLIC_DBTOOLS DriversConfig + { + typedef salhelper::SingletonRef OSharedConfigNode; + + const ::comphelper::NamedValueCollection& impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const; + public: + DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + ~DriversConfig(); + + DriversConfig( const DriversConfig& ); + DriversConfig& operator=( const DriversConfig& ); + + ::rtl::OUString getDriverFactoryName(const ::rtl::OUString& _sUrl) const; + ::rtl::OUString getDriverTypeDisplayName(const ::rtl::OUString& _sUrl) const; + const ::comphelper::NamedValueCollection& getProperties(const ::rtl::OUString& _sURL) const; + const ::comphelper::NamedValueCollection& getFeatures(const ::rtl::OUString& _sURL) const; + const ::comphelper::NamedValueCollection& getMetaData(const ::rtl::OUString& _sURL) const; + ::com::sun::star::uno::Sequence< ::rtl::OUString > getURLs() const; + private: + OSharedConfigNode m_aNode; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + }; +} +#endif // CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED diff --git a/connectivity/inc/connectivity/dbmetadata.hxx b/connectivity/inc/connectivity/dbmetadata.hxx index 32662c5c157a..1ee1718247ae 100644 --- a/connectivity/inc/connectivity/dbmetadata.hxx +++ b/connectivity/inc/connectivity/dbmetadata.hxx @@ -177,6 +177,12 @@ namespace dbtools /** determines whether in the application UI, empty table folders (aka catalogs/schemas) should be displayed */ bool displayEmptyTableFolders() const; + + /** determines that threads are supported. + * + * \return when threads are supported, otherwise + */ + bool supportsThreads() const; }; //........................................................................ diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx index a72816d6427b..30c822b6f169 100755 --- a/connectivity/source/commontools/DriversConfig.cxx +++ b/connectivity/source/commontools/DriversConfig.cxx @@ -112,32 +112,35 @@ DriversConfigImpl::DriversConfigImpl() { } // ----------------------------------------------------------------------------- -void DriversConfigImpl::Load(const uno::Reference< lang::XMultiServiceFactory >& _rxORB,TInstalledDrivers& _rDrivers) +void DriversConfigImpl::Load(const uno::Reference< lang::XMultiServiceFactory >& _rxORB) const { - if ( !m_aInstalled.isValid() ) + if ( m_aDrivers.empty() ) { - static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess.Drivers/Installed")); ///Installed - m_aInstalled = ::utl::OConfigurationTreeRoot::createWithServiceFactory(_rxORB, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY); - } - - if ( m_aInstalled.isValid() ) - { - const uno::Sequence< ::rtl::OUString > aURLPatterns = m_aInstalled.getNodeNames(); - const ::rtl::OUString* pPatternIter = aURLPatterns.getConstArray(); - const ::rtl::OUString* pPatternEnd = pPatternIter + aURLPatterns.getLength(); - for (;pPatternIter != pPatternEnd ; ++pPatternIter) + if ( !m_aInstalled.isValid() ) { - TInstalledDriver aInstalledDriver; - lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver); - if ( aInstalledDriver.sDriverFactory.getLength() ) - _rDrivers.insert(TInstalledDrivers::value_type(*pPatternIter,aInstalledDriver)); + static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess.Drivers/Installed")); ///Installed + m_aInstalled = ::utl::OConfigurationTreeRoot::createWithServiceFactory(_rxORB, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY); } + + if ( m_aInstalled.isValid() ) + { + const uno::Sequence< ::rtl::OUString > aURLPatterns = m_aInstalled.getNodeNames(); + const ::rtl::OUString* pPatternIter = aURLPatterns.getConstArray(); + const ::rtl::OUString* pPatternEnd = pPatternIter + aURLPatterns.getLength(); + for (;pPatternIter != pPatternEnd ; ++pPatternIter) + { + TInstalledDriver aInstalledDriver; + lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver); + if ( aInstalledDriver.sDriverFactory.getLength() ) + m_aDrivers.insert(TInstalledDrivers::value_type(*pPatternIter,aInstalledDriver)); + } + } // if ( m_aInstalled.isValid() ) } } // ----------------------------------------------------------------------------- DriversConfig::DriversConfig(const uno::Reference< lang::XMultiServiceFactory >& _rxORB) +:m_xORB(_rxORB) { - m_aNode->Load(_rxORB,m_aDrivers); } // ----------------------------------------------------------------------------- @@ -156,7 +159,6 @@ DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs ) { if ( this != &_rhs ) { - m_aDrivers = _rhs.m_aDrivers; m_aNode = _rhs.m_aNode; } return *this; @@ -165,10 +167,11 @@ DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs ) // ----------------------------------------------------------------------------- ::rtl::OUString DriversConfig::getDriverFactoryName(const ::rtl::OUString& _sURL) const { + const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); ::rtl::OUString sRet; ::rtl::OUString sOldPattern; - TInstalledDrivers::const_iterator aIter = m_aDrivers.begin(); - TInstalledDrivers::const_iterator aEnd = m_aDrivers.end(); + TInstalledDrivers::const_iterator aIter = rDrivers.begin(); + TInstalledDrivers::const_iterator aEnd = rDrivers.end(); for(;aIter != aEnd;++aIter) { WildCard aWildCard(aIter->first); @@ -184,10 +187,11 @@ DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs ) // ----------------------------------------------------------------------------- ::rtl::OUString DriversConfig::getDriverTypeDisplayName(const ::rtl::OUString& _sURL) const { + const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); ::rtl::OUString sRet; ::rtl::OUString sOldPattern; - TInstalledDrivers::const_iterator aIter = m_aDrivers.begin(); - TInstalledDrivers::const_iterator aEnd = m_aDrivers.end(); + TInstalledDrivers::const_iterator aIter = rDrivers.begin(); + TInstalledDrivers::const_iterator aEnd = rDrivers.end(); for(;aIter != aEnd;++aIter) { WildCard aWildCard(aIter->first); @@ -218,10 +222,11 @@ const ::comphelper::NamedValueCollection& DriversConfig::getMetaData(const ::rtl // ----------------------------------------------------------------------------- const ::comphelper::NamedValueCollection& DriversConfig::impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const { + const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); const ::comphelper::NamedValueCollection* pRet = NULL; ::rtl::OUString sOldPattern; - TInstalledDrivers::const_iterator aIter = m_aDrivers.begin(); - TInstalledDrivers::const_iterator aEnd = m_aDrivers.end(); + TInstalledDrivers::const_iterator aIter = rDrivers.begin(); + TInstalledDrivers::const_iterator aEnd = rDrivers.end(); for(;aIter != aEnd;++aIter) { WildCard aWildCard(aIter->first); @@ -252,10 +257,11 @@ const ::comphelper::NamedValueCollection& DriversConfig::impl_get(const ::rtl::O // ----------------------------------------------------------------------------- uno::Sequence< ::rtl::OUString > DriversConfig::getURLs() const { - uno::Sequence< ::rtl::OUString > aRet(m_aDrivers.size()); + const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); + uno::Sequence< ::rtl::OUString > aRet(rDrivers.size()); ::rtl::OUString* pIter = aRet.getArray(); - TInstalledDrivers::const_iterator aIter = m_aDrivers.begin(); - TInstalledDrivers::const_iterator aEnd = m_aDrivers.end(); + TInstalledDrivers::const_iterator aIter = rDrivers.begin(); + TInstalledDrivers::const_iterator aEnd = rDrivers.end(); for(;aIter != aEnd;++aIter,++pIter) { *pIter = aIter->first; diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx index 70220b1cd563..c5b65a9d113b 100644 --- a/connectivity/source/commontools/dbmetadata.cxx +++ b/connectivity/source/commontools/dbmetadata.cxx @@ -407,6 +407,22 @@ namespace dbtools #endif return doDisplay; } + //-------------------------------------------------------------------- + bool DatabaseMetaData::supportsThreads() const + { + bool bSupported( true ); + try + { + Reference< XDatabaseMetaData > xMeta( m_pImpl->xConnectionMetaData, UNO_SET_THROW ); + ::rtl::OUString sConnectionURL( xMeta->getURL() ); + bSupported = sConnectionURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "sdbc:mysql:mysqlc" ) ) != 0; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return bSupported; + } //........................................................................ } // namespace dbtools diff --git a/connectivity/source/drivers/jdbc/jdbc.xcu b/connectivity/source/drivers/jdbc/jdbc.xcu index 73fe2e9adc55..ae1bbad227e7 100755 --- a/connectivity/source/drivers/jdbc/jdbc.xcu +++ b/connectivity/source/drivers/jdbc/jdbc.xcu @@ -174,7 +174,7 @@ - false + true diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx index 27359ebf9738..87a1de55ec0a 100644 --- a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx +++ b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx @@ -65,6 +65,8 @@ namespace sdr { namespace contact { ::rtl::Reference< ViewObjectContactOfUnoControl_Impl > m_pImpl; public: + ViewObjectContactOfUnoControl( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); + /// determines whether an XControl already exists, and is currently visible bool isControlVisible() const; @@ -98,7 +100,6 @@ namespace sdr { namespace contact { virtual void ActionChanged(); protected: - ViewObjectContactOfUnoControl( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); ~ViewObjectContactOfUnoControl(); // support for Primitive2D @@ -110,36 +111,6 @@ namespace sdr { namespace contact { ViewObjectContactOfUnoControl& operator=( const ViewObjectContactOfUnoControl& ); // never implemented }; - //==================================================================== - //= UnoControlDefaultContact - //==================================================================== - class SVX_DLLPRIVATE UnoControlDefaultContact : public ViewObjectContactOfUnoControl - { - public: - UnoControlDefaultContact( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); - ~UnoControlDefaultContact(); - - private: - UnoControlDefaultContact(); // never implemented - UnoControlDefaultContact( const UnoControlDefaultContact& ); // never implemented - UnoControlDefaultContact& operator=( const UnoControlDefaultContact& ); // never implemented - }; - - //==================================================================== - //= UnoControlWindowContact - //==================================================================== - class SVX_DLLPRIVATE UnoControlWindowContact : public ViewObjectContactOfUnoControl - { - public: - UnoControlWindowContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); - ~UnoControlWindowContact(); - - private: - UnoControlWindowContact(); // never implemented - UnoControlWindowContact( const UnoControlWindowContact& ); // never implemented - UnoControlWindowContact& operator=( const UnoControlWindowContact& ); // never implemented - }; - //==================================================================== //= UnoControlPrintOrPreviewContact //==================================================================== @@ -157,21 +128,6 @@ namespace sdr { namespace contact { virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo ) const; }; - //==================================================================== - //= UnoControlPDFExportContact - //==================================================================== - class SVX_DLLPRIVATE UnoControlPDFExportContact : public ViewObjectContactOfUnoControl - { - public: - UnoControlPDFExportContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); - ~UnoControlPDFExportContact(); - - private: - UnoControlPDFExportContact(); // never implemented - UnoControlPDFExportContact( const UnoControlPDFExportContact& ); // never implemented - UnoControlPDFExportContact& operator=( const UnoControlPDFExportContact& ); // never implemented - }; - //........................................................................ } } // namespace sdr::contact //........................................................................ diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index f53168a273ac..afff309168ac 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -763,12 +763,18 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType ) Fraction aZoom = GetZoom(); // not all of these controls need to know the new zoom, but to be sure ... - Font aFont( IsControlFont() ? GetControlFont() : GetPointFont()); + Font aFont( GetSettings().GetStyleSettings().GetFieldFont() ); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) { pWindows[i]->SetZoom(aZoom); pWindows[i]->SetZoomedPointFont(aFont); } + + SetZoomedPointFont( aFont ); + // rearrange the controls m_nDefaultWidth = ArrangeControls(); } @@ -1075,18 +1081,13 @@ void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat ) { if ( m_bNavigationBar ) { - m_aBar.SetZoom( GetZoom() ); - Font aFont = m_aBar.GetSettings().GetStyleSettings().GetFieldFont(); if ( IsControlFont() ) - { m_aBar.SetControlFont( GetControlFont() ); - aFont.Merge( GetControlFont() ); - } else m_aBar.SetControlFont(); - m_aBar.SetZoomedPointFont( aFont ); + m_aBar.SetZoom( GetZoom() ); } } diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 10c0978288a6..fc7f1aa78558 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -101,6 +101,7 @@ namespace svx //==================================================================== static SfxSlotId pTextControlSlots[] = { + SID_CLIPBOARD_FORMAT_ITEMS, SID_CUT, SID_COPY, SID_PASTE, @@ -140,7 +141,6 @@ namespace svx // SID_TEXTDIRECTION_TOP_TO_BOTTOM, SID_ATTR_CHAR_SCALEWIDTH, /* 911 */ SID_ATTR_CHAR_RELIEF, - SID_CLIPBOARD_FORMAT_ITEMS, /* 922 */ SID_ATTR_PARA_LEFT_TO_RIGHT, /* 950 */ SID_ATTR_PARA_RIGHT_TO_LEFT, 0 diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx index 9d6548a1b791..7bea25feeeed 100644 --- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx @@ -121,36 +121,18 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- ViewObjectContact& ViewContactOfUnoControl::CreateObjectSpecificViewObjectContact( ObjectContact& _rObjectContact ) { + // print or print preview requires special handling + const OutputDevice* pDevice = _rObjectContact.TryToGetOutputDevice(); + bool bPrintOrPreview = ( pDevice != NULL ) && ( pDevice->GetOutDevType() == OUTDEV_PRINTER ); + ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &_rObjectContact ); - if ( pPageViewContact ) - { - // special classes for special devices: - // - PDF export - ::vcl::PDFExtOutDevData* pPDFExport = PTR_CAST( ::vcl::PDFExtOutDevData, pPageViewContact->GetPageWindow().GetPaintWindow().GetOutputDevice().GetExtOutDevData() ); - if ( pPDFExport != NULL ) - return *new UnoControlPDFExportContact( *pPageViewContact, *this ); + bPrintOrPreview |= ( pPageViewContact != NULL ) && pPageViewContact->GetPageWindow().GetPageView().GetView().IsPrintPreview(); - // - print preview - if ( pPageViewContact->GetPageWindow().GetPageView().GetView().IsPrintPreview() ) - return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this ); + if ( bPrintOrPreview ) + return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this ); - OutDevType eDeviceType = pPageViewContact->GetPageWindow().GetPaintWindow().GetOutputDevice().GetOutDevType(); - // - printing - if ( eDeviceType == OUTDEV_PRINTER ) - return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this ); - - // - any other virtual device - if ( eDeviceType == OUTDEV_VIRDEV ) - return *new UnoControlDefaultContact( *pPageViewContact, *this ); - - // - normal windows have special, design-mode dependent handling - if ( eDeviceType == OUTDEV_WINDOW ) - return *new UnoControlWindowContact( *pPageViewContact, *this ); - } - - // if we're not working for a ObjectContactOfPageView, then we can't use a ViewObjectContactOfUnoControl, or any - // of its derivees. Fall back to a "normal" SdrObj's contact object. - return *new ViewObjectContactOfSdrObj( _rObjectContact, *this ); + // all others are nowadays served by the same implementation + return *new ViewObjectContactOfUnoControl( _rObjectContact, *this ); } //-------------------------------------------------------------------- @@ -173,7 +155,7 @@ namespace sdr { namespace contact { aTransform.set(0, 2, aRange.getMinX()); aTransform.set(1, 2, aRange.getMinY()); - // create control primitive WITHOUT evtl. existing XControl; this would be done in + // create control primitive WITHOUT possibly existing XControl; this would be done in // the VOC in createPrimitive2DSequence() const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::ControlPrimitive2D( aTransform, xControlModel)); diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 667129e27653..bbfe3eaf65ab 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -402,7 +402,7 @@ namespace sdr { namespace contact { //= InvisibleControlViewAccess //==================================================================== /** is a ->IPageViewAccess implementation which can be used to create an invisble control for - an arbitrary device + an arbitrary window */ class InvisibleControlViewAccess : public IPageViewAccess { @@ -445,6 +445,47 @@ namespace sdr { namespace contact { return false; } + //==================================================================== + //= DummyPageViewAccess + //==================================================================== + /** is a ->IPageViewAccess implementation which can be used to create a control for an arbitrary + non-Window device + + The implementation will report the "PageView" as being in design mode, all layers to be visible, + and will not return any ControlContainer, so all control container related features (notifications etc) + are not available. + */ + class DummyPageViewAccess : public IPageViewAccess + { + public: + DummyPageViewAccess() + { + } + + virtual bool isDesignMode() const; + virtual Reference< XControlContainer > + getControlContainer( const OutputDevice& _rDevice ) const; + virtual bool isLayerVisible( SdrLayerID _nLayerID ) const; + }; + + //-------------------------------------------------------------------- + bool DummyPageViewAccess::isDesignMode() const + { + return true; + } + + //-------------------------------------------------------------------- + Reference< XControlContainer > DummyPageViewAccess::getControlContainer( const OutputDevice& /*_rDevice*/ ) const + { + return NULL; + } + + //-------------------------------------------------------------------- + bool DummyPageViewAccess::isLayerVisible( SdrLayerID /*_nLayerID*/ ) const + { + return true; + } + //==================================================================== //= ViewObjectContactOfUnoControl_Impl //==================================================================== @@ -763,8 +804,9 @@ namespace sdr { namespace contact { This method cares for this, by retrieving the very original OutputDevice. */ - static const OutputDevice& imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ); - const OutputDevice& imp_getPageViewDevice_nothrow() const; + static const OutputDevice& impl_getPageViewOutputDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ); + + const OutputDevice& impl_getOutputDevice_throw() const; private: ViewObjectContactOfUnoControl_Impl(); // never implemented @@ -828,6 +870,13 @@ namespace sdr { namespace contact { static void getTransformation( const ViewContactOfUnoControl& _rVOC, ::basegfx::B2DHomMatrix& _out_Transformation ); + private: + void impl_positionAndZoomControl( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const + { + if ( !_rViewInformation.getViewport().isEmpty() ) + m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() ); + } + private: ::rtl::Reference< ViewObjectContactOfUnoControl_Impl > m_pVOCImpl; /** The geometry is part of the identity of an primitive, so we cannot calculate it on demand @@ -854,9 +903,15 @@ namespace sdr { namespace contact { DBG_CTOR( ViewObjectContactOfUnoControl_Impl, NULL ); DBG_ASSERT( m_pAntiImpl, "ViewObjectContactOfUnoControl_Impl::ViewObjectContactOfUnoControl_Impl: invalid AntiImpl!" ); - const OutputDevice& rPageViewDevice( imp_getPageViewDevice_nothrow() ); + const OutputDevice& rPageViewDevice( impl_getOutputDevice_throw() ); m_aZoomLevelNormalization = rPageViewDevice.GetInverseViewTransformation(); + #if OSL_DEBUG_LEVEL > 1 + ::basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + m_aZoomLevelNormalization.decompose( aScale, aTranslate, fRotate, fShearX ); + #endif + ::basegfx::B2DHomMatrix aScaleNormalization; MapMode aCurrentDeviceMapMode( rPageViewDevice.GetMapMode() ); aScaleNormalization.set( 0, 0, (double)aCurrentDeviceMapMode.GetScaleX() ); @@ -953,27 +1008,40 @@ namespace sdr { namespace contact { return false; ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() ); - DBG_ASSERT( pPageViewContact, "ViewObjectContactOfUnoControl_Impl::ensureControl: cannot create a control if I don't have a PageView!" ); - if ( !pPageViewContact ) - return false; + if ( pPageViewContact ) + { + SdrPageViewAccess aPVAccess( pPageViewContact->GetPageWindow().GetPageView() ); + return impl_ensureControl_nothrow( + aPVAccess, + impl_getPageViewOutputDevice_nothrow( *pPageViewContact ) + ); + } - SdrPageViewAccess aPVAccess( pPageViewContact->GetPageWindow().GetPageView() ); + DummyPageViewAccess aNoPageView; return impl_ensureControl_nothrow( - aPVAccess, - imp_getPageViewDevice_nothrow( *pPageViewContact ) + aNoPageView, + impl_getOutputDevice_throw() ); } //-------------------------------------------------------------------- - const OutputDevice& ViewObjectContactOfUnoControl_Impl::imp_getPageViewDevice_nothrow() const + const OutputDevice& ViewObjectContactOfUnoControl_Impl::impl_getOutputDevice_throw() const { ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() ); - ENSURE_OR_THROW( pPageViewContact, "need a ObjectContactOfPageView." ); - return imp_getPageViewDevice_nothrow( *pPageViewContact ); + if ( pPageViewContact ) + { + // do not use ObjectContact::TryToGetOutputDevice here, it would not care for the PageWindow's + // OriginalPaintWindow + return impl_getPageViewOutputDevice_nothrow( *pPageViewContact ); + } + + const OutputDevice* pDevice = m_pAntiImpl->GetObjectContact().TryToGetOutputDevice(); + ENSURE_OR_THROW( pDevice, "no output device -> no control" ); + return *pDevice; } //-------------------------------------------------------------------- - const OutputDevice& ViewObjectContactOfUnoControl_Impl::imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ) + const OutputDevice& ViewObjectContactOfUnoControl_Impl::impl_getPageViewOutputDevice_nothrow( const ObjectContactOfPageView& _rObjectContact ) { // if the PageWindow has a patched PaintWindow, use the original PaintWindow // this ensures that our control is _not_ re-created just because somebody @@ -1522,18 +1590,28 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::get2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const { + #if OSL_DEBUG_LEVEL > 1 + ::basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + _rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX ); + #endif if ( m_pVOCImpl->hasControl() ) - m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() ); + impl_positionAndZoomControl( _rViewInformation ); return BasePrimitive2D::get2DDecomposition( _rViewInformation ); } //-------------------------------------------------------------------- ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::createLocalDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const { + #if OSL_DEBUG_LEVEL > 1 + ::basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + _rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX ); + #endif // force control here to make it a VCL ChildWindow. Will be fetched // and used below by getExistentControl() m_pVOCImpl->ensureControl(); - m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() ); + impl_positionAndZoomControl( _rViewInformation ); // get needed data const ViewContactOfUnoControl& rViewContactOfUnoControl( m_pVOCImpl->getViewContact() ); @@ -1703,40 +1781,6 @@ namespace sdr { namespace contact { } } - //==================================================================== - //= UnoControlDefaultContact - //==================================================================== - DBG_NAME( UnoControlDefaultContact ) - //-------------------------------------------------------------------- - UnoControlDefaultContact::UnoControlDefaultContact( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact ) - :ViewObjectContactOfUnoControl( _rObjectContact, _rViewContact ) - { - DBG_CTOR( UnoControlDefaultContact, NULL ); - } - - //-------------------------------------------------------------------- - UnoControlDefaultContact::~UnoControlDefaultContact() - { - DBG_DTOR( UnoControlDefaultContact, NULL ); - } - - //==================================================================== - //= UnoControlWindowContact - //==================================================================== - DBG_NAME( UnoControlWindowContact ) - //-------------------------------------------------------------------- - UnoControlWindowContact::UnoControlWindowContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact ) - :ViewObjectContactOfUnoControl( _rObjectContact, _rViewContact ) - { - DBG_CTOR( UnoControlWindowContact, NULL ); - } - - //-------------------------------------------------------------------- - UnoControlWindowContact::~UnoControlWindowContact() - { - DBG_DTOR( UnoControlWindowContact, NULL ); - } - //==================================================================== //= UnoControlPrintOrPreviewContact //==================================================================== @@ -1762,23 +1806,6 @@ namespace sdr { namespace contact { return ViewObjectContactOfUnoControl::createPrimitive2DSequence( rDisplayInfo ); } - //==================================================================== - //= UnoControlPDFExportContact - //==================================================================== - DBG_NAME( UnoControlPDFExportContact ) - //-------------------------------------------------------------------- - UnoControlPDFExportContact::UnoControlPDFExportContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact ) - :ViewObjectContactOfUnoControl( _rObjectContact, _rViewContact ) - { - DBG_CTOR( UnoControlPDFExportContact, NULL ); - } - - //-------------------------------------------------------------------- - UnoControlPDFExportContact::~UnoControlPDFExportContact() - { - DBG_DTOR( UnoControlPDFExportContact, NULL ); - } - //........................................................................ } } // namespace sdr::contact //........................................................................