LibreOffice Module chart2 (master) 1
WallFloorWrapper.cxx
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#include "WallFloorWrapper.hxx"
24
25#include <FillProperties.hxx>
29
30#include <algorithm>
31#include <utility>
32
33using namespace ::com::sun::star;
34using namespace ::com::sun::star::chart2;
35
36using ::com::sun::star::beans::Property;
37using ::com::sun::star::uno::Reference;
38using ::com::sun::star::uno::Sequence;
39
40namespace chart::wrapper
41{
42
44 std::shared_ptr<Chart2ModelContact> spChart2ModelContact ) :
45 m_spChart2ModelContact(std::move( spChart2ModelContact )),
46 m_bWall( bWall )
47
48{
49}
50
52{
53}
54
55// ____ XComponent ____
57{
58 std::unique_lock g(m_aMutex);
59 Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
60 m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) );
61
62 clearWrappedPropertySet();
63}
64
66 const Reference< lang::XEventListener >& xListener )
67{
68 std::unique_lock g(m_aMutex);
70}
71
73 const Reference< lang::XEventListener >& aListener )
74{
75 std::unique_lock g(m_aMutex);
77}
78
79// WrappedPropertySet
81{
83
85 if( xDiagram.is() )
86 {
87 if( m_bWall )
88 xRet.set( xDiagram->getWall() );
89 else
90 xRet.set( xDiagram->getFloor() );
91 }
92
93 return xRet;
94}
95
97{
98 static Sequence< Property > aPropSeq = []()
99 {
100 std::vector< css::beans::Property > aProperties;
104
105 std::sort( aProperties.begin(), aProperties.end(),
107
109 }();
110 return aPropSeq;
111}
112
113std::vector< std::unique_ptr<WrappedProperty> > WallFloorWrapper::createWrappedProperties()
114{
115 std::vector< std::unique_ptr<WrappedProperty> > aWrappedProperties;
116
117 // use direct state always, so that in XML the value is always
118 // exported. Because in the old chart the defaults is as follows:
119 // Floor: SOLID (new and old model default), Wall: NONE, except for some chart types (line, scatter)
120 if( m_bWall )
121 aWrappedProperties.emplace_back( new WrappedDirectStateProperty( "FillStyle", "FillStyle" ));
122 aWrappedProperties.emplace_back( new WrappedDirectStateProperty( "FillColor", "FillColor" ));
123
124 return aWrappedProperties;
125}
126
128{
129 return "com.sun.star.comp.chart.WallOrFloor";
130}
131
132sal_Bool SAL_CALL WallFloorWrapper::supportsService( const OUString& rServiceName )
133{
134 return cppu::supportsService(this, rServiceName);
135}
136
137css::uno::Sequence< OUString > SAL_CALL WallFloorWrapper::getSupportedServiceNames()
138{
139 return {
140 "com.sun.star.xml.UserDefinedAttributesSupplier",
141 "com.sun.star.drawing.FillProperties",
142 "com.sun.star.drawing.LineProperties",
143 "com.sun.star.beans.PropertySet"
144 };
145}
146
147} // namespace chart::wrapper
148
149/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact
PropertiesInfo aProperties
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
WallFloorWrapper(bool bWall, std::shared_ptr< Chart2ModelContact > spChart2ModelContact)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual std::vector< std::unique_ptr< WrappedProperty > > createWrappedProperties() override
virtual const css::uno::Sequence< css::beans::Property > & getPropertySequence() override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual OUString SAL_CALL getImplementationName() override
XServiceInfo declarations.
virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() override
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aEventListenerContainer
virtual void SAL_CALL dispose() override
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(::std::unique_lock<::std::mutex > &rGuard, const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
std::mutex m_aMutex
OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector(std::vector< css::beans::Property > &rOutProperties)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool