From df3e716b3c4313d9c495c64aa7d84082fb9596e7 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Wed, 21 Jan 2009 15:28:14 +0000 Subject: [PATCH] CWS-TOOLING: integrate CWS fwk95 2009-01-15 13:24:14 +0100 cd r266366 : #i96390# Change method name to use UNO AWT style for mnemonics 2009-01-15 13:23:30 +0100 cd r266365 : #i96390# Change method name to use UNO AWT style for mnemonics 2009-01-12 17:25:13 +0100 cd r266174 : #i97983# Check pointer returned by dynamic_cast 2009-01-12 15:31:40 +0100 cd r266162 : #i97983# Create toolkit popup menus via service manager instead of implementation class 2008-12-11 15:04:34 +0100 cd r265305 : #i95863# Remove user defined properties 2008-12-11 14:56:45 +0100 cd r265302 : #i95606# Update documentation for textfields 2008-12-11 10:06:20 +0100 cd r265250 : #i96390# Fix warning on Solaris compiler 2008-12-09 17:27:32 +0100 cd r265119 : CWS-TOOLING: rebase CWS fwk95 to trunk@264807 (milestone: DEV300:m37) 2008-12-01 13:29:43 +0100 cd r264597 : #i96390# New interfaces and structures for complete UNO AWT menu API 2008-12-01 13:25:22 +0100 cd r264596 : #i96390# Added implementation of the new UNO AWT interfaces and structures for menus 2008-11-28 13:55:19 +0100 cd r264553 : #i96640# Fixed wrong property type for MenuBarCloser 2008-11-28 13:53:56 +0100 cd r264552 : #i96621# Fixed ambiguous usage of && and || 2008-11-18 16:05:45 +0100 cd r263781 : #i95316# Initialize SvtTabAppearanceCfg to enable system settings changed notiifcation code 2008-11-18 16:05:43 +0100 cd r263780 : #i96155# Fix wrong statement to check for enabled argument 2008-10-20 16:54:37 +0200 cd r262328 : #i10000# migrate CWS fwk95 to SVN. --- desktop/source/app/app.cxx | 2 +- desktop/source/offacc/acceptor.cxx | 7 +-- .../source/layoutmanager/layoutmanager.cxx | 2 +- sfx2/inc/sfx2/dinfdlg.hxx | 21 +------ sfx2/source/dialog/dinfdlg.cxx | 56 +++++++------------ sfx2/source/doc/objserv.cxx | 23 ++------ sfx2/source/doc/sfxbasemodel.cxx | 33 +++++++---- 7 files changed, 53 insertions(+), 91 deletions(-) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 4d98e11882f2..4fb9d3b7d7b6 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1512,7 +1512,7 @@ void Desktop::Main() SvtFontSubstConfig().Apply(); SvtTabAppearanceCfg aAppearanceCfg; - //aAppearanceCfg.SetInitialized(); + aAppearanceCfg.SetInitialized(); aAppearanceCfg.SetApplicationDefaults( this ); SvtAccessibilityOptions aOptions; aOptions.SetVCLSettings(); diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx index 7b888524fcb0..39620534bcdf 100644 --- a/desktop/source/offacc/acceptor.cxx +++ b/desktop/source/offacc/acceptor.cxx @@ -188,15 +188,14 @@ void SAL_CALL Acceptor::initialize( const Sequence& aArguments ) // do we want to enable accepting? sal_Bool bEnable = sal_False; - if ((nArgs == 1 && (aArguments[0] >>= bEnable) ) - || (nArgs == 2 && (aArguments[1] >>= bEnable)) - && bEnable ) + if (((nArgs == 1 && (aArguments[0] >>= bEnable)) || + (nArgs == 2 && (aArguments[1] >>= bEnable))) && + bEnable ) { m_cEnable.set(); bOk = sal_True; } - if (!bOk) { throw IllegalArgumentException( diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 8eeeafb259aa..90fbd3d2356e 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -7622,7 +7622,7 @@ const com::sun::star::uno::Sequence< com::sun::star::beans::Property > LayoutMan com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_AUTOMATICTOOLBARS, LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS, ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_HIDECURRENTUI, LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI, ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_LOCKCOUNT, LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT, ::getCppuType((const sal_Int32*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT|com::sun::star::beans::PropertyAttribute::READONLY ), - com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER, ::getCppuType((const Reference< XStatusListener >*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), + com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER, ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_REFRESHVISIBILITY, LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY, ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ) }; // Use it to initialize sequence! diff --git a/sfx2/inc/sfx2/dinfdlg.hxx b/sfx2/inc/sfx2/dinfdlg.hxx index 159f2a093c69..ae7439bcde44 100644 --- a/sfx2/inc/sfx2/dinfdlg.hxx +++ b/sfx2/inc/sfx2/dinfdlg.hxx @@ -54,22 +54,12 @@ namespace com { namespace sun { namespace star { class XPropertyContainer; } namespace document { - class XDocumentInfo; class XDocumentProperties; } } } } -struct CustomProperty -{ - ::rtl::OUString m_sName; - com::sun::star::uno::Any m_aValue; +struct CustomProperty; - CustomProperty( const ::rtl::OUString& sName, const com::sun::star::uno::Any& rValue ) : - m_sName( sName ), m_aValue( rValue ) {} - - inline bool operator==( const CustomProperty& rProp ) - { return m_sName.equals( rProp.m_sName ) && m_aValue == rProp.m_aValue; } -}; // class SfxDocumentInfoItem --------------------------------------------- @@ -103,23 +93,18 @@ private: public: TYPEINFO(); SfxDocumentInfoItem(); -//FIXME: remove XDocumentInfo when implementing "Custom" tab SfxDocumentInfoItem( const String &rFileName, const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties> & i_xDocProps, - const ::com::sun::star::uno::Reference< - ::com::sun::star::document::XDocumentInfo> & i_xDocInfo, sal_Bool bUseUserData ); SfxDocumentInfoItem( const SfxDocumentInfoItem& ); virtual ~SfxDocumentInfoItem(); -//FIXME: remove XDocumentInfo when implementing "Custom" tab /// update i_xDocProps with the data in this object void updateDocumentInfo( const ::com::sun::star::uno::Reference< - ::com::sun::star::document::XDocumentProperties> & i_xDocProps, - const ::com::sun::star::uno::Reference< - ::com::sun::star::document::XDocumentInfo> & i_xDocInfo) const; + ::com::sun::star::document::XDocumentProperties> & i_xDocProps) + const; sal_Bool isAutoloadEnabled() const { return m_isAutoloadEnabled; } void setAutoloadEnabled(sal_Bool i_val) { m_isAutoloadEnabled = i_val; } diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 875462c8744a..09b5ab8b0859 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -36,9 +36,7 @@ #include #include #include -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include -#endif #include #include #include @@ -48,9 +46,7 @@ #include #include -#ifndef _COM_SUN_STAR_SECURITY_DOCUMENTSIGNATURESINFORMATION_HPP_ #include -#endif #include #include #include @@ -60,7 +56,6 @@ #include #include #include -#include #include #include @@ -86,9 +81,20 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::uno; -// The number of user defined fields handled by the dialog -// There are exactly 4. No more, no less. -#define FOUR 4 + +struct CustomProperty +{ + ::rtl::OUString m_sName; + com::sun::star::uno::Any m_aValue; + + CustomProperty( const ::rtl::OUString& sName, + const com::sun::star::uno::Any& rValue ) : + m_sName( sName ), m_aValue( rValue ) {} + + inline bool operator==( const CustomProperty& rProp ) + { return m_sName.equals( rProp.m_sName ) && m_aValue == rProp.m_aValue; } +}; + static bool operator==(const util::DateTime &i_rLeft, const util::DateTime &i_rRight) @@ -227,7 +233,6 @@ SfxDocumentInfoItem::SfxDocumentInfoItem() SfxDocumentInfoItem::SfxDocumentInfoItem( const String& rFile, const uno::Reference& i_xDocProps, - const uno::Reference& i_xDocInfo, sal_Bool bIs ) : SfxStringItem( SID_DOCINFO, rFile ) , m_AutoloadDelay( i_xDocProps->getAutoloadSecs() ) @@ -252,11 +257,6 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const String& rFile, , bDeleteUserData( sal_False ) , bIsUseUserData( bIs ) { - for (sal_Int16 i = 0; i < FOUR; ++i) { - m_UserDefinedFieldTitles[i] = i_xDocInfo->getUserFieldName(i); - m_UserDefinedFieldValues[i] = i_xDocInfo->getUserFieldValue(i); - } - try { Reference< beans::XPropertyContainer > xContainer = i_xDocProps->getUserDefinedProperties(); @@ -306,7 +306,7 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const SfxDocumentInfoItem& rItem ) , bDeleteUserData( rItem.bDeleteUserData ) , bIsUseUserData( rItem.bIsUseUserData ) { - for (size_t i = 0; i < FOUR; ++i) { + for (size_t i = 0; i < 4; ++i) { m_UserDefinedFieldTitles[i] = rItem.getUserDefinedFieldTitle(i); m_UserDefinedFieldValues[i] = rItem.getUserDefinedFieldValue(i); } @@ -343,19 +343,7 @@ int SfxDocumentInfoItem::operator==( const SfxPoolItem& rItem) const const SfxDocumentInfoItem& rInfoItem( static_cast(rItem)); - bool bEqual = m_aCustomProperties.size() == rInfoItem.m_aCustomProperties.size(); - if ( bEqual ) - { - for ( sal_uInt32 i = 0; i < m_aCustomProperties.size(); i++ ) - { - bEqual = *m_aCustomProperties[i] == *rInfoItem.m_aCustomProperties[i]; - if ( !bEqual ) - break; - } - } - return - bEqual != false && m_AutoloadDelay == rInfoItem.m_AutoloadDelay && m_AutoloadURL == rInfoItem.m_AutoloadURL && m_isAutoloadEnabled == rInfoItem.m_isAutoloadEnabled && @@ -372,10 +360,9 @@ int SfxDocumentInfoItem::operator==( const SfxPoolItem& rItem) const m_Keywords == rInfoItem.m_Keywords && m_Subject == rInfoItem.m_Subject && m_Title == rInfoItem.m_Title && - std::equal(m_UserDefinedFieldTitles, m_UserDefinedFieldTitles+FOUR, - rInfoItem.m_UserDefinedFieldTitles) && - std::equal(m_UserDefinedFieldValues, m_UserDefinedFieldValues+FOUR, - rInfoItem.m_UserDefinedFieldValues); + m_aCustomProperties.size() == rInfoItem.m_aCustomProperties.size() && + std::equal(m_aCustomProperties.begin(), m_aCustomProperties.end(), + rInfoItem.m_aCustomProperties.begin()); } //------------------------------------------------------------------------ @@ -398,8 +385,7 @@ void SfxDocumentInfoItem::resetUserData(const ::rtl::OUString & i_rAuthor) //------------------------------------------------------------------------ void SfxDocumentInfoItem::updateDocumentInfo( - const uno::Reference& i_xDocProps, - const uno::Reference& i_xDocInfo) const + const uno::Reference& i_xDocProps) const { if (isAutoloadEnabled()) { i_xDocProps->setAutoloadSecs(getAutoloadDelay()); @@ -423,10 +409,6 @@ void SfxDocumentInfoItem::updateDocumentInfo( ::comphelper::string::convertCommaSeparated(getKeywords())); i_xDocProps->setSubject(getSubject()); i_xDocProps->setTitle(getTitle()); - for ( sal_Int16 i = 0; i < FOUR; ++i ) { - i_xDocInfo->setUserFieldName(i, getUserDefinedFieldTitle(i)); - i_xDocInfo->setUserFieldValue(i, getUserDefinedFieldValue(i)); - } try { diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index b84e988ec9fd..95640642f565 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -51,15 +51,11 @@ #include #include -#ifndef _COM_SUN_STAR_SECURITY_DOCUMENTSIGNATURESINFORMATION_HPP_ #include -#endif #include #include #include -#ifndef _MSGBOX_HXX //autogen #include -#endif #include #include #include @@ -106,13 +102,9 @@ #include #include #include -#include -#include #include -#ifndef _SFX_HELPID_HRC #include "helpid.hrc" -#endif #include "guisaveas.hxx" @@ -423,10 +415,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( pDocInfItem ) { // parameter, e.g. from replayed macro - uno::Reference xDIS( - GetModel(), uno::UNO_QUERY_THROW); - pDocInfItem->updateDocumentInfo(getDocProperties(), - xDIS->getDocumentInfo()); + pDocInfItem->updateDocumentInfo(getDocProperties()); SetUseUserData( pDocInfItem->IsUseUserData() ); } else @@ -467,10 +456,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) aTitle = GetTitle(); } - uno::Reference xDIS( - GetModel(), uno::UNO_QUERY_THROW); SfxDocumentInfoItem aDocInfoItem( aURL, getDocProperties(), - xDIS->getDocumentInfo(), IsUseUserData() ); + IsUseUserData() ); if ( !GetSlotState( SID_DOCTEMPLATE ) ) // templates not supported aDocInfoItem.SetTemplate(FALSE); @@ -491,14 +478,12 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( pDocInfoItem ) { // user has done some changes to DocumentInfo - pDocInfoItem->updateDocumentInfo(getDocProperties(), - xDIS->getDocumentInfo()); + pDocInfoItem->updateDocumentInfo(getDocProperties()); SetUseUserData( ((const SfxDocumentInfoItem *)pDocInfoItem)->IsUseUserData() ); // add data from dialog for possible recording purposes rReq.AppendItem( SfxDocumentInfoItem( GetTitle(), - getDocProperties(), xDIS->getDocumentInfo(), - IsUseUserData() ) ); + getDocProperties(), IsUseUserData() ) ); } rReq.Done(); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 588396fda97d..09dc93f53f36 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2632,17 +2632,28 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL if ( bCopyTo ) { xOldDocProps = getDocumentProperties(); - xOldDocInfo = getDocumentInfo(); - Reference xCloneable(xOldDocInfo, - UNO_QUERY_THROW); - Reference xNewDocInfo( - xCloneable->createClone(), UNO_QUERY_THROW); - Reference xDPS( - xNewDocInfo, UNO_QUERY_THROW); - Reference xNewDocProps( - xDPS->getDocumentProperties()); - m_pData->m_xDocumentProperties = xNewDocProps; - m_pData->m_xDocumentInfo = xNewDocInfo; + if (m_pData->m_xDocumentInfo.is()) + { + xOldDocInfo = getDocumentInfo(); + const Reference xCloneable(xOldDocInfo, + UNO_QUERY_THROW); + const Reference xNewDocInfo( + xCloneable->createClone(), UNO_QUERY_THROW); + const Reference xDPS( + xNewDocInfo, UNO_QUERY_THROW); + const Reference xNewDocProps( + xDPS->getDocumentProperties()); + m_pData->m_xDocumentProperties = xNewDocProps; + m_pData->m_xDocumentInfo = xNewDocInfo; + } + else // try not to create DocumentInfo if it does not exist... + { + const Reference xCloneable(xOldDocProps, + UNO_QUERY_THROW); + const Reference xNewDocProps( + xCloneable->createClone(), UNO_QUERY_THROW); + m_pData->m_xDocumentProperties = xNewDocProps; + } } sal_Bool bRet = m_pData->m_pObjectShell->APISaveAs_Impl( sURL, aParams );