diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-17 11:18:40 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-18 07:41:51 +0100 |
commit | 5e69b3619d3a2b05930c5b8b8521d7f2938c709d (patch) | |
tree | 2bcfb4244223b7fe570e9b0bcee2f7dd3928e226 | |
parent | 1d097883541b9d244e50ced7fe49a4d7a0f65cfd (diff) |
loplugin:flatten in toolkit..writerfilter
Change-Id: I4da2a768b6b55869c3a3d6f8a8d50dc018709acd
Reviewed-on: https://gerrit.libreoffice.org/44865
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | toolkit/source/awt/vclxtabpagecontainer.cxx | 37 | ||||
-rw-r--r-- | toolkit/source/controls/dialogcontrol.cxx | 100 | ||||
-rw-r--r-- | toolkit/source/controls/tabpagemodel.cxx | 96 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrol.cxx | 704 | ||||
-rw-r--r-- | ucb/source/ucp/package/pkguri.cxx | 277 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_uri.cxx | 151 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/NeonSession.cxx | 203 | ||||
-rw-r--r-- | unoxml/source/dom/characterdata.cxx | 135 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbahelper.cxx | 66 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 220 |
10 files changed, 1002 insertions, 987 deletions
diff --git a/toolkit/source/awt/vclxtabpagecontainer.cxx b/toolkit/source/awt/vclxtabpagecontainer.cxx index df730e9adfcf..24d2d309665f 100644 --- a/toolkit/source/awt/vclxtabpagecontainer.cxx +++ b/toolkit/source/awt/vclxtabpagecontainer.cxx @@ -179,24 +179,25 @@ void SAL_CALL VCLXTabPageContainer::elementInserted( const css::container::Conta SolarMutexGuard aGuard; VclPtr<TabControl> pTabCtrl = GetAs<TabControl>(); Reference< css::awt::tab::XTabPage > xTabPage(Event.Element,uno::UNO_QUERY); - if ( pTabCtrl && xTabPage.is() ) - { - Reference< awt::XControl > xControl(xTabPage,UNO_QUERY ); - Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY ); - sal_Int16 nPageID = xP->getTabPageID(); - - VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xControl->getPeer()); - TabPage* pPage = static_cast<TabPage*>(pWindow.get()); - pTabCtrl->InsertPage(nPageID,pPage->GetText()); - - pPage->Hide(); - pTabCtrl->SetTabPage(nPageID,pPage); - pTabCtrl->SetHelpText(nPageID,xP->getToolTip()); - pTabCtrl->SetPageImage(nPageID,TkResMgr::getImageFromURL(xP->getImageURL())); - pTabCtrl->SelectTabPage(nPageID); - pTabCtrl->EnablePage(nPageID,xP->getEnabled()); - m_aTabPages.push_back(xTabPage); - } + if ( !pTabCtrl || !xTabPage.is() ) + return; + + Reference< awt::XControl > xControl(xTabPage,UNO_QUERY ); + Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY ); + sal_Int16 nPageID = xP->getTabPageID(); + + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xControl->getPeer()); + TabPage* pPage = static_cast<TabPage*>(pWindow.get()); + pTabCtrl->InsertPage(nPageID,pPage->GetText()); + + pPage->Hide(); + pTabCtrl->SetTabPage(nPageID,pPage); + pTabCtrl->SetHelpText(nPageID,xP->getToolTip()); + pTabCtrl->SetPageImage(nPageID,TkResMgr::getImageFromURL(xP->getImageURL())); + pTabCtrl->SelectTabPage(nPageID); + pTabCtrl->EnablePage(nPageID,xP->getEnabled()); + m_aTabPages.push_back(xTabPage); + } void SAL_CALL VCLXTabPageContainer::elementRemoved( const css::container::ContainerEvent& Event ) { diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 2a27b237ee57..8ca31adf47d3 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -488,65 +488,67 @@ void SAL_CALL UnoDialogControl::windowResized( const css::awt::WindowEvent& e ) { OutputDevice*pOutDev = Application::GetDefaultDevice(); DBG_ASSERT( pOutDev, "Missing Default Device!" ); - if ( pOutDev && !mbSizeModified ) - { - // Currentley we are simply using MapUnit::MapAppFont - ::Size aAppFontSize( e.Width, e.Height ); + if ( !pOutDev || mbSizeModified ) + return; - Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW ); - Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY ); - OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" ); + // Currentley we are simply using MapUnit::MapAppFont + ::Size aAppFontSize( e.Width, e.Height ); - // #i87592 In design mode the drawing layer works with sizes with decoration. - // Therefore we have to subtract them before writing back to the properties (model). - if ( xDialogDevice.is() && mbDesignMode ) - { - DeviceInfo aDeviceInfo( xDialogDevice->getInfo() ); - aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset; - aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset; - } + Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW ); + Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY ); + OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" ); - aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize ); - - // Remember that changes have been done by listener. No need to - // update the position because of property change event. - mbSizeModified = true; - Sequence< OUString > aProps( 2 ); - Sequence< Any > aValues( 2 ); - // Properties in a sequence must be sorted! - aProps[0] = "Height"; - aProps[1] = "Width"; - aValues[0] <<= aAppFontSize.Height(); - aValues[1] <<= aAppFontSize.Width(); - - ImplSetPropertyValues( aProps, aValues, true ); - mbSizeModified = false; + // #i87592 In design mode the drawing layer works with sizes with decoration. + // Therefore we have to subtract them before writing back to the properties (model). + if ( xDialogDevice.is() && mbDesignMode ) + { + DeviceInfo aDeviceInfo( xDialogDevice->getInfo() ); + aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset; + aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset; } + + aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize ); + + // Remember that changes have been done by listener. No need to + // update the position because of property change event. + mbSizeModified = true; + Sequence< OUString > aProps( 2 ); + Sequence< Any > aValues( 2 ); + // Properties in a sequence must be sorted! + aProps[0] = "Height"; + aProps[1] = "Width"; + aValues[0] <<= aAppFontSize.Height(); + aValues[1] <<= aAppFontSize.Width(); + + ImplSetPropertyValues( aProps, aValues, true ); + mbSizeModified = false; + } void SAL_CALL UnoDialogControl::windowMoved( const css::awt::WindowEvent& e ) { OutputDevice*pOutDev = Application::GetDefaultDevice(); DBG_ASSERT( pOutDev, "Missing Default Device!" ); - if ( pOutDev && !mbPosModified ) - { - // Currentley we are simply using MapUnit::MapAppFont - ::Size aTmp( e.X, e.Y ); - aTmp = ImplMapPixelToAppFont( pOutDev, aTmp ); - - // Remember that changes have been done by listener. No need to - // update the position because of property change event. - mbPosModified = true; - Sequence< OUString > aProps( 2 ); - Sequence< Any > aValues( 2 ); - aProps[0] = "PositionX"; - aProps[1] = "PositionY"; - aValues[0] <<= aTmp.Width(); - aValues[1] <<= aTmp.Height(); - - ImplSetPropertyValues( aProps, aValues, true ); - mbPosModified = false; - } + if ( !pOutDev || mbPosModified ) + return; + + // Currentley we are simply using MapUnit::MapAppFont + ::Size aTmp( e.X, e.Y ); + aTmp = ImplMapPixelToAppFont( pOutDev, aTmp ); + + // Remember that changes have been done by listener. No need to + // update the position because of property change event. + mbPosModified = true; + Sequence< OUString > aProps( 2 ); + Sequence< Any > aValues( 2 ); + aProps[0] = "PositionX"; + aProps[1] = "PositionY"; + aValues[0] <<= aTmp.Width(); + aValues[1] <<= aTmp.Height(); + + ImplSetPropertyValues( aProps, aValues, true ); + mbPosModified = false; + } void SAL_CALL UnoDialogControl::windowShown( const EventObject& ) {} diff --git a/toolkit/source/controls/tabpagemodel.cxx b/toolkit/source/controls/tabpagemodel.cxx index c45c8daad700..90f22675da0f 100644 --- a/toolkit/source/controls/tabpagemodel.cxx +++ b/toolkit/source/controls/tabpagemodel.cxx @@ -235,62 +235,64 @@ void SAL_CALL UnoControlTabPage::windowResized( const css::awt::WindowEvent& e ) { OutputDevice*pOutDev = Application::GetDefaultDevice(); DBG_ASSERT( pOutDev, "Missing Default Device!" ); - if ( pOutDev && !mbSizeModified ) - { - // Currentley we are simply using MapUnit::MapAppFont - ::Size aAppFontSize( e.Width, e.Height ); + if ( !pOutDev || mbSizeModified ) + return; - Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW ); - Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY ); - OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" ); - if ( xDialogDevice.is() ) - { - DeviceInfo aDeviceInfo( xDialogDevice->getInfo() ); - aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset; - aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset; - } + // Currentley we are simply using MapUnit::MapAppFont + ::Size aAppFontSize( e.Width, e.Height ); - aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize ); - - // Remember that changes have been done by listener. No need to - // update the position because of property change event. - mbSizeModified = true; - Sequence< OUString > aProps( 2 ); - Sequence< Any > aValues( 2 ); - // Properties in a sequence must be sorted! - aProps[0] = "Height"; - aProps[1] = "Width"; - aValues[0] <<= aAppFontSize.Height(); - aValues[1] <<= aAppFontSize.Width(); - - ImplSetPropertyValues( aProps, aValues, true ); - mbSizeModified = false; + Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW ); + Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY ); + OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" ); + if ( xDialogDevice.is() ) + { + DeviceInfo aDeviceInfo( xDialogDevice->getInfo() ); + aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset; + aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset; } + + aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize ); + + // Remember that changes have been done by listener. No need to + // update the position because of property change event. + mbSizeModified = true; + Sequence< OUString > aProps( 2 ); + Sequence< Any > aValues( 2 ); + // Properties in a sequence must be sorted! + aProps[0] = "Height"; + aProps[1] = "Width"; + aValues[0] <<= aAppFontSize.Height(); + aValues[1] <<= aAppFontSize.Width(); + + ImplSetPropertyValues( aProps, aValues, true ); + mbSizeModified = false; + } void SAL_CALL UnoControlTabPage::windowMoved( const css::awt::WindowEvent& e ) { OutputDevice*pOutDev = Application::GetDefaultDevice(); DBG_ASSERT( pOutDev, "Missing Default Device!" ); - if ( pOutDev && !mbPosModified ) - { - // Currentley we are simply using MapUnit::MapAppFont - ::Size aTmp( e.X, e.Y ); - aTmp = ImplMapPixelToAppFont( pOutDev, aTmp ); - - // Remember that changes have been done by listener. No need to - // update the position because of property change event. - mbPosModified = true; - Sequence< OUString > aProps( 2 ); - Sequence< Any > aValues( 2 ); - aProps[0] = "PositionX"; - aProps[1] = "PositionY"; - aValues[0] <<= aTmp.Width(); - aValues[1] <<= aTmp.Height(); - - ImplSetPropertyValues( aProps, aValues, true ); - mbPosModified = false; - } + if ( !pOutDev || mbPosModified ) + return; + + // Currentley we are simply using MapUnit::MapAppFont + ::Size aTmp( e.X, e.Y ); + aTmp = ImplMapPixelToAppFont( pOutDev, aTmp ); + + // Remember that changes have been done by listener. No need to + // update the position because of property change event. + mbPosModified = true; + Sequence< OUString > aProps( 2 ); + Sequence< Any > aValues( 2 ); + aProps[0] = "PositionX"; + aProps[1] = "PositionY"; + aValues[0] <<= aTmp.Width(); + aValues[1] <<= aTmp.Height(); + + ImplSetPropertyValues( aProps, aValues, true ); + mbPosModified = false; + } void SAL_CALL UnoControlTabPage::windowShown( const css::lang::EventObject& ) {} diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 02e393f39af9..f07ff4d64251 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -462,199 +462,200 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent { ::osl::ClearableGuard< ::osl::Mutex > aGuard( GetMutex() ); - if( getPeer().is() ) - { - std::vector< PropertyValue > aPeerPropertiesToSet; - sal_Int32 nIndependentPos = 0; - bool bResourceResolverSet( false ); - // position where to insert the independent properties into aPeerPropertiesToSet, - // dependent ones are inserted at the end of the vector + if( !getPeer().is() ) + return; + + std::vector< PropertyValue > aPeerPropertiesToSet; + sal_Int32 nIndependentPos = 0; + bool bResourceResolverSet( false ); + // position where to insert the independent properties into aPeerPropertiesToSet, + // dependent ones are inserted at the end of the vector - bool bNeedNewPeer = false; - // some properties require a re-creation of the peer, 'cause they can't be changed on the fly + bool bNeedNewPeer = false; + // some properties require a re-creation of the peer, 'cause they can't be changed on the fly - Reference< XControlModel > xOwnModel( getModel(), UNO_QUERY ); - // our own model for comparison - Reference< XPropertySet > xPS( xOwnModel, UNO_QUERY ); - Reference< XPropertySetInfo > xPSI( xPS->getPropertySetInfo(), UNO_QUERY ); - OSL_ENSURE( xPSI.is(), "UnoControl::ImplModelPropertiesChanged: should have property set meta data!" ); + Reference< XControlModel > xOwnModel( getModel(), UNO_QUERY ); + // our own model for comparison + Reference< XPropertySet > xPS( xOwnModel, UNO_QUERY ); + Reference< XPropertySetInfo > xPSI( xPS->getPropertySetInfo(), UNO_QUERY ); + OSL_ENSURE( xPSI.is(), "UnoControl::ImplModelPropertiesChanged: should have property set meta data!" ); - const PropertyChangeEvent* pEvents = rEvents.getConstArray(); + const PropertyChangeEvent* pEvents = rEvents.getConstArray(); - sal_Int32 nLen = rEvents.getLength(); - aPeerPropertiesToSet.reserve(nLen); + sal_Int32 nLen = rEvents.getLength(); + aPeerPropertiesToSet.reserve(nLen); - for( sal_Int32 i = 0; i < nLen; ++i, ++pEvents ) + for( sal_Int32 i = 0; i < nLen; ++i, ++pEvents ) + { + Reference< XControlModel > xModel( pEvents->Source, UNO_QUERY ); + bool bOwnModel = xModel.get() == xOwnModel.get(); + if ( !bOwnModel ) + continue; + + // Detect changes on our resource resolver which invalidates + // automatically some language dependent properties. + if ( pEvents->PropertyName == "ResourceResolver" ) { - Reference< XControlModel > xModel( pEvents->Source, UNO_QUERY ); - bool bOwnModel = xModel.get() == xOwnModel.get(); - if ( !bOwnModel ) - continue; - - // Detect changes on our resource resolver which invalidates - // automatically some language dependent properties. - if ( pEvents->PropertyName == "ResourceResolver" ) - { - Reference< resource::XStringResourceResolver > xStrResolver; - if ( pEvents->NewValue >>= xStrResolver ) - bResourceResolverSet = xStrResolver.is(); - } + Reference< resource::XStringResourceResolver > xStrResolver; + if ( pEvents->NewValue >>= xStrResolver ) + bResourceResolverSet = xStrResolver.is(); + } - sal_uInt16 nPType = GetPropertyId( pEvents->PropertyName ); - if ( mbDesignMode && mbDisposePeer && !mbRefeshingPeer && !mbCreatingPeer ) - { - // if we're in design mode, then some properties can change which - // require creating a *new* peer (since these properties cannot - // be switched at existing peers) - if ( nPType ) - bNeedNewPeer = ( nPType == BASEPROPERTY_BORDER ) - || ( nPType == BASEPROPERTY_MULTILINE ) - || ( nPType == BASEPROPERTY_DROPDOWN ) - || ( nPType == BASEPROPERTY_HSCROLL ) - || ( nPType == BASEPROPERTY_VSCROLL ) - || ( nPType == BASEPROPERTY_AUTOHSCROLL ) - || ( nPType == BASEPROPERTY_AUTOVSCROLL ) - || ( nPType == BASEPROPERTY_ORIENTATION ) - || ( nPType == BASEPROPERTY_SPIN ) - || ( nPType == BASEPROPERTY_ALIGN ) - || ( nPType == BASEPROPERTY_PAINTTRANSPARENT ); - else - bNeedNewPeer = requiresNewPeer( pEvents->PropertyName ); + sal_uInt16 nPType = GetPropertyId( pEvents->PropertyName ); + if ( mbDesignMode && mbDisposePeer && !mbRefeshingPeer && !mbCreatingPeer ) + { + // if we're in design mode, then some properties can change which + // require creating a *new* peer (since these properties cannot + // be switched at existing peers) + if ( nPType ) + bNeedNewPeer = ( nPType == BASEPROPERTY_BORDER ) + || ( nPType == BASEPROPERTY_MULTILINE ) + || ( nPType == BASEPROPERTY_DROPDOWN ) + || ( nPType == BASEPROPERTY_HSCROLL ) + || ( nPType == BASEPROPERTY_VSCROLL ) + || ( nPType == BASEPROPERTY_AUTOHSCROLL ) + || ( nPType == BASEPROPERTY_AUTOVSCROLL ) + || ( nPType == BASEPROPERTY_ORIENTATION ) + || ( nPType == BASEPROPERTY_SPIN ) + || ( nPType == BASEPROPERTY_ALIGN ) + || ( nPType == BASEPROPERTY_PAINTTRANSPARENT ); + else + bNeedNewPeer = requiresNewPeer( pEvents->PropertyName ); - if ( bNeedNewPeer ) - break; - } + if ( bNeedNewPeer ) + break; + } - if ( nPType && ( nLen > 1 ) && DoesDependOnOthers( nPType ) ) + if ( nPType && ( nLen > 1 ) && DoesDependOnOthers( nPType ) ) + { + // Add properties with dependencies on other properties last + // since they're dependent on properties added later (such as + // VALUE dependency on VALUEMIN/MAX) + aPeerPropertiesToSet.emplace_back(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE); + } + else + { + if ( bResourceResolverSet ) { - // Add properties with dependencies on other properties last - // since they're dependent on properties added later (such as - // VALUE dependency on VALUEMIN/MAX) - aPeerPropertiesToSet.emplace_back(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE); + // The resource resolver property change should be one of the first ones. + // All language dependent properties are dependent on this property. + // As BASEPROPERTY_NATIVE_WIDGET_LOOK is not dependent on resource + // resolver. We don't need to handle a special order for these two props. + aPeerPropertiesToSet.insert( + aPeerPropertiesToSet.begin(), + PropertyValue( pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE ) ); + ++nIndependentPos; + } + else if ( nPType == BASEPROPERTY_NATIVE_WIDGET_LOOK ) + { + // since *a lot* of other properties might be overruled by this one, we need + // a special handling: + // NativeWidgetLook needs to be set first: If it is set to ON, all other + // properties describing the look (e.g. BackgroundColor) are ignored, anyway. + // If it is switched OFF, then we need to do it first because else it will + // overrule other look-related properties, and re-initialize them from system + // defaults. + aPeerPropertiesToSet.insert( + aPeerPropertiesToSet.begin(), + PropertyValue( pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE ) ); + ++nIndependentPos; } else { - if ( bResourceResolverSet ) - { - // The resource resolver property change should be one of the first ones. - // All language dependent properties are dependent on this property. - // As BASEPROPERTY_NATIVE_WIDGET_LOOK is not dependent on resource - // resolver. We don't need to handle a special order for these two props. - aPeerPropertiesToSet.insert( - aPeerPropertiesToSet.begin(), - PropertyValue( pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE ) ); - ++nIndependentPos; - } - else if ( nPType == BASEPROPERTY_NATIVE_WIDGET_LOOK ) - { - // since *a lot* of other properties might be overruled by this one, we need - // a special handling: - // NativeWidgetLook needs to be set first: If it is set to ON, all other - // properties describing the look (e.g. BackgroundColor) are ignored, anyway. - // If it is switched OFF, then we need to do it first because else it will - // overrule other look-related properties, and re-initialize them from system - // defaults. - aPeerPropertiesToSet.insert( - aPeerPropertiesToSet.begin(), - PropertyValue( pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE ) ); - ++nIndependentPos; - } - else - { - aPeerPropertiesToSet.insert(aPeerPropertiesToSet.begin() + nIndependentPos, - PropertyValue(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE)); - ++nIndependentPos; - } + aPeerPropertiesToSet.insert(aPeerPropertiesToSet.begin() + nIndependentPos, + PropertyValue(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE)); + ++nIndependentPos; } } + } - Reference< XWindow > xParent = getParentPeer(); - Reference< XControl > xThis( static_cast<XAggregation*>(static_cast<cppu::OWeakAggObject*>(this)), UNO_QUERY ); - // call createPeer via a interface got from queryInterface, so the aggregating class can intercept it + Reference< XWindow > xParent = getParentPeer(); + Reference< XControl > xThis( static_cast<XAggregation*>(static_cast<cppu::OWeakAggObject*>(this)), UNO_QUERY ); + // call createPeer via a interface got from queryInterface, so the aggregating class can intercept it - DBG_ASSERT( !bNeedNewPeer || xParent.is(), "Need new peer, but don't have a parent!" ); + DBG_ASSERT( !bNeedNewPeer || xParent.is(), "Need new peer, but don't have a parent!" ); - // Check if we have to update language dependent properties - if ( !bNeedNewPeer && bResourceResolverSet ) + // Check if we have to update language dependent properties + if ( !bNeedNewPeer && bResourceResolverSet ) + { + // Add language dependent properties into the peer property set. + // Our resource resolver has been changed and we must be sure + // that language dependent props use the new resolver. + const LanguageDependentProp* pLangDepProp = aLanguageDependentProp; + while ( pLangDepProp->pPropName != nullptr ) { - // Add language dependent properties into the peer property set. - // Our resource resolver has been changed and we must be sure - // that language dependent props use the new resolver. - const LanguageDependentProp* pLangDepProp = aLanguageDependentProp; - while ( pLangDepProp->pPropName != nullptr ) + bool bMustBeInserted( true ); + for (PropertyValue & i : aPeerPropertiesToSet) { - bool bMustBeInserted( true ); - for (PropertyValue & i : aPeerPropertiesToSet) + if ( i.Name.equalsAsciiL( + pLangDepProp->pPropName, pLangDepProp->nPropNameLength )) { - if ( i.Name.equalsAsciiL( - pLangDepProp->pPropName, pLangDepProp->nPropNameLength )) - { - bMustBeInserted = false; - break; - } + bMustBeInserted = false; + break; } + } - if ( bMustBeInserted ) + if ( bMustBeInserted ) + { + // Add language dependent props at the end + OUString aPropName( OUString::createFromAscii( pLangDepProp->pPropName )); + if ( xPSI.is() && xPSI->hasPropertyByName( aPropName ) ) { - // Add language dependent props at the end - OUString aPropName( OUString::createFromAscii( pLangDepProp->pPropName )); - if ( xPSI.is() && xPSI->hasPropertyByName( aPropName ) ) - { - aPeerPropertiesToSet.emplace_back( aPropName, 0, xPS->getPropertyValue( aPropName ), PropertyState_DIRECT_VALUE ); - } + aPeerPropertiesToSet.emplace_back( aPropName, 0, xPS->getPropertyValue( aPropName ), PropertyState_DIRECT_VALUE ); } - - ++pLangDepProp; } + + ++pLangDepProp; } - aGuard.clear(); + } + aGuard.clear(); - // clear the guard before creating a new peer - as usual, our peer implementations use the SolarMutex + // clear the guard before creating a new peer - as usual, our peer implementations use the SolarMutex - if (bNeedNewPeer && xParent.is()) - { - SolarMutexGuard aVclGuard; - // and now this is the final withdrawal: - // I have no other idea than locking the SolarMutex here.... - // I really hate the fact that VCL is not threadsafe.... - - // Doesn't work for Container! - getPeer()->dispose(); - mxPeer.clear(); - mxVclWindowPeer = nullptr; - mbRefeshingPeer = true; - Reference< XWindowPeer > xP( xParent, UNO_QUERY ); - xThis->createPeer( Reference< XToolkit > (), xP ); - mbRefeshingPeer = false; - aPeerPropertiesToSet.clear(); - } + if (bNeedNewPeer && xParent.is()) + { + SolarMutexGuard aVclGuard; + // and now this is the final withdrawal: + // I have no other idea than locking the SolarMutex here.... + // I really hate the fact that VCL is not threadsafe.... + + // Doesn't work for Container! + getPeer()->dispose(); + mxPeer.clear(); + mxVclWindowPeer = nullptr; + mbRefeshingPeer = true; + Reference< XWindowPeer > xP( xParent, UNO_QUERY ); + xThis->createPeer( Reference< XToolkit > (), xP ); + mbRefeshingPeer = false; + aPeerPropertiesToSet.clear(); + } - // lock the multiplexing of VCL events to our UNO listeners - // this is for compatibility reasons: in OOo 1.0.x, changes which were done at the - // model did not cause the listeners of the controls/peers to be called - // Since the implementations for the listeners changed a lot towards 1.1, this - // would not be the case anymore, if we would not do this listener-lock below - // #i14703# - VCLXWindow* pPeer; - { - SolarMutexGuard g; - VclPtr<vcl::Window> pVclPeer = VCLUnoHelper::GetWindow( getPeer() ); - pPeer = pVclPeer ? pVclPeer->GetWindowPeer() : nullptr; - } - VclListenerLock aNoVclEventMultiplexing( pPeer ); - - // setting peer properties may result in an attempt to acquire the solar mutex, 'cause the peers - // usually don't have an own mutex but use the SolarMutex instead. - // To prevent deadlocks resulting from this, we do this without our own mutex locked - std::vector< PropertyValue >::iterator aEnd = aPeerPropertiesToSet.end(); - for ( std::vector< PropertyValue >::iterator aLoop = aPeerPropertiesToSet.begin(); - aLoop != aEnd; - ++aLoop - ) - { - ImplSetPeerProperty( aLoop->Name, aLoop->Value ); - } + // lock the multiplexing of VCL events to our UNO listeners + // this is for compatibility reasons: in OOo 1.0.x, changes which were done at the + // model did not cause the listeners of the controls/peers to be called + // Since the implementations for the listeners changed a lot towards 1.1, this + // would not be the case anymore, if we would not do this listener-lock below + // #i14703# + VCLXWindow* pPeer; + { + SolarMutexGuard g; + VclPtr<vcl::Window> pVclPeer = VCLUnoHelper::GetWindow( getPeer() ); + pPeer = pVclPeer ? pVclPeer->GetWindowPeer() : nullptr; + } + VclListenerLock aNoVclEventMultiplexing( pPeer ); + + // setting peer properties may result in an attempt to acquire the solar mutex, 'cause the peers + // usually don't have an own mutex but use the SolarMutex instead. + // To prevent deadlocks resulting from this, we do this without our own mutex locked + std::vector< PropertyValue >::iterator aEnd = aPeerPropertiesToSet.end(); + for ( std::vector< PropertyValue >::iterator aLoop = aPeerPropertiesToSet.begin(); + aLoop != aEnd; + ++aLoop + ) + { + ImplSetPeerProperty( aLoop->Name, aLoop->Value ); } + } void UnoControl::disposing( const EventObject& rEvt ) @@ -1086,235 +1087,236 @@ void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Refer throw aException; } - if( !getPeer().is() ) - { - mbCreatingPeer = true; + if( getPeer().is() ) + return; - WindowClass eType; - Reference< XToolkit > xToolkit = rxToolkit; - if( rParentPeer.is() && mxContext.is() ) + mbCreatingPeer = true; + + WindowClass eType; + Reference< XToolkit > xToolkit = rxToolkit; + if( rParentPeer.is() && mxContext.is() ) + { + // no TopWindow + if ( !xToolkit.is() ) + xToolkit = rParentPeer->getToolkit(); + Any aAny = OWeakAggObject::queryInterface( cppu::UnoType<XControlContainer>::get()); + Reference< XControlContainer > xC; + aAny >>= xC; + if( xC.is() ) + // It's a container + eType = WindowClass_CONTAINER; + else + eType = WindowClass_SIMPLE; + } + else + { // This is only correct for Top Window + if( rParentPeer.is() ) { - // no TopWindow if ( !xToolkit.is() ) xToolkit = rParentPeer->getToolkit(); - Any aAny = OWeakAggObject::queryInterface( cppu::UnoType<XControlContainer>::get()); - Reference< XControlContainer > xC; - aAny >>= xC; - if( xC.is() ) - // It's a container - eType = WindowClass_CONTAINER; - else - eType = WindowClass_SIMPLE; + eType = WindowClass_CONTAINER; } else - { // This is only correct for Top Window - if( rParentPeer.is() ) - { - if ( !xToolkit.is() ) - xToolkit = rParentPeer->getToolkit(); - eType = WindowClass_CONTAINER; - } - else - { - if ( !xToolkit.is() ) - xToolkit = VCLUnoHelper::CreateToolkit(); - eType = WindowClass_TOP; - } - } - WindowDescriptor aDescr; - aDescr.Type = eType; - aDescr.WindowServiceName = GetComponentServiceName(); - aDescr.Parent = rParentPeer; - aDescr.Bounds = getPosSize(); - aDescr.WindowAttributes = 0; - - // Border - Reference< XPropertySet > xPSet( mxModel, UNO_QUERY ); - Reference< XPropertySetInfo > xInfo = xPSet->getPropertySetInfo(); - - Any aVal; - OUString aPropName = GetPropertyName( BASEPROPERTY_BORDER ); - if ( xInfo->hasPropertyByName( aPropName ) ) - { - aVal = xPSet->getPropertyValue( aPropName ); - sal_Int16 n = sal_Int16(); - if ( aVal >>= n ) - { - if ( n ) - aDescr.WindowAttributes |= WindowAttribute::BORDER; - else - aDescr.WindowAttributes |= VclWindowPeerAttribute::NOBORDER; - } - } - - // DESKTOP_AS_PARENT - if ( aDescr.Type == WindowClass_TOP ) { - aPropName = GetPropertyName( BASEPROPERTY_DESKTOP_AS_PARENT ); - if ( xInfo->hasPropertyByName( aPropName ) ) - { - aVal = xPSet->getPropertyValue( aPropName ); - bool b = bool(); - if ( ( aVal >>= b ) && b) - aDescr.ParentIndex = -1; - } + if ( !xToolkit.is() ) + xToolkit = VCLUnoHelper::CreateToolkit(); + eType = WindowClass_TOP; } - // Moveable - aPropName = GetPropertyName( BASEPROPERTY_MOVEABLE ); - if ( xInfo->hasPropertyByName( aPropName ) ) + } + WindowDescriptor aDescr; + aDescr.Type = eType; + aDescr.WindowServiceName = GetComponentServiceName(); + aDescr.Parent = rParentPeer; + aDescr.Bounds = getPosSize(); + aDescr.WindowAttributes = 0; + + // Border + Reference< XPropertySet > xPSet( mxModel, UNO_QUERY ); + Reference< XPropertySetInfo > xInfo = xPSet->getPropertySetInfo(); + + Any aVal; + OUString aPropName = GetPropertyName( BASEPROPERTY_BORDER ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + sal_Int16 n = sal_Int16(); + if ( aVal >>= n ) { - aVal = xPSet->getPropertyValue( aPropName ); - bool b = bool(); - if ( ( aVal >>= b ) && b) - aDescr.WindowAttributes |= WindowAttribute::MOVEABLE; + if ( n ) + aDescr.WindowAttributes |= WindowAttribute::BORDER; + else + aDescr.WindowAttributes |= VclWindowPeerAttribute::NOBORDER; } + } - // Closeable - aPropName = GetPropertyName( BASEPROPERTY_CLOSEABLE ); + // DESKTOP_AS_PARENT + if ( aDescr.Type == WindowClass_TOP ) + { + aPropName = GetPropertyName( BASEPROPERTY_DESKTOP_AS_PARENT ); if ( xInfo->hasPropertyByName( aPropName ) ) { aVal = xPSet->getPropertyValue( aPropName ); bool b = bool(); if ( ( aVal >>= b ) && b) - aDescr.WindowAttributes |= WindowAttribute::CLOSEABLE; + aDescr.ParentIndex = -1; } + } + // Moveable + aPropName = GetPropertyName( BASEPROPERTY_MOVEABLE ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + bool b = bool(); + if ( ( aVal >>= b ) && b) + aDescr.WindowAttributes |= WindowAttribute::MOVEABLE; + } - // Dropdown - aPropName = GetPropertyName( BASEPROPERTY_DROPDOWN ); - if ( xInfo->hasPropertyByName( aPropName ) ) - { - aVal = xPSet->getPropertyValue( aPropName ); - bool b = bool(); - if ( ( aVal >>= b ) && b) - aDescr.WindowAttributes |= VclWindowPeerAttribute::DROPDOWN; - } + // Closeable + aPropName = GetPropertyName( BASEPROPERTY_CLOSEABLE ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + bool b = bool(); + if ( ( aVal >>= b ) && b) + aDescr.WindowAttributes |= WindowAttribute::CLOSEABLE; + } - // Spin - aPropName = GetPropertyName( BASEPROPERTY_SPIN ); - if ( xInfo->hasPropertyByName( aPropName ) ) - { - aVal = xPSet->getPropertyValue( aPropName ); - bool b = bool(); - if ( ( aVal >>= b ) && b) - aDescr.WindowAttributes |= VclWindowPeerAttribute::SPIN; - } + // Dropdown + aPropName = GetPropertyName( BASEPROPERTY_DROPDOWN ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + bool b = bool(); + if ( ( aVal >>= b ) && b) + aDescr.WindowAttributes |= VclWindowPeerAttribute::DROPDOWN; + } - // HScroll - aPropName = GetPropertyName( BASEPROPERTY_HSCROLL ); - if ( xInfo->hasPropertyByName( aPropName ) ) - { - aVal = xPSet->getPropertyValue( aPropName ); - bool b = bool(); - if ( ( aVal >>= b ) && b) - aDescr.WindowAttributes |= VclWindowPeerAttribute::HSCROLL; - } + // Spin + aPropName = GetPropertyName( BASEPROPERTY_SPIN ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + bool b = bool(); + if ( ( aVal >>= b ) && b) + aDescr.WindowAttributes |= VclWindowPeerAttribute::SPIN; + } - // VScroll - aPropName = GetPropertyName( BASEPROPERTY_VSCROLL ); - if ( xInfo->hasPropertyByName( aPropName ) ) - { - aVal = xPSet->getPropertyValue( aPropName ); - bool b = bool(); - if ( ( aVal >>= b ) && b) - aDescr.WindowAttributes |= VclWindowPeerAttribute::VSCROLL; - } + // HScroll + aPropName = GetPropertyName( BASEPROPERTY_HSCROLL ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + bool b = bool(); + if ( ( aVal >>= b ) && b) + aDescr.WindowAttributes |= VclWindowPeerAttribute::HSCROLL; + } - // AutoHScroll - aPropName = GetPropertyName( BASEPROPERTY_AUTOHSCROLL ); - if ( xInfo->hasPropertyByName( aPropName ) ) - { - aVal = xPSet->getPropertyValue( aPropName ); - bool b = bool(); - if ( ( aVal >>= b ) && b) - aDescr.WindowAttributes |= VclWindowPeerAttribute::AUTOHSCROLL; - } + // VScroll + aPropName = GetPropertyName( BASEPROPERTY_VSCROLL ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + bool b = bool(); + if ( ( aVal >>= b ) && b) + aDescr.WindowAttributes |= VclWindowPeerAttribute::VSCROLL; + } - // AutoVScroll - aPropName = GetPropertyName( BASEPROPERTY_AUTOVSCROLL ); - if ( xInfo->hasPropertyByName( aPropName ) ) - { - aVal = xPSet->getPropertyValue( aPropName ); - bool b = bool(); - if ( ( aVal >>= b ) && b) - aDescr.WindowAttributes |= VclWindowPeerAttribute::AUTOVSCROLL; - } + // AutoHScroll + aPropName = GetPropertyName( BASEPROPERTY_AUTOHSCROLL ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + bool b = bool(); + if ( ( aVal >>= b ) && b) + aDescr.WindowAttributes |= VclWindowPeerAttribute::AUTOHSCROLL; + } - //added for issue79712 - //NoLabel - aPropName = GetPropertyName( BASEPROPERTY_NOLABEL ); - if ( xInfo->hasPropertyByName( aPropName ) ) - { - aVal = xPSet->getPropertyValue( aPropName ); - bool b = bool(); - if ( ( aVal >>=b ) && b ) - aDescr.WindowAttributes |= VclWindowPeerAttribute::NOLABEL; - } - //issue79712 ends + // AutoVScroll + aPropName = GetPropertyName( BASEPROPERTY_AUTOVSCROLL ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + bool b = bool(); + if ( ( aVal >>= b ) && b) + aDescr.WindowAttributes |= VclWindowPeerAttribute::AUTOVSCROLL; + } - // Align - aPropName = GetPropertyName( BASEPROPERTY_ALIGN ); - if ( xInfo->hasPropertyByName( aPropName ) ) + //added for issue79712 + //NoLabel + aPropName = GetPropertyName( BASEPROPERTY_NOLABEL ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + bool b = bool(); + if ( ( aVal >>=b ) && b ) + aDescr.WindowAttributes |= VclWindowPeerAttribute::NOLABEL; + } + //issue79712 ends + + // Align + aPropName = GetPropertyName( BASEPROPERTY_ALIGN ); + if ( xInfo->hasPropertyByName( aPropName ) ) + { + aVal = xPSet->getPropertyValue( aPropName ); + sal_Int16 n = sal_Int16(); + if ( aVal >>= n ) { - aVal = xPSet->getPropertyValue( aPropName ); - sal_Int16 n = sal_Int16(); - if ( aVal >>= n ) - { - if ( n == PROPERTY_ALIGN_LEFT ) - aDescr.WindowAttributes |= VclWindowPeerAttribute::LEFT; - else if ( n == PROPERTY_ALIGN_CENTER ) - aDescr.WindowAttributes |= VclWindowPeerAttribute::CENTER; - else - aDescr.WindowAttributes |= VclWindowPeerAttribute::RIGHT; - } + if ( n == PROPERTY_ALIGN_LEFT ) + aDescr.WindowAttributes |= VclWindowPeerAttribute::LEFT; + else if ( n == PROPERTY_ALIGN_CENTER ) + aDescr.WindowAttributes |= VclWindowPeerAttribute::CENTER; + else + aDescr.WindowAttributes |= VclWindowPeerAttribute::RIGHT; } + } - // Allow derivates to manipulate attributes - PrepareWindowDescriptor(aDescr); + // Allow derivates to manipulate attributes + PrepareWindowDescriptor(aDescr); - // create the peer - setPeer( xToolkit->createWindow( aDescr ) ); + // create the peer + setPeer( xToolkit->createWindow( aDescr ) ); - // release the mutex guard (and work with copies of our members) - // this is necessary as our peer may lock the SolarMutex (actually, all currently known peers do), so calling - // into the peer with our own mutex locked may cause deadlocks - // (We _really_ need peers which do not use the SolarMutex. It's really pissing me off that from time to - // time deadlocks pop up because the low-level components like our peers use a mutex which usually - // is locked at the top of the stack (it protects the global message looping). This is always dangerous, and - // can not always be solved by tampering with other mutexes. - // Unfortunately, the VCL used in the peers is not threadsafe, and by definition needs a locked SolarMutex.) - // 82300 - 12/21/00 - FS - UnoControlComponentInfos aComponentInfos(maComponentInfos); - bool bDesignMode(mbDesignMode); + // release the mutex guard (and work with copies of our members) + // this is necessary as our peer may lock the SolarMutex (actually, all currently known peers do), so calling + // into the peer with our own mutex locked may cause deadlocks + // (We _really_ need peers which do not use the SolarMutex. It's really pissing me off that from time to + // time deadlocks pop up because the low-level components like our peers use a mutex which usually + // is locked at the top of the stack (it protects the global message looping). This is always dangerous, and + // can not always be solved by tampering with other mutexes. + // Unfortunately, the VCL used in the peers is not threadsafe, and by definition needs a locked SolarMutex.) + // 82300 - 12/21/00 - FS + UnoControlComponentInfos aComponentInfos(maComponentInfos); + bool bDesignMode(mbDesignMode); - Reference< XGraphics > xGraphics( mxGraphics ); - Reference< XView > xView ( getPeer(), UNO_QUERY_THROW ); - Reference< XWindow > xWindow ( getPeer(), UNO_QUERY_THROW ); + Reference< XGraphics > xGraphics( mxGraphics ); + Reference< XView > xView ( getPeer(), UNO_QUERY_THROW ); + Reference< XWindow > xWindow ( getPeer(), UNO_QUERY_THROW ); - aGuard.clear(); + aGuard.clear(); - // the updateFromModel is done without a locked mutex, too. - // The reason is that the only thing this method does is firing property changes, and this in general has - // to be done without locked mutexes (as every notification to external listeners). - // 82300 - 12/21/00 - FS - updateFromModel(); + // the updateFromModel is done without a locked mutex, too. + // The reason is that the only thing this method does is firing property changes, and this in general has + // to be done without locked mutexes (as every notification to external listeners). + // 82300 - 12/21/00 - FS + updateFromModel(); - xView->setZoom( aComponentInfos.nZoomX, aComponentInfos.nZoomY ); + xView->setZoom( aComponentInfos.nZoomX, aComponentInfos.nZoomY ); - setPosSize( aComponentInfos.nX, aComponentInfos.nY, aComponentInfos.nWidth, aComponentInfos.nHeight, aComponentInfos.nFlags ); + setPosSize( aComponentInfos.nX, aComponentInfos.nY, aComponentInfos.nWidth, aComponentInfos.nHeight, aComponentInfos.nFlags ); - if( aComponentInfos.bVisible && !bDesignMode ) - // Show only after setting the data - xWindow->setVisible( aComponentInfos.bVisible ); + if( aComponentInfos.bVisible && !bDesignMode ) + // Show only after setting the data + xWindow->setVisible( aComponentInfos.bVisible ); - if( !aComponentInfos.bEnable ) - xWindow->setEnable( aComponentInfos.bEnable ); + if( !aComponentInfos.bEnable ) + xWindow->setEnable( aComponentInfos.bEnable ); - xView->setGraphics( xGraphics ); + xView->setGraphics( xGraphics ); - peerCreated(); + peerCreated(); + + mbCreatingPeer = false; - mbCreatingPeer = false; - } } Reference< XWindowPeer > UnoControl::getPeer() diff --git a/ucb/source/ucp/package/pkguri.cxx b/ucb/source/ucp/package/pkguri.cxx index 96c238d6758f..95cb0b7d8874 100644 --- a/ucb/source/ucp/package/pkguri.cxx +++ b/ucb/source/ucp/package/pkguri.cxx @@ -60,171 +60,172 @@ static void normalize( OUString& rURL ) void PackageUri::init() const { // Already inited? - if ( !m_aUri.isEmpty() && m_aPath.isEmpty() ) + if ( m_aUri.isEmpty() || !m_aPath.isEmpty() ) + return; + + // Note: Maybe it's a re-init, setUri only resets m_aPath! + m_aPackage.clear(); + m_aParentUri.clear(); + m_aName.clear(); + m_aParam.clear(); + m_aScheme.clear(); + + // URI must match at least: <sheme>://<non_empty_url_to_file> + if ( m_aUri.getLength() < PACKAGE_URL_SCHEME_LENGTH + 4 ) { - // Note: Maybe it's a re-init, setUri only resets m_aPath! - m_aPackage.clear(); - m_aParentUri.clear(); - m_aName.clear(); - m_aParam.clear(); - m_aScheme.clear(); - - // URI must match at least: <sheme>://<non_empty_url_to_file> - if ( m_aUri.getLength() < PACKAGE_URL_SCHEME_LENGTH + 4 ) + // error, but remember that we did a init(). + m_aPath = "/"; + return; + } + + // Scheme must be followed by '://' + if ( ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH ] != ':' ) + || + ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH + 1 ] != '/' ) + || + ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH + 2 ] != '/' ) ) + { + // error, but remember that we did a init(). + m_aPath = "/"; + return; + } + + OUString aPureUri; + sal_Int32 nParam = m_aUri.indexOf( '?' ); + if( nParam >= 0 ) + { + m_aParam = m_aUri.copy( nParam ); + aPureUri = m_aUri.copy( 0, nParam ); + } + else + aPureUri = m_aUri; + + // Scheme is case insensitive. + m_aScheme = aPureUri.copy( + 0, PACKAGE_URL_SCHEME_LENGTH ).toAsciiLowerCase(); + + if ( m_aScheme == PACKAGE_URL_SCHEME || m_aScheme == PACKAGE_ZIP_URL_SCHEME ) + { + if ( m_aScheme == PACKAGE_ZIP_URL_SCHEME ) { - // error, but remember that we did a init(). - m_aPath = "/"; - return; + m_aParam += + ( !m_aParam.isEmpty() + ? OUString( "&purezip" ) + : OUString( "?purezip" ) ); } - // Scheme must be followed by '://' - if ( ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH ] != ':' ) - || - ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH + 1 ] != '/' ) - || - ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH + 2 ] != '/' ) ) + aPureUri = aPureUri.replaceAt( 0, + m_aScheme.getLength(), + m_aScheme ); + + sal_Int32 nStart = PACKAGE_URL_SCHEME_LENGTH + 3; + sal_Int32 nEnd = aPureUri.lastIndexOf( '/' ); + if ( nEnd == PACKAGE_URL_SCHEME_LENGTH + 3 ) { + // Only <scheme>:/// - Empty authority + // error, but remember that we did a init(). m_aPath = "/"; return; } - - OUString aPureUri; - sal_Int32 nParam = m_aUri.indexOf( '?' ); - if( nParam >= 0 ) + else if ( nEnd == ( aPureUri.getLength() - 1 ) ) { - m_aParam = m_aUri.copy( nParam ); - aPureUri = m_aUri.copy( 0, nParam ); - } - else - aPureUri = m_aUri; - - // Scheme is case insensitive. - m_aScheme = aPureUri.copy( - 0, PACKAGE_URL_SCHEME_LENGTH ).toAsciiLowerCase(); - - if ( m_aScheme == PACKAGE_URL_SCHEME || m_aScheme == PACKAGE_ZIP_URL_SCHEME ) - { - if ( m_aScheme == PACKAGE_ZIP_URL_SCHEME ) - { - m_aParam += - ( !m_aParam.isEmpty() - ? OUString( "&purezip" ) - : OUString( "?purezip" ) ); - } - - aPureUri = aPureUri.replaceAt( 0, - m_aScheme.getLength(), - m_aScheme ); - - sal_Int32 nStart = PACKAGE_URL_SCHEME_LENGTH + 3; - sal_Int32 nEnd = aPureUri.lastIndexOf( '/' ); - if ( nEnd == PACKAGE_URL_SCHEME_LENGTH + 3 ) + if ( aPureUri[ aPureUri.getLength() - 2 ] == '/' ) { - // Only <scheme>:/// - Empty authority + // Only <scheme>://// or <scheme>://<something> // error, but remember that we did a init(). m_aPath = "/"; return; } - else if ( nEnd == ( aPureUri.getLength() - 1 ) ) - { - if ( aPureUri[ aPureUri.getLength() - 2 ] == '/' ) - { - // Only <scheme>://// or <scheme>://<something> - // error, but remember that we did a init(). - m_aPath = "/"; - return; - } - - // Remove trailing slash. - aPureUri = aPureUri.copy( 0, nEnd ); - } + // Remove trailing slash. + aPureUri = aPureUri.copy( 0, nEnd ); + } - nEnd = aPureUri.indexOf( '/', nStart ); - if ( nEnd == -1 ) - { - // root folder. + nEnd = aPureUri.indexOf( '/', nStart ); + if ( nEnd == -1 ) + { + // root folder. - OUString aNormPackage = aPureUri.copy( nStart ); - normalize( aNormPackage ); + OUString aNormPackage = aPureUri.copy( nStart ); + normalize( aNormPackage ); - aPureUri = aPureUri.replaceAt( - nStart, aPureUri.getLength() - nStart, aNormPackage ); - m_aPackage - = ::ucb_impl::urihelper::decodeSegment( aNormPackage ); - m_aPath = "/"; - m_aUri = m_aUri.replaceAt( 0, - ( nParam >= 0 ) - ? nParam - : m_aUri.getLength(), aPureUri ); - - sal_Int32 nLastSlash = m_aPackage.lastIndexOf( '/' ); - if ( nLastSlash != -1 ) - m_aName = ::ucb_impl::urihelper::decodeSegment( - m_aPackage.copy( nLastSlash + 1 ) ); - else - m_aName - = ::ucb_impl::urihelper::decodeSegment( m_aPackage ); - } + aPureUri = aPureUri.replaceAt( + nStart, aPureUri.getLength() - nStart, aNormPackage ); + m_aPackage + = ::ucb_impl::urihelper::decodeSegment( aNormPackage ); + m_aPath = "/"; + m_aUri = m_aUri.replaceAt( 0, + ( nParam >= 0 ) + ? nParam + : m_aUri.getLength(), aPureUri ); + + sal_Int32 nLastSlash = m_aPackage.lastIndexOf( '/' ); + if ( nLastSlash != -1 ) + m_aName = ::ucb_impl::urihelper::decodeSegment( + m_aPackage.copy( nLastSlash + 1 ) ); else - { - m_aPath = aPureUri.copy( nEnd + 1 ); - - // Unexpected sequences of characters: - // - empty path segments - // - encoded slashes - // - parent folder segments ".." - // - current folder segments "." - if ( m_aPath.indexOf( "//" ) != -1 - || m_aPath.indexOf( "%2F" ) != -1 - || m_aPath.indexOf( "%2f" ) != -1 - || ::comphelper::OStorageHelper::PathHasSegment( m_aPath, ".." ) - || ::comphelper::OStorageHelper::PathHasSegment( m_aPath, "." ) ) - { - // error, but remember that we did a init(). - m_aPath = "/"; - return; - } - - OUString aNormPackage = aPureUri.copy( nStart, nEnd - nStart ); - normalize( aNormPackage ); - - aPureUri = aPureUri.replaceAt( - nStart, nEnd - nStart, aNormPackage ); - aPureUri = aPureUri.replaceAt( - nEnd + 1, - aPureUri.getLength() - nEnd - 1, - ::ucb_impl::urihelper::encodeURI( m_aPath ) ); - - m_aPackage - = ::ucb_impl::urihelper::decodeSegment( aNormPackage ); - m_aPath = ::ucb_impl::urihelper::decodeSegment( m_aPath ); - m_aUri = m_aUri.replaceAt( 0, - ( nParam >= 0 ) - ? nParam - : m_aUri.getLength(), aPureUri ); - - sal_Int32 nLastSlash = aPureUri.lastIndexOf( '/' ); - if ( nLastSlash != -1 ) - { - m_aParentUri = aPureUri.copy( 0, nLastSlash ); - m_aName = ::ucb_impl::urihelper::decodeSegment( - aPureUri.copy( nLastSlash + 1 ) ); - } - } - - // success - m_bValid = true; + m_aName + = ::ucb_impl::urihelper::decodeSegment( m_aPackage ); } else { - // error, but remember that we did a init(). - m_aPath = "/"; + m_aPath = aPureUri.copy( nEnd + 1 ); + + // Unexpected sequences of characters: + // - empty path segments + // - encoded slashes + // - parent folder segments ".." + // - current folder segments "." + if ( m_aPath.indexOf( "//" ) != -1 + || m_aPath.indexOf( "%2F" ) != -1 + || m_aPath.indexOf( "%2f" ) != -1 + || ::comphelper::OStorageHelper::PathHasSegment( m_aPath, ".." ) + || ::comphelper::OStorageHelper::PathHasSegment( m_aPath, "." ) ) + { + // error, but remember that we did a init(). + m_aPath = "/"; + return; + } + + OUString aNormPackage = aPureUri.copy( nStart, nEnd - nStart ); + normalize( aNormPackage ); + + aPureUri = aPureUri.replaceAt( + nStart, nEnd - nStart, aNormPackage ); + aPureUri = aPureUri.replaceAt( + nEnd + 1, + aPureUri.getLength() - nEnd - 1, + ::ucb_impl::urihelper::encodeURI( m_aPath ) ); + + m_aPackage + = ::ucb_impl::urihelper::decodeSegment( aNormPackage ); + m_aPath = ::ucb_impl::urihelper::decodeSegment( m_aPath ); + m_aUri = m_aUri.replaceAt( 0, + ( nParam >= 0 ) + ? nParam + : m_aUri.getLength(), aPureUri ); + + sal_Int32 nLastSlash = aPureUri.lastIndexOf( '/' ); + if ( nLastSlash != -1 ) + { + m_aParentUri = aPureUri.copy( 0, nLastSlash ); + m_aName = ::ucb_impl::urihelper::decodeSegment( + aPureUri.copy( nLastSlash + 1 ) ); + } } + + // success + m_bValid = true; } + else + { + // error, but remember that we did a init(). + m_aPath = "/"; + } + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/tdoc/tdoc_uri.cxx b/ucb/source/ucp/tdoc/tdoc_uri.cxx index c48fa4078e08..126ef346b202 100644 --- a/ucb/source/ucp/tdoc/tdoc_uri.cxx +++ b/ucb/source/ucp/tdoc/tdoc_uri.cxx @@ -38,83 +38,84 @@ using namespace tdoc_ucp; void Uri::init() const { // Already inited? - if ( m_eState == UNKNOWN ) + if ( m_eState != UNKNOWN ) + return; + + m_eState = INVALID; + + // Check for proper length: must be at least length of <sheme>:/ + if ( m_aUri.getLength() < TDOC_URL_SCHEME_LENGTH + 2 ) + { + // Invalid length (to short). + return; + } + + // Check for proper scheme. (Scheme is case insensitive.) + OUString aScheme + = m_aUri.copy( 0, TDOC_URL_SCHEME_LENGTH ).toAsciiLowerCase(); + if ( aScheme != TDOC_URL_SCHEME ) + { + // Invalid scheme. + return; + } + + // Remember normalized scheme string. + m_aUri = m_aUri.replaceAt( 0, aScheme.getLength(), aScheme ); + + if ( m_aUri[ TDOC_URL_SCHEME_LENGTH ] != ':' ) { - m_eState = INVALID; - - // Check for proper length: must be at least length of <sheme>:/ - if ( m_aUri.getLength() < TDOC_URL_SCHEME_LENGTH + 2 ) - { - // Invalid length (to short). - return; - } - - // Check for proper scheme. (Scheme is case insensitive.) - OUString aScheme - = m_aUri.copy( 0, TDOC_URL_SCHEME_LENGTH ).toAsciiLowerCase(); - if ( aScheme != TDOC_URL_SCHEME ) - { - // Invalid scheme. - return; - } - - // Remember normalized scheme string. - m_aUri = m_aUri.replaceAt( 0, aScheme.getLength(), aScheme ); - - if ( m_aUri[ TDOC_URL_SCHEME_LENGTH ] != ':' ) - { - // Invalid (no ':' after <scheme>). - return; - } - - if ( m_aUri[ TDOC_URL_SCHEME_LENGTH + 1 ] != '/' ) - { - // Invalid (no '/' after <scheme>:). - return; - } - - m_aPath = m_aUri.copy( TDOC_URL_SCHEME_LENGTH + 1 ); - - // Note: There must be at least one slash; see above. - sal_Int32 nLastSlash = m_aUri.lastIndexOf( '/' ); - bool bTrailingSlash = false; - if ( nLastSlash == m_aUri.getLength() - 1 ) - { - // ignore trailing slash - bTrailingSlash = true; - nLastSlash = m_aUri.lastIndexOf( '/', nLastSlash ); - } - - if ( nLastSlash != -1 ) // -1 is valid for the root folder - { - m_aParentUri = m_aUri.copy( 0, nLastSlash + 1 ); - - if ( bTrailingSlash ) - m_aName = m_aUri.copy( nLastSlash + 1, - m_aUri.getLength() - nLastSlash - 2 ); - else - m_aName = m_aUri.copy( nLastSlash + 1 ); - - m_aDecodedName = ::ucb_impl::urihelper::decodeSegment( m_aName ); - - sal_Int32 nSlash = m_aPath.indexOf( '/', 1 ); - if ( nSlash == -1 ) - m_aDocId = m_aPath.copy( 1 ); - else - m_aDocId = m_aPath.copy( 1, nSlash - 1 ); - } - - if ( !m_aDocId.isEmpty() ) - { - sal_Int32 nSlash = m_aPath.indexOf( '/', 1 ); - if ( nSlash != - 1 ) - m_aInternalPath = m_aPath.copy( nSlash ); - else - m_aInternalPath = "/"; - } - - m_eState = VALID; + // Invalid (no ':' after <scheme>). + return; } + + if ( m_aUri[ TDOC_URL_SCHEME_LENGTH + 1 ] != '/' ) + { + // Invalid (no '/' after <scheme>:). + return; + } + + m_aPath = m_aUri.copy( TDOC_URL_SCHEME_LENGTH + 1 ); + + // Note: There must be at least one slash; see above. + sal_Int32 nLastSlash = m_aUri.lastIndexOf( '/' ); + bool bTrailingSlash = false; + if ( nLastSlash == m_aUri.getLength() - 1 ) + { + // ignore trailing slash + bTrailingSlash = true; + nLastSlash = m_aUri.lastIndexOf( '/', nLastSlash ); + } + + if ( nLastSlash != -1 ) // -1 is valid for the root folder + { + m_aParentUri = m_aUri.copy( 0, nLastSlash + 1 ); + + if ( bTrailingSlash ) + m_aName = m_aUri.copy( nLastSlash + 1, + m_aUri.getLength() - nLastSlash - 2 ); + else + m_aName = m_aUri.copy( nLastSlash + 1 ); + + m_aDecodedName = ::ucb_impl::urihelper::decodeSegment( m_aName ); + + sal_Int32 nSlash = m_aPath.indexOf( '/', 1 ); + if ( nSlash == -1 ) + m_aDocId = m_aPath.copy( 1 ); + else + m_aDocId = m_aPath.copy( 1, nSlash - 1 ); + } + + if ( !m_aDocId.isEmpty() ) + { + sal_Int32 nSlash = m_aPath.indexOf( '/', 1 ); + if ( nSlash != - 1 ) + m_aInternalPath = m_aPath.copy( nSlash ); + else + m_aInternalPath = "/"; + } + + m_eState = VALID; + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx index 0ccf4a0109e7..0c02f3287502 100644 --- a/ucb/source/ucp/webdav-neon/NeonSession.cxx +++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx @@ -679,133 +679,134 @@ void NeonSession::Init() } } - if ( bCreateNewSession ) - { - const sal_Int32 nConnectTimeoutMax = 180; - const sal_Int32 nConnectTimeoutMin = 2; - const sal_Int32 nReadTimeoutMax = 180; - const sal_Int32 nReadTimeoutMin = 20; + if ( !bCreateNewSession ) + return; - // @@@ For FTP over HTTP proxy inUserInfo is needed to be able to - // build the complete request URI (including user:pass), but - // currently (0.22.0) neon does not allow to pass the user info - // to the session + const sal_Int32 nConnectTimeoutMax = 180; + const sal_Int32 nConnectTimeoutMin = 2; + const sal_Int32 nReadTimeoutMax = 180; + const sal_Int32 nReadTimeoutMin = 20; - { - osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex ); - m_pHttpSession = ne_session_create( - OUStringToOString( m_aScheme, RTL_TEXTENCODING_UTF8 ).getStr(), - /* theUri.GetUserInfo(), - @@@ for FTP via HTTP proxy, but not supported by Neon */ - OUStringToOString( m_aHostName, RTL_TEXTENCODING_UTF8 ).getStr(), - m_nPort ); - } + // @@@ For FTP over HTTP proxy inUserInfo is needed to be able to + // build the complete request URI (including user:pass), but + // currently (0.22.0) neon does not allow to pass the user info + // to the session - if ( m_pHttpSession == nullptr ) - throw DAVException( DAVException::DAV_SESSION_CREATE, - NeonUri::makeConnectionEndPointString( - m_aHostName, m_nPort ) ); + { + osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex ); + m_pHttpSession = ne_session_create( + OUStringToOString( m_aScheme, RTL_TEXTENCODING_UTF8 ).getStr(), + /* theUri.GetUserInfo(), + @@@ for FTP via HTTP proxy, but not supported by Neon */ + OUStringToOString( m_aHostName, RTL_TEXTENCODING_UTF8 ).getStr(), + m_nPort ); + } - // Register the session with the lock store - m_aNeonLockStore.registerSession( m_pHttpSession ); + if ( m_pHttpSession == nullptr ) + throw DAVException( DAVException::DAV_SESSION_CREATE, + NeonUri::makeConnectionEndPointString( + m_aHostName, m_nPort ) ); - if ( m_aScheme.equalsIgnoreAsciiCase("https") ) - { - // Set a failure callback for certificate check - ne_ssl_set_verify( - m_pHttpSession, NeonSession_CertificationNotify, this); - - // Tell Neon to tell the SSL library used (OpenSSL or - // GnuTLS, I guess) to use a default set of root - // certificates. - ne_ssl_trust_default_ca(m_pHttpSession); - } + // Register the session with the lock store + m_aNeonLockStore.registerSession( m_pHttpSession ); - // Add hooks (i.e. for adding additional headers to the request) + if ( m_aScheme.equalsIgnoreAsciiCase("https") ) + { + // Set a failure callback for certificate check + ne_ssl_set_verify( + m_pHttpSession, NeonSession_CertificationNotify, this); + + // Tell Neon to tell the SSL library used (OpenSSL or + // GnuTLS, I guess) to use a default set of root + // certificates. + ne_ssl_trust_default_ca(m_pHttpSession); + } + + // Add hooks (i.e. for adding additional headers to the request) #if 0 - /* Hook called when a request is created. */ - //typedef void (*ne_create_request_fn)(ne_request *req, void *userdata, - // const char *method, const char *path); + /* Hook called when a request is created. */ + //typedef void (*ne_create_request_fn)(ne_request *req, void *userdata, + // const char *method, const char *path); - ne_hook_create_request( m_pHttpSession, create_req_hook_fn, this ); + ne_hook_create_request( m_pHttpSession, create_req_hook_fn, this ); #endif - /* Hook called before the request is sent. 'header' is the raw HTTP - * header before the trailing CRLF is added: add in more here. */ - //typedef void (*ne_pre_send_fn)(ne_request *req, void *userdata, - // ne_buffer *header); + /* Hook called before the request is sent. 'header' is the raw HTTP + * header before the trailing CRLF is added: add in more here. */ + //typedef void (*ne_pre_send_fn)(ne_request *req, void *userdata, + // ne_buffer *header); - ne_hook_pre_send( m_pHttpSession, NeonSession_PreSendRequest, this ); + ne_hook_pre_send( m_pHttpSession, NeonSession_PreSendRequest, this ); #if 0 - /* Hook called after the request is sent. May return: - * NE_OK everything is okay - * NE_RETRY try sending the request again. - * anything else signifies an error, and the request is failed. The - * return code is passed back the _dispatch caller, so the session error - * must also be set appropriately (ne_set_error). - */ - //typedef int (*ne_post_send_fn)(ne_request *req, void *userdata, - // const ne_status *status); + /* Hook called after the request is sent. May return: + * NE_OK everything is okay + * NE_RETRY try sending the request again. + * anything else signifies an error, and the request is failed. The + * return code is passed back the _dispatch caller, so the session error + * must also be set appropriately (ne_set_error). + */ + //typedef int (*ne_post_send_fn)(ne_request *req, void *userdata, + // const ne_status *status); - ne_hook_post_send( m_pHttpSession, post_send_req_hook_fn, this ); + ne_hook_post_send( m_pHttpSession, post_send_req_hook_fn, this ); - /* Hook called when the request is destroyed. */ - //typedef void (*ne_destroy_req_fn)(ne_request *req, void *userdata); + /* Hook called when the request is destroyed. */ + //typedef void (*ne_destroy_req_fn)(ne_request *req, void *userdata); - ne_hook_destroy_request( m_pHttpSession, destroy_req_hook_fn, this ); + ne_hook_destroy_request( m_pHttpSession, destroy_req_hook_fn, this ); - /* Hook called when the session is destroyed. */ - //typedef void (*ne_destroy_sess_fn)(void *userdata); + /* Hook called when the session is destroyed. */ + //typedef void (*ne_destroy_sess_fn)(void *userdata); - ne_hook_destroy_session( m_pHttpSession, destroy_sess_hook_fn, this ); + ne_hook_destroy_session( m_pHttpSession, destroy_sess_hook_fn, this ); #endif - if ( !m_aProxyName.isEmpty() ) - { - ne_session_proxy( m_pHttpSession, - OUStringToOString( - m_aProxyName, - RTL_TEXTENCODING_UTF8 ).getStr(), - m_nProxyPort ); - } + if ( !m_aProxyName.isEmpty() ) + { + ne_session_proxy( m_pHttpSession, + OUStringToOString( + m_aProxyName, + RTL_TEXTENCODING_UTF8 ).getStr(), + m_nProxyPort ); + } - // avoid KeepAlive? - if ( noKeepAlive(m_aFlags) ) - ne_set_session_flag( m_pHttpSession, NE_SESSFLAG_PERSIST, 0 ); + // avoid KeepAlive? + if ( noKeepAlive(m_aFlags) ) + ne_set_session_flag( m_pHttpSession, NE_SESSFLAG_PERSIST, 0 ); - // Register for redirects. - ne_redirect_register( m_pHttpSession ); + // Register for redirects. + ne_redirect_register( m_pHttpSession ); - // authentication callbacks. + // authentication callbacks. #if 1 - ne_add_server_auth( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); - ne_add_proxy_auth ( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); + ne_add_server_auth( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); + ne_add_proxy_auth ( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); #else - ne_set_server_auth( m_pHttpSession, NeonSession_NeonAuth, this ); - ne_set_proxy_auth ( m_pHttpSession, NeonSession_NeonAuth, this ); + ne_set_server_auth( m_pHttpSession, NeonSession_NeonAuth, this ); + ne_set_proxy_auth ( m_pHttpSession, NeonSession_NeonAuth, this ); #endif - // set timeout to connect - // if connect_timeout is not set, neon returns NE_CONNECT when the TCP socket default - // timeout elapses - // with connect_timeout set neon returns NE_TIMEOUT if elapsed when the connection - // didn't succeed - // grab it from configuration - uno::Reference< uno::XComponentContext > rContext = m_xFactory->getComponentContext(); - - // set the timeout (in seconds) used when making a connection - sal_Int32 nConnectTimeout = officecfg::Inet::Settings::ConnectTimeout::get( rContext ); - ne_set_connect_timeout( m_pHttpSession, - std::max( nConnectTimeoutMin, - std::min( nConnectTimeout, nConnectTimeoutMax ) ) ); - - // provides a read time out facility as well - // set the timeout (in seconds) used when reading from a socket. - sal_Int32 nReadTimeout = officecfg::Inet::Settings::ReadTimeout::get( rContext ); - ne_set_read_timeout( m_pHttpSession, - std::max( nReadTimeoutMin, - std::min( nReadTimeout, nReadTimeoutMax ) ) ); - } + // set timeout to connect + // if connect_timeout is not set, neon returns NE_CONNECT when the TCP socket default + // timeout elapses + // with connect_timeout set neon returns NE_TIMEOUT if elapsed when the connection + // didn't succeed + // grab it from configuration + uno::Reference< uno::XComponentContext > rContext = m_xFactory->getComponentContext(); + + // set the timeout (in seconds) used when making a connection + sal_Int32 nConnectTimeout = officecfg::Inet::Settings::ConnectTimeout::get( rContext ); + ne_set_connect_timeout( m_pHttpSession, + std::max( nConnectTimeoutMin, + std::min( nConnectTimeout, nConnectTimeoutMax ) ) ); + + // provides a read time out facility as well + // set the timeout (in seconds) used when reading from a socket. + sal_Int32 nReadTimeout = officecfg::Inet::Settings::ReadTimeout::get( rContext ); + ne_set_read_timeout( m_pHttpSession, + std::max( nReadTimeoutMin, + std::min( nReadTimeout, nReadTimeoutMax ) ) ); + } bool NeonSession::CanUse( const OUString & inUri, diff --git a/unoxml/source/dom/characterdata.cxx b/unoxml/source/dom/characterdata.cxx index ca29f993cfe1..3813a72899d0 100644 --- a/unoxml/source/dom/characterdata.cxx +++ b/unoxml/source/dom/characterdata.cxx @@ -82,30 +82,31 @@ namespace DOM { ::osl::ClearableMutexGuard guard(m_rMutex); - if (m_aNodePtr != nullptr) - { - // get current data - std::shared_ptr<xmlChar const> const pContent( - xmlNodeGetContent(m_aNodePtr), xmlFree); - OString aData(reinterpret_cast<sal_Char const*>(pContent.get())); - OUString tmp(OStringToOUString(aData, RTL_TEXTENCODING_UTF8)); - if (offset > tmp.getLength() || offset < 0 || count < 0) { - DOMException e; - e.Code = DOMExceptionType_INDEX_SIZE_ERR; - throw e; - } - if ((offset+count) > tmp.getLength()) - count = tmp.getLength() - offset; + if (m_aNodePtr == nullptr) + return; + + // get current data + std::shared_ptr<xmlChar const> const pContent( + xmlNodeGetContent(m_aNodePtr), xmlFree); + OString aData(reinterpret_cast<sal_Char const*>(pContent.get())); + OUString tmp(OStringToOUString(aData, RTL_TEXTENCODING_UTF8)); + if (offset > tmp.getLength() || offset < 0 || count < 0) { + DOMException e; + e.Code = DOMExceptionType_INDEX_SIZE_ERR; + throw e; + } + if ((offset+count) > tmp.getLength()) + count = tmp.getLength() - offset; - OUString tmp2 = tmp.copy(0, offset); - tmp2 += tmp.copy(offset+count); - OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); - xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr())); - OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); + OUString tmp2 = tmp.copy(0, offset); + tmp2 += tmp.copy(offset+count); + OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); + xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr())); + OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); + + guard.clear(); // release mutex before calling event handlers + dispatchEvent_Impl(oldValue, newValue); - guard.clear(); // release mutex before calling event handlers - dispatchEvent_Impl(oldValue, newValue); - } } @@ -152,29 +153,30 @@ namespace DOM { ::osl::ClearableMutexGuard guard(m_rMutex); - if (m_aNodePtr != nullptr) - { - // get current data - std::shared_ptr<xmlChar const> const pContent( - xmlNodeGetContent(m_aNodePtr), xmlFree); - OString aData(reinterpret_cast<sal_Char const*>(pContent.get())); - OUString tmp(OStringToOUString(aData, RTL_TEXTENCODING_UTF8)); - if (offset > tmp.getLength() || offset < 0) { - DOMException e; - e.Code = DOMExceptionType_INDEX_SIZE_ERR; - throw e; - } + if (m_aNodePtr == nullptr) + return; + + // get current data + std::shared_ptr<xmlChar const> const pContent( + xmlNodeGetContent(m_aNodePtr), xmlFree); + OString aData(reinterpret_cast<sal_Char const*>(pContent.get())); + OUString tmp(OStringToOUString(aData, RTL_TEXTENCODING_UTF8)); + if (offset > tmp.getLength() || offset < 0) { + DOMException e; + e.Code = DOMExceptionType_INDEX_SIZE_ERR; + throw e; + } - OUString tmp2 = tmp.copy(0, offset); - tmp2 += arg; - tmp2 += tmp.copy(offset); - OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); - xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr())); - OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); + OUString tmp2 = tmp.copy(0, offset); + tmp2 += arg; + tmp2 += tmp.copy(offset); + OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); + xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr())); + OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); + + guard.clear(); // release mutex before calling event handlers + dispatchEvent_Impl(oldValue, newValue); - guard.clear(); // release mutex before calling event handlers - dispatchEvent_Impl(oldValue, newValue); - } } @@ -186,31 +188,32 @@ namespace DOM { ::osl::ClearableMutexGuard guard(m_rMutex); - if (m_aNodePtr != nullptr) - { - // get current data - std::shared_ptr<xmlChar const> const pContent( - xmlNodeGetContent(m_aNodePtr), xmlFree); - OString aData(reinterpret_cast<sal_Char const*>(pContent.get())); - OUString tmp(OStringToOUString(aData, RTL_TEXTENCODING_UTF8)); - if (offset > tmp.getLength() || offset < 0 || count < 0){ - DOMException e; - e.Code = DOMExceptionType_INDEX_SIZE_ERR; - throw e; - } - if ((offset+count) > tmp.getLength()) - count = tmp.getLength() - offset; + if (m_aNodePtr == nullptr) + return; + + // get current data + std::shared_ptr<xmlChar const> const pContent( + xmlNodeGetContent(m_aNodePtr), xmlFree); + OString aData(reinterpret_cast<sal_Char const*>(pContent.get())); + OUString tmp(OStringToOUString(aData, RTL_TEXTENCODING_UTF8)); + if (offset > tmp.getLength() || offset < 0 || count < 0){ + DOMException e; + e.Code = DOMExceptionType_INDEX_SIZE_ERR; + throw e; + } + if ((offset+count) > tmp.getLength()) + count = tmp.getLength() - offset; - OUString tmp2 = tmp.copy(0, offset); - tmp2 += arg; - tmp2 += tmp.copy(offset+count); - OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); - xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr())); - OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); + OUString tmp2 = tmp.copy(0, offset); + tmp2 += arg; + tmp2 += tmp.copy(offset+count); + OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); + xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr())); + OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); + + guard.clear(); // release mutex before calling event handlers + dispatchEvent_Impl(oldValue, newValue); - guard.clear(); // release mutex before calling event handlers - dispatchEvent_Impl(oldValue, newValue); - } } /** diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 327986919ab7..82cd2bf197c0 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -362,49 +362,49 @@ void PrintOutHelper( SfxViewShell const * pViewShell, const uno::Any& From, cons SfxViewFrame* pViewFrame = nullptr; if ( pViewShell ) pViewFrame = pViewShell->GetViewFrame(); - if ( pViewFrame ) - { - SfxAllItemSet aArgs( SfxGetpApp()->GetPool() ); + if ( !pViewFrame ) + return; - SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate ); - aArgs.Put( sfxCollate, sfxCollate.Which() ); - SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies ); - aArgs.Put( sfxCopies, sfxCopies.Which() ); - if ( !sFileName.isEmpty() ) - { - SfxStringItem sfxFileName( SID_FILE_NAME, sFileName); - aArgs.Put( sfxFileName, sfxFileName.Which() ); + SfxAllItemSet aArgs( SfxGetpApp()->GetPool() ); - } - if ( !sRange.isEmpty() ) - { - SfxStringItem sfxRange( SID_PRINT_PAGES, sRange ); - aArgs.Put( sfxRange, sfxRange.Which() ); - } - SfxBoolItem sfxSelection( SID_SELECTION, bSelection ); - aArgs.Put( sfxSelection, sfxSelection.Which() ); - SfxBoolItem sfxAsync( SID_ASYNCHRON, false ); - aArgs.Put( sfxAsync, sfxAsync.Which() ); - SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate ); + aArgs.Put( sfxCollate, sfxCollate.Which() ); + SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies ); + aArgs.Put( sfxCopies, sfxCopies.Which() ); + if ( !sFileName.isEmpty() ) + { + SfxStringItem sfxFileName( SID_FILE_NAME, sFileName); + aArgs.Put( sfxFileName, sfxFileName.Which() ); - if ( pDispatcher ) + } + if ( !sRange.isEmpty() ) + { + SfxStringItem sfxRange( SID_PRINT_PAGES, sRange ); + aArgs.Put( sfxRange, sfxRange.Which() ); + } + SfxBoolItem sfxSelection( SID_SELECTION, bSelection ); + aArgs.Put( sfxSelection, sfxSelection.Which() ); + SfxBoolItem sfxAsync( SID_ASYNCHRON, false ); + aArgs.Put( sfxAsync, sfxAsync.Which() ); + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + + if ( pDispatcher ) + { + if ( bPreview ) { - if ( bPreview ) + if ( !pViewFrame->GetFrame().IsInPlace() ) { - if ( !pViewFrame->GetFrame().IsInPlace() ) - { - // #TODO is this necessary ( calc specific ) + // #TODO is this necessary ( calc specific ) // SC_MOD()->InputEnterHandler(); - pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SfxCallMode::SYNCHRON ); - WaitUntilPreviewIsClosed( pViewFrame ); - } + pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SfxCallMode::SYNCHRON ); + WaitUntilPreviewIsClosed( pViewFrame ); } - else - pDispatcher->Execute( (sal_uInt16)SID_PRINTDOC, SfxCallMode::SYNCHRON, aArgs ); } - + else + pDispatcher->Execute( (sal_uInt16)SID_PRINTDOC, SfxCallMode::SYNCHRON, aArgs ); } + // #FIXME #TODO // 1 ActivePrinter ( how/can we switch a printer via API? ) // 2 PrintToFile ( ms behaviour if this option is specified but no diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index a21bc6118099..f5786ac3fe38 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3147,38 +3147,39 @@ void DomainMapper_Impl::handleRubyEQField( const FieldContextPtr& pContext) } nIndex = rCommand.indexOf("\\o"); - if (nIndex != -1 && (nIndex = rCommand.indexOf('(', nIndex)) != -1 && (nEnd = rCommand.lastIndexOf(')'))!=-1 && nEnd > nIndex) + if (nIndex == -1 || (nIndex = rCommand.indexOf('(', nIndex)) == -1 || (nEnd = rCommand.lastIndexOf(')'))==-1 || nEnd <= nIndex) + return; + + OUString sRubyParts = rCommand.copy(nIndex+1,nEnd-nIndex-1); + nIndex = 0; + OUString sPart1 = sRubyParts.getToken(0, ',', nIndex); + OUString sPart2 = sRubyParts.getToken(0, ',', nIndex); + if ((nIndex = sPart1.indexOf('(')) != -1 && (nEnd = sPart1.lastIndexOf(')'))!=-1 && nEnd > nIndex) { - OUString sRubyParts = rCommand.copy(nIndex+1,nEnd-nIndex-1); - nIndex = 0; - OUString sPart1 = sRubyParts.getToken(0, ',', nIndex); - OUString sPart2 = sRubyParts.getToken(0, ',', nIndex); - if ((nIndex = sPart1.indexOf('(')) != -1 && (nEnd = sPart1.lastIndexOf(')'))!=-1 && nEnd > nIndex) - { - aInfo.sRubyText = sPart1.copy(nIndex+1,nEnd-nIndex-1); - } + aInfo.sRubyText = sPart1.copy(nIndex+1,nEnd-nIndex-1); + } - PropertyMapPtr pRubyContext(new PropertyMap()); - pRubyContext->InsertProps(GetTopContext()); - if (aInfo.nHps > 0) - { - double fVal = double(aInfo.nHps) / 2.; - uno::Any aVal = uno::makeAny( fVal ); + PropertyMapPtr pRubyContext(new PropertyMap()); + pRubyContext->InsertProps(GetTopContext()); + if (aInfo.nHps > 0) + { + double fVal = double(aInfo.nHps) / 2.; + uno::Any aVal = uno::makeAny( fVal ); - pRubyContext->Insert(PROP_CHAR_HEIGHT, aVal); - pRubyContext->Insert(PROP_CHAR_HEIGHT_ASIAN, aVal); - } - PropertyValueVector_t aProps = comphelper::sequenceToContainer< PropertyValueVector_t >(pRubyContext->GetPropertyValues()); - aInfo.sRubyStyle = m_rDMapper.getOrCreateCharStyle(aProps, /*bAlwaysCreate=*/false); - PropertyMapPtr pCharContext(new PropertyMap()); - if (m_pLastCharacterContext.get()) - pCharContext->InsertProps(m_pLastCharacterContext); - pCharContext->InsertProps(pContext->getProperties()); - pCharContext->Insert(PROP_RUBY_TEXT, uno::makeAny( aInfo.sRubyText ) ); - pCharContext->Insert(PROP_RUBY_ADJUST, uno::makeAny((sal_Int16)ConversionHelper::convertRubyAlign(aInfo.nRubyAlign))); - pCharContext->Insert(PROP_RUBY_STYLE, uno::makeAny(aInfo.sRubyStyle)); - appendTextPortion(sPart2, pCharContext); + pRubyContext->Insert(PROP_CHAR_HEIGHT, aVal); + pRubyContext->Insert(PROP_CHAR_HEIGHT_ASIAN, aVal); } + PropertyValueVector_t aProps = comphelper::sequenceToContainer< PropertyValueVector_t >(pRubyContext->GetPropertyValues()); + aInfo.sRubyStyle = m_rDMapper.getOrCreateCharStyle(aProps, /*bAlwaysCreate=*/false); + PropertyMapPtr pCharContext(new PropertyMap()); + if (m_pLastCharacterContext.get()) + pCharContext->InsertProps(m_pLastCharacterContext); + pCharContext->InsertProps(pContext->getProperties()); + pCharContext->Insert(PROP_RUBY_TEXT, uno::makeAny( aInfo.sRubyText ) ); + pCharContext->Insert(PROP_RUBY_ADJUST, uno::makeAny((sal_Int16)ConversionHelper::convertRubyAlign(aInfo.nRubyAlign))); + pCharContext->Insert(PROP_RUBY_STYLE, uno::makeAny(aInfo.sRubyStyle)); + appendTextPortion(sPart2, pCharContext); + } void DomainMapper_Impl::handleAutoNum @@ -3230,95 +3231,96 @@ void DomainMapper_Impl::handleAuthor { //some docproperties should be imported as document statistic fields, some as DocInfo fields //others should be user fields - if (!rFirstParam.isEmpty()) + if (rFirstParam.isEmpty()) + return; + + #define SET_ARABIC 0x01 + #define SET_DATE 0x04 + struct DocPropertyMap { - #define SET_ARABIC 0x01 - #define SET_DATE 0x04 - struct DocPropertyMap - { - const sal_Char* pDocPropertyName; - const sal_Char* pServiceName; - sal_uInt8 nFlags; - }; - static const DocPropertyMap aDocProperties[] = - { - {"CreateTime", "DocInfo.CreateDateTime", SET_DATE}, - {"Characters", "CharacterCount", SET_ARABIC}, - {"Comments", "DocInfo.Description", 0}, - {"Keywords", "DocInfo.KeyWords", 0}, - {"LastPrinted", "DocInfo.PrintDateTime", 0}, - {"LastSavedBy", "DocInfo.ChangeAuthor", 0}, - {"LastSavedTime", "DocInfo.ChangeDateTime", SET_DATE}, - {"Paragraphs", "ParagraphCount", SET_ARABIC}, - {"RevisionNumber", "DocInfo.Revision", 0}, - {"Subject", "DocInfo.Subject", 0}, - {"Template", "TemplateName", 0}, - {"Title", "DocInfo.Title", 0}, - {"TotalEditingTime", "DocInfo.EditTime", 0}, - {"Words", "WordCount", SET_ARABIC} - - //other available DocProperties: - //Bytes, Category, CharactersWithSpaces, Company - //HyperlinkBase, - //Lines, Manager, NameofApplication, ODMADocId, Pages, - //Security, - }; - uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(m_xTextDocument, uno::UNO_QUERY); - uno::Reference<document::XDocumentProperties> xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties(); - uno::Reference<beans::XPropertySet> xUserDefinedProps(xDocumentProperties->getUserDefinedProperties(), uno::UNO_QUERY_THROW); - uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xUserDefinedProps->getPropertySetInfo(); - //search for a field mapping - OUString sFieldServiceName; - sal_uInt16 nMap = 0; - for( ; nMap < SAL_N_ELEMENTS(aDocProperties); ++nMap ) - { - if ((rFirstParam.equalsAscii(aDocProperties[nMap].pDocPropertyName)) && (!xPropertySetInfo->hasPropertyByName(rFirstParam))) - { - sFieldServiceName = - OUString::createFromAscii - (aDocProperties[nMap].pServiceName); - break; - } - } - OUString sServiceName("com.sun.star.text.TextField."); - bool bIsCustomField = false; - if(sFieldServiceName.isEmpty()) - { - //create a custom property field - sServiceName += "DocInfo.Custom"; - bIsCustomField = true; - } - else + const sal_Char* pDocPropertyName; + const sal_Char* pServiceName; + sal_uInt8 nFlags; + }; + static const DocPropertyMap aDocProperties[] = + { + {"CreateTime", "DocInfo.CreateDateTime", SET_DATE}, + {"Characters", "CharacterCount", SET_ARABIC}, + {"Comments", "DocInfo.Description", 0}, + {"Keywords", "DocInfo.KeyWords", 0}, + {"LastPrinted", "DocInfo.PrintDateTime", 0}, + {"LastSavedBy", "DocInfo.ChangeAuthor", 0}, + {"LastSavedTime", "DocInfo.ChangeDateTime", SET_DATE}, + {"Paragraphs", "ParagraphCount", SET_ARABIC}, + {"RevisionNumber", "DocInfo.Revision", 0}, + {"Subject", "DocInfo.Subject", 0}, + {"Template", "TemplateName", 0}, + {"Title", "DocInfo.Title", 0}, + {"TotalEditingTime", "DocInfo.EditTime", 0}, + {"Words", "WordCount", SET_ARABIC} + + //other available DocProperties: + //Bytes, Category, CharactersWithSpaces, Company + //HyperlinkBase, + //Lines, Manager, NameofApplication, ODMADocId, Pages, + //Security, + }; + uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(m_xTextDocument, uno::UNO_QUERY); + uno::Reference<document::XDocumentProperties> xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties(); + uno::Reference<beans::XPropertySet> xUserDefinedProps(xDocumentProperties->getUserDefinedProperties(), uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xUserDefinedProps->getPropertySetInfo(); + //search for a field mapping + OUString sFieldServiceName; + sal_uInt16 nMap = 0; + for( ; nMap < SAL_N_ELEMENTS(aDocProperties); ++nMap ) + { + if ((rFirstParam.equalsAscii(aDocProperties[nMap].pDocPropertyName)) && (!xPropertySetInfo->hasPropertyByName(rFirstParam))) { - sServiceName += sFieldServiceName; + sFieldServiceName = + OUString::createFromAscii + (aDocProperties[nMap].pServiceName); + break; } - if (m_xTextFactory.is()) - xFieldInterface = m_xTextFactory->createInstance(sServiceName); - uno::Reference<beans::XPropertySet> xFieldProperties = - uno::Reference< beans::XPropertySet >( xFieldInterface, - uno::UNO_QUERY_THROW); - if( bIsCustomField ) - { + } + OUString sServiceName("com.sun.star.text.TextField."); + bool bIsCustomField = false; + if(sFieldServiceName.isEmpty()) + { + //create a custom property field + sServiceName += "DocInfo.Custom"; + bIsCustomField = true; + } + else + { + sServiceName += sFieldServiceName; + } + if (m_xTextFactory.is()) + xFieldInterface = m_xTextFactory->createInstance(sServiceName); + uno::Reference<beans::XPropertySet> xFieldProperties = + uno::Reference< beans::XPropertySet >( xFieldInterface, + uno::UNO_QUERY_THROW); + if( bIsCustomField ) + { + xFieldProperties->setPropertyValue( + getPropertyName(PROP_NAME), uno::makeAny(rFirstParam)); + pContext->SetCustomField( xFieldProperties ); + } + else + { + if(0 != (aDocProperties[nMap].nFlags & SET_ARABIC)) xFieldProperties->setPropertyValue( - getPropertyName(PROP_NAME), uno::makeAny(rFirstParam)); - pContext->SetCustomField( xFieldProperties ); - } - else + getPropertyName(PROP_NUMBERING_TYPE), + uno::makeAny( style::NumberingType::ARABIC )); + else if(0 != (aDocProperties[nMap].nFlags & SET_DATE)) { - if(0 != (aDocProperties[nMap].nFlags & SET_ARABIC)) - xFieldProperties->setPropertyValue( - getPropertyName(PROP_NUMBERING_TYPE), - uno::makeAny( style::NumberingType::ARABIC )); - else if(0 != (aDocProperties[nMap].nFlags & SET_DATE)) - { - xFieldProperties->setPropertyValue( - getPropertyName(PROP_IS_DATE), - uno::makeAny( true )); - SetNumberFormat( pContext->GetCommand(), xFieldProperties ); - } + xFieldProperties->setPropertyValue( + getPropertyName(PROP_IS_DATE), + uno::makeAny( true )); + SetNumberFormat( pContext->GetCommand(), xFieldProperties ); } } + #undef SET_ARABIC #undef SET_DATE } |