1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svx/fmpage.hxx>
22 #include <svx/fmdpage.hxx>
23 #include <svx/unoshape.hxx>
24 #include <vcl/svapp.hxx>
25 #include <cppuhelper/queryinterface.hxx>
27 using ::com::sun::star::uno::Any
;
28 using ::com::sun::star::form::XFormsSupplier2
;
30 SvxFmDrawPage::SvxFmDrawPage( SdrPage
* pInPage
) :
31 SvxDrawPage( pInPage
)
35 SvxFmDrawPage::~SvxFmDrawPage() noexcept
39 css::uno::Sequence
< sal_Int8
> SAL_CALL
SvxFmDrawPage::getImplementationId()
41 return css::uno::Sequence
<sal_Int8
>();
44 Any SAL_CALL
SvxFmDrawPage::queryAggregation( const css::uno::Type
& _rType
)
46 Any aRet
= ::cppu::queryInterface ( _rType
47 , static_cast< XFormsSupplier2
* >( this )
48 , static_cast< XFormsSupplier
* >( this )
50 if ( !aRet
.hasValue() )
51 aRet
= SvxDrawPage::queryAggregation( _rType
);
56 css::uno::Sequence
< css::uno::Type
> SAL_CALL
SvxFmDrawPage::getTypes( )
58 return comphelper::concatSequences(SvxDrawPage::getTypes(),
59 css::uno::Sequence
{ cppu::UnoType
<css::form::XFormsSupplier
>::get() });
62 SdrObject
*SvxFmDrawPage::CreateSdrObject_( const css::uno::Reference
< css::drawing::XShape
> & xDescr
)
64 OUString
aShapeType( xDescr
->getShapeType() );
66 if ( aShapeType
== "com.sun.star.drawing.ShapeControl" // compatibility
67 || aShapeType
== "com.sun.star.drawing.ControlShape"
70 return new FmFormObj(GetSdrPage()->getSdrModelFromSdrPage());
74 return SvxDrawPage::CreateSdrObject_( xDescr
);
78 css::uno::Reference
< css::drawing::XShape
> SvxFmDrawPage::CreateShape( SdrObject
*pObj
) const
80 if( SdrInventor::FmForm
== pObj
->GetObjInventor() )
82 css::uno::Reference
< css::drawing::XShape
> xShape
= static_cast<SvxShape
*>(new SvxShapeControl( pObj
));
86 return SvxDrawPage::CreateShape( pObj
);
90 css::uno::Reference
< css::container::XNameContainer
> SAL_CALL
SvxFmDrawPage::getForms()
94 css::uno::Reference
< css::container::XNameContainer
> xForms
;
96 FmFormPage
*pFmPage
= dynamic_cast<FmFormPage
*>( GetSdrPage() );
98 xForms
.set( pFmPage
->GetForms(), css::uno::UNO_QUERY_THROW
);
104 sal_Bool SAL_CALL
SvxFmDrawPage::hasForms()
109 FmFormPage
* pFormPage
= dynamic_cast<FmFormPage
*>( GetSdrPage() );
111 bHas
= pFormPage
->GetForms( false ).is();
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */