Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _FRM_FORMATTED_FIELD_WRAPPER_HXX_
30 : : #define _FRM_FORMATTED_FIELD_WRAPPER_HXX_
31 : :
32 : : #include "FormComponent.hxx"
33 : : #include <cppuhelper/implbase3.hxx>
34 : : #include <com/sun/star/lang/XServiceInfo.hpp>
35 : : #include <com/sun/star/util/XCloneable.hpp>
36 : : #include "rtl/ref.hxx"
37 : :
38 : : //.........................................................................
39 : : namespace frm
40 : : {
41 : :
42 : : class OEditModel;
43 : : //==================================================================
44 : : //= OFormattedFieldWrapper
45 : : //==================================================================
46 : : typedef ::cppu::WeakAggImplHelper3 < ::com::sun::star::io::XPersistObject
47 : : , ::com::sun::star::lang::XServiceInfo
48 : : , ::com::sun::star::util::XCloneable
49 : : > OFormattedFieldWrapper_Base;
50 : :
51 : : class OFormattedFieldWrapper : public OFormattedFieldWrapper_Base
52 : : {
53 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xServiceFactory;
54 : :
55 : : protected:
56 : : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> m_xAggregate;
57 : :
58 : : rtl::Reference< OEditModel > m_editPart;
59 : : // if we act as formatted this is used to write the EditModel part
60 : : ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject> m_xFormattedPart;
61 : : // if we act as formatted, this is the PersistObject interface of our aggregate, used
62 : : // to read and write the FormattedModel part
63 : :
64 : : OFormattedFieldWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, sal_Bool _bActAsFormatted);
65 : : // if _bActAsFormatted is sal_False, the state is undetermined until somebody calls ::read or does
66 : : // anything which requires a living aggregate
67 : : OFormattedFieldWrapper( const OFormattedFieldWrapper* _pCloneSource );
68 : : virtual ~OFormattedFieldWrapper();
69 : :
70 : : friend InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance_ForceFormatted(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
71 : : friend InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
72 : :
73 : : public:
74 : : // UNO
75 : 166954 : DECLARE_UNO3_AGG_DEFAULTS(OFormattedFieldWrapper, OWeakAggObject);
76 : : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException);
77 : :
78 : : // XServiceInfo
79 : : virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
80 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
81 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
82 : :
83 : : // XPersistObject
84 : : virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
85 : : virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
86 : : virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
87 : :
88 : : // XCloneable
89 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
90 : :
91 : : protected:
92 : : /// ensure we're in a defined state, which means a FormattedModel _OR_ an EditModel
93 : : void ensureAggregate();
94 : : };
95 : :
96 : : //.........................................................................
97 : : }
98 : : //.........................................................................
99 : :
100 : : #endif // _FRM_FORMATTED_FIELD_WRAPPER_HXX_
101 : :
102 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|