19e0e4191SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
39e0e4191SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
49e0e4191SAndrew Rist * or more contributor license agreements. See the NOTICE file
59e0e4191SAndrew Rist * distributed with this work for additional information
69e0e4191SAndrew Rist * regarding copyright ownership. The ASF licenses this file
79e0e4191SAndrew Rist * to you under the Apache License, Version 2.0 (the
89e0e4191SAndrew Rist * "License"); you may not use this file except in compliance
99e0e4191SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
119e0e4191SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
139e0e4191SAndrew Rist * Unless required by applicable law or agreed to in writing,
149e0e4191SAndrew Rist * software distributed under the License is distributed on an
159e0e4191SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169e0e4191SAndrew Rist * KIND, either express or implied. See the License for the
179e0e4191SAndrew Rist * specific language governing permissions and limitations
189e0e4191SAndrew Rist * under the License.
19cdf0e10cSrcweir *
209e0e4191SAndrew Rist *************************************************************/
219e0e4191SAndrew Rist
229e0e4191SAndrew Rist
23*b63233d8Sdamjan #include "precompiled_reportdesign.hxx"
24cdf0e10cSrcweir #include "Section.hxx"
25cdf0e10cSrcweir #include <comphelper/enumhelper.hxx>
26cdf0e10cSrcweir #include <connectivity/dbtools.hxx>
27cdf0e10cSrcweir #include <com/sun/star/report/XReportComponent.hpp>
28cdf0e10cSrcweir #include <com/sun/star/report/ForceNewPage.hpp>
29cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31cdf0e10cSrcweir #ifndef REPORTDESIGN_SHARED_CORESTRINGS_HRC
32cdf0e10cSrcweir #include "corestrings.hrc"
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir #include "core_resource.hxx"
35cdf0e10cSrcweir #ifndef REPORTDESIGN_CORE_RESOURCE_HRC_
36cdf0e10cSrcweir #include "core_resource.hrc"
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #include <tools/debug.hxx>
39cdf0e10cSrcweir #include "Tools.hxx"
40cdf0e10cSrcweir #include "RptModel.hxx"
41cdf0e10cSrcweir #include "RptPage.hxx"
42cdf0e10cSrcweir #include "ReportDefinition.hxx"
43cdf0e10cSrcweir #include "Shape.hxx"
44cdf0e10cSrcweir #include <svx/unoshape.hxx>
45cdf0e10cSrcweir #include "RptObject.hxx"
46cdf0e10cSrcweir #include "ReportDrawPage.hxx"
47cdf0e10cSrcweir #include <comphelper/property.hxx>
48cdf0e10cSrcweir // =============================================================================
49cdf0e10cSrcweir namespace reportdesign
50cdf0e10cSrcweir {
51cdf0e10cSrcweir // =============================================================================
52cdf0e10cSrcweir using namespace com::sun::star;
53cdf0e10cSrcweir using namespace comphelper;
DBG_NAME(rpt_OSection)54cdf0e10cSrcweir DBG_NAME( rpt_OSection )
55cdf0e10cSrcweir // -----------------------------------------------------------------------------
56cdf0e10cSrcweir uno::Sequence< ::rtl::OUString> lcl_getGroupAbsent()
57cdf0e10cSrcweir {
58cdf0e10cSrcweir ::rtl::OUString pProps[] = {
59cdf0e10cSrcweir PROPERTY_CANGROW
60cdf0e10cSrcweir ,PROPERTY_CANSHRINK
61cdf0e10cSrcweir };
62cdf0e10cSrcweir
63cdf0e10cSrcweir return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
64cdf0e10cSrcweir }
65cdf0e10cSrcweir
66cdf0e10cSrcweir // -----------------------------------------------------------------------------
OSection(const uno::Reference<report::XGroup> & _xParent,const uno::Reference<uno::XComponentContext> & context,bool)67cdf0e10cSrcweir OSection::OSection( const uno::Reference< report::XGroup >& _xParent
68cdf0e10cSrcweir ,const uno::Reference< uno::XComponentContext >& context
69cdf0e10cSrcweir ,bool /*_bPageSection*/)
70cdf0e10cSrcweir :SectionBase(m_aMutex)
71cdf0e10cSrcweir ,SectionPropertySet(context,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getGroupAbsent())
72cdf0e10cSrcweir ,m_aContainerListeners(m_aMutex)
73cdf0e10cSrcweir ,m_xContext(context)
74cdf0e10cSrcweir ,m_xGroup(_xParent)
75cdf0e10cSrcweir ,m_nHeight(3000)
76cdf0e10cSrcweir ,m_nBackgroundColor(COL_TRANSPARENT)
77cdf0e10cSrcweir ,m_nForceNewPage(report::ForceNewPage::NONE)
78cdf0e10cSrcweir ,m_nNewRowOrCol(report::ForceNewPage::NONE)
79cdf0e10cSrcweir ,m_bKeepTogether(sal_False)
80cdf0e10cSrcweir ,m_bCanGrow(sal_False)
81cdf0e10cSrcweir ,m_bCanShrink(sal_False)
82cdf0e10cSrcweir ,m_bRepeatSection(sal_False)
83cdf0e10cSrcweir ,m_bVisible(sal_True)
84cdf0e10cSrcweir ,m_bBacktransparent(sal_True)
85cdf0e10cSrcweir ,m_bInRemoveNotify(false)
86cdf0e10cSrcweir ,m_bInInsertNotify(false)
87cdf0e10cSrcweir {
88cdf0e10cSrcweir DBG_CTOR( rpt_OSection,NULL);
89cdf0e10cSrcweir init();
90cdf0e10cSrcweir }
91cdf0e10cSrcweir // -----------------------------------------------------------------------------
lcl_getAbsent(bool _bPageSection)92cdf0e10cSrcweir uno::Sequence< ::rtl::OUString> lcl_getAbsent(bool _bPageSection)
93cdf0e10cSrcweir {
94cdf0e10cSrcweir if ( _bPageSection )
95cdf0e10cSrcweir {
96cdf0e10cSrcweir ::rtl::OUString pProps[] = {
97cdf0e10cSrcweir PROPERTY_FORCENEWPAGE
98cdf0e10cSrcweir ,PROPERTY_NEWROWORCOL
99cdf0e10cSrcweir ,PROPERTY_KEEPTOGETHER
100cdf0e10cSrcweir ,PROPERTY_CANGROW
101cdf0e10cSrcweir ,PROPERTY_CANSHRINK
102cdf0e10cSrcweir ,PROPERTY_REPEATSECTION
103cdf0e10cSrcweir };
104cdf0e10cSrcweir return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
105cdf0e10cSrcweir }
106cdf0e10cSrcweir
107cdf0e10cSrcweir ::rtl::OUString pProps[] = {
108cdf0e10cSrcweir PROPERTY_CANGROW
109cdf0e10cSrcweir ,PROPERTY_CANSHRINK
110cdf0e10cSrcweir ,PROPERTY_REPEATSECTION
111cdf0e10cSrcweir };
112cdf0e10cSrcweir
113cdf0e10cSrcweir return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
114cdf0e10cSrcweir }
115cdf0e10cSrcweir // -----------------------------------------------------------------------------
OSection(const uno::Reference<report::XReportDefinition> & _xParent,const uno::Reference<uno::XComponentContext> & context,bool _bPageSection)116cdf0e10cSrcweir OSection::OSection(const uno::Reference< report::XReportDefinition >& _xParent
117cdf0e10cSrcweir ,const uno::Reference< uno::XComponentContext >& context
118cdf0e10cSrcweir ,bool _bPageSection)
119cdf0e10cSrcweir :SectionBase(m_aMutex)
120cdf0e10cSrcweir ,SectionPropertySet(context,SectionPropertySet::IMPLEMENTS_PROPERTY_SET,lcl_getAbsent(_bPageSection))
121cdf0e10cSrcweir ,m_aContainerListeners(m_aMutex)
122cdf0e10cSrcweir ,m_xContext(context)
123cdf0e10cSrcweir ,m_xReportDefinition(_xParent)
124cdf0e10cSrcweir ,m_nHeight(3000)
125cdf0e10cSrcweir ,m_nBackgroundColor(COL_TRANSPARENT)
126cdf0e10cSrcweir ,m_nForceNewPage(report::ForceNewPage::NONE)
127cdf0e10cSrcweir ,m_nNewRowOrCol(report::ForceNewPage::NONE)
128cdf0e10cSrcweir ,m_bKeepTogether(sal_False)
129cdf0e10cSrcweir ,m_bCanGrow(sal_False)
130cdf0e10cSrcweir ,m_bCanShrink(sal_False)
131cdf0e10cSrcweir ,m_bRepeatSection(sal_False)
132cdf0e10cSrcweir ,m_bVisible(sal_True)
133cdf0e10cSrcweir ,m_bBacktransparent(sal_True)
134cdf0e10cSrcweir ,m_bInRemoveNotify(false)
135cdf0e10cSrcweir ,m_bInInsertNotify(false)
136cdf0e10cSrcweir {
137cdf0e10cSrcweir DBG_CTOR( rpt_OSection,NULL);
138cdf0e10cSrcweir init();
139cdf0e10cSrcweir //.getSdrModel()->createNewPage(m_xSection);
140cdf0e10cSrcweir }
141cdf0e10cSrcweir //--------------------------------------------------------------------------
142cdf0e10cSrcweir // TODO: VirtualFunctionFinder: This is virtual function!
143cdf0e10cSrcweir //
~OSection()144cdf0e10cSrcweir OSection::~OSection()
145cdf0e10cSrcweir {
146cdf0e10cSrcweir DBG_DTOR( rpt_OSection,NULL);
147cdf0e10cSrcweir if ( m_xProxy.is() )
148cdf0e10cSrcweir m_xProxy->setDelegator( NULL );
149cdf0e10cSrcweir }
150cdf0e10cSrcweir //--------------------------------------------------------------------------
151cdf0e10cSrcweir //IMPLEMENT_FORWARD_XINTERFACE2(OSection,SectionBase,SectionPropertySet)
IMPLEMENT_FORWARD_REFCOUNT(OSection,SectionBase)152cdf0e10cSrcweir IMPLEMENT_FORWARD_REFCOUNT( OSection, SectionBase )
153cdf0e10cSrcweir // --------------------------------------------------------------------------------
154cdf0e10cSrcweir uno::Any SAL_CALL OSection::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException)
155cdf0e10cSrcweir {
156cdf0e10cSrcweir uno::Any aReturn = SectionBase::queryInterface(_rType);
157cdf0e10cSrcweir if ( !aReturn.hasValue() )
158cdf0e10cSrcweir aReturn = SectionPropertySet::queryInterface(_rType);
159cdf0e10cSrcweir
160cdf0e10cSrcweir if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
161cdf0e10cSrcweir return aReturn;
162cdf0e10cSrcweir
163cdf0e10cSrcweir return aReturn.hasValue() ? aReturn : (m_xProxy.is() ? m_xProxy->queryAggregation(_rType) : aReturn);
164cdf0e10cSrcweir }
165cdf0e10cSrcweir
166cdf0e10cSrcweir // -----------------------------------------------------------------------------
dispose()167cdf0e10cSrcweir void SAL_CALL OSection::dispose() throw(uno::RuntimeException)
168cdf0e10cSrcweir {
169cdf0e10cSrcweir OSL_ENSURE(!rBHelper.bDisposed,"Already disposed!");
170cdf0e10cSrcweir SectionPropertySet::dispose();
171cdf0e10cSrcweir cppu::WeakComponentImplHelperBase::dispose();
172cdf0e10cSrcweir
173cdf0e10cSrcweir }
174cdf0e10cSrcweir // -----------------------------------------------------------------------------
175cdf0e10cSrcweir // TODO: VirtualFunctionFinder: This is virtual function!
176cdf0e10cSrcweir //
disposing()177cdf0e10cSrcweir void SAL_CALL OSection::disposing()
178cdf0e10cSrcweir {
179cdf0e10cSrcweir lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) );
180cdf0e10cSrcweir m_aContainerListeners.disposeAndClear( aDisposeEvent );
181cdf0e10cSrcweir m_xContext.clear();
182cdf0e10cSrcweir //m_xDrawPage.clear();
183cdf0e10cSrcweir
184cdf0e10cSrcweir /*uno::Reference< report::XReportDefinition> xReport = getReportDefinition();
185cdf0e10cSrcweir ::boost::shared_ptr<rptui::OReportModel> pModel = OReportDefinition::getSdrModel(xReport);
186cdf0e10cSrcweir osl_incrementInterlockedCount( &m_refCount );
187cdf0e10cSrcweir while( m_xDrawPage.is() && m_xDrawPage->hasElements() )
188cdf0e10cSrcweir {
189cdf0e10cSrcweir try
190cdf0e10cSrcweir {
191cdf0e10cSrcweir uno::Reference< drawing::XShape> xShape(m_xDrawPage->getByIndex(0),uno::UNO_QUERY);
192cdf0e10cSrcweir m_xDrawPage->remove(xShape);
193cdf0e10cSrcweir ::comphelper::disposeComponent(xShape);
194cdf0e10cSrcweir }
195cdf0e10cSrcweir catch(const uno::Exception&)
196cdf0e10cSrcweir {}
197cdf0e10cSrcweir }
198cdf0e10cSrcweir if ( pModel )
199cdf0e10cSrcweir {
200cdf0e10cSrcweir uno::Reference< report::XSection> xSection = this;
201cdf0e10cSrcweir pModel->DeletePage(pModel->getPage(xSection)->GetPageNum());
202cdf0e10cSrcweir }
203cdf0e10cSrcweir osl_decrementInterlockedCount( &m_refCount );*/
204cdf0e10cSrcweir }
205cdf0e10cSrcweir //--------------------------------------------------------------------------
getImplementationName()206cdf0e10cSrcweir ::rtl::OUString SAL_CALL OSection::getImplementationName( ) throw(uno::RuntimeException)
207cdf0e10cSrcweir {
208cdf0e10cSrcweir return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.Section"));
209cdf0e10cSrcweir }
210cdf0e10cSrcweir //------------------------------------------------------------------------------
getSupportedServiceNames_Static(void)211cdf0e10cSrcweir uno::Sequence< ::rtl::OUString> OSection::getSupportedServiceNames_Static(void) throw( uno::RuntimeException )
212cdf0e10cSrcweir {
213cdf0e10cSrcweir uno::Sequence< ::rtl::OUString> aSupported(1);
214cdf0e10cSrcweir aSupported.getArray()[0] = SERVICE_SECTION;
215cdf0e10cSrcweir return aSupported;
216cdf0e10cSrcweir }
217cdf0e10cSrcweir //-------------------------------------------------------------------------
getSupportedServiceNames()218cdf0e10cSrcweir uno::Sequence< ::rtl::OUString> SAL_CALL OSection::getSupportedServiceNames() throw(uno::RuntimeException)
219cdf0e10cSrcweir {
220cdf0e10cSrcweir return getSupportedServiceNames_Static();
221cdf0e10cSrcweir }
222cdf0e10cSrcweir // -----------------------------------------------------------------------------
supportsService(const::rtl::OUString & _rServiceName)223cdf0e10cSrcweir sal_Bool SAL_CALL OSection::supportsService( const ::rtl::OUString& _rServiceName ) throw(uno::RuntimeException)
224cdf0e10cSrcweir {
225cdf0e10cSrcweir return ::comphelper::existsValue(_rServiceName,getSupportedServiceNames_Static());
226cdf0e10cSrcweir }
227cdf0e10cSrcweir // -----------------------------------------------------------------------------
init()228cdf0e10cSrcweir void OSection::init()
229cdf0e10cSrcweir {
230cdf0e10cSrcweir uno::Reference< report::XReportDefinition> xReport = getReportDefinition();
231cdf0e10cSrcweir ::boost::shared_ptr<rptui::OReportModel> pModel = OReportDefinition::getSdrModel(xReport);
232cdf0e10cSrcweir OSL_ENSURE(pModel,"No odel set at the report definition!");
233cdf0e10cSrcweir if ( pModel )
234cdf0e10cSrcweir {
235cdf0e10cSrcweir // DO NOT TOUCH THIS BLOCKS, WE HAVE A COMPILER PROBLEM UNDER SOLARIS X86
236cdf0e10cSrcweir osl_incrementInterlockedCount( &m_refCount );
237cdf0e10cSrcweir {
238cdf0e10cSrcweir uno::Reference<report::XSection> xTemp = this;
239cdf0e10cSrcweir {
240cdf0e10cSrcweir {
241cdf0e10cSrcweir m_xProxy.set(pModel->createNewPage(xTemp)->getUnoPage(),uno::UNO_QUERY);
242cdf0e10cSrcweir }
243cdf0e10cSrcweir {
244cdf0e10cSrcweir ::comphelper::query_aggregation(m_xProxy,m_xDrawPage);
245cdf0e10cSrcweir }
246cdf0e10cSrcweir
247cdf0e10cSrcweir // set ourself as delegator
248cdf0e10cSrcweir {
249cdf0e10cSrcweir if ( m_xProxy.is() )
250cdf0e10cSrcweir {
251cdf0e10cSrcweir m_xProxy->setDelegator( xTemp );
252cdf0e10cSrcweir }
253cdf0e10cSrcweir }
254cdf0e10cSrcweir }
255cdf0e10cSrcweir xTemp.clear();
256cdf0e10cSrcweir }
257cdf0e10cSrcweir // DO NOT TOUCH THIS BLOCKS, WE HAVE A COMPILER PROBLEM UNDER SOLARIS X86
258cdf0e10cSrcweir osl_decrementInterlockedCount( &m_refCount );
259cdf0e10cSrcweir }
260cdf0e10cSrcweir }
261cdf0e10cSrcweir // -----------------------------------------------------------------------------
262cdf0e10cSrcweir // XSection
263cdf0e10cSrcweir // -----------------------------------------------------------------------------
getVisible()264cdf0e10cSrcweir ::sal_Bool SAL_CALL OSection::getVisible() throw (uno::RuntimeException)
265cdf0e10cSrcweir {
266cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
267cdf0e10cSrcweir return m_bVisible;
268cdf0e10cSrcweir }
269cdf0e10cSrcweir // -----------------------------------------------------------------------------
setVisible(::sal_Bool _visible)270cdf0e10cSrcweir void SAL_CALL OSection::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
271cdf0e10cSrcweir {
272cdf0e10cSrcweir set(PROPERTY_VISIBLE,_visible,m_bVisible);
273cdf0e10cSrcweir }
274cdf0e10cSrcweir // -----------------------------------------------------------------------------
getName()275cdf0e10cSrcweir ::rtl::OUString SAL_CALL OSection::getName() throw (uno::RuntimeException)
276cdf0e10cSrcweir {
277cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
278cdf0e10cSrcweir return m_sName;
279cdf0e10cSrcweir }
280cdf0e10cSrcweir // -----------------------------------------------------------------------------
setName(const::rtl::OUString & _name)281cdf0e10cSrcweir void SAL_CALL OSection::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeException)
282cdf0e10cSrcweir {
283cdf0e10cSrcweir set(PROPERTY_NAME,_name,m_sName);
284cdf0e10cSrcweir }
285cdf0e10cSrcweir // -----------------------------------------------------------------------------
getHeight()286cdf0e10cSrcweir ::sal_uInt32 SAL_CALL OSection::getHeight() throw (uno::RuntimeException)
287cdf0e10cSrcweir {
288cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
289cdf0e10cSrcweir return m_nHeight;
290cdf0e10cSrcweir }
291cdf0e10cSrcweir // -----------------------------------------------------------------------------
setHeight(::sal_uInt32 _height)292cdf0e10cSrcweir void SAL_CALL OSection::setHeight( ::sal_uInt32 _height ) throw (uno::RuntimeException)
293cdf0e10cSrcweir {
294cdf0e10cSrcweir set(PROPERTY_HEIGHT,_height,m_nHeight);
295cdf0e10cSrcweir }
296cdf0e10cSrcweir // -----------------------------------------------------------------------------
getBackColor()297cdf0e10cSrcweir ::sal_Int32 SAL_CALL OSection::getBackColor() throw (uno::RuntimeException)
298cdf0e10cSrcweir {
299cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
300cdf0e10cSrcweir return m_bBacktransparent ? COL_TRANSPARENT : m_nBackgroundColor;
301cdf0e10cSrcweir }
302cdf0e10cSrcweir // -----------------------------------------------------------------------------
setBackColor(::sal_Int32 _backgroundcolor)303cdf0e10cSrcweir void SAL_CALL OSection::setBackColor( ::sal_Int32 _backgroundcolor ) throw (uno::RuntimeException)
304cdf0e10cSrcweir {
305cdf0e10cSrcweir sal_Bool bTransparent = _backgroundcolor == static_cast<sal_Int32>(COL_TRANSPARENT);
306cdf0e10cSrcweir setBackTransparent(bTransparent);
307cdf0e10cSrcweir if ( !bTransparent )
308cdf0e10cSrcweir set(PROPERTY_BACKCOLOR,_backgroundcolor,m_nBackgroundColor);
309cdf0e10cSrcweir }
310cdf0e10cSrcweir // -----------------------------------------------------------------------------
getBackTransparent()311cdf0e10cSrcweir ::sal_Bool SAL_CALL OSection::getBackTransparent() throw (uno::RuntimeException)
312cdf0e10cSrcweir {
313cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
314cdf0e10cSrcweir return m_bBacktransparent;
315cdf0e10cSrcweir }
316cdf0e10cSrcweir // -----------------------------------------------------------------------------
setBackTransparent(::sal_Bool _backtransparent)317cdf0e10cSrcweir void SAL_CALL OSection::setBackTransparent( ::sal_Bool _backtransparent ) throw (uno::RuntimeException)
318cdf0e10cSrcweir {
319cdf0e10cSrcweir set(PROPERTY_BACKTRANSPARENT,_backtransparent,m_bBacktransparent);
320cdf0e10cSrcweir if ( _backtransparent )
321cdf0e10cSrcweir set(PROPERTY_BACKCOLOR,static_cast<sal_Int32>(COL_TRANSPARENT),m_nBackgroundColor);
322cdf0e10cSrcweir }
323cdf0e10cSrcweir // -----------------------------------------------------------------------------
getConditionalPrintExpression()324cdf0e10cSrcweir ::rtl::OUString SAL_CALL OSection::getConditionalPrintExpression() throw (uno::RuntimeException)
325cdf0e10cSrcweir {
326cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
327cdf0e10cSrcweir return m_sConditionalPrintExpression;
328cdf0e10cSrcweir }
329cdf0e10cSrcweir // -----------------------------------------------------------------------------
setConditionalPrintExpression(const::rtl::OUString & _conditionalprintexpression)330cdf0e10cSrcweir void SAL_CALL OSection::setConditionalPrintExpression( const ::rtl::OUString& _conditionalprintexpression ) throw (uno::RuntimeException)
331cdf0e10cSrcweir {
332cdf0e10cSrcweir set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_sConditionalPrintExpression);
333cdf0e10cSrcweir }
334cdf0e10cSrcweir // -----------------------------------------------------------------------------
checkNotPageHeaderFooter()335cdf0e10cSrcweir void OSection::checkNotPageHeaderFooter()
336cdf0e10cSrcweir {
337cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
338cdf0e10cSrcweir uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
339cdf0e10cSrcweir if ( xRet.is() )
340cdf0e10cSrcweir {
341cdf0e10cSrcweir if ( xRet->getPageHeaderOn() && xRet->getPageHeader() == *this )
342cdf0e10cSrcweir throw beans::UnknownPropertyException();
343cdf0e10cSrcweir if ( xRet->getPageFooterOn() && xRet->getPageFooter() == *this )
344cdf0e10cSrcweir throw beans::UnknownPropertyException();
345cdf0e10cSrcweir }
346cdf0e10cSrcweir }
347cdf0e10cSrcweir // -----------------------------------------------------------------------------
getForceNewPage()348cdf0e10cSrcweir ::sal_Int16 SAL_CALL OSection::getForceNewPage() throw (beans::UnknownPropertyException, uno::RuntimeException)
349cdf0e10cSrcweir {
350cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
351cdf0e10cSrcweir
352cdf0e10cSrcweir checkNotPageHeaderFooter();
353cdf0e10cSrcweir return m_nForceNewPage;
354cdf0e10cSrcweir }
355cdf0e10cSrcweir // -----------------------------------------------------------------------------
setForceNewPage(::sal_Int16 _forcenewpage)356cdf0e10cSrcweir void SAL_CALL OSection::setForceNewPage( ::sal_Int16 _forcenewpage ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
357cdf0e10cSrcweir {
358cdf0e10cSrcweir if ( _forcenewpage < report::ForceNewPage::NONE || _forcenewpage > report::ForceNewPage::BEFORE_AFTER_SECTION )
359cdf0e10cSrcweir throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::ForceNewPage"))
360cdf0e10cSrcweir ,*this
361cdf0e10cSrcweir ,1
362cdf0e10cSrcweir ,m_xContext);
363cdf0e10cSrcweir checkNotPageHeaderFooter();
364cdf0e10cSrcweir set(PROPERTY_FORCENEWPAGE,_forcenewpage,m_nForceNewPage);
365cdf0e10cSrcweir }
366cdf0e10cSrcweir // -----------------------------------------------------------------------------
getNewRowOrCol()367cdf0e10cSrcweir ::sal_Int16 SAL_CALL OSection::getNewRowOrCol() throw (beans::UnknownPropertyException, uno::RuntimeException)
368cdf0e10cSrcweir {
369cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
370cdf0e10cSrcweir checkNotPageHeaderFooter();
371cdf0e10cSrcweir return m_nNewRowOrCol;
372cdf0e10cSrcweir }
373cdf0e10cSrcweir // -----------------------------------------------------------------------------
setNewRowOrCol(::sal_Int16 _newroworcol)374cdf0e10cSrcweir void SAL_CALL OSection::setNewRowOrCol( ::sal_Int16 _newroworcol ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
375cdf0e10cSrcweir {
376cdf0e10cSrcweir if ( _newroworcol < report::ForceNewPage::NONE || _newroworcol > report::ForceNewPage::BEFORE_AFTER_SECTION )
377cdf0e10cSrcweir throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::ForceNewPage"))
378cdf0e10cSrcweir ,*this
379cdf0e10cSrcweir ,1
380cdf0e10cSrcweir ,m_xContext);
381cdf0e10cSrcweir checkNotPageHeaderFooter();
382cdf0e10cSrcweir
383cdf0e10cSrcweir set(PROPERTY_NEWROWORCOL,_newroworcol,m_nNewRowOrCol);
384cdf0e10cSrcweir }
385cdf0e10cSrcweir // -----------------------------------------------------------------------------
getKeepTogether()386cdf0e10cSrcweir ::sal_Bool SAL_CALL OSection::getKeepTogether() throw (beans::UnknownPropertyException, uno::RuntimeException)
387cdf0e10cSrcweir {
388cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
389cdf0e10cSrcweir checkNotPageHeaderFooter();
390cdf0e10cSrcweir return m_bKeepTogether;
391cdf0e10cSrcweir }
392cdf0e10cSrcweir // -----------------------------------------------------------------------------
setKeepTogether(::sal_Bool _keeptogether)393cdf0e10cSrcweir void SAL_CALL OSection::setKeepTogether( ::sal_Bool _keeptogether ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
394cdf0e10cSrcweir {
395cdf0e10cSrcweir {
396cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
397cdf0e10cSrcweir checkNotPageHeaderFooter();
398cdf0e10cSrcweir }
399cdf0e10cSrcweir
400cdf0e10cSrcweir set(PROPERTY_KEEPTOGETHER,_keeptogether,m_bKeepTogether);
401cdf0e10cSrcweir }
402cdf0e10cSrcweir // -----------------------------------------------------------------------------
getCanGrow()403cdf0e10cSrcweir ::sal_Bool SAL_CALL OSection::getCanGrow() throw (beans::UnknownPropertyException, uno::RuntimeException)
404cdf0e10cSrcweir {
405cdf0e10cSrcweir throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
406cdf0e10cSrcweir }
407cdf0e10cSrcweir // -----------------------------------------------------------------------------
setCanGrow(::sal_Bool)408cdf0e10cSrcweir void SAL_CALL OSection::setCanGrow( ::sal_Bool /*_cangrow*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
409cdf0e10cSrcweir {
410cdf0e10cSrcweir throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
411cdf0e10cSrcweir }
412cdf0e10cSrcweir // -----------------------------------------------------------------------------
getCanShrink()413cdf0e10cSrcweir ::sal_Bool SAL_CALL OSection::getCanShrink() throw (beans::UnknownPropertyException, uno::RuntimeException)
414cdf0e10cSrcweir {
415cdf0e10cSrcweir throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
416cdf0e10cSrcweir }
417cdf0e10cSrcweir // -----------------------------------------------------------------------------
setCanShrink(::sal_Bool)418cdf0e10cSrcweir void SAL_CALL OSection::setCanShrink( ::sal_Bool /*_canshrink*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
419cdf0e10cSrcweir {
420cdf0e10cSrcweir throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
421cdf0e10cSrcweir }
422cdf0e10cSrcweir // -----------------------------------------------------------------------------
getRepeatSection()423cdf0e10cSrcweir ::sal_Bool SAL_CALL OSection::getRepeatSection() throw (beans::UnknownPropertyException, uno::RuntimeException)
424cdf0e10cSrcweir {
425cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
426cdf0e10cSrcweir uno::Reference< report::XGroup > xGroup = m_xGroup;
427cdf0e10cSrcweir if ( !xGroup.is() )
428cdf0e10cSrcweir throw beans::UnknownPropertyException();
429cdf0e10cSrcweir return m_bRepeatSection;
430cdf0e10cSrcweir }
431cdf0e10cSrcweir // -----------------------------------------------------------------------------
setRepeatSection(::sal_Bool _repeatsection)432cdf0e10cSrcweir void SAL_CALL OSection::setRepeatSection( ::sal_Bool _repeatsection ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
433cdf0e10cSrcweir {
434cdf0e10cSrcweir {
435cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
436cdf0e10cSrcweir uno::Reference< report::XGroup > xGroup = m_xGroup;
437cdf0e10cSrcweir if ( !xGroup.is() )
438cdf0e10cSrcweir throw beans::UnknownPropertyException();
439cdf0e10cSrcweir }
440cdf0e10cSrcweir set(PROPERTY_REPEATSECTION,_repeatsection,m_bRepeatSection);
441cdf0e10cSrcweir }
442cdf0e10cSrcweir // -----------------------------------------------------------------------------
getGroup()443cdf0e10cSrcweir uno::Reference< report::XGroup > SAL_CALL OSection::getGroup() throw (uno::RuntimeException)
444cdf0e10cSrcweir {
445cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
446cdf0e10cSrcweir return m_xGroup;
447cdf0e10cSrcweir }
448cdf0e10cSrcweir // -----------------------------------------------------------------------------
getReportDefinition()449cdf0e10cSrcweir uno::Reference< report::XReportDefinition > SAL_CALL OSection::getReportDefinition() throw (uno::RuntimeException)
450cdf0e10cSrcweir {
451cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
452cdf0e10cSrcweir uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
453cdf0e10cSrcweir uno::Reference< report::XGroup > xGroup = m_xGroup;
454cdf0e10cSrcweir if ( !xRet.is() && xGroup.is() )
455cdf0e10cSrcweir {
456cdf0e10cSrcweir uno::Reference< report::XGroups> xGroups(xGroup->getGroups());
457cdf0e10cSrcweir if ( xGroups.is() )
458cdf0e10cSrcweir xRet = xGroups->getReportDefinition();
459cdf0e10cSrcweir }
460cdf0e10cSrcweir
461cdf0e10cSrcweir return xRet;
462cdf0e10cSrcweir }
463cdf0e10cSrcweir // -----------------------------------------------------------------------------
lcl_getControlModelMap()464cdf0e10cSrcweir const ::std::vector< ::rtl::OUString >& lcl_getControlModelMap()
465cdf0e10cSrcweir {
466cdf0e10cSrcweir static ::std::vector< ::rtl::OUString > s_sControlModels;
467cdf0e10cSrcweir if ( s_sControlModels.empty() )
468cdf0e10cSrcweir {
469cdf0e10cSrcweir s_sControlModels.push_back( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FixedText")) );
470cdf0e10cSrcweir s_sControlModels.push_back( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FixedLine")) );
471cdf0e10cSrcweir s_sControlModels.push_back( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageControl")) );
472cdf0e10cSrcweir s_sControlModels.push_back( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FormattedField")) );
473cdf0e10cSrcweir s_sControlModels.push_back( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Shape")) );
474cdf0e10cSrcweir } // if ( s_sMap.empty() )
475cdf0e10cSrcweir return s_sControlModels;
476cdf0e10cSrcweir
477cdf0e10cSrcweir }
478cdf0e10cSrcweir // -----------------------------------------------------------------------------
createReportComponent(const::rtl::OUString & _sReportComponentSpecifier)479cdf0e10cSrcweir uno::Reference< report::XReportComponent > SAL_CALL OSection::createReportComponent( const ::rtl::OUString& _sReportComponentSpecifier ) throw (uno::Exception, lang::IllegalArgumentException,uno::RuntimeException)
480cdf0e10cSrcweir {
481cdf0e10cSrcweir ::osl::ResettableMutexGuard aGuard(m_aMutex);
482cdf0e10cSrcweir const ::std::vector< ::rtl::OUString >& aRet = lcl_getControlModelMap();
483cdf0e10cSrcweir ::std::vector< ::rtl::OUString >::const_iterator aFind = ::std::find(aRet.begin(),aRet.end(),_sReportComponentSpecifier);
484cdf0e10cSrcweir if ( aFind == aRet.end() )
485cdf0e10cSrcweir throw lang::IllegalArgumentException();
486cdf0e10cSrcweir
487cdf0e10cSrcweir uno::Reference< report::XReportComponent > xRet;
488cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory> xFac(getReportDefinition(),uno::UNO_QUERY_THROW);
489cdf0e10cSrcweir switch( aFind - aRet.begin() )
490cdf0e10cSrcweir {
491cdf0e10cSrcweir case 0:
492cdf0e10cSrcweir xRet.set(xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText"))),uno::UNO_QUERY);
493cdf0e10cSrcweir break;
494cdf0e10cSrcweir case 1:
495cdf0e10cSrcweir xRet.set(xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel"))),uno::UNO_QUERY);
496cdf0e10cSrcweir break;
497cdf0e10cSrcweir case 2:
498cdf0e10cSrcweir xRet.set(xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl"))),uno::UNO_QUERY);
499cdf0e10cSrcweir break;
500cdf0e10cSrcweir case 3:
501cdf0e10cSrcweir xRet.set(xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FormattedField"))),uno::UNO_QUERY);
502cdf0e10cSrcweir break;
503cdf0e10cSrcweir case 4:
504cdf0e10cSrcweir xRet.set(xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ControlShape"))),uno::UNO_QUERY);
505cdf0e10cSrcweir break;
506cdf0e10cSrcweir default:
507cdf0e10cSrcweir //xRet = new OShape(m_xContext);
508cdf0e10cSrcweir break;
509cdf0e10cSrcweir } // switch( aRet.begin() - aFind )
510cdf0e10cSrcweir return xRet;
511cdf0e10cSrcweir }
512cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAvailableReportComponentNames()513cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL OSection::getAvailableReportComponentNames( ) throw (uno::RuntimeException)
514cdf0e10cSrcweir {
515cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
516cdf0e10cSrcweir
517cdf0e10cSrcweir const ::std::vector< ::rtl::OUString >& aRet = lcl_getControlModelMap();
518cdf0e10cSrcweir const ::rtl::OUString* pRet = aRet.empty() ? 0 : &aRet[0];
519cdf0e10cSrcweir return uno::Sequence< ::rtl::OUString >(pRet, aRet.size());
520cdf0e10cSrcweir }
521cdf0e10cSrcweir // -----------------------------------------------------------------------------
522cdf0e10cSrcweir // XChild
getParent()523cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL OSection::getParent( ) throw (uno::RuntimeException)
524cdf0e10cSrcweir {
525cdf0e10cSrcweir uno::Reference< uno::XInterface > xRet;
526cdf0e10cSrcweir {
527cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
528cdf0e10cSrcweir xRet = m_xReportDefinition;
529cdf0e10cSrcweir if ( !xRet.is() )
530cdf0e10cSrcweir xRet = m_xGroup;
531cdf0e10cSrcweir }
532cdf0e10cSrcweir return xRet;
533cdf0e10cSrcweir }
534cdf0e10cSrcweir // -----------------------------------------------------------------------------
setParent(const uno::Reference<uno::XInterface> &)535cdf0e10cSrcweir void SAL_CALL OSection::setParent( const uno::Reference< uno::XInterface >& /*Parent*/ ) throw (lang::NoSupportException, uno::RuntimeException)
536cdf0e10cSrcweir {
537cdf0e10cSrcweir throw lang::NoSupportException();
538cdf0e10cSrcweir }
539cdf0e10cSrcweir // -----------------------------------------------------------------------------
540cdf0e10cSrcweir // XContainer
addContainerListener(const uno::Reference<container::XContainerListener> & xListener)541cdf0e10cSrcweir void SAL_CALL OSection::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException)
542cdf0e10cSrcweir {
543cdf0e10cSrcweir m_aContainerListeners.addInterface(xListener);
544cdf0e10cSrcweir }
545cdf0e10cSrcweir // -----------------------------------------------------------------------------
removeContainerListener(const uno::Reference<container::XContainerListener> & xListener)546cdf0e10cSrcweir void SAL_CALL OSection::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException)
547cdf0e10cSrcweir {
548cdf0e10cSrcweir m_aContainerListeners.removeInterface(xListener);
549cdf0e10cSrcweir }
550cdf0e10cSrcweir // -----------------------------------------------------------------------------
551cdf0e10cSrcweir // XElementAccess
getElementType()552cdf0e10cSrcweir uno::Type SAL_CALL OSection::getElementType( ) throw (uno::RuntimeException)
553cdf0e10cSrcweir {
554cdf0e10cSrcweir return ::getCppuType(static_cast< uno::Reference<report::XReportComponent>*>(NULL));
555cdf0e10cSrcweir }
556cdf0e10cSrcweir // -----------------------------------------------------------------------------
hasElements()557cdf0e10cSrcweir ::sal_Bool SAL_CALL OSection::hasElements( ) throw (uno::RuntimeException)
558cdf0e10cSrcweir {
559cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
560cdf0e10cSrcweir return m_xDrawPage.is() ? m_xDrawPage->hasElements() : sal_False;
561cdf0e10cSrcweir }
562cdf0e10cSrcweir // -----------------------------------------------------------------------------
563cdf0e10cSrcweir // XIndexAccess
getCount()564cdf0e10cSrcweir ::sal_Int32 SAL_CALL OSection::getCount( ) throw (uno::RuntimeException)
565cdf0e10cSrcweir {
566cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
567cdf0e10cSrcweir return m_xDrawPage.is() ? m_xDrawPage->getCount() : 0;
568cdf0e10cSrcweir }
569cdf0e10cSrcweir // -----------------------------------------------------------------------------
getByIndex(::sal_Int32 Index)570cdf0e10cSrcweir uno::Any SAL_CALL OSection::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
571cdf0e10cSrcweir {
572cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
573cdf0e10cSrcweir return m_xDrawPage->getByIndex(Index);
574cdf0e10cSrcweir }
575cdf0e10cSrcweir // -----------------------------------------------------------------------------
576cdf0e10cSrcweir // XEnumerationAccess
createEnumeration()577cdf0e10cSrcweir uno::Reference< container::XEnumeration > SAL_CALL OSection::createEnumeration( ) throw (uno::RuntimeException)
578cdf0e10cSrcweir {
579cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
580cdf0e10cSrcweir return new ::comphelper::OEnumerationByIndex(static_cast<XIndexAccess*>(this));
581cdf0e10cSrcweir }
582cdf0e10cSrcweir // -----------------------------------------------------------------------------
getPropertySetInfo()583cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL OSection::getPropertySetInfo( ) throw(uno::RuntimeException)
584cdf0e10cSrcweir {
585cdf0e10cSrcweir return SectionPropertySet::getPropertySetInfo();
586cdf0e10cSrcweir }
587cdf0e10cSrcweir // -------------------------------------------------------------------------
setPropertyValue(const::rtl::OUString & aPropertyName,const uno::Any & aValue)588cdf0e10cSrcweir void SAL_CALL OSection::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
589cdf0e10cSrcweir {
590cdf0e10cSrcweir SectionPropertySet::setPropertyValue( aPropertyName, aValue );
591cdf0e10cSrcweir }
592cdf0e10cSrcweir // -----------------------------------------------------------------------------
getPropertyValue(const::rtl::OUString & PropertyName)593cdf0e10cSrcweir uno::Any SAL_CALL OSection::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
594cdf0e10cSrcweir {
595cdf0e10cSrcweir return SectionPropertySet::getPropertyValue( PropertyName);
596cdf0e10cSrcweir }
597cdf0e10cSrcweir // -----------------------------------------------------------------------------
addPropertyChangeListener(const::rtl::OUString & aPropertyName,const uno::Reference<beans::XPropertyChangeListener> & xListener)598cdf0e10cSrcweir void SAL_CALL OSection::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
599cdf0e10cSrcweir {
600cdf0e10cSrcweir SectionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
601cdf0e10cSrcweir }
602cdf0e10cSrcweir // -----------------------------------------------------------------------------
removePropertyChangeListener(const::rtl::OUString & aPropertyName,const uno::Reference<beans::XPropertyChangeListener> & aListener)603cdf0e10cSrcweir void SAL_CALL OSection::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
604cdf0e10cSrcweir {
605cdf0e10cSrcweir SectionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
606cdf0e10cSrcweir }
607cdf0e10cSrcweir // -----------------------------------------------------------------------------
addVetoableChangeListener(const::rtl::OUString & PropertyName,const uno::Reference<beans::XVetoableChangeListener> & aListener)608cdf0e10cSrcweir void SAL_CALL OSection::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
609cdf0e10cSrcweir {
610cdf0e10cSrcweir SectionPropertySet::addVetoableChangeListener( PropertyName, aListener );
611cdf0e10cSrcweir }
612cdf0e10cSrcweir // -----------------------------------------------------------------------------
removeVetoableChangeListener(const::rtl::OUString & PropertyName,const uno::Reference<beans::XVetoableChangeListener> & aListener)613cdf0e10cSrcweir void SAL_CALL OSection::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
614cdf0e10cSrcweir {
615cdf0e10cSrcweir SectionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
616cdf0e10cSrcweir }
617cdf0e10cSrcweir // -----------------------------------------------------------------------------
lcl_copySection(const uno::Reference<report::XSection> & _xSource,uno::Reference<report::XSection> & _xDest)618cdf0e10cSrcweir void OSection::lcl_copySection(const uno::Reference< report::XSection>& _xSource,uno::Reference< report::XSection>& _xDest)
619cdf0e10cSrcweir {
620cdf0e10cSrcweir if ( _xSource.is() )
621cdf0e10cSrcweir {
622cdf0e10cSrcweir ::comphelper::copyProperties(_xSource.get(),_xDest.get());
623cdf0e10cSrcweir sal_Int32 nCount = _xSource->getCount();
624cdf0e10cSrcweir for(sal_Int32 i = 0;i != nCount;++i)
625cdf0e10cSrcweir {
626cdf0e10cSrcweir uno::Reference<util::XCloneable> xClone(_xSource->getByIndex(i),uno::UNO_QUERY);
627cdf0e10cSrcweir OSL_ENSURE(xClone.is(),"No XCloneable interface found!");
628cdf0e10cSrcweir if ( xClone.is() )
629cdf0e10cSrcweir {
630cdf0e10cSrcweir uno::Reference< drawing::XShape> xShape(xClone->createClone(),uno::UNO_QUERY);
631cdf0e10cSrcweir _xDest->add(xShape);
632cdf0e10cSrcweir }
633cdf0e10cSrcweir }
634cdf0e10cSrcweir }
635cdf0e10cSrcweir }
636cdf0e10cSrcweir // -----------------------------------------------------------------------------
add(const uno::Reference<drawing::XShape> & xShape)637cdf0e10cSrcweir void SAL_CALL OSection::add( const uno::Reference< drawing::XShape >& xShape ) throw (uno::RuntimeException)
638cdf0e10cSrcweir {
639cdf0e10cSrcweir {
640cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
641cdf0e10cSrcweir m_bInInsertNotify = true;
642cdf0e10cSrcweir OSL_ENSURE(m_xDrawPage.is(),"No DrawPage!");
643cdf0e10cSrcweir m_xDrawPage->add(xShape);
644cdf0e10cSrcweir m_bInInsertNotify = false;
645cdf0e10cSrcweir }
646cdf0e10cSrcweir notifyElementAdded(xShape);
647cdf0e10cSrcweir }
648cdf0e10cSrcweir // -----------------------------------------------------------------------------
remove(const uno::Reference<drawing::XShape> & xShape)649cdf0e10cSrcweir void SAL_CALL OSection::remove( const uno::Reference< drawing::XShape >& xShape ) throw (uno::RuntimeException)
650cdf0e10cSrcweir {
651cdf0e10cSrcweir {
652cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex);
653cdf0e10cSrcweir m_bInRemoveNotify = true;
654cdf0e10cSrcweir OSL_ENSURE(m_xDrawPage.is(),"No DrawPage!");
655cdf0e10cSrcweir m_xDrawPage->remove(xShape);
656cdf0e10cSrcweir m_bInRemoveNotify = false;
657cdf0e10cSrcweir }
658cdf0e10cSrcweir notifyElementRemoved(xShape);
659cdf0e10cSrcweir }
660cdf0e10cSrcweir // -----------------------------------------------------------------------------
661cdf0e10cSrcweir // -----------------------------------------------------------------------------
662cdf0e10cSrcweir // com::sun::star::lang::XUnoTunnel
663cdf0e10cSrcweir //------------------------------------------------------------------
getSomething(const uno::Sequence<sal_Int8> & rId)664cdf0e10cSrcweir sal_Int64 OSection::getSomething( const uno::Sequence< sal_Int8 > & rId ) throw (uno::RuntimeException)
665cdf0e10cSrcweir {
666cdf0e10cSrcweir if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
667cdf0e10cSrcweir return reinterpret_cast<sal_Int64>(this);
668cdf0e10cSrcweir uno::Reference< lang::XUnoTunnel> xTunnel;
669cdf0e10cSrcweir ::comphelper::query_aggregation(m_xProxy,xTunnel);
670cdf0e10cSrcweir return xTunnel->getSomething(rId);
671cdf0e10cSrcweir }
672cdf0e10cSrcweir
673cdf0e10cSrcweir // -----------------------------------------------------------------------------
getImplementation(const uno::Reference<uno::XInterface> & _rxComponent)674cdf0e10cSrcweir OSection* OSection::getImplementation( const uno::Reference< uno::XInterface >& _rxComponent )
675cdf0e10cSrcweir {
676cdf0e10cSrcweir OSection* pContent( NULL );
677cdf0e10cSrcweir
678cdf0e10cSrcweir uno::Reference< lang::XUnoTunnel > xUnoTunnel( _rxComponent, uno::UNO_QUERY );
679cdf0e10cSrcweir if ( xUnoTunnel.is() )
680cdf0e10cSrcweir pContent = reinterpret_cast< OSection* >( xUnoTunnel->getSomething( getUnoTunnelImplementationId() ) );
681cdf0e10cSrcweir
682cdf0e10cSrcweir return pContent;
683cdf0e10cSrcweir }
684cdf0e10cSrcweir //------------------------------------------------------------------------
getUnoTunnelImplementationId()685cdf0e10cSrcweir uno::Sequence< sal_Int8 > OSection::getUnoTunnelImplementationId()
686cdf0e10cSrcweir {
687cdf0e10cSrcweir static ::cppu::OImplementationId * pId = 0;
688cdf0e10cSrcweir if (! pId)
689cdf0e10cSrcweir {
690cdf0e10cSrcweir ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
691cdf0e10cSrcweir if (! pId)
692cdf0e10cSrcweir {
693cdf0e10cSrcweir static ::cppu::OImplementationId aId;
694cdf0e10cSrcweir pId = &aId;
695cdf0e10cSrcweir }
696cdf0e10cSrcweir }
697cdf0e10cSrcweir return pId->getImplementationId();
698cdf0e10cSrcweir }
699cdf0e10cSrcweir // -----------------------------------------------------------------------------
notifyElementAdded(const uno::Reference<drawing::XShape> & xShape)700cdf0e10cSrcweir void OSection::notifyElementAdded(const uno::Reference< drawing::XShape >& xShape )
701cdf0e10cSrcweir {
702cdf0e10cSrcweir if ( !m_bInInsertNotify )
703cdf0e10cSrcweir {
704cdf0e10cSrcweir container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(), uno::makeAny(xShape), uno::Any());
705cdf0e10cSrcweir m_aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,aEvent);
706cdf0e10cSrcweir }
707cdf0e10cSrcweir }
708cdf0e10cSrcweir // -----------------------------------------------------------------------------
notifyElementRemoved(const uno::Reference<drawing::XShape> & xShape)709cdf0e10cSrcweir void OSection::notifyElementRemoved(const uno::Reference< drawing::XShape >& xShape)
710cdf0e10cSrcweir {
711cdf0e10cSrcweir if ( !m_bInRemoveNotify )
712cdf0e10cSrcweir {
713cdf0e10cSrcweir // notify our container listeners
714cdf0e10cSrcweir container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(), uno::makeAny(xShape), uno::Any());
715cdf0e10cSrcweir m_aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,aEvent);
716cdf0e10cSrcweir }
717cdf0e10cSrcweir }
718cdf0e10cSrcweir // =============================================================================
719cdf0e10cSrcweir } // namespace reportdesign
720cdf0e10cSrcweir // =============================================================================
721