1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DesignView.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include "precompiled_reportdesign.hxx"
32 #include "DesignView.hxx"
33 #include <tools/debug.hxx>
34 #include "ReportController.hxx"
35 #include <comphelper/types.hxx>
36 #include <svtools/syslocale.hxx>
37 #include <svtools/viewoptions.hxx>
39 #include "UITools.hxx"
40 #include "RptObject.hxx"
41 #include "propbrw.hxx"
42 #include <toolkit/helper/convert.hxx>
43 #include "helpids.hrc"
44 #include "SectionView.hxx"
45 #include "ReportSection.hxx"
46 #include "rptui_slotid.hrc"
47 #include <svx/svxids.hrc>
48 #include "AddField.hxx"
49 #include "ScrollHelper.hxx"
50 #include "Navigator.hxx"
51 #include "SectionWindow.hxx"
52 #include "RptResId.hrc"
53 #include <vcl/svapp.hxx>
57 using namespace ::dbaui
;
58 using namespace ::utl
;
59 using namespace ::com::sun::star
;
62 using namespace beans
;
63 using namespace container
;
66 #define START_SIZE_TASKPANE 30
71 class OTaskWindow
: public Window
75 OTaskWindow(Window
* _pParent
) : Window(_pParent
),m_pPropWin(NULL
){}
77 inline void setPropertyBrowser(PropBrw
* _pPropWin
)
79 m_pPropWin
= _pPropWin
;
84 const Size aSize
= GetOutputSizePixel();
85 if ( m_pPropWin
&& aSize
.Height() && aSize
.Width() )
86 m_pPropWin
->SetSizePixel(aSize
);
88 long getMinimumWidth() const
92 nRet
= m_pPropWin
->getMinimumSize().Width();
96 class OwnSplitWindow
: public SplitWindow
99 OwnSplitWindow(Window
* pParent
) : SplitWindow(pParent
,WB_DIALOGCONTROL
){SetBackground( );}
103 SplitWindow::Split();
108 const long nOutWidth
= GetOutputSizePixel().Width();
109 long nTaskPaneMinSplitSize
= static_cast<OTaskWindow
*>(GetItemWindow(TASKPANE_ID
))->getMinimumWidth();
110 nTaskPaneMinSplitSize
= static_cast<long>(nTaskPaneMinSplitSize
*100/nOutWidth
);
111 if ( !nTaskPaneMinSplitSize
)
112 nTaskPaneMinSplitSize
= START_SIZE_TASKPANE
;
114 const long nReportMinSplitSize
= static_cast<long>(12000/nOutWidth
);
116 long nReportSize
= GetItemSize( REPORT_ID
);
117 long nTaskPaneSize
= GetItemSize( TASKPANE_ID
);
120 if( nReportSize
< nReportMinSplitSize
)
122 nReportSize
= nReportMinSplitSize
;
123 nTaskPaneSize
= 99 - nReportMinSplitSize
;
127 else if( nTaskPaneSize
< nTaskPaneMinSplitSize
)
129 nTaskPaneSize
= nTaskPaneMinSplitSize
;
130 nReportSize
= 99 - nTaskPaneMinSplitSize
;
137 SetItemSize( REPORT_ID
, nReportSize
);
138 SetItemSize( TASKPANE_ID
, nTaskPaneSize
);
142 //==================================================================
144 //==================================================================
145 DBG_NAME( rpt_ODesignView
)
146 //------------------------------------------------------------------------------
147 ODesignView::ODesignView( Window
* pParent
,
148 const Reference
< XMultiServiceFactory
>& _rxOrb
,
149 OReportController
& _rController
) :
150 ODataView( pParent
, _rController
, _rxOrb
, WB_DIALOGCONTROL
)
152 ,m_rReportController( _rController
)
153 ,m_aScrollWindow(this)
156 ,m_pCurrentView(NULL
)
157 ,m_pReportExplorer(NULL
)
158 ,m_eMode( RPTUI_SELECT
)
159 ,m_nCurrentPosition(USHRT_MAX
)
160 ,m_eActObj( OBJ_NONE
)
162 ,m_aGridSizeCoarse( 1000, 1000 ) // #i93595# 100TH_MM changed to grid using coarse 1 cm grid
163 ,m_aGridSizeFine( 250, 250 ) // and a 0,25 cm subdivision for better visualisation
164 ,m_bGridVisible(TRUE
)
168 DBG_CTOR( rpt_ODesignView
,NULL
);
169 SetHelpId(UID_RPT_RPT_APP_VIEW
);
172 SetMapMode( MapMode( MAP_100TH_MM
) );
174 // now create the task pane on the right side :-)
175 m_pTaskPane
= new OTaskWindow(this);
176 //m_pTaskPane->Show();
178 m_aSplitWin
.InsertItem( COLSET_ID
,100,SPLITWINDOW_APPEND
, 0, SWIB_PERCENTSIZE
| SWIB_COLSET
);
179 m_aSplitWin
.InsertItem( REPORT_ID
, &m_aScrollWindow
, 100/*m_aScrollWindow.getMaxMarkerWidth(sal_False)*/, SPLITWINDOW_APPEND
, COLSET_ID
, SWIB_PERCENTSIZE
/*SWIB_COLSET*/);
180 //m_aSplitWin.InsertItem( TASKPANE_ID, m_pTaskPane, 50, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE );
182 // Splitter einrichten
183 //m_aSplitter.SetSplitHdl(LINK(this, ODesignView,SplitHdl));
184 m_aSplitWin
.SetSplitHdl(LINK(this, ODesignView
,SplitHdl
));
185 m_aSplitWin
.ShowAutoHideButton();
186 m_aSplitWin
.SetAlign(WINDOWALIGN_LEFT
);
189 m_aMarkTimer
.SetTimeout( 100 );
190 m_aMarkTimer
.SetTimeoutHdl( LINK( this, ODesignView
, MarkTimeout
) );
193 //------------------------------------------------------------------------------
194 ODesignView::~ODesignView()
196 DBG_DTOR( rpt_ODesignView
,NULL
);
199 m_aScrollWindow
.Hide();
203 notifySystemWindow(this,m_pPropWin
,::comphelper::mem_fun(&TaskPaneList::RemoveWindow
));
204 ::std::auto_ptr
<Window
> aTemp2(m_pPropWin
);
209 SvtViewOptions
aDlgOpt( E_WINDOW
, String::CreateFromInt32( UID_RPT_RPT_APP_VIEW
) );
210 aDlgOpt
.SetWindowState( ::rtl::OUString::createFromAscii( m_pAddField
->GetWindowState(WINDOWSTATE_MASK_ALL
).GetBuffer() ) );
211 notifySystemWindow(this,m_pAddField
,::comphelper::mem_fun(&TaskPaneList::RemoveWindow
));
212 ::std::auto_ptr
<Window
> aTemp2(m_pAddField
);
215 if ( m_pReportExplorer
)
217 SvtViewOptions
aDlgOpt( E_WINDOW
, String::CreateFromInt32( RID_NAVIGATOR
) );
218 aDlgOpt
.SetWindowState( ::rtl::OUString::createFromAscii( m_pReportExplorer
->GetWindowState(WINDOWSTATE_MASK_ALL
).GetBuffer() ) );
219 notifySystemWindow(this,m_pReportExplorer
,::comphelper::mem_fun(&TaskPaneList::RemoveWindow
));
220 ::std::auto_ptr
<Window
> aTemp2(m_pReportExplorer
);
221 m_pReportExplorer
= NULL
;
224 ::std::auto_ptr
<Window
> aTemp2(m_pTaskPane
);
228 // -----------------------------------------------------------------------------
229 void ODesignView::initialize()
231 SetMapMode( MapMode( MAP_100TH_MM
) );
232 m_aScrollWindow
.initialize();
233 m_aScrollWindow
.Show();
235 //-----------------------------------------------------------------------------
236 void ODesignView::DataChanged( const DataChangedEvent
& rDCEvt
)
238 ODataView::DataChanged( rDCEvt
);
240 if ( (rDCEvt
.GetType() == DATACHANGED_SETTINGS
) &&
241 (rDCEvt
.GetFlags() & SETTINGS_STYLE
) )
247 //------------------------------------------------------------------------------
248 long ODesignView::PreNotify( NotifyEvent
& rNEvt
)
250 long nRet
= ODataView::PreNotify(rNEvt
); // 1 := has to be handled here
251 switch(rNEvt
.GetType())
256 const KeyEvent
* pKeyEvent
= rNEvt
.GetKeyEvent();
257 if ( handleKeyEvent(*pKeyEvent
) )
259 else if ( nRet
== 1L && m_pAccel
.get() )
261 const KeyCode
& rCode
= pKeyEvent
->GetKeyCode();
263 aUrl
.Complete
= m_pAccel
->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rCode
));
264 if ( !aUrl
.Complete
.getLength() || !m_rController
.isCommandEnabled( aUrl
.Complete
) )
275 //------------------------------------------------------------------------------
276 void ODesignView::resizeDocumentView(Rectangle
& _rPlayground
)
278 if ( !_rPlayground
.IsEmpty() )
280 const Size
aPlaygroundSize( _rPlayground
.GetSize() );
282 // calc the split pos, and forward it to the controller
283 sal_Int32 nSplitPos
= getController().getSplitPos();
284 if ( 0 != aPlaygroundSize
.Width() )
286 if ( ( -1 == nSplitPos
)
287 || ( nSplitPos
>= aPlaygroundSize
.Width() )
290 long nMinWidth
= static_cast<long>(0.1*aPlaygroundSize
.Width());
291 if ( m_pPropWin
&& m_pPropWin
->IsVisible() )
292 nMinWidth
= m_pPropWin
->GetMinOutputSizePixel().Width();
293 nSplitPos
= static_cast<sal_Int32
>(_rPlayground
.Right() - nMinWidth
);
294 getController().setSplitPos(nSplitPos
);
296 } // if ( 0 != _rPlaygroundSize.Width() )
298 Size
aReportWindowSize(aPlaygroundSize
);
299 if ( m_aSplitWin
.IsItemValid(TASKPANE_ID
) )
301 // normalize the split pos
302 const long nSplitterWidth
= GetSettings().GetStyleSettings().GetSplitSize();
303 Point
aTaskPanePos(nSplitPos
+ nSplitterWidth
, _rPlayground
.Top());
304 if ( m_pTaskPane
&& m_pTaskPane
->IsVisible() )
306 aTaskPanePos
.X() = aPlaygroundSize
.Width() - m_pTaskPane
->GetSizePixel().Width();
307 sal_Int32 nMinWidth
= m_pPropWin
->getMinimumSize().Width();
308 if ( nMinWidth
> (aPlaygroundSize
.Width() - aTaskPanePos
.X()) )
310 aTaskPanePos
.X() = aPlaygroundSize
.Width() - nMinWidth
;
312 nSplitPos
= aTaskPanePos
.X() - nSplitterWidth
;
313 getController().setSplitPos(nSplitPos
);
315 const long nTaskPaneSize
= static_cast<long>((aPlaygroundSize
.Width() - aTaskPanePos
.X())*100/aPlaygroundSize
.Width());
316 if ( m_aSplitWin
.GetItemSize( TASKPANE_ID
) != nTaskPaneSize
)
318 m_aSplitWin
.SetItemSize( REPORT_ID
, 99 - nTaskPaneSize
);
319 m_aSplitWin
.SetItemSize( TASKPANE_ID
, nTaskPaneSize
);
323 // set the size of the report window
324 m_aSplitWin
.SetPosSizePixel( _rPlayground
.TopLeft(),aPlaygroundSize
);
326 // just for completeness: there is no space left, we occupied it all ...
327 _rPlayground
.SetPos( _rPlayground
.BottomRight() );
328 _rPlayground
.SetSize( Size( 0, 0 ) );
331 // -----------------------------------------------------------------------------
332 // set the view readonly or not
333 void ODesignView::setReadOnly(sal_Bool
/*_bReadOnly*/)
336 //----------------------------------------------------------------------------
337 IMPL_LINK( ODesignView
, MarkTimeout
, Timer
*, EMPTYARG
)
339 if ( m_pPropWin
&& m_pPropWin
->IsVisible() )
341 m_pPropWin
->Update(m_pCurrentView
);
342 uno::Reference
<beans::XPropertySet
> xProp(m_xReportComponent
,uno::UNO_QUERY
);
345 m_pPropWin
->Update(xProp
);
346 static_cast<OTaskWindow
*>(m_pTaskPane
)->Resize();
354 //----------------------------------------------------------------------------
355 void ODesignView::SetMode( DlgEdMode _eNewMode
)
358 if ( m_eMode
== RPTUI_SELECT
)
359 m_eActObj
= OBJ_NONE
;
361 m_aScrollWindow
.SetMode(_eNewMode
);
363 //----------------------------------------------------------------------------
364 void ODesignView::SetInsertObj( USHORT eObj
,const ::rtl::OUString
& _sShapeType
)
367 m_aScrollWindow
.SetInsertObj( eObj
,_sShapeType
);
369 //----------------------------------------------------------------------------
370 rtl::OUString
ODesignView::GetInsertObjString() const
372 return m_aScrollWindow
.GetInsertObjString();
374 //----------------------------------------------------------------------------
376 USHORT
ODesignView::GetInsertObj() const
381 //----------------------------------------------------------------------------
382 void ODesignView::Cut()
388 //----------------------------------------------------------------------------
390 void ODesignView::Copy()
392 m_aScrollWindow
.Copy();
395 //----------------------------------------------------------------------------
397 void ODesignView::Paste()
399 m_aScrollWindow
.Paste();
401 //----------------------------------------------------------------------------
402 void ODesignView::Delete()
404 m_aScrollWindow
.Delete();
406 //----------------------------------------------------------------------------
407 BOOL
ODesignView::HasSelection()
409 return m_aScrollWindow
.HasSelection();
411 //----------------------------------------------------------------------------
413 BOOL
ODesignView::IsPasteAllowed()
415 return m_aScrollWindow
.IsPasteAllowed();
418 //----------------------------------------------------------------------------
419 void ODesignView::UpdatePropertyBrowserDelayed(OSectionView
& _rView
)
421 if ( m_pCurrentView
!= &_rView
)
423 if ( m_pCurrentView
)
424 m_aScrollWindow
.setMarked(m_pCurrentView
,sal_False
);
425 m_pCurrentView
= &_rView
;
426 if ( m_pCurrentView
)
427 m_aScrollWindow
.setMarked(m_pCurrentView
,sal_True
);
428 m_xReportComponent
.clear();
429 DlgEdHint
aHint( RPTUI_HINT_SELECTIONCHANGED
);
432 m_aMarkTimer
.Start();
435 //----------------------------------------------------------------------------
436 void ODesignView::toggleGrid(sal_Bool _bGridVisible
)
438 m_aScrollWindow
.toggleGrid(_bGridVisible
);
440 //----------------------------------------------------------------------------
441 USHORT
ODesignView::getSectionCount() const
443 return m_aScrollWindow
.getSectionCount();
445 //----------------------------------------------------------------------------
446 void ODesignView::showRuler(sal_Bool _bShow
)
448 m_aScrollWindow
.showRuler(_bShow
);
450 //----------------------------------------------------------------------------
451 void ODesignView::removeSection(USHORT _nPosition
)
453 m_aScrollWindow
.removeSection(_nPosition
);
455 //----------------------------------------------------------------------------
456 void ODesignView::addSection(const uno::Reference
< report::XSection
>& _xSection
,const ::rtl::OUString
& _sColorEntry
,USHORT _nPosition
)
458 m_aScrollWindow
.addSection(_xSection
,_sColorEntry
,_nPosition
);
460 // -----------------------------------------------------------------------------
461 void ODesignView::GetFocus()
467 ::boost::shared_ptr
<OSectionWindow
> pSectionWindow
= m_aScrollWindow
.getMarkedSection();
468 if ( pSectionWindow
)
469 pSectionWindow
->GrabFocus();
472 // -----------------------------------------------------------------------------
473 void ODesignView::ImplInitSettings()
475 //#if OSL_DEBUG_LEVEL > 0
476 // SetBackground( Wallpaper( COL_RED ));
478 SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ));
480 SetFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
481 SetTextFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
483 //-----------------------------------------------------------------------------
484 IMPL_LINK( ODesignView
, SplitHdl
, void*, )
486 const Size aOutputSize
= GetOutputSizePixel();
487 const long nTest
= aOutputSize
.Width() * m_aSplitWin
.GetItemSize(TASKPANE_ID
) / 100;
488 long nMinWidth
= static_cast<long>(0.1*aOutputSize
.Width());
489 if ( m_pPropWin
&& m_pPropWin
->IsVisible() )
490 nMinWidth
= m_pPropWin
->GetMinOutputSizePixel().Width();
492 if ( (aOutputSize
.Width() - nTest
) >= nMinWidth
&& nTest
> m_aScrollWindow
.getMaxMarkerWidth(sal_False
) )
494 long nOldSplitPos
= getController().getSplitPos();
495 getController().setSplitPos(nTest
);
496 if ( nOldSplitPos
!= -1 && nOldSplitPos
<= nTest
)
498 Invalidate(/*INVALIDATE_NOCHILDREN*/);
504 //-----------------------------------------------------------------------------
505 void ODesignView::SelectAll(const sal_uInt16 _nObjectType
)
507 m_aScrollWindow
.SelectAll(_nObjectType
);
509 //-----------------------------------------------------------------------------
510 void ODesignView::unmarkAllObjects(OSectionView
* _pSectionView
)
512 m_aScrollWindow
.unmarkAllObjects(_pSectionView
);
514 //-----------------------------------------------------------------------------
515 void ODesignView::togglePropertyBrowser(sal_Bool _bToogleOn
)
517 if ( !m_pPropWin
&& _bToogleOn
)
519 m_pPropWin
= new PropBrw(getController().getORB(),m_pTaskPane
,this);
520 m_pPropWin
->Invalidate();
521 static_cast<OTaskWindow
*>(m_pTaskPane
)->setPropertyBrowser(m_pPropWin
);
522 notifySystemWindow(this,m_pPropWin
,::comphelper::mem_fun(&TaskPaneList::AddWindow
));
524 if ( m_pPropWin
&& _bToogleOn
!= m_pPropWin
->IsVisible() )
526 if ( !m_pCurrentView
&& !m_xReportComponent
.is() )
527 m_xReportComponent
= getController().getReportDefinition();
529 const sal_Bool bWillBeVisible
= _bToogleOn
;
530 m_pPropWin
->Show(bWillBeVisible
);
531 m_pTaskPane
->Show(bWillBeVisible
);
532 m_pTaskPane
->Invalidate();
534 if ( bWillBeVisible
)
535 m_aSplitWin
.InsertItem( TASKPANE_ID
, m_pTaskPane
,START_SIZE_TASKPANE
, SPLITWINDOW_APPEND
, COLSET_ID
, SWIB_PERCENTSIZE
/*|SWIB_COLSET */);
537 m_aSplitWin
.RemoveItem(TASKPANE_ID
);
540 // Invalidate(/*INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE*/);
541 if ( bWillBeVisible
)
542 m_aMarkTimer
.Start();
545 //-----------------------------------------------------------------------------
546 void ODesignView::showProperties(const uno::Reference
< uno::XInterface
>& _xReportComponent
)
548 if ( m_xReportComponent
!= _xReportComponent
)
550 m_xReportComponent
= _xReportComponent
;
551 if ( m_pCurrentView
)
552 m_aScrollWindow
.setMarked(m_pCurrentView
,sal_False
);
553 m_pCurrentView
= NULL
;
554 m_aMarkTimer
.Start();
557 //-----------------------------------------------------------------------------
558 BOOL
ODesignView::isReportExplorerVisible() const
560 return m_pReportExplorer
&& m_pReportExplorer
->IsVisible();
562 //-----------------------------------------------------------------------------
563 void ODesignView::toggleReportExplorer()
565 if ( !m_pReportExplorer
)
567 OReportController
& rReportController
= getController();
568 m_pReportExplorer
= new ONavigator(this,rReportController
);
569 SvtViewOptions
aDlgOpt( E_WINDOW
, String::CreateFromInt32( RID_NAVIGATOR
) );
570 if ( aDlgOpt
.Exists() )
571 m_pReportExplorer
->SetWindowState( ByteString( aDlgOpt
.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US
) );
572 m_pReportExplorer
->AddEventListener(LINK(&rReportController
,OReportController
,EventLstHdl
));
573 notifySystemWindow(this,m_pReportExplorer
,::comphelper::mem_fun(&TaskPaneList::AddWindow
));
576 m_pReportExplorer
->Show(!m_pReportExplorer
->IsVisible());
578 //-----------------------------------------------------------------------------
579 BOOL
ODesignView::isAddFieldVisible() const
581 return m_pAddField
&& m_pAddField
->IsVisible();
583 //-----------------------------------------------------------------------------
584 void ODesignView::toggleAddField()
588 uno::Reference
< report::XReportDefinition
> xReport(m_xReportComponent
,uno::UNO_QUERY
);
589 uno::Reference
< report::XReportComponent
> xReportComponent(m_xReportComponent
,uno::UNO_QUERY
);
590 OReportController
& rReportController
= getController();
591 if ( !m_pCurrentView
&& !xReport
.is() )
593 if ( xReportComponent
.is() )
594 xReport
= xReportComponent
->getSection()->getReportDefinition();
596 xReport
= rReportController
.getReportDefinition().get();
598 else if ( m_pCurrentView
)
600 uno::Reference
< report::XSection
> xSection
= m_pCurrentView
->getReportSection()->getSection();
601 xReport
= xSection
->getReportDefinition();
603 uno::Reference
< beans::XPropertySet
> xSet(rReportController
.getRowSet(),uno::UNO_QUERY
);
604 m_pAddField
= new OAddFieldWindow(this,xSet
);
605 m_pAddField
->SetCreateHdl(LINK( &rReportController
, OReportController
, OnCreateHdl
) );
606 SvtViewOptions
aDlgOpt( E_WINDOW
, String::CreateFromInt32( UID_RPT_RPT_APP_VIEW
) );
607 if ( aDlgOpt
.Exists() )
608 m_pAddField
->SetWindowState( ByteString( aDlgOpt
.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US
) );
609 m_pAddField
->Update();
610 m_pAddField
->AddEventListener(LINK(&rReportController
,OReportController
,EventLstHdl
));
611 notifySystemWindow(this,m_pAddField
,::comphelper::mem_fun(&TaskPaneList::AddWindow
));
615 m_pAddField
->Show(!m_pAddField
->IsVisible());
617 // -------------------------------------------------------------------------
618 uno::Reference
< report::XSection
> ODesignView::getCurrentSection() const
620 uno::Reference
< report::XSection
> xSection
;
621 if ( m_pCurrentView
)
622 xSection
= m_pCurrentView
->getReportSection()->getSection();
624 // why do we need the code below?
627 // OReportController& rReportController = getController();
628 // xSection = rReportController.getReportDefinition()->getDetail();
632 // -----------------------------------------------------------------------------
633 uno::Reference
< report::XReportComponent
> ODesignView::getCurrentControlModel() const
635 uno::Reference
< report::XReportComponent
> xModel
;
636 if ( m_pCurrentView
)
638 xModel
= m_pCurrentView
->getReportSection()->getCurrentControlModel();
642 // -------------------------------------------------------------------------
643 ::boost::shared_ptr
<OSectionWindow
> ODesignView::getMarkedSection(NearSectionAccess nsa
) const
645 return m_aScrollWindow
.getMarkedSection(nsa
);
647 //-----------------------------------------------------------------------------
648 ::boost::shared_ptr
<OSectionWindow
> ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference
< ::com::sun::star::report::XSection
>& _xSection
) const
650 return m_aScrollWindow
.getSectionWindow(_xSection
);
652 // -------------------------------------------------------------------------
653 void ODesignView::markSection(const sal_uInt16 _nPos
)
655 m_aScrollWindow
.markSection(_nPos
);
657 // -----------------------------------------------------------------------------
658 void ODesignView::fillCollapsedSections(::std::vector
<sal_uInt16
>& _rCollapsedPositions
) const
660 m_aScrollWindow
.fillCollapsedSections(_rCollapsedPositions
);
662 // -----------------------------------------------------------------------------
663 void ODesignView::collapseSections(const uno::Sequence
< beans::PropertyValue
>& _aCollpasedSections
)
665 m_aScrollWindow
.collapseSections(_aCollpasedSections
);
667 // -----------------------------------------------------------------------------
668 ::rtl::OUString
ODesignView::getCurrentPage() const
670 return m_pPropWin
? m_pPropWin
->getCurrentPage() : ::rtl::OUString();
672 // -----------------------------------------------------------------------------
673 void ODesignView::setCurrentPage(const ::rtl::OUString
& _sLastActivePage
)
676 m_pPropWin
->setCurrentPage(_sLastActivePage
);
678 // -----------------------------------------------------------------------------
679 void ODesignView::alignMarkedObjects(sal_Int32 _nControlModification
,bool _bAlignAtSection
, bool bBoundRects
)
681 m_aScrollWindow
.alignMarkedObjects(_nControlModification
, _bAlignAtSection
,bBoundRects
);
683 // -----------------------------------------------------------------------------
684 sal_Bool
ODesignView::isAlignPossible() const
686 ::boost::shared_ptr
<OSectionWindow
> pMarkedSection
= getMarkedSection();
687 return pMarkedSection
.get() && pMarkedSection
->getReportSection().getSectionView().IsAlignPossible();
689 //------------------------------------------------------------------------------
690 sal_Bool
ODesignView::handleKeyEvent(const KeyEvent
& _rEvent
)
692 if ( (m_pPropWin
&& m_pPropWin
->HasChildPathFocus()) )
694 if ( (m_pAddField
&& m_pAddField
->HasChildPathFocus()) )
696 if ( (m_pReportExplorer
&& m_pReportExplorer
->HasChildPathFocus()) )
698 return m_aScrollWindow
.handleKeyEvent(_rEvent
);
700 //------------------------------------------------------------------------
701 void ODesignView::setMarked(const uno::Reference
< report::XSection
>& _xSection
,sal_Bool _bMark
)
703 m_aScrollWindow
.setMarked(_xSection
,_bMark
);
705 UpdatePropertyBrowserDelayed(getMarkedSection()->getReportSection().getSectionView());
707 m_pCurrentView
= NULL
;
709 //------------------------------------------------------------------------
710 void ODesignView::setMarked(const uno::Sequence
< uno::Reference
< report::XReportComponent
> >& _aShapes
,sal_Bool _bMark
)
712 m_aScrollWindow
.setMarked(_aShapes
,_bMark
);
713 if ( _aShapes
.hasElements() && _bMark
)
714 showProperties(_aShapes
[0]);
716 m_xReportComponent
.clear();
718 //------------------------------------------------------------------------------
719 void ODesignView::MouseButtonDown( const MouseEvent
& rMEvt
)
721 if ( rMEvt
.IsLeft() )
723 const uno::Sequence
< beans::PropertyValue
> aArgs
;
724 getController().executeChecked(SID_SELECT_REPORT
,aArgs
);
726 ODataView::MouseButtonDown(rMEvt
);
728 // -----------------------------------------------------------------------------
729 uno::Any
ODesignView::getCurrentlyShownProperty() const
732 ::boost::shared_ptr
<OSectionWindow
> pSectionWindow
= getMarkedSection();
733 if ( pSectionWindow
)
735 ::std::vector
< uno::Reference
< uno::XInterface
> > aSelection
;
736 pSectionWindow
->getReportSection().fillControlModelSelection(aSelection
);
737 if ( !aSelection
.empty() )
739 ::std::vector
< uno::Reference
< uno::XInterface
> >::iterator aIter
= aSelection
.begin();
740 uno::Sequence
< uno::Reference
< report::XReportComponent
> > aSeq(aSelection
.size());
741 for(sal_Int32 i
= 0; i
< aSeq
.getLength(); ++i
,++aIter
)
743 aSeq
[i
].set(*aIter
,uno::UNO_QUERY
);
750 // -----------------------------------------------------------------------------
751 void ODesignView::fillControlModelSelection(::std::vector
< uno::Reference
< uno::XInterface
> >& _rSelection
) const
753 m_aScrollWindow
.fillControlModelSelection(_rSelection
);
755 // -----------------------------------------------------------------------------
756 void ODesignView::setGridSnap(BOOL bOn
)
758 m_aScrollWindow
.setGridSnap(bOn
);
761 // -----------------------------------------------------------------------------
762 void ODesignView::setDragStripes(BOOL bOn
)
764 m_aScrollWindow
.setDragStripes(bOn
);
766 // -----------------------------------------------------------------------------
767 sal_Bool
ODesignView::isHandleEvent(sal_uInt16
/*_nId*/) const
769 return m_pPropWin
&& m_pPropWin
->HasChildPathFocus();
771 // -----------------------------------------------------------------------------
772 sal_uInt32
ODesignView::getMarkedObjectCount() const
774 return m_aScrollWindow
.getMarkedObjectCount();
776 // -----------------------------------------------------------------------------
777 void ODesignView::zoom(const Fraction
& _aZoom
)
779 m_aScrollWindow
.zoom(_aZoom
);
781 // -----------------------------------------------------------------------------
782 sal_uInt16
ODesignView::getZoomFactor(SvxZoomType _eType
) const
784 return m_aScrollWindow
.getZoomFactor(_eType
);
786 //============================================================================
788 //============================================================================