1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <svx/fmpage.hxx>
31 #include <svx/fmglob.hxx>
32 #include <svx/fmdpage.hxx>
33 #include <svx/unoshape.hxx>
34 #include <cppuhelper/queryinterface.hxx>
35 #include <cppuhelper/typeprovider.hxx>
37 using ::com::sun::star::uno::Any
;
38 using ::com::sun::star::uno::RuntimeException
;
39 using ::com::sun::star::form::XFormsSupplier2
;
41 DBG_NAME(SvxFmDrawPage
)
42 SvxFmDrawPage::SvxFmDrawPage( SdrPage
* pInPage
) :
43 SvxDrawPage( pInPage
)
45 DBG_CTOR(SvxFmDrawPage
,NULL
);
48 SvxFmDrawPage::~SvxFmDrawPage() throw ()
50 DBG_DTOR(SvxFmDrawPage
,NULL
);
53 ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
SvxFmDrawPage::getImplementationId() throw(::com::sun::star::uno::RuntimeException
)
55 static ::cppu::OImplementationId
* pId
= 0;
58 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
61 static ::cppu::OImplementationId aId
;
65 return pId
->getImplementationId();
68 Any SAL_CALL
SvxFmDrawPage::queryAggregation( const ::com::sun::star::uno::Type
& _rType
) throw(RuntimeException
)
70 Any aRet
= ::cppu::queryInterface ( _rType
71 , static_cast< XFormsSupplier2
* >( this )
72 , static_cast< XFormsSupplier
* >( this )
74 if ( !aRet
.hasValue() )
75 aRet
= SvxDrawPage::queryAggregation( _rType
);
80 /***********************************************************************
82 ***********************************************************************/
83 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
SvxFmDrawPage::getTypes( ) throw(::com::sun::star::uno::RuntimeException
)
85 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypes(SvxDrawPage::getTypes());
86 aTypes
.realloc(aTypes
.getLength() + 1);
87 ::com::sun::star::uno::Type
* pTypes
= aTypes
.getArray();
89 pTypes
[aTypes
.getLength()-1] = ::getCppuType((const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XFormsSupplier
>*)0);
93 SdrObject
*SvxFmDrawPage::_CreateSdrObject( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> & xDescr
) throw ()
95 ::rtl::OUString
aShapeType( xDescr
->getShapeType() );
97 if ( aShapeType
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.ShapeControl" ) ) // compatibility
98 || aShapeType
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.ControlShape" ) )
100 return new FmFormObj();
102 return SvxDrawPage::_CreateSdrObject( xDescr
);
106 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> SvxFmDrawPage::_CreateShape( SdrObject
*pObj
) const throw ()
108 if( FmFormInventor
== pObj
->GetObjInventor() )
110 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> xShape
= (SvxShape
*)new SvxShapeControl( pObj
);
114 return SvxDrawPage::_CreateShape( pObj
);
118 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> SAL_CALL
SvxFmDrawPage::getForms(void) throw( ::com::sun::star::uno::RuntimeException
)
120 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> xForms
;
122 FmFormPage
*pFmPage
= PTR_CAST( FmFormPage
, GetSdrPage() );
124 xForms
= pFmPage
->GetForms();
130 sal_Bool SAL_CALL
SvxFmDrawPage::hasForms(void) throw( ::com::sun::star::uno::RuntimeException
)
132 sal_Bool bHas
= sal_False
;
133 FmFormPage
* pFormPage
= PTR_CAST( FmFormPage
, GetSdrPage() );
135 bHas
= pFormPage
->GetForms( false ).is();
139 // ::com::sun::star::lang::XServiceInfo
140 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
SvxFmDrawPage::getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
)
142 return SvxDrawPage::getSupportedServiceNames();
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */