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 #include "precompiled_reportdesign.hxx"
28*cdf0e10cSrcweir 
29*cdf0e10cSrcweir #include "Navigator.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "uistrings.hrc"
32*cdf0e10cSrcweir #include "ReportController.hxx"
33*cdf0e10cSrcweir #include "UITools.hxx"
34*cdf0e10cSrcweir #include "RptUndo.hxx"
35*cdf0e10cSrcweir #include "reportformula.hxx"
36*cdf0e10cSrcweir #include <com/sun/star/container/XContainerListener.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/report/XReportDefinition.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/report/XFixedText.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/report/XFixedLine.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/report/XFormattedField.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/report/XImageControl.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/report/XShape.hpp>
43*cdf0e10cSrcweir #include <svx/globlmn.hrc>
44*cdf0e10cSrcweir #include <svx/svxids.hrc>
45*cdf0e10cSrcweir #include "helpids.hrc"
46*cdf0e10cSrcweir #include "RptResId.hrc"
47*cdf0e10cSrcweir #include "rptui_slotid.hrc"
48*cdf0e10cSrcweir #include <tools/debug.hxx>
49*cdf0e10cSrcweir #include <comphelper/propmultiplex.hxx>
50*cdf0e10cSrcweir #include <comphelper/containermultiplexer.hxx>
51*cdf0e10cSrcweir #include <comphelper/types.hxx>
52*cdf0e10cSrcweir #include "cppuhelper/basemutex.hxx"
53*cdf0e10cSrcweir #include "comphelper/SelectionMultiplex.hxx"
54*cdf0e10cSrcweir #include <svtools/svtreebx.hxx>
55*cdf0e10cSrcweir #include <svl/solar.hrc>
56*cdf0e10cSrcweir #include "ReportVisitor.hxx"
57*cdf0e10cSrcweir #include "ModuleHelper.hxx"
58*cdf0e10cSrcweir #include <rtl/ref.hxx>
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir #include <boost/bind.hpp>
61*cdf0e10cSrcweir #include <memory>
62*cdf0e10cSrcweir #include <algorithm>
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir #define RID_SVXIMG_COLLAPSEDNODE			(RID_FORMS_START + 2)
65*cdf0e10cSrcweir #define RID_SVXIMG_EXPANDEDNODE				(RID_FORMS_START + 3)
66*cdf0e10cSrcweir #define DROP_ACTION_TIMER_INITIAL_TICKS     10
67*cdf0e10cSrcweir #define DROP_ACTION_TIMER_SCROLL_TICKS      3
68*cdf0e10cSrcweir #define DROP_ACTION_TIMER_TICK_BASE         10
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir namespace rptui
71*cdf0e10cSrcweir {
72*cdf0e10cSrcweir using namespace ::com::sun::star;
73*cdf0e10cSrcweir using namespace utl;
74*cdf0e10cSrcweir using namespace ::comphelper;
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir sal_uInt16 lcl_getImageId(const uno::Reference< report::XReportComponent>& _xElement)
77*cdf0e10cSrcweir {
78*cdf0e10cSrcweir     sal_uInt16 nId = 0;
79*cdf0e10cSrcweir     uno::Reference< report::XFixedLine> xFixedLine(_xElement,uno::UNO_QUERY);
80*cdf0e10cSrcweir     if ( uno::Reference< report::XFixedText>(_xElement,uno::UNO_QUERY).is() )
81*cdf0e10cSrcweir         nId = SID_FM_FIXEDTEXT;
82*cdf0e10cSrcweir     else if ( xFixedLine.is() )
83*cdf0e10cSrcweir         nId = xFixedLine->getOrientation() ? SID_INSERT_VFIXEDLINE : SID_INSERT_HFIXEDLINE;
84*cdf0e10cSrcweir     else if ( uno::Reference< report::XFormattedField>(_xElement,uno::UNO_QUERY).is() )
85*cdf0e10cSrcweir         nId = SID_FM_EDIT;
86*cdf0e10cSrcweir     else if ( uno::Reference< report::XImageControl>(_xElement,uno::UNO_QUERY).is() )
87*cdf0e10cSrcweir         nId = SID_FM_IMAGECONTROL;
88*cdf0e10cSrcweir     else if ( uno::Reference< report::XShape>(_xElement,uno::UNO_QUERY).is() )
89*cdf0e10cSrcweir         nId = SID_DRAWTBX_CS_BASIC;
90*cdf0e10cSrcweir     return nId;
91*cdf0e10cSrcweir }
92*cdf0e10cSrcweir // -----------------------------------------------------------------------------
93*cdf0e10cSrcweir ::rtl::OUString lcl_getName(const uno::Reference< beans::XPropertySet>& _xElement)
94*cdf0e10cSrcweir {
95*cdf0e10cSrcweir     OSL_ENSURE(_xElement.is(),"Found report element which is NULL!");
96*cdf0e10cSrcweir     ::rtl::OUString sTempName;
97*cdf0e10cSrcweir     _xElement->getPropertyValue(PROPERTY_NAME) >>= sTempName;
98*cdf0e10cSrcweir     ::rtl::OUStringBuffer sName = sTempName;
99*cdf0e10cSrcweir     uno::Reference< report::XFixedText> xFixedText(_xElement,uno::UNO_QUERY);
100*cdf0e10cSrcweir     uno::Reference< report::XReportControlModel> xReportModel(_xElement,uno::UNO_QUERY);
101*cdf0e10cSrcweir     if ( xFixedText.is() )
102*cdf0e10cSrcweir     {
103*cdf0e10cSrcweir         sName.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" : ")));
104*cdf0e10cSrcweir         sName.append(xFixedText->getLabel());
105*cdf0e10cSrcweir     }
106*cdf0e10cSrcweir     else if ( xReportModel.is() && _xElement->getPropertySetInfo()->hasPropertyByName(PROPERTY_DATAFIELD) )
107*cdf0e10cSrcweir     {
108*cdf0e10cSrcweir         ReportFormula aFormula( xReportModel->getDataField() );
109*cdf0e10cSrcweir         if ( aFormula.isValid() )
110*cdf0e10cSrcweir         {
111*cdf0e10cSrcweir             sName.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" : ")));
112*cdf0e10cSrcweir             sName.append( aFormula.getUndecoratedContent() );
113*cdf0e10cSrcweir         }
114*cdf0e10cSrcweir     }
115*cdf0e10cSrcweir     return sName.makeStringAndClear();
116*cdf0e10cSrcweir }
117*cdf0e10cSrcweir // -----------------------------------------------------------------------------
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir class NavigatorTree :   public ::cppu::BaseMutex
120*cdf0e10cSrcweir                     ,   public SvTreeListBox
121*cdf0e10cSrcweir                     ,   public reportdesign::ITraverseReport
122*cdf0e10cSrcweir                     ,   public comphelper::OSelectionChangeListener
123*cdf0e10cSrcweir                     ,	public ::comphelper::OPropertyChangeListener
124*cdf0e10cSrcweir {
125*cdf0e10cSrcweir     class UserData;
126*cdf0e10cSrcweir     friend class UserData;
127*cdf0e10cSrcweir     class UserData : public ::cppu::BaseMutex
128*cdf0e10cSrcweir                     ,public ::comphelper::OPropertyChangeListener
129*cdf0e10cSrcweir                     ,public ::comphelper::OContainerListener
130*cdf0e10cSrcweir     {
131*cdf0e10cSrcweir         uno::Reference< uno::XInterface >                           m_xContent;
132*cdf0e10cSrcweir         ::rtl::Reference< comphelper::OPropertyChangeMultiplexer>   m_pListener;
133*cdf0e10cSrcweir         ::rtl::Reference< comphelper::OContainerListenerAdapter>    m_pContainerListener;
134*cdf0e10cSrcweir         NavigatorTree*                                              m_pTree;
135*cdf0e10cSrcweir     public:
136*cdf0e10cSrcweir         UserData(NavigatorTree* _pTree,const uno::Reference<uno::XInterface>& _xContent);
137*cdf0e10cSrcweir         ~UserData();
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir         inline uno::Reference< uno::XInterface > getContent() const { return m_xContent; }
140*cdf0e10cSrcweir         inline void setContent(const uno::Reference< uno::XInterface >& _xContent) { m_xContent = _xContent; }
141*cdf0e10cSrcweir     protected:
142*cdf0e10cSrcweir         // OPropertyChangeListener
143*cdf0e10cSrcweir 	    virtual void _propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException);
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir         // OContainerListener
146*cdf0e10cSrcweir         virtual void _elementInserted( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException);
147*cdf0e10cSrcweir 	    virtual void _elementRemoved( const container::ContainerEvent& _Event ) throw(uno::RuntimeException);
148*cdf0e10cSrcweir 	    virtual void _elementReplaced( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException);
149*cdf0e10cSrcweir 	    virtual void _disposing(const lang::EventObject& _rSource) throw( uno::RuntimeException);
150*cdf0e10cSrcweir     };
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir     enum DROP_ACTION        { DA_SCROLLUP, DA_SCROLLDOWN, DA_EXPANDNODE };
153*cdf0e10cSrcweir     AutoTimer                                                                   m_aDropActionTimer;
154*cdf0e10cSrcweir     Timer                                                                       m_aSynchronizeTimer;
155*cdf0e10cSrcweir     ImageList                                                                   m_aNavigatorImages;
156*cdf0e10cSrcweir 	ImageList                                                                   m_aNavigatorImagesHC;
157*cdf0e10cSrcweir     Point                                                                       m_aTimerTriggered;      // die Position, an der der DropTimer angeschaltet wurde
158*cdf0e10cSrcweir     DROP_ACTION                                                                 m_aDropActionType;
159*cdf0e10cSrcweir     OReportController&                                                          m_rController;
160*cdf0e10cSrcweir     SvLBoxEntry*                                                                m_pMasterReport;
161*cdf0e10cSrcweir     SvLBoxEntry*				                                                m_pDragedEntry;
162*cdf0e10cSrcweir     ::rtl::Reference< comphelper::OPropertyChangeMultiplexer>	                m_pReportListener;
163*cdf0e10cSrcweir     ::rtl::Reference< comphelper::OSelectionChangeMultiplexer>                  m_pSelectionListener;
164*cdf0e10cSrcweir     unsigned short                                                              m_nTimerCounter;
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir     SvLBoxEntry* insertEntry(const ::rtl::OUString& _sName,SvLBoxEntry* _pParent,sal_uInt16 _nImageId,sal_uLong _nPosition,UserData* _pData);
167*cdf0e10cSrcweir     void traverseSection(const uno::Reference< report::XSection>& _xSection,SvLBoxEntry* _pParent,sal_uInt16 _nImageId,sal_uLong _nPosition = LIST_APPEND);
168*cdf0e10cSrcweir     void traverseFunctions(const uno::Reference< report::XFunctions>& _xFunctions,SvLBoxEntry* _pParent);
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir     NavigatorTree(const NavigatorTree&);
171*cdf0e10cSrcweir     void operator =(const NavigatorTree&);
172*cdf0e10cSrcweir protected:
173*cdf0e10cSrcweir 	virtual void	    Command( const CommandEvent& rEvt );
174*cdf0e10cSrcweir     // DragSourceHelper overridables
175*cdf0e10cSrcweir 	virtual void		StartDrag( sal_Int8 nAction, const Point& rPosPixel );
176*cdf0e10cSrcweir 	// DropTargetHelper overridables
177*cdf0e10cSrcweir 	virtual sal_Int8	AcceptDrop( const AcceptDropEvent& _rEvt );
178*cdf0e10cSrcweir 	virtual sal_Int8	ExecuteDrop( const ExecuteDropEvent& _rEvt );
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir     // OSelectionChangeListener
181*cdf0e10cSrcweir 	virtual void _disposing(const lang::EventObject& _rSource) throw( uno::RuntimeException);
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir     // OPropertyChangeListener
184*cdf0e10cSrcweir 	virtual void _propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException);
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir     // OContainerListener Helper
187*cdf0e10cSrcweir     void _elementInserted( const container::ContainerEvent& _rEvent );
188*cdf0e10cSrcweir 	void _elementRemoved( const container::ContainerEvent& _Event );
189*cdf0e10cSrcweir 	void _elementReplaced( const container::ContainerEvent& _rEvent );
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir public:
192*cdf0e10cSrcweir     NavigatorTree(Window* pParent,OReportController& _rController );
193*cdf0e10cSrcweir 	virtual ~NavigatorTree();
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir     DECL_LINK(OnEntrySelDesel, NavigatorTree*);
196*cdf0e10cSrcweir     DECL_LINK( OnDropActionTimer, void* );
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir     virtual void _selectionChanged( const lang::EventObject& aEvent ) throw (uno::RuntimeException);
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir     // ITraverseReport
201*cdf0e10cSrcweir     virtual void traverseReport(const uno::Reference< report::XReportDefinition>& _xReport);
202*cdf0e10cSrcweir     virtual void traverseReportFunctions(const uno::Reference< report::XFunctions>& _xFunctions);
203*cdf0e10cSrcweir     virtual void traverseReportHeader(const uno::Reference< report::XSection>& _xSection);
204*cdf0e10cSrcweir     virtual void traverseReportFooter(const uno::Reference< report::XSection>& _xSection);
205*cdf0e10cSrcweir     virtual void traversePageHeader(const uno::Reference< report::XSection>& _xSection);
206*cdf0e10cSrcweir     virtual void traversePageFooter(const uno::Reference< report::XSection>& _xSection);
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir     virtual void traverseGroups(const uno::Reference< report::XGroups>& _xGroups);
209*cdf0e10cSrcweir     virtual void traverseGroup(const uno::Reference< report::XGroup>& _xGroup);
210*cdf0e10cSrcweir     virtual void traverseGroupFunctions(const uno::Reference< report::XFunctions>& _xFunctions);
211*cdf0e10cSrcweir     virtual void traverseGroupHeader(const uno::Reference< report::XSection>& _xSection);
212*cdf0e10cSrcweir     virtual void traverseGroupFooter(const uno::Reference< report::XSection>& _xSection);
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir     virtual void traverseDetail(const uno::Reference< report::XSection>& _xSection);
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir     SvLBoxEntry* find(const uno::Reference< uno::XInterface >& _xContent);
217*cdf0e10cSrcweir     void removeEntry(SvLBoxEntry* _pEntry,bool _bRemove = true);
218*cdf0e10cSrcweir private:
219*cdf0e10cSrcweir     using SvTreeListBox::ExecuteDrop;
220*cdf0e10cSrcweir };
221*cdf0e10cSrcweir DBG_NAME(rpt_NavigatorTree)
222*cdf0e10cSrcweir // -----------------------------------------------------------------------------
223*cdf0e10cSrcweir NavigatorTree::NavigatorTree( Window* pParent,OReportController& _rController )
224*cdf0e10cSrcweir         :SvTreeListBox( pParent, WB_TABSTOP| WB_HASBUTTONS|WB_HASLINES|WB_BORDER|WB_HSCROLL|WB_HASBUTTONSATROOT )
225*cdf0e10cSrcweir         ,comphelper::OSelectionChangeListener(m_aMutex)
226*cdf0e10cSrcweir         ,OPropertyChangeListener(m_aMutex)
227*cdf0e10cSrcweir         ,m_aTimerTriggered(-1,-1)
228*cdf0e10cSrcweir         ,m_aDropActionType( DA_SCROLLUP )
229*cdf0e10cSrcweir         ,m_rController(_rController)
230*cdf0e10cSrcweir         ,m_pMasterReport(NULL)
231*cdf0e10cSrcweir         ,m_pDragedEntry(NULL)
232*cdf0e10cSrcweir         ,m_nTimerCounter( DROP_ACTION_TIMER_INITIAL_TICKS )
233*cdf0e10cSrcweir {
234*cdf0e10cSrcweir     DBG_CTOR(rpt_NavigatorTree,NULL);
235*cdf0e10cSrcweir     m_pReportListener = new OPropertyChangeMultiplexer(this,m_rController.getReportDefinition().get());
236*cdf0e10cSrcweir     m_pReportListener->addProperty(PROPERTY_PAGEHEADERON);
237*cdf0e10cSrcweir     m_pReportListener->addProperty(PROPERTY_PAGEFOOTERON);
238*cdf0e10cSrcweir     m_pReportListener->addProperty(PROPERTY_REPORTHEADERON);
239*cdf0e10cSrcweir     m_pReportListener->addProperty(PROPERTY_REPORTFOOTERON);
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir     m_pSelectionListener = new OSelectionChangeMultiplexer(this,&m_rController);
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir     SetHelpId( HID_REPORT_NAVIGATOR_TREE );
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir     m_aNavigatorImages = ImageList( ModuleRes( RID_SVXIMGLIST_RPTEXPL ) );
246*cdf0e10cSrcweir 	m_aNavigatorImagesHC = ImageList( ModuleRes( RID_SVXIMGLIST_RPTEXPL_HC ) );
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir 	SetNodeBitmaps(
249*cdf0e10cSrcweir 		m_aNavigatorImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ),
250*cdf0e10cSrcweir 		m_aNavigatorImages.GetImage( RID_SVXIMG_EXPANDEDNODE ),
251*cdf0e10cSrcweir 		BMP_COLOR_NORMAL
252*cdf0e10cSrcweir 	);
253*cdf0e10cSrcweir 	SetNodeBitmaps(
254*cdf0e10cSrcweir 		m_aNavigatorImagesHC.GetImage( RID_SVXIMG_COLLAPSEDNODE ),
255*cdf0e10cSrcweir 		m_aNavigatorImagesHC.GetImage( RID_SVXIMG_EXPANDEDNODE ),
256*cdf0e10cSrcweir 		BMP_COLOR_HIGHCONTRAST
257*cdf0e10cSrcweir 	);
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir 	SetDragDropMode(0xFFFF);
260*cdf0e10cSrcweir 	EnableInplaceEditing( sal_False );
261*cdf0e10cSrcweir 	SetSelectionMode(MULTIPLE_SELECTION);
262*cdf0e10cSrcweir     Clear();
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir     m_aDropActionTimer.SetTimeoutHdl(LINK(this, NavigatorTree, OnDropActionTimer));
265*cdf0e10cSrcweir     SetSelectHdl(LINK(this, NavigatorTree, OnEntrySelDesel));
266*cdf0e10cSrcweir 	SetDeselectHdl(LINK(this, NavigatorTree, OnEntrySelDesel));
267*cdf0e10cSrcweir }
268*cdf0e10cSrcweir // -----------------------------------------------------------------------------
269*cdf0e10cSrcweir NavigatorTree::~NavigatorTree()
270*cdf0e10cSrcweir {
271*cdf0e10cSrcweir     SvLBoxEntry* pCurrent = First();
272*cdf0e10cSrcweir     while ( pCurrent )
273*cdf0e10cSrcweir     {
274*cdf0e10cSrcweir         delete static_cast<UserData*>(pCurrent->GetUserData());
275*cdf0e10cSrcweir         pCurrent = Next(pCurrent);
276*cdf0e10cSrcweir     }
277*cdf0e10cSrcweir     m_pReportListener->dispose();
278*cdf0e10cSrcweir     m_pSelectionListener->dispose();
279*cdf0e10cSrcweir     DBG_DTOR(rpt_NavigatorTree,NULL);
280*cdf0e10cSrcweir }
281*cdf0e10cSrcweir //------------------------------------------------------------------------------
282*cdf0e10cSrcweir void NavigatorTree::Command( const CommandEvent& rEvt )
283*cdf0e10cSrcweir {
284*cdf0e10cSrcweir 	sal_Bool bHandled = sal_False;
285*cdf0e10cSrcweir 	switch( rEvt.GetCommand() )
286*cdf0e10cSrcweir 	{
287*cdf0e10cSrcweir 		case COMMAND_CONTEXTMENU:
288*cdf0e10cSrcweir 		{
289*cdf0e10cSrcweir 			// die Stelle, an der geklickt wurde
290*cdf0e10cSrcweir             SvLBoxEntry* ptClickedOn = NULL;
291*cdf0e10cSrcweir 			::Point aWhere;
292*cdf0e10cSrcweir 			if (rEvt.IsMouseEvent())
293*cdf0e10cSrcweir 			{
294*cdf0e10cSrcweir 				aWhere = rEvt.GetMousePosPixel();
295*cdf0e10cSrcweir 				ptClickedOn = GetEntry(aWhere);
296*cdf0e10cSrcweir 				if (ptClickedOn == NULL)
297*cdf0e10cSrcweir 					break;
298*cdf0e10cSrcweir 				if ( !IsSelected(ptClickedOn) )
299*cdf0e10cSrcweir 				{
300*cdf0e10cSrcweir 					SelectAll(sal_False);
301*cdf0e10cSrcweir 					Select(ptClickedOn, sal_True);
302*cdf0e10cSrcweir 					SetCurEntry(ptClickedOn);
303*cdf0e10cSrcweir 				}
304*cdf0e10cSrcweir 			}
305*cdf0e10cSrcweir 			else
306*cdf0e10cSrcweir 			{
307*cdf0e10cSrcweir 				ptClickedOn = GetCurEntry();
308*cdf0e10cSrcweir 				if ( !ptClickedOn )
309*cdf0e10cSrcweir 					break;
310*cdf0e10cSrcweir 				aWhere = GetEntryPosition(ptClickedOn);
311*cdf0e10cSrcweir 			}
312*cdf0e10cSrcweir             UserData* pData = static_cast<UserData*>(ptClickedOn->GetUserData());
313*cdf0e10cSrcweir             uno::Reference< report::XFunctionsSupplier> xSupplier(pData->getContent(),uno::UNO_QUERY);
314*cdf0e10cSrcweir             uno::Reference< report::XFunctions> xFunctions(pData->getContent(),uno::UNO_QUERY);
315*cdf0e10cSrcweir             uno::Reference< report::XGroup> xGroup(pData->getContent(),uno::UNO_QUERY);
316*cdf0e10cSrcweir             sal_Bool bDeleteAllowed = m_rController.isEditable() && (xGroup.is() ||
317*cdf0e10cSrcweir                                       uno::Reference< report::XFunction>(pData->getContent(),uno::UNO_QUERY).is());
318*cdf0e10cSrcweir             PopupMenu aContextMenu( ModuleRes( RID_MENU_NAVIGATOR ) );
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir 			sal_uInt16 nCount = aContextMenu.GetItemCount();
321*cdf0e10cSrcweir 			for (sal_uInt16 i = 0; i < nCount; ++i)
322*cdf0e10cSrcweir 			{
323*cdf0e10cSrcweir 				if ( MENUITEM_SEPARATOR != aContextMenu.GetItemType(i))
324*cdf0e10cSrcweir 				{
325*cdf0e10cSrcweir 					sal_uInt16 nId = aContextMenu.GetItemId(i);
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 					aContextMenu.CheckItem(nId,m_rController.isCommandChecked(nId));
328*cdf0e10cSrcweir                     sal_Bool bEnabled = m_rController.isCommandEnabled(nId);
329*cdf0e10cSrcweir                     if ( nId == SID_RPT_NEW_FUNCTION )
330*cdf0e10cSrcweir                         aContextMenu.EnableItem(nId,m_rController.isEditable() && (xSupplier.is() || xFunctions.is()) );
331*cdf0e10cSrcweir                     // special condition, check for function and group
332*cdf0e10cSrcweir                     else if ( nId == SID_DELETE )
333*cdf0e10cSrcweir                         aContextMenu.EnableItem(SID_DELETE,bDeleteAllowed);
334*cdf0e10cSrcweir                     else
335*cdf0e10cSrcweir                         aContextMenu.EnableItem(nId,bEnabled);
336*cdf0e10cSrcweir 				}
337*cdf0e10cSrcweir 			} // for (sal_uInt16 i = 0; i < nCount; ++i)
338*cdf0e10cSrcweir 			sal_uInt16 nId = aContextMenu.Execute(this, aWhere);
339*cdf0e10cSrcweir 			if ( nId )
340*cdf0e10cSrcweir             {
341*cdf0e10cSrcweir                 uno::Sequence< beans::PropertyValue> aArgs;
342*cdf0e10cSrcweir                 if ( nId == SID_RPT_NEW_FUNCTION )
343*cdf0e10cSrcweir                 {
344*cdf0e10cSrcweir                     aArgs.realloc(1);
345*cdf0e10cSrcweir                     aArgs[0].Value <<= (xFunctions.is() ? xFunctions : xSupplier->getFunctions());
346*cdf0e10cSrcweir                 }
347*cdf0e10cSrcweir                 else if ( nId == SID_DELETE )
348*cdf0e10cSrcweir                 {
349*cdf0e10cSrcweir                     if ( xGroup.is() )
350*cdf0e10cSrcweir                         nId = SID_GROUP_REMOVE;
351*cdf0e10cSrcweir                     aArgs.realloc(1);
352*cdf0e10cSrcweir                     aArgs[0].Name = PROPERTY_GROUP;
353*cdf0e10cSrcweir                     aArgs[0].Value <<= pData->getContent();
354*cdf0e10cSrcweir                 }
355*cdf0e10cSrcweir                 m_rController.executeUnChecked(nId,aArgs);
356*cdf0e10cSrcweir             }
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir 			bHandled = sal_True;
359*cdf0e10cSrcweir 		} break;
360*cdf0e10cSrcweir 	}
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir 	if (!bHandled)
363*cdf0e10cSrcweir 		SvTreeListBox::Command( rEvt );
364*cdf0e10cSrcweir }
365*cdf0e10cSrcweir // -----------------------------------------------------------------------------
366*cdf0e10cSrcweir sal_Int8 NavigatorTree::AcceptDrop( const AcceptDropEvent& _rEvt )
367*cdf0e10cSrcweir {
368*cdf0e10cSrcweir 	sal_Int8 nDropOption = DND_ACTION_NONE;
369*cdf0e10cSrcweir     ::Point aDropPos = _rEvt.maPosPixel;
370*cdf0e10cSrcweir     if (_rEvt.mbLeaving)
371*cdf0e10cSrcweir 	{
372*cdf0e10cSrcweir 		if (m_aDropActionTimer.IsActive())
373*cdf0e10cSrcweir 			m_aDropActionTimer.Stop();
374*cdf0e10cSrcweir 	}
375*cdf0e10cSrcweir     else
376*cdf0e10cSrcweir 	{
377*cdf0e10cSrcweir         bool bNeedTrigger = false;
378*cdf0e10cSrcweir 		// auf dem ersten Eintrag ?
379*cdf0e10cSrcweir 		if ((aDropPos.Y() >= 0) && (aDropPos.Y() < GetEntryHeight()))
380*cdf0e10cSrcweir 		{
381*cdf0e10cSrcweir 			m_aDropActionType = DA_SCROLLUP;
382*cdf0e10cSrcweir 			bNeedTrigger = true;
383*cdf0e10cSrcweir 		}
384*cdf0e10cSrcweir         else if ((aDropPos.Y() < GetSizePixel().Height()) && (aDropPos.Y() >= GetSizePixel().Height() - GetEntryHeight()))
385*cdf0e10cSrcweir 		{
386*cdf0e10cSrcweir 			m_aDropActionType = DA_SCROLLDOWN;
387*cdf0e10cSrcweir 			bNeedTrigger = true;
388*cdf0e10cSrcweir 		}
389*cdf0e10cSrcweir         else
390*cdf0e10cSrcweir 		{
391*cdf0e10cSrcweir 			SvLBoxEntry* pDropppedOn = GetEntry(aDropPos);
392*cdf0e10cSrcweir 			if (pDropppedOn && (GetChildCount(pDropppedOn) > 0) && !IsExpanded(pDropppedOn))
393*cdf0e10cSrcweir 			{
394*cdf0e10cSrcweir 				m_aDropActionType = DA_EXPANDNODE;
395*cdf0e10cSrcweir 				bNeedTrigger = true;
396*cdf0e10cSrcweir 			}
397*cdf0e10cSrcweir 		}
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir 		if (bNeedTrigger && (m_aTimerTriggered != aDropPos))
400*cdf0e10cSrcweir 		{
401*cdf0e10cSrcweir 			// neu anfangen zu zaehlen
402*cdf0e10cSrcweir 			m_nTimerCounter = DROP_ACTION_TIMER_INITIAL_TICKS;
403*cdf0e10cSrcweir 			// die Pos merken, da ich auch AcceptDrops bekomme, wenn sich die Maus gar nicht bewegt hat
404*cdf0e10cSrcweir 			m_aTimerTriggered = aDropPos;
405*cdf0e10cSrcweir 			// und den Timer los
406*cdf0e10cSrcweir 			if (!m_aDropActionTimer.IsActive()) // gibt es den Timer schon ?
407*cdf0e10cSrcweir 			{
408*cdf0e10cSrcweir 				m_aDropActionTimer.SetTimeout(DROP_ACTION_TIMER_TICK_BASE);
409*cdf0e10cSrcweir 				m_aDropActionTimer.Start();
410*cdf0e10cSrcweir 			}
411*cdf0e10cSrcweir 		}
412*cdf0e10cSrcweir         else if (!bNeedTrigger)
413*cdf0e10cSrcweir 			m_aDropActionTimer.Stop();
414*cdf0e10cSrcweir 	}
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir     return nDropOption;
417*cdf0e10cSrcweir }
418*cdf0e10cSrcweir // -------------------------------------------------------------------------
419*cdf0e10cSrcweir sal_Int8 NavigatorTree::ExecuteDrop( const ExecuteDropEvent& /*_rEvt*/ )
420*cdf0e10cSrcweir {
421*cdf0e10cSrcweir     // _rEvt.mnAction;
422*cdf0e10cSrcweir 	return DND_ACTION_NONE;
423*cdf0e10cSrcweir }
424*cdf0e10cSrcweir // -------------------------------------------------------------------------
425*cdf0e10cSrcweir void NavigatorTree::StartDrag( sal_Int8 /*_nAction*/, const Point& _rPosPixel )
426*cdf0e10cSrcweir {
427*cdf0e10cSrcweir     m_pDragedEntry = GetEntry(_rPosPixel);
428*cdf0e10cSrcweir     if ( m_pDragedEntry )
429*cdf0e10cSrcweir     {
430*cdf0e10cSrcweir         EndSelection();
431*cdf0e10cSrcweir     }
432*cdf0e10cSrcweir }
433*cdf0e10cSrcweir //------------------------------------------------------------------------
434*cdf0e10cSrcweir IMPL_LINK( NavigatorTree, OnDropActionTimer, void*, EMPTYARG )
435*cdf0e10cSrcweir {
436*cdf0e10cSrcweir 	if (--m_nTimerCounter > 0)
437*cdf0e10cSrcweir 		return 0L;
438*cdf0e10cSrcweir 
439*cdf0e10cSrcweir     switch ( m_aDropActionType )
440*cdf0e10cSrcweir     {
441*cdf0e10cSrcweir     case DA_EXPANDNODE:
442*cdf0e10cSrcweir 	{
443*cdf0e10cSrcweir 		SvLBoxEntry* pToExpand = GetEntry(m_aTimerTriggered);
444*cdf0e10cSrcweir 		if (pToExpand && (GetChildCount(pToExpand) > 0) &&  !IsExpanded(pToExpand))
445*cdf0e10cSrcweir 			// tja, eigentlich muesste ich noch testen, ob die Node nicht schon expandiert ist, aber ich
446*cdf0e10cSrcweir 			// habe dazu weder in den Basisklassen noch im Model eine Methode gefunden ...
447*cdf0e10cSrcweir 			// aber ich denke, die BK sollte es auch so vertragen
448*cdf0e10cSrcweir 			Expand(pToExpand);
449*cdf0e10cSrcweir 
450*cdf0e10cSrcweir 		// nach dem Expand habe ich im Gegensatz zum Scrollen natuerlich nix mehr zu tun
451*cdf0e10cSrcweir 		m_aDropActionTimer.Stop();
452*cdf0e10cSrcweir 	}
453*cdf0e10cSrcweir     break;
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir     case DA_SCROLLUP :
456*cdf0e10cSrcweir 		ScrollOutputArea( 1 );
457*cdf0e10cSrcweir 		m_nTimerCounter = DROP_ACTION_TIMER_SCROLL_TICKS;
458*cdf0e10cSrcweir 		break;
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir 	case DA_SCROLLDOWN :
461*cdf0e10cSrcweir 		ScrollOutputArea( -1 );
462*cdf0e10cSrcweir 		m_nTimerCounter = DROP_ACTION_TIMER_SCROLL_TICKS;
463*cdf0e10cSrcweir 		break;
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir 	}
466*cdf0e10cSrcweir 
467*cdf0e10cSrcweir 	return 0L;
468*cdf0e10cSrcweir }
469*cdf0e10cSrcweir 
470*cdf0e10cSrcweir // -----------------------------------------------------------------------------
471*cdf0e10cSrcweir IMPL_LINK(NavigatorTree, OnEntrySelDesel, NavigatorTree*, /*pThis*/)
472*cdf0e10cSrcweir {
473*cdf0e10cSrcweir     if ( !m_pSelectionListener->locked() )
474*cdf0e10cSrcweir     {
475*cdf0e10cSrcweir         m_pSelectionListener->lock();
476*cdf0e10cSrcweir         SvLBoxEntry* pEntry = GetCurEntry();
477*cdf0e10cSrcweir         uno::Any aSelection;
478*cdf0e10cSrcweir         if ( IsSelected(pEntry) )
479*cdf0e10cSrcweir             aSelection <<= static_cast<UserData*>(pEntry->GetUserData())->getContent();
480*cdf0e10cSrcweir         m_rController.select(aSelection);
481*cdf0e10cSrcweir         m_pSelectionListener->unlock();
482*cdf0e10cSrcweir     }
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir     return 0L;
485*cdf0e10cSrcweir }
486*cdf0e10cSrcweir // -----------------------------------------------------------------------------
487*cdf0e10cSrcweir void NavigatorTree::_selectionChanged( const lang::EventObject& aEvent ) throw (uno::RuntimeException)
488*cdf0e10cSrcweir {
489*cdf0e10cSrcweir     m_pSelectionListener->lock();
490*cdf0e10cSrcweir     uno::Reference< view::XSelectionSupplier> xSelectionSupplier(aEvent.Source,uno::UNO_QUERY);
491*cdf0e10cSrcweir     uno::Any aSec = xSelectionSupplier->getSelection();
492*cdf0e10cSrcweir     uno::Sequence< uno::Reference< report::XReportComponent > > aSelection;
493*cdf0e10cSrcweir     aSec >>= aSelection;
494*cdf0e10cSrcweir     if ( !aSelection.getLength() )
495*cdf0e10cSrcweir     {
496*cdf0e10cSrcweir         uno::Reference< uno::XInterface> xSelection(aSec,uno::UNO_QUERY);
497*cdf0e10cSrcweir         SvLBoxEntry* pEntry = find(xSelection);
498*cdf0e10cSrcweir         if ( pEntry && !IsSelected(pEntry) )
499*cdf0e10cSrcweir         {
500*cdf0e10cSrcweir             Select(pEntry, sal_True);
501*cdf0e10cSrcweir 	        SetCurEntry(pEntry);
502*cdf0e10cSrcweir         }
503*cdf0e10cSrcweir         else if ( !pEntry )
504*cdf0e10cSrcweir             SelectAll(sal_False,sal_False);
505*cdf0e10cSrcweir     }
506*cdf0e10cSrcweir     else
507*cdf0e10cSrcweir     {
508*cdf0e10cSrcweir         const uno::Reference< report::XReportComponent >* pIter = aSelection.getConstArray();
509*cdf0e10cSrcweir         const uno::Reference< report::XReportComponent >* pEnd  = pIter + aSelection.getLength();
510*cdf0e10cSrcweir         for (; pIter != pEnd; ++pIter)
511*cdf0e10cSrcweir         {
512*cdf0e10cSrcweir             SvLBoxEntry* pEntry = find(*pIter);
513*cdf0e10cSrcweir             if ( pEntry && !IsSelected(pEntry) )
514*cdf0e10cSrcweir             {
515*cdf0e10cSrcweir                 Select(pEntry, sal_True);
516*cdf0e10cSrcweir 	            SetCurEntry(pEntry);
517*cdf0e10cSrcweir             }
518*cdf0e10cSrcweir         }
519*cdf0e10cSrcweir     }
520*cdf0e10cSrcweir     m_pSelectionListener->unlock();
521*cdf0e10cSrcweir }
522*cdf0e10cSrcweir // -----------------------------------------------------------------------------
523*cdf0e10cSrcweir SvLBoxEntry* NavigatorTree::insertEntry(const ::rtl::OUString& _sName,SvLBoxEntry* _pParent,sal_uInt16 _nImageId,sal_uLong _nPosition,UserData* _pData)
524*cdf0e10cSrcweir {
525*cdf0e10cSrcweir     SvLBoxEntry* pEntry = NULL;
526*cdf0e10cSrcweir     if ( _nImageId )
527*cdf0e10cSrcweir     {
528*cdf0e10cSrcweir         const Image aImage( m_aNavigatorImages.GetImage( _nImageId ) );
529*cdf0e10cSrcweir         pEntry = InsertEntry(_sName,aImage,aImage,_pParent,sal_False,_nPosition,_pData);
530*cdf0e10cSrcweir         if ( pEntry )
531*cdf0e10cSrcweir 	    {
532*cdf0e10cSrcweir             const Image aImageHC( m_aNavigatorImagesHC.GetImage( _nImageId ) );
533*cdf0e10cSrcweir 		    SetExpandedEntryBmp( pEntry, aImageHC, BMP_COLOR_HIGHCONTRAST );
534*cdf0e10cSrcweir 		    SetCollapsedEntryBmp( pEntry, aImageHC, BMP_COLOR_HIGHCONTRAST );
535*cdf0e10cSrcweir 	    }
536*cdf0e10cSrcweir     }
537*cdf0e10cSrcweir     else
538*cdf0e10cSrcweir         pEntry = InsertEntry(_sName,_pParent,sal_False,_nPosition,_pData);
539*cdf0e10cSrcweir     return pEntry;
540*cdf0e10cSrcweir }
541*cdf0e10cSrcweir // -----------------------------------------------------------------------------
542*cdf0e10cSrcweir void NavigatorTree::traverseSection(const uno::Reference< report::XSection>& _xSection,SvLBoxEntry* _pParent,sal_uInt16 _nImageId,sal_uLong _nPosition)
543*cdf0e10cSrcweir {
544*cdf0e10cSrcweir     SvLBoxEntry* pSection = insertEntry(_xSection->getName(),_pParent,_nImageId,_nPosition,new UserData(this,_xSection));
545*cdf0e10cSrcweir     const sal_Int32 nCount = _xSection->getCount();
546*cdf0e10cSrcweir     for (sal_Int32 i = 0; i < nCount; ++i)
547*cdf0e10cSrcweir     {
548*cdf0e10cSrcweir         uno::Reference< report::XReportComponent> xElement(_xSection->getByIndex(i),uno::UNO_QUERY_THROW);
549*cdf0e10cSrcweir         OSL_ENSURE(xElement.is(),"Found report element which is NULL!");
550*cdf0e10cSrcweir         insertEntry(lcl_getName(xElement.get()),pSection,lcl_getImageId(xElement),LIST_APPEND,new UserData(this,xElement));
551*cdf0e10cSrcweir         uno::Reference< report::XReportDefinition> xSubReport(xElement,uno::UNO_QUERY);
552*cdf0e10cSrcweir         if ( xSubReport.is() )
553*cdf0e10cSrcweir         {
554*cdf0e10cSrcweir             m_pMasterReport = find(_xSection->getReportDefinition());
555*cdf0e10cSrcweir             reportdesign::OReportVisitor aSubVisitor(this);
556*cdf0e10cSrcweir             aSubVisitor.start(xSubReport);
557*cdf0e10cSrcweir         }
558*cdf0e10cSrcweir     }
559*cdf0e10cSrcweir }
560*cdf0e10cSrcweir // -----------------------------------------------------------------------------
561*cdf0e10cSrcweir void NavigatorTree::traverseFunctions(const uno::Reference< report::XFunctions>& _xFunctions,SvLBoxEntry* _pParent)
562*cdf0e10cSrcweir {
563*cdf0e10cSrcweir     SvLBoxEntry* pFunctions = insertEntry(String(ModuleRes(RID_STR_FUNCTIONS)),_pParent,SID_RPT_NEW_FUNCTION,LIST_APPEND,new UserData(this,_xFunctions));
564*cdf0e10cSrcweir     const sal_Int32 nCount = _xFunctions->getCount();
565*cdf0e10cSrcweir     for (sal_Int32 i = 0; i< nCount; ++i)
566*cdf0e10cSrcweir     {
567*cdf0e10cSrcweir         uno::Reference< report::XFunction> xElement(_xFunctions->getByIndex(i),uno::UNO_QUERY);
568*cdf0e10cSrcweir         insertEntry(xElement->getName(),pFunctions,SID_RPT_NEW_FUNCTION,LIST_APPEND,new UserData(this,xElement));
569*cdf0e10cSrcweir     }
570*cdf0e10cSrcweir }
571*cdf0e10cSrcweir // -----------------------------------------------------------------------------
572*cdf0e10cSrcweir SvLBoxEntry* NavigatorTree::find(const uno::Reference< uno::XInterface >& _xContent)
573*cdf0e10cSrcweir {
574*cdf0e10cSrcweir     SvLBoxEntry* pRet = NULL;
575*cdf0e10cSrcweir     if ( _xContent.is() )
576*cdf0e10cSrcweir     {
577*cdf0e10cSrcweir         SvLBoxEntry* pCurrent = First();
578*cdf0e10cSrcweir         while ( pCurrent )
579*cdf0e10cSrcweir         {
580*cdf0e10cSrcweir             UserData* pData = static_cast<UserData*>(pCurrent->GetUserData());
581*cdf0e10cSrcweir             OSL_ENSURE(pData,"No UserData set an entry!");
582*cdf0e10cSrcweir             if ( pData->getContent() == _xContent )
583*cdf0e10cSrcweir             {
584*cdf0e10cSrcweir                 pRet = pCurrent;
585*cdf0e10cSrcweir                 break;
586*cdf0e10cSrcweir             }
587*cdf0e10cSrcweir             pCurrent = Next(pCurrent);
588*cdf0e10cSrcweir         }
589*cdf0e10cSrcweir     }
590*cdf0e10cSrcweir     return pRet;
591*cdf0e10cSrcweir }
592*cdf0e10cSrcweir // -----------------------------------------------------------------------------
593*cdf0e10cSrcweir // ITraverseReport
594*cdf0e10cSrcweir // -----------------------------------------------------------------------------
595*cdf0e10cSrcweir void NavigatorTree::traverseReport(const uno::Reference< report::XReportDefinition>& _xReport)
596*cdf0e10cSrcweir {
597*cdf0e10cSrcweir     insertEntry(_xReport->getName(),m_pMasterReport,SID_SELECT_REPORT,LIST_APPEND,new UserData(this,_xReport));
598*cdf0e10cSrcweir }
599*cdf0e10cSrcweir // -----------------------------------------------------------------------------
600*cdf0e10cSrcweir void NavigatorTree::traverseReportFunctions(const uno::Reference< report::XFunctions>& _xFunctions)
601*cdf0e10cSrcweir {
602*cdf0e10cSrcweir     SvLBoxEntry* pReport = find(_xFunctions->getParent());
603*cdf0e10cSrcweir     traverseFunctions(_xFunctions,pReport);
604*cdf0e10cSrcweir }
605*cdf0e10cSrcweir // -----------------------------------------------------------------------------
606*cdf0e10cSrcweir void NavigatorTree::traverseReportHeader(const uno::Reference< report::XSection>& _xSection)
607*cdf0e10cSrcweir {
608*cdf0e10cSrcweir     SvLBoxEntry* pReport = find(_xSection->getReportDefinition());
609*cdf0e10cSrcweir     traverseSection(_xSection,pReport,SID_REPORTHEADERFOOTER);
610*cdf0e10cSrcweir }
611*cdf0e10cSrcweir // -----------------------------------------------------------------------------
612*cdf0e10cSrcweir void NavigatorTree::traverseReportFooter(const uno::Reference< report::XSection>& _xSection)
613*cdf0e10cSrcweir {
614*cdf0e10cSrcweir     SvLBoxEntry* pReport = find(_xSection->getReportDefinition());
615*cdf0e10cSrcweir     traverseSection(_xSection,pReport,SID_REPORTHEADERFOOTER);
616*cdf0e10cSrcweir }
617*cdf0e10cSrcweir // -----------------------------------------------------------------------------
618*cdf0e10cSrcweir void NavigatorTree::traversePageHeader(const uno::Reference< report::XSection>& _xSection)
619*cdf0e10cSrcweir {
620*cdf0e10cSrcweir     SvLBoxEntry* pReport = find(_xSection->getReportDefinition());
621*cdf0e10cSrcweir     traverseSection(_xSection,pReport,SID_PAGEHEADERFOOTER);
622*cdf0e10cSrcweir }
623*cdf0e10cSrcweir // -----------------------------------------------------------------------------
624*cdf0e10cSrcweir void NavigatorTree::traversePageFooter(const uno::Reference< report::XSection>& _xSection)
625*cdf0e10cSrcweir {
626*cdf0e10cSrcweir     SvLBoxEntry* pReport = find(_xSection->getReportDefinition());
627*cdf0e10cSrcweir     traverseSection(_xSection,pReport,SID_PAGEHEADERFOOTER);
628*cdf0e10cSrcweir }
629*cdf0e10cSrcweir // -----------------------------------------------------------------------------
630*cdf0e10cSrcweir void NavigatorTree::traverseGroups(const uno::Reference< report::XGroups>& _xGroups)
631*cdf0e10cSrcweir {
632*cdf0e10cSrcweir     SvLBoxEntry* pReport = find(_xGroups->getReportDefinition());
633*cdf0e10cSrcweir     insertEntry(String(ModuleRes(RID_STR_GROUPS)),pReport,SID_SORTINGANDGROUPING,LIST_APPEND,new UserData(this,_xGroups));
634*cdf0e10cSrcweir }
635*cdf0e10cSrcweir // -----------------------------------------------------------------------------
636*cdf0e10cSrcweir void NavigatorTree::traverseGroup(const uno::Reference< report::XGroup>& _xGroup)
637*cdf0e10cSrcweir {
638*cdf0e10cSrcweir     uno::Reference< report::XGroups> xGroups(_xGroup->getParent(),uno::UNO_QUERY);
639*cdf0e10cSrcweir     SvLBoxEntry* pGroups = find(xGroups);
640*cdf0e10cSrcweir     OSL_ENSURE(pGroups,"No Groups inserted so far. Why!");
641*cdf0e10cSrcweir     insertEntry(_xGroup->getExpression(),pGroups,SID_GROUP,rptui::getPositionInIndexAccess(xGroups.get(),_xGroup),new UserData(this,_xGroup));
642*cdf0e10cSrcweir }
643*cdf0e10cSrcweir // -----------------------------------------------------------------------------
644*cdf0e10cSrcweir void NavigatorTree::traverseGroupFunctions(const uno::Reference< report::XFunctions>& _xFunctions)
645*cdf0e10cSrcweir {
646*cdf0e10cSrcweir     SvLBoxEntry* pGroup = find(_xFunctions->getParent());
647*cdf0e10cSrcweir     traverseFunctions(_xFunctions,pGroup);
648*cdf0e10cSrcweir }
649*cdf0e10cSrcweir // -----------------------------------------------------------------------------
650*cdf0e10cSrcweir void NavigatorTree::traverseGroupHeader(const uno::Reference< report::XSection>& _xSection)
651*cdf0e10cSrcweir {
652*cdf0e10cSrcweir     SvLBoxEntry* pGroup = find(_xSection->getGroup());
653*cdf0e10cSrcweir     OSL_ENSURE(pGroup,"No group found");
654*cdf0e10cSrcweir     traverseSection(_xSection,pGroup,SID_GROUPHEADER,1);
655*cdf0e10cSrcweir }
656*cdf0e10cSrcweir // -----------------------------------------------------------------------------
657*cdf0e10cSrcweir void NavigatorTree::traverseGroupFooter(const uno::Reference< report::XSection>& _xSection)
658*cdf0e10cSrcweir {
659*cdf0e10cSrcweir     SvLBoxEntry* pGroup = find(_xSection->getGroup());
660*cdf0e10cSrcweir     OSL_ENSURE(pGroup,"No group found");
661*cdf0e10cSrcweir     traverseSection(_xSection,pGroup,SID_GROUPFOOTER);
662*cdf0e10cSrcweir }
663*cdf0e10cSrcweir // -----------------------------------------------------------------------------
664*cdf0e10cSrcweir void NavigatorTree::traverseDetail(const uno::Reference< report::XSection>& _xSection)
665*cdf0e10cSrcweir {
666*cdf0e10cSrcweir     uno::Reference< report::XReportDefinition> xReport = _xSection->getReportDefinition();
667*cdf0e10cSrcweir     SvLBoxEntry* pParent = find(xReport);
668*cdf0e10cSrcweir     traverseSection(_xSection,pParent,SID_ICON_DETAIL);
669*cdf0e10cSrcweir }
670*cdf0e10cSrcweir // -----------------------------------------------------------------------------
671*cdf0e10cSrcweir void NavigatorTree::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException)
672*cdf0e10cSrcweir {
673*cdf0e10cSrcweir     uno::Reference< report::XReportDefinition> xReport(_rEvent.Source,uno::UNO_QUERY);
674*cdf0e10cSrcweir     if ( xReport.is() )
675*cdf0e10cSrcweir     {
676*cdf0e10cSrcweir         sal_Bool bEnabled = sal_False;
677*cdf0e10cSrcweir         _rEvent.NewValue >>= bEnabled;
678*cdf0e10cSrcweir         if ( bEnabled )
679*cdf0e10cSrcweir         {
680*cdf0e10cSrcweir             SvLBoxEntry* pParent = find(xReport);
681*cdf0e10cSrcweir             if ( _rEvent.PropertyName == PROPERTY_REPORTHEADERON )
682*cdf0e10cSrcweir             {
683*cdf0e10cSrcweir                 sal_uLong nPos = xReport->getReportHeaderOn() ? 2 : 1;
684*cdf0e10cSrcweir                 traverseSection(xReport->getReportHeader(),pParent,SID_REPORTHEADERFOOTER,nPos);
685*cdf0e10cSrcweir             }
686*cdf0e10cSrcweir             else if ( _rEvent.PropertyName == PROPERTY_PAGEHEADERON )
687*cdf0e10cSrcweir             {
688*cdf0e10cSrcweir                 traverseSection(xReport->getPageHeader(),pParent, SID_PAGEHEADERFOOTER,1);
689*cdf0e10cSrcweir             }
690*cdf0e10cSrcweir             else if ( _rEvent.PropertyName == PROPERTY_PAGEFOOTERON )
691*cdf0e10cSrcweir                 traverseSection(xReport->getPageFooter(),pParent, SID_PAGEHEADERFOOTER);
692*cdf0e10cSrcweir             else if ( _rEvent.PropertyName == PROPERTY_REPORTFOOTERON )
693*cdf0e10cSrcweir             {
694*cdf0e10cSrcweir                 sal_uLong nPos = xReport->getPageFooterOn() ? (GetLevelChildCount(pParent) - 1) : LIST_APPEND;
695*cdf0e10cSrcweir                 traverseSection(xReport->getReportFooter(),pParent,SID_REPORTHEADERFOOTER,nPos);
696*cdf0e10cSrcweir             }
697*cdf0e10cSrcweir         }
698*cdf0e10cSrcweir     }
699*cdf0e10cSrcweir }
700*cdf0e10cSrcweir // -----------------------------------------------------------------------------
701*cdf0e10cSrcweir void NavigatorTree::_elementInserted( const container::ContainerEvent& _rEvent )
702*cdf0e10cSrcweir {
703*cdf0e10cSrcweir     SvLBoxEntry* pEntry = find(_rEvent.Source);
704*cdf0e10cSrcweir     uno::Reference<beans::XPropertySet> xProp(_rEvent.Element,uno::UNO_QUERY_THROW);
705*cdf0e10cSrcweir     ::rtl::OUString sName;
706*cdf0e10cSrcweir     uno::Reference< beans::XPropertySetInfo> xInfo = xProp->getPropertySetInfo();
707*cdf0e10cSrcweir     if ( xInfo.is() )
708*cdf0e10cSrcweir     {
709*cdf0e10cSrcweir         if ( xInfo->hasPropertyByName(PROPERTY_NAME) )
710*cdf0e10cSrcweir             xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
711*cdf0e10cSrcweir         else if ( xInfo->hasPropertyByName(PROPERTY_EXPRESSION) )
712*cdf0e10cSrcweir             xProp->getPropertyValue(PROPERTY_EXPRESSION) >>= sName;
713*cdf0e10cSrcweir     }
714*cdf0e10cSrcweir     uno::Reference< report::XGroup> xGroup(xProp,uno::UNO_QUERY);
715*cdf0e10cSrcweir     if ( xGroup.is() )
716*cdf0e10cSrcweir     {
717*cdf0e10cSrcweir         reportdesign::OReportVisitor aSubVisitor(this);
718*cdf0e10cSrcweir         aSubVisitor.start(xGroup);
719*cdf0e10cSrcweir     }
720*cdf0e10cSrcweir     else
721*cdf0e10cSrcweir     {
722*cdf0e10cSrcweir         uno::Reference< report::XReportComponent> xElement(xProp,uno::UNO_QUERY);
723*cdf0e10cSrcweir         if ( xProp.is() )
724*cdf0e10cSrcweir             sName = lcl_getName(xProp);
725*cdf0e10cSrcweir         insertEntry(sName,pEntry,(!xElement.is() ? sal_uInt16(SID_RPT_NEW_FUNCTION) : lcl_getImageId(xElement)),LIST_APPEND,new UserData(this,xProp));
726*cdf0e10cSrcweir     }
727*cdf0e10cSrcweir     if ( !IsExpanded(pEntry) )
728*cdf0e10cSrcweir         Expand(pEntry);
729*cdf0e10cSrcweir }
730*cdf0e10cSrcweir // -----------------------------------------------------------------------------
731*cdf0e10cSrcweir void NavigatorTree::_elementRemoved( const container::ContainerEvent& _rEvent )
732*cdf0e10cSrcweir {
733*cdf0e10cSrcweir     uno::Reference<beans::XPropertySet> xProp(_rEvent.Element,uno::UNO_QUERY);
734*cdf0e10cSrcweir     SvLBoxEntry* pEntry = find(xProp);
735*cdf0e10cSrcweir     OSL_ENSURE(pEntry,"NavigatorTree::_elementRemoved: No Entry found!");
736*cdf0e10cSrcweir 
737*cdf0e10cSrcweir     if ( pEntry )
738*cdf0e10cSrcweir     {
739*cdf0e10cSrcweir         SvLBoxEntry* pParent = GetParent(pEntry);
740*cdf0e10cSrcweir         removeEntry(pEntry);
741*cdf0e10cSrcweir         PaintEntry(pParent);
742*cdf0e10cSrcweir     }
743*cdf0e10cSrcweir }
744*cdf0e10cSrcweir // -----------------------------------------------------------------------------
745*cdf0e10cSrcweir void NavigatorTree::_elementReplaced( const container::ContainerEvent& _rEvent )
746*cdf0e10cSrcweir {
747*cdf0e10cSrcweir     uno::Reference<beans::XPropertySet> xProp(_rEvent.ReplacedElement,uno::UNO_QUERY);
748*cdf0e10cSrcweir     SvLBoxEntry* pEntry = find(xProp);
749*cdf0e10cSrcweir     if ( pEntry )
750*cdf0e10cSrcweir     {
751*cdf0e10cSrcweir         UserData* pData = static_cast<UserData*>(pEntry->GetUserData());
752*cdf0e10cSrcweir         xProp.set(_rEvent.Element,uno::UNO_QUERY);
753*cdf0e10cSrcweir         pData->setContent(xProp);
754*cdf0e10cSrcweir         ::rtl::OUString sName;
755*cdf0e10cSrcweir         xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
756*cdf0e10cSrcweir         SetEntryText(pEntry,sName);
757*cdf0e10cSrcweir     }
758*cdf0e10cSrcweir }
759*cdf0e10cSrcweir // -----------------------------------------------------------------------------
760*cdf0e10cSrcweir void NavigatorTree::_disposing(const lang::EventObject& _rSource)throw( uno::RuntimeException)
761*cdf0e10cSrcweir {
762*cdf0e10cSrcweir     removeEntry(find(_rSource.Source));
763*cdf0e10cSrcweir }
764*cdf0e10cSrcweir // -----------------------------------------------------------------------------
765*cdf0e10cSrcweir void NavigatorTree::removeEntry(SvLBoxEntry* _pEntry,bool _bRemove)
766*cdf0e10cSrcweir {
767*cdf0e10cSrcweir     if ( _pEntry )
768*cdf0e10cSrcweir     {
769*cdf0e10cSrcweir         SvLBoxEntry* pChild = FirstChild(_pEntry);
770*cdf0e10cSrcweir         while( pChild )
771*cdf0e10cSrcweir         {
772*cdf0e10cSrcweir             removeEntry(pChild,false);
773*cdf0e10cSrcweir             pChild = NextSibling(pChild);
774*cdf0e10cSrcweir         }
775*cdf0e10cSrcweir         delete static_cast<UserData*>(_pEntry->GetUserData());
776*cdf0e10cSrcweir         if ( _bRemove )
777*cdf0e10cSrcweir             GetModel()->Remove(_pEntry);
778*cdf0e10cSrcweir     }
779*cdf0e10cSrcweir }
780*cdf0e10cSrcweir DBG_NAME(rpt_NavigatorTree_UserData)
781*cdf0e10cSrcweir // -----------------------------------------------------------------------------
782*cdf0e10cSrcweir NavigatorTree::UserData::UserData(NavigatorTree* _pTree,const uno::Reference<uno::XInterface>& _xContent)
783*cdf0e10cSrcweir     : OPropertyChangeListener(m_aMutex)
784*cdf0e10cSrcweir     , OContainerListener(m_aMutex)
785*cdf0e10cSrcweir     , m_xContent(_xContent)
786*cdf0e10cSrcweir     , m_pTree(_pTree)
787*cdf0e10cSrcweir {
788*cdf0e10cSrcweir     DBG_CTOR(rpt_NavigatorTree_UserData,NULL);
789*cdf0e10cSrcweir     uno::Reference<beans::XPropertySet> xProp(m_xContent,uno::UNO_QUERY);
790*cdf0e10cSrcweir     if ( xProp.is() )
791*cdf0e10cSrcweir     {
792*cdf0e10cSrcweir         uno::Reference< beans::XPropertySetInfo> xInfo = xProp->getPropertySetInfo();
793*cdf0e10cSrcweir         if ( xInfo.is() )
794*cdf0e10cSrcweir         {
795*cdf0e10cSrcweir             m_pListener = new ::comphelper::OPropertyChangeMultiplexer(this,xProp);
796*cdf0e10cSrcweir             if ( xInfo->hasPropertyByName(PROPERTY_NAME) )
797*cdf0e10cSrcweir                 m_pListener->addProperty(PROPERTY_NAME);
798*cdf0e10cSrcweir             else if ( xInfo->hasPropertyByName(PROPERTY_EXPRESSION) )
799*cdf0e10cSrcweir                 m_pListener->addProperty(PROPERTY_EXPRESSION);
800*cdf0e10cSrcweir             if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) )
801*cdf0e10cSrcweir                 m_pListener->addProperty(PROPERTY_DATAFIELD);
802*cdf0e10cSrcweir             if ( xInfo->hasPropertyByName(PROPERTY_LABEL) )
803*cdf0e10cSrcweir                 m_pListener->addProperty(PROPERTY_LABEL);
804*cdf0e10cSrcweir             if ( xInfo->hasPropertyByName(PROPERTY_HEADERON) )
805*cdf0e10cSrcweir                 m_pListener->addProperty(PROPERTY_HEADERON);
806*cdf0e10cSrcweir             if ( xInfo->hasPropertyByName(PROPERTY_FOOTERON) )
807*cdf0e10cSrcweir                 m_pListener->addProperty(PROPERTY_FOOTERON);
808*cdf0e10cSrcweir         }
809*cdf0e10cSrcweir     }
810*cdf0e10cSrcweir     uno::Reference< container::XContainer> xContainer(m_xContent,uno::UNO_QUERY);
811*cdf0e10cSrcweir     if ( xContainer.is() )
812*cdf0e10cSrcweir     {
813*cdf0e10cSrcweir         m_pContainerListener = new ::comphelper::OContainerListenerAdapter(this,xContainer);
814*cdf0e10cSrcweir     }
815*cdf0e10cSrcweir }
816*cdf0e10cSrcweir // -----------------------------------------------------------------------------
817*cdf0e10cSrcweir NavigatorTree::UserData::~UserData()
818*cdf0e10cSrcweir {
819*cdf0e10cSrcweir     DBG_DTOR(rpt_NavigatorTree_UserData,NULL);
820*cdf0e10cSrcweir     if ( m_pContainerListener.is() )
821*cdf0e10cSrcweir         m_pContainerListener->dispose();
822*cdf0e10cSrcweir     if ( m_pListener.is() )
823*cdf0e10cSrcweir         m_pListener->dispose();
824*cdf0e10cSrcweir }
825*cdf0e10cSrcweir // -----------------------------------------------------------------------------
826*cdf0e10cSrcweir // OPropertyChangeListener
827*cdf0e10cSrcweir void NavigatorTree::UserData::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException)
828*cdf0e10cSrcweir {
829*cdf0e10cSrcweir     SvLBoxEntry* pEntry = m_pTree->find(_rEvent.Source);
830*cdf0e10cSrcweir     OSL_ENSURE(pEntry,"No entry could be found! Why not!");
831*cdf0e10cSrcweir     const bool bFooterOn = (PROPERTY_FOOTERON == _rEvent.PropertyName);
832*cdf0e10cSrcweir     try
833*cdf0e10cSrcweir     {
834*cdf0e10cSrcweir         if ( bFooterOn || PROPERTY_HEADERON == _rEvent.PropertyName )
835*cdf0e10cSrcweir         {
836*cdf0e10cSrcweir             sal_Int32 nPos = 1;
837*cdf0e10cSrcweir             uno::Reference< report::XGroup> xGroup(_rEvent.Source,uno::UNO_QUERY);
838*cdf0e10cSrcweir             ::std::mem_fun_t< sal_Bool,OGroupHelper> pIsOn = ::std::mem_fun(&OGroupHelper::getHeaderOn);
839*cdf0e10cSrcweir 	        ::std::mem_fun_t< uno::Reference<report::XSection> ,OGroupHelper> pMemFunSection = ::std::mem_fun(&OGroupHelper::getHeader);
840*cdf0e10cSrcweir             if ( bFooterOn )
841*cdf0e10cSrcweir             {
842*cdf0e10cSrcweir                 pIsOn = ::std::mem_fun(&OGroupHelper::getFooterOn);
843*cdf0e10cSrcweir 		        pMemFunSection = ::std::mem_fun(&OGroupHelper::getFooter);
844*cdf0e10cSrcweir                 nPos = m_pTree->GetChildCount(pEntry) - 1;
845*cdf0e10cSrcweir             }
846*cdf0e10cSrcweir 
847*cdf0e10cSrcweir             OGroupHelper aGroupHelper(xGroup);
848*cdf0e10cSrcweir             if ( pIsOn(&aGroupHelper) )
849*cdf0e10cSrcweir             {
850*cdf0e10cSrcweir                 if ( bFooterOn )
851*cdf0e10cSrcweir                     ++nPos;
852*cdf0e10cSrcweir                 m_pTree->traverseSection(pMemFunSection(&aGroupHelper),pEntry,bFooterOn ? SID_GROUPFOOTER : SID_GROUPHEADER,nPos);
853*cdf0e10cSrcweir             }
854*cdf0e10cSrcweir             //else
855*cdf0e10cSrcweir             //    m_pTree->removeEntry(m_pTree->GetEntry(pEntry,nPos));
856*cdf0e10cSrcweir         }
857*cdf0e10cSrcweir         else if ( PROPERTY_EXPRESSION == _rEvent.PropertyName)
858*cdf0e10cSrcweir         {
859*cdf0e10cSrcweir             ::rtl::OUString sNewName;
860*cdf0e10cSrcweir             _rEvent.NewValue >>= sNewName;
861*cdf0e10cSrcweir             m_pTree->SetEntryText(pEntry,sNewName);
862*cdf0e10cSrcweir         }
863*cdf0e10cSrcweir         else if ( PROPERTY_DATAFIELD == _rEvent.PropertyName || PROPERTY_LABEL == _rEvent.PropertyName || PROPERTY_NAME == _rEvent.PropertyName )
864*cdf0e10cSrcweir         {
865*cdf0e10cSrcweir             uno::Reference<beans::XPropertySet> xProp(_rEvent.Source,uno::UNO_QUERY);
866*cdf0e10cSrcweir             m_pTree->SetEntryText(pEntry,lcl_getName(xProp));
867*cdf0e10cSrcweir         }
868*cdf0e10cSrcweir     }
869*cdf0e10cSrcweir     catch(uno::Exception)
870*cdf0e10cSrcweir     {}
871*cdf0e10cSrcweir }
872*cdf0e10cSrcweir // -----------------------------------------------------------------------------
873*cdf0e10cSrcweir void NavigatorTree::UserData::_elementInserted( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException)
874*cdf0e10cSrcweir {
875*cdf0e10cSrcweir     m_pTree->_elementInserted( _rEvent );
876*cdf0e10cSrcweir }
877*cdf0e10cSrcweir // -----------------------------------------------------------------------------
878*cdf0e10cSrcweir void NavigatorTree::UserData::_elementRemoved( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException)
879*cdf0e10cSrcweir {
880*cdf0e10cSrcweir     m_pTree->_elementRemoved( _rEvent );
881*cdf0e10cSrcweir }
882*cdf0e10cSrcweir // -----------------------------------------------------------------------------
883*cdf0e10cSrcweir void NavigatorTree::UserData::_elementReplaced( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException)
884*cdf0e10cSrcweir {
885*cdf0e10cSrcweir     m_pTree->_elementReplaced( _rEvent );
886*cdf0e10cSrcweir }
887*cdf0e10cSrcweir // -----------------------------------------------------------------------------
888*cdf0e10cSrcweir void NavigatorTree::UserData::_disposing(const lang::EventObject& _rSource) throw( uno::RuntimeException)
889*cdf0e10cSrcweir {
890*cdf0e10cSrcweir     m_pTree->_disposing( _rSource );
891*cdf0e10cSrcweir }
892*cdf0e10cSrcweir // -----------------------------------------------------------------------------
893*cdf0e10cSrcweir // class ONavigatorImpl
894*cdf0e10cSrcweir // -----------------------------------------------------------------------------
895*cdf0e10cSrcweir class ONavigatorImpl
896*cdf0e10cSrcweir {
897*cdf0e10cSrcweir     ONavigatorImpl(const ONavigatorImpl&);
898*cdf0e10cSrcweir     void operator =(const ONavigatorImpl&);
899*cdf0e10cSrcweir public:
900*cdf0e10cSrcweir     ONavigatorImpl(OReportController& _rController,ONavigator* _pParent);
901*cdf0e10cSrcweir     virtual ~ONavigatorImpl();
902*cdf0e10cSrcweir 
903*cdf0e10cSrcweir     uno::Reference< report::XReportDefinition>  m_xReport;
904*cdf0e10cSrcweir     ::rptui::OReportController&				    m_rController;
905*cdf0e10cSrcweir     ::std::auto_ptr<NavigatorTree>              m_pNavigatorTree;
906*cdf0e10cSrcweir };
907*cdf0e10cSrcweir 
908*cdf0e10cSrcweir ONavigatorImpl::ONavigatorImpl(OReportController& _rController,ONavigator* _pParent)
909*cdf0e10cSrcweir     :m_xReport(_rController.getReportDefinition())
910*cdf0e10cSrcweir     ,m_rController(_rController)
911*cdf0e10cSrcweir     ,m_pNavigatorTree(new NavigatorTree(_pParent,_rController))
912*cdf0e10cSrcweir {
913*cdf0e10cSrcweir     reportdesign::OReportVisitor aVisitor(m_pNavigatorTree.get());
914*cdf0e10cSrcweir     aVisitor.start(m_xReport);
915*cdf0e10cSrcweir     m_pNavigatorTree->Expand(m_pNavigatorTree->find(m_xReport));
916*cdf0e10cSrcweir     lang::EventObject aEvent(m_rController);
917*cdf0e10cSrcweir     m_pNavigatorTree->_selectionChanged(aEvent);
918*cdf0e10cSrcweir }
919*cdf0e10cSrcweir //------------------------------------------------------------------------
920*cdf0e10cSrcweir ONavigatorImpl::~ONavigatorImpl()
921*cdf0e10cSrcweir {
922*cdf0e10cSrcweir }
923*cdf0e10cSrcweir // -----------------------------------------------------------------------------
924*cdf0e10cSrcweir DBG_NAME( rpt_ONavigator )
925*cdf0e10cSrcweir const long STD_WIN_SIZE_X = 210;
926*cdf0e10cSrcweir const long STD_WIN_SIZE_Y = 280;
927*cdf0e10cSrcweir const long LISTBOX_BORDER = 2;
928*cdf0e10cSrcweir //========================================================================
929*cdf0e10cSrcweir // class ONavigator
930*cdf0e10cSrcweir //========================================================================
931*cdf0e10cSrcweir ONavigator::ONavigator( Window* _pParent
932*cdf0e10cSrcweir 						,OReportController& _rController)
933*cdf0e10cSrcweir 	: FloatingWindow( _pParent, ModuleRes(RID_NAVIGATOR) )
934*cdf0e10cSrcweir {
935*cdf0e10cSrcweir 	DBG_CTOR( rpt_ONavigator,NULL);
936*cdf0e10cSrcweir 
937*cdf0e10cSrcweir     m_pImpl.reset(new ONavigatorImpl(_rController,this));
938*cdf0e10cSrcweir 
939*cdf0e10cSrcweir 	//Size aSpace = LogicToPixel( Size( 7, 120), MAP_APPFONT );
940*cdf0e10cSrcweir 	//Size aOutSize(nMaxTextWidth + m_aHeader.GetSizePixel().Width() + 3*aSpace.Width(),aSpace.Height());
941*cdf0e10cSrcweir 	//SetMinOutputSizePixel(aOutSize);
942*cdf0e10cSrcweir 	//SetOutputSizePixel(aOutSize);
943*cdf0e10cSrcweir     FreeResource();
944*cdf0e10cSrcweir     m_pImpl->m_pNavigatorTree->Show();
945*cdf0e10cSrcweir     m_pImpl->m_pNavigatorTree->GrabFocus();
946*cdf0e10cSrcweir     SetSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
947*cdf0e10cSrcweir     Show();
948*cdf0e10cSrcweir 
949*cdf0e10cSrcweir }
950*cdf0e10cSrcweir // -----------------------------------------------------------------------------
951*cdf0e10cSrcweir 
952*cdf0e10cSrcweir //------------------------------------------------------------------------
953*cdf0e10cSrcweir ONavigator::~ONavigator()
954*cdf0e10cSrcweir {
955*cdf0e10cSrcweir 	DBG_DTOR( rpt_ONavigator,NULL);
956*cdf0e10cSrcweir }
957*cdf0e10cSrcweir //------------------------------------------------------------------------------
958*cdf0e10cSrcweir void ONavigator::Resize()
959*cdf0e10cSrcweir {
960*cdf0e10cSrcweir 	FloatingWindow::Resize();
961*cdf0e10cSrcweir 
962*cdf0e10cSrcweir 	Point aPos(GetPosPixel());
963*cdf0e10cSrcweir 	Size aSize( GetOutputSizePixel() );
964*cdf0e10cSrcweir 
965*cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
966*cdf0e10cSrcweir 
967*cdf0e10cSrcweir 	// Groesse der form::ListBox anpassen
968*cdf0e10cSrcweir 	Point aLBPos( LISTBOX_BORDER, LISTBOX_BORDER );
969*cdf0e10cSrcweir 	Size aLBSize( aSize );
970*cdf0e10cSrcweir 	aLBSize.Width() -= (2*LISTBOX_BORDER);
971*cdf0e10cSrcweir 	aLBSize.Height() -= (2*LISTBOX_BORDER);
972*cdf0e10cSrcweir 
973*cdf0e10cSrcweir 	m_pImpl->m_pNavigatorTree->SetPosSizePixel( aLBPos, aLBSize );
974*cdf0e10cSrcweir }
975*cdf0e10cSrcweir // -----------------------------------------------------------------------------
976*cdf0e10cSrcweir // -----------------------------------------------------------------------------
977*cdf0e10cSrcweir void ONavigator::GetFocus()
978*cdf0e10cSrcweir {
979*cdf0e10cSrcweir 	Window::GetFocus();
980*cdf0e10cSrcweir 	if ( m_pImpl->m_pNavigatorTree.get() )
981*cdf0e10cSrcweir 		m_pImpl->m_pNavigatorTree->GrabFocus();
982*cdf0e10cSrcweir }
983*cdf0e10cSrcweir // =============================================================================
984*cdf0e10cSrcweir } // rptui
985*cdf0e10cSrcweir // =============================================================================
986*cdf0e10cSrcweir 
987