diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 11:41:31 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 15:08:48 +0100 |
commit | e8b97a52c96df9c8e8055407b1e40ed7cb9cfc67 (patch) | |
tree | b322529f4a54a6427862cb20cb4cf87fb6a5d065 /reportdesign/source/ui/report | |
parent | 2b0be6c0e9d23f1b8535ba7033732ae2e3bfb5c9 (diff) | |
parent | 0cde74f788a054fa2b65107a030dd463b8d11c7a (diff) |
Merge remote-tracking branch 'origin/feature/vclptr'
Resolve several thousand lines of conflicts.
Conflicts:
accessibility/source/extended/accessiblelistbox.cxx
accessibility/source/standard/vclxaccessiblecombobox.cxx
accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
accessibility/source/standard/vclxaccessiblelistbox.cxx
accessibility/source/standard/vclxaccessibletextfield.cxx
basctl/source/basicide/basidesh.cxx
cui/source/inc/chardlg.hxx
cui/source/tabpages/tpbitmap.cxx
dbaccess/source/ui/dlg/UserAdmin.cxx
dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
extensions/source/propctrlr/propertyeditor.hxx
extensions/source/scanner/sanedlg.cxx
filter/source/pdf/impdialog.cxx
include/sfx2/mgetempl.hxx
include/sfx2/sidebar/SidebarToolBox.hxx
include/sfx2/viewsh.hxx
include/svtools/brwbox.hxx
include/svtools/filectrl.hxx
include/svtools/scrwin.hxx
include/svx/dlgctrl.hxx
include/svx/sidebar/Popup.hxx
include/svx/sidebar/PopupContainer.hxx
include/svx/sidebar/PopupControl.hxx
include/svx/sidebar/SidebarDialControl.hxx
include/svx/sidebar/ValueSetWithTextControl.hxx
sc/source/ui/condformat/condformatdlgentry.cxx
sc/source/ui/navipi/navipi.cxx
sc/source/ui/sidebar/CellBorderStyleControl.hxx
sd/source/ui/animations/CustomAnimationDialog.cxx
sd/source/ui/inc/DrawViewShell.hxx
sd/source/ui/inc/Ruler.hxx
sd/source/ui/inc/SlideSorter.hxx
sd/source/ui/inc/ViewTabBar.hxx
sd/source/ui/inc/Window.hxx
sd/source/ui/inc/morphdlg.hxx
sd/source/ui/inc/sdpreslt.hxx
sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
sd/source/ui/sidebar/LayoutMenu.hxx
sd/source/ui/sidebar/MasterPagesSelector.hxx
sd/source/ui/sidebar/NavigatorWrapper.hxx
sd/source/ui/sidebar/PanelBase.hxx
sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
sd/source/ui/slideshow/showwindow.hxx
sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
sd/source/ui/view/ViewShellBase.cxx
sd/source/ui/view/drviewsa.cxx
sfx2/source/appl/fileobj.hxx
sfx2/source/appl/opengrf.cxx
sfx2/source/control/thumbnailviewacc.hxx
sfx2/source/dialog/securitypage.cxx
sfx2/source/dialog/templdlg.cxx
sfx2/source/doc/docinsert.cxx
sfx2/source/doc/guisaveas.cxx
sfx2/source/inc/alienwarn.hxx
sfx2/source/sidebar/Deck.cxx
sfx2/source/sidebar/Deck.hxx
sfx2/source/sidebar/DeckTitleBar.cxx
sfx2/source/sidebar/DeckTitleBar.hxx
sfx2/source/sidebar/MenuButton.cxx
sfx2/source/sidebar/MenuButton.hxx
sfx2/source/sidebar/Panel.cxx
sfx2/source/sidebar/Panel.hxx
sfx2/source/sidebar/PanelTitleBar.hxx
sfx2/source/sidebar/SidebarDockingWindow.hxx
sfx2/source/sidebar/SidebarToolBox.cxx
sfx2/source/sidebar/TabBar.hxx
sfx2/source/sidebar/TabItem.cxx
sfx2/source/sidebar/TabItem.hxx
sfx2/source/sidebar/TitleBar.hxx
sfx2/source/toolbox/imgmgr.cxx
starmath/inc/edit.hxx
starmath/inc/smmod.hxx
starmath/qa/cppunit/test_starmath.cxx
starmath/source/edit.cxx
starmath/source/smmod.cxx
svtools/source/brwbox/brwbox1.cxx
svtools/source/brwbox/datwin.hxx
svtools/source/contnr/fileview.cxx
svtools/source/contnr/simptabl.cxx
svtools/source/control/filectrl.cxx
svtools/source/control/valueimp.hxx
svx/inc/GalleryControl.hxx
svx/source/dialog/dlgctrl.cxx
svx/source/dialog/swframeexample.cxx
svx/source/fmcomp/fmgridif.cxx
svx/source/gallery2/GalleryControl.cxx
svx/source/sidebar/EmptyPanel.hxx
svx/source/sidebar/area/AreaPropertyPanel.hxx
svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
svx/source/sidebar/insert/InsertPropertyPanel.cxx
svx/source/sidebar/insert/InsertPropertyPanel.hxx
svx/source/sidebar/line/LinePropertyPanel.hxx
svx/source/sidebar/line/LineWidthControl.cxx
svx/source/sidebar/line/LineWidthControl.hxx
svx/source/sidebar/line/LineWidthValueSet.hxx
svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
svx/source/sidebar/possize/SidebarDialControl.cxx
svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
svx/source/sidebar/text/TextPropertyPanel.hxx
svx/source/sidebar/tools/PopupContainer.cxx
svx/source/sidebar/tools/PopupControl.cxx
svx/source/sidebar/tools/ValueSetWithTextControl.cxx
svx/source/svdraw/svdfmtf.hxx
svx/source/svdraw/svdibrow.cxx
svx/source/tbxctrls/colrctrl.cxx
svx/source/tbxctrls/tbcontrl.cxx
sw/source/ui/dbui/mmaddressblockpage.cxx
sw/source/ui/dialog/uiregionsw.cxx
sw/source/ui/index/cnttab.cxx
sw/source/uibase/inc/drpcps.hxx
sw/source/uibase/sidebar/PageColumnControl.hxx
sw/source/uibase/sidebar/PageMarginControl.hxx
sw/source/uibase/sidebar/PageOrientationControl.hxx
sw/source/uibase/sidebar/PagePropertyPanel.hxx
sw/source/uibase/sidebar/PageSizeControl.hxx
sw/source/uibase/uiview/view2.cxx
sw/source/uibase/utlui/navipi.cxx
vcl/inc/svdata.hxx
vcl/source/control/combobox.cxx
vcl/source/control/lstbox.cxx
vcl/source/window/dockwin.cxx
vcl/source/window/winproc.cxx
Change-Id: I056cf3026ff17d65cca0b6e6588bda4a88fa8d95
Diffstat (limited to 'reportdesign/source/ui/report')
-rw-r--r-- | reportdesign/source/ui/report/DesignView.cxx | 155 | ||||
-rw-r--r-- | reportdesign/source/ui/report/FixedTextColor.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/report/FormattedFieldBeautifier.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportController.cxx | 61 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportSection.cxx | 7 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportWindow.cxx | 147 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ScrollHelper.cxx | 134 | ||||
-rw-r--r-- | reportdesign/source/ui/report/SectionWindow.cxx | 133 | ||||
-rw-r--r-- | reportdesign/source/ui/report/StartMarker.cxx | 94 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ViewsWindow.cxx | 37 | ||||
-rw-r--r-- | reportdesign/source/ui/report/propbrw.cxx | 9 |
11 files changed, 424 insertions, 357 deletions
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index 96953d86019a..698b065796f6 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -59,9 +59,11 @@ using namespace container; class OTaskWindow : public vcl::Window { - PropBrw* m_pPropWin; + VclPtr<PropBrw> m_pPropWin; public: OTaskWindow(vcl::Window* _pParent) : Window(_pParent),m_pPropWin(NULL){} + virtual ~OTaskWindow() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE { m_pPropWin.clear(); vcl::Window::dispose(); } inline void setPropertyBrowser(PropBrw* _pPropWin) { @@ -84,9 +86,9 @@ ODesignView::ODesignView( vcl::Window* pParent, const Reference< XComponentContext >& _rxOrb, OReportController& _rController) : ODataView( pParent, _rController, _rxOrb, WB_DIALOGCONTROL ) - ,m_aSplitWin(this) + ,m_aSplitWin(VclPtr<SplitWindow>::Create(this)) ,m_rReportController( _rController ) - ,m_aScrollWindow(this) + ,m_aScrollWindow(VclPtr<rptui::OScrollWindowHelper>::Create(this)) ,m_pPropWin(NULL) ,m_pAddField(NULL) ,m_pCurrentView(NULL) @@ -107,16 +109,16 @@ ODesignView::ODesignView( vcl::Window* pParent, SetMapMode( MapMode( MAP_100TH_MM ) ); // now create the task pane on the right side :-) - m_pTaskPane = new OTaskWindow(this); + m_pTaskPane = VclPtr<OTaskWindow>::Create(this); - m_aSplitWin.InsertItem( COLSET_ID,100,SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE | SWIB_COLSET ); - m_aSplitWin.InsertItem( REPORT_ID, &m_aScrollWindow, 100, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE); + m_aSplitWin->InsertItem( COLSET_ID,100,SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE | SWIB_COLSET ); + m_aSplitWin->InsertItem( REPORT_ID, m_aScrollWindow.get(), 100, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE); // Splitter einrichten - m_aSplitWin.SetSplitHdl(LINK(this, ODesignView,SplitHdl)); - m_aSplitWin.ShowAutoHideButton(); - m_aSplitWin.SetAlign(WINDOWALIGN_LEFT); - m_aSplitWin.Show(); + m_aSplitWin->SetSplitHdl(LINK(this, ODesignView,SplitHdl)); + m_aSplitWin->ShowAutoHideButton(); + m_aSplitWin->SetAlign(WINDOWALIGN_LEFT); + m_aSplitWin->Show(); m_aMarkIdle.SetPriority( SchedulerPriority::LOW ); m_aMarkIdle.SetIdleHdl( LINK( this, ODesignView, MarkTimeout ) ); @@ -125,43 +127,46 @@ ODesignView::ODesignView( vcl::Window* pParent, ODesignView::~ODesignView() { + disposeOnce(); +} + +void ODesignView::dispose() +{ m_bDeleted = true; Hide(); - m_aScrollWindow.Hide(); + m_aScrollWindow->Hide(); m_aMarkIdle.Stop(); if ( m_pPropWin ) { notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); - ::std::unique_ptr<vcl::Window> aTemp2(m_pPropWin); - m_pPropWin = NULL; } if ( m_pAddField ) { SvtViewOptions aDlgOpt( E_WINDOW, OUString( UID_RPT_RPT_APP_VIEW ) ); aDlgOpt.SetWindowState(OStringToOUString(m_pAddField->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US)); notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); - ::std::unique_ptr<vcl::Window> aTemp2(m_pAddField); - m_pAddField = NULL; } if ( m_pReportExplorer ) { SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pReportExplorer->GetHelpId(), RTL_TEXTENCODING_UTF8)); aDlgOpt.SetWindowState(OStringToOUString(m_pReportExplorer->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US)); notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); - ::std::unique_ptr<vcl::Window> aTemp2(m_pReportExplorer); - m_pReportExplorer = NULL; - } - { - ::std::unique_ptr<vcl::Window> aTemp2(m_pTaskPane); - m_pTaskPane = NULL; } + + m_aSplitWin.disposeAndClear(); + m_aScrollWindow.disposeAndClear(); + m_pTaskPane.clear(); + m_pReportExplorer.clear(); + m_pPropWin.clear(); + m_pAddField.clear(); + dbaui::ODataView::dispose(); } void ODesignView::initialize() { SetMapMode( MapMode( MAP_100TH_MM ) ); - m_aScrollWindow.initialize(); - m_aScrollWindow.Show(); + m_aScrollWindow->initialize(); + m_aScrollWindow->Show(); } void ODesignView::DataChanged( const DataChangedEvent& rDCEvt ) @@ -197,7 +202,7 @@ bool ODesignView::PreNotify( NotifyEvent& rNEvt ) const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode(); util::URL aUrl; aUrl.Complete = m_pAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rCode)); - if ( aUrl.Complete.isEmpty() || !m_rController.isCommandEnabled( aUrl.Complete ) ) + if ( aUrl.Complete.isEmpty() || !m_xController->isCommandEnabled( aUrl.Complete ) ) nRet = false; } } @@ -231,7 +236,7 @@ void ODesignView::resizeDocumentView(Rectangle& _rPlayground) } } - if ( m_aSplitWin.IsItemValid(TASKPANE_ID) ) + if ( m_aSplitWin->IsItemValid(TASKPANE_ID) ) { // normalize the split pos const long nSplitterWidth = GetSettings().GetStyleSettings().GetSplitSize(); @@ -248,15 +253,15 @@ void ODesignView::resizeDocumentView(Rectangle& _rPlayground) getController().setSplitPos(nSplitPos); const long nTaskPaneSize = static_cast<long>((aPlaygroundSize.Width() - aTaskPanePos.X())*100/aPlaygroundSize.Width()); - if ( m_aSplitWin.GetItemSize( TASKPANE_ID ) != nTaskPaneSize ) + if ( m_aSplitWin->GetItemSize( TASKPANE_ID ) != nTaskPaneSize ) { - m_aSplitWin.SetItemSize( REPORT_ID, 99 - nTaskPaneSize ); - m_aSplitWin.SetItemSize( TASKPANE_ID, nTaskPaneSize ); + m_aSplitWin->SetItemSize( REPORT_ID, 99 - nTaskPaneSize ); + m_aSplitWin->SetItemSize( TASKPANE_ID, nTaskPaneSize ); } } } // set the size of the report window - m_aSplitWin.SetPosSizePixel( _rPlayground.TopLeft(),aPlaygroundSize ); + m_aSplitWin->SetPosSizePixel( _rPlayground.TopLeft(),aPlaygroundSize ); } // just for completeness: there is no space left, we occupied it all ... _rPlayground.SetPos( _rPlayground.BottomRight() ); @@ -273,7 +278,7 @@ IMPL_LINK_NOARG(ODesignView, MarkTimeout) if ( xProp.is() ) { m_pPropWin->Update(xProp); - static_cast<OTaskWindow*>(m_pTaskPane)->Resize(); + static_cast<OTaskWindow*>(m_pTaskPane.get())->Resize(); } Resize(); } @@ -288,18 +293,18 @@ void ODesignView::SetMode( DlgEdMode _eNewMode ) if ( m_eMode == RPTUI_SELECT ) m_eActObj = OBJ_NONE; - m_aScrollWindow.SetMode(_eNewMode); + m_aScrollWindow->SetMode(_eNewMode); } void ODesignView::SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType ) { m_eActObj = eObj; - m_aScrollWindow.SetInsertObj( eObj,_sShapeType ); + m_aScrollWindow->SetInsertObj( eObj,_sShapeType ); } OUString ODesignView::GetInsertObjString() const { - return m_aScrollWindow.GetInsertObjString(); + return m_aScrollWindow->GetInsertObjString(); } @@ -315,30 +320,30 @@ void ODesignView::Cut() void ODesignView::Copy() { - m_aScrollWindow.Copy(); + m_aScrollWindow->Copy(); } void ODesignView::Paste() { - m_aScrollWindow.Paste(); + m_aScrollWindow->Paste(); } void ODesignView::Delete() { - m_aScrollWindow.Delete(); + m_aScrollWindow->Delete(); } bool ODesignView::HasSelection() const { - return m_aScrollWindow.HasSelection(); + return m_aScrollWindow->HasSelection(); } bool ODesignView::IsPasteAllowed() const { - return m_aScrollWindow.IsPasteAllowed(); + return m_aScrollWindow->IsPasteAllowed(); } @@ -347,10 +352,10 @@ void ODesignView::UpdatePropertyBrowserDelayed(OSectionView& _rView) if ( m_pCurrentView != &_rView ) { if ( m_pCurrentView ) - m_aScrollWindow.setMarked(m_pCurrentView,false); + m_aScrollWindow->setMarked(m_pCurrentView,false); m_pCurrentView = &_rView; if ( m_pCurrentView ) - m_aScrollWindow.setMarked(m_pCurrentView,true); + m_aScrollWindow->setMarked(m_pCurrentView,true); m_xReportComponent.clear(); DlgEdHint aHint( RPTUI_HINT_SELECTIONCHANGED ); Broadcast( aHint ); @@ -361,27 +366,27 @@ void ODesignView::UpdatePropertyBrowserDelayed(OSectionView& _rView) void ODesignView::toggleGrid(bool _bGridVisible) { - m_aScrollWindow.toggleGrid(_bGridVisible); + m_aScrollWindow->toggleGrid(_bGridVisible); } sal_uInt16 ODesignView::getSectionCount() const { - return m_aScrollWindow.getSectionCount(); + return m_aScrollWindow->getSectionCount(); } void ODesignView::showRuler(bool _bShow) { - m_aScrollWindow.showRuler(_bShow); + m_aScrollWindow->showRuler(_bShow); } void ODesignView::removeSection(sal_uInt16 _nPosition) { - m_aScrollWindow.removeSection(_nPosition); + m_aScrollWindow->removeSection(_nPosition); } void ODesignView::addSection(const uno::Reference< report::XSection >& _xSection,const OUString& _sColorEntry,sal_uInt16 _nPosition) { - m_aScrollWindow.addSection(_xSection,_sColorEntry,_nPosition); + m_aScrollWindow->addSection(_xSection,_sColorEntry,_nPosition); } void ODesignView::GetFocus() @@ -390,7 +395,7 @@ void ODesignView::GetFocus() if ( !m_bDeleted ) { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aScrollWindow.getMarkedSection(); + OSectionWindow* pSectionWindow = m_aScrollWindow->getMarkedSection(); if ( pSectionWindow ) pSectionWindow->GrabFocus(); } @@ -406,12 +411,12 @@ void ODesignView::ImplInitSettings() IMPL_LINK( ODesignView, SplitHdl, void*, ) { const Size aOutputSize = GetOutputSizePixel(); - const long nTest = aOutputSize.Width() * m_aSplitWin.GetItemSize(TASKPANE_ID) / 100; + const long nTest = aOutputSize.Width() * m_aSplitWin->GetItemSize(TASKPANE_ID) / 100; long nMinWidth = static_cast<long>(0.1*aOutputSize.Width()); if ( m_pPropWin && m_pPropWin->IsVisible() ) nMinWidth = m_pPropWin->GetMinOutputSizePixel().Width(); - if ( (aOutputSize.Width() - nTest) >= nMinWidth && nTest > m_aScrollWindow.getMaxMarkerWidth(false) ) + if ( (aOutputSize.Width() - nTest) >= nMinWidth && nTest > m_aScrollWindow->getMaxMarkerWidth(false) ) { long nOldSplitPos = getController().getSplitPos(); (void)nOldSplitPos; @@ -423,21 +428,21 @@ IMPL_LINK( ODesignView, SplitHdl, void*, ) void ODesignView::SelectAll(const sal_uInt16 _nObjectType) { - m_aScrollWindow.SelectAll(_nObjectType); + m_aScrollWindow->SelectAll(_nObjectType); } void ODesignView::unmarkAllObjects(OSectionView* _pSectionView) { - m_aScrollWindow.unmarkAllObjects(_pSectionView); + m_aScrollWindow->unmarkAllObjects(_pSectionView); } void ODesignView::togglePropertyBrowser(bool _bToogleOn) { if ( !m_pPropWin && _bToogleOn ) { - m_pPropWin = new PropBrw(getController().getORB(), m_pTaskPane,this); + m_pPropWin = VclPtr<PropBrw>::Create(getController().getORB(), m_pTaskPane,this); m_pPropWin->Invalidate(); - static_cast<OTaskWindow*>(m_pTaskPane)->setPropertyBrowser(m_pPropWin); + static_cast<OTaskWindow*>(m_pTaskPane.get())->setPropertyBrowser(m_pPropWin); notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::AddWindow)); } if ( m_pPropWin && _bToogleOn != m_pPropWin->IsVisible() ) @@ -451,9 +456,9 @@ void ODesignView::togglePropertyBrowser(bool _bToogleOn) m_pTaskPane->Invalidate(); if ( bWillBeVisible ) - m_aSplitWin.InsertItem( TASKPANE_ID, m_pTaskPane,START_SIZE_TASKPANE, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE); + m_aSplitWin->InsertItem( TASKPANE_ID, m_pTaskPane,START_SIZE_TASKPANE, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE); else - m_aSplitWin.RemoveItem(TASKPANE_ID); + m_aSplitWin->RemoveItem(TASKPANE_ID); if ( bWillBeVisible ) m_aMarkIdle.Start(); @@ -466,7 +471,7 @@ void ODesignView::showProperties(const uno::Reference< uno::XInterface>& _xRepor { m_xReportComponent = _xReportComponent; if ( m_pCurrentView ) - m_aScrollWindow.setMarked(m_pCurrentView,false); + m_aScrollWindow->setMarked(m_pCurrentView,false); m_pCurrentView = NULL; m_aMarkIdle.Start(); } @@ -482,7 +487,7 @@ void ODesignView::toggleReportExplorer() if ( !m_pReportExplorer ) { OReportController& rReportController = getController(); - m_pReportExplorer = new ONavigator(this,rReportController); + m_pReportExplorer = VclPtr<ONavigator>::Create(this,rReportController); SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pReportExplorer->GetHelpId(), RTL_TEXTENCODING_UTF8)); if ( aDlgOpt.Exists() ) m_pReportExplorer->SetWindowState(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_ASCII_US)); @@ -518,7 +523,7 @@ void ODesignView::toggleAddField() xReport = xSection->getReportDefinition(); } uno::Reference < beans::XPropertySet > xSet(rReportController.getRowSet(),uno::UNO_QUERY); - m_pAddField = new OAddFieldWindow(this,xSet); + m_pAddField = VclPtr<OAddFieldWindow>::Create(this,xSet); m_pAddField->SetCreateHdl(LINK( &rReportController, OReportController, OnCreateHdl ) ); SvtViewOptions aDlgOpt( E_WINDOW, OUString( UID_RPT_RPT_APP_VIEW ) ); if ( aDlgOpt.Exists() ) @@ -551,29 +556,29 @@ uno::Reference< report::XReportComponent > ODesignView::getCurrentControlModel() return xModel; } -::boost::shared_ptr<OSectionWindow> ODesignView::getMarkedSection(NearSectionAccess nsa) const +OSectionWindow* ODesignView::getMarkedSection(NearSectionAccess nsa) const { - return m_aScrollWindow.getMarkedSection(nsa); + return m_aScrollWindow->getMarkedSection(nsa); } -::boost::shared_ptr<OSectionWindow> ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const +OSectionWindow* ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const { - return m_aScrollWindow.getSectionWindow(_xSection); + return m_aScrollWindow->getSectionWindow(_xSection); } void ODesignView::markSection(const sal_uInt16 _nPos) { - m_aScrollWindow.markSection(_nPos); + m_aScrollWindow->markSection(_nPos); } void ODesignView::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const { - m_aScrollWindow.fillCollapsedSections(_rCollapsedPositions); + m_aScrollWindow->fillCollapsedSections(_rCollapsedPositions); } void ODesignView::collapseSections(const uno::Sequence< beans::PropertyValue>& _aCollpasedSections) { - m_aScrollWindow.collapseSections(_aCollpasedSections); + m_aScrollWindow->collapseSections(_aCollpasedSections); } OUString ODesignView::getCurrentPage() const @@ -589,7 +594,7 @@ void ODesignView::setCurrentPage(const OUString& _sLastActivePage) void ODesignView::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects) { - m_aScrollWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection,bBoundRects); + m_aScrollWindow->alignMarkedObjects(_nControlModification, _bAlignAtSection,bBoundRects); } bool ODesignView::handleKeyEvent(const KeyEvent& _rEvent) @@ -600,12 +605,12 @@ bool ODesignView::handleKeyEvent(const KeyEvent& _rEvent) return false; if ( (m_pReportExplorer && m_pReportExplorer->HasChildPathFocus()) ) return false; - return m_aScrollWindow.handleKeyEvent(_rEvent); + return m_aScrollWindow->handleKeyEvent(_rEvent); } void ODesignView::setMarked(const uno::Reference< report::XSection>& _xSection,bool _bMark) { - m_aScrollWindow.setMarked(_xSection,_bMark); + m_aScrollWindow->setMarked(_xSection,_bMark); if ( _bMark ) UpdatePropertyBrowserDelayed(getMarkedSection()->getReportSection().getSectionView()); else @@ -614,7 +619,7 @@ void ODesignView::setMarked(const uno::Reference< report::XSection>& _xSection,b void ODesignView::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _aShapes,bool _bMark) { - m_aScrollWindow.setMarked(_aShapes,_bMark); + m_aScrollWindow->setMarked(_aShapes,_bMark); if ( _aShapes.hasElements() && _bMark ) showProperties(_aShapes[0]); else @@ -634,7 +639,7 @@ void ODesignView::MouseButtonDown( const MouseEvent& rMEvt ) uno::Any ODesignView::getCurrentlyShownProperty() const { uno::Any aRet; - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getMarkedSection(); + OSectionWindow* pSectionWindow = getMarkedSection(); if ( pSectionWindow ) { ::std::vector< uno::Reference< uno::XInterface > > aSelection; @@ -655,18 +660,18 @@ uno::Any ODesignView::getCurrentlyShownProperty() const void ODesignView::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const { - m_aScrollWindow.fillControlModelSelection(_rSelection); + m_aScrollWindow->fillControlModelSelection(_rSelection); } void ODesignView::setGridSnap(bool bOn) { - m_aScrollWindow.setGridSnap(bOn); + m_aScrollWindow->setGridSnap(bOn); } void ODesignView::setDragStripes(bool bOn) { - m_aScrollWindow.setDragStripes(bOn); + m_aScrollWindow->setDragStripes(bOn); } bool ODesignView::isHandleEvent(sal_uInt16 /*_nId*/) const @@ -676,17 +681,17 @@ bool ODesignView::isHandleEvent(sal_uInt16 /*_nId*/) const sal_uInt32 ODesignView::getMarkedObjectCount() const { - return m_aScrollWindow.getMarkedObjectCount(); + return m_aScrollWindow->getMarkedObjectCount(); } void ODesignView::zoom(const Fraction& _aZoom) { - m_aScrollWindow.zoom(_aZoom); + m_aScrollWindow->zoom(_aZoom); } sal_uInt16 ODesignView::getZoomFactor(SvxZoomType _eType) const { - return m_aScrollWindow.getZoomFactor(_eType); + return m_aScrollWindow->getZoomFactor(_eType); } } // rptui diff --git a/reportdesign/source/ui/report/FixedTextColor.cxx b/reportdesign/source/ui/report/FixedTextColor.cxx index ca3029b0ad31..8ccfc48ac682 100644 --- a/reportdesign/source/ui/report/FixedTextColor.cxx +++ b/reportdesign/source/ui/report/FixedTextColor.cxx @@ -172,7 +172,7 @@ namespace rptui OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObject); if ( pUnoObj ) // this doesn't need to be done for shapes { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = pController->getSectionWindow(xSection); + OSectionWindow* pSectionWindow = pController->getSectionWindow(xSection); if (pSectionWindow != 0) { OReportSection& aOutputDevice = pSectionWindow->getReportSection(); // OutputDevice diff --git a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx index a2ca68daba83..1255d686fe23 100644 --- a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx +++ b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx @@ -173,7 +173,7 @@ namespace rptui OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObject); if ( pUnoObj ) // this doesn't need to be done for shapes { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_rReportController.getSectionWindow(xSection); + OSectionWindow* pSectionWindow = m_rReportController.getSectionWindow(xSection); if (pSectionWindow != 0) { OReportSection& aOutputDevice = pSectionWindow->getReportSection(); // OutputDevice diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index bd7f17eb582a..24f274ee56dd 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -339,7 +339,6 @@ void OReportController::disposing() { SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pGroupsFloater->GetHelpId(), RTL_TEXTENCODING_UTF8)); aDlgOpt.SetWindowState(OStringToOUString(m_pGroupsFloater->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US)); - ::std::unique_ptr<FloatingWindow> aTemp(m_pGroupsFloater); m_pGroupsFloater = NULL; } @@ -362,7 +361,7 @@ void OReportController::disposing() { try { - ::boost::shared_ptr<OSectionWindow> pSectionWindow; + OSectionWindow* pSectionWindow = NULL; if ( getDesignView() ) pSectionWindow = getDesignView()->getMarkedSection(); if ( pSectionWindow ) @@ -583,7 +582,7 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId); if ( aReturn.bEnabled ) { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection(); + OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection(); if ( pSectionWindow ) aReturn.bEnabled = !pSectionWindow->getReportSection().isUiActive(); } @@ -1135,7 +1134,7 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > break; case SID_TERMINATE_INPLACEACTIVATION: { - ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection(); + OSectionWindow* pSection = getDesignView()->getMarkedSection(); if ( pSection ) pSection->getReportSection().deactivateOle(); } @@ -1568,8 +1567,8 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > uno::Reference< report::XFormattedField> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY); if ( xFormattedField.is() ) { - ConditionalFormattingDialog aDlg( getView(), xFormattedField.get(), *this ); - aDlg.Execute(); + ScopedVclPtrInstance< ConditionalFormattingDialog > aDlg( getView(), xFormattedField.get(), *this ); + aDlg->Execute(); } } break; @@ -1578,8 +1577,8 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > { if ( !aArgs.getLength() ) { - ODateTimeDialog aDlg(getView(),getDesignView()->getCurrentSection(),this); - aDlg.Execute(); + ScopedVclPtrInstance< ODateTimeDialog > aDlg(getView(),getDesignView()->getCurrentSection(),this); + aDlg->Execute(); } else createDateTime(aArgs); @@ -1590,8 +1589,8 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > { if ( !aArgs.getLength() ) { - OPageNumberDialog aDlg(getView(),m_xReportDefinition,this); - aDlg.Execute(); + ScopedVclPtrInstance< OPageNumberDialog > aDlg(getView(),m_xReportDefinition,this); + aDlg->Execute(); } else createPageNumber(aArgs); @@ -1783,9 +1782,9 @@ void OReportController::doOpenHelpAgent() bool OReportController::Construct(vcl::Window* pParent) { - ODesignView* pMyOwnView = new ODesignView( pParent, m_xContext, *this ); + VclPtrInstance<ODesignView> pMyOwnView( pParent, m_xContext, *this ); StartListening( *pMyOwnView ); - setView( *pMyOwnView ); + setView( pMyOwnView ); // now that we have a view we can create the clipboard listener m_aSystemClipboard = TransferableDataHelper::CreateFromSystemClipboard( getView() ); @@ -2481,15 +2480,16 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _ } { // want the dialog to be destroyed before our set - ORptPageDialog aDlg(getView(), pDescriptor.get(),_xSection.is() - ? OUString("BackgroundDialog") - : OUString("PageDialog")); - if (RET_OK == aDlg.Execute()) + ScopedVclPtrInstance<ORptPageDialog> aDlg( + getView(), pDescriptor.get(),_xSection.is() + ? OUString("BackgroundDialog") + : OUString("PageDialog")); + if (RET_OK == aDlg->Execute()) { // ItemSet->UNO // UNO-properties - const SfxItemSet* pSet = aDlg.GetOutputItemSet(); + const SfxItemSet* pSet = aDlg->GetOutputItemSet(); if ( _xSection.is() ) { const SfxPoolItem* pItem; @@ -2578,7 +2578,7 @@ void OReportController::openSortingAndGroupingDialog() return; if ( !m_pGroupsFloater ) { - m_pGroupsFloater = new OGroupsSortingDialog(getView(),!isEditable(),this); + m_pGroupsFloater = VclPtr<OGroupsSortingDialog>::Create(getView(),!isEditable(),this); SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pGroupsFloater->GetHelpId(), RTL_TEXTENCODING_UTF8)); if ( aDlgOpt.Exists() ) m_pGroupsFloater->SetWindowState(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_ASCII_US)); @@ -2791,8 +2791,8 @@ uno::Any SAL_CALL OReportController::getViewData() throw( uno::RuntimeException, aViewData.put( "CollapsedSections", aCollapsedSections ); } - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection(); - if ( pSectionWindow.get() ) + OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection(); + if ( pSectionWindow ) { aViewData.put( "MarkedSection", (sal_Int32)pSectionWindow->getReportSection().getPage()->GetPageNum() ); } @@ -3159,7 +3159,7 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co { SequenceAsHashMap aMap(_aArgs); getDesignView()->setMarked(_xSection, true); - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection(); + OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection(); if ( !pSectionWindow ) return; @@ -3337,7 +3337,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) getDesignView()->unmarkAllObjects(NULL); // Anhand des FormatKeys wird festgestellt, welches Feld benoetigt wird - ::boost::shared_ptr<OSectionWindow> pSectionWindow[2]; + OSectionWindow* pSectionWindow[2]; pSectionWindow[0] = getDesignView()->getMarkedSection(); if ( !pSectionWindow[0] ) @@ -3651,8 +3651,8 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) OSectionView* OReportController::getCurrentSectionView() const { OSectionView* pSectionView = NULL; - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection(); - if ( pSectionWindow.get() ) + OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection(); + if ( pSectionWindow ) pSectionView = &pSectionWindow->getReportSection().getSectionView(); return pSectionView; } @@ -3966,7 +3966,7 @@ void OReportController::createGroupSection(const bool _bUndo,const bool _bHeader void OReportController::collapseSection(const bool _bCollapse) { - ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection(); + OSectionWindow *pSection = getDesignView()->getMarkedSection(); if ( pSection ) { pSection->setCollapsed(_bCollapse); @@ -3975,10 +3975,10 @@ void OReportController::collapseSection(const bool _bCollapse) void OReportController::markSection(const bool _bNext) { - ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection(); + OSectionWindow *pSection = getDesignView()->getMarkedSection(); if ( pSection ) { - ::boost::shared_ptr<OSectionWindow> pPrevSection = getDesignView()->getMarkedSection(_bNext ? POST : PREVIOUS); + OSectionWindow *pPrevSection = getDesignView()->getMarkedSection(_bNext ? POST : PREVIOUS); if ( pPrevSection != pSection && pPrevSection ) select(uno::makeAny(pPrevSection->getReportSection().getSection())); else @@ -4219,16 +4219,15 @@ void OReportController::impl_fillCustomShapeState_nothrow(const char* _pCustomSh } -::boost::shared_ptr<OSectionWindow> OReportController::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const +OSectionWindow* OReportController::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const { if ( getDesignView() ) { - return getDesignView()->getSectionWindow(_xSection); + return getDesignView()->getSectionWindow(_xSection); } // throw NullPointerException? - ::boost::shared_ptr<OSectionWindow> pEmpty; - return pEmpty; + return NULL; } diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index 1a70619ecc33..22a1d986e98d 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -111,6 +111,11 @@ OReportSection::OReportSection(OSectionWindow* _pParent,const uno::Reference< re OReportSection::~OReportSection() { + disposeOnce(); +} + +void OReportSection::dispose() +{ m_pPage = NULL; if ( m_pMulti.is() ) m_pMulti->dispose(); @@ -125,6 +130,8 @@ OReportSection::~OReportSection() m_pView->EndListening( *m_pModel ); m_pView = NULL; } + m_pParent.clear(); + vcl::Window::dispose(); } void OReportSection::Paint( const Rectangle& rRect ) diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx index 74148f6700f3..d43d5584fe8e 100644 --- a/reportdesign/source/ui/report/ReportWindow.cxx +++ b/reportdesign/source/ui/report/ReportWindow.cxx @@ -58,26 +58,26 @@ using namespace ::comphelper; OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView) : Window(_pParent,WB_DIALOGCONTROL) , ::comphelper::OPropertyChangeListener(m_aMutex) -,m_aHRuler(this) +,m_aHRuler(VclPtr<Ruler>::Create(this)) ,m_pView(_pView) ,m_pParent(_pParent) -,m_aViewsWindow(this) +,m_aViewsWindow(VclPtr<rptui::OViewsWindow>::Create(this)) ,m_pObjFac( new DlgEdFactory() ) { SetHelpId(UID_RPT_REPORTWINDOW); SetMapMode( MapMode( MAP_100TH_MM ) ); - m_aViewsWindow.Show(); + m_aViewsWindow->Show(); - m_aHRuler.Show(); - m_aHRuler.Activate(); - m_aHRuler.SetPagePos(0); - m_aHRuler.SetBorders(); - m_aHRuler.SetIndents(); - m_aHRuler.SetMargin1(); - m_aHRuler.SetMargin2(); + m_aHRuler->Show(); + m_aHRuler->Activate(); + m_aHRuler->SetPagePos(0); + m_aHRuler->SetBorders(); + m_aHRuler->SetIndents(); + m_aHRuler->SetMargin1(); + m_aHRuler->SetMargin2(); const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum(); - m_aHRuler.SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH); + m_aHRuler->SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH); ImplInitSettings(); m_pReportListener = addStyleListener(_pView->getController().getReportDefinition(),this); @@ -85,31 +85,40 @@ OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView) OReportWindow::~OReportWindow() { + disposeOnce(); +} + +void OReportWindow::dispose() +{ if ( m_pReportListener.is() ) m_pReportListener->dispose(); + m_aHRuler.disposeAndClear(); + m_aViewsWindow.disposeAndClear(); + m_pView.clear(); + m_pParent.clear(); + vcl::Window::dispose(); } void OReportWindow::SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType ) { - m_aViewsWindow.SetInsertObj( eObj,_sShapeType); + m_aViewsWindow->SetInsertObj( eObj,_sShapeType); } - OUString OReportWindow::GetInsertObjString() const { - return m_aViewsWindow.GetInsertObjString(); + return m_aViewsWindow->GetInsertObjString(); } void OReportWindow::SetMode( DlgEdMode eNewMode ) { - m_aViewsWindow.SetMode(eNewMode); + m_aViewsWindow->SetMode(eNewMode); } void OReportWindow::removeSection(sal_uInt16 _nPosition) { - m_aViewsWindow.removeSection(_nPosition); + m_aViewsWindow->removeSection(_nPosition); m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight()); - m_aViewsWindow.Invalidate(INVALIDATE_TRANSPARENT); + m_aViewsWindow->Invalidate(INVALIDATE_TRANSPARENT); } void OReportWindow::addSection(const uno::Reference< report::XSection >& _xSection,const OUString& _sColorEntry,sal_uInt16 _nPosition) @@ -117,27 +126,27 @@ void OReportWindow::addSection(const uno::Reference< report::XSection >& _xSecti if ( !_xSection.is() ) return; - m_aViewsWindow.addSection(_xSection,_sColorEntry,_nPosition); + m_aViewsWindow->addSection(_xSection,_sColorEntry,_nPosition); m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight()); } void OReportWindow::toggleGrid(bool _bVisible) { - m_aViewsWindow.toggleGrid(_bVisible); + m_aViewsWindow->toggleGrid(_bVisible); } void OReportWindow::showRuler(bool _bShow) { - m_aHRuler.Show(_bShow); + m_aHRuler->Show(_bShow); - m_aViewsWindow.showRuler(_bShow); + m_aViewsWindow->showRuler(_bShow); } sal_Int32 OReportWindow::getMaxMarkerWidth(bool _bWithEnd) const { Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH)); - aStartWidth *= m_aViewsWindow.GetMapMode().GetScaleX(); + aStartWidth *= m_aViewsWindow->GetMapMode().GetScaleX(); if ( _bWithEnd ) aStartWidth += Fraction(long(REPORT_ENDMARKER_WIDTH)); return sal_Int32((long)aStartWidth); @@ -146,7 +155,7 @@ sal_Int32 OReportWindow::getMaxMarkerWidth(bool _bWithEnd) const sal_Int32 OReportWindow::GetTotalWidth() const { sal_Int32 nWidth = 0; - if ( !m_aViewsWindow.empty() ) + if ( !m_aViewsWindow->empty() ) { Fraction aStartWidth(long(REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH )); const Fraction aZoom(m_pView->getController().getZoomValue(),100); @@ -163,7 +172,7 @@ sal_Int32 OReportWindow::GetTotalWidth() const void OReportWindow::Resize() { Window::Resize(); - if ( !m_aViewsWindow.empty() ) + if ( !m_aViewsWindow->empty() ) { const Size aTotalOutputSize = GetOutputSizePixel(); Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH)*m_pView->getController().getZoomValue(),100); @@ -174,26 +183,26 @@ void OReportWindow::Resize() const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width; sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN); sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN); - Size aPageSize = m_aViewsWindow.LogicToPixel(Size(nPaperWidth ,0)); - nLeftMargin = m_aViewsWindow.LogicToPixel(Size(nLeftMargin,0)).Width(); - nRightMargin = m_aViewsWindow.LogicToPixel(Size(nRightMargin,0)).Width(); + Size aPageSize = m_aViewsWindow->LogicToPixel(Size(nPaperWidth ,0)); + nLeftMargin = m_aViewsWindow->LogicToPixel(Size(nLeftMargin,0)).Width(); + nRightMargin = m_aViewsWindow->LogicToPixel(Size(nRightMargin,0)).Width(); - aPageSize.Height() = m_aHRuler.GetSizePixel().Height(); + aPageSize.Height() = m_aHRuler->GetSizePixel().Height(); - const long nTermp(m_aViewsWindow.getTotalHeight() + aPageSize.Height()); + const long nTermp(m_aViewsWindow->getTotalHeight() + aPageSize.Height()); long nSectionsHeight = ::std::max<long>(nTermp,aTotalOutputSize.Height()); - m_aHRuler.SetPosSizePixel(aStartPoint,aPageSize); - m_aHRuler.SetNullOffset(nLeftMargin); - m_aHRuler.SetMargin1(0); - m_aHRuler.SetMargin2(aPageSize.Width() - nLeftMargin - nRightMargin); + m_aHRuler->SetPosSizePixel(aStartPoint,aPageSize); + m_aHRuler->SetNullOffset(nLeftMargin); + m_aHRuler->SetMargin1(0); + m_aHRuler->SetMargin2(aPageSize.Width() - nLeftMargin - nRightMargin); aStartPoint.Y() += aPageSize.Height(); nSectionsHeight -= aStartPoint.Y(); aStartPoint.X() = aOffset.X(); - m_aViewsWindow.SetPosSizePixel(aStartPoint,Size(aTotalOutputSize.Width(),nSectionsHeight)); + m_aViewsWindow->SetPosSizePixel(aStartPoint,Size(aTotalOutputSize.Width(),nSectionsHeight)); } } @@ -221,26 +230,26 @@ void OReportWindow::DataChanged( const DataChangedEvent& rDCEvt ) sal_Int32 OReportWindow::GetTotalHeight() const { - return m_aViewsWindow.getTotalHeight(); + return m_aViewsWindow->getTotalHeight(); } void OReportWindow::ScrollChildren(const Point& _aThumbPos) { - MapMode aMap = m_aHRuler.GetMapMode(); + MapMode aMap = m_aHRuler->GetMapMode(); Point aOrg( aMap.GetOrigin() ); if ( aOrg.X() != (-_aThumbPos.X()) ) { aMap.SetOrigin( Point(- _aThumbPos.X(), aOrg.Y())); - m_aHRuler.SetMapMode( aMap ); - m_aHRuler.Scroll(-(aOrg.X() + _aThumbPos.X()),0); + m_aHRuler->SetMapMode( aMap ); + m_aHRuler->Scroll(-(aOrg.X() + _aThumbPos.X()),0); } - m_aViewsWindow.scrollChildren(_aThumbPos); + m_aViewsWindow->scrollChildren(_aThumbPos); } sal_uInt16 OReportWindow::getSectionCount() const { - return m_aViewsWindow.getSectionCount(); + return m_aViewsWindow->getSectionCount(); } void OReportWindow::notifySizeChanged() @@ -250,129 +259,129 @@ void OReportWindow::notifySizeChanged() bool OReportWindow::HasSelection() const { - return m_aViewsWindow.HasSelection(); + return m_aViewsWindow->HasSelection(); } void OReportWindow::Delete() { - m_aViewsWindow.Delete(); + m_aViewsWindow->Delete(); } void OReportWindow::Copy() { - m_aViewsWindow.Copy(); + m_aViewsWindow->Copy(); } void OReportWindow::Paste() { - m_aViewsWindow.Paste(); + m_aViewsWindow->Paste(); } bool OReportWindow::IsPasteAllowed() const { - return m_aViewsWindow.IsPasteAllowed(); + return m_aViewsWindow->IsPasteAllowed(); } void OReportWindow::SelectAll(const sal_uInt16 _nObjectType) { - m_aViewsWindow.SelectAll(_nObjectType); + m_aViewsWindow->SelectAll(_nObjectType); } void OReportWindow::unmarkAllObjects(OSectionView* _pSectionView) { - m_aViewsWindow.unmarkAllObjects(_pSectionView); + m_aViewsWindow->unmarkAllObjects(_pSectionView); } void OReportWindow::showProperties(const uno::Reference< report::XSection>& _xReportComponent) { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aViewsWindow.getSectionWindow( _xReportComponent ); + OSectionWindow* pSectionWindow = m_aViewsWindow->getSectionWindow( _xReportComponent ); m_pView->UpdatePropertyBrowserDelayed(pSectionWindow->getReportSection().getSectionView()); } bool OReportWindow::handleKeyEvent(const KeyEvent& _rEvent) { - return m_aViewsWindow.handleKeyEvent(_rEvent); + return m_aViewsWindow->handleKeyEvent(_rEvent); } void OReportWindow::setMarked(OSectionView* _pSectionView, bool _bMark) { if ( _pSectionView ) - m_aViewsWindow.setMarked(_pSectionView,_bMark); + m_aViewsWindow->setMarked(_pSectionView,_bMark); } void OReportWindow::setMarked(const uno::Reference< report::XSection>& _xSection, bool _bMark) { - m_aViewsWindow.setMarked(_xSection,_bMark); + m_aViewsWindow->setMarked(_xSection,_bMark); } void OReportWindow::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _xShape, bool _bMark) { - m_aViewsWindow.setMarked(_xShape,_bMark); + m_aViewsWindow->setMarked(_xShape,_bMark); } -::boost::shared_ptr<OSectionWindow> OReportWindow::getMarkedSection(NearSectionAccess nsa) const +OSectionWindow* OReportWindow::getMarkedSection(NearSectionAccess nsa) const { - return m_aViewsWindow.getMarkedSection(nsa); + return m_aViewsWindow->getMarkedSection(nsa); } -::boost::shared_ptr<OSectionWindow> OReportWindow::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const +OSectionWindow* OReportWindow::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const { - return m_aViewsWindow.getSectionWindow(_xSection); + return m_aViewsWindow->getSectionWindow(_xSection); } void OReportWindow::markSection(const sal_uInt16 _nPos) { - m_aViewsWindow.markSection(_nPos); + m_aViewsWindow->markSection(_nPos); } void OReportWindow::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const { - m_aViewsWindow.fillCollapsedSections(_rCollapsedPositions); + m_aViewsWindow->fillCollapsedSections(_rCollapsedPositions); } void OReportWindow::collapseSections(const uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections) { - m_aViewsWindow.collapseSections(_aCollpasedSections); + m_aViewsWindow->collapseSections(_aCollpasedSections); } void OReportWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects) { - m_aViewsWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects); + m_aViewsWindow->alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects); } void OReportWindow::setGridSnap(bool bOn) { - m_aViewsWindow.setGridSnap(bOn); + m_aViewsWindow->setGridSnap(bOn); } void OReportWindow::setDragStripes(bool bOn) { - m_aViewsWindow.setDragStripes(bOn); + m_aViewsWindow->setDragStripes(bOn); } sal_uInt32 OReportWindow::getMarkedObjectCount() const { - return m_aViewsWindow.getMarkedObjectCount(); + return m_aViewsWindow->getMarkedObjectCount(); } void OReportWindow::zoom(const Fraction& _aZoom) { - m_aHRuler.SetZoom(_aZoom); - m_aHRuler.Invalidate(); + m_aHRuler->SetZoom(_aZoom); + m_aHRuler->Invalidate(); - m_aViewsWindow.zoom(_aZoom); + m_aViewsWindow->zoom(_aZoom); notifySizeChanged(); const Point aNewThumbPos( m_pParent->getThumbPos() ); @@ -385,7 +394,7 @@ void OReportWindow::zoom(const Fraction& _aZoom) void OReportWindow::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const { - m_aViewsWindow.fillControlModelSelection(_rSelection); + m_aViewsWindow->fillControlModelSelection(_rSelection); } sal_Int32 OReportWindow::impl_getRealPixelWidth() const @@ -411,7 +420,7 @@ sal_uInt16 OReportWindow::getZoomFactor(SvxZoomType _eType) const { nZoom = (sal_uInt16)(long)Fraction(aSize.Width()*100,impl_getRealPixelWidth()); MapMode aMap( MAP_100TH_MM ); - const Size aHeight = m_aViewsWindow.LogicToPixel(m_aViewsWindow.PixelToLogic(Size(0,GetTotalHeight() + m_aHRuler.GetSizePixel().Height())),aMap); + const Size aHeight = m_aViewsWindow->LogicToPixel(m_aViewsWindow->PixelToLogic(Size(0,GetTotalHeight() + m_aHRuler->GetSizePixel().Height())),aMap); nZoom = ::std::min(nZoom,(sal_uInt16)(long)Fraction(aSize.Height()*100,aHeight.Height())); } break; @@ -429,7 +438,7 @@ void OReportWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) { (void)_rEvent; Resize(); - m_aViewsWindow.Resize(); + m_aViewsWindow->Resize(); static sal_Int32 nIn = INVALIDATE_TRANSPARENT; Invalidate(nIn); } diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx index d5cf903a4bac..ba789bc9f774 100644 --- a/reportdesign/source/ui/report/ScrollHelper.cxx +++ b/reportdesign/source/ui/report/ScrollHelper.cxx @@ -46,20 +46,20 @@ void lcl_setScrollBar(sal_Int32 _nNewValue,const Point& _aPos,const Size& _aSize OScrollWindowHelper::OScrollWindowHelper( ODesignView* _pDesignView) : OScrollWindowHelper_BASE( _pDesignView,WB_DIALOGCONTROL) ,OPropertyChangeListener(m_aMutex) - ,m_aHScroll( this, WB_HSCROLL|WB_REPEAT|WB_DRAG ) - ,m_aVScroll( this, WB_VSCROLL|WB_REPEAT|WB_DRAG ) - ,m_aCornerWin( this ) + ,m_aHScroll( VclPtr<ScrollBar>::Create(this, WB_HSCROLL|WB_REPEAT|WB_DRAG) ) + ,m_aVScroll( VclPtr<ScrollBar>::Create(this, WB_VSCROLL|WB_REPEAT|WB_DRAG) ) + ,m_aCornerWin( VclPtr<ScrollBarBox>::Create(this) ) ,m_pParent(_pDesignView) - ,m_aReportWindow(this,m_pParent) + ,m_aReportWindow(VclPtr<rptui::OReportWindow>::Create(this,m_pParent)) ,m_pReportDefintionMultiPlexer(NULL) { SetMapMode( MapMode( MAP_100TH_MM ) ); - impl_initScrollBar( m_aHScroll ); - impl_initScrollBar( m_aVScroll ); + impl_initScrollBar( *m_aHScroll.get() ); + impl_initScrollBar( *m_aVScroll.get() ); - m_aReportWindow.SetMapMode( MapMode( MAP_100TH_MM ) ); - m_aReportWindow.Show(); + m_aReportWindow->SetMapMode( MapMode( MAP_100TH_MM ) ); + m_aReportWindow->Show(); // normally we should be SCROLL_PANE SetAccessibleRole(css::accessibility::AccessibleRole::SCROLL_PANE); @@ -69,8 +69,20 @@ OScrollWindowHelper::OScrollWindowHelper( ODesignView* _pDesignView) OScrollWindowHelper::~OScrollWindowHelper() { + disposeOnce(); +} + +void OScrollWindowHelper::dispose() +{ if ( m_pReportDefintionMultiPlexer.is() ) m_pReportDefintionMultiPlexer->dispose(); + + m_aHScroll.disposeAndClear(); + m_aVScroll.disposeAndClear(); + m_aCornerWin.disposeAndClear(); + m_aReportWindow.disposeAndClear(); + m_pParent.clear(); + OScrollWindowHelper_BASE::dispose(); } @@ -101,8 +113,8 @@ void OScrollWindowHelper::setTotalSize(sal_Int32 _nWidth ,sal_Int32 _nHeight) // now set the ranges without start marker Fraction aStartWidth(REPORT_STARTMARKER_WIDTH * m_pParent->getController().getZoomValue(),100); long nWidth = long(_nWidth - (double)aStartWidth); - m_aHScroll.SetRangeMax( nWidth ); - m_aVScroll.SetRangeMax( m_aTotalPixelSize.Height() ); + m_aHScroll->SetRangeMax( nWidth ); + m_aVScroll->SetRangeMax( m_aTotalPixelSize.Height() ); Resize(); } @@ -114,7 +126,7 @@ Size OScrollWindowHelper::ResizeScrollBars() if ( aOutPixSz.Width() == 0 || aOutPixSz.Height() == 0 ) return aOutPixSz; - aOutPixSz.Height() -= m_aReportWindow.getRulerHeight(); + aOutPixSz.Height() -= m_aReportWindow->getRulerHeight(); // determine the size of the output-area and if we need scrollbars const long nScrSize = GetSettings().GetStyleSettings().GetScrollBarSize(); bool bVVisible = false; // by default no vertical-ScrollBar @@ -143,31 +155,31 @@ Size OScrollWindowHelper::ResizeScrollBars() } while ( bChanged ); // until no visibility has changed - aOutPixSz.Height() += m_aReportWindow.getRulerHeight(); + aOutPixSz.Height() += m_aReportWindow->getRulerHeight(); // show or hide scrollbars - m_aVScroll.Show( bVVisible ); - m_aHScroll.Show( bHVisible ); + m_aVScroll->Show( bVVisible ); + m_aHScroll->Show( bHVisible ); // disable painting in the corner between the scrollbars if ( bVVisible && bHVisible ) { - m_aCornerWin.SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()), Size(nScrSize, nScrSize) ); - m_aCornerWin.Show(); + m_aCornerWin->SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()), Size(nScrSize, nScrSize) ); + m_aCornerWin->Show(); } else - m_aCornerWin.Hide(); + m_aCornerWin->Hide(); const Point aOffset = LogicToPixel( Point( SECTION_OFFSET, SECTION_OFFSET ), MAP_APPFONT ); // resize scrollbars and set their ranges { Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH*m_pParent->getController().getZoomValue()),100); const sal_Int32 nNewWidth = aOutPixSz.Width() - aOffset.X() - (long)aStartWidth; - lcl_setScrollBar(nNewWidth,Point( (long)aStartWidth + aOffset.X(), aOutPixSz.Height() ),Size( nNewWidth, nScrSize ),m_aHScroll); + lcl_setScrollBar(nNewWidth,Point( (long)aStartWidth + aOffset.X(), aOutPixSz.Height() ), Size( nNewWidth, nScrSize ), *m_aHScroll.get()); } { - const sal_Int32 nNewHeight = aOutPixSz.Height() - m_aReportWindow.getRulerHeight(); - lcl_setScrollBar(nNewHeight,Point( aOutPixSz.Width(), m_aReportWindow.getRulerHeight() ),Size( nScrSize,nNewHeight),m_aVScroll); + const sal_Int32 nNewHeight = aOutPixSz.Height() - m_aReportWindow->getRulerHeight(); + lcl_setScrollBar(nNewHeight,Point( aOutPixSz.Width(), m_aReportWindow->getRulerHeight() ), Size( nScrSize,nNewHeight), *m_aVScroll.get()); } return aOutPixSz; @@ -178,12 +190,12 @@ void OScrollWindowHelper::Resize() OScrollWindowHelper_BASE::Resize(); const Size aTotalOutputSize = ResizeScrollBars(); - m_aReportWindow.SetPosSizePixel(Point( 0, 0 ),aTotalOutputSize); + m_aReportWindow->SetPosSizePixel(Point( 0, 0 ),aTotalOutputSize); } IMPL_LINK( OScrollWindowHelper, ScrollHdl, ScrollBar*, /*pScroll*/ ) { - m_aReportWindow.ScrollChildren( getThumbPos() ); + m_aReportWindow->ScrollChildren( getThumbPos() ); return 0; } @@ -191,127 +203,127 @@ void OScrollWindowHelper::addSection(const uno::Reference< report::XSection >& _ ,const OUString& _sColorEntry ,sal_uInt16 _nPosition) { - m_aReportWindow.addSection(_xSection,_sColorEntry,_nPosition); + m_aReportWindow->addSection(_xSection,_sColorEntry,_nPosition); } void OScrollWindowHelper::removeSection(sal_uInt16 _nPosition) { - m_aReportWindow.removeSection(_nPosition); + m_aReportWindow->removeSection(_nPosition); } void OScrollWindowHelper::toggleGrid(bool _bVisible) { - m_aReportWindow.toggleGrid(_bVisible); + m_aReportWindow->toggleGrid(_bVisible); } sal_uInt16 OScrollWindowHelper::getSectionCount() const { - return m_aReportWindow.getSectionCount(); + return m_aReportWindow->getSectionCount(); } void OScrollWindowHelper::SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType ) { - m_aReportWindow.SetInsertObj(eObj,_sShapeType); + m_aReportWindow->SetInsertObj(eObj,_sShapeType); } OUString OScrollWindowHelper::GetInsertObjString() const { - return m_aReportWindow.GetInsertObjString(); + return m_aReportWindow->GetInsertObjString(); } void OScrollWindowHelper::SetMode( DlgEdMode _eNewMode ) { - m_aReportWindow.SetMode(_eNewMode); + m_aReportWindow->SetMode(_eNewMode); } bool OScrollWindowHelper::HasSelection() const { - return m_aReportWindow.HasSelection(); + return m_aReportWindow->HasSelection(); } void OScrollWindowHelper::Delete() { - m_aReportWindow.Delete(); + m_aReportWindow->Delete(); } void OScrollWindowHelper::Copy() { - m_aReportWindow.Copy(); + m_aReportWindow->Copy(); } void OScrollWindowHelper::Paste() { - m_aReportWindow.Paste(); + m_aReportWindow->Paste(); } bool OScrollWindowHelper::IsPasteAllowed() const { - return m_aReportWindow.IsPasteAllowed(); + return m_aReportWindow->IsPasteAllowed(); } void OScrollWindowHelper::SelectAll(const sal_uInt16 _nObjectType) { - m_aReportWindow.SelectAll(_nObjectType); + m_aReportWindow->SelectAll(_nObjectType); } void OScrollWindowHelper::unmarkAllObjects(OSectionView* _pSectionView) { - m_aReportWindow.unmarkAllObjects(_pSectionView); + m_aReportWindow->unmarkAllObjects(_pSectionView); } sal_Int32 OScrollWindowHelper::getMaxMarkerWidth(bool _bWithEnd) const { - return m_aReportWindow.getMaxMarkerWidth(_bWithEnd); + return m_aReportWindow->getMaxMarkerWidth(_bWithEnd); } void OScrollWindowHelper::showRuler(bool _bShow) { - m_aReportWindow.showRuler(_bShow); + m_aReportWindow->showRuler(_bShow); } bool OScrollWindowHelper::handleKeyEvent(const KeyEvent& _rEvent) { - return m_aReportWindow.handleKeyEvent(_rEvent); + return m_aReportWindow->handleKeyEvent(_rEvent); } void OScrollWindowHelper::setMarked(OSectionView* _pSectionView, bool _bMark) { - m_aReportWindow.setMarked(_pSectionView,_bMark); + m_aReportWindow->setMarked(_pSectionView,_bMark); } void OScrollWindowHelper::setMarked(const uno::Reference< report::XSection>& _xSection, bool _bMark) { - m_aReportWindow.setMarked(_xSection,_bMark); + m_aReportWindow->setMarked(_xSection,_bMark); } void OScrollWindowHelper::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _xShape, bool _bMark) { - m_aReportWindow.setMarked(_xShape,_bMark); + m_aReportWindow->setMarked(_xShape,_bMark); } -::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getMarkedSection(NearSectionAccess nsa) const +OSectionWindow* OScrollWindowHelper::getMarkedSection(NearSectionAccess nsa) const { - return m_aReportWindow.getMarkedSection(nsa); + return m_aReportWindow->getMarkedSection(nsa); } -::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const +OSectionWindow* OScrollWindowHelper::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const { - return m_aReportWindow.getSectionWindow(_xSection); + return m_aReportWindow->getSectionWindow(_xSection); } void OScrollWindowHelper::markSection(const sal_uInt16 _nPos) { - m_aReportWindow.markSection(_nPos); + m_aReportWindow->markSection(_nPos); } void OScrollWindowHelper::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const { - m_aReportWindow.fillCollapsedSections(_rCollapsedPositions); + m_aReportWindow->fillCollapsedSections(_rCollapsedPositions); } void OScrollWindowHelper::collapseSections(const uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections) { - m_aReportWindow.collapseSections(_aCollpasedSections); + m_aReportWindow->collapseSections(_aCollpasedSections); } bool OScrollWindowHelper::Notify( NotifyEvent& rNEvt ) @@ -324,11 +336,11 @@ bool OScrollWindowHelper::Notify( NotifyEvent& rNEvt ) { ScrollBar* pHScrBar = NULL; ScrollBar* pVScrBar = NULL; - if ( m_aHScroll.IsVisible() ) - pHScrBar = &m_aHScroll; + if ( m_aHScroll->IsVisible() ) + pHScrBar = m_aHScroll.get(); - if ( m_aVScroll.IsVisible() ) - pVScrBar = &m_aVScroll; + if ( m_aVScroll->IsVisible() ) + pVScrBar = m_aVScroll.get(); if ( HandleScrollCommand( *pCommandEvent, pHScrBar, pVScrBar ) ) return true; @@ -338,7 +350,7 @@ bool OScrollWindowHelper::Notify( NotifyEvent& rNEvt ) void OScrollWindowHelper::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects) { - m_aReportWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects); + m_aReportWindow->alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects); } void OScrollWindowHelper::ImplInitSettings() @@ -363,39 +375,39 @@ void OScrollWindowHelper::DataChanged( const DataChangedEvent& rDCEvt ) void OScrollWindowHelper::_propertyChanged(const beans::PropertyChangeEvent& /*_rEvent*/) throw (uno::RuntimeException, std::exception) { - m_aReportWindow.notifySizeChanged(); + m_aReportWindow->notifySizeChanged(); } void OScrollWindowHelper::setGridSnap(bool bOn) { - m_aReportWindow.setGridSnap(bOn); + m_aReportWindow->setGridSnap(bOn); } void OScrollWindowHelper::setDragStripes(bool bOn) { - m_aReportWindow.setDragStripes(bOn); + m_aReportWindow->setDragStripes(bOn); } sal_uInt32 OScrollWindowHelper::getMarkedObjectCount() const { - return m_aReportWindow.getMarkedObjectCount(); + return m_aReportWindow->getMarkedObjectCount(); } void OScrollWindowHelper::zoom(const Fraction& _aZoom) { - m_aReportWindow.zoom(_aZoom); + m_aReportWindow->zoom(_aZoom); Resize(); Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_TRANSPARENT); } void OScrollWindowHelper::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const { - m_aReportWindow.fillControlModelSelection(_rSelection); + m_aReportWindow->fillControlModelSelection(_rSelection); } sal_uInt16 OScrollWindowHelper::getZoomFactor(SvxZoomType _eType) const { - return m_aReportWindow.getZoomFactor(_eType); + return m_aReportWindow->getZoomFactor(_eType); } } // rptui diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx index b3c50f17b7e6..bb37ceb4cdd4 100644 --- a/reportdesign/source/ui/report/SectionWindow.cxx +++ b/reportdesign/source/ui/report/SectionWindow.cxx @@ -48,35 +48,35 @@ OSectionWindow::OSectionWindow( OViewsWindow* _pParent,const uno::Reference< rep : Window( _pParent,WB_DIALOGCONTROL) ,OPropertyChangeListener(m_aMutex) ,m_pParent(_pParent) -,m_aStartMarker( this,_sColorEntry) -,m_aReportSection( this,_xSection) -,m_aSplitter(this) -,m_aEndMarker( this,_sColorEntry) +,m_aStartMarker( VclPtr<rptui::OStartMarker>::Create(this,_sColorEntry)) +,m_aReportSection( VclPtr<rptui::OReportSection>::Create(this,_xSection)) +,m_aSplitter(VclPtr<Splitter>::Create(this)) +,m_aEndMarker( VclPtr<rptui::OEndMarker>::Create(this,_sColorEntry)) { SetUniqueId(UID_RPT_SECTIONSWINDOW); const MapMode& rMapMode = _pParent->GetMapMode(); SetMapMode( rMapMode ); ImplInitSettings(); // TRY - m_aSplitter.SetMapMode( MapMode( MAP_100TH_MM ) ); - m_aSplitter.SetStartSplitHdl(LINK(this, OSectionWindow,StartSplitHdl)); - m_aSplitter.SetSplitHdl(LINK(this, OSectionWindow,SplitHdl)); - m_aSplitter.SetEndSplitHdl(LINK(this, OSectionWindow,EndSplitHdl)); - m_aSplitter.SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() )); - m_aSplitter.SetSplitPosPixel(m_aSplitter.LogicToPixel(Size(0,_xSection->getHeight())).Height()); + m_aSplitter->SetMapMode( MapMode( MAP_100TH_MM ) ); + m_aSplitter->SetStartSplitHdl(LINK(this, OSectionWindow,StartSplitHdl)); + m_aSplitter->SetSplitHdl(LINK(this, OSectionWindow,SplitHdl)); + m_aSplitter->SetEndSplitHdl(LINK(this, OSectionWindow,EndSplitHdl)); + m_aSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() )); + m_aSplitter->SetSplitPosPixel(m_aSplitter->LogicToPixel(Size(0,_xSection->getHeight())).Height()); - m_aStartMarker.setCollapsedHdl(LINK(this,OSectionWindow,Collapsed)); + m_aStartMarker->setCollapsedHdl(LINK(this,OSectionWindow,Collapsed)); - m_aStartMarker.zoom(rMapMode.GetScaleX()); - setZoomFactor(rMapMode.GetScaleX(),m_aReportSection); - setZoomFactor(rMapMode.GetScaleX(),m_aSplitter); - setZoomFactor(rMapMode.GetScaleX(),m_aEndMarker); + m_aStartMarker->zoom(rMapMode.GetScaleX()); + setZoomFactor(rMapMode.GetScaleX(), *m_aReportSection.get()); + setZoomFactor(rMapMode.GetScaleX(), *m_aSplitter.get()); + setZoomFactor(rMapMode.GetScaleX(), *m_aEndMarker.get()); - m_aSplitter.Show(); - m_aStartMarker.Show(); - m_aReportSection.Show(); - m_aEndMarker.Show(); + m_aSplitter->Show(); + m_aStartMarker->Show(); + m_aReportSection->Show(); + m_aEndMarker->Show(); Show(); m_pSectionMulti = new OPropertyChangeMultiplexer(this,_xSection.get()); @@ -100,6 +100,11 @@ OSectionWindow::OSectionWindow( OViewsWindow* _pParent,const uno::Reference< rep OSectionWindow::~OSectionWindow() { + disposeOnce(); +} + +void OSectionWindow::dispose() +{ try { if ( m_pSectionMulti.is() ) @@ -110,6 +115,12 @@ OSectionWindow::~OSectionWindow() catch (uno::Exception&) { } + m_aStartMarker.disposeAndClear(); + m_aReportSection.disposeAndClear(); + m_aSplitter.disposeAndClear(); + m_aEndMarker.disposeAndClear(); + m_pParent.clear(); + vcl::Window::dispose(); } void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) @@ -119,7 +130,7 @@ void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) const uno::Reference< report::XSection > xSection(_rEvent.Source,uno::UNO_QUERY); if ( xSection.is() ) { - const uno::Reference< report::XSection> xCurrentSection = m_aReportSection.getSection(); + const uno::Reference< report::XSection> xCurrentSection = m_aReportSection->getSection(); if ( _rEvent.PropertyName == PROPERTY_HEIGHT ) { m_pParent->getView()->SetUpdateMode(false); @@ -137,13 +148,13 @@ void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) || setReportSectionTitle(xReport,RID_STR_PAGE_HEADER,::std::mem_fun(&OReportHelper::getPageHeader),::std::mem_fun(&OReportHelper::getPageHeaderOn)) || setReportSectionTitle(xReport,RID_STR_PAGE_FOOTER,::std::mem_fun(&OReportHelper::getPageFooter),::std::mem_fun(&OReportHelper::getPageFooterOn)) ) { - m_aStartMarker.Invalidate(INVALIDATE_NOERASE); + m_aStartMarker->Invalidate(INVALIDATE_NOERASE); } else { OUString sTitle = ModuleRes(RID_STR_DETAIL); - m_aStartMarker.setTitle(sTitle); - m_aStartMarker.Invalidate(INVALIDATE_CHILDREN); + m_aStartMarker->setTitle(sTitle); + m_aStartMarker->Invalidate(INVALIDATE_CHILDREN); } } } @@ -160,12 +171,12 @@ void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) bool OSectionWindow::setReportSectionTitle(const uno::Reference< report::XReportDefinition>& _xReport,sal_uInt16 _nResId,::std::mem_fun_t<uno::Reference<report::XSection> , OReportHelper> _pGetSection, const ::std::mem_fun_t<bool,OReportHelper>& _pIsSectionOn) { OReportHelper aReportHelper(_xReport); - const bool bRet = _pIsSectionOn(&aReportHelper) && _pGetSection(&aReportHelper) == m_aReportSection.getSection(); + const bool bRet = _pIsSectionOn(&aReportHelper) && _pGetSection(&aReportHelper) == m_aReportSection->getSection(); if ( bRet ) { OUString sTitle = ModuleRes(_nResId); - m_aStartMarker.setTitle(sTitle); - m_aStartMarker.Invalidate(INVALIDATE_CHILDREN); + m_aStartMarker->setTitle(sTitle); + m_aStartMarker->Invalidate(INVALIDATE_CHILDREN); } return bRet; } @@ -173,7 +184,7 @@ bool OSectionWindow::setReportSectionTitle(const uno::Reference< report::XReport bool OSectionWindow::setGroupSectionTitle(const uno::Reference< report::XGroup>& _xGroup,sal_uInt16 _nResId,::std::mem_fun_t<uno::Reference<report::XSection> , OGroupHelper> _pGetSection, const ::std::mem_fun_t<bool,OGroupHelper>& _pIsSectionOn) { OGroupHelper aGroupHelper(_xGroup); - const bool bRet = _pIsSectionOn(&aGroupHelper) && _pGetSection(&aGroupHelper) == m_aReportSection.getSection() ; + const bool bRet = _pIsSectionOn(&aGroupHelper) && _pGetSection(&aGroupHelper) == m_aReportSection->getSection() ; if ( bRet ) { OUString sExpression = _xGroup->getExpression(); @@ -185,8 +196,8 @@ bool OSectionWindow::setGroupSectionTitle(const uno::Reference< report::XGroup>& OUString sTitle( ModuleRes(_nResId).toString() ); sTitle = sTitle.replaceFirst("#", sExpression); - m_aStartMarker.setTitle( sTitle ); - m_aStartMarker.Invalidate(INVALIDATE_CHILDREN); + m_aStartMarker->setTitle( sTitle ); + m_aStartMarker->Invalidate(INVALIDATE_CHILDREN); } return bRet; } @@ -225,12 +236,12 @@ void OSectionWindow::Resize() const Point aThumbPos = m_pParent->getView()->getThumbPos(); aOutputSize.Width() -= aThumbPos.X(); - aOutputSize.Height() -= m_aSplitter.GetSizePixel().Height(); + aOutputSize.Height() -= m_aSplitter->GetSizePixel().Height(); - if ( m_aStartMarker.isCollapsed() ) + if ( m_aStartMarker->isCollapsed() ) { Point aPos(0,0); - m_aStartMarker.SetPosSizePixel(aPos,aOutputSize); + m_aStartMarker->SetPosSizePixel(aPos,aOutputSize); } else { @@ -240,49 +251,49 @@ void OSectionWindow::Resize() aStartWidth *= GetMapMode().GetScaleX(); // set start marker - m_aStartMarker.SetPosSizePixel(Point(0,0),Size(aStartWidth,aOutputSize.Height())); + m_aStartMarker->SetPosSizePixel(Point(0,0),Size(aStartWidth,aOutputSize.Height())); // set report section - const uno::Reference< report::XSection> xSection = m_aReportSection.getSection(); + const uno::Reference< report::XSection> xSection = m_aReportSection->getSection(); Size aSectionSize = LogicToPixel( Size( 0,xSection->getHeight() ) ); Point aReportPos(aStartWidth,0); aSectionSize.Width() = aOutputSize.Width() - (long)aStartWidth; if ( bShowEndMarker ) aSectionSize.Width() -= (long)aEndWidth; - m_aReportSection.SetPosSizePixel(aReportPos,aSectionSize); + m_aReportSection->SetPosSizePixel(aReportPos,aSectionSize); // set splitter aReportPos.Y() += aSectionSize.Height(); - m_aSplitter.SetPosSizePixel(aReportPos,Size(aSectionSize.Width(),m_aSplitter.GetSizePixel().Height())); + m_aSplitter->SetPosSizePixel(aReportPos,Size(aSectionSize.Width(),m_aSplitter->GetSizePixel().Height())); aSectionSize.Height() = (long)(1000 * (double)GetMapMode().GetScaleY()); - m_aSplitter.SetDragRectPixel( Rectangle(Point(aStartWidth,0),aSectionSize)); + m_aSplitter->SetDragRectPixel( Rectangle(Point(aStartWidth,0),aSectionSize)); // set end marker aReportPos.X() += aSectionSize.Width(); aReportPos.Y() = 0; - m_aEndMarker.Show(bShowEndMarker); - m_aEndMarker.SetPosSizePixel(aReportPos,Size(aEndWidth,aOutputSize.Height())); + m_aEndMarker->Show(bShowEndMarker); + m_aEndMarker->SetPosSizePixel(aReportPos,Size(aEndWidth,aOutputSize.Height())); } } void OSectionWindow::setCollapsed(bool _bCollapsed) { - if ( m_aStartMarker.isCollapsed() != _bCollapsed ) + if ( m_aStartMarker->isCollapsed() != _bCollapsed ) { - m_aStartMarker.setCollapsed(_bCollapsed); + m_aStartMarker->setCollapsed(_bCollapsed); } } void OSectionWindow::showProperties() { - m_pParent->getView()->showProperties( m_aReportSection.getSection().get() ); + m_pParent->getView()->showProperties( m_aReportSection->getSection().get() ); } void OSectionWindow::setMarked(bool _bMark) { - m_aStartMarker.setMarked(_bMark); - m_aEndMarker.setMarked(_bMark); + m_aStartMarker->setMarked(_bMark); + m_aEndMarker->setMarked(_bMark); } IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker ) @@ -290,9 +301,9 @@ IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker ) if ( _pMarker ) { bool bShow = !_pMarker->isCollapsed(); - m_aReportSection.Show(bShow); - m_aEndMarker.Show(bShow); - m_aSplitter.Show(bShow); + m_aReportSection->Show(bShow); + m_aEndMarker->Show(bShow); + m_aSplitter->Show(bShow); m_pParent->resize(*this); } @@ -302,11 +313,11 @@ IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker ) void OSectionWindow::zoom(const Fraction& _aZoom) { setZoomFactor(_aZoom,*this); - m_aStartMarker.zoom(_aZoom); + m_aStartMarker->zoom(_aZoom); - setZoomFactor(_aZoom,m_aReportSection); - setZoomFactor(_aZoom,m_aSplitter); - setZoomFactor(_aZoom,m_aEndMarker); + setZoomFactor(_aZoom, *m_aReportSection.get()); + setZoomFactor(_aZoom, *m_aSplitter.get()); + setZoomFactor(_aZoom, *m_aEndMarker.get()); Invalidate(); } @@ -332,8 +343,8 @@ IMPL_LINK( OSectionWindow, SplitHdl, Splitter*, _pSplitter ) sal_Int32 nSplitPos = _pSplitter->GetSplitPosPixel(); - const uno::Reference< report::XSection> xSection = m_aReportSection.getSection(); - nSplitPos = m_aSplitter.PixelToLogic(Size(0,nSplitPos)).Height(); + const uno::Reference< report::XSection> xSection = m_aReportSection->getSection(); + nSplitPos = m_aSplitter->PixelToLogic(Size(0,nSplitPos)).Height(); const sal_Int32 nCount = xSection->getCount(); for (sal_Int32 i = 0; i < nCount; ++i) @@ -349,7 +360,7 @@ IMPL_LINK( OSectionWindow, SplitHdl, Splitter*, _pSplitter ) nSplitPos = 0; xSection->setHeight(nSplitPos); - m_aSplitter.SetSplitPosPixel(m_aSplitter.LogicToPixel(Size(0,nSplitPos)).Height()); + m_aSplitter->SetSplitPosPixel(m_aSplitter->LogicToPixel(Size(0,nSplitPos)).Height()); return 0L; } @@ -371,21 +382,21 @@ void OSectionWindow::scrollChildren(long _nX) { const Point aDelta( _nX,0 ); - MapMode aMapMode( m_aReportSection.GetMapMode() ); + MapMode aMapMode( m_aReportSection->GetMapMode() ); const Point aOld = aMapMode.GetOrigin(); - lcl_setOrigin(m_aReportSection,aDelta.X(), 0); + lcl_setOrigin(*m_aReportSection.get(), aDelta.X(), 0); - aMapMode = m_aReportSection.GetMapMode(); + aMapMode = m_aReportSection->GetMapMode(); const Point aNew = aMapMode.GetOrigin(); const Point aDiff = aOld - aNew; { - lcl_scroll(m_aReportSection,aDiff); + lcl_scroll(*m_aReportSection.get(), aDiff); } - lcl_scroll(m_aEndMarker,m_aEndMarker.PixelToLogic(Point(_nX,0))); + lcl_scroll(*m_aEndMarker.get(), m_aEndMarker->PixelToLogic(Point(_nX,0))); - lcl_setOrigin(m_aSplitter,_nX, 0); - lcl_scroll(m_aSplitter,aDiff); + lcl_setOrigin(*m_aSplitter.get(),_nX, 0); + lcl_scroll(*m_aSplitter.get(),aDiff); } } // rptui diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx index 37a1e7ce4608..a435b02a38ed 100644 --- a/reportdesign/source/ui/report/StartMarker.cxx +++ b/reportdesign/source/ui/report/StartMarker.cxx @@ -48,9 +48,9 @@ oslInterlockedCount OStartMarker::s_nImageRefCount = 0; OStartMarker::OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry) : OColorListener(_pParent,_sColorEntry) -,m_aVRuler(this,WB_VERT) -,m_aText(this,WB_HYPHENATION) -,m_aImage(this,WB_LEFT|WB_TOP|WB_SCALE) +,m_aVRuler(VclPtr<Ruler>::Create(this,WB_VERT)) +,m_aText(VclPtr<FixedText>::Create(this,WB_HYPHENATION)) +,m_aImage(VclPtr<FixedImage>::Create(this,WB_LEFT|WB_TOP|WB_SCALE)) ,m_pParent(_pParent) ,m_bShowRuler(true) { @@ -59,20 +59,20 @@ OStartMarker::OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry osl_atomic_increment(&s_nImageRefCount); initDefaultNodeImages(); ImplInitSettings(); - m_aText.SetHelpId(HID_RPT_START_TITLE); - m_aText.SetPaintTransparent(true); - m_aImage.SetHelpId(HID_RPT_START_IMAGE); - m_aText.Show(); - m_aImage.Show(); - m_aVRuler.Show(); - m_aVRuler.Activate(); - m_aVRuler.SetPagePos(0); - m_aVRuler.SetBorders(); - m_aVRuler.SetIndents(); - m_aVRuler.SetMargin1(); - m_aVRuler.SetMargin2(); + m_aText->SetHelpId(HID_RPT_START_TITLE); + m_aText->SetPaintTransparent(true); + m_aImage->SetHelpId(HID_RPT_START_IMAGE); + m_aText->Show(); + m_aImage->Show(); + m_aVRuler->Show(); + m_aVRuler->Activate(); + m_aVRuler->SetPagePos(0); + m_aVRuler->SetBorders(); + m_aVRuler->SetIndents(); + m_aVRuler->SetMargin1(); + m_aVRuler->SetMargin2(); const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum(); - m_aVRuler.SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH); + m_aVRuler->SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH); EnableChildTransparentMode( true ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); SetPaintTransparent( true ); @@ -80,18 +80,28 @@ OStartMarker::OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry OStartMarker::~OStartMarker() { + disposeOnce(); +} + +void OStartMarker::dispose() +{ if ( osl_atomic_decrement(&s_nImageRefCount) == 0 ) { DELETEZ(s_pDefCollapsed); DELETEZ(s_pDefExpanded); } + m_aVRuler.disposeAndClear(); + m_aText.disposeAndClear(); + m_aImage.disposeAndClear(); + m_pParent.clear(); + OColorListener::dispose(); } sal_Int32 OStartMarker::getMinHeight() const { Fraction aExtraWidth(long(2*REPORT_EXTRA_SPACE)); aExtraWidth *= GetMapMode().GetScaleX(); - return LogicToPixel(Size(0,m_aText.GetTextHeight())).Height() + (long)aExtraWidth; + return LogicToPixel(Size(0,m_aText->GetTextHeight())).Height() + (long)aExtraWidth; } void OStartMarker::Paint( const Rectangle& rRect ) @@ -107,7 +117,7 @@ void OStartMarker::Paint( const Rectangle& rRect ) } else { - const long nVRulerWidth = m_aVRuler.GetSizePixel().Width(); + const long nVRulerWidth = m_aVRuler->GetSizePixel().Width(); nSize = aSize.Width() - nVRulerWidth; aSize.Width() += nCornerWidth; SetClipRegion(vcl::Region(PixelToLogic(Rectangle(Point(),Size(nSize,aSize.Height()))))); @@ -148,8 +158,8 @@ void OStartMarker::setColor() Color aTextColor = GetTextColor(); if ( aColor.GetLuminance() < 128 ) aTextColor = COL_WHITE; - m_aText.SetTextColor(aTextColor); - m_aText.SetLineColor(m_nColor); + m_aText->SetTextColor(aTextColor); + m_aText->SetLineColor(m_nColor); } void OStartMarker::MouseButtonUp( const MouseEvent& rMEvt ) @@ -162,14 +172,14 @@ void OStartMarker::MouseButtonUp( const MouseEvent& rMEvt ) const Size aOutputSize = GetOutputSizePixel(); if( aPos.X() > aOutputSize.Width() || aPos.Y() > aOutputSize.Height() ) return; - Rectangle aRect(m_aImage.GetPosPixel(),m_aImage.GetSizePixel()); + Rectangle aRect(m_aImage->GetPosPixel(),m_aImage->GetSizePixel()); if ( rMEvt.GetClicks() == 2 || aRect.IsInside( aPos ) ) { m_bCollapsed = !m_bCollapsed; changeImage(); - m_aVRuler.Show(!m_bCollapsed && m_bShowRuler); + m_aVRuler->Show(!m_bCollapsed && m_bShowRuler); if ( m_aCollapsedLink.IsSet() ) m_aCollapsedLink.Call(this); } @@ -180,7 +190,7 @@ void OStartMarker::MouseButtonUp( const MouseEvent& rMEvt ) void OStartMarker::changeImage() { Image* pImage = m_bCollapsed ? s_pDefCollapsed : s_pDefExpanded; - m_aImage.SetImage(*pImage); + m_aImage->SetImage(*pImage); } void OStartMarker::initDefaultNodeImages() @@ -192,11 +202,11 @@ void OStartMarker::initDefaultNodeImages() } Image* pImage = m_bCollapsed ? s_pDefCollapsed : s_pDefExpanded; - m_aImage.SetImage(*pImage); - m_aImage.SetMouseTransparent(true); - m_aImage.SetBackground(); - m_aText.SetBackground(); - m_aText.SetMouseTransparent(true); + m_aImage->SetImage(*pImage); + m_aImage->SetMouseTransparent(true); + m_aImage->SetBackground(); + m_aText->SetBackground(); + m_aText->SetMouseTransparent(true); } void OStartMarker::ImplInitSettings() @@ -212,11 +222,11 @@ void OStartMarker::Resize() const long nOutputWidth = aOutputSize.Width(); const long nOutputHeight = aOutputSize.Height(); - const long nVRulerWidth = m_aVRuler.GetSizePixel().Width(); + const long nVRulerWidth = m_aVRuler->GetSizePixel().Width(); const Point aRulerPos(nOutputWidth - nVRulerWidth,0); - m_aVRuler.SetPosSizePixel(aRulerPos,Size(nVRulerWidth,nOutputHeight)); + m_aVRuler->SetPosSizePixel(aRulerPos,Size(nVRulerWidth,nOutputHeight)); - Size aImageSize = m_aImage.GetImage().GetSizePixel(); + Size aImageSize = m_aImage->GetImage().GetSizePixel(); const MapMode& rMapMode = GetMapMode(); aImageSize.Width() = long(aImageSize.Width() * (double)rMapMode.GetScaleX()); aImageSize.Height() = long(aImageSize.Height() * (double)rMapMode.GetScaleY()); @@ -225,17 +235,17 @@ void OStartMarker::Resize() aExtraWidth *= rMapMode.GetScaleX(); Point aPos(aImageSize.Width() + (long)(aExtraWidth + aExtraWidth), aExtraWidth); - const long nHeight = ::std::max<sal_Int32>(nOutputHeight - 2*aPos.Y(),LogicToPixel(Size(0,m_aText.GetTextHeight())).Height()); - m_aText.SetPosSizePixel(aPos,Size(aRulerPos.X() - aPos.X(),nHeight)); + const long nHeight = ::std::max<sal_Int32>(nOutputHeight - 2*aPos.Y(),LogicToPixel(Size(0,m_aText->GetTextHeight())).Height()); + m_aText->SetPosSizePixel(aPos,Size(aRulerPos.X() - aPos.X(),nHeight)); aPos.X() = aExtraWidth; - aPos.Y() += static_cast<sal_Int32>((LogicToPixel(Size(0,m_aText.GetTextHeight())).Height() - aImageSize.Height()) * 0.5) ; - m_aImage.SetPosSizePixel(aPos,aImageSize); + aPos.Y() += static_cast<sal_Int32>((LogicToPixel(Size(0,m_aText->GetTextHeight())).Height() - aImageSize.Height()) * 0.5) ; + m_aImage->SetPosSizePixel(aPos,aImageSize); } void OStartMarker::setTitle(const OUString& _sTitle) { - m_aText.SetText(_sTitle); + m_aText->SetText(_sTitle); } void OStartMarker::Notify(SfxBroadcaster & rBc, SfxHint const & rHint) @@ -252,12 +262,12 @@ void OStartMarker::Notify(SfxBroadcaster & rBc, SfxHint const & rHint) void OStartMarker::showRuler(bool _bShow) { m_bShowRuler = _bShow; - m_aVRuler.Show(!m_bCollapsed && m_bShowRuler); + m_aVRuler->Show(!m_bCollapsed && m_bShowRuler); } void OStartMarker::RequestHelp( const HelpEvent& rHEvt ) { - if( !m_aText.GetText().isEmpty()) + if( !m_aText->GetText().isEmpty()) { // Hilfe anzeigen Rectangle aItemRect(rHEvt.GetMousePosPixel(),Size(GetSizePixel().Width(),getMinHeight())); @@ -268,9 +278,9 @@ void OStartMarker::RequestHelp( const HelpEvent& rHEvt ) aItemRect.Right() = aPt.X(); aItemRect.Bottom() = aPt.Y(); if( rHEvt.GetMode() == HelpEventMode::BALLOON ) - Help::ShowBalloon( this, aItemRect.Center(), aItemRect, m_aText.GetText()); + Help::ShowBalloon( this, aItemRect.Center(), aItemRect, m_aText->GetText()); else - Help::ShowQuickHelp( this, aItemRect, m_aText.GetText() ); + Help::ShowQuickHelp( this, aItemRect, m_aText->GetText() ); } } @@ -284,8 +294,8 @@ void OStartMarker::setCollapsed(bool _bCollapsed) void OStartMarker::zoom(const Fraction& _aZoom) { setZoomFactor(_aZoom,*this); - m_aVRuler.SetZoom(_aZoom); - setZoomFactor(_aZoom,m_aText); + m_aVRuler->SetZoom(_aZoom); + setZoomFactor(_aZoom, *m_aText.get()); Resize(); Invalidate(); } diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 9a7afeeae66c..49bf68956faf 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -185,8 +185,15 @@ OViewsWindow::OViewsWindow( OReportWindow* _pReportWindow) OViewsWindow::~OViewsWindow() { + disposeOnce(); +} + +void OViewsWindow::dispose() +{ m_aColorConfig.RemoveListener(this); m_aSections.clear(); + m_pParent.clear(); + vcl::Window::dispose(); } void OViewsWindow::impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Point& _rStartPoint,bool _bSet) @@ -219,8 +226,8 @@ void OViewsWindow::resize(const OSectionWindow& _rSectionWindow) TSectionsMap::iterator aEnd = m_aSections.end(); for (;aIter != aEnd ; ++aIter) { - const ::boost::shared_ptr<OSectionWindow> pSectionWindow = (*aIter); - if ( pSectionWindow.get() == &_rSectionWindow ) + OSectionWindow* pSectionWindow = (*aIter); + if ( pSectionWindow == &_rSectionWindow ) { aStartPoint = pSectionWindow->GetPosPixel(); bSet = true; @@ -228,7 +235,7 @@ void OViewsWindow::resize(const OSectionWindow& _rSectionWindow) if ( bSet ) { - impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,bSet); + impl_resizeSectionWindow(*pSectionWindow,aStartPoint,bSet); static sal_Int32 nIn = INVALIDATE_UPDATE | INVALIDATE_TRANSPARENT; pSectionWindow->getStartMarker().Invalidate( nIn ); // INVALIDATE_NOERASE |INVALIDATE_NOCHILDREN| INVALIDATE_TRANSPARENT pSectionWindow->getEndMarker().Invalidate( nIn ); @@ -248,8 +255,8 @@ void OViewsWindow::Resize() TSectionsMap::iterator aEnd = m_aSections.end(); for (;aIter != aEnd ; ++aIter) { - const ::boost::shared_ptr<OSectionWindow> pSectionWindow = (*aIter); - impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,true); + OSectionWindow* pSectionWindow = (*aIter); + impl_resizeSectionWindow(*pSectionWindow,aStartPoint,true); } } } @@ -292,7 +299,7 @@ void OViewsWindow::DataChanged( const DataChangedEvent& rDCEvt ) void OViewsWindow::addSection(const uno::Reference< report::XSection >& _xSection,const OUString& _sColorEntry,sal_uInt16 _nPosition) { - ::boost::shared_ptr<OSectionWindow> pSectionWindow( new OSectionWindow(this,_xSection,_sColorEntry) ); + VclPtrInstance<OSectionWindow> pSectionWindow(this,_xSection,_sColorEntry); m_aSections.insert(getIteratorAtPos(_nPosition) , TSectionsMap::value_type(pSectionWindow)); m_pParent->setMarked(&pSectionWindow->getReportSection().getSectionView(),m_aSections.size() == 1); Resize(); @@ -392,17 +399,17 @@ void OViewsWindow::Paste() ::o3tl::compose1(::boost::bind(&OReportSection::Paste,_1,aCopies,false),TReportPairHelper())); else { - ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection(); + OSectionWindow* pMarkedSection = getMarkedSection(); if ( pMarkedSection ) pMarkedSection->getReportSection().Paste(aCopies,true); } } -::boost::shared_ptr<OSectionWindow> OViewsWindow::getSectionWindow(const uno::Reference< report::XSection>& _xSection) const +OSectionWindow* OViewsWindow::getSectionWindow(const uno::Reference< report::XSection>& _xSection) const { OSL_ENSURE(_xSection.is(),"Section is NULL!"); - ::boost::shared_ptr<OSectionWindow> pSectionWindow; + OSectionWindow* pSectionWindow = NULL; TSectionsMap::const_iterator aIter = m_aSections.begin(); TSectionsMap::const_iterator aEnd = m_aSections.end(); for (; aIter != aEnd ; ++aIter) @@ -418,9 +425,9 @@ void OViewsWindow::Paste() } -::boost::shared_ptr<OSectionWindow> OViewsWindow::getMarkedSection(NearSectionAccess nsa) const +OSectionWindow* OViewsWindow::getMarkedSection(NearSectionAccess nsa) const { - ::boost::shared_ptr<OSectionWindow> pRet; + OSectionWindow* pRet = NULL; TSectionsMap::const_iterator aIter = m_aSections.begin(); TSectionsMap::const_iterator aEnd = m_aSections.end(); sal_uInt32 nCurrentPosition = 0; @@ -624,7 +631,7 @@ void OViewsWindow::setMarked(const uno::Sequence< uno::Reference< report::XRepor bFirst = false; m_pParent->setMarked(xSection,_bMark); } - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getSectionWindow(xSection); + OSectionWindow* pSectionWindow = getSectionWindow(xSection); if ( pSectionWindow ) { SvxShape* pShape = SvxShape::getImplementation( *pIter ); @@ -881,7 +888,7 @@ void OViewsWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAli void OViewsWindow::createDefault() { - ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection(); + OSectionWindow* pMarkedSection = getMarkedSection(); if ( pMarkedSection ) pMarkedSection->getReportSection().createDefault(m_sShapeType); } @@ -922,9 +929,9 @@ sal_uInt16 OViewsWindow::getPosition(const OSectionWindow* _pSectionWindow) cons return nPosition; } -::boost::shared_ptr<OSectionWindow> OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const +OSectionWindow* OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const { - ::boost::shared_ptr<OSectionWindow> aReturn; + OSectionWindow* aReturn = NULL; if ( _nPos < m_aSections.size() ) aReturn = m_aSections[_nPos]; diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx index 0e8f7b6492c1..0fb2b0e62dfe 100644 --- a/reportdesign/source/ui/report/propbrw.cxx +++ b/reportdesign/source/ui/report/propbrw.cxx @@ -185,6 +185,11 @@ PropBrw::PropBrw(const Reference< XComponentContext >& _xORB, vcl::Window* pPare PropBrw::~PropBrw() { + disposeOnce(); +} + +void PropBrw::dispose() +{ if (m_xBrowserController.is()) implDetachController(); @@ -204,6 +209,8 @@ PropBrw::~PropBrw() {} ::rptui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); + m_pDesignView.clear(); + DockingWindow::dispose(); } void PropBrw::setCurrentPage(const OUString& _sLastActivePage) @@ -507,7 +514,7 @@ void PropBrw::Update( OSectionView* pNewView ) const sal_uInt16 nSectionCount = pViews->getSectionCount(); for (sal_uInt16 i = 0; i < nSectionCount; ++i) { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = pViews->getSectionWindow(i); + OSectionWindow* pSectionWindow = pViews->getSectionWindow(i); if ( pSectionWindow ) { const SdrMarkList& rMarkList = pSectionWindow->getReportSection().getSectionView().GetMarkedObjectList(); |