1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_chart2.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "dlg_DataEditor.hxx"
32*cdf0e10cSrcweir #include "dlg_DataEditor.hrc"
33*cdf0e10cSrcweir #include "Strings.hrc"
34*cdf0e10cSrcweir #include "DataBrowser.hxx"
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include "ResId.hxx"
37*cdf0e10cSrcweir #include "Strings.hrc"
38*cdf0e10cSrcweir #include "SchSlotIds.hxx"
39*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
40*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
41*cdf0e10cSrcweir #include <vcl/taskpanelist.hxx>
42*cdf0e10cSrcweir #include <svtools/miscopt.hxx>
43*cdf0e10cSrcweir #include <unotools/pathoptions.hxx>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir // for SfxBoolItem
46*cdf0e10cSrcweir #include <svl/eitem.hxx>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #include <vcl/edit.hxx>
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir #include <com/sun/star/frame/XStorable.hpp>
51*cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp>
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir // for storing/reading the position and size of the dialog
54*cdf0e10cSrcweir // #include <svtools/viewoptions.hxx>
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir using namespace ::com::sun::star;
57*cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
58*cdf0e10cSrcweir using ::rtl::OUString;
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir namespace chart
62*cdf0e10cSrcweir {
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir DataEditor::DataEditor(
65*cdf0e10cSrcweir     Window* pParent,
66*cdf0e10cSrcweir     const Reference< chart2::XChartDocument > & xChartDoc,
67*cdf0e10cSrcweir     const Reference< uno::XComponentContext > & xContext ) :
68*cdf0e10cSrcweir         ModalDialog( pParent, SchResId( DLG_DIAGRAM_DATA )),
69*cdf0e10cSrcweir         m_bReadOnly( false ),
70*cdf0e10cSrcweir         m_apBrwData( new DataBrowser( this, SchResId( CTL_DATA ), true /* bLiveUpdate */)),
71*cdf0e10cSrcweir         m_aTbxData( this, SchResId( TBX_DATA )),
72*cdf0e10cSrcweir         m_xChartDoc( xChartDoc ),
73*cdf0e10cSrcweir         m_xContext( xContext ),
74*cdf0e10cSrcweir         m_aToolboxImageList( SchResId( IL_DIAGRAM_DATA )),
75*cdf0e10cSrcweir         m_aToolboxImageListHighContrast( SchResId( IL_HC_DIAGRAM_DATA ))
76*cdf0e10cSrcweir {
77*cdf0e10cSrcweir     FreeResource();
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir     // set min size to current size
80*cdf0e10cSrcweir     SetMinOutputSizePixel( GetOutputSizePixel() );
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir     ApplyImageList();
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir     m_aTbxData.SetSizePixel( m_aTbxData.CalcWindowSizePixel() );
85*cdf0e10cSrcweir     m_aTbxData.SetSelectHdl( LINK( this, DataEditor, ToolboxHdl ));
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     m_apBrwData->SetCursorMovedHdl( LINK( this, DataEditor,   BrowserCursorMovedHdl ));
88*cdf0e10cSrcweir     m_apBrwData->SetCellModifiedHdl( LINK( this, DataEditor,  CellModified ));
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir     UpdateData();
91*cdf0e10cSrcweir     GrabFocus();
92*cdf0e10cSrcweir     m_apBrwData->GrabFocus();
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir     bool bReadOnly = true;
95*cdf0e10cSrcweir     Reference< frame::XStorable > xStor( m_xChartDoc, uno::UNO_QUERY );
96*cdf0e10cSrcweir     if( xStor.is())
97*cdf0e10cSrcweir         bReadOnly = xStor->isReadonly();
98*cdf0e10cSrcweir     SetReadOnly( bReadOnly );
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir     // #101228# change buttons to flat-look if set so by user
101*cdf0e10cSrcweir     SvtMiscOptions aMiscOptions;
102*cdf0e10cSrcweir     const sal_Int16 nStyle( aMiscOptions.GetToolboxStyle() );
103*cdf0e10cSrcweir     // react on changes
104*cdf0e10cSrcweir     aMiscOptions.AddListenerLink( LINK( this, DataEditor, MiscHdl ) );
105*cdf0e10cSrcweir     m_aTbxData.SetOutStyle( nStyle );
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     // set good window width
108*cdf0e10cSrcweir     Size aWinSize( GetOutputSizePixel());
109*cdf0e10cSrcweir     Size aWinSizeWithBorder( GetSizePixel());
110*cdf0e10cSrcweir     Point aWinPos( OutputToAbsoluteScreenPixel( GetPosPixel()));
111*cdf0e10cSrcweir     sal_Int32 nMinWidth = aWinSize.getWidth();
112*cdf0e10cSrcweir     sal_Int32 nMaxWidth = GetDesktopRectPixel().getWidth() -
113*cdf0e10cSrcweir         (aWinSizeWithBorder.getWidth() - aWinSize.getWidth() + aWinPos.getX()) - 10; // leave some space
114*cdf0e10cSrcweir     sal_Int32 nBrowserWidth = m_apBrwData->GetTotalWidth() + 12 + 16; // plus padding + 16?
115*cdf0e10cSrcweir     sal_Int32 nWindowWidth = ::std::max( nMinWidth, nBrowserWidth );
116*cdf0e10cSrcweir     nWindowWidth = ::std::min( nMaxWidth, nBrowserWidth );
117*cdf0e10cSrcweir     aWinSize.setWidth( nWindowWidth );
118*cdf0e10cSrcweir     SetOutputSizePixel( aWinSize );
119*cdf0e10cSrcweir     AdaptBrowseBoxSize();
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir //     ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     // allow travelling to toolbar with F6
124*cdf0e10cSrcweir     notifySystemWindow( this, & m_aTbxData, ::comphelper::mem_fun( & TaskPaneList::AddWindow ));
125*cdf0e10cSrcweir }
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir DataEditor::~DataEditor()
128*cdf0e10cSrcweir {
129*cdf0e10cSrcweir     notifySystemWindow( this, & m_aTbxData, ::comphelper::mem_fun( & TaskPaneList::RemoveWindow ));
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir     SvtMiscOptions aMiscOptions;
132*cdf0e10cSrcweir     aMiscOptions.RemoveListenerLink( LINK( this, DataEditor, MiscHdl ) );
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir     OSL_TRACE( "DataEditor: DTOR" );
135*cdf0e10cSrcweir }
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir // react on click (or keypress) on toolbar icon
138*cdf0e10cSrcweir IMPL_LINK( DataEditor, ToolboxHdl, void *, EMPTYARG )
139*cdf0e10cSrcweir {
140*cdf0e10cSrcweir     switch( m_aTbxData.GetCurItemId() )
141*cdf0e10cSrcweir     {
142*cdf0e10cSrcweir         case TBI_DATA_INSERT_ROW:
143*cdf0e10cSrcweir             m_apBrwData->InsertRow();
144*cdf0e10cSrcweir             break;
145*cdf0e10cSrcweir         case TBI_DATA_INSERT_COL:
146*cdf0e10cSrcweir             m_apBrwData->InsertColumn();
147*cdf0e10cSrcweir             break;
148*cdf0e10cSrcweir         case TBI_DATA_INSERT_TEXT_COL:
149*cdf0e10cSrcweir             m_apBrwData->InsertTextColumn();
150*cdf0e10cSrcweir             break;
151*cdf0e10cSrcweir         case TBI_DATA_DELETE_ROW:
152*cdf0e10cSrcweir             m_apBrwData->RemoveRow();
153*cdf0e10cSrcweir             break;
154*cdf0e10cSrcweir         case TBI_DATA_DELETE_COL:
155*cdf0e10cSrcweir             m_apBrwData->RemoveColumn();
156*cdf0e10cSrcweir             break;
157*cdf0e10cSrcweir         case TBI_DATA_SWAP_COL :
158*cdf0e10cSrcweir             m_apBrwData->SwapColumn ();
159*cdf0e10cSrcweir             break;
160*cdf0e10cSrcweir         case TBI_DATA_SWAP_ROW :
161*cdf0e10cSrcweir             m_apBrwData->SwapRow ();
162*cdf0e10cSrcweir             break;
163*cdf0e10cSrcweir     }
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir     return 0;
166*cdf0e10cSrcweir }
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir // refresh toolbar icons according to currently selected cell in brwose box
169*cdf0e10cSrcweir IMPL_LINK( DataEditor, BrowserCursorMovedHdl, void *, EMPTYARG )
170*cdf0e10cSrcweir {
171*cdf0e10cSrcweir     if( m_bReadOnly )
172*cdf0e10cSrcweir         return 0;
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir     bool bIsDataValid = m_apBrwData->IsEnableItem();
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir     m_aTbxData.EnableItem( TBI_DATA_INSERT_ROW, bIsDataValid && m_apBrwData->MayInsertRow() );
177*cdf0e10cSrcweir     m_aTbxData.EnableItem( TBI_DATA_INSERT_COL, bIsDataValid && m_apBrwData->MayInsertColumn() );
178*cdf0e10cSrcweir     m_aTbxData.EnableItem( TBI_DATA_INSERT_TEXT_COL, bIsDataValid && m_apBrwData->MayInsertColumn() );
179*cdf0e10cSrcweir     m_aTbxData.EnableItem( TBI_DATA_DELETE_ROW, m_apBrwData->MayDeleteRow() );
180*cdf0e10cSrcweir     m_aTbxData.EnableItem( TBI_DATA_DELETE_COL, m_apBrwData->MayDeleteColumn() );
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir     m_aTbxData.EnableItem( TBI_DATA_SWAP_COL,   bIsDataValid && m_apBrwData->MaySwapColumns() );
183*cdf0e10cSrcweir     m_aTbxData.EnableItem( TBI_DATA_SWAP_ROW,   bIsDataValid && m_apBrwData->MaySwapRows() );
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir     return 0;
186*cdf0e10cSrcweir }
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir // disable all modifying controls
189*cdf0e10cSrcweir void DataEditor::SetReadOnly( bool bReadOnly )
190*cdf0e10cSrcweir {
191*cdf0e10cSrcweir     m_bReadOnly = bReadOnly;
192*cdf0e10cSrcweir     if( m_bReadOnly )
193*cdf0e10cSrcweir     {
194*cdf0e10cSrcweir         m_aTbxData.EnableItem( TBI_DATA_INSERT_ROW, sal_False );
195*cdf0e10cSrcweir         m_aTbxData.EnableItem( TBI_DATA_INSERT_COL, sal_False );
196*cdf0e10cSrcweir         m_aTbxData.EnableItem( TBI_DATA_INSERT_TEXT_COL, sal_False );
197*cdf0e10cSrcweir         m_aTbxData.EnableItem( TBI_DATA_DELETE_ROW, sal_False );
198*cdf0e10cSrcweir         m_aTbxData.EnableItem( TBI_DATA_DELETE_COL, sal_False );
199*cdf0e10cSrcweir         m_aTbxData.EnableItem( TBI_DATA_SWAP_COL, sal_False );
200*cdf0e10cSrcweir         m_aTbxData.EnableItem( TBI_DATA_SWAP_ROW, sal_False );
201*cdf0e10cSrcweir     }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir     m_apBrwData->SetReadOnly( m_bReadOnly );
204*cdf0e10cSrcweir }
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir IMPL_LINK( DataEditor, MiscHdl, void*, EMPTYARG )
207*cdf0e10cSrcweir {
208*cdf0e10cSrcweir     SvtMiscOptions aMiscOptions;
209*cdf0e10cSrcweir     sal_Int16 nStyle( aMiscOptions.GetToolboxStyle() );
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir     m_aTbxData.SetOutStyle( nStyle );
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir     return 0L;
214*cdf0e10cSrcweir }
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir IMPL_LINK( DataEditor, CellModified, void*, EMPTYARG )
217*cdf0e10cSrcweir {
218*cdf0e10cSrcweir     return 0;
219*cdf0e10cSrcweir }
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir // IMPL_LINK( DataEditor, BrowserColumnResized, void*, EMPTYARG )
222*cdf0e10cSrcweir // {
223*cdf0e10cSrcweir //     ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
224*cdf0e10cSrcweir //     return 0;
225*cdf0e10cSrcweir // }
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir // IMPL_LINK( DataEditor, BrowserContentScrolled, void*, EMPTYARG )
228*cdf0e10cSrcweir // {
229*cdf0e10cSrcweir //     ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
230*cdf0e10cSrcweir //     return 0;
231*cdf0e10cSrcweir // }
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir void DataEditor::UpdateData()
234*cdf0e10cSrcweir {
235*cdf0e10cSrcweir     m_apBrwData->SetDataFromModel( m_xChartDoc, m_xContext );
236*cdf0e10cSrcweir }
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir // react on the change of the underlying document by displaying the new data
239*cdf0e10cSrcweir // void DataEditor::SFX_NOTIFY(
240*cdf0e10cSrcweir //     SfxBroadcaster& rBC,
241*cdf0e10cSrcweir //     const TypeId& rBCType,
242*cdf0e10cSrcweir //     const SfxHint& rHint,
243*cdf0e10cSrcweir //     const TypeId& rHintType )
244*cdf0e10cSrcweir // {
245*cdf0e10cSrcweir //     if( rHint.Type() == TYPE(SfxSimpleHint) )
246*cdf0e10cSrcweir //     {
247*cdf0e10cSrcweir //         // note: if dynamic_cast works this should be changed
248*cdf0e10cSrcweir //         switch( static_cast< const SfxSimpleHint & >( rHint ).GetId())
249*cdf0e10cSrcweir //         {
250*cdf0e10cSrcweir //             case SFX_HINT_DOCCHANGED:
251*cdf0e10cSrcweir //                 UpdateData();
252*cdf0e10cSrcweir //                 break;
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir //             case SFX_HINT_DYING:
255*cdf0e10cSrcweir //                 break;
256*cdf0e10cSrcweir //         }
257*cdf0e10cSrcweir //     }
258*cdf0e10cSrcweir // }
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir // {
261*cdf0e10cSrcweir //     sal_Bool bRet = sal_True;
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir //     // confirm changes currently made and not saved
264*cdf0e10cSrcweir //     m_apBrwData->EndEditing();
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir //     if( m_apBrwData->IsDirty() )
267*cdf0e10cSrcweir //     {
268*cdf0e10cSrcweir //         QueryBox aSafetyQuery( this, WB_YES_NO_CANCEL | WB_DEF_YES,
269*cdf0e10cSrcweir //                                String( SchResId( STR_DIAGRAM_DATA_SAFETY_QUERY )));
270*cdf0e10cSrcweir //         long nQueryResult = aSafetyQuery.Execute();
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir //         bRet = ( nQueryResult != RET_CANCEL );
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir //         if( nQueryResult == RET_YES )
275*cdf0e10cSrcweir //         {
276*cdf0e10cSrcweir //             // save changes
277*cdf0e10cSrcweir //             ApplyChangesToModel();
278*cdf0e10cSrcweir //         }
279*cdf0e10cSrcweir //     }
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir //     if( bRet )
282*cdf0e10cSrcweir //     {
283*cdf0e10cSrcweir //         // close child window
284*cdf0e10cSrcweir //         SfxBoolItem aItem( SID_DIAGRAM_DATA, sal_False );
285*cdf0e10cSrcweir //         if( m_pBindings )
286*cdf0e10cSrcweir //         {
287*cdf0e10cSrcweir //             SfxDispatcher* pDisp = m_pBindings->GetDispatcher();
288*cdf0e10cSrcweir //             if( pDisp )
289*cdf0e10cSrcweir //                 pDisp->Execute( SID_DIAGRAM_DATA, SFX_CALLMODE_ASYNCHRON, &aItem, 0L);
290*cdf0e10cSrcweir //             else
291*cdf0e10cSrcweir //                 DBG_ERROR( "Couldn't dispatch command" );
292*cdf0e10cSrcweir //         }
293*cdf0e10cSrcweir //     }
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir //     return ( bRet? SfxFloatingWindow::Close(): sal_False );
296*cdf0e10cSrcweir // }
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir void DataEditor::AdaptBrowseBoxSize()
299*cdf0e10cSrcweir {
300*cdf0e10cSrcweir     Size aSize( PixelToLogic( GetResizeOutputSizePixel(), MAP_APPFONT ));
301*cdf0e10cSrcweir     Size aDataSize;
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir     aDataSize.setWidth( aSize.getWidth() - 12 );
304*cdf0e10cSrcweir     aDataSize.setHeight( aSize.getHeight() - 31 -24 );
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir     m_apBrwData->SetSizePixel( LogicToPixel( aDataSize, MAP_APPFONT ));
307*cdf0e10cSrcweir }
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir void DataEditor::Resize()
310*cdf0e10cSrcweir {
311*cdf0e10cSrcweir     Dialog::Resize();
312*cdf0e10cSrcweir     AdaptBrowseBoxSize();
313*cdf0e10cSrcweir //     ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
314*cdf0e10cSrcweir }
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir sal_Bool DataEditor::Close()
317*cdf0e10cSrcweir {
318*cdf0e10cSrcweir     if( ApplyChangesToModel() )
319*cdf0e10cSrcweir         return ModalDialog::Close();
320*cdf0e10cSrcweir     else
321*cdf0e10cSrcweir         return sal_True;
322*cdf0e10cSrcweir }
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir bool DataEditor::ApplyChangesToModel()
325*cdf0e10cSrcweir {
326*cdf0e10cSrcweir     return m_apBrwData->EndEditing();
327*cdf0e10cSrcweir }
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir // sets the correct toolbar icons depending on the current mode (e.g. high contrast)
330*cdf0e10cSrcweir void DataEditor::ApplyImageList()
331*cdf0e10cSrcweir {
332*cdf0e10cSrcweir     bool bIsHighContrast = ( true && GetSettings().GetStyleSettings().GetHighContrastMode() );
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir     ImageList& rImgLst = bIsHighContrast
335*cdf0e10cSrcweir         ? m_aToolboxImageListHighContrast
336*cdf0e10cSrcweir         : m_aToolboxImageList;
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir     m_aTbxData.SetImageList( rImgLst );
339*cdf0e10cSrcweir }
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir // add/remove a window (the toolbar) to/from the global list, so that F6
342*cdf0e10cSrcweir // travels/no longer travels over this window.  _rMemFunc may be
343*cdf0e10cSrcweir // TaskPaneList::AddWindow or TaskPaneList::RemoveWindow
344*cdf0e10cSrcweir void DataEditor::notifySystemWindow(
345*cdf0e10cSrcweir     Window* pWindow, Window* pToRegister,
346*cdf0e10cSrcweir     ::comphelper::mem_fun1_t< TaskPaneList, Window* > rMemFunc )
347*cdf0e10cSrcweir {
348*cdf0e10cSrcweir     OSL_ENSURE( pWindow, "Window must not be null!" );
349*cdf0e10cSrcweir     if( !pWindow )
350*cdf0e10cSrcweir         return;
351*cdf0e10cSrcweir     Window* pParent = pWindow->GetParent();
352*cdf0e10cSrcweir     while( pParent && ! pParent->IsSystemWindow() )
353*cdf0e10cSrcweir     {
354*cdf0e10cSrcweir         pParent = pParent->GetParent();
355*cdf0e10cSrcweir     }
356*cdf0e10cSrcweir     if ( pParent && pParent->IsSystemWindow())
357*cdf0e10cSrcweir     {
358*cdf0e10cSrcweir         SystemWindow* pSystemWindow = static_cast< SystemWindow* >( pParent );
359*cdf0e10cSrcweir         rMemFunc( pSystemWindow->GetTaskPaneList(),( pToRegister ));
360*cdf0e10cSrcweir     }
361*cdf0e10cSrcweir }
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir } // namespace chart
364