LibreOffice Module forms (master) 1
FormattedFieldWrapper.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <comphelper/uno3.hxx>
24#include <com/sun/star/io/XPersistObject.hpp>
25#include <com/sun/star/lang/XServiceInfo.hpp>
26#include <com/sun/star/util/XCloneable.hpp>
27#include <com/sun/star/uno/XComponentContext.hpp>
28#include <rtl/ref.hxx>
29
30namespace frm
31{
32
33class OEditModel;
34
35//= OFormattedFieldWrapper
36
37typedef ::cppu::WeakAggImplHelper3 < css::io::XPersistObject
38 , css::lang::XServiceInfo
39 , css::util::XCloneable
41
43{
44 css::uno::Reference< css::uno::XComponentContext> m_xContext;
46
47 css::uno::Reference< css::uno::XAggregation> m_xAggregate;
48
50 // if we act as formatted this is used to write the EditModel part
51 css::uno::Reference< css::io::XPersistObject> m_xFormattedPart;
52
53 OFormattedFieldWrapper(const css::uno::Reference< css::uno::XComponentContext>& _rxFactory,
54 OUString const & implementationName);
55
56 virtual ~OFormattedFieldWrapper() override;
57
58public:
59 // if we act as formatted, this is the PersistObject interface of our aggregate, used
60 // to read and write the FormattedModel part
61 // if bActAsFormatted is false, the state is undetermined until somebody calls
62 // ::read or does anything which requires a living aggregate
63 static css::uno::Reference<css::uno::XInterface> createFormattedFieldWrapper(const css::uno::Reference< css::uno::XComponentContext>& _rxFactory, bool bActAsFormatted, OUString const & implementationName);
64
65 // UNO
67 virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type& _rType) override;
68
69 // XServiceInfo
70 virtual OUString SAL_CALL getImplementationName( ) override;
71 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
72 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
73
74 // XPersistObject
75 virtual OUString SAL_CALL getServiceName() override;
76 virtual void SAL_CALL write(const css::uno::Reference< css::io::XObjectOutputStream>& _rxOutStream) override;
77 virtual void SAL_CALL read(const css::uno::Reference< css::io::XObjectInputStream>& _rxInStream) override;
78
79 // XCloneable
80 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
81
82private:
84 void ensureAggregate();
85};
86
87}
88
89/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static css::uno::Reference< css::uno::XInterface > createFormattedFieldWrapper(const css::uno::Reference< css::uno::XComponentContext > &_rxFactory, bool bActAsFormatted, OUString const &implementationName)
virtual void SAL_CALL read(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
rtl::Reference< OEditModel > m_pEditPart
css::uno::Reference< css::io::XPersistObject > m_xFormattedPart
virtual ~OFormattedFieldWrapper() override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual void SAL_CALL write(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream) override
OFormattedFieldWrapper(const css::uno::Reference< css::uno::XComponentContext > &_rxFactory, OUString const &implementationName)
void ensureAggregate()
ensure we're in a defined state, which means a FormattedModel OR an EditModel
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
css::uno::Reference< css::uno::XAggregation > m_xAggregate
virtual OUString SAL_CALL getServiceName() override
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &_rType) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25
::cppu::WeakAggImplHelper3< css::io::XPersistObject, css::lang::XServiceInfo, css::util::XCloneable > OFormattedFieldWrapper_Base
unsigned char sal_Bool
#define DECLARE_UNO3_AGG_DEFAULTS(classname, baseclass)