1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: FormattedFieldWrapper.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _FRM_FORMATTED_FIELD_WRAPPER_HXX_
32 #define _FRM_FORMATTED_FIELD_WRAPPER_HXX_
34 #include "FormComponent.hxx"
35 #include <cppuhelper/implbase3.hxx>
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/util/XCloneable.hpp>
39 //.........................................................................
44 //==================================================================
45 //= OFormattedFieldWrapper
46 //==================================================================
47 typedef ::cppu::WeakAggImplHelper3
< ::com::sun::star::io::XPersistObject
48 , ::com::sun::star::lang::XServiceInfo
49 , ::com::sun::star::util::XCloneable
50 > OFormattedFieldWrapper_Base
;
52 class OFormattedFieldWrapper
: public OFormattedFieldWrapper_Base
54 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xServiceFactory
;
57 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XAggregation
> m_xAggregate
;
59 OEditModel
* m_pEditPart
;
60 // if we act as formatted this is used to write the EditModel part
61 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XPersistObject
> m_xFormattedPart
;
62 // if we act as formatted, this is the PersistObject interface of our aggregate, used
63 // to read and write the FormattedModel part
65 OFormattedFieldWrapper(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
, sal_Bool _bActAsFormatted
);
66 // if _bActAsFormatted is sal_False, the state is undetermined until somebody calls ::read or does
67 // anything which requires a living aggregate
68 OFormattedFieldWrapper( const OFormattedFieldWrapper
* _pCloneSource
);
69 virtual ~OFormattedFieldWrapper();
71 friend InterfaceRef SAL_CALL
OFormattedFieldWrapper_CreateInstance_ForceFormatted(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
);
72 friend InterfaceRef SAL_CALL
OFormattedFieldWrapper_CreateInstance(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
);
76 DECLARE_UNO3_AGG_DEFAULTS(OFormattedFieldWrapper
, OWeakAggObject
);
77 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation(const ::com::sun::star::uno::Type
& _rType
) throw(::com::sun::star::uno::RuntimeException
);
80 virtual ::rtl::OUString SAL_CALL
getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
);
81 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
);
82 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
);
85 virtual ::rtl::OUString SAL_CALL
getServiceName() throw(::com::sun::star::uno::RuntimeException
);
86 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
);
87 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
);
90 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::util::XCloneable
> SAL_CALL
createClone( ) throw (::com::sun::star::uno::RuntimeException
);
93 /// ensure we're in a defined state, which means a FormattedModel _OR_ an EditModel
94 void ensureAggregate();
97 //.........................................................................
99 //.........................................................................
101 #endif // _FRM_FORMATTED_FIELD_WRAPPER_HXX_