1cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3cde9e8dcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4cde9e8dcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5cde9e8dcSAndrew Rist  * distributed with this work for additional information
6cde9e8dcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7cde9e8dcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8cde9e8dcSAndrew Rist  * "License"); you may not use this file except in compliance
9cde9e8dcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cde9e8dcSAndrew Rist  *
11cde9e8dcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cde9e8dcSAndrew Rist  *
13cde9e8dcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14cde9e8dcSAndrew Rist  * software distributed under the License is distributed on an
15cde9e8dcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16cde9e8dcSAndrew Rist  * KIND, either express or implied.  See the License for the
17cde9e8dcSAndrew Rist  * specific language governing permissions and limitations
18cde9e8dcSAndrew Rist  * under the License.
19cde9e8dcSAndrew Rist  *
20cde9e8dcSAndrew Rist  *************************************************************/
21cde9e8dcSAndrew Rist 
22cde9e8dcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "chartview/DrawModelWrapper.hxx"
28cdf0e10cSrcweir #include "macros.hxx"
29cdf0e10cSrcweir #include "ShapeFactory.hxx"
30cdf0e10cSrcweir #include "ChartItemPool.hxx"
31cdf0e10cSrcweir #include "ObjectIdentifier.hxx"
32cdf0e10cSrcweir #include <svx/unomodel.hxx>
33cdf0e10cSrcweir #include <svl/itempool.hxx>
34cdf0e10cSrcweir // header for class SfxBoolItem
35cdf0e10cSrcweir #include <svl/eitem.hxx>
36cdf0e10cSrcweir // header for define EE_PARA_HYPHENATE
37cdf0e10cSrcweir #include <editeng/eeitem.hxx>
38cdf0e10cSrcweir // header for class Svx3DPercentDiagonalItem
39cdf0e10cSrcweir #include <svx/svx3ditems.hxx>
40cdf0e10cSrcweir // header for class SvtPathOptions
41cdf0e10cSrcweir #include <unotools/pathoptions.hxx>
42cdf0e10cSrcweir // header E3dObjFactory
43cdf0e10cSrcweir #include <svx/objfac3d.hxx>
44cdf0e10cSrcweir // header for class SdrObjList
45cdf0e10cSrcweir #include <svx/svdpage.hxx>
46cdf0e10cSrcweir // header for SvxUnoXDashTable_createInstance
47cdf0e10cSrcweir #include <svx/XPropertyTable.hxx>
48cdf0e10cSrcweir // header for class XDashList
49cdf0e10cSrcweir #include <svx/xtable.hxx>
50cdf0e10cSrcweir // header for class SdrOutliner
51cdf0e10cSrcweir #include <svx/svdoutl.hxx>
52cdf0e10cSrcweir // header for class LinguMgr
53cdf0e10cSrcweir #include <editeng/unolingu.hxx>
54cdf0e10cSrcweir // header for class Application
55cdf0e10cSrcweir #include <vcl/svapp.hxx>
56cdf0e10cSrcweir // header for class VirtualDevice
57cdf0e10cSrcweir #include <vcl/virdev.hxx>
58cdf0e10cSrcweir 
59cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp>
60cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
61cdf0e10cSrcweir 
62cdf0e10cSrcweir #include <sfx2/objsh.hxx>
63cdf0e10cSrcweir #include <com/sun/star/linguistic2/XHyphenator.hpp>
64cdf0e10cSrcweir #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
65cdf0e10cSrcweir 
66cdf0e10cSrcweir using namespace ::com::sun::star;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir //.............................................................................
69cdf0e10cSrcweir namespace
70cdf0e10cSrcweir {
71cdf0e10cSrcweir // this code is copied from sfx2/source/doc/objembed.cxx
lcl_GetParentObjectShell(const uno::Reference<frame::XModel> & xModel)72cdf0e10cSrcweir SfxObjectShell * lcl_GetParentObjectShell( const uno::Reference< frame::XModel > & xModel )
73cdf0e10cSrcweir {
74cdf0e10cSrcweir     SfxObjectShell* pResult = NULL;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     try
77cdf0e10cSrcweir     {
78cdf0e10cSrcweir         uno::Reference< container::XChild > xChildModel( xModel, uno::UNO_QUERY );
79cdf0e10cSrcweir         if ( xChildModel.is() )
80cdf0e10cSrcweir         {
81cdf0e10cSrcweir             uno::Reference< lang::XUnoTunnel > xParentTunnel( xChildModel->getParent(), uno::UNO_QUERY );
82cdf0e10cSrcweir             if ( xParentTunnel.is() )
83cdf0e10cSrcweir             {
84cdf0e10cSrcweir                 SvGlobalName aSfxIdent( SFX_GLOBAL_CLASSID );
85cdf0e10cSrcweir                 pResult = reinterpret_cast< SfxObjectShell * >(
86cdf0e10cSrcweir                     xParentTunnel->getSomething( uno::Sequence< sal_Int8 >( aSfxIdent.GetByteSequence() ) ) );
87cdf0e10cSrcweir             }
88cdf0e10cSrcweir         }
89cdf0e10cSrcweir     }
90cdf0e10cSrcweir     catch( uno::Exception& )
91cdf0e10cSrcweir     {
92cdf0e10cSrcweir         // TODO: error handling
93cdf0e10cSrcweir     }
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     return pResult;
96cdf0e10cSrcweir }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir // this code is copied from sfx2/source/doc/objembed.cxx.  It is a workaround to
99cdf0e10cSrcweir // get the reference device (e.g. printer) fromthe parent document
lcl_GetParentRefDevice(const uno::Reference<frame::XModel> & xModel)100cdf0e10cSrcweir OutputDevice * lcl_GetParentRefDevice( const uno::Reference< frame::XModel > & xModel )
101cdf0e10cSrcweir {
102cdf0e10cSrcweir     SfxObjectShell * pParent = lcl_GetParentObjectShell( xModel );
103cdf0e10cSrcweir     if ( pParent )
104cdf0e10cSrcweir         return pParent->GetDocumentRefDev();
105cdf0e10cSrcweir     return NULL;
106cdf0e10cSrcweir }
107cdf0e10cSrcweir 
108cdf0e10cSrcweir } // anonymous namespace
109cdf0e10cSrcweir 
110cdf0e10cSrcweir //..    ...........................................................................
111cdf0e10cSrcweir namespace chart
112cdf0e10cSrcweir {
113cdf0e10cSrcweir //.............................................................................
114cdf0e10cSrcweir 
DrawModelWrapper(uno::Reference<uno::XComponentContext> const & xContext)115cdf0e10cSrcweir DrawModelWrapper::DrawModelWrapper(
116cdf0e10cSrcweir 		uno::Reference<uno::XComponentContext> const & xContext )
117cdf0e10cSrcweir         : SdrModel( SvtPathOptions().GetPalettePath() )
118cdf0e10cSrcweir         , m_xMCF(0)
119cdf0e10cSrcweir         , m_pChartItemPool(0)
120cdf0e10cSrcweir         , m_xMainDrawPage(0)
121cdf0e10cSrcweir         , m_xHiddenDrawPage(0)
122cdf0e10cSrcweir         , m_apRefDevice(0)
123cdf0e10cSrcweir {
124cdf0e10cSrcweir     m_pChartItemPool = ChartItemPool::CreateChartItemPool();
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     m_xMCF = xContext->getServiceManager();
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     SetScaleUnit(MAP_100TH_MM);
129cdf0e10cSrcweir     SetScaleFraction(Fraction(1, 1));
130cdf0e10cSrcweir     SetDefaultFontHeight(423);     // 12pt
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	SfxItemPool* pMasterPool = &GetItemPool();
133cdf0e10cSrcweir 	pMasterPool->SetDefaultMetric(SFX_MAPUNIT_100TH_MM);
134cdf0e10cSrcweir 	pMasterPool->SetPoolDefaultItem(SfxBoolItem(EE_PARA_HYPHENATE, sal_True) );
135cdf0e10cSrcweir 	pMasterPool->SetPoolDefaultItem(Svx3DPercentDiagonalItem (5));
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     SfxItemPool* pPool = pMasterPool;
138cdf0e10cSrcweir 	// append chart pool to end of pool chain
139cdf0e10cSrcweir 	for (;;)
140cdf0e10cSrcweir 	{
141cdf0e10cSrcweir 		SfxItemPool* pSecondary = pPool->GetSecondaryPool();
142cdf0e10cSrcweir 		if (!pSecondary)
143cdf0e10cSrcweir 			break;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 		pPool = pSecondary;
146cdf0e10cSrcweir 	}
147cdf0e10cSrcweir 	pPool->SetSecondaryPool(m_pChartItemPool);
148cdf0e10cSrcweir 	pMasterPool->FreezeIdRanges();
149cdf0e10cSrcweir 
150cdf0e10cSrcweir     //this factory needs to be created before first use of 3D scenes once upon an office runtime
151cdf0e10cSrcweir     //@todo in future this should be done by drawing engine itself on demand
152cdf0e10cSrcweir     static bool b3dFactoryInitialized = false;
153cdf0e10cSrcweir     if(!b3dFactoryInitialized)
154cdf0e10cSrcweir     {
155cdf0e10cSrcweir         E3dObjFactory aObjFactory;
156cdf0e10cSrcweir         b3dFactoryInitialized = true;
157cdf0e10cSrcweir     }
158cdf0e10cSrcweir 
159cdf0e10cSrcweir     //Hyphenyation and spellchecking
160cdf0e10cSrcweir     SdrOutliner& rOutliner = GetDrawOutliner();
161cdf0e10cSrcweir     try
162cdf0e10cSrcweir 	{
163cdf0e10cSrcweir         uno::Reference< linguistic2::XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
164cdf0e10cSrcweir 	    if( xHyphenator.is() )
165cdf0e10cSrcweir 		    rOutliner.SetHyphenator( xHyphenator );
166cdf0e10cSrcweir 
167cdf0e10cSrcweir         uno::Reference< linguistic2::XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
168cdf0e10cSrcweir 	    if ( xSpellChecker.is() )
169cdf0e10cSrcweir 		    rOutliner.SetSpeller( xSpellChecker );
170cdf0e10cSrcweir 	}
171cdf0e10cSrcweir 	catch(...)
172cdf0e10cSrcweir 	{
173cdf0e10cSrcweir 		DBG_ERROR("Can't get Hyphenator or SpellChecker for chart");
174cdf0e10cSrcweir 	}
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     //ref device for font rendering
177cdf0e10cSrcweir     OutputDevice* pDefaultDevice = rOutliner.GetRefDevice();
178cdf0e10cSrcweir     if( !pDefaultDevice )
179cdf0e10cSrcweir         pDefaultDevice = Application::GetDefaultDevice();
180cdf0e10cSrcweir     m_apRefDevice = std::auto_ptr< OutputDevice >( new VirtualDevice( *pDefaultDevice ) );
181cdf0e10cSrcweir     MapMode aMapMode = m_apRefDevice->GetMapMode();
182cdf0e10cSrcweir     aMapMode.SetMapUnit(MAP_100TH_MM);
183cdf0e10cSrcweir     m_apRefDevice->SetMapMode(aMapMode);
184cdf0e10cSrcweir     SetRefDevice(m_apRefDevice.get());
185cdf0e10cSrcweir     rOutliner.SetRefDevice(m_apRefDevice.get());
186cdf0e10cSrcweir }
187cdf0e10cSrcweir 
~DrawModelWrapper()188cdf0e10cSrcweir DrawModelWrapper::~DrawModelWrapper()
189cdf0e10cSrcweir {
190cdf0e10cSrcweir     //remove m_pChartItemPool from pool chain
191cdf0e10cSrcweir     if(m_pChartItemPool)
192cdf0e10cSrcweir     {
193cdf0e10cSrcweir 	    SfxItemPool* pPool = &GetItemPool();
194cdf0e10cSrcweir 	    for (;;)
195cdf0e10cSrcweir 	    {
196cdf0e10cSrcweir 		    SfxItemPool* pSecondary = pPool->GetSecondaryPool();
197cdf0e10cSrcweir 		    if(pSecondary == m_pChartItemPool)
198cdf0e10cSrcweir 		    {
199cdf0e10cSrcweir 			    pPool->SetSecondaryPool (NULL);
200cdf0e10cSrcweir 			    break;
201cdf0e10cSrcweir 		    }
202cdf0e10cSrcweir 		    pPool = pSecondary;
203cdf0e10cSrcweir 	    }
204cdf0e10cSrcweir         SfxItemPool::Free(m_pChartItemPool);
205cdf0e10cSrcweir     }
206cdf0e10cSrcweir }
207cdf0e10cSrcweir 
208cdf0e10cSrcweir uno::Reference< uno::XInterface > DrawModelWrapper
createUnoModel()209cdf0e10cSrcweir ::createUnoModel()
210cdf0e10cSrcweir {
211cdf0e10cSrcweir 	uno::Reference< lang::XComponent > xComponent = new SvxUnoDrawingModel( this ); //tell Andreas Schluens if SvxUnoDrawingModel is not needed anymore -> remove export from svx to avoid link problems in writer
212cdf0e10cSrcweir 	return uno::Reference< uno::XInterface >::query( xComponent );
213cdf0e10cSrcweir }
214cdf0e10cSrcweir 
getUnoModel()215cdf0e10cSrcweir uno::Reference< frame::XModel > DrawModelWrapper::getUnoModel()
216cdf0e10cSrcweir {
217cdf0e10cSrcweir     uno::Reference< uno::XInterface > xI = this->SdrModel::getUnoModel();
218cdf0e10cSrcweir     return uno::Reference<frame::XModel>::query( xI );
219cdf0e10cSrcweir }
220cdf0e10cSrcweir 
getSdrModel()221cdf0e10cSrcweir SdrModel& DrawModelWrapper::getSdrModel()
222cdf0e10cSrcweir {
223cdf0e10cSrcweir     return *this;
224cdf0e10cSrcweir }
225cdf0e10cSrcweir 
getShapeFactory()226cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > DrawModelWrapper::getShapeFactory()
227cdf0e10cSrcweir {
228cdf0e10cSrcweir     uno::Reference< lang::XMultiServiceFactory > xShapeFactory( this->getUnoModel(), uno::UNO_QUERY );
229cdf0e10cSrcweir     return xShapeFactory;
230cdf0e10cSrcweir }
231cdf0e10cSrcweir 
getMainDrawPage()232cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > DrawModelWrapper::getMainDrawPage()
233cdf0e10cSrcweir {
234cdf0e10cSrcweir     //create draw page:
235cdf0e10cSrcweir 	if( !m_xMainDrawPage.is() )
236cdf0e10cSrcweir     {
237cdf0e10cSrcweir         uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSuplier( this->getUnoModel(), uno::UNO_QUERY );
238cdf0e10cSrcweir         if( xDrawPagesSuplier.is() )
239cdf0e10cSrcweir         {
240cdf0e10cSrcweir             uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSuplier->getDrawPages () );
241cdf0e10cSrcweir             if( xDrawPages->getCount()>1 )
242cdf0e10cSrcweir             {
243cdf0e10cSrcweir                 uno::Any aPage = xDrawPages->getByIndex( 0 ) ;
244cdf0e10cSrcweir                 aPage >>= m_xMainDrawPage;
245cdf0e10cSrcweir             }
246cdf0e10cSrcweir             if(!m_xMainDrawPage.is())
247cdf0e10cSrcweir             {
248cdf0e10cSrcweir                 m_xMainDrawPage = xDrawPages->insertNewByIndex( 0 );
249cdf0e10cSrcweir             }
250cdf0e10cSrcweir         }
251cdf0e10cSrcweir     }
252cdf0e10cSrcweir     //ensure that additional shapes are in front of the chart objects so create the chart root before
253cdf0e10cSrcweir     ShapeFactory(this->getShapeFactory()).getOrCreateChartRootShape( m_xMainDrawPage );
254cdf0e10cSrcweir     return m_xMainDrawPage;
255cdf0e10cSrcweir }
getHiddenDrawPage()256cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > DrawModelWrapper::getHiddenDrawPage()
257cdf0e10cSrcweir {
258cdf0e10cSrcweir     if( !m_xHiddenDrawPage.is() )
259cdf0e10cSrcweir     {
260cdf0e10cSrcweir         uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSuplier( this->getUnoModel(), uno::UNO_QUERY );
261cdf0e10cSrcweir         if( xDrawPagesSuplier.is() )
262cdf0e10cSrcweir         {
263cdf0e10cSrcweir             uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSuplier->getDrawPages () );
264cdf0e10cSrcweir             if( xDrawPages->getCount()>1 )
265cdf0e10cSrcweir             {
266cdf0e10cSrcweir                 uno::Any aPage = xDrawPages->getByIndex( 1 ) ;
267cdf0e10cSrcweir                 aPage >>= m_xHiddenDrawPage;
268cdf0e10cSrcweir             }
269cdf0e10cSrcweir 
270cdf0e10cSrcweir             if(!m_xHiddenDrawPage.is())
271cdf0e10cSrcweir             {
272cdf0e10cSrcweir                 if( xDrawPages->getCount()==0 )
273cdf0e10cSrcweir                     m_xMainDrawPage = xDrawPages->insertNewByIndex( 0 );
274cdf0e10cSrcweir                 m_xHiddenDrawPage = xDrawPages->insertNewByIndex( 1 );
275cdf0e10cSrcweir             }
276cdf0e10cSrcweir         }
277cdf0e10cSrcweir     }
278cdf0e10cSrcweir     return m_xHiddenDrawPage;
279cdf0e10cSrcweir }
clearMainDrawPage()280cdf0e10cSrcweir void DrawModelWrapper::clearMainDrawPage()
281cdf0e10cSrcweir {
282cdf0e10cSrcweir     //uno::Reference<drawing::XShapes> xChartRoot( m_xMainDrawPage, uno::UNO_QUERY );
283cdf0e10cSrcweir     uno::Reference<drawing::XShapes> xChartRoot( ShapeFactory::getChartRootShape( m_xMainDrawPage ) );
284cdf0e10cSrcweir     if( xChartRoot.is() )
285cdf0e10cSrcweir     {
286cdf0e10cSrcweir         sal_Int32 nSubCount = xChartRoot->getCount();
287cdf0e10cSrcweir         uno::Reference< drawing::XShape > xShape;
288cdf0e10cSrcweir         for( sal_Int32 nS = nSubCount; nS--; )
289cdf0e10cSrcweir         {
290cdf0e10cSrcweir             if( xChartRoot->getByIndex( nS ) >>= xShape )
291cdf0e10cSrcweir                 xChartRoot->remove( xShape );
292cdf0e10cSrcweir         }
293cdf0e10cSrcweir     }
294cdf0e10cSrcweir }
295cdf0e10cSrcweir 
getChartRootShape(const uno::Reference<drawing::XDrawPage> & xDrawPage)296cdf0e10cSrcweir uno::Reference< drawing::XShapes > DrawModelWrapper::getChartRootShape(
297cdf0e10cSrcweir     const uno::Reference< drawing::XDrawPage>& xDrawPage )
298cdf0e10cSrcweir {
299cdf0e10cSrcweir     return ShapeFactory::getChartRootShape( xDrawPage );
300cdf0e10cSrcweir }
301cdf0e10cSrcweir 
lockControllers()302cdf0e10cSrcweir void DrawModelWrapper::lockControllers()
303cdf0e10cSrcweir {
304cdf0e10cSrcweir     uno::Reference< frame::XModel > xDrawModel( this->getUnoModel() );
305cdf0e10cSrcweir     if( xDrawModel.is())
306cdf0e10cSrcweir 		xDrawModel->lockControllers();
307cdf0e10cSrcweir }
unlockControllers()308cdf0e10cSrcweir void DrawModelWrapper::unlockControllers()
309cdf0e10cSrcweir {
310cdf0e10cSrcweir     uno::Reference< frame::XModel > xDrawModel( this->getUnoModel() );
311cdf0e10cSrcweir     if( xDrawModel.is())
312cdf0e10cSrcweir 		xDrawModel->unlockControllers();
313cdf0e10cSrcweir }
314cdf0e10cSrcweir 
attachParentReferenceDevice(const uno::Reference<frame::XModel> & xChartModel)315cdf0e10cSrcweir void DrawModelWrapper::attachParentReferenceDevice( const uno::Reference< frame::XModel > & xChartModel )
316cdf0e10cSrcweir {
317cdf0e10cSrcweir     OutputDevice * pParentRefDev( lcl_GetParentRefDevice( xChartModel ));
318cdf0e10cSrcweir     if( pParentRefDev )
319cdf0e10cSrcweir     {
320cdf0e10cSrcweir         SetRefDevice( pParentRefDev );
321cdf0e10cSrcweir     }
322cdf0e10cSrcweir }
323cdf0e10cSrcweir 
getReferenceDevice() const324cdf0e10cSrcweir OutputDevice* DrawModelWrapper::getReferenceDevice() const
325cdf0e10cSrcweir {
326cdf0e10cSrcweir     return SdrModel::GetRefDevice();
327cdf0e10cSrcweir }
328cdf0e10cSrcweir 
GetItemPool()329cdf0e10cSrcweir SfxItemPool& DrawModelWrapper::GetItemPool()
330cdf0e10cSrcweir {
331cdf0e10cSrcweir     return this->SdrModel::GetItemPool();
332cdf0e10cSrcweir }
GetItemPool() const333cdf0e10cSrcweir const SfxItemPool& DrawModelWrapper::GetItemPool() const
334cdf0e10cSrcweir {
335cdf0e10cSrcweir     return this->SdrModel::GetItemPool();
336cdf0e10cSrcweir }
GetColorTableFromSdrModel() const337c7be74b1SArmin Le Grand XColorListSharedPtr  DrawModelWrapper::GetColorTableFromSdrModel() const
338cdf0e10cSrcweir {
339c7be74b1SArmin Le Grand     return this->SdrModel::GetColorTableFromSdrModel();
340cdf0e10cSrcweir }
GetDashListFromSdrModel() const341c7be74b1SArmin Le Grand XDashListSharedPtr DrawModelWrapper::GetDashListFromSdrModel() const
342cdf0e10cSrcweir {
343c7be74b1SArmin Le Grand     return this->SdrModel::GetDashListFromSdrModel();
344cdf0e10cSrcweir }
GetLineEndListFromSdrModel() const345c7be74b1SArmin Le Grand XLineEndListSharedPtr DrawModelWrapper::GetLineEndListFromSdrModel() const
346cdf0e10cSrcweir {
347c7be74b1SArmin Le Grand     return this->SdrModel::GetLineEndListFromSdrModel();
348cdf0e10cSrcweir }
GetGradientListFromSdrModel() const349c7be74b1SArmin Le Grand XGradientListSharedPtr DrawModelWrapper::GetGradientListFromSdrModel() const
350cdf0e10cSrcweir {
351c7be74b1SArmin Le Grand     return this->SdrModel::GetGradientListFromSdrModel();
352cdf0e10cSrcweir }
GetHatchListFromSdrModel() const353c7be74b1SArmin Le Grand XHatchListSharedPtr DrawModelWrapper::GetHatchListFromSdrModel() const
354cdf0e10cSrcweir {
355c7be74b1SArmin Le Grand     return this->SdrModel::GetHatchListFromSdrModel();
356cdf0e10cSrcweir }
GetBitmapListFromSdrModel() const357c7be74b1SArmin Le Grand XBitmapListSharedPtr DrawModelWrapper::GetBitmapListFromSdrModel() const
358cdf0e10cSrcweir {
359c7be74b1SArmin Le Grand     return this->SdrModel::GetBitmapListFromSdrModel();
360cdf0e10cSrcweir }
361cdf0e10cSrcweir 
getNamedSdrObject(const rtl::OUString & rName)362cdf0e10cSrcweir SdrObject* DrawModelWrapper::getNamedSdrObject( const rtl::OUString& rName )
363cdf0e10cSrcweir {
364*9ec58d04SHerbert Dürr     if( rName.isEmpty() )
365cdf0e10cSrcweir         return 0;
366cdf0e10cSrcweir     return getNamedSdrObject( rName, GetPage(0) );
367cdf0e10cSrcweir }
368cdf0e10cSrcweir 
getNamedSdrObject(const String & rObjectCID,SdrObjList * pSearchList)369cdf0e10cSrcweir SdrObject* DrawModelWrapper::getNamedSdrObject( const String& rObjectCID, SdrObjList* pSearchList )
370cdf0e10cSrcweir {
371cdf0e10cSrcweir     if(!pSearchList || rObjectCID.Len()==0)
372cdf0e10cSrcweir         return 0;
373cdf0e10cSrcweir     sal_uLong nCount = pSearchList->GetObjCount();
374cdf0e10cSrcweir     for( sal_uLong nN=0; nN<nCount; nN++  )
375cdf0e10cSrcweir     {
376cdf0e10cSrcweir         SdrObject* pObj = pSearchList->GetObj(nN);
377cdf0e10cSrcweir         if(!pObj)
378cdf0e10cSrcweir             continue;
379cdf0e10cSrcweir         if( ObjectIdentifier::areIdenticalObjects( rObjectCID, pObj->GetName() ) )
380cdf0e10cSrcweir             return pObj;
381cdf0e10cSrcweir         pObj = DrawModelWrapper::getNamedSdrObject( rObjectCID, pObj->GetSubList() );
382cdf0e10cSrcweir         if(pObj)
383cdf0e10cSrcweir             return pObj;
384cdf0e10cSrcweir     }
385cdf0e10cSrcweir     return 0;
386cdf0e10cSrcweir }
387cdf0e10cSrcweir 
removeShape(const uno::Reference<drawing::XShape> & xShape)388cdf0e10cSrcweir bool DrawModelWrapper::removeShape( const uno::Reference< drawing::XShape >& xShape )
389cdf0e10cSrcweir {
390cdf0e10cSrcweir     uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY );
391cdf0e10cSrcweir     if( xChild.is() )
392cdf0e10cSrcweir     {
393cdf0e10cSrcweir         uno::Reference<drawing::XShapes> xShapes( xChild->getParent(), uno::UNO_QUERY );
394cdf0e10cSrcweir         if( xShapes.is() )
395cdf0e10cSrcweir         {
396cdf0e10cSrcweir             xShapes->remove(xShape);
397cdf0e10cSrcweir             return true;
398cdf0e10cSrcweir         }
399cdf0e10cSrcweir     }
400cdf0e10cSrcweir     return false;
401cdf0e10cSrcweir }
402cdf0e10cSrcweir 
403cdf0e10cSrcweir //.............................................................................
404cdf0e10cSrcweir } //namespace chart
405cdf0e10cSrcweir //.............................................................................
406