1*9e0e4191SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9e0e4191SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9e0e4191SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9e0e4191SAndrew Rist  * distributed with this work for additional information
6*9e0e4191SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9e0e4191SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9e0e4191SAndrew Rist  * "License"); you may not use this file except in compliance
9*9e0e4191SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9e0e4191SAndrew Rist  *
11*9e0e4191SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9e0e4191SAndrew Rist  *
13*9e0e4191SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9e0e4191SAndrew Rist  * software distributed under the License is distributed on an
15*9e0e4191SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9e0e4191SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9e0e4191SAndrew Rist  * specific language governing permissions and limitations
18*9e0e4191SAndrew Rist  * under the License.
19*9e0e4191SAndrew Rist  *
20*9e0e4191SAndrew Rist  *************************************************************/
21*9e0e4191SAndrew Rist 
22*9e0e4191SAndrew Rist 
23cdf0e10cSrcweir #include "precompiled_reportdesign.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include "DesignView.hxx"
26cdf0e10cSrcweir #include <tools/debug.hxx>
27cdf0e10cSrcweir #include "ReportController.hxx"
28cdf0e10cSrcweir #include <comphelper/types.hxx>
29cdf0e10cSrcweir #include <unotools/syslocale.hxx>
30cdf0e10cSrcweir #include <unotools/viewoptions.hxx>
31cdf0e10cSrcweir #include "RptDef.hxx"
32cdf0e10cSrcweir #include "UITools.hxx"
33cdf0e10cSrcweir #include "RptObject.hxx"
34cdf0e10cSrcweir #include "propbrw.hxx"
35cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
36cdf0e10cSrcweir #include "helpids.hrc"
37cdf0e10cSrcweir #include "SectionView.hxx"
38cdf0e10cSrcweir #include "ReportSection.hxx"
39cdf0e10cSrcweir #include "rptui_slotid.hrc"
40cdf0e10cSrcweir #include <svx/svxids.hrc>
41cdf0e10cSrcweir #include "AddField.hxx"
42cdf0e10cSrcweir #include "ScrollHelper.hxx"
43cdf0e10cSrcweir #include "Navigator.hxx"
44cdf0e10cSrcweir #include "SectionWindow.hxx"
45cdf0e10cSrcweir #include "RptResId.hrc"
46cdf0e10cSrcweir #include <vcl/svapp.hxx>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir namespace rptui
49cdf0e10cSrcweir {
50cdf0e10cSrcweir using namespace ::dbaui;
51cdf0e10cSrcweir using namespace ::utl;
52cdf0e10cSrcweir using namespace ::com::sun::star;
53cdf0e10cSrcweir using namespace uno;
54cdf0e10cSrcweir using namespace lang;
55cdf0e10cSrcweir using namespace beans;
56cdf0e10cSrcweir using namespace container;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir #define LINE_SIZE			50
59cdf0e10cSrcweir #define START_SIZE_TASKPANE 30
60cdf0e10cSrcweir #define COLSET_ID           1
61cdf0e10cSrcweir #define REPORT_ID           2
62cdf0e10cSrcweir #define TASKPANE_ID         3
63cdf0e10cSrcweir 
64cdf0e10cSrcweir class OTaskWindow : public Window
65cdf0e10cSrcweir {
66cdf0e10cSrcweir     PropBrw* m_pPropWin;
67cdf0e10cSrcweir public:
OTaskWindow(Window * _pParent)68cdf0e10cSrcweir     OTaskWindow(Window* _pParent) : Window(_pParent),m_pPropWin(NULL){}
69cdf0e10cSrcweir 
setPropertyBrowser(PropBrw * _pPropWin)70cdf0e10cSrcweir     inline void setPropertyBrowser(PropBrw* _pPropWin)
71cdf0e10cSrcweir     {
72cdf0e10cSrcweir         m_pPropWin = _pPropWin;
73cdf0e10cSrcweir     }
74cdf0e10cSrcweir 
Resize()75cdf0e10cSrcweir     virtual void Resize()
76cdf0e10cSrcweir     {
77cdf0e10cSrcweir         const Size aSize = GetOutputSizePixel();
78cdf0e10cSrcweir         if ( m_pPropWin && aSize.Height() && aSize.Width() )
79cdf0e10cSrcweir             m_pPropWin->SetSizePixel(aSize);
80cdf0e10cSrcweir     }
getMinimumWidth() const81cdf0e10cSrcweir     long getMinimumWidth() const
82cdf0e10cSrcweir     {
83cdf0e10cSrcweir         long nRet = 0;
84cdf0e10cSrcweir         if ( m_pPropWin )
85cdf0e10cSrcweir             nRet = m_pPropWin->getMinimumSize().Width();
86cdf0e10cSrcweir         return nRet;
87cdf0e10cSrcweir     }
88cdf0e10cSrcweir };
89cdf0e10cSrcweir class OwnSplitWindow : public SplitWindow
90cdf0e10cSrcweir {
91cdf0e10cSrcweir public:
OwnSplitWindow(Window * pParent)92cdf0e10cSrcweir     OwnSplitWindow(Window* pParent) : SplitWindow(pParent,WB_DIALOGCONTROL){SetBackground( );}
93cdf0e10cSrcweir 
Split()94cdf0e10cSrcweir     virtual void		Split()
95cdf0e10cSrcweir     {
96cdf0e10cSrcweir         SplitWindow::Split();
97cdf0e10cSrcweir         setItemSizes();
98cdf0e10cSrcweir     }
setItemSizes()99cdf0e10cSrcweir     void setItemSizes()
100cdf0e10cSrcweir     {
101cdf0e10cSrcweir         const long nOutWidth = GetOutputSizePixel().Width();
102cdf0e10cSrcweir         long	nTaskPaneMinSplitSize = static_cast<OTaskWindow*>(GetItemWindow(TASKPANE_ID))->getMinimumWidth();
103cdf0e10cSrcweir         nTaskPaneMinSplitSize = static_cast<long>(nTaskPaneMinSplitSize*100/nOutWidth);
104cdf0e10cSrcweir         if ( !nTaskPaneMinSplitSize )
105cdf0e10cSrcweir             nTaskPaneMinSplitSize = START_SIZE_TASKPANE;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir         const long nReportMinSplitSize = static_cast<long>(12000/nOutWidth);
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	    long nReportSize = GetItemSize( REPORT_ID );
110cdf0e10cSrcweir 	    long nTaskPaneSize = GetItemSize( TASKPANE_ID );
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 	    sal_Bool		bMod = sal_False;
113cdf0e10cSrcweir 	    if( nReportSize < nReportMinSplitSize )
114cdf0e10cSrcweir 	    {
115cdf0e10cSrcweir 		    nReportSize = nReportMinSplitSize;
116cdf0e10cSrcweir 		    nTaskPaneSize = 99 - nReportMinSplitSize;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 		    bMod = sal_True;
119cdf0e10cSrcweir 	    }
120cdf0e10cSrcweir 	    else if( nTaskPaneSize < nTaskPaneMinSplitSize )
121cdf0e10cSrcweir 	    {
122cdf0e10cSrcweir 		    nTaskPaneSize = nTaskPaneMinSplitSize;
123cdf0e10cSrcweir 		    nReportSize = 99 - nTaskPaneMinSplitSize;
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 		    bMod = sal_True;
126cdf0e10cSrcweir 	    }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	    if( bMod )
129cdf0e10cSrcweir 	    {
130cdf0e10cSrcweir 		    SetItemSize( REPORT_ID, nReportSize );
131cdf0e10cSrcweir 		    SetItemSize( TASKPANE_ID, nTaskPaneSize );
132cdf0e10cSrcweir 	    }
133cdf0e10cSrcweir     }
134cdf0e10cSrcweir };
135cdf0e10cSrcweir //==================================================================
136cdf0e10cSrcweir // class ODesignView
137cdf0e10cSrcweir //==================================================================
DBG_NAME(rpt_ODesignView)138cdf0e10cSrcweir DBG_NAME( rpt_ODesignView )
139cdf0e10cSrcweir //------------------------------------------------------------------------------
140cdf0e10cSrcweir ODesignView::ODesignView(   Window* pParent,
141cdf0e10cSrcweir 							const Reference< XMultiServiceFactory >& _rxOrb,
142cdf0e10cSrcweir 							OReportController& _rController) :
143cdf0e10cSrcweir 	ODataView( pParent, _rController, _rxOrb, WB_DIALOGCONTROL )
144cdf0e10cSrcweir     ,m_aSplitWin(this)
145cdf0e10cSrcweir     ,m_rReportController( _rController )
146cdf0e10cSrcweir     ,m_aScrollWindow(this)
147cdf0e10cSrcweir 	,m_pPropWin(NULL)
148cdf0e10cSrcweir 	,m_pAddField(NULL)
149cdf0e10cSrcweir 	,m_pCurrentView(NULL)
150cdf0e10cSrcweir     ,m_pReportExplorer(NULL)
151cdf0e10cSrcweir 	,m_eMode( RPTUI_SELECT )
152cdf0e10cSrcweir 	,m_nCurrentPosition(USHRT_MAX)
153cdf0e10cSrcweir 	,m_eActObj( OBJ_NONE )
154cdf0e10cSrcweir 	,m_bFirstDraw(sal_False)
155cdf0e10cSrcweir 	,m_aGridSizeCoarse( 1000, 1000 )	// #i93595# 100TH_MM changed to grid using coarse 1 cm grid
156cdf0e10cSrcweir     ,m_aGridSizeFine( 250, 250 )        // and a 0,25 cm subdivision for better visualisation
157cdf0e10cSrcweir 	,m_bGridVisible(sal_True)
158cdf0e10cSrcweir 	,m_bGridSnap(sal_True)
159cdf0e10cSrcweir 	,m_bDeleted( sal_False )
160cdf0e10cSrcweir {
161cdf0e10cSrcweir 	DBG_CTOR( rpt_ODesignView,NULL);
162cdf0e10cSrcweir 	SetHelpId(UID_RPT_RPT_APP_VIEW);
163cdf0e10cSrcweir 	ImplInitSettings();
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 	SetMapMode( MapMode( MAP_100TH_MM ) );
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 	// now create the task pane on the right side :-)
168cdf0e10cSrcweir 	m_pTaskPane = new OTaskWindow(this);
169cdf0e10cSrcweir 	//m_pTaskPane->Show();
170cdf0e10cSrcweir 
171cdf0e10cSrcweir     m_aSplitWin.InsertItem( COLSET_ID,100,SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE | SWIB_COLSET );
172cdf0e10cSrcweir     m_aSplitWin.InsertItem( REPORT_ID, &m_aScrollWindow, 100/*m_aScrollWindow.getMaxMarkerWidth(sal_False)*/, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE  /*SWIB_COLSET*/);
173cdf0e10cSrcweir 	//m_aSplitWin.InsertItem( TASKPANE_ID, m_pTaskPane, 50, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE );
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	// Splitter einrichten
176cdf0e10cSrcweir 	//m_aSplitter.SetSplitHdl(LINK(this, ODesignView,SplitHdl));
177cdf0e10cSrcweir 	m_aSplitWin.SetSplitHdl(LINK(this, ODesignView,SplitHdl));
178cdf0e10cSrcweir     m_aSplitWin.ShowAutoHideButton();
179cdf0e10cSrcweir     m_aSplitWin.SetAlign(WINDOWALIGN_LEFT);
180cdf0e10cSrcweir     m_aSplitWin.Show();
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 	m_aMarkTimer.SetTimeout( 100 );
183cdf0e10cSrcweir 	m_aMarkTimer.SetTimeoutHdl( LINK( this, ODesignView, MarkTimeout ) );
184cdf0e10cSrcweir }
185cdf0e10cSrcweir 
186cdf0e10cSrcweir //------------------------------------------------------------------------------
~ODesignView()187cdf0e10cSrcweir ODesignView::~ODesignView()
188cdf0e10cSrcweir {
189cdf0e10cSrcweir 	DBG_DTOR( rpt_ODesignView,NULL);
190cdf0e10cSrcweir     m_bDeleted = sal_True;
191cdf0e10cSrcweir     Hide();
192cdf0e10cSrcweir     m_aScrollWindow.Hide();
193cdf0e10cSrcweir 	m_aMarkTimer.Stop();
194cdf0e10cSrcweir     if ( m_pPropWin )
195cdf0e10cSrcweir 	{
196cdf0e10cSrcweir         notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
197cdf0e10cSrcweir 		::std::auto_ptr<Window> aTemp2(m_pPropWin);
198cdf0e10cSrcweir 		m_pPropWin = NULL;
199cdf0e10cSrcweir 	}
200cdf0e10cSrcweir     if ( m_pAddField )
201cdf0e10cSrcweir 	{
202cdf0e10cSrcweir         SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromAscii( UID_RPT_RPT_APP_VIEW ) );
203cdf0e10cSrcweir         aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pAddField->GetWindowState(WINDOWSTATE_MASK_ALL).GetBuffer() ) );
204cdf0e10cSrcweir         notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
205cdf0e10cSrcweir 		::std::auto_ptr<Window> aTemp2(m_pAddField);
206cdf0e10cSrcweir 		m_pAddField = NULL;
207cdf0e10cSrcweir 	}
208cdf0e10cSrcweir     if ( m_pReportExplorer )
209cdf0e10cSrcweir     {
210cdf0e10cSrcweir         SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_NAVIGATOR ) );
211cdf0e10cSrcweir         aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pReportExplorer->GetWindowState(WINDOWSTATE_MASK_ALL).GetBuffer() ) );
212cdf0e10cSrcweir         notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
213cdf0e10cSrcweir 		::std::auto_ptr<Window> aTemp2(m_pReportExplorer);
214cdf0e10cSrcweir 		m_pReportExplorer = NULL;
215cdf0e10cSrcweir 	}
216cdf0e10cSrcweir 	{
217cdf0e10cSrcweir 		::std::auto_ptr<Window> aTemp2(m_pTaskPane);
218cdf0e10cSrcweir 		m_pTaskPane = NULL;
219cdf0e10cSrcweir 	}
220cdf0e10cSrcweir }
221cdf0e10cSrcweir // -----------------------------------------------------------------------------
initialize()222cdf0e10cSrcweir void ODesignView::initialize()
223cdf0e10cSrcweir {
224cdf0e10cSrcweir 	SetMapMode( MapMode( MAP_100TH_MM ) );
225cdf0e10cSrcweir 	m_aScrollWindow.initialize();
226cdf0e10cSrcweir 	m_aScrollWindow.Show();
227cdf0e10cSrcweir }
228cdf0e10cSrcweir //-----------------------------------------------------------------------------
DataChanged(const DataChangedEvent & rDCEvt)229cdf0e10cSrcweir void ODesignView::DataChanged( const DataChangedEvent& rDCEvt )
230cdf0e10cSrcweir {
231cdf0e10cSrcweir 	ODataView::DataChanged( rDCEvt );
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
234cdf0e10cSrcweir 		 (rDCEvt.GetFlags() & SETTINGS_STYLE) )
235cdf0e10cSrcweir 	{
236cdf0e10cSrcweir 		ImplInitSettings();
237cdf0e10cSrcweir 		Invalidate();
238cdf0e10cSrcweir 	}
239cdf0e10cSrcweir }
240cdf0e10cSrcweir //------------------------------------------------------------------------------
PreNotify(NotifyEvent & rNEvt)241cdf0e10cSrcweir long ODesignView::PreNotify( NotifyEvent& rNEvt )
242cdf0e10cSrcweir {
243cdf0e10cSrcweir     long nRet = ODataView::PreNotify(rNEvt); // 1 := has to be handled here
244cdf0e10cSrcweir 	switch(rNEvt.GetType())
245cdf0e10cSrcweir 	{
246cdf0e10cSrcweir         case EVENT_KEYINPUT:
247cdf0e10cSrcweir             if ( (m_pPropWin && m_pPropWin->HasChildPathFocus()) )
248cdf0e10cSrcweir                 return 0L;
249cdf0e10cSrcweir             if ( (m_pAddField && m_pAddField->HasChildPathFocus()) )
250cdf0e10cSrcweir                 return 0L;
251cdf0e10cSrcweir             if ( (m_pReportExplorer && m_pReportExplorer->HasChildPathFocus()) )
252cdf0e10cSrcweir                 return 0L;
253cdf0e10cSrcweir             {
254cdf0e10cSrcweir                 const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
255cdf0e10cSrcweir                 if ( handleKeyEvent(*pKeyEvent) )
256cdf0e10cSrcweir                     nRet = 1L;
257cdf0e10cSrcweir                 else if ( nRet == 1L && m_pAccel.get() )
258cdf0e10cSrcweir                 {
259cdf0e10cSrcweir                     const KeyCode& rCode = pKeyEvent->GetKeyCode();
260cdf0e10cSrcweir                     util::URL aUrl;
261cdf0e10cSrcweir                     aUrl.Complete = m_pAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rCode));
262cdf0e10cSrcweir                     if ( !aUrl.Complete.getLength() || !m_rController.isCommandEnabled( aUrl.Complete ) )
263cdf0e10cSrcweir                         nRet = 0L;
264cdf0e10cSrcweir                 }
265cdf0e10cSrcweir             }
266cdf0e10cSrcweir             break;
267cdf0e10cSrcweir         default:
268cdf0e10cSrcweir             break;
269cdf0e10cSrcweir 	}
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 	return nRet;
272cdf0e10cSrcweir }
273cdf0e10cSrcweir //------------------------------------------------------------------------------
resizeDocumentView(Rectangle & _rPlayground)274cdf0e10cSrcweir void ODesignView::resizeDocumentView(Rectangle& _rPlayground)
275cdf0e10cSrcweir {
276cdf0e10cSrcweir 	if ( !_rPlayground.IsEmpty() )
277cdf0e10cSrcweir 	{
278cdf0e10cSrcweir 		const Size aPlaygroundSize( _rPlayground.GetSize() );
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 		// calc the split pos, and forward it to the controller
281cdf0e10cSrcweir 		sal_Int32 nSplitPos = getController().getSplitPos();
282cdf0e10cSrcweir 		if ( 0 != aPlaygroundSize.Width() )
283cdf0e10cSrcweir 		{
284cdf0e10cSrcweir 			if	(	( -1 == nSplitPos )
285cdf0e10cSrcweir 				||	( nSplitPos >= aPlaygroundSize.Width() )
286cdf0e10cSrcweir 				)
287cdf0e10cSrcweir 			{
288cdf0e10cSrcweir                 long nMinWidth = static_cast<long>(0.1*aPlaygroundSize.Width());
289cdf0e10cSrcweir                 if ( m_pPropWin && m_pPropWin->IsVisible() )
290cdf0e10cSrcweir                     nMinWidth = m_pPropWin->GetMinOutputSizePixel().Width();
291cdf0e10cSrcweir 				nSplitPos = static_cast<sal_Int32>(_rPlayground.Right() - nMinWidth);
292cdf0e10cSrcweir 				getController().setSplitPos(nSplitPos);
293cdf0e10cSrcweir 			}
294cdf0e10cSrcweir 		} // if ( 0 != _rPlaygroundSize.Width() )
295cdf0e10cSrcweir 
296cdf0e10cSrcweir         Size aReportWindowSize(aPlaygroundSize);
297cdf0e10cSrcweir         if ( m_aSplitWin.IsItemValid(TASKPANE_ID) )
298cdf0e10cSrcweir         {
299cdf0e10cSrcweir 		    // normalize the split pos
300cdf0e10cSrcweir             const long nSplitterWidth = GetSettings().GetStyleSettings().GetSplitSize();
301cdf0e10cSrcweir             Point aTaskPanePos(nSplitPos + nSplitterWidth, _rPlayground.Top());
302cdf0e10cSrcweir             if ( m_pTaskPane && m_pTaskPane->IsVisible() )
303cdf0e10cSrcweir             {
304cdf0e10cSrcweir                 aTaskPanePos.X() = aPlaygroundSize.Width() - m_pTaskPane->GetSizePixel().Width();
305cdf0e10cSrcweir                 sal_Int32 nMinWidth = m_pPropWin->getMinimumSize().Width();
306cdf0e10cSrcweir                 if ( nMinWidth > (aPlaygroundSize.Width() - aTaskPanePos.X()) )
307cdf0e10cSrcweir                 {
308cdf0e10cSrcweir                     aTaskPanePos.X() = aPlaygroundSize.Width() - nMinWidth;
309cdf0e10cSrcweir                 }
310cdf0e10cSrcweir                 nSplitPos = aTaskPanePos.X() - nSplitterWidth;
311cdf0e10cSrcweir                 getController().setSplitPos(nSplitPos);
312cdf0e10cSrcweir 
313cdf0e10cSrcweir                 const long nTaskPaneSize = static_cast<long>((aPlaygroundSize.Width() - aTaskPanePos.X())*100/aPlaygroundSize.Width());
314cdf0e10cSrcweir                 if ( m_aSplitWin.GetItemSize( TASKPANE_ID ) != nTaskPaneSize )
315cdf0e10cSrcweir                 {
316cdf0e10cSrcweir                     m_aSplitWin.SetItemSize( REPORT_ID, 99 - nTaskPaneSize );
317cdf0e10cSrcweir 		            m_aSplitWin.SetItemSize( TASKPANE_ID, nTaskPaneSize );
318cdf0e10cSrcweir                 }
319cdf0e10cSrcweir             }
320cdf0e10cSrcweir         }
321cdf0e10cSrcweir         // set the size of the report window
322cdf0e10cSrcweir         m_aSplitWin.SetPosSizePixel( _rPlayground.TopLeft(),aPlaygroundSize );
323cdf0e10cSrcweir 	}
324cdf0e10cSrcweir     	// just for completeness: there is no space left, we occupied it all ...
325cdf0e10cSrcweir 	_rPlayground.SetPos( _rPlayground.BottomRight() );
326cdf0e10cSrcweir 	_rPlayground.SetSize( Size( 0, 0 ) );
327cdf0e10cSrcweir 
328cdf0e10cSrcweir }
329cdf0e10cSrcweir // -----------------------------------------------------------------------------
330cdf0e10cSrcweir // set the view readonly or not
setReadOnly(sal_Bool)331cdf0e10cSrcweir void ODesignView::setReadOnly(sal_Bool /*_bReadOnly*/)
332cdf0e10cSrcweir {
333cdf0e10cSrcweir }
334cdf0e10cSrcweir //----------------------------------------------------------------------------
IMPL_LINK(ODesignView,MarkTimeout,Timer *,EMPTYARG)335cdf0e10cSrcweir IMPL_LINK( ODesignView, MarkTimeout, Timer *, EMPTYARG )
336cdf0e10cSrcweir {
337cdf0e10cSrcweir 	if ( m_pPropWin && m_pPropWin->IsVisible() )
338cdf0e10cSrcweir 	{
339cdf0e10cSrcweir 		m_pPropWin->Update(m_pCurrentView);
340cdf0e10cSrcweir         uno::Reference<beans::XPropertySet> xProp(m_xReportComponent,uno::UNO_QUERY);
341cdf0e10cSrcweir 		if ( xProp.is() )
342cdf0e10cSrcweir         {
343cdf0e10cSrcweir 			m_pPropWin->Update(xProp);
344cdf0e10cSrcweir             static_cast<OTaskWindow*>(m_pTaskPane)->Resize();
345cdf0e10cSrcweir         }
346cdf0e10cSrcweir         Resize();
347cdf0e10cSrcweir 	}
348cdf0e10cSrcweir 
349cdf0e10cSrcweir     return 0;
350cdf0e10cSrcweir }
351cdf0e10cSrcweir 
352cdf0e10cSrcweir //----------------------------------------------------------------------------
SetMode(DlgEdMode _eNewMode)353cdf0e10cSrcweir void ODesignView::SetMode( DlgEdMode _eNewMode )
354cdf0e10cSrcweir {
355cdf0e10cSrcweir 	m_eMode = _eNewMode;
356cdf0e10cSrcweir     if ( m_eMode == RPTUI_SELECT )
357cdf0e10cSrcweir         m_eActObj = OBJ_NONE;
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 	m_aScrollWindow.SetMode(_eNewMode);
360cdf0e10cSrcweir }
361cdf0e10cSrcweir //----------------------------------------------------------------------------
SetInsertObj(sal_uInt16 eObj,const::rtl::OUString & _sShapeType)362cdf0e10cSrcweir void ODesignView::SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType )
363cdf0e10cSrcweir {
364cdf0e10cSrcweir 	m_eActObj = eObj;
365cdf0e10cSrcweir 	m_aScrollWindow.SetInsertObj( eObj,_sShapeType );
366cdf0e10cSrcweir }
367cdf0e10cSrcweir //----------------------------------------------------------------------------
GetInsertObjString() const368cdf0e10cSrcweir rtl::OUString ODesignView::GetInsertObjString() const
369cdf0e10cSrcweir {
370cdf0e10cSrcweir 	return m_aScrollWindow.GetInsertObjString();
371cdf0e10cSrcweir }
372cdf0e10cSrcweir //----------------------------------------------------------------------------
373cdf0e10cSrcweir 
GetInsertObj() const374cdf0e10cSrcweir sal_uInt16 ODesignView::GetInsertObj() const
375cdf0e10cSrcweir {
376cdf0e10cSrcweir 	return m_eActObj;
377cdf0e10cSrcweir }
378cdf0e10cSrcweir 
379cdf0e10cSrcweir //----------------------------------------------------------------------------
Cut()380cdf0e10cSrcweir void ODesignView::Cut()
381cdf0e10cSrcweir {
382cdf0e10cSrcweir 	Copy();
383cdf0e10cSrcweir 	Delete();
384cdf0e10cSrcweir }
385cdf0e10cSrcweir 
386cdf0e10cSrcweir //----------------------------------------------------------------------------
387cdf0e10cSrcweir 
Copy()388cdf0e10cSrcweir void ODesignView::Copy()
389cdf0e10cSrcweir {
390cdf0e10cSrcweir     m_aScrollWindow.Copy();
391cdf0e10cSrcweir }
392cdf0e10cSrcweir 
393cdf0e10cSrcweir //----------------------------------------------------------------------------
394cdf0e10cSrcweir 
Paste()395cdf0e10cSrcweir void ODesignView::Paste()
396cdf0e10cSrcweir {
397cdf0e10cSrcweir     m_aScrollWindow.Paste();
398cdf0e10cSrcweir }
399cdf0e10cSrcweir //----------------------------------------------------------------------------
Delete()400cdf0e10cSrcweir void ODesignView::Delete()
401cdf0e10cSrcweir {
402cdf0e10cSrcweir 	m_aScrollWindow.Delete();
403cdf0e10cSrcweir }
404cdf0e10cSrcweir //----------------------------------------------------------------------------
HasSelection() const405cdf0e10cSrcweir sal_Bool ODesignView::HasSelection() const
406cdf0e10cSrcweir {
407cdf0e10cSrcweir 	return m_aScrollWindow.HasSelection();
408cdf0e10cSrcweir }
409cdf0e10cSrcweir //----------------------------------------------------------------------------
410cdf0e10cSrcweir 
IsPasteAllowed() const411cdf0e10cSrcweir sal_Bool ODesignView::IsPasteAllowed() const
412cdf0e10cSrcweir {
413cdf0e10cSrcweir     return m_aScrollWindow.IsPasteAllowed();
414cdf0e10cSrcweir }
415cdf0e10cSrcweir 
416cdf0e10cSrcweir //----------------------------------------------------------------------------
UpdatePropertyBrowserDelayed(OSectionView & _rView)417cdf0e10cSrcweir void ODesignView::UpdatePropertyBrowserDelayed(OSectionView& _rView)
418cdf0e10cSrcweir {
419cdf0e10cSrcweir 	if ( m_pCurrentView != &_rView )
420cdf0e10cSrcweir 	{
421cdf0e10cSrcweir 		if ( m_pCurrentView )
422cdf0e10cSrcweir 			m_aScrollWindow.setMarked(m_pCurrentView,sal_False);
423cdf0e10cSrcweir 		m_pCurrentView = &_rView;
424cdf0e10cSrcweir 		if ( m_pCurrentView )
425cdf0e10cSrcweir 			m_aScrollWindow.setMarked(m_pCurrentView,sal_True);
426cdf0e10cSrcweir 		m_xReportComponent.clear();
427cdf0e10cSrcweir         DlgEdHint aHint( RPTUI_HINT_SELECTIONCHANGED );
428cdf0e10cSrcweir 		Broadcast( aHint );
429cdf0e10cSrcweir 	}
430cdf0e10cSrcweir     m_aMarkTimer.Start();
431cdf0e10cSrcweir }
432cdf0e10cSrcweir 
433cdf0e10cSrcweir //----------------------------------------------------------------------------
toggleGrid(sal_Bool _bGridVisible)434cdf0e10cSrcweir void ODesignView::toggleGrid(sal_Bool _bGridVisible)
435cdf0e10cSrcweir {
436cdf0e10cSrcweir 	 m_aScrollWindow.toggleGrid(_bGridVisible);
437cdf0e10cSrcweir }
438cdf0e10cSrcweir //----------------------------------------------------------------------------
getSectionCount() const439cdf0e10cSrcweir sal_uInt16 ODesignView::getSectionCount() const
440cdf0e10cSrcweir {
441cdf0e10cSrcweir     return m_aScrollWindow.getSectionCount();
442cdf0e10cSrcweir }
443cdf0e10cSrcweir //----------------------------------------------------------------------------
showRuler(sal_Bool _bShow)444cdf0e10cSrcweir void ODesignView::showRuler(sal_Bool _bShow)
445cdf0e10cSrcweir {
446cdf0e10cSrcweir 	 m_aScrollWindow.showRuler(_bShow);
447cdf0e10cSrcweir }
448cdf0e10cSrcweir //----------------------------------------------------------------------------
removeSection(sal_uInt16 _nPosition)449cdf0e10cSrcweir void ODesignView::removeSection(sal_uInt16 _nPosition)
450cdf0e10cSrcweir {
451cdf0e10cSrcweir 	 m_aScrollWindow.removeSection(_nPosition);
452cdf0e10cSrcweir }
453cdf0e10cSrcweir //----------------------------------------------------------------------------
addSection(const uno::Reference<report::XSection> & _xSection,const::rtl::OUString & _sColorEntry,sal_uInt16 _nPosition)454cdf0e10cSrcweir void ODesignView::addSection(const uno::Reference< report::XSection >& _xSection,const ::rtl::OUString& _sColorEntry,sal_uInt16 _nPosition)
455cdf0e10cSrcweir {
456cdf0e10cSrcweir 	 m_aScrollWindow.addSection(_xSection,_sColorEntry,_nPosition);
457cdf0e10cSrcweir }
458cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetFocus()459cdf0e10cSrcweir void ODesignView::GetFocus()
460cdf0e10cSrcweir {
461cdf0e10cSrcweir 	Window::GetFocus();
462cdf0e10cSrcweir 
463cdf0e10cSrcweir     if ( !m_bDeleted )
464cdf0e10cSrcweir     {
465cdf0e10cSrcweir         ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aScrollWindow.getMarkedSection();
466cdf0e10cSrcweir         if ( pSectionWindow )
467cdf0e10cSrcweir 		    pSectionWindow->GrabFocus();
468cdf0e10cSrcweir     }
469cdf0e10cSrcweir }
470cdf0e10cSrcweir // -----------------------------------------------------------------------------
ImplInitSettings()471cdf0e10cSrcweir void ODesignView::ImplInitSettings()
472cdf0e10cSrcweir {
473cdf0e10cSrcweir //#if OSL_DEBUG_LEVEL > 0
474cdf0e10cSrcweir //    SetBackground( Wallpaper( COL_RED ));
475cdf0e10cSrcweir //#else
476cdf0e10cSrcweir     SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ));
477cdf0e10cSrcweir //#endif
478cdf0e10cSrcweir 	SetFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
479cdf0e10cSrcweir 	SetTextFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
480cdf0e10cSrcweir }
481cdf0e10cSrcweir //-----------------------------------------------------------------------------
482cdf0e10cSrcweir IMPL_LINK( ODesignView, SplitHdl, void*,  )
483cdf0e10cSrcweir {
484cdf0e10cSrcweir 	const Size aOutputSize = GetOutputSizePixel();
485cdf0e10cSrcweir     const long nTest = aOutputSize.Width() * m_aSplitWin.GetItemSize(TASKPANE_ID) / 100;
486cdf0e10cSrcweir     long nMinWidth = static_cast<long>(0.1*aOutputSize.Width());
487cdf0e10cSrcweir     if ( m_pPropWin && m_pPropWin->IsVisible() )
488cdf0e10cSrcweir         nMinWidth = m_pPropWin->GetMinOutputSizePixel().Width();
489cdf0e10cSrcweir 
490cdf0e10cSrcweir 	if ( (aOutputSize.Width() - nTest) >= nMinWidth && nTest > m_aScrollWindow.getMaxMarkerWidth(sal_False) )
491cdf0e10cSrcweir 	{
492cdf0e10cSrcweir         long nOldSplitPos = getController().getSplitPos();
493cdf0e10cSrcweir         (void)nOldSplitPos;
494cdf0e10cSrcweir 		getController().setSplitPos(nTest);
495cdf0e10cSrcweir 	}
496cdf0e10cSrcweir 
497cdf0e10cSrcweir 	return 0L;
498cdf0e10cSrcweir }
499cdf0e10cSrcweir //-----------------------------------------------------------------------------
SelectAll(const sal_uInt16 _nObjectType)500cdf0e10cSrcweir void ODesignView::SelectAll(const sal_uInt16 _nObjectType)
501cdf0e10cSrcweir {
502cdf0e10cSrcweir 	 m_aScrollWindow.SelectAll(_nObjectType);
503cdf0e10cSrcweir }
504cdf0e10cSrcweir //-----------------------------------------------------------------------------
unmarkAllObjects(OSectionView * _pSectionView)505cdf0e10cSrcweir void ODesignView::unmarkAllObjects(OSectionView* _pSectionView)
506cdf0e10cSrcweir {
507cdf0e10cSrcweir 	m_aScrollWindow.unmarkAllObjects(_pSectionView);
508cdf0e10cSrcweir }
509cdf0e10cSrcweir //-----------------------------------------------------------------------------
togglePropertyBrowser(sal_Bool _bToogleOn)510cdf0e10cSrcweir void ODesignView::togglePropertyBrowser(sal_Bool _bToogleOn)
511cdf0e10cSrcweir {
512cdf0e10cSrcweir 	if ( !m_pPropWin && _bToogleOn )
513cdf0e10cSrcweir     {
514cdf0e10cSrcweir 		m_pPropWin = new PropBrw(getController().getORB(),m_pTaskPane,this);
515cdf0e10cSrcweir         m_pPropWin->Invalidate();
516cdf0e10cSrcweir         static_cast<OTaskWindow*>(m_pTaskPane)->setPropertyBrowser(m_pPropWin);
517cdf0e10cSrcweir         notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::AddWindow));
518cdf0e10cSrcweir     }
519cdf0e10cSrcweir 	if ( m_pPropWin && _bToogleOn != m_pPropWin->IsVisible() )
520cdf0e10cSrcweir 	{
521cdf0e10cSrcweir 		if ( !m_pCurrentView && !m_xReportComponent.is() )
522cdf0e10cSrcweir 			m_xReportComponent = getController().getReportDefinition();
523cdf0e10cSrcweir 
524cdf0e10cSrcweir         const sal_Bool bWillBeVisible = _bToogleOn;
525cdf0e10cSrcweir 		m_pPropWin->Show(bWillBeVisible);
526cdf0e10cSrcweir         m_pTaskPane->Show(bWillBeVisible);
527cdf0e10cSrcweir         m_pTaskPane->Invalidate();
528cdf0e10cSrcweir 
529cdf0e10cSrcweir         if ( bWillBeVisible )
530cdf0e10cSrcweir             m_aSplitWin.InsertItem( TASKPANE_ID, m_pTaskPane,START_SIZE_TASKPANE, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE/*|SWIB_COLSET */);
531cdf0e10cSrcweir         else
532cdf0e10cSrcweir             m_aSplitWin.RemoveItem(TASKPANE_ID);
533cdf0e10cSrcweir 
534cdf0e10cSrcweir         // TRY
535cdf0e10cSrcweir         // Invalidate(/*INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE*/);
536cdf0e10cSrcweir 		if ( bWillBeVisible )
537cdf0e10cSrcweir 			m_aMarkTimer.Start();
538cdf0e10cSrcweir 	}
539cdf0e10cSrcweir }
540cdf0e10cSrcweir //-----------------------------------------------------------------------------
showProperties(const uno::Reference<uno::XInterface> & _xReportComponent)541cdf0e10cSrcweir void ODesignView::showProperties(const uno::Reference< uno::XInterface>& _xReportComponent)
542cdf0e10cSrcweir {
543cdf0e10cSrcweir     if ( m_xReportComponent != _xReportComponent )
544cdf0e10cSrcweir     {
545cdf0e10cSrcweir 	    m_xReportComponent = _xReportComponent;
546cdf0e10cSrcweir 	    if ( m_pCurrentView )
547cdf0e10cSrcweir 		    m_aScrollWindow.setMarked(m_pCurrentView,sal_False);
548cdf0e10cSrcweir 	    m_pCurrentView = NULL;
549cdf0e10cSrcweir         m_aMarkTimer.Start();
550cdf0e10cSrcweir     }
551cdf0e10cSrcweir }
552cdf0e10cSrcweir //-----------------------------------------------------------------------------
isReportExplorerVisible() const553cdf0e10cSrcweir sal_Bool ODesignView::isReportExplorerVisible() const
554cdf0e10cSrcweir {
555cdf0e10cSrcweir 	return m_pReportExplorer && m_pReportExplorer->IsVisible();
556cdf0e10cSrcweir }
557cdf0e10cSrcweir //-----------------------------------------------------------------------------
toggleReportExplorer()558cdf0e10cSrcweir void ODesignView::toggleReportExplorer()
559cdf0e10cSrcweir {
560cdf0e10cSrcweir     if ( !m_pReportExplorer )
561cdf0e10cSrcweir     {
562cdf0e10cSrcweir         OReportController& rReportController = getController();
563cdf0e10cSrcweir         m_pReportExplorer = new ONavigator(this,rReportController);
564cdf0e10cSrcweir         SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_NAVIGATOR ) );
565cdf0e10cSrcweir         if ( aDlgOpt.Exists() )
566cdf0e10cSrcweir             m_pReportExplorer->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
567cdf0e10cSrcweir         m_pReportExplorer->AddEventListener(LINK(&rReportController,OReportController,EventLstHdl));
568cdf0e10cSrcweir         notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::AddWindow));
569cdf0e10cSrcweir     }
570cdf0e10cSrcweir     else
571cdf0e10cSrcweir 		m_pReportExplorer->Show(!m_pReportExplorer->IsVisible());
572cdf0e10cSrcweir }
573cdf0e10cSrcweir //-----------------------------------------------------------------------------
isAddFieldVisible() const574cdf0e10cSrcweir sal_Bool ODesignView::isAddFieldVisible() const
575cdf0e10cSrcweir {
576cdf0e10cSrcweir 	return m_pAddField && m_pAddField->IsVisible();
577cdf0e10cSrcweir }
578cdf0e10cSrcweir //-----------------------------------------------------------------------------
toggleAddField()579cdf0e10cSrcweir void ODesignView::toggleAddField()
580cdf0e10cSrcweir {
581cdf0e10cSrcweir     if ( !m_pAddField )
582cdf0e10cSrcweir 	{
583cdf0e10cSrcweir 		uno::Reference< report::XReportDefinition > xReport(m_xReportComponent,uno::UNO_QUERY);
584cdf0e10cSrcweir         uno::Reference< report::XReportComponent > xReportComponent(m_xReportComponent,uno::UNO_QUERY);
585cdf0e10cSrcweir         OReportController& rReportController = getController();
586cdf0e10cSrcweir         if ( !m_pCurrentView && !xReport.is() )
587cdf0e10cSrcweir 		{
588cdf0e10cSrcweir 			if ( xReportComponent.is() )
589cdf0e10cSrcweir 				xReport = xReportComponent->getSection()->getReportDefinition();
590cdf0e10cSrcweir 			else
591cdf0e10cSrcweir 				xReport = rReportController.getReportDefinition().get();
592cdf0e10cSrcweir 		}
593cdf0e10cSrcweir         else if ( m_pCurrentView )
594cdf0e10cSrcweir         {
595cdf0e10cSrcweir             uno::Reference< report::XSection > xSection = m_pCurrentView->getReportSection()->getSection();
596cdf0e10cSrcweir 			xReport = xSection->getReportDefinition();
597cdf0e10cSrcweir         }
598cdf0e10cSrcweir 		uno::Reference < beans::XPropertySet > xSet(rReportController.getRowSet(),uno::UNO_QUERY);
599cdf0e10cSrcweir 		m_pAddField = new OAddFieldWindow(this,xSet);
600cdf0e10cSrcweir         m_pAddField->SetCreateHdl(LINK( &rReportController, OReportController, OnCreateHdl ) );
601cdf0e10cSrcweir         SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromAscii( UID_RPT_RPT_APP_VIEW ) );
602cdf0e10cSrcweir         if ( aDlgOpt.Exists() )
603cdf0e10cSrcweir             m_pAddField->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
604cdf0e10cSrcweir         m_pAddField->Update();
605cdf0e10cSrcweir 		m_pAddField->AddEventListener(LINK(&rReportController,OReportController,EventLstHdl));
606cdf0e10cSrcweir         notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::AddWindow));
607cdf0e10cSrcweir         m_pAddField->Show();
608cdf0e10cSrcweir 	}
609cdf0e10cSrcweir 	else
610cdf0e10cSrcweir 		m_pAddField->Show(!m_pAddField->IsVisible());
611cdf0e10cSrcweir }
612cdf0e10cSrcweir // -------------------------------------------------------------------------
getCurrentSection() const613cdf0e10cSrcweir uno::Reference< report::XSection > ODesignView::getCurrentSection() const
614cdf0e10cSrcweir {
615cdf0e10cSrcweir 	uno::Reference< report::XSection > xSection;
616cdf0e10cSrcweir 	if ( m_pCurrentView )
617cdf0e10cSrcweir 		xSection = m_pCurrentView->getReportSection()->getSection();
618cdf0e10cSrcweir 
619cdf0e10cSrcweir     // why do we need the code below?
620cdf0e10cSrcweir 	//else
621cdf0e10cSrcweir  //   {
622cdf0e10cSrcweir  //       OReportController& rReportController = getController();
623cdf0e10cSrcweir  //       xSection = rReportController.getReportDefinition()->getDetail();
624cdf0e10cSrcweir  //   }
625cdf0e10cSrcweir 	return xSection;
626cdf0e10cSrcweir }
627cdf0e10cSrcweir // -----------------------------------------------------------------------------
getCurrentControlModel() const628cdf0e10cSrcweir uno::Reference< report::XReportComponent > ODesignView::getCurrentControlModel() const
629cdf0e10cSrcweir {
630cdf0e10cSrcweir 	uno::Reference< report::XReportComponent > xModel;
631cdf0e10cSrcweir 	if ( m_pCurrentView )
632cdf0e10cSrcweir 	{
633cdf0e10cSrcweir 		xModel = m_pCurrentView->getReportSection()->getCurrentControlModel();
634cdf0e10cSrcweir 	}
635cdf0e10cSrcweir 	return xModel;
636cdf0e10cSrcweir }
637cdf0e10cSrcweir // -------------------------------------------------------------------------
getMarkedSection(NearSectionAccess nsa) const638cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> ODesignView::getMarkedSection(NearSectionAccess nsa) const
639cdf0e10cSrcweir {
640cdf0e10cSrcweir 	return  m_aScrollWindow.getMarkedSection(nsa);
641cdf0e10cSrcweir }
642cdf0e10cSrcweir //-----------------------------------------------------------------------------
getSectionWindow(const::com::sun::star::uno::Reference<::com::sun::star::report::XSection> & _xSection) const643cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
644cdf0e10cSrcweir {
645cdf0e10cSrcweir 	return  m_aScrollWindow.getSectionWindow(_xSection);
646cdf0e10cSrcweir }
647cdf0e10cSrcweir // -------------------------------------------------------------------------
markSection(const sal_uInt16 _nPos)648cdf0e10cSrcweir void ODesignView::markSection(const sal_uInt16 _nPos)
649cdf0e10cSrcweir {
650cdf0e10cSrcweir 	m_aScrollWindow.markSection(_nPos);
651cdf0e10cSrcweir }
652cdf0e10cSrcweir // -----------------------------------------------------------------------------
fillCollapsedSections(::std::vector<sal_uInt16> & _rCollapsedPositions) const653cdf0e10cSrcweir void ODesignView::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
654cdf0e10cSrcweir {
655cdf0e10cSrcweir     m_aScrollWindow.fillCollapsedSections(_rCollapsedPositions);
656cdf0e10cSrcweir }
657cdf0e10cSrcweir // -----------------------------------------------------------------------------
collapseSections(const uno::Sequence<beans::PropertyValue> & _aCollpasedSections)658cdf0e10cSrcweir void ODesignView::collapseSections(const uno::Sequence< beans::PropertyValue>& _aCollpasedSections)
659cdf0e10cSrcweir {
660cdf0e10cSrcweir     m_aScrollWindow.collapseSections(_aCollpasedSections);
661cdf0e10cSrcweir }
662cdf0e10cSrcweir // -----------------------------------------------------------------------------
getCurrentPage() const663cdf0e10cSrcweir ::rtl::OUString ODesignView::getCurrentPage() const
664cdf0e10cSrcweir {
665cdf0e10cSrcweir     return m_pPropWin ? m_pPropWin->getCurrentPage() : ::rtl::OUString();
666cdf0e10cSrcweir }
667cdf0e10cSrcweir // -----------------------------------------------------------------------------
setCurrentPage(const::rtl::OUString & _sLastActivePage)668cdf0e10cSrcweir void ODesignView::setCurrentPage(const ::rtl::OUString& _sLastActivePage)
669cdf0e10cSrcweir {
670cdf0e10cSrcweir     if ( m_pPropWin )
671cdf0e10cSrcweir         m_pPropWin->setCurrentPage(_sLastActivePage);
672cdf0e10cSrcweir }
673cdf0e10cSrcweir // -----------------------------------------------------------------------------
alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection,bool bBoundRects)674cdf0e10cSrcweir void ODesignView::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects)
675cdf0e10cSrcweir {
676cdf0e10cSrcweir     m_aScrollWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection,bBoundRects);
677cdf0e10cSrcweir }
678cdf0e10cSrcweir #if 0
679cdf0e10cSrcweir // -----------------------------------------------------------------------------
680cdf0e10cSrcweir sal_Bool ODesignView::isAlignPossible() const
681cdf0e10cSrcweir {
682cdf0e10cSrcweir     ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection();
683cdf0e10cSrcweir     return pMarkedSection.get() && pMarkedSection->getReportSection().getSectionView().IsAlignPossible();
684cdf0e10cSrcweir }
685cdf0e10cSrcweir #endif
686cdf0e10cSrcweir //------------------------------------------------------------------------------
handleKeyEvent(const KeyEvent & _rEvent)687cdf0e10cSrcweir sal_Bool ODesignView::handleKeyEvent(const KeyEvent& _rEvent)
688cdf0e10cSrcweir {
689cdf0e10cSrcweir     if ( (m_pPropWin && m_pPropWin->HasChildPathFocus()) )
690cdf0e10cSrcweir         return sal_False;
691cdf0e10cSrcweir     if ( (m_pAddField && m_pAddField->HasChildPathFocus()) )
692cdf0e10cSrcweir         return sal_False;
693cdf0e10cSrcweir     if ( (m_pReportExplorer && m_pReportExplorer->HasChildPathFocus()) )
694cdf0e10cSrcweir         return sal_False;
695cdf0e10cSrcweir 	return m_aScrollWindow.handleKeyEvent(_rEvent);
696cdf0e10cSrcweir }
697cdf0e10cSrcweir //------------------------------------------------------------------------
setMarked(const uno::Reference<report::XSection> & _xSection,sal_Bool _bMark)698cdf0e10cSrcweir void ODesignView::setMarked(const uno::Reference< report::XSection>& _xSection,sal_Bool _bMark)
699cdf0e10cSrcweir {
700cdf0e10cSrcweir 	m_aScrollWindow.setMarked(_xSection,_bMark);
701cdf0e10cSrcweir     if ( _bMark )
702cdf0e10cSrcweir         UpdatePropertyBrowserDelayed(getMarkedSection()->getReportSection().getSectionView());
703cdf0e10cSrcweir     else
704cdf0e10cSrcweir         m_pCurrentView = NULL;
705cdf0e10cSrcweir }
706cdf0e10cSrcweir //------------------------------------------------------------------------
setMarked(const uno::Sequence<uno::Reference<report::XReportComponent>> & _aShapes,sal_Bool _bMark)707cdf0e10cSrcweir void ODesignView::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _aShapes,sal_Bool _bMark)
708cdf0e10cSrcweir {
709cdf0e10cSrcweir 	m_aScrollWindow.setMarked(_aShapes,_bMark);
710cdf0e10cSrcweir     if ( _aShapes.hasElements() && _bMark )
711cdf0e10cSrcweir         showProperties(_aShapes[0]);
712cdf0e10cSrcweir     else
713cdf0e10cSrcweir         m_xReportComponent.clear();
714cdf0e10cSrcweir }
715cdf0e10cSrcweir //------------------------------------------------------------------------------
MouseButtonDown(const MouseEvent & rMEvt)716cdf0e10cSrcweir void ODesignView::MouseButtonDown( const MouseEvent& rMEvt )
717cdf0e10cSrcweir {
718cdf0e10cSrcweir 	if ( rMEvt.IsLeft() )
719cdf0e10cSrcweir 	{
720cdf0e10cSrcweir 		const uno::Sequence< beans::PropertyValue> aArgs;
721cdf0e10cSrcweir 		getController().executeChecked(SID_SELECT_REPORT,aArgs);
722cdf0e10cSrcweir 	}
723cdf0e10cSrcweir     ODataView::MouseButtonDown(rMEvt);
724cdf0e10cSrcweir }
725cdf0e10cSrcweir // -----------------------------------------------------------------------------
getCurrentlyShownProperty() const726cdf0e10cSrcweir uno::Any ODesignView::getCurrentlyShownProperty() const
727cdf0e10cSrcweir {
728cdf0e10cSrcweir     uno::Any aRet;
729cdf0e10cSrcweir     ::boost::shared_ptr<OSectionWindow> pSectionWindow = getMarkedSection();
730cdf0e10cSrcweir     if ( pSectionWindow )
731cdf0e10cSrcweir     {
732cdf0e10cSrcweir         ::std::vector< uno::Reference< uno::XInterface > > aSelection;
733cdf0e10cSrcweir         pSectionWindow->getReportSection().fillControlModelSelection(aSelection);
734cdf0e10cSrcweir         if ( !aSelection.empty() )
735cdf0e10cSrcweir         {
736cdf0e10cSrcweir             ::std::vector< uno::Reference< uno::XInterface > >::iterator aIter = aSelection.begin();
737cdf0e10cSrcweir             uno::Sequence< uno::Reference< report::XReportComponent > > aSeq(aSelection.size());
738cdf0e10cSrcweir             for(sal_Int32 i = 0; i < aSeq.getLength(); ++i,++aIter)
739cdf0e10cSrcweir             {
740cdf0e10cSrcweir                 aSeq[i].set(*aIter,uno::UNO_QUERY);
741cdf0e10cSrcweir             }
742cdf0e10cSrcweir             aRet <<= aSeq;
743cdf0e10cSrcweir         }
744cdf0e10cSrcweir     }
745cdf0e10cSrcweir     return aRet;
746cdf0e10cSrcweir }
747cdf0e10cSrcweir // -----------------------------------------------------------------------------
fillControlModelSelection(::std::vector<uno::Reference<uno::XInterface>> & _rSelection) const748cdf0e10cSrcweir void ODesignView::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
749cdf0e10cSrcweir {
750cdf0e10cSrcweir     m_aScrollWindow.fillControlModelSelection(_rSelection);
751cdf0e10cSrcweir }
752cdf0e10cSrcweir // -----------------------------------------------------------------------------
setGridSnap(sal_Bool bOn)753cdf0e10cSrcweir void ODesignView::setGridSnap(sal_Bool bOn)
754cdf0e10cSrcweir {
755cdf0e10cSrcweir     m_aScrollWindow.setGridSnap(bOn);
756cdf0e10cSrcweir 
757cdf0e10cSrcweir }
758cdf0e10cSrcweir // -----------------------------------------------------------------------------
setDragStripes(sal_Bool bOn)759cdf0e10cSrcweir void ODesignView::setDragStripes(sal_Bool bOn)
760cdf0e10cSrcweir {
761cdf0e10cSrcweir     m_aScrollWindow.setDragStripes(bOn);
762cdf0e10cSrcweir }
763cdf0e10cSrcweir // -----------------------------------------------------------------------------
isHandleEvent(sal_uInt16) const764cdf0e10cSrcweir sal_Bool ODesignView::isHandleEvent(sal_uInt16 /*_nId*/) const
765cdf0e10cSrcweir {
766cdf0e10cSrcweir     return m_pPropWin && m_pPropWin->HasChildPathFocus();
767cdf0e10cSrcweir }
768cdf0e10cSrcweir // -----------------------------------------------------------------------------
getMarkedObjectCount() const769cdf0e10cSrcweir sal_uInt32 ODesignView::getMarkedObjectCount() const
770cdf0e10cSrcweir {
771cdf0e10cSrcweir     return m_aScrollWindow.getMarkedObjectCount();
772cdf0e10cSrcweir }
773cdf0e10cSrcweir // -----------------------------------------------------------------------------
zoom(const Fraction & _aZoom)774cdf0e10cSrcweir void ODesignView::zoom(const Fraction& _aZoom)
775cdf0e10cSrcweir {
776cdf0e10cSrcweir     m_aScrollWindow.zoom(_aZoom);
777cdf0e10cSrcweir }
778cdf0e10cSrcweir // -----------------------------------------------------------------------------
getZoomFactor(SvxZoomType _eType) const779cdf0e10cSrcweir sal_uInt16 ODesignView::getZoomFactor(SvxZoomType _eType) const
780cdf0e10cSrcweir {
781cdf0e10cSrcweir     return m_aScrollWindow.getZoomFactor(_eType);
782cdf0e10cSrcweir }
783cdf0e10cSrcweir //============================================================================
784cdf0e10cSrcweir } // rptui
785cdf0e10cSrcweir //============================================================================
786