diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-31 11:08:41 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-06-03 10:00:01 +0200 |
commit | 65edd1c8a87abf3cfeaaa6490795be0d06049bea (patch) | |
tree | 6b1cac02ed09271a06eede262331a44f20d44bf2 /svx | |
parent | e6c13f2846c684410e060701cbf1deb9bcaec890 (diff) |
fdo#46808, Convert ComponentContext to XComponentContext
Change-Id: Ie51549cb77cfc026be85c9d9bad9b9e7ef37334f
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/fmcomp/fmgridcl.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/fmview.cxx | 3 | ||||
-rw-r--r-- | svx/source/form/fmvwimp.cxx | 34 | ||||
-rw-r--r-- | svx/source/form/formcontrolfactory.cxx | 22 | ||||
-rw-r--r-- | svx/source/inc/fmvwimp.hxx | 8 | ||||
-rw-r--r-- | svx/source/inc/formcontrolfactory.hxx | 3 | ||||
-rw-r--r-- | svx/source/sidebar/ContextChangeEventMultiplexer.cxx | 8 | ||||
-rw-r--r-- | svx/source/sidebar/nbdtmg.cxx | 170 | ||||
-rw-r--r-- | svx/source/sidebar/paragraph/ParaNumberingControl.cxx | 9 |
9 files changed, 125 insertions, 136 deletions
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index a864db34a1c2..ed3b2aa95177 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -545,7 +545,7 @@ IMPL_LINK( FmGridHeader, OnAsyncExecuteDrop, void*, /*NOTINTERESTEDIN*/ ) else xCol->setPropertyValue(FM_PROP_LABEL, makeAny(sFieldName)); - FormControlFactory aControlFactory( ::comphelper::getProcessServiceFactory() ); + FormControlFactory aControlFactory; aControlFactory.initializeControlModel( DocumentClassification::classifyHostDocument( xCols ), xCol ); aControlFactory.initializeFieldDependentProperties( xField, xCol, xNumberFormats ); @@ -938,7 +938,7 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe } else { - FormControlFactory factory( ::comphelper::getProcessServiceFactory() ); + FormControlFactory factory; OUString sLabel = factory.getDefaultUniqueName_ByComponentType( Reference< XNameAccess >( xCols, UNO_QUERY_THROW ), xNewCol ); diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index b18745e2f634..83c6709f3476 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -93,7 +93,7 @@ FmFormView::FmFormView( FmFormModel* pModel, OutputDevice* pOut ) void FmFormView::Init() { pFormShell = NULL; - pImpl = new FmXFormView(::comphelper::getProcessComponentContext(),this); + pImpl = new FmXFormView(this); pImpl->acquire(); ////////////////////////////////////////////////////////////////////// @@ -594,7 +594,6 @@ void FmFormView::createControlLabelPair( OutputDevice* _pOutDev, sal_Int32 _nXOf SdrPage* _pLabelPage, SdrPage* _pControlPage, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl ) { FmXFormView::createControlLabelPair( - ::comphelper::getProcessComponentContext(), *_pOutDev, _nXOffsetMM, _nYOffsetMM, _rxField, _rxNumberFormats, _nControlObjectID, _rFieldPostfix, _nInventor, _nLabelObjectID, diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index c309bb850631..2bec2867d297 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -77,6 +77,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <comphelper/numbers.hxx> #include <comphelper/property.hxx> +#include <comphelper/processfactory.hxx> #include <cppuhelper/exc_hlp.hxx> #include <unotools/moduleoptions.hxx> #include <tools/diagnose_ex.h> @@ -103,6 +104,7 @@ using namespace ::svxform; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::style::VerticalAlignment_MIDDLE; using ::com::sun::star::form::FormButtonType_SUBMIT; using ::com::sun::star::form::binding::XValueBinding; @@ -163,9 +165,9 @@ public: //======================================================================== DBG_NAME(FormViewPageWindowAdapter) //------------------------------------------------------------------------ -FormViewPageWindowAdapter::FormViewPageWindowAdapter( const ::comphelper::ComponentContext& _rContext, const SdrPageWindow& _rWindow, FmXFormView* _pViewImpl ) +FormViewPageWindowAdapter::FormViewPageWindowAdapter( const css::uno::Reference<css::uno::XComponentContext>& _rContext, const SdrPageWindow& _rWindow, FmXFormView* _pViewImpl ) : m_xControlContainer( _rWindow.GetControlContainer() ), - m_aContext( _rContext ), + m_xContext( _rContext ), m_pViewImpl( _pViewImpl ), m_pWindow( dynamic_cast< Window* >( &_rWindow.GetPaintWindow().GetOutputDevice() ) ) { @@ -339,7 +341,7 @@ void FormViewPageWindowAdapter::setController(const Reference< XForm > & xForm, Reference< XTabControllerModel > xTabOrder(xForm, UNO_QUERY); // create a form controller - Reference< XFormController > xController( FormController::create(m_aContext.getUNOContext()) ); + Reference< XFormController > xController( FormController::create(m_xContext) ); Reference< XInteractionHandler > xHandler; if ( _rxParentController.is() ) @@ -417,9 +419,8 @@ void FormViewPageWindowAdapter::updateTabOrder( const Reference< XForm >& _rxFor } //------------------------------------------------------------------------ -FmXFormView::FmXFormView(const ::comphelper::ComponentContext& _rContext, FmFormView* _pView ) - :m_aContext( _rContext ) - ,m_pMarkedGrid(NULL) +FmXFormView::FmXFormView(FmFormView* _pView ) + :m_pMarkedGrid(NULL) ,m_pView(_pView) ,m_nActivationEvent(0) ,m_nErrorMessageEvent( 0 ) @@ -577,7 +578,7 @@ void FmXFormView::addWindow(const SdrPageWindow& rWindow) && ( !findWindow( xCC ).is() ) ) { - PFormViewPageWindowAdapter pAdapter = new FormViewPageWindowAdapter( m_aContext, rWindow, this ); + PFormViewPageWindowAdapter pAdapter = new FormViewPageWindowAdapter( comphelper::getProcessComponentContext(), rWindow, this ); m_aPageWindowAdapters.push_back( pAdapter ); // Am ControlContainer horchen um Aenderungen mitzbekommen @@ -1004,7 +1005,7 @@ void FmXFormView::onCreatedFormObject( FmFormObj& _rFormObject ) return; // some initial property defaults - FormControlFactory aControlFactory( m_aContext ); + FormControlFactory aControlFactory; aControlFactory.initializeControlModel( pShellImpl->getDocumentType(), _rFormObject ); if ( !pShellImpl->GetWizardUsing() ) @@ -1067,7 +1068,8 @@ IMPL_LINK( FmXFormView, OnStartControlWizard, void*, /**/ ) Reference< XExecutableDialog > xWizard; try { - m_aContext.createComponentWithArguments( pWizardAsciiName, aWizardArgs.getWrappedPropertyValues(), xWizard ); + Reference<XComponentContext> xContext = comphelper::getProcessComponentContext(); + xWizard.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii(pWizardAsciiName), aWizardArgs.getWrappedPropertyValues(), xContext ), UNO_QUERY);; } catch (const Exception&) { @@ -1161,7 +1163,7 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript // obtain the data source if ( !xDataSource.is() ) - xDataSource = OStaticDataAccessTools().getDataSource( sDataSource, m_aContext.getUNOContext() ); + xDataSource = OStaticDataAccessTools().getDataSource( sDataSource, comphelper::getProcessComponentContext() ); // and the connection, if necessary if ( !xConnection.is() ) @@ -1169,7 +1171,7 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript sDataSource, OUString(), OUString(), - m_aContext.getUNOContext() + comphelper::getProcessComponentContext() ) ); } catch (const SQLException&) @@ -1489,7 +1491,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXO const Reference< XDataSource >& _rxDataSource, const OUString& _rDataSourceName, const OUString& _rCommand, const sal_Int32 _nCommandType ) { - if ( !createControlLabelPair( m_aContext, _rOutDev, _nXOffsetMM, _nYOffsetMM, + if ( !createControlLabelPair( _rOutDev, _nXOffsetMM, _nYOffsetMM, _rxField, _rxNumberFormats, _nControlObjectID, _rFieldPostfix, FmFormInventor, OBJ_FM_FIXEDTEXT, NULL, NULL, NULL, _rpLabel, _rpControl ) ) @@ -1501,7 +1503,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXO lcl_insertIntoFormComponentHierarchy_throw( *m_pView, *_rpControl, _rxDataSource, _rDataSourceName, _rCommand, _nCommandType ); // some context-dependent initializations - FormControlFactory aControlFactory( m_aContext ); + FormControlFactory aControlFactory; if ( _rpLabel ) aControlFactory.initializeControlModel( impl_getDocumentType(), *_rpLabel ); aControlFactory.initializeControlModel( impl_getDocumentType(), *_rpControl ); @@ -1510,8 +1512,8 @@ bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXO } //------------------------------------------------------------------------ -bool FmXFormView::createControlLabelPair( const ::comphelper::ComponentContext& _rContext, - OutputDevice& _rOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM, const Reference< XPropertySet >& _rxField, +bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM, + const Reference< XPropertySet >& _rxField, const Reference< XNumberFormats >& _rxNumberFormats, sal_uInt16 _nControlObjectID, const OUString& _rFieldPostfix, sal_uInt32 _nInventor, sal_uInt16 _nLabelObjectID, SdrPage* _pLabelPage, SdrPage* _pControlPage, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl) @@ -1660,7 +1662,7 @@ bool FmXFormView::createControlLabelPair( const ::comphelper::ComponentContext& if ( _rxField.is() ) { - FormControlFactory aControlFactory( _rContext ); + FormControlFactory aControlFactory; aControlFactory.initializeFieldDependentProperties( _rxField, xControlSet, _rxNumberFormats ); } diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 5197304149c6..ccd1cf905d21 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -41,8 +41,8 @@ #include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/awt/FontDescriptor.hpp> -#include <comphelper/componentcontext.hxx> #include <comphelper/numbers.hxx> +#include <comphelper/processfactory.hxx> #include <unotools/syslocale.hxx> #include <tools/gen.hxx> #include <tools/diagnose_ex.h> @@ -65,6 +65,7 @@ namespace svxform using ::com::sun::star::uno::makeAny; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::awt::XControlModel; using ::com::sun::star::form::XFormComponent; @@ -98,10 +99,10 @@ namespace svxform //==================================================================== struct FormControlFactory_Data { - ::comphelper::ComponentContext m_aContext; + Reference<XComponentContext> m_xContext; - FormControlFactory_Data( const ::comphelper::ComponentContext& _rContext ) - :m_aContext( _rContext ) + FormControlFactory_Data( const Reference<XComponentContext>& _rContext ) + :m_xContext( _rContext ) { } }; @@ -110,11 +111,16 @@ namespace svxform //= FormControlFactory //==================================================================== //-------------------------------------------------------------------- - FormControlFactory::FormControlFactory( const ::comphelper::ComponentContext& _rContext ) + FormControlFactory::FormControlFactory( const Reference<XComponentContext>& _rContext ) :m_pData( new FormControlFactory_Data( _rContext ) ) { } + FormControlFactory::FormControlFactory( ) + :m_pData( new FormControlFactory_Data( comphelper::getProcessComponentContext() ) ) + { + } + //-------------------------------------------------------------------- FormControlFactory::~FormControlFactory() { @@ -187,7 +193,7 @@ namespace svxform //.................................................................... static Sequence< PropertyValue > lcl_getDataSourceIndirectProperties( const Reference< XPropertySet >& _rxControlModel, - const ::comphelper::ComponentContext& _rContext ) + const Reference<XComponentContext>& _rContext ) { OSL_PRECOND( _rxControlModel.is(), "lcl_getDataSourceIndirectProperties: invalid model!" ); @@ -213,7 +219,7 @@ namespace svxform Reference< XPropertySet > xDsProperties; if ( !sDataSourceName.isEmpty() ) - xDsProperties = xDsProperties.query( OStaticDataAccessTools().getDataSource( sDataSourceName, _rContext.getUNOContext() ) ); + xDsProperties = xDsProperties.query( OStaticDataAccessTools().getDataSource( sDataSourceName, _rContext ) ); if ( xDsProperties.is() ) xDsProperties->getPropertyValue( OUString( "Info" ) ) >>= aInfo; } @@ -528,7 +534,7 @@ namespace svxform // let's see if the data source which the form belongs to (if any) // has a setting for the preferred line end format sal_Bool bDosLineEnds = sal_False; - Sequence< PropertyValue > aInfo = lcl_getDataSourceIndirectProperties( _rxModel, m_pData->m_aContext ); + Sequence< PropertyValue > aInfo = lcl_getDataSourceIndirectProperties( _rxModel, m_pData->m_xContext ); const PropertyValue* pInfo = aInfo.getConstArray(); const PropertyValue* pInfoEnd = pInfo + aInfo.getLength(); for ( ; pInfo != pInfoEnd; ++pInfo ) diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx index 4124f84cfcd0..02bcbc108654 100644 --- a/svx/source/inc/fmvwimp.hxx +++ b/svx/source/inc/fmvwimp.hxx @@ -86,7 +86,7 @@ class FormViewPageWindowAdapter : public FormViewPageWindowAdapter_Base ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > > m_aControllerList; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xControlContainer; - ::comphelper::ComponentContext m_aContext; + css::uno::Reference<css::uno::XComponentContext> m_xContext; FmXFormView* m_pViewImpl; Window* m_pWindow; @@ -94,7 +94,7 @@ protected: ~FormViewPageWindowAdapter(); public: - FormViewPageWindowAdapter( const ::comphelper::ComponentContext& _rContext, + FormViewPageWindowAdapter( const css::uno::Reference<css::uno::XComponentContext>& _rContext, const SdrPageWindow&, FmXFormView* pView); //const SdrPageViewWinRec*, FmXFormView* pView); @@ -150,7 +150,6 @@ class FmXFormView : public ::cppu::WeakImplHelper3< class ObjectRemoveListener; friend class ObjectRemoveListener; - ::comphelper::ComponentContext m_aContext; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> m_xWindow; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xLastCreatedControlModel; @@ -181,7 +180,7 @@ class FmXFormView : public ::cppu::WeakImplHelper3< void removeGridWindowListening(); protected: - FmXFormView( const ::comphelper::ComponentContext& _rContext, FmFormView* _pView ); + FmXFormView( FmFormView* _pView ); ~FmXFormView(); void saveMarkList( sal_Bool _bSmartUnmark = sal_True ); @@ -252,7 +251,6 @@ private: SdrObject* implCreateXFormsControl( const ::svx::OXFormsDescriptor &_rDesc ); static bool createControlLabelPair( - const ::comphelper::ComponentContext& _rContext, OutputDevice& _rOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM, diff --git a/svx/source/inc/formcontrolfactory.hxx b/svx/source/inc/formcontrolfactory.hxx index 23e0fb08c80d..db1a1ab24b05 100644 --- a/svx/source/inc/formcontrolfactory.hxx +++ b/svx/source/inc/formcontrolfactory.hxx @@ -51,7 +51,8 @@ namespace svxform class FormControlFactory { public: - FormControlFactory( const ::comphelper::ComponentContext& _rContext ); + FormControlFactory( const css::uno::Reference<css::uno::XComponentContext>& _rContext ); + FormControlFactory(); ~FormControlFactory(); /** initializes the given control model which is to be newly inserted into a document diff --git a/svx/source/sidebar/ContextChangeEventMultiplexer.cxx b/svx/source/sidebar/ContextChangeEventMultiplexer.cxx index 427c37a37d03..602a22ee926d 100644 --- a/svx/source/sidebar/ContextChangeEventMultiplexer.cxx +++ b/svx/source/sidebar/ContextChangeEventMultiplexer.cxx @@ -21,7 +21,7 @@ #include <com/sun/star/ui/ContextChangeEventObject.hpp> #include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp> #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/componentcontext.hxx> #include <sfx2/viewsh.hxx> @@ -69,10 +69,8 @@ void ContextChangeEventMultiplexer::NotifyContextChange ( { try { - const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory()); - const Reference<frame::XModuleManager> xModuleManager ( - aContext.createComponent("com.sun.star.frame.ModuleManager" ), - UNO_QUERY_THROW ); + const Reference<frame::XModuleManager> xModuleManager = + frame::ModuleManager::create( comphelper::getProcessComponentContext() ); return xModuleManager->identify(rxFrame); } catch (const Exception&) diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index a1eb0c1bcb5c..288a85ad0112 100644 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -44,7 +44,7 @@ #include <com/sun/star/style/NumberingType.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/text/XDefaultNumberingProvider.hpp> +#include <com/sun/star/text/DefaultNumberingProvider.hpp> #include <com/sun/star/text/XNumberingFormatter.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <comphelper/processfactory.hxx> @@ -1410,72 +1410,67 @@ NumberingTypeMgr::NumberingTypeMgr(const NumberingTypeMgr& aTypeMgr): void NumberingTypeMgr::Init() { - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference < XInterface > xI = xMSF->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); - Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference<XDefaultNumberingProvider> xDefNum = DefaultNumberingProvider::create( xContext ); - if(xDefNum.is()) + Sequence< Sequence< PropertyValue > > aNumberings; + Locale aLocale(Application::GetSettings().GetLanguageTag().getLocale()); + try { - Sequence< Sequence< PropertyValue > > aNumberings; - Locale aLocale(Application::GetSettings().GetLanguageTag().getLocale()); - try - { - aNumberings = xDefNum->getDefaultContinuousNumberingLevels( aLocale ); + aNumberings = xDefNum->getDefaultContinuousNumberingLevels( aLocale ); - sal_Int32 nLength = aNumberings.getLength() > DEFAULT_NUM_VALUSET_COUNT ? DEFAULT_NUM_VALUSET_COUNT :aNumberings.getLength(); + sal_Int32 nLength = aNumberings.getLength() > DEFAULT_NUM_VALUSET_COUNT ? DEFAULT_NUM_VALUSET_COUNT :aNumberings.getLength(); - const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray(); - for(sal_Int32 i = 0; i < nLength; i++) + const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray(); + for(sal_Int32 i = 0; i < nLength; i++) + { + NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(pValuesArr[i]); + NumberSettings_Impl* pNumEntry = new NumberSettings_Impl; + pNumEntry->nIndex = i + 1; + pNumEntry->nIndexDefault = i; + pNumEntry->pNumSetting = pNew; + //SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS + i )); { - NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(pValuesArr[i]); - NumberSettings_Impl* pNumEntry = new NumberSettings_Impl; - pNumEntry->nIndex = i + 1; - pNumEntry->nIndexDefault = i; - pNumEntry->pNumSetting = pNew; - //SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS + i )); + String sText; + //const OUString sValue(C2U("Value")); + Reference<XNumberingFormatter> xFormatter(xDefNum, UNO_QUERY); + if(xFormatter.is() && aNumberings.getLength() > i) { - String sText; - //const OUString sValue(C2U("Value")); - Reference<XNumberingFormatter> xFormatter(xDefNum, UNO_QUERY); - if(xFormatter.is() && aNumberings.getLength() > i) + + for (sal_uInt16 j=0;j<3;j++) { + Sequence<PropertyValue> aLevel = aNumberings.getConstArray()[i]; + try + { + aLevel.realloc(aLevel.getLength() + 1); + PropertyValue& rValue = aLevel.getArray()[aLevel.getLength() - 1]; + rValue.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); + rValue.Value <<= (sal_Int32)(j + 1); + + if (j!=0) + sText += OUString(" "); - for (sal_uInt16 j=0;j<3;j++) + sText+=String(xFormatter->makeNumberingString( aLevel, aLocale )); + } + catch (const Exception&) { - Sequence<PropertyValue> aLevel = aNumberings.getConstArray()[i]; - try - { - aLevel.realloc(aLevel.getLength() + 1); - PropertyValue& rValue = aLevel.getArray()[aLevel.getLength() - 1]; - rValue.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); - rValue.Value <<= (sal_Int32)(j + 1); - - if (j!=0) - sText += OUString(" "); - - sText+=String(xFormatter->makeNumberingString( aLevel, aLocale )); - } - catch (const Exception&) - { - OSL_ENSURE(false, "Exception in DefaultNumberingProvider::makeNumberingString"); - } + OSL_ENSURE(false, "Exception in DefaultNumberingProvider::makeNumberingString"); } } - String aStrFromRES(SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS)); - String aReplace = OUString("%NUMBERINGSAMPLE"); - aStrFromRES.SearchAndReplace(aReplace,sText); - pNumEntry->sDescription = aStrFromRES; } - //End modification - - //pNumEntry->sDescription = SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTION_0 + i ); - pNumberSettingsArr->push_back(boost::shared_ptr<NumberSettings_Impl>(pNumEntry)); + String aStrFromRES(SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS)); + String aReplace = OUString("%NUMBERINGSAMPLE"); + aStrFromRES.SearchAndReplace(aReplace,sText); + pNumEntry->sDescription = aStrFromRES; } + //End modification + + //pNumEntry->sDescription = SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTION_0 + i ); + pNumberSettingsArr->push_back(boost::shared_ptr<NumberSettings_Impl>(pNumEntry)); } - catch(Exception&) - { - } + } + catch(Exception&) + { } } @@ -1689,50 +1684,45 @@ OutlineTypeMgr::OutlineTypeMgr(const OutlineTypeMgr& aTypeMgr): void OutlineTypeMgr::Init() { - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference < XInterface > xI = xMSF->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); - Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference<XDefaultNumberingProvider> xDefNum = DefaultNumberingProvider::create( xContext ); - if(xDefNum.is()) + Sequence<Reference<XIndexAccess> > aOutlineAccess; + Locale aLocale(Application::GetSettings().GetLanguageTag().getLocale()); + try { - Sequence<Reference<XIndexAccess> > aOutlineAccess; - Locale aLocale(Application::GetSettings().GetLanguageTag().getLocale()); - try - { - aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale ); + aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale ); - SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False , - SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT); + SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False , + SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT); - for(sal_Int32 nItem = 0; - nItem < aOutlineAccess.getLength() && nItem < DEFAULT_NUM_VALUSET_COUNT; - nItem++ ) + for(sal_Int32 nItem = 0; + nItem < aOutlineAccess.getLength() && nItem < DEFAULT_NUM_VALUSET_COUNT; + nItem++ ) + { + pOutlineSettingsArrs[ nItem ] = new OutlineSettings_Impl; + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[ nItem ]; + pItemArr->sDescription = SVX_RESSTR( RID_SVXSTR_OUTLINENUM_DESCRIPTION_0 + nItem ); + pItemArr->pNumSettingsArr = new NumSettingsArr_Impl; + Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem]; + for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++) { - pOutlineSettingsArrs[ nItem ] = new OutlineSettings_Impl; - OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[ nItem ]; - pItemArr->sDescription = SVX_RESSTR( RID_SVXSTR_OUTLINENUM_DESCRIPTION_0 + nItem ); - pItemArr->pNumSettingsArr = new NumSettingsArr_Impl; - Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem]; - for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++) - { - Any aValueAny = xLevel->getByIndex(nLevel); - Sequence<PropertyValue> aLevelProps; - aValueAny >>= aLevelProps; - NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(aLevelProps); - SvxNumberFormat aNumFmt( aDefNumRule.GetLevel( nLevel) ); - pNew->eLabelFollowedBy = aNumFmt.GetLabelFollowedBy(); - pNew->nTabValue = aNumFmt.GetListtabPos(); - pNew->eNumAlign = aNumFmt.GetNumAdjust(); - pNew->nNumAlignAt = aNumFmt.GetFirstLineIndent(); - pNew->nNumIndentAt = aNumFmt.GetIndentAt(); - pItemArr->pNumSettingsArr->push_back(boost::shared_ptr<NumSettings_Impl>(pNew)); - } + Any aValueAny = xLevel->getByIndex(nLevel); + Sequence<PropertyValue> aLevelProps; + aValueAny >>= aLevelProps; + NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(aLevelProps); + SvxNumberFormat aNumFmt( aDefNumRule.GetLevel( nLevel) ); + pNew->eLabelFollowedBy = aNumFmt.GetLabelFollowedBy(); + pNew->nTabValue = aNumFmt.GetListtabPos(); + pNew->eNumAlign = aNumFmt.GetNumAdjust(); + pNew->nNumAlignAt = aNumFmt.GetFirstLineIndent(); + pNew->nNumIndentAt = aNumFmt.GetIndentAt(); + pItemArr->pNumSettingsArr->push_back(boost::shared_ptr<NumSettings_Impl>(pNew)); } } - catch(Exception&) - { - } + } + catch(Exception&) + { } } diff --git a/svx/source/sidebar/paragraph/ParaNumberingControl.cxx b/svx/source/sidebar/paragraph/ParaNumberingControl.cxx index c41ea8c3cf4f..839aed9d5523 100644 --- a/svx/source/sidebar/paragraph/ParaNumberingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaNumberingControl.cxx @@ -27,7 +27,7 @@ #include <sfx2/sidebar/Theme.hxx> #include <svtools/unitconv.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/text/XDefaultNumberingProvider.hpp> +#include <com/sun/star/text/DefaultNumberingProvider.hpp> #include <com/sun/star/text/XNumberingFormatter.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <comphelper/processfactory.hxx> @@ -44,12 +44,7 @@ namespace svx { namespace sidebar { Reference<XDefaultNumberingProvider> lcl_GetNumberingProvider() { - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference < XInterface > xI = xMSF->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); - Reference<XDefaultNumberingProvider> xRet(xI, UNO_QUERY); - - return xRet; + return DefaultNumberingProvider::create( comphelper::getProcessComponentContext() ); } ParaNumberingControl::ParaNumberingControl( |