Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <svx/fmpage.hxx>
21 : #include "fmobj.hxx"
22 : #include <svx/fmglob.hxx>
23 : #include <svx/fmdpage.hxx>
24 : #include <svx/unoshape.hxx>
25 : #include <cppuhelper/queryinterface.hxx>
26 : #include <cppuhelper/typeprovider.hxx>
27 :
28 : using ::com::sun::star::uno::Any;
29 : using ::com::sun::star::uno::RuntimeException;
30 : using ::com::sun::star::form::XFormsSupplier2;
31 :
32 5189 : SvxFmDrawPage::SvxFmDrawPage( SdrPage* pInPage ) :
33 5189 : SvxDrawPage( pInPage )
34 : {
35 5189 : }
36 :
37 5721 : SvxFmDrawPage::~SvxFmDrawPage() throw ()
38 : {
39 5721 : }
40 :
41 0 : ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SvxFmDrawPage::getImplementationId() throw(::com::sun::star::uno::RuntimeException, std::exception)
42 : {
43 0 : return css::uno::Sequence<sal_Int8>();
44 : }
45 :
46 120175 : Any SAL_CALL SvxFmDrawPage::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException, std::exception)
47 : {
48 : Any aRet = ::cppu::queryInterface ( _rType
49 : , static_cast< XFormsSupplier2* >( this )
50 : , static_cast< XFormsSupplier* >( this )
51 120175 : );
52 120175 : if ( !aRet.hasValue() )
53 118398 : aRet = SvxDrawPage::queryAggregation( _rType );
54 :
55 120175 : return aRet;
56 : }
57 :
58 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL SvxFmDrawPage::getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
59 : {
60 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypes(SvxDrawPage::getTypes());
61 0 : aTypes.realloc(aTypes.getLength() + 1);
62 0 : ::com::sun::star::uno::Type* pTypes = aTypes.getArray();
63 :
64 0 : pTypes[aTypes.getLength()-1] = cppu::UnoType<com::sun::star::form::XFormsSupplier>::get();
65 0 : return aTypes;
66 : }
67 :
68 94976 : SdrObject *SvxFmDrawPage::_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xDescr )
69 : throw (css::uno::RuntimeException, std::exception)
70 : {
71 94976 : OUString aShapeType( xDescr->getShapeType() );
72 :
73 189952 : if ( aShapeType == "com.sun.star.drawing.ShapeControl" // compatibility
74 94976 : || aShapeType == "com.sun.star.drawing.ControlShape"
75 : )
76 0 : return new FmFormObj();
77 : else
78 94976 : return SvxDrawPage::_CreateSdrObject( xDescr );
79 :
80 : }
81 :
82 64156 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SvxFmDrawPage::_CreateShape( SdrObject *pObj ) const
83 : throw (css::uno::RuntimeException, std::exception)
84 : {
85 64156 : if( FmFormInventor == pObj->GetObjInventor() )
86 : {
87 91 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape = static_cast<SvxShape*>(new SvxShapeControl( pObj ));
88 91 : return xShape;
89 : }
90 : else
91 64065 : return SvxDrawPage::_CreateShape( pObj );
92 : }
93 :
94 : // XFormsSupplier
95 307 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL SvxFmDrawPage::getForms() throw( ::com::sun::star::uno::RuntimeException, std::exception )
96 : {
97 307 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xForms;
98 :
99 307 : FmFormPage *pFmPage = PTR_CAST( FmFormPage, GetSdrPage() );
100 307 : if( pFmPage )
101 307 : xForms.set( pFmPage->GetForms(), css::uno::UNO_QUERY_THROW );
102 :
103 307 : return xForms;
104 : }
105 :
106 : // XFormsSupplier2
107 1356 : sal_Bool SAL_CALL SvxFmDrawPage::hasForms() throw( ::com::sun::star::uno::RuntimeException, std::exception )
108 : {
109 1356 : bool bHas = false;
110 1356 : FmFormPage* pFormPage = PTR_CAST( FmFormPage, GetSdrPage() );
111 1356 : if ( pFormPage )
112 1356 : bHas = pFormPage->GetForms( false ).is();
113 1356 : return bHas;
114 : }
115 :
116 : // ::com::sun::star::lang::XServiceInfo
117 373 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL SvxFmDrawPage::getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException, std::exception )
118 : {
119 373 : return SvxDrawPage::getSupportedServiceNames();
120 435 : }
121 :
122 :
123 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|