1*f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6e50924SAndrew Rist * distributed with this work for additional information 6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6e50924SAndrew Rist * software distributed under the License is distributed on an 15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17*f6e50924SAndrew Rist * specific language governing permissions and limitations 18*f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*f6e50924SAndrew Rist *************************************************************/ 21*f6e50924SAndrew Rist 22*f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir #include <svx/fmpage.hxx> 27cdf0e10cSrcweir #include "fmobj.hxx" 28cdf0e10cSrcweir #include <svx/fmglob.hxx> 29cdf0e10cSrcweir #include <svx/fmdpage.hxx> 30cdf0e10cSrcweir #include <svx/unoshape.hxx> 31cdf0e10cSrcweir #include <cppuhelper/queryinterface.hxx> 32cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 33cdf0e10cSrcweir 34cdf0e10cSrcweir using ::com::sun::star::uno::Any; 35cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException; 36cdf0e10cSrcweir using ::com::sun::star::form::XFormsSupplier2; 37cdf0e10cSrcweir 38cdf0e10cSrcweir DBG_NAME(SvxFmDrawPage) 39cdf0e10cSrcweir SvxFmDrawPage::SvxFmDrawPage( SdrPage* pInPage ) : 40cdf0e10cSrcweir SvxDrawPage( pInPage ) 41cdf0e10cSrcweir { 42cdf0e10cSrcweir DBG_CTOR(SvxFmDrawPage,NULL); 43cdf0e10cSrcweir } 44cdf0e10cSrcweir 45cdf0e10cSrcweir SvxFmDrawPage::~SvxFmDrawPage() throw () 46cdf0e10cSrcweir { 47cdf0e10cSrcweir DBG_DTOR(SvxFmDrawPage,NULL); 48cdf0e10cSrcweir } 49cdf0e10cSrcweir 50cdf0e10cSrcweir ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SvxFmDrawPage::getImplementationId() throw(::com::sun::star::uno::RuntimeException) 51cdf0e10cSrcweir { 52cdf0e10cSrcweir static ::cppu::OImplementationId* pId = 0; 53cdf0e10cSrcweir if (! pId) 54cdf0e10cSrcweir { 55cdf0e10cSrcweir ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); 56cdf0e10cSrcweir if (! pId) 57cdf0e10cSrcweir { 58cdf0e10cSrcweir static ::cppu::OImplementationId aId; 59cdf0e10cSrcweir pId = &aId; 60cdf0e10cSrcweir } 61cdf0e10cSrcweir } 62cdf0e10cSrcweir return pId->getImplementationId(); 63cdf0e10cSrcweir } 64cdf0e10cSrcweir 65cdf0e10cSrcweir Any SAL_CALL SvxFmDrawPage::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException) 66cdf0e10cSrcweir { 67cdf0e10cSrcweir Any aRet = ::cppu::queryInterface ( _rType 68cdf0e10cSrcweir , static_cast< XFormsSupplier2* >( this ) 69cdf0e10cSrcweir , static_cast< XFormsSupplier* >( this ) 70cdf0e10cSrcweir ); 71cdf0e10cSrcweir if ( !aRet.hasValue() ) 72cdf0e10cSrcweir aRet = SvxDrawPage::queryAggregation( _rType ); 73cdf0e10cSrcweir 74cdf0e10cSrcweir return aRet; 75cdf0e10cSrcweir } 76cdf0e10cSrcweir 77cdf0e10cSrcweir /*********************************************************************** 78cdf0e10cSrcweir * * 79cdf0e10cSrcweir ***********************************************************************/ 80cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL SvxFmDrawPage::getTypes( ) throw(::com::sun::star::uno::RuntimeException) 81cdf0e10cSrcweir { 82cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypes(SvxDrawPage::getTypes()); 83cdf0e10cSrcweir aTypes.realloc(aTypes.getLength() + 1); 84cdf0e10cSrcweir ::com::sun::star::uno::Type* pTypes = aTypes.getArray(); 85cdf0e10cSrcweir 86cdf0e10cSrcweir pTypes[aTypes.getLength()-1] = ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier>*)0); 87cdf0e10cSrcweir return aTypes; 88cdf0e10cSrcweir } 89cdf0e10cSrcweir 90cdf0e10cSrcweir SdrObject *SvxFmDrawPage::_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xDescr ) throw () 91cdf0e10cSrcweir { 92cdf0e10cSrcweir ::rtl::OUString aShapeType( xDescr->getShapeType() ); 93cdf0e10cSrcweir 94cdf0e10cSrcweir if ( aShapeType.equalsAscii( "com.sun.star.drawing.ShapeControl" ) // compatibility 95cdf0e10cSrcweir || aShapeType.equalsAscii( "com.sun.star.drawing.ControlShape" ) 96cdf0e10cSrcweir ) 97cdf0e10cSrcweir return new FmFormObj( OBJ_FM_CONTROL ); 98cdf0e10cSrcweir else 99cdf0e10cSrcweir return SvxDrawPage::_CreateSdrObject( xDescr ); 100cdf0e10cSrcweir 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SvxFmDrawPage::_CreateShape( SdrObject *pObj ) const throw () 104cdf0e10cSrcweir { 105cdf0e10cSrcweir if( FmFormInventor == pObj->GetObjInventor() ) 106cdf0e10cSrcweir { 107cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape = (SvxShape*)new SvxShapeControl( pObj ); 108cdf0e10cSrcweir return xShape; 109cdf0e10cSrcweir } 110cdf0e10cSrcweir else 111cdf0e10cSrcweir return SvxDrawPage::_CreateShape( pObj ); 112cdf0e10cSrcweir } 113cdf0e10cSrcweir 114cdf0e10cSrcweir // XFormsSupplier 115cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL SvxFmDrawPage::getForms(void) throw( ::com::sun::star::uno::RuntimeException ) 116cdf0e10cSrcweir { 117cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xForms; 118cdf0e10cSrcweir 119cdf0e10cSrcweir FmFormPage *pFmPage = PTR_CAST( FmFormPage, GetSdrPage() ); 120cdf0e10cSrcweir if( pFmPage ) 121cdf0e10cSrcweir xForms = pFmPage->GetForms(); 122cdf0e10cSrcweir 123cdf0e10cSrcweir return xForms; 124cdf0e10cSrcweir } 125cdf0e10cSrcweir 126cdf0e10cSrcweir // XFormsSupplier2 127cdf0e10cSrcweir sal_Bool SAL_CALL SvxFmDrawPage::hasForms(void) throw( ::com::sun::star::uno::RuntimeException ) 128cdf0e10cSrcweir { 129cdf0e10cSrcweir sal_Bool bHas = sal_False; 130cdf0e10cSrcweir FmFormPage* pFormPage = PTR_CAST( FmFormPage, GetSdrPage() ); 131cdf0e10cSrcweir if ( pFormPage ) 132cdf0e10cSrcweir bHas = pFormPage->GetForms( false ).is(); 133cdf0e10cSrcweir return bHas; 134cdf0e10cSrcweir } 135cdf0e10cSrcweir 136cdf0e10cSrcweir // ::com::sun::star::lang::XServiceInfo 137cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SvxFmDrawPage::getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ) 138cdf0e10cSrcweir { 139cdf0e10cSrcweir return SvxDrawPage::getSupportedServiceNames(); 140cdf0e10cSrcweir } 141cdf0e10cSrcweir 142cdf0e10cSrcweir 143