LibreOffice Module chart2 (master) 1
AreaWrapper.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 "AreaWrapper.hxx"
25
27#include <FillProperties.hxx>
29
30#include <algorithm>
31#include <utility>
32
33using namespace ::com::sun::star;
34using ::com::sun::star::beans::Property;
35using ::com::sun::star::uno::Reference;
36using ::com::sun::star::uno::Sequence;
37
39{
40
41AreaWrapper::AreaWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
42 : m_spChart2ModelContact(std::move(spChart2ModelContact))
43{
44}
45
47{}
48
49// ____ XShape ____
50awt::Point SAL_CALL AreaWrapper::getPosition()
51{
52 return awt::Point(0,0);
53}
54
55void SAL_CALL AreaWrapper::setPosition( const awt::Point& /*aPosition*/ )
56{
57 OSL_FAIL( "trying to set position of chart area" );
58}
59
60awt::Size SAL_CALL AreaWrapper::getSize()
61{
62 return m_spChart2ModelContact->GetPageSize();
63}
64
65void SAL_CALL AreaWrapper::setSize( const awt::Size& /*aSize*/ )
66{
67 OSL_FAIL( "trying to set size of chart area" );
68}
69
70// ____ XShapeDescriptor (base of XShape) ____
71OUString SAL_CALL AreaWrapper::getShapeType()
72{
73 return "com.sun.star.chart.ChartArea";
74}
75
76// ____ XComponent ____
77void SAL_CALL AreaWrapper::dispose()
78{
79 std::unique_lock g(m_aMutex);
80 Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
81 m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) );
82
83 clearWrappedPropertySet();
84}
85
87 const Reference< lang::XEventListener >& xListener )
88{
89 std::unique_lock g(m_aMutex);
91}
92
94 const Reference< lang::XEventListener >& aListener )
95{
96 std::unique_lock g(m_aMutex);
98}
99
100// WrappedPropertySet
102{
103 rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
104 if( xChartDoc.is() )
105 return xChartDoc->getPageBackground();
106 OSL_FAIL("AreaWrapper::getInnerPropertySet() is NULL");
107 return nullptr;
108}
109
111{
112 static Sequence< Property > aPropSeq = []()
113 {
114 std::vector< css::beans::Property > aProperties;
118
119 std::sort( aProperties.begin(), aProperties.end(),
121
123 }();
124 return aPropSeq;
125}
126
127std::vector< std::unique_ptr<WrappedProperty> > AreaWrapper::createWrappedProperties()
128{
129 std::vector< std::unique_ptr<WrappedProperty> > aWrappedProperties;
130
131 aWrappedProperties.emplace_back( new WrappedDirectStateProperty("LineStyle","LineStyle") );
132
133 return aWrappedProperties;
134}
135
137{
138 return "com.sun.star.comp.chart.Area";
139}
140
141sal_Bool SAL_CALL AreaWrapper::supportsService( const OUString& rServiceName )
142{
143 return cppu::supportsService(this, rServiceName);
144}
145
146css::uno::Sequence< OUString > SAL_CALL AreaWrapper::getSupportedServiceNames()
147{
148 return {
149 "com.sun.star.xml.UserDefinedAttributesSupplier",
150 "com.sun.star.beans.PropertySet",
151 "com.sun.star.drawing.FillProperties",
152 "com.sun.star.drawing.LineProperties" };
153}
154
155} // namespace chart::wrapper
156
157/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact
PropertiesInfo aProperties
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: AreaWrapper.cxx:93
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: AreaWrapper.cxx:86
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual const css::uno::Sequence< css::beans::Property > & getPropertySequence() override
virtual void SAL_CALL dispose() override
Definition: AreaWrapper.cxx:77
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact
Definition: AreaWrapper.hxx:74
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aEventListenerContainer
Definition: AreaWrapper.hxx:75
virtual css::awt::Point SAL_CALL getPosition() override
Definition: AreaWrapper.cxx:50
virtual css::awt::Size SAL_CALL getSize() override
Definition: AreaWrapper.cxx:60
AreaWrapper(std::shared_ptr< Chart2ModelContact > spChart2ModelContact)
Definition: AreaWrapper.cxx:41
virtual OUString SAL_CALL getImplementationName() override
XServiceInfo declarations.
virtual ~AreaWrapper() override
Definition: AreaWrapper.cxx:46
virtual void SAL_CALL setSize(const css::awt::Size &aSize) override
Definition: AreaWrapper.cxx:65
virtual OUString SAL_CALL getShapeType() override
Definition: AreaWrapper.cxx:71
virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() override
virtual void SAL_CALL setPosition(const css::awt::Point &aPosition) override
Definition: AreaWrapper.cxx:55
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual std::vector< std::unique_ptr< WrappedProperty > > createWrappedProperties() 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