diff options
author | Noel Grandin <noel@peralex.com> | 2013-03-19 15:36:11 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-03-20 07:32:48 +0200 |
commit | 70e7bd63adda4c17a47fd7caeacdf5b91ace6157 (patch) | |
tree | 22e2ba35c38d477efa0809cfc2db659b633c66f8 | |
parent | 32fe9ef796a92e5eaf3dc21fad15761b96500501 (diff) |
fdo#46808, Convert text::AutoTextContainer to new style
Change-Id: Ia33419c4d8cf633b572627edf57c926099d698e5
-rw-r--r-- | offapi/UnoApi_offapi.mk | 3 | ||||
-rw-r--r-- | offapi/com/sun/star/text/AutoTextContainer.idl | 13 | ||||
-rw-r--r-- | offapi/com/sun/star/text/XAutoTextContainer2.idl | 45 | ||||
-rw-r--r-- | offapi/type_reference/types.rdb | bin | 7439872 -> 7439872 bytes | |||
-rw-r--r-- | sw/source/ui/envelp/label1.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/envelp/labelexp.cxx | 20 | ||||
-rw-r--r-- | sw/source/ui/envelp/swuilabimp.hxx | 3 | ||||
-rw-r--r-- | sw/source/ui/inc/glossary.hxx | 3 | ||||
-rw-r--r-- | sw/source/ui/inc/unoatxt.hxx | 25 | ||||
-rw-r--r-- | sw/source/ui/misc/glossary.cxx | 13 | ||||
-rw-r--r-- | sw/source/ui/vba/vbatemplate.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/text/XMLAutoTextEventExport.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/text/XMLAutoTextEventImport.cxx | 4 |
13 files changed, 85 insertions, 55 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index e6b2b75636b4..7197b34ff476 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -334,6 +334,7 @@ $(eval $(call gb_ZipUnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/task,\ StatusIndicatorFactory \ )) $(eval $(call gb_ZipUnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/text,\ + AutoTextContainer \ DefaultNumberingProvider \ )) $(eval $(call gb_ZipUnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ucb,\ @@ -1265,7 +1266,6 @@ $(eval $(call gb_ZipUnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/text AccessibleTextEmbeddedObject \ AccessibleTextFrameView \ AccessibleTextGraphicObject \ - AutoTextContainer \ AutoTextEntry \ AutoTextGroup \ BaseFrame \ @@ -3647,6 +3647,7 @@ $(eval $(call gb_ZipUnoApi_add_idlfiles,offapi,offapi/com/sun/star/text,\ WritingMode \ WritingMode2 \ XAutoTextContainer \ + XAutoTextContainer2 \ XAutoTextEntry \ XAutoTextGroup \ XBookmarkInsertTool \ diff --git a/offapi/com/sun/star/text/AutoTextContainer.idl b/offapi/com/sun/star/text/AutoTextContainer.idl index 66e427164573..36644d094afa 100644 --- a/offapi/com/sun/star/text/AutoTextContainer.idl +++ b/offapi/com/sun/star/text/AutoTextContainer.idl @@ -19,22 +19,15 @@ #ifndef __com_sun_star_text_AutoTextContainer_idl__ #define __com_sun_star_text_AutoTextContainer_idl__ -#include <com/sun/star/text/XAutoTextContainer.idl> -#include <com/sun/star/container/XIndexAccess.idl> +#include <com/sun/star/text/XAutoTextContainer2.idl> +module com { module sun { module star { module text { - module com { module sun { module star { module text { /** provides access to groups of text blocks. */ -published service AutoTextContainer -{ - interface com::sun::star::text::XAutoTextContainer; - - [optional] interface com::sun::star::container::XIndexAccess; - -}; +published service AutoTextContainer : XAutoTextContainer2; }; }; }; }; diff --git a/offapi/com/sun/star/text/XAutoTextContainer2.idl b/offapi/com/sun/star/text/XAutoTextContainer2.idl new file mode 100644 index 000000000000..8d018f1a26eb --- /dev/null +++ b/offapi/com/sun/star/text/XAutoTextContainer2.idl @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_text_XAutoTextContainer2_idl__ +#define __com_sun_star_text_XAutoTextContainer2_idl__ + +#include <com/sun/star/text/XAutoTextContainer.idl> +#include <com/sun/star/container/XIndexAccess.idl> + + +module com { module sun { module star { module text { + + +/** + @since LibreOffice 4.1 + */ +published interface XAutoTextContainer2 +{ + interface com::sun::star::text::XAutoTextContainer; + + interface com::sun::star::container::XIndexAccess; + +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb Binary files differindex b5a34d5589e9..d98aaadb41d3 100644 --- a/offapi/type_reference/types.rdb +++ b/offapi/type_reference/types.rdb diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 11ca073c67aa..9ffa4154c3cf 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -641,7 +641,7 @@ SwVisitingCardPage::~SwVisitingCardPage() { for(sal_uInt16 i = 0; i < aAutoTextGroupLB.GetEntryCount(); i++) delete (String*)aAutoTextGroupLB.GetEntryData( i ); - _xAutoText = 0; + m_xAutoText = 0; ClearUserData(); delete pExampleFrame; diff --git a/sw/source/ui/envelp/labelexp.cxx b/sw/source/ui/envelp/labelexp.cxx index ed30c8d7e430..a90eaef95e70 100644 --- a/sw/source/ui/envelp/labelexp.cxx +++ b/sw/source/ui/envelp/labelexp.cxx @@ -17,9 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/text/AutoTextContainer.hpp> #include <com/sun/star/text/XTextFieldsSupplier.hpp> #include <com/sun/star/util/XRefreshable.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> #include "svtools/treelistentry.hxx" #include <swtypes.hxx> @@ -52,16 +53,15 @@ void SwVisitingCardPage::InitFrameControl() getProcessServiceFactory(); //now the AutoText ListBoxes have to be filled - uno::Reference< uno::XInterface > xAText = xMgr->createInstance( "com.sun.star.text.AutoTextContainer" ); - _xAutoText = uno::Reference< container::XNameAccess >(xAText, uno::UNO_QUERY); + m_xAutoText = text::AutoTextContainer::create( comphelper::getComponentContext(xMgr) ); - uno::Sequence<OUString> aNames = _xAutoText->getElementNames(); + uno::Sequence<OUString> aNames = m_xAutoText->getElementNames(); const OUString* pGroups = aNames.getConstArray(); OUString uTitleName( rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_TITLE)) ); for(sal_uInt16 i = 0; i < aNames.getLength(); i++) { - uno::Any aGroup = _xAutoText->getByName(pGroups[i]); + uno::Any aGroup = m_xAutoText->getByName(pGroups[i]); uno::Reference< text::XAutoTextGroup > xGroup; aGroup >>= xGroup; uno::Reference< container::XIndexAccess > xIdxAcc(xGroup, uno::UNO_QUERY); @@ -88,9 +88,9 @@ void SwVisitingCardPage::InitFrameControl() aAutoTextGroupLB.SelectEntryPos(0); String sCurGroupName( *(String*)aAutoTextGroupLB.GetEntryData(aAutoTextGroupLB.GetSelectEntryPos())); - if(_xAutoText->hasByName(sCurGroupName)) + if(m_xAutoText->hasByName(sCurGroupName)) { - uno::Any aGroup = _xAutoText->getByName(sCurGroupName); + uno::Any aGroup = m_xAutoText->getByName(sCurGroupName); try { uno::Reference< text::XAutoTextGroup > xGroup; @@ -122,7 +122,7 @@ IMPL_LINK_NOARG(SwVisitingCardPage, FrameControlInitializedHdl) { String sGroup( *(String*)aAutoTextGroupLB.GetEntryData( aAutoTextGroupLB.GetSelectEntryPos() ) ); - uno::Any aGroup = _xAutoText->getByName(sGroup); + uno::Any aGroup = m_xAutoText->getByName(sGroup); uno::Reference< text::XAutoTextGroup > xGroup; aGroup >>= xGroup; @@ -144,13 +144,13 @@ IMPL_LINK_NOARG(SwVisitingCardPage, FrameControlInitializedHdl) IMPL_LINK( SwVisitingCardPage, AutoTextSelectHdl, void*, pBox ) { - if(_xAutoText.is()) + if(m_xAutoText.is()) { if( &aAutoTextGroupLB == pBox ) { String sGroup( *(String*)aAutoTextGroupLB.GetEntryData( aAutoTextGroupLB.GetSelectEntryPos())); - uno::Any aGroup = _xAutoText->getByName(sGroup); + uno::Any aGroup = m_xAutoText->getByName(sGroup); uno::Reference< text::XAutoTextGroup > xGroup; aGroup >>= xGroup; diff --git a/sw/source/ui/envelp/swuilabimp.hxx b/sw/source/ui/envelp/swuilabimp.hxx index ace270d094f4..7b439450ed15 100644 --- a/sw/source/ui/envelp/swuilabimp.hxx +++ b/sw/source/ui/envelp/swuilabimp.hxx @@ -19,6 +19,7 @@ #ifndef _SWUILABIMP_HXX #define _SWUILABIMP_HXX #include "labimp.hxx" +#include <com/sun/star/text/XAutoTextContainer2.hpp> class SwLabPage : public SfxTabPage { @@ -103,7 +104,7 @@ class SwVisitingCardPage : public SfxTabPage SwLabItem aLabItem; SwOneExampleFrame* pExampleFrame; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > _xAutoText; + ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextContainer2 > m_xAutoText; DECL_LINK( AutoTextSelectHdl, void* ); diff --git a/sw/source/ui/inc/glossary.hxx b/sw/source/ui/inc/glossary.hxx index afd47aa30999..3beb52ac1f7a 100644 --- a/sw/source/ui/inc/glossary.hxx +++ b/sw/source/ui/inc/glossary.hxx @@ -36,6 +36,7 @@ #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/container/XElementAccess.hpp> #include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/text/XAutoTextContainer2.hpp> #include <actctrl.hxx> @@ -100,7 +101,7 @@ class SwGlossaryDlg : public SvxStandardDialog String sReadonlyPath; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > _xAutoText; + ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextContainer2 > m_xAutoText; SwOneExampleFrame* pExampleFrame; SwGlossaryHdl* pGlossaryHdl; diff --git a/sw/source/ui/inc/unoatxt.hxx b/sw/source/ui/inc/unoatxt.hxx index e92962bec165..8813d430d11c 100644 --- a/sw/source/ui/inc/unoatxt.hxx +++ b/sw/source/ui/inc/unoatxt.hxx @@ -19,21 +19,19 @@ #ifndef _UNOATXT_HXX #define _UNOATXT_HXX -#include <com/sun/star/text/XAutoTextGroup.hpp> -#include <com/sun/star/text/XAutoTextEntry.hpp> -#include <com/sun/star/text/XAutoTextContainer.hpp> -#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> -#include <com/sun/star/container/XNamed.hpp> -#include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/text/XAutoTextGroup.hpp> +#include <com/sun/star/text/XAutoTextEntry.hpp> +#include <com/sun/star/text/XAutoTextContainer2.hpp> +#include <com/sun/star/text/XText.hpp> #include <svl/itemprop.hxx> #include <svl/lstner.hxx> -#include <cppuhelper/implbase3.hxx> // helper for implementations -#include <cppuhelper/implbase4.hxx> // helper for implementations +#include <cppuhelper/implbase2.hxx> // helper for implementations #include <cppuhelper/implbase5.hxx> // helper for implementations #include <cppuhelper/implbase6.hxx> // helper for implementations #include <svtools/unoevent.hxx> @@ -53,11 +51,10 @@ SV_DECL_REF( SwDocShell ) SAL_CALL SwXAutoTextContainer_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & ) throw ( ::com::sun::star::uno::Exception ); -class SwXAutoTextContainer : public cppu::WeakImplHelper3 +class SwXAutoTextContainer : public cppu::WeakImplHelper2 < - ::com::sun::star::text::XAutoTextContainer, - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::container::XIndexAccess + ::com::sun::star::text::XAutoTextContainer2, + ::com::sun::star::lang::XServiceInfo > { SwGlossaries *pGlossaries; diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index ee5a1c077a22..02fe69133241 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -37,6 +37,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> #include <ucbhelper/content.hxx> +#include <com/sun/star/text/AutoTextContainer.hpp> #include <com/sun/star/ui/dialogs/XFilePicker.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> @@ -1132,19 +1133,17 @@ void SwGlossaryDlg::ShowAutoText(const String& rGroup, const String& rShortName) } } -void SwGlossaryDlg::ResumeShowAutoText() +void SwGlossaryDlg::ResumeShowAutoText() { String sGroup, sShortName; if(GetResumeData(sGroup, sShortName) && m_pExampleWIN->IsVisible()) { - if(!_xAutoText.is()) + if(!m_xAutoText.is()) { - uno::Reference< lang::XMultiServiceFactory > - xMgr = getProcessServiceFactory(); + uno::Reference< lang::XMultiServiceFactory > xMgr = getProcessServiceFactory(); //now the AutoText ListBoxes have to be filled - uno::Reference< uno::XInterface > xAText = xMgr->createInstance( "com.sun.star.text.AutoTextContainer" ); - _xAutoText = uno::Reference< container::XNameAccess >(xAText, uno::UNO_QUERY); + m_xAutoText = text::AutoTextContainer::create( comphelper::getComponentContext(xMgr) ); } uno::Reference< XTextCursor > & xCrsr = pExampleFrame->GetTextCursor(); @@ -1152,7 +1151,7 @@ void SwGlossaryDlg::ResumeShowAutoText() { if(sShortName.Len()) { - uno::Any aGroup = _xAutoText->getByName(sGroup); + uno::Any aGroup = m_xAutoText->getByName(sGroup); uno::Reference< XAutoTextGroup > xGroup; OUString uShortName(sShortName); if((aGroup >>= xGroup) && xGroup->hasByName(uShortName)) diff --git a/sw/source/ui/vba/vbatemplate.cxx b/sw/source/ui/vba/vbatemplate.cxx index 8a01bc26dfdb..e17a2fc87c9c 100644 --- a/sw/source/ui/vba/vbatemplate.cxx +++ b/sw/source/ui/vba/vbatemplate.cxx @@ -20,7 +20,7 @@ #include <vbahelper/vbahelper.hxx> #include "wordvbahelper.hxx" #include "vbaautotextentry.hxx" -#include <com/sun/star/text/XAutoTextContainer.hpp> +#include <com/sun/star/text/AutoTextContainer.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> #include <tools/urlobj.hxx> @@ -85,8 +85,8 @@ SwVbaTemplate::getPath() throw ( css::uno::RuntimeException ) uno::Any SAL_CALL SwVbaTemplate::AutoTextEntries( const uno::Any& index ) throw (uno::RuntimeException) { - uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - uno::Reference< text::XAutoTextContainer > xAutoTextContainer( xMgr->createInstance( rtl::OUString("com.sun.star.text.AutoTextContainer") ), uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + uno::Reference< text::XAutoTextContainer2 > xAutoTextContainer = text::AutoTextContainer::create( xContext ); // the default template is "Normal.dot" in Word. rtl::OUString sGroup("Normal"); diff --git a/xmloff/source/text/XMLAutoTextEventExport.cxx b/xmloff/source/text/XMLAutoTextEventExport.cxx index 945b815d0cbe..95e28fb9e7d0 100644 --- a/xmloff/source/text/XMLAutoTextEventExport.cxx +++ b/xmloff/source/text/XMLAutoTextEventExport.cxx @@ -60,9 +60,6 @@ using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::xml::sax::XDocumentHandler; -const sal_Char sAPI_AutoText[] = "com.sun.star.text.AutoTextContainer"; - - XMLAutoTextEventExport::XMLAutoTextEventExport( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_uInt16 nFlags diff --git a/xmloff/source/text/XMLAutoTextEventImport.cxx b/xmloff/source/text/XMLAutoTextEventImport.cxx index 875b29a6eb25..0f6b43ca75c6 100644 --- a/xmloff/source/text/XMLAutoTextEventImport.cxx +++ b/xmloff/source/text/XMLAutoTextEventImport.cxx @@ -46,10 +46,6 @@ using ::com::sun::star::lang::XMultiServiceFactory; using ::xmloff::token::IsXMLToken; using ::xmloff::token::XML_AUTO_TEXT_EVENTS; -const sal_Char sAPI_AutoText[] = "com.sun.star.text.AutoTextContainer"; - - -// #110680# XMLAutoTextEventImport::XMLAutoTextEventImport( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext) throw() : SvXMLImport(xContext) |