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 #ifndef INCLUDED_FORMS_SOURCE_COMPONENT_FORMATTEDFIELDWRAPPER_HXX
21 #define INCLUDED_FORMS_SOURCE_COMPONENT_FORMATTEDFIELDWRAPPER_HXX
23 #include "FormComponent.hxx"
24 #include <cppuhelper/implbase3.hxx>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/util/XCloneable.hpp>
33 //= OFormattedFieldWrapper
35 typedef ::cppu::WeakAggImplHelper3
< ::com::sun::star::io::XPersistObject
36 , ::com::sun::star::lang::XServiceInfo
37 , ::com::sun::star::util::XCloneable
38 > OFormattedFieldWrapper_Base
;
40 class OFormattedFieldWrapper
: public OFormattedFieldWrapper_Base
42 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
45 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XAggregation
> m_xAggregate
;
47 rtl::Reference
< OEditModel
> m_pEditPart
;
48 // if we act as formatted this is used to write the EditModel part
49 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XPersistObject
> m_xFormattedPart
;
52 OFormattedFieldWrapper(const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxFactory
);
55 virtual ~OFormattedFieldWrapper();
58 // if we act as formatted, this is the PersistObject interface of our aggregate, used
59 // to read and write the FormattedModel part
60 // if bActAsFormatted is false, the state is undetermined until somebody calls
61 // ::read or does anything which requires a living aggregate
62 static InterfaceRef
createFormattedFieldWrapper(const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxFactory
, bool bActAsFormatted
);
65 DECLARE_UNO3_AGG_DEFAULTS(OFormattedFieldWrapper
, OWeakAggObject
)
66 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation(const ::com::sun::star::uno::Type
& _rType
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
69 virtual OUString SAL_CALL
getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
70 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
71 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
74 virtual OUString SAL_CALL
getServiceName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
75 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
, std::exception
) SAL_OVERRIDE
;
76 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
, std::exception
) SAL_OVERRIDE
;
79 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::util::XCloneable
> SAL_CALL
createClone( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
82 /// ensure we're in a defined state, which means a FormattedModel _OR_ an EditModel
83 void ensureAggregate();
88 #endif // INCLUDED_FORMS_SOURCE_COMPONENT_FORMATTEDFIELDWRAPPER_HXX
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */