diff options
Diffstat (limited to 'basctl')
43 files changed, 1086 insertions, 1263 deletions
diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx index 4b58550e92d0..6e720ea0a778 100644 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx @@ -84,8 +84,8 @@ bool AccessibleDialogControlShape::IsFocused() bool bFocused = false; if ( m_pDialogWindow ) { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView && pSdrView->IsObjMarked( m_pDlgEdObj ) && pSdrView->GetMarkedObjectList().GetMarkCount() == 1 ) + SdrView& rView = m_pDialogWindow->GetView(); + if (rView.IsObjMarked(m_pDlgEdObj) && rView.GetMarkedObjectList().GetMarkCount() == 1) bFocused = true; } @@ -96,15 +96,9 @@ bool AccessibleDialogControlShape::IsFocused() bool AccessibleDialogControlShape::IsSelected() { - bool bSelected = false; if ( m_pDialogWindow ) - { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView ) - bSelected = pSdrView->IsObjMarked( m_pDlgEdObj ); - } - - return bSelected; + return m_pDialogWindow->GetView().IsObjMarked(m_pDlgEdObj); + return false; } // ----------------------------------------------------------------------------- diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index c9b19717bf3e..0b12b8d0b526 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -117,31 +117,25 @@ AccessibleDialogWindow::AccessibleDialogWindow (basctl::DialogWindow* pDialogWin if ( m_pDialogWindow ) { - SdrPage* pSdrPage = m_pDialogWindow->GetPage(); - if ( pSdrPage ) - { - sal_uLong nCount = pSdrPage->GetObjCount(); + SdrPage& rPage = m_pDialogWindow->GetPage(); + sal_uLong nCount = rPage.GetObjCount(); - for ( sal_uLong i = 0; i < nCount; ++i ) + for ( sal_uLong i = 0; i < nCount; ++i ) + { + if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(rPage.GetObj(i))) { - if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pSdrPage->GetObj(i))) - { - ChildDescriptor aDesc( pDlgEdObj ); - if ( IsChildVisible( aDesc ) ) - m_aAccessibleChildren.push_back( aDesc ); - } + ChildDescriptor aDesc( pDlgEdObj ); + if ( IsChildVisible( aDesc ) ) + m_aAccessibleChildren.push_back( aDesc ); } } m_pDialogWindow->AddEventListener( LINK( this, AccessibleDialogWindow, WindowEventListener ) ); - m_pDlgEditor = m_pDialogWindow->GetEditor(); - if ( m_pDlgEditor ) - StartListening( *m_pDlgEditor ); + StartListening(m_pDialogWindow->GetEditor()); - m_pDlgEdModel = m_pDialogWindow->GetModel(); - if ( m_pDlgEdModel ) - StartListening( *m_pDlgEdModel ); + m_pDlgEdModel = &m_pDialogWindow->GetModel(); + StartListening(*m_pDlgEdModel); } } @@ -222,37 +216,33 @@ bool AccessibleDialogWindow::IsChildVisible( const ChildDescriptor& rDesc ) if ( m_pDialogWindow ) { // first check, if the shape is in a visible layer - SdrModel* pSdrModel = m_pDialogWindow->GetModel(); - if ( pSdrModel ) + SdrLayerAdmin& rLayerAdmin = m_pDialogWindow->GetModel().GetLayerAdmin(); + DlgEdObj* pDlgEdObj = rDesc.pDlgEdObj; + if ( pDlgEdObj ) { - SdrLayerAdmin& rLayerAdmin = pSdrModel->GetLayerAdmin(); - DlgEdObj* pDlgEdObj = rDesc.pDlgEdObj; - if ( pDlgEdObj ) + SdrLayerID nLayerId = pDlgEdObj->GetLayer(); + const SdrLayer* pSdrLayer = rLayerAdmin.GetLayerPerID( nLayerId ); + if ( pSdrLayer ) { - SdrLayerID nLayerId = pDlgEdObj->GetLayer(); - const SdrLayer* pSdrLayer = rLayerAdmin.GetLayerPerID( nLayerId ); - if ( pSdrLayer ) + ::rtl::OUString aLayerName = pSdrLayer->GetName(); + SdrView& rView = m_pDialogWindow->GetView(); + if (rView.IsLayerVisible(aLayerName)) { - ::rtl::OUString aLayerName = pSdrLayer->GetName(); - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView && pSdrView->IsLayerVisible( aLayerName ) ) - { - // get the bounding box of the shape in logic units - Rectangle aRect = pDlgEdObj->GetSnapRect(); - - // transform coordinates relative to the parent - MapMode aMap = m_pDialogWindow->GetMapMode(); - Point aOrg = aMap.GetOrigin(); - aRect.Move( aOrg.X(), aOrg.Y() ); - - // convert logic units to pixel - aRect = m_pDialogWindow->LogicToPixel( aRect, MapMode(MAP_100TH_MM) ); - - // check, if the shape's bounding box intersects with the bounding box of its parent - Rectangle aParentRect( Point( 0, 0 ), m_pDialogWindow->GetSizePixel() ); - if ( aParentRect.IsOver( aRect ) ) - bVisible = true; - } + // get the bounding box of the shape in logic units + Rectangle aRect = pDlgEdObj->GetSnapRect(); + + // transform coordinates relative to the parent + MapMode aMap = m_pDialogWindow->GetMapMode(); + Point aOrg = aMap.GetOrigin(); + aRect.Move( aOrg.X(), aOrg.Y() ); + + // convert logic units to pixel + aRect = m_pDialogWindow->LogicToPixel( aRect, MapMode(MAP_100TH_MM) ); + + // check, if the shape's bounding box intersects with the bounding box of its parent + Rectangle aParentRect( Point( 0, 0 ), m_pDialogWindow->GetSizePixel() ); + if ( aParentRect.IsOver( aRect ) ) + bVisible = true; } } } @@ -342,12 +332,10 @@ void AccessibleDialogWindow::UpdateChildren() { if ( m_pDialogWindow ) { - if (SdrPage* pSdrPage = m_pDialogWindow->GetPage()) - { - for ( sal_uLong i = 0, nCount = pSdrPage->GetObjCount(); i < nCount; ++i ) - if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pSdrPage->GetObj(i))) - UpdateChild( ChildDescriptor( pDlgEdObj ) ); - } + SdrPage& rPage = m_pDialogWindow->GetPage(); + for ( sal_uLong i = 0, nCount = rPage.GetObjCount(); i < nCount; ++i ) + if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(rPage.GetObj(i))) + UpdateChild( ChildDescriptor( pDlgEdObj ) ); } } @@ -963,16 +951,11 @@ void AccessibleDialogWindow::selectAccessibleChild( sal_Int32 nChildIndex ) thro if ( m_pDialogWindow ) { - DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj; - if ( pDlgEdObj ) + if (DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj) { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView ) - { - SdrPageView* pPgView = pSdrView->GetSdrPageView(); - if ( pPgView ) - pSdrView->MarkObj( pDlgEdObj, pPgView ); - } + SdrView& rView = m_pDialogWindow->GetView(); + if (SdrPageView* pPgView = rView.GetSdrPageView()) + rView.MarkObj(pDlgEdObj, pPgView); } } } @@ -986,19 +969,10 @@ sal_Bool AccessibleDialogWindow::isAccessibleChildSelected( sal_Int32 nChildInde if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) throw IndexOutOfBoundsException(); - bool bSelected = false; - if ( m_pDialogWindow ) - { - DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj; - if ( pDlgEdObj ) - { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView ) - bSelected = pSdrView->IsObjMarked( pDlgEdObj ); - } - } - - return bSelected; + if (m_pDialogWindow) + if (DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj) + return m_pDialogWindow->GetView().IsObjMarked(pDlgEdObj); + return false; } // ----------------------------------------------------------------------------- @@ -1008,11 +982,7 @@ void AccessibleDialogWindow::clearAccessibleSelection( ) throw (RuntimeExceptio OExternalLockGuard aGuard( this ); if ( m_pDialogWindow ) - { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView ) - pSdrView->UnmarkAll(); - } + m_pDialogWindow->GetView().UnmarkAll(); } // ----------------------------------------------------------------------------- @@ -1022,11 +992,7 @@ void AccessibleDialogWindow::selectAllAccessibleChildren( ) throw (RuntimeExcep OExternalLockGuard aGuard( this ); if ( m_pDialogWindow ) - { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView ) - pSdrView->MarkAll(); - } + m_pDialogWindow->GetView().MarkAll(); } // ----------------------------------------------------------------------------- @@ -1080,16 +1046,12 @@ void AccessibleDialogWindow::deselectAccessibleChild( sal_Int32 nChildIndex ) th if ( m_pDialogWindow ) { - DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj; - if ( pDlgEdObj ) + if (DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj) { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView ) - { - SdrPageView* pPgView = pSdrView->GetSdrPageView(); - if ( pPgView ) - pSdrView->MarkObj( pDlgEdObj, pPgView, true ); - } + SdrView& rView = m_pDialogWindow->GetView(); + SdrPageView* pPgView = rView.GetSdrPageView(); + if (pPgView) + rView.MarkObj( pDlgEdObj, pPgView, true ); } } } diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx index 67f358c13599..6f64fbcf4af2 100644 --- a/basctl/source/basicide/basdoc.cxx +++ b/basctl/source/basicide/basdoc.cxx @@ -48,31 +48,27 @@ SFX_IMPL_INTERFACE( basctl_DocShell, SfxObjectShell, IDEResId( 0 ) ) DocShell::DocShell() :SfxObjectShell( SFXMODEL_DISABLE_EMBEDDED_SCRIPTS | SFXMODEL_DISABLE_DOCUMENT_RECOVERY ) { - pPrinter = 0; SetPool( &SFX_APP()->GetPool() ); SetBaseModel( new SIDEModel(this) ); } DocShell::~DocShell() -{ - delete pPrinter; -} +{ } SfxPrinter* DocShell::GetPrinter( bool bCreate ) { if ( !pPrinter && bCreate ) - pPrinter = new SfxPrinter( new SfxItemSet( GetPool(), SID_PRINTER_NOTFOUND_WARN , SID_PRINTER_NOTFOUND_WARN ) ); + pPrinter.reset(new SfxPrinter(new SfxItemSet( + GetPool(), SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN + ))); - return pPrinter; + return pPrinter.get(); } void DocShell::SetPrinter( SfxPrinter* pPr ) { - if ( pPr != pPrinter ) - { - delete pPrinter; - pPrinter = pPr; - } + if (pPr != pPrinter.get()) + pPrinter.reset(pPr); } void DocShell::FillClass( SvGlobalName*, sal_uInt32*, String*, String*, String*, sal_Int32, sal_Bool bTemplate) const diff --git a/basctl/source/basicide/basdoc.hxx b/basctl/source/basicide/basdoc.hxx index 8a302d7b9c29..19a0ae6e7555 100644 --- a/basctl/source/basicide/basdoc.hxx +++ b/basctl/source/basicide/basdoc.hxx @@ -25,6 +25,8 @@ #include <sfx2/objsh.hxx> #include <svx/ifaceids.hxx> +#include <boost/scoped_ptr.hpp> + class SfxPrinter; namespace basctl @@ -32,7 +34,7 @@ namespace basctl class DocShell: public SfxObjectShell { - SfxPrinter* pPrinter; + boost::scoped_ptr<SfxPrinter> pPrinter; protected: virtual void Draw( OutputDevice *, const JobSetup & rSetup, diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 49a88f7b3334..7de663d804a4 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -54,20 +54,28 @@ namespace basctl { -#define LMARGPRN 1700 -#define RMARGPRN 900 -#define TMARGPRN 2000 -#define BMARGPRN 1000 -#define BORDERPRN 300 +namespace +{ + +namespace Print +{ + int const nLeftMargin = 1700; + int const nRightMargin = 900; + int const nTopMargin = 2000; + int const nBottomMargin = 1000; + int const nBorder = 300; +} -#define VALIDWINDOW 0x1234 +short const ValidWindow = 0x1234; #if defined(OW) || defined(MTF) -#define FILTERMASK_ALL "*" +char const FilterMask_All[] = "*"; #else -#define FILTERMASK_ALL "*.*" +char const FilterMask_All[] = "*.*"; #endif +} // namespace + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ui::dialogs; @@ -84,9 +92,7 @@ namespace void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage, const ::rtl::OUString& rTitle, bool bOutput ) { - short nLeftMargin = LMARGPRN; - Size aSz = pPrinter->GetOutputSize(); - short nBorder = BORDERPRN; + Size const aSz = pPrinter->GetOutputSize(); const Color aOldLineColor( pPrinter->GetLineColor() ); const Color aOldFillColor( pPrinter->GetFillColor() ); @@ -103,19 +109,20 @@ void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage, long nFontHeight = pPrinter->GetTextHeight(); // 1st Border => line, 2+3 Border = free space - long nYTop = TMARGPRN-3*nBorder-nFontHeight; + long nYTop = Print::nTopMargin - 3*Print::nBorder - nFontHeight; - long nXLeft = nLeftMargin-nBorder; - long nXRight = aSz.Width()-RMARGPRN+nBorder; + long nXLeft = Print::nLeftMargin - Print::nBorder; + long nXRight = aSz.Width() - Print::nRightMargin + Print::nBorder; if( bOutput ) - pPrinter->DrawRect( Rectangle( - Point( nXLeft, nYTop ), - Size( nXRight-nXLeft, aSz.Height() - nYTop - BMARGPRN + nBorder ) ) ); + pPrinter->DrawRect(Rectangle( + Point(nXLeft, nYTop), + Size(nXRight - nXLeft, aSz.Height() - nYTop - Print::nBottomMargin + Print::nBorder) + )); - long nY = TMARGPRN-2*nBorder; - Point aPos( nLeftMargin, nY ); + long nY = Print::nTopMargin - 2*Print::nBorder; + Point aPos(Print::nLeftMargin, nY); if( bOutput ) pPrinter->DrawText( aPos, rTitle ); if ( nPages != 1 ) @@ -136,7 +143,7 @@ void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage, } } - nY = TMARGPRN-nBorder; + nY = Print::nTopMargin - Print::nBorder; if( bOutput ) pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) ); @@ -187,7 +194,7 @@ ModulWindow::ModulWindow ( ) : BaseWindow(pParent, rDocument, aLibName, aName), rLayout(*pParent), - nValid(VALIDWINDOW), + nValid(ValidWindow), aXEditorWindow(this), m_aModule(aModule) { @@ -233,7 +240,7 @@ ModulWindow::~ModulWindow() void ModulWindow::GetFocus() { - if ( nValid != VALIDWINDOW ) + if (nValid != ValidWindow) return; DBG_CHKTHIS( ModulWindow, 0 ); aXEditorWindow.GetEdtWindow().GrabFocus(); @@ -262,9 +269,6 @@ void ModulWindow::Resize() } -// "Import" of baside4.cxx -void CreateEngineForBasic( StarBASIC* pBasic ); - void ModulWindow::CheckCompileBasic() { DBG_CHKTHIS( ModulWindow, 0 ); @@ -446,7 +450,7 @@ bool ModulWindow::LoadBasic() Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); xFltMgr->appendFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.bas" ) ) ); - xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) ); + xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FilterMask_All ) ) ); xFltMgr->setCurrentFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) ); if( xFP->execute() == RET_OK ) @@ -506,7 +510,7 @@ bool ModulWindow::SaveBasicSource() Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); xFltMgr->appendFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.bas" ) ) ); - xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) ); + xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FilterMask_All ) ) ); xFltMgr->setCurrentFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) ); if( xFP->execute() == RET_OK ) @@ -535,7 +539,7 @@ bool ModulWindow::SaveBasicSource() return bDone; } -bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName ); +extern bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName ); // defined in baside3.cxx bool ModulWindow::ImportDialog() { @@ -704,7 +708,7 @@ long ModulWindow::BasicErrorHdl( StarBASIC * pBasic ) return false; if ( bMarkError ) - aXEditorWindow.GetBrkWindow().SetMarkerPos( MARKER_NOMARKER ); + aXEditorWindow.GetBrkWindow().SetNoMarker(); return false; } @@ -746,7 +750,7 @@ long ModulWindow::BasicBreakHdl( StarBASIC* pBasic ) Application::Yield(); aStatus.bIsInReschedule = false; - aXEditorWindow.GetBrkWindow().SetMarkerPos( MARKER_NOMARKER ); + aXEditorWindow.GetBrkWindow().SetNoMarker(); ClearStatus( BASWIN_INRESCHEDULE ); @@ -863,7 +867,7 @@ void ModulWindow::UpdateData() if ( GetEditView() ) { TextSelection aSel = GetEditView()->GetSelection(); - setTextEngineText( GetEditEngine(), xModule->GetSource32() ); + setTextEngineText(*GetEditEngine(), xModule->GetSource32()); GetEditView()->SetSelection( aSel ); GetEditEngine()->SetModified( false ); MarkDocumentModified( GetDocument() ); @@ -909,8 +913,8 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage ) sal_uInt16 nParaSpace = 10; Size aPaperSz = pPrinter->GetOutputSize(); - aPaperSz.Width() -= (LMARGPRN+RMARGPRN); - aPaperSz.Height() -= (TMARGPRN+BMARGPRN); + aPaperSz.Width() -= (Print::nLeftMargin + Print::nRightMargin); + aPaperSz.Height() -= (Print::nTopMargin + Print::nBottomMargin); // nLinepPage is not correct if there's a line break sal_uInt16 nLinespPage = (sal_uInt16) (aPaperSz.Height()/nLineHeight); @@ -921,7 +925,7 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage ) sal_uInt16 nCurPage = 1; lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nPrintPage == 0 ); - Point aPos( LMARGPRN, TMARGPRN ); + Point aPos( Print::nLeftMargin, Print::nTopMargin ); for ( sal_uLong nPara = 0; nPara < nParas; nPara++ ) { String aLine( GetEditEngine()->GetText( nPara ) ); @@ -931,11 +935,11 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage ) { String aTmpLine( aLine, nLine*nCharspLine, nCharspLine ); aPos.Y() += nLineHeight; - if ( aPos.Y() > ( aPaperSz.Height()+TMARGPRN ) ) + if ( aPos.Y() > ( aPaperSz.Height() + Print::nTopMargin ) ) { nCurPage++; lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nCurPage-1 == nPrintPage ); - aPos = Point( LMARGPRN, TMARGPRN+nLineHeight ); + aPos = Point(Print::nLeftMargin, Print::nTopMargin + nLineHeight); } if( nCurPage-1 == nPrintPage ) pPrinter->DrawText( aPos, aTmpLine ); @@ -1357,7 +1361,7 @@ void ModulWindow::BasicStarted() void ModulWindow::BasicStopped() { aStatus.bIsRunning = false; - GetBreakPointWindow().SetMarkerPos( MARKER_NOMARKER ); + GetBreakPointWindow().SetNoMarker(); } EntryDescriptor ModulWindow::CreateEntryDescriptor() @@ -1457,7 +1461,7 @@ bool ModulWindow::HasActiveEditor () const void ModulWindow::UpdateModule () { - rtl::OUString const aModule = getTextEngineText(GetEditEngine()); + rtl::OUString const aModule = getTextEngineText(*GetEditEngine()); // update module in basic assert(xModule); diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 297ebd67e57a..489376c55201 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -21,9 +21,11 @@ #define BASCTL_BASIDE2_HXX #include "layout.hxx" -#include <bastypes.hxx> -#include <bastype3.hxx> -#include <basidesh.hxx> +#include "bastypes.hxx" +#include "bastype3.hxx" +#include "basidesh.hxx" +#include "breakpoint.hxx" +#include "linenumberwindow.hxx" #include <svheader.hxx> @@ -37,17 +39,15 @@ class SvxSearchItem; #include <basic/sbstar.hxx> #include <basic/sbmod.hxx> #include <vcl/split.hxx> -#include "svl/lstner.hxx" +#include <svl/lstner.hxx> #include <svtools/colorcfg.hxx> #include <sfx2/progress.hxx> #include <unotools/options.hxx> +#include <rtl/ref.hxx> -#include "breakpoint.hxx" -#include "linenumberwindow.hxx" #include <set> - -#define MARKER_NOMARKER 0xFFFF +#include <boost/scoped_ptr.hpp> namespace com { namespace sun { namespace star { namespace beans { class XMultiPropertySet; @@ -63,40 +63,18 @@ DBG_NAMEEX( ModulWindow ) // #108672 Helper functions to get/set text in TextEngine // using the stream interface (get/setText() only supports // tools Strings limited to 64K). -::rtl::OUString getTextEngineText( ExtTextEngine* pEngine ); -void setTextEngineText( ExtTextEngine* pEngine, const ::rtl::OUString aStr ); - -class ProgressInfo : public SfxProgress -{ -private: - sal_uLong nCurState; - -public: +// defined in baside2b.cxx +rtl::OUString getTextEngineText (ExtTextEngine&); +void setTextEngineText (ExtTextEngine&, rtl::OUString const&); - inline ProgressInfo( SfxObjectShell* pObjSh, const String& rText, sal_uLong nRange ); - inline void StepProgress(); -}; - -inline ProgressInfo::ProgressInfo( SfxObjectShell* pObjSh, const String& rText, sal_uLong nRange ) - : SfxProgress( pObjSh, rText, nRange ) -{ - nCurState = 0; -} - -inline void ProgressInfo::StepProgress() -{ - SetState( ++nCurState ); -} - -typedef std::set<sal_uInt16> SyntaxLineSet; class EditorWindow : public Window, public SfxListener { private: class ChangesListener; - ExtTextView* pEditView; - ExtTextEngine* pEditEngine; + boost::scoped_ptr<ExtTextView> pEditView; + boost::scoped_ptr<ExtTextEngine> pEditEngine; ModulWindow& rModulWindow; rtl::Reference< ChangesListener > listener_; @@ -108,9 +86,13 @@ private: SyntaxHighlighter aHighlighter; Timer aSyntaxIdleTimer; + typedef std::set<sal_uInt16> SyntaxLineSet; SyntaxLineSet aSyntaxLineTable; DECL_LINK(SyntaxTimerHdl, void *); - ProgressInfo* pProgress; + + // progress bar + class ProgressInfo; + boost::scoped_ptr<ProgressInfo> pProgress; virtual void DataChanged(DataChangedEvent const & rDCEvt); @@ -147,9 +129,8 @@ public: EditorWindow (Window* pParent, ModulWindow*); ~EditorWindow(); - ExtTextEngine* GetEditEngine() const { return pEditEngine; } - ExtTextView* GetEditView() const { return pEditView; } - ProgressInfo* GetProgress() const { return pProgress; } + ExtTextEngine* GetEditEngine() const { return pEditEngine.get(); } + ExtTextView* GetEditView() const { return pEditView.get(); } void CreateProgress( const String& rText, sal_uLong nRange ); void DestroyProgress(); @@ -185,7 +166,6 @@ private: protected: virtual void Paint( const Rectangle& ); - virtual void Resize(); BreakPoint* FindBreakPoint( const Point& rMousePos ); void ShowMarker( bool bShow ); virtual void MouseButtonDown( const MouseEvent& rMEvt ); @@ -198,6 +178,7 @@ public: ~BreakPointWindow(); void SetMarkerPos( sal_uInt16 nLine, bool bErrorMarker = false ); + void SetNoMarker (); void DoScroll( long nHorzScroll, long nVertScroll ); long& GetCurYOffset() { return nCurYOffset; } diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index a184d060178a..fefed79c0e34 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -45,6 +45,8 @@ #include <vcl/taskpanelist.hxx> #include <vcl/help.hxx> +#include <vector> + namespace basctl { @@ -54,6 +56,8 @@ using namespace ::com::sun::star::uno; namespace { +sal_uInt16 const NoMarker = 0xFFFF; + long nVirtToolBoxHeight; // inited in WatchWindow, used in Stackwindow long nHeaderBarHeight; @@ -72,13 +76,14 @@ Image GetImage (unsigned nId) return aImagesNormal.GetImage(nId); } -} // namespace +int const nScrollLine = 12; +int const nScrollPage = 60; +int const DWBORDER = 3; -#define SCROLL_LINE 12 -#define SCROLL_PAGE 60 -#define DWBORDER 3 +char const cSuffixes[] = "%&!#@$"; + +} // namespace -static const char cSuffixes[] = "%&!#@$"; /** * Helper functions to get/set text in TextEngine using @@ -86,27 +91,27 @@ static const char cSuffixes[] = "%&!#@$"; * * get/setText() only supports tools Strings limited to 64K). */ -::rtl::OUString getTextEngineText( ExtTextEngine* pEngine ) +rtl::OUString getTextEngineText (ExtTextEngine& rEngine) { SvMemoryStream aMemStream; aMemStream.SetStreamCharSet( RTL_TEXTENCODING_UTF8 ); aMemStream.SetLineDelimiter( LINEEND_LF ); - pEngine->Write( aMemStream ); + rEngine.Write( aMemStream ); sal_uLong nSize = aMemStream.Tell(); ::rtl::OUString aText( (const sal_Char*)aMemStream.GetData(), nSize, RTL_TEXTENCODING_UTF8 ); return aText; } -void setTextEngineText( ExtTextEngine* pEngine, const ::rtl::OUString aStr ) +void setTextEngineText (ExtTextEngine& rEngine, rtl::OUString const& aStr) { - pEngine->SetText( String() ); + rEngine.SetText(String()); ::rtl::OString aUTF8Str = ::rtl::OUStringToOString( aStr, RTL_TEXTENCODING_UTF8 ); SvMemoryStream aMemStream( (void*)aUTF8Str.getStr(), aUTF8Str.getLength(), STREAM_READ | STREAM_SEEK_TO_BEGIN ); aMemStream.SetStreamCharSet( RTL_TEXTENCODING_UTF8 ); aMemStream.SetLineDelimiter( LINEEND_LF ); - pEngine->Read( aMemStream ); + rEngine.Read(aMemStream); } namespace @@ -193,13 +198,29 @@ private: EditorWindow & editor_; }; +class EditorWindow::ProgressInfo : public SfxProgress +{ +public: + ProgressInfo (SfxObjectShell* pObjSh, String const& rText, sal_uLong nRange) : + SfxProgress(pObjSh, rText, nRange), + nCurState(0) + { } + + void StepProgress () + { + SetState(++nCurState); + } + +private: + sal_uLong nCurState; +}; + EditorWindow::EditorWindow (Window* pParent, ModulWindow* pModulWindow) : Window(pParent, WB_BORDER), pEditView(0), pEditEngine(0), rModulWindow(*pModulWindow), nCurTextWidth(0), - pProgress(0), bHighlightning(false), bDoSyntaxHighlight(true), bDelayHighlight(true) @@ -239,9 +260,7 @@ EditorWindow::~EditorWindow() if ( pEditEngine ) { EndListening( *pEditEngine ); - pEditEngine->RemoveView( pEditView ); - delete pEditView; - delete pEditEngine; + pEditEngine->RemoveView(pEditView.get()); } } @@ -558,11 +577,11 @@ void EditorWindow::CreateEditEngine() if ( pEditEngine ) return; - pEditEngine = new ExtTextEngine; - pEditView = new ExtTextView( pEditEngine, this ); + pEditEngine.reset(new ExtTextEngine); + pEditView.reset(new ExtTextView(pEditEngine.get(), this)); pEditView->SetAutoIndentMode(true); pEditEngine->SetUpdateMode(false); - pEditEngine->InsertView( pEditView ); + pEditEngine->InsertView(pEditView.get()); ImplSetFont(); @@ -586,12 +605,12 @@ void EditorWindow::CreateEditEngine() // nLines*4: SetText+Formatting+DoHighlight+Formatting // it could be cut down on one formatting but you would wait even longer // for the text then if the source code is long... - pProgress = new ProgressInfo( + pProgress.reset(new ProgressInfo( GetShell()->GetViewFrame()->GetObjectShell(), String(IDEResId(RID_STR_GENERATESOURCE)), nLines*4 - ); - setTextEngineText( pEditEngine, aOUSource ); + )); + setTextEngineText(*pEditEngine, aOUSource); pEditView->SetStartDocPos( Point( 0, 0 ) ); pEditView->SetSelection( TextSelection() ); @@ -612,7 +631,7 @@ void EditorWindow::CreateEditEngine() aSyntaxLineTable.insert( nLine ); ForceSyntaxTimeout(); - DELETEZ( pProgress ); + pProgress.reset(); pEditView->EraseVirtualDevice(); pEditEngine->SetModified( false ); @@ -924,22 +943,22 @@ void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, bool bInserted ) void EditorWindow::CreateProgress( const String& rText, sal_uLong nRange ) { DBG_ASSERT( !pProgress, "ProgressInfo existiert schon" ); - pProgress = new ProgressInfo( + pProgress.reset(new ProgressInfo( GetShell()->GetViewFrame()->GetObjectShell(), rText, nRange - ); + )); } void EditorWindow::DestroyProgress() { - DELETEZ( pProgress ); + pProgress.reset(); } void EditorWindow::ForceSyntaxTimeout() { aSyntaxIdleTimer.Stop(); - ((Link&)aSyntaxIdleTimer.GetTimeoutHdl()).Call( &aSyntaxIdleTimer ); + aSyntaxIdleTimer.GetTimeoutHdl().Call(&aSyntaxIdleTimer); } @@ -952,7 +971,7 @@ BreakPointWindow::BreakPointWindow (Window* pParent, ModulWindow* pModulWindow) Window(pParent, WB_BORDER), rModulWindow(*pModulWindow), nCurYOffset(0), // memorize nCurYOffset and not take it from EditEngine - nMarkerPos(MARKER_NOMARKER) + nMarkerPos(NoMarker) { setBackgroundColor(GetSettings().GetStyleSettings().GetFieldColor()); SetHelpId(HID_BASICIDE_BREAKPOINTWINDOW); @@ -964,13 +983,6 @@ BreakPointWindow::~BreakPointWindow() -void BreakPointWindow::Resize() -{ -/// Invalidate(); -} - - - void BreakPointWindow::Paint( const Rectangle& ) { if ( SyncYOffset() ) @@ -1017,9 +1029,14 @@ void BreakPointWindow::SetMarkerPos( sal_uInt16 nLine, bool bError ) ShowMarker( true ); } +void BreakPointWindow::SetNoMarker () +{ + SetMarkerPos(NoMarker); +} + void BreakPointWindow::ShowMarker( bool bShow ) { - if ( nMarkerPos == MARKER_NOMARKER ) + if ( nMarkerPos == NoMarker ) return; Size const aOutSz = GetOutputSize(); @@ -1287,78 +1304,30 @@ void WatchWindow::Resize() Invalidate(); } -struct MemberList -{ - String* mpMemberNames; - int mnMemberCount; - - MemberList( void ) - : mpMemberNames( NULL ) - , mnMemberCount( 0 ) - {} - ~MemberList() - { - clear(); - } - - void clear( void ); - void allocList( int nCount ); -}; - -void MemberList::clear( void ) -{ - if( mnMemberCount ) - { - delete[] mpMemberNames; - mnMemberCount = 0; - } -} - -void MemberList::allocList( int nCount ) -{ - clear(); - if( nCount > 0 ) - { - mnMemberCount = nCount; - mpMemberNames = new String[ mnMemberCount ]; - } -} - struct WatchItem { String maName; String maDisplayName; SbxObjectRef mpObject; - MemberList maMemberList; + std::vector<String> maMemberList; SbxDimArrayRef mpArray; int nDimLevel; // 0 = Root int nDimCount; - short* pIndices; + std::vector<short> vIndices; WatchItem* mpArrayParentItem; - WatchItem( void ) - : nDimLevel( 0 ) - , nDimCount( 0 ) - , pIndices( NULL ) - , mpArrayParentItem( NULL ) - {} - ~WatchItem() - { clearWatchItem(); } + WatchItem (String const& rName): + maName(rName), + nDimLevel(0), + nDimCount(0), + mpArrayParentItem(0) + { } - void clearWatchItem( bool bIncludeArrayData=true ) + void clearWatchItem () { - mpObject = NULL; maMemberList.clear(); - if( bIncludeArrayData ) - { - mpArray = NULL; - nDimLevel = 0; - nDimCount = 0; - delete[] pIndices; - pIndices = NULL; - } } WatchItem* GetRootItem( void ); @@ -1388,10 +1357,9 @@ SbxDimArray* WatchItem::GetRootArray( void ) void WatchWindow::AddWatch( const String& rVName ) { - WatchItem* pWatchItem = new WatchItem; String aVar, aIndex; lcl_SeparateNameAndIndex( rVName, aVar, aIndex ); - pWatchItem->maName = aVar; + WatchItem* pWatchItem = new WatchItem(aVar); String aWatchStr_( aVar ); aWatchStr_ += String( RTL_CONSTASCII_USTRINGPARAM( "\t\t" ) ); @@ -1652,8 +1620,8 @@ ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) : aEdtWindow.Show(); aBrkWindow.Show(); - aEWVScrollBar.SetLineSize( SCROLL_LINE ); - aEWVScrollBar.SetPageSize( SCROLL_PAGE ); + aEWVScrollBar.SetLineSize(nScrollLine); + aEWVScrollBar.SetPageSize(nScrollPage); aEWVScrollBar.SetScrollHdl( LINK( this, ComplexEditorWindow, ScrollHdl ) ); aEWVScrollBar.Show(); } @@ -1786,7 +1754,7 @@ void WatchTreeListBox::RequestingChildren( SvLBoxEntry * pParent ) if( GetChildCount( pParent ) > 0 ) return; - SvLBoxEntry * pEntry = pParent; + SvLBoxEntry* pEntry = pParent; WatchItem* pItem = (WatchItem*)pEntry->GetUserData(); SbxDimArray* pArray = pItem->mpArray; @@ -1802,20 +1770,18 @@ void WatchTreeListBox::RequestingChildren( SvLBoxEntry * pParent ) if( pObj ) { createAllObjectProperties( pObj ); - SbxArray* pProps = pObj->GetProperties(); + SbxArray* pProps = pObj->GetProperties(); sal_uInt16 nPropCount = pProps->Count(); - pItem->maMemberList.allocList( nPropCount ); + pItem->maMemberList.reserve(nPropCount); for( sal_uInt16 i = 0 ; i < nPropCount - 3 ; i++ ) { SbxVariable* pVar = pProps->Get( i ); - String aName( pVar->GetName() ); - pItem->maMemberList.mpMemberNames[i] = aName; - SvLBoxEntry* pChildEntry = SvTreeListBox::InsertEntry( aName, pEntry ); - WatchItem* pChildItem = new WatchItem(); - pChildItem->maName = aName; - pChildEntry->SetUserData( pChildItem ); + pItem->maMemberList.push_back(String(pVar->GetName())); + String const& rName = pItem->maMemberList.back(); + SvLBoxEntry* pChildEntry = SvTreeListBox::InsertEntry( rName, pEntry ); + pChildEntry->SetUserData(new WatchItem(rName)); } if( nPropCount > 0 ) { @@ -1833,25 +1799,23 @@ void WatchTreeListBox::RequestingChildren( SvLBoxEntry * pParent ) pArray->GetDim32( nThisLevel, nMin, nMax ); for( sal_Int32 i = nMin ; i <= nMax ; i++ ) { - WatchItem* pChildItem = new WatchItem(); + WatchItem* pChildItem = new WatchItem(pItem->maName); // Copy data and create name - String aBaseName( pItem->maName ); - pChildItem->maName = aBaseName; String aIndexStr = String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ); pChildItem->mpArrayParentItem = pItem; pChildItem->nDimLevel = nThisLevel; pChildItem->nDimCount = pItem->nDimCount; - pChildItem->pIndices = new short[ pChildItem->nDimCount ]; + pChildItem->vIndices.resize(pChildItem->nDimCount); sal_uInt16 j; for( j = 0 ; j < nParentLevel ; j++ ) { - short n = pChildItem->pIndices[j] = pItem->pIndices[j]; + short n = pChildItem->vIndices[j] = pItem->vIndices[j]; aIndexStr += String::CreateFromInt32( n ); aIndexStr += String( RTL_CONSTASCII_USTRINGPARAM( "," ) ); } - pChildItem->pIndices[ nParentLevel ] = sal::static_int_cast<short>( i ); + pChildItem->vIndices[nParentLevel] = sal::static_int_cast<short>( i ); aIndexStr += String::CreateFromInt32( i ); aIndexStr += String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ); @@ -1860,7 +1824,7 @@ void WatchTreeListBox::RequestingChildren( SvLBoxEntry * pParent ) if( pArrayRootItem && pArrayRootItem->mpArrayParentItem ) aDisplayName = pItem->maDisplayName; else - aDisplayName = aBaseName; + aDisplayName = pItem->maName; aDisplayName += aIndexStr; pChildItem->maDisplayName = aDisplayName; @@ -1905,7 +1869,7 @@ SbxBase* WatchTreeListBox::ImplGetSBXForEntry( SvLBoxEntry* pEntry, bool& rbArra { rbArrayElement = true; if( pParentItem->nDimLevel + 1 == pParentItem->nDimCount ) - pSBX = pArray->Get( pItem->pIndices ); + pSBX = pArray->Get(pItem->vIndices.empty() ? 0 : &*pItem->vIndices.begin()); } } else @@ -1986,7 +1950,10 @@ bool WatchTreeListBox::ImplBasicEntryEdited( SvLBoxEntry* pEntry, const String& } -static void implCollapseModifiedObjectEntry( SvLBoxEntry* pParent, WatchTreeListBox* pThis ) +namespace +{ + +void implCollapseModifiedObjectEntry( SvLBoxEntry* pParent, WatchTreeListBox* pThis ) { pThis->Collapse( pParent ); @@ -1996,13 +1963,12 @@ static void implCollapseModifiedObjectEntry( SvLBoxEntry* pParent, WatchTreeList { implCollapseModifiedObjectEntry( pDeleteEntry, pThis ); - WatchItem* pItem = (WatchItem*)pDeleteEntry->GetUserData(); - delete pItem; + delete (WatchItem*)pDeleteEntry->GetUserData(); pModel->Remove( pDeleteEntry ); } } -static String implCreateTypeStringForDimArray( WatchItem* pItem, SbxDataType eType ) +String implCreateTypeStringForDimArray( WatchItem* pItem, SbxDataType eType ) { String aRetStr = getBasicTypeName( eType ); @@ -2032,7 +1998,6 @@ static String implCreateTypeStringForDimArray( WatchItem* pItem, SbxDataType eTy return aRetStr; } - void implEnableChildren( SvLBoxEntry* pEntry, bool bEnable ) { if( bEnable ) @@ -2049,6 +2014,8 @@ void implEnableChildren( SvLBoxEntry* pEntry, bool bEnable ) } } +} // namespace + void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) { SbMethod* pCurMethod = StarBASIC::GetActiveMethod(); @@ -2127,7 +2094,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) // #i37227 Clear always and replace array if( pNewArray != pOldArray ) { - pItem->clearWatchItem( false ); + pItem->clearWatchItem(); if( pNewArray ) { implEnableChildren( pEntry, true ); @@ -2152,7 +2119,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) { // Check if member list has changed bool bObjChanged = false; - if( pItem->mpObject != NULL && pItem->maMemberList.mpMemberNames != NULL ) + if (pItem->mpObject && !pItem->maMemberList.empty()) { SbxArray* pProps = pObj->GetProperties(); sal_uInt16 nPropCount = pProps->Count(); @@ -2160,7 +2127,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) { SbxVariable* pVar_ = pProps->Get( i ); String aName( pVar_->GetName() ); - if( pItem->maMemberList.mpMemberNames[i] != aName ) + if( pItem->maMemberList[i] != aName ) { bObjChanged = true; break; @@ -2180,7 +2147,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) if( pItem->mpObject != NULL ) { bCollapse = true; - pItem->clearWatchItem( false ); + pItem->clearWatchItem(); implEnableChildren( pEntry, false ); } @@ -2191,7 +2158,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) if( pItem->mpObject != NULL ) { bCollapse = true; - pItem->clearWatchItem( false ); + pItem->clearWatchItem(); implEnableChildren( pEntry, false ); } diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index ef0368605a80..6b137d2af311 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -65,9 +65,9 @@ using namespace ::com::sun::star::resource; using namespace ::com::sun::star::ui::dialogs; #if defined(UNX) -#define FILTERMASK_ALL "*" +char const FilterMask_All[] = "*"; #else -#define FILTERMASK_ALL "*.*" +char const FilterMask_All[] = "*.*"; #endif DBG_NAME( DialogWindow ) @@ -82,20 +82,15 @@ DialogWindow::DialogWindow ( ) : BaseWindow(pParent, rDocument, aLibName, aName), rLayout(*pParent), - pUndoMgr(0) + pEditor(new DlgEditor(*this, rLayout, rDocument.isDocument() ? rDocument.getDocument() : Reference<frame::XModel>(), xDialogModel)), + pUndoMgr(new SfxUndoManager) { InitSettings( true, true, true ); - pEditor = new DlgEditor(rDocument.isDocument() ? rDocument.getDocument() : Reference<frame::XModel>(), rLayout); - pEditor->SetWindow( this ); - pEditor->SetDialog( xDialogModel ); - - pUndoMgr = new SfxUndoManager; - - Link aDummyLink; - aOldNotifyUndoActionHdl = pEditor->GetModel()->GetNotifyUndoActionHdl(); - pEditor->GetModel()->SetNotifyUndoActionHdl( - LINK(this, DialogWindow, NotifyUndoActionHdl)); + aOldNotifyUndoActionHdl = pEditor->GetModel().GetNotifyUndoActionHdl(); + pEditor->GetModel().SetNotifyUndoActionHdl( + LINK(this, DialogWindow, NotifyUndoActionHdl) + ); SetHelpId( HID_BASICIDE_DIALOGWINDOW ); @@ -109,10 +104,7 @@ DialogWindow::DialogWindow ( } DialogWindow::~DialogWindow() -{ - delete pEditor; - delete pUndoMgr; -} +{ } void DialogWindow::LoseFocus() { @@ -209,10 +201,10 @@ void DialogWindow::Command( const CommandEvent& rCEvt ) { if (SfxDispatcher* pDispatcher = GetDispatcher()) { - SdrView* pView = GetView(); - if( !rCEvt.IsMouseEvent() && pView->AreObjectsMarked() ) + SdrView& rView = GetView(); + if( !rCEvt.IsMouseEvent() && rView.AreObjectsMarked() ) { - Rectangle aMarkedRect( pView->GetMarkedRect() ); + Rectangle aMarkedRect( rView.GetMarkedRect() ); Point MarkedCenter( aMarkedRect.Center() ); Point PosPixel( LogicToPixel( MarkedCenter ) ); pDispatcher->ExecutePopup( IDEResId(RID_POPUP_DLGED), this, &PosPixel ); @@ -285,7 +277,7 @@ void DialogWindow::GetState( SfxItemSet& rSet ) case SID_COPY: { // any object selected? - if ( !pEditor->GetView()->AreObjectsMarked() ) + if ( !pEditor->GetView().AreObjectsMarked() ) rSet.DisableItem( nWh ); } break; @@ -294,7 +286,7 @@ void DialogWindow::GetState( SfxItemSet& rSet ) case SID_BACKSPACE: { // any object selected? - if ( !pEditor->GetView()->AreObjectsMarked() ) + if ( !pEditor->GetView().AreObjectsMarked() ) rSet.DisableItem( nWh ); if ( IsReadOnly() ) @@ -326,7 +318,7 @@ void DialogWindow::GetState( SfxItemSet& rSet ) else { SfxAllEnumItem aItem( SID_CHOOSE_CONTROLS ); - if ( GetEditor()->GetMode() == DlgEditor::SELECT ) + if ( GetEditor().GetMode() == DlgEditor::SELECT ) aItem.SetValue( SVX_SNAP_SELECT ); else { @@ -376,7 +368,7 @@ void DialogWindow::GetState( SfxItemSet& rSet ) { Shell* pShell = GetShell(); SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : NULL; - if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_PROPERTYBROWSER ) && !pEditor->GetView()->AreObjectsMarked() ) + if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_PROPERTYBROWSER ) && !pEditor->GetView().AreObjectsMarked() ) rSet.DisableItem( nWh ); if ( IsReadOnly() ) @@ -415,7 +407,7 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq ) case SID_CUT: if ( !IsReadOnly() ) { - GetEditor()->Cut(); + GetEditor().Cut(); if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_DOC_MODIFIED ); } @@ -423,49 +415,49 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq ) case SID_DELETE: if ( !IsReadOnly() ) { - GetEditor()->Delete(); + GetEditor().Delete(); if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_DOC_MODIFIED ); } break; case SID_COPY: - GetEditor()->Copy(); + GetEditor().Copy(); break; case SID_PASTE: if ( !IsReadOnly() ) { - GetEditor()->Paste(); + GetEditor().Paste(); if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_DOC_MODIFIED ); } break; case SID_INSERT_FORM_RADIO: - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FORMRADIO ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_FORMRADIO ); break; case SID_INSERT_FORM_CHECK: - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FORMCHECK ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_FORMCHECK ); break; case SID_INSERT_FORM_LIST: - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FORMLIST ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_FORMLIST ); break; case SID_INSERT_FORM_COMBO: - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FORMCOMBO ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_FORMCOMBO ); break; case SID_INSERT_FORM_SPIN: - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FORMSPIN ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_FORMSPIN ); break; case SID_INSERT_FORM_VSCROLL: - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FORMVSCROLL ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_FORMVSCROLL ); break; case SID_INSERT_FORM_HSCROLL: - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FORMHSCROLL ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_FORMHSCROLL ); break; case SID_CHOOSE_CONTROLS: { @@ -477,154 +469,154 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq ) { case SVX_SNAP_PUSHBUTTON: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_PUSHBUTTON ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_PUSHBUTTON ); } break; case SVX_SNAP_RADIOBUTTON: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_RADIOBUTTON ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_RADIOBUTTON ); } break; case SVX_SNAP_CHECKBOX: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_CHECKBOX); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_CHECKBOX); } break; case SVX_SNAP_LISTBOX: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_LISTBOX ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_LISTBOX ); } break; case SVX_SNAP_COMBOBOX: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_COMBOBOX ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_COMBOBOX ); } break; case SVX_SNAP_GROUPBOX: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_GROUPBOX ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_GROUPBOX ); } break; case SVX_SNAP_EDIT: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_EDIT ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_EDIT ); } break; case SVX_SNAP_FIXEDTEXT: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FIXEDTEXT ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_FIXEDTEXT ); } break; case SVX_SNAP_IMAGECONTROL: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_IMAGECONTROL ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_IMAGECONTROL ); } break; case SVX_SNAP_PROGRESSBAR: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_PROGRESSBAR ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_PROGRESSBAR ); } break; case SVX_SNAP_HSCROLLBAR: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_HSCROLLBAR ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_HSCROLLBAR ); } break; case SVX_SNAP_VSCROLLBAR: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_VSCROLLBAR ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_VSCROLLBAR ); } break; case SVX_SNAP_HFIXEDLINE: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_HFIXEDLINE ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_HFIXEDLINE ); } break; case SVX_SNAP_VFIXEDLINE: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_VFIXEDLINE ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_VFIXEDLINE ); } break; case SVX_SNAP_DATEFIELD: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_DATEFIELD ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_DATEFIELD ); } break; case SVX_SNAP_TIMEFIELD: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_TIMEFIELD ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_TIMEFIELD ); } break; case SVX_SNAP_NUMERICFIELD: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_NUMERICFIELD ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_NUMERICFIELD ); } break; case SVX_SNAP_CURRENCYFIELD: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_CURRENCYFIELD ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_CURRENCYFIELD ); } break; case SVX_SNAP_FORMATTEDFIELD: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FORMATTEDFIELD ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_FORMATTEDFIELD ); } break; case SVX_SNAP_PATTERNFIELD: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_PATTERNFIELD ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_PATTERNFIELD ); } break; case SVX_SNAP_FILECONTROL: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FILECONTROL ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_FILECONTROL ); } break; case SVX_SNAP_SPINBUTTON: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_SPINBUTTON ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_SPINBUTTON ); } break; case SVX_SNAP_TREECONTROL: { - GetEditor()->SetMode( DlgEditor::INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_TREECONTROL ); + GetEditor().SetMode( DlgEditor::INSERT ); + GetEditor().SetInsertObj( OBJ_DLG_TREECONTROL ); } break; case SVX_SNAP_SELECT: { - GetEditor()->SetMode( DlgEditor::SELECT ); + GetEditor().SetMode( DlgEditor::SELECT ); } break; } if ( rReq.GetModifier() & KEY_MOD1 ) { - if ( GetEditor()->GetMode() == DlgEditor::INSERT ) - GetEditor()->CreateDefaultObject(); + if ( GetEditor().GetMode() == DlgEditor::INSERT ) + GetEditor().CreateDefaultObject(); } if (SfxBindings* pBindings = GetBindingsPtr()) @@ -634,9 +626,9 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq ) case SID_DIALOG_TESTMODE: { - DlgEditor::Mode eOldMode = GetEditor()->GetMode(); - GetEditor()->SetMode( DlgEditor::TEST ); - GetEditor()->SetMode( eOldMode ); + DlgEditor::Mode eOldMode = GetEditor().GetMode(); + GetEditor().SetMode( DlgEditor::TEST ); + GetEditor().SetMode( eOldMode ); rReq.Done(); if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_DIALOG_TESTMODE ); @@ -722,7 +714,7 @@ bool DialogWindow::SaveDialog() ::rtl::OUString aDialogStr(IDE_RESSTR(RID_STR_STDDIALOGNAME)); Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); xFltMgr->appendFilter( aDialogStr, String( RTL_CONSTASCII_USTRINGPARAM( "*.xdl" ) ) ); - xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) ); + xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), String( RTL_CONSTASCII_USTRINGPARAM( FilterMask_All ) ) ); xFltMgr->setCurrentFilter( aDialogStr ); if( xFP->execute() == RET_OK ) @@ -984,7 +976,7 @@ bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const Scri ::rtl::OUString aDialogStr(IDE_RESSTR(RID_STR_STDDIALOGNAME)); Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); xFltMgr->appendFilter( aDialogStr, String( RTL_CONSTASCII_USTRINGPARAM( "*.xdl" ) ) ); - xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) ); + xFltMgr->appendFilter( IDE_RESSTR(RID_STR_FILTER_ALLFILES), String( RTL_CONSTASCII_USTRINGPARAM( FilterMask_All ) ) ); xFltMgr->setCurrentFilter( aDialogStr ); if( xFP->execute() == RET_OK ) @@ -1267,19 +1259,19 @@ bool DialogWindow::ImportDialog() return implImportDialog( this, aCurPath, rDocument, aLibName ); } -DlgEdModel* DialogWindow::GetModel() const +DlgEdModel& DialogWindow::GetModel() const { - return pEditor ? pEditor->GetModel() : NULL; + return pEditor->GetModel(); } -DlgEdPage* DialogWindow::GetPage() const +DlgEdPage& DialogWindow::GetPage() const { - return pEditor ? pEditor->GetPage() : NULL; + return pEditor->GetPage(); } -DlgEdView* DialogWindow::GetView() const +DlgEdView& DialogWindow::GetView() const { - return pEditor ? pEditor->GetView() : NULL; + return pEditor->GetView(); } bool DialogWindow::IsModified() @@ -1289,7 +1281,7 @@ bool DialogWindow::IsModified() ::svl::IUndoManager* DialogWindow::GetUndoManager() { - return pUndoMgr; + return pUndoMgr.get(); } ::rtl::OUString DialogWindow::GetTitle() @@ -1308,18 +1300,17 @@ EntryDescriptor DialogWindow::CreateEntryDescriptor() void DialogWindow::SetReadOnly (bool bReadOnly) { - if (pEditor) - pEditor->SetMode(bReadOnly ? DlgEditor::READONLY : DlgEditor::SELECT); + pEditor->SetMode(bReadOnly ? DlgEditor::READONLY : DlgEditor::SELECT); } bool DialogWindow::IsReadOnly () { - return pEditor && pEditor->GetMode() == DlgEditor::READONLY; + return pEditor->GetMode() == DlgEditor::READONLY; } bool DialogWindow::IsPasteAllowed() { - return pEditor && pEditor->IsPasteAllowed(); + return pEditor->IsPasteAllowed(); } void DialogWindow::StoreData() diff --git a/basctl/source/basicide/basidectrlr.cxx b/basctl/source/basicide/basidectrlr.cxx index 262afb10e06c..6af458723822 100644 --- a/basctl/source/basicide/basidectrlr.cxx +++ b/basctl/source/basicide/basidectrlr.cxx @@ -34,9 +34,13 @@ using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::beans; +namespace +{ + +int const nPropertyIconId = 1; +rtl::OUString const sPropertyIconId("IconId"); -#define PROPERTY_ID_ICONID 1 -#define PROPERTY_ICONID ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconId" ) ) +} //---------------------------------------------------------------------------- @@ -46,7 +50,11 @@ Controller::Controller (Shell* pViewShell) ,SfxBaseController( pViewShell ) ,m_nIconId( ICON_MACROLIBRARY ) { - registerProperty( PROPERTY_ICONID, PROPERTY_ID_ICONID, PropertyAttribute::READONLY, &m_nIconId, ::getCppuType( &m_nIconId ) ); + registerProperty( + sPropertyIconId, nPropertyIconId, + PropertyAttribute::READONLY, + &m_nIconId, getCppuType(&m_nIconId) + ); } //---------------------------------------------------------------------------- diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx index f7bb0ef194b9..5f6d86b039a2 100644 --- a/basctl/source/basicide/basides3.cxx +++ b/basctl/source/basicide/basides3.cxx @@ -142,7 +142,7 @@ sal_uInt16 Shell::GetWindowId(const BaseWindow* pWin) const SdrView* Shell::GetCurDlgView() const { if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin)) - return pDCurWin->GetView(); + return &pDCurWin->GetView(); else return 0; } diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index e81b3a6d2b53..5b64d24aa854 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -147,13 +147,18 @@ SFX_IMPL_INTERFACE( basctl_Shell, SfxViewShell, IDEResId( RID_STR_IDENAME ) ) -#define IDE_VIEWSHELL_FLAGS (SFX_VIEW_CAN_PRINT|SFX_VIEW_NO_NEWWINDOW) +namespace +{ + +unsigned const ShellFlags = SFX_VIEW_CAN_PRINT | SFX_VIEW_NO_NEWWINDOW; + +} unsigned Shell::nShellCount = 0; Shell::Shell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) : - SfxViewShell( pFrame_, IDE_VIEWSHELL_FLAGS ), + SfxViewShell( pFrame_, ShellFlags ), m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ), aHScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG ) ), aVScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG ) ), @@ -195,7 +200,7 @@ void Shell::Init() m_aCurDocument = ScriptDocument::getApplicationScriptDocument(); bCreatingWindow = false; - pTabBar = new TabBar( &GetViewFrame()->GetWindow() ); + pTabBar.reset(new TabBar(&GetViewFrame()->GetWindow())); pTabBar->SetSplitHdl( LINK( this, Shell, TabBarSplitHdl ) ); bTabBarSplitted = false; @@ -238,8 +243,6 @@ Shell::~Shell() delete it->second; } - delete pTabBar; - // Destroy all ContainerListeners for Basic Container. if (ContainerListenerImpl* pListener = static_cast<ContainerListenerImpl*>(m_xLibListener.get())) pListener->removeContainerListener(m_aCurDocument, m_aCurLibName); diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index 7990efbed7f3..e7a9b4e0119e 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -273,11 +273,11 @@ namespace ::std::auto_ptr< MacroChooser > pChooser( new MacroChooser( NULL, true ) ); if ( bChooseOnly || !SvtModuleOptions().IsBasicIDE() ) - pChooser->SetMode( MACROCHOOSER_CHOOSEONLY ); + pChooser->SetMode(MacroChooser::ChooseOnly); if ( !bChooseOnly && rxLimitToDocument.is() ) // Hack! - pChooser->SetMode( MACROCHOOSER_RECORDING ); + pChooser->SetMode(MacroChooser::Recording); short nRetValue = pChooser->Execute(); @@ -285,10 +285,10 @@ namespace switch ( nRetValue ) { - case MACRO_OK_RUN: + case Macro_OkRun: { pMethod = pChooser->GetMacro(); - if ( !pMethod && pChooser->GetMode() == MACROCHOOSER_RECORDING ) + if ( !pMethod && pChooser->GetMode() == MacroChooser::Recording ) pMethod = pChooser->CreateMacro(); if ( !pMethod ) diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx index 576ab8b2f521..5da04e9016fb 100644 --- a/basctl/source/basicide/basobj3.cxx +++ b/basctl/source/basicide/basobj3.cxx @@ -196,7 +196,7 @@ bool RenameDialog ( DialogWindow* pWin = pShell ? pShell->FindDlgWin(rDocument, rLibName, rOldName) : 0; Reference< XNameContainer > xExistingDialog; if ( pWin ) - xExistingDialog = pWin->GetEditor()->GetDialog(); + xExistingDialog = pWin->GetEditor().GetDialog(); if ( xExistingDialog.is() ) LocalizationMgr::renameStringResourceIDs( rDocument, rLibName, rNewName, xExistingDialog ); diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx index 0178fa829d0d..acd531f60f4a 100644 --- a/basctl/source/basicide/bastype2.hxx +++ b/basctl/source/basicide/bastype2.hxx @@ -51,9 +51,12 @@ enum EntryType OBJ_TYPE_CLASS_MODULES }; -#define BROWSEMODE_MODULES 0x01 -#define BROWSEMODE_SUBS 0x02 -#define BROWSEMODE_DIALOGS 0x04 +enum +{ + BROWSEMODE_MODULES = 0x01, + BROWSEMODE_SUBS = 0x02, + BROWSEMODE_DIALOGS = 0x04, +}; class Entry { diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 1166221e0509..bc4d32babc81 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -837,19 +837,19 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer, do { // password dialog - SfxPasswordDialog* pDlg = new SfxPasswordDialog( Application::GetDefDialogParent() ); - pDlg->SetMinLen( 1 ); + SfxPasswordDialog aDlg(Application::GetDefDialogParent()); + aDlg.SetMinLen( 1 ); // set new title if ( bNewTitle ) { ::rtl::OUString aTitle(IDE_RESSTR(RID_STR_ENTERPASSWORD)); aTitle = aTitle.replaceAll("XX", rLibName); - pDlg->SetText( aTitle ); + aDlg.SetText( aTitle ); } // execute dialog - nRet = pDlg->Execute(); + nRet = aDlg.Execute(); // verify password if ( nRet == RET_OK ) @@ -859,7 +859,7 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer, Reference< script::XLibraryContainerPassword > xPasswd( xLibContainer, UNO_QUERY ); if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( rLibName ) && !xPasswd->isLibraryPasswordVerified( rLibName ) ) { - rPassword = pDlg->GetPassword(); + rPassword = aDlg.GetPassword(); // ::rtl::OUString aOUPassword( rPassword ); bOK = xPasswd->verifyLibraryPassword( rLibName, rPassword ); @@ -871,8 +871,6 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer, } } } - - delete pDlg; } while ( bRepeat && !bOK && nRet == RET_OK ); diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx index bc863a29b4b9..28133d1150a9 100644 --- a/basctl/source/basicide/doceventnotifier.cxx +++ b/basctl/source/basicide/doceventnotifier.cxx @@ -55,7 +55,7 @@ namespace basctl namespace csslang = ::com::sun::star::lang; //==================================================================== - //= DocumentEventNotifier_Impl + //= DocumentEventNotifier::Impl //==================================================================== typedef ::cppu::WeakComponentImplHelper1 < XEventListener > DocumentEventNotifier_Impl_Base; @@ -68,12 +68,13 @@ namespace basctl /** impl class for DocumentEventNotifier */ - class DocumentEventNotifier_Impl :public ::boost::noncopyable + class DocumentEventNotifier::Impl :public ::boost::noncopyable ,public ::cppu::BaseMutex ,public DocumentEventNotifier_Impl_Base { public: - DocumentEventNotifier_Impl( DocumentEventListener& _rListener, const Reference< XModel >& _rxDocument ); + Impl (DocumentEventListener&, Reference<XModel> const& rxDocument); + ~Impl (); // document::XEventListener virtual void SAL_CALL notifyEvent( const EventObject& Event ) throw (RuntimeException); @@ -84,9 +85,6 @@ namespace basctl // ComponentHelper virtual void SAL_CALL disposing(); - protected: - ~DocumentEventNotifier_Impl(); - private: /// determines whether the instance is already disposed bool impl_isDisposed_nothrow() const { return m_pListener == NULL; } @@ -103,10 +101,10 @@ namespace basctl }; //-------------------------------------------------------------------- - DocumentEventNotifier_Impl::DocumentEventNotifier_Impl( DocumentEventListener& _rListener, const Reference< XModel >& _rxDocument ) - :DocumentEventNotifier_Impl_Base( m_aMutex ) - ,m_pListener( &_rListener ) - ,m_xModel( _rxDocument ) + DocumentEventNotifier::Impl::Impl (DocumentEventListener& rListener, Reference<XModel> const& rxDocument) : + DocumentEventNotifier_Impl_Base(m_aMutex), + m_pListener(&rListener), + m_xModel(rxDocument) { osl_incrementInterlockedCount( &m_refCount ); impl_listenerAction_nothrow( RegisterListener ); @@ -114,7 +112,7 @@ namespace basctl } //-------------------------------------------------------------------- - DocumentEventNotifier_Impl::~DocumentEventNotifier_Impl() + DocumentEventNotifier::Impl::~Impl () { if ( !impl_isDisposed_nothrow() ) { @@ -124,16 +122,16 @@ namespace basctl } //-------------------------------------------------------------------- - void SAL_CALL DocumentEventNotifier_Impl::notifyEvent( const EventObject& _rEvent ) throw (RuntimeException) + void SAL_CALL DocumentEventNotifier::Impl::notifyEvent( const EventObject& _rEvent ) throw (RuntimeException) { ::osl::ClearableMutexGuard aGuard( m_aMutex ); - OSL_PRECOND( !impl_isDisposed_nothrow(), "DocumentEventNotifier_Impl::notifyEvent: disposed, but still getting events?" ); + OSL_PRECOND( !impl_isDisposed_nothrow(), "DocumentEventNotifier::Impl::notifyEvent: disposed, but still getting events?" ); if ( impl_isDisposed_nothrow() ) return; Reference< XModel > xDocument( _rEvent.Source, UNO_QUERY ); - OSL_ENSURE( xDocument.is(), "DocumentEventNotifier_Impl::notifyEvent: illegal source document!" ); + OSL_ENSURE( xDocument.is(), "DocumentEventNotifier::Impl::notifyEvent: illegal source document!" ); if ( !xDocument.is() ) return; @@ -178,7 +176,7 @@ namespace basctl } //-------------------------------------------------------------------- - void SAL_CALL DocumentEventNotifier_Impl::disposing( const csslang::EventObject& /*Event*/ ) throw (RuntimeException) + void SAL_CALL DocumentEventNotifier::Impl::disposing( const csslang::EventObject& /*Event*/ ) throw (RuntimeException) { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); @@ -188,21 +186,21 @@ namespace basctl } //-------------------------------------------------------------------- - void SAL_CALL DocumentEventNotifier_Impl::disposing() + void SAL_CALL DocumentEventNotifier::Impl::disposing() { impl_listenerAction_nothrow( RemoveListener ); impl_dispose_nothrow(); } //-------------------------------------------------------------------- - void DocumentEventNotifier_Impl::impl_dispose_nothrow() + void DocumentEventNotifier::Impl::impl_dispose_nothrow() { m_pListener = NULL; m_xModel.clear(); } //-------------------------------------------------------------------- - void DocumentEventNotifier_Impl::impl_listenerAction_nothrow( ListenerAction _eAction ) + void DocumentEventNotifier::Impl::impl_listenerAction_nothrow( ListenerAction _eAction ) { try { @@ -231,16 +229,14 @@ namespace basctl //= DocumentEventNotifier //==================================================================== //-------------------------------------------------------------------- - DocumentEventNotifier::DocumentEventNotifier( DocumentEventListener& _rListener, const Reference< XModel >& _rxDocument ) - :m_pImpl( new DocumentEventNotifier_Impl( _rListener, _rxDocument ) ) - { - } + DocumentEventNotifier::DocumentEventNotifier (DocumentEventListener& rListener, Reference<XModel> const& rxDocument) : + m_pImpl(new Impl(rListener, rxDocument)) + { } //-------------------------------------------------------------------- - DocumentEventNotifier::DocumentEventNotifier( DocumentEventListener& _rListener ) - :m_pImpl( new DocumentEventNotifier_Impl( _rListener, Reference< XModel >() ) ) - { - } + DocumentEventNotifier::DocumentEventNotifier (DocumentEventListener& rListener) : + m_pImpl(new Impl(rListener, Reference<XModel>())) + { } //-------------------------------------------------------------------- DocumentEventNotifier::~DocumentEventNotifier() diff --git a/basctl/source/basicide/docsignature.cxx b/basctl/source/basicide/docsignature.cxx index 17adaf30822f..0124f523cf7a 100644 --- a/basctl/source/basicide/docsignature.cxx +++ b/basctl/source/basicide/docsignature.cxx @@ -38,25 +38,25 @@ namespace basctl /** === end UNO using === **/ //==================================================================== - //= DocumentSignature_Data + //= DocumentSignature::Impl //==================================================================== - struct DocumentSignature_Data + struct DocumentSignature::Impl { - SfxObjectShell* pShell; + SfxObjectShell* pShell; - DocumentSignature_Data() : pShell( NULL ) { } + Impl () : pShell(0) { } }; //==================================================================== //= DocumentSignature //==================================================================== //-------------------------------------------------------------------- - DocumentSignature::DocumentSignature( const ScriptDocument& _rDocument ) - :m_pData( new DocumentSignature_Data ) + DocumentSignature::DocumentSignature (ScriptDocument const& rDocument) : + m_pImpl(new Impl) { - if ( _rDocument.isDocument() ) + if (rDocument.isDocument()) { - Reference< XModel > xDocument( _rDocument.getDocument() ); + Reference<XModel> xDocument(rDocument.getDocument()); // find object shell for document SfxObjectShell* pShell = SfxObjectShell::GetFirst(); while ( pShell ) @@ -65,7 +65,7 @@ namespace basctl break; pShell = SfxObjectShell::GetNext( *pShell ); } - m_pData->pShell = pShell; + m_pImpl->pShell = pShell; } } @@ -77,22 +77,22 @@ namespace basctl //-------------------------------------------------------------------- bool DocumentSignature::supportsSignatures() const { - return ( m_pData->pShell != NULL ); + return ( m_pImpl->pShell != NULL ); } //-------------------------------------------------------------------- void DocumentSignature::signScriptingContent() const { OSL_PRECOND( supportsSignatures(), "DocumentSignature::signScriptingContent: signatures not supported by this document!" ); - if ( m_pData->pShell ) - m_pData->pShell->SignScriptingContent(); + if ( m_pImpl->pShell ) + m_pImpl->pShell->SignScriptingContent(); } //-------------------------------------------------------------------- sal_uInt16 DocumentSignature::getScriptingSignatureState() const { - if ( m_pData->pShell ) - return m_pData->pShell->GetScriptingSignatureState(); + if ( m_pImpl->pShell ) + return m_pImpl->pShell->GetScriptingSignatureState(); return SIGNATURESTATE_NOSIGNATURES; } diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx index c4c55b25ff61..62004ad27859 100644 --- a/basctl/source/basicide/localizationmgr.cxx +++ b/basctl/source/basicide/localizationmgr.cxx @@ -38,36 +38,38 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::resource; -static ::rtl::OUString aDot( RTL_CONSTASCII_USTRINGPARAM( "." )); -static ::rtl::OUString aEsc( RTL_CONSTASCII_USTRINGPARAM( "&" )); -static ::rtl::OUString aSemi( RTL_CONSTASCII_USTRINGPARAM( ";" )); - - -LocalizationMgr::LocalizationMgr( Shell* pShell, - const ScriptDocument& rDocument, ::rtl::OUString aLibName, - const Reference< XStringResourceManager >& xStringResourceManager ) - : m_xStringResourceManager( xStringResourceManager ) - , m_pShell( pShell ) - , m_aDocument( rDocument ) - , m_aLibName( aLibName ) +namespace { -} -bool LocalizationMgr::isLibraryLocalized( void ) +rtl::OUString const aDot("."); +rtl::OUString const aEsc("&"); +rtl::OUString const aSemi(";"); + +} // namespace + +LocalizationMgr::LocalizationMgr( + Shell* pShell, + ScriptDocument const& rDocument, + rtl::OUString const& aLibName, + Reference<XStringResourceManager> const& xStringResourceManager +) : + m_xStringResourceManager(xStringResourceManager), + m_pShell(pShell), + m_aDocument(rDocument), + m_aLibName(aLibName) +{ } + +bool LocalizationMgr::isLibraryLocalized () { - bool bRet = false; - if( m_xStringResourceManager.is() ) - { - Sequence< Locale > aLocaleSeq = m_xStringResourceManager->getLocales(); - bRet = ( aLocaleSeq.getLength() > 0 ); - } - return bRet; + if (m_xStringResourceManager.is()) + return m_xStringResourceManager->getLocales().getLength() > 0; + return false; } -void LocalizationMgr::handleTranslationbar( void ) +void LocalizationMgr::handleTranslationbar () { - static ::rtl::OUString aLayoutManagerName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )); - static ::rtl::OUString aToolBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/translationbar" )); + static rtl::OUString const aLayoutManagerName("LayoutManager"); + static rtl::OUString const aToolBarResName("private:resource/toolbar/translationbar"); Reference< beans::XPropertySet > xFrameProps ( m_pShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); @@ -94,38 +96,34 @@ void LocalizationMgr::handleTranslationbar( void ) // TODO: -> export from toolkit -struct LanguageDependentProp +namespace { - const char* pPropName; - sal_Int32 nPropNameLength; -}; -static LanguageDependentProp aLanguageDependentProp[] = -{ - { "Text", 4 }, - { "Label", 5 }, - { "Title", 5 }, - { "HelpText", 8 }, - { "CurrencySymbol", 14 }, - { "StringItemList", 14 }, - { 0, 0 } -}; + +} bool isLanguageDependentProperty( ::rtl::OUString aName ) { - bool bRet = false; - - LanguageDependentProp* pLangDepProp = aLanguageDependentProp; - while( pLangDepProp->pPropName != 0 ) + static struct Prop { - if( aName.equalsAsciiL( pLangDepProp->pPropName, pLangDepProp->nPropNameLength )) - { - bRet = true; - break; - } - pLangDepProp++; + const char* sName; + sal_Int32 nNameLength; } - return bRet; + const vProp[] = + { + { "Text", 4 }, + { "Label", 5 }, + { "Title", 5 }, + { "HelpText", 8 }, + { "CurrencySymbol", 14 }, + { "StringItemList", 14 }, + { 0, 0 } + }; + + for (Prop const* pProp = vProp; pProp->sName; ++pProp) + if (aName.equalsAsciiL(pProp->sName, pProp->nNameLength)) + return true; + return false; } @@ -779,8 +777,7 @@ void LocalizationMgr::handleSetCurrentLocale( ::com::sun::star::lang::Locale aLo if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(m_pShell->GetCurWindow())) if (!pDlgWin->IsSuspended()) - if (DlgEditor* pWinEditor = pDlgWin->GetEditor()) - pWinEditor->UpdatePropertyBrowserDelayed(); + pDlgWin->GetEditor().UpdatePropertyBrowserDelayed(); } } @@ -812,8 +809,7 @@ DialogWindow* FindDialogWindowForEditor( DlgEditor* pEditor ) if (!pWin->IsSuspended()) if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(pWin)) { - DlgEditor* pWinEditor = pDlgWin->GetEditor(); - if( pWinEditor == pEditor ) + if (&pDlgWin->GetEditor() == pEditor) return pDlgWin; } } diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index 66978826b160..4feb8ffefac5 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -60,34 +60,31 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; MacroChooser::MacroChooser( Window* pParnt, bool bCreateEntries ) : - SfxModalDialog( pParnt, IDEResId( RID_MACROCHOOSER ) ), - aMacroNameTxt( this, IDEResId( RID_TXT_MACRONAME ) ), - aMacroNameEdit( this, IDEResId( RID_ED_MACRONAME ) ), - aMacroFromTxT( this, IDEResId( RID_TXT_MACROFROM ) ), - aMacrosSaveInTxt( this, IDEResId( RID_TXT_SAVEMACRO ) ), - aBasicBox( this, IDEResId( RID_CTRL_LIB ) ), - aMacrosInTxt( this, IDEResId( RID_TXT_MACROSIN ) ), - aMacroBox( this, IDEResId( RID_CTRL_MACRO ) ), - aRunButton( this, IDEResId( RID_PB_RUN ) ), - aCloseButton( this, IDEResId( RID_PB_CLOSE ) ), - aAssignButton( this, IDEResId( RID_PB_ASSIGN ) ), - aEditButton( this, IDEResId( RID_PB_EDIT ) ), - aNewDelButton( this, IDEResId( RID_PB_DEL ) ), - aOrganizeButton( this, IDEResId( RID_PB_ORG ) ), - aHelpButton( this, IDEResId( RID_PB_HELP ) ), - aNewLibButton( this, IDEResId( RID_PB_NEWLIB ) ), - aNewModButton( this, IDEResId( RID_PB_NEWMOD ) ) -{ - FreeResource(); - - nMode = MACROCHOOSER_ALL; - bNewDelIsDel = true; - + SfxModalDialog( pParnt, IDEResId( RID_MACROCHOOSER ) ), + aMacroNameTxt( this, IDEResId( RID_TXT_MACRONAME ) ), + aMacroNameEdit( this, IDEResId( RID_ED_MACRONAME ) ), + aMacroFromTxT( this, IDEResId( RID_TXT_MACROFROM ) ), + aMacrosSaveInTxt( this, IDEResId( RID_TXT_SAVEMACRO ) ), + aBasicBox( this, IDEResId( RID_CTRL_LIB ) ), + aMacrosInTxt( this, IDEResId( RID_TXT_MACROSIN ) ), + aMacrosInTxtBaseStr(aMacrosInTxt.GetText()), + aMacroBox( this, IDEResId( RID_CTRL_MACRO ) ), + aRunButton( this, IDEResId( RID_PB_RUN ) ), + aCloseButton( this, IDEResId( RID_PB_CLOSE ) ), + aAssignButton( this, IDEResId( RID_PB_ASSIGN ) ), + aEditButton( this, IDEResId( RID_PB_EDIT ) ), + aNewDelButton( this, IDEResId( RID_PB_DEL ) ), + aOrganizeButton( this, IDEResId( RID_PB_ORG ) ), + aHelpButton( this, IDEResId( RID_PB_HELP ) ), + aNewLibButton( this, IDEResId( RID_PB_NEWLIB ) ), + aNewModButton( this, IDEResId( RID_PB_NEWMOD ) ), + bNewDelIsDel(true), // the Sfx doesn't aske the BasicManger whether modified or not // => start saving in case of a change without a into the BasicIDE. - bForceStoreBasic = false; - - aMacrosInTxtBaseStr = aMacrosInTxt.GetText(); + bForceStoreBasic(false), + nMode(All) +{ + FreeResource(); aMacroBox.SetSelectionMode( SINGLE_SELECTION ); aMacroBox.SetHighlightRange(); // select over the whole width @@ -99,7 +96,7 @@ MacroChooser::MacroChooser( Window* pParnt, bool bCreateEntries ) : aNewDelButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) ); aOrganizeButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) ); - // Buttons only for MACROCHOOSER_RECORDING + // Buttons only for MacroChooser::Recording aNewLibButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) ); aNewModButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) ); aNewLibButton.Hide(); // default @@ -252,7 +249,7 @@ void MacroChooser::EnableButton( Button& rButton, bool bEnable ) { if ( bEnable ) { - if ( nMode == MACROCHOOSER_CHOOSEONLY || nMode == MACROCHOOSER_RECORDING ) + if (nMode == ChooseOnly || nMode == Recording) rButton.Enable(&rButton == &aRunButton); else rButton.Enable(); @@ -418,11 +415,11 @@ void MacroChooser::CheckButtons() } } - if ( nMode != MACROCHOOSER_RECORDING ) + if (nMode != Recording) { // Run... bool bEnable = pMethod ? true : false; - if ( ( nMode != MACROCHOOSER_CHOOSEONLY ) && StarBASIC::IsRunning() ) + if (nMode != ChooseOnly && StarBASIC::IsRunning()) bEnable = false; EnableButton( aRunButton, bEnable ); } @@ -436,22 +433,21 @@ void MacroChooser::CheckButtons() EnableButton( aEditButton, pMacroEntry ? true : false ); // aOrganizeButton - EnableButton( aOrganizeButton, !StarBASIC::IsRunning() && ( nMode == MACROCHOOSER_ALL )); + EnableButton( aOrganizeButton, !StarBASIC::IsRunning() && nMode == All ); // aNewDelButton.... bool bProtected = aBasicBox.IsEntryProtected( pCurEntry ); bool bShare = ( aDesc.GetLocation() == LIBRARY_LOCATION_SHARE ); - EnableButton( aNewDelButton, - !StarBASIC::IsRunning() && ( nMode == MACROCHOOSER_ALL ) && !bProtected && !bReadOnly && !bShare ); + EnableButton(aNewDelButton, !StarBASIC::IsRunning() && nMode == All && !bProtected && !bReadOnly && !bShare); bool bPrev = bNewDelIsDel; bNewDelIsDel = pMethod ? true : false; - if ( ( bPrev != bNewDelIsDel ) && ( nMode == MACROCHOOSER_ALL ) ) + if (bPrev != bNewDelIsDel && nMode == All) { String aBtnText( bNewDelIsDel ? IDEResId( RID_STR_BTNDEL) : IDEResId( RID_STR_BTNNEW ) ); aNewDelButton.SetText( aBtnText ); } - if ( nMode == MACROCHOOSER_RECORDING ) + if (nMode == Recording) { // save button aRunButton.Enable(!bProtected && !bReadOnly && !bShare); @@ -467,14 +463,14 @@ void MacroChooser::CheckButtons() IMPL_LINK_NOARG_INLINE_START(MacroChooser, MacroDoubleClickHdl) { StoreMacroDescription(); - if ( nMode == MACROCHOOSER_RECORDING ) + if (nMode == Recording) { SbMethod* pMethod = GetMacro(); if ( pMethod && !QueryReplaceMacro( pMethod->GetName(), this ) ) return 0; } - EndDialog( MACRO_OK_RUN ); + EndDialog(Macro_OkRun); return 0; } IMPL_LINK_NOARG_INLINE_END(MacroChooser, MacroDoubleClickHdl) @@ -618,7 +614,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) StoreMacroDescription(); // #116444# check security settings before macro execution - if ( nMode == MACROCHOOSER_ALL ) + if (nMode == All) { SbMethod* pMethod = GetMacro(); SbModule* pModule = pMethod ? pMethod->GetModule() : NULL; @@ -634,7 +630,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) } } } - else if ( nMode == MACROCHOOSER_RECORDING ) + else if (nMode == Recording ) { if ( !IsValidSbxName(aMacroNameEdit.GetText()) ) { @@ -649,12 +645,12 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) return 0; } - EndDialog( MACRO_OK_RUN ); + EndDialog(Macro_OkRun); } else if ( pButton == &aCloseButton ) { StoreMacroDescription(); - EndDialog( MACRO_CLOSE ); + EndDialog(Macro_Close); } else if ( ( pButton == &aEditButton ) || ( pButton == &aNewDelButton ) ) { @@ -687,7 +683,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_EDITMACRO, SFX_CALLMODE_ASYNCHRON, &aInfoItem, 0L ); - EndDialog( MACRO_EDIT ); + EndDialog(Macro_Edit); } else { @@ -724,7 +720,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_EDITMACRO, SFX_CALLMODE_ASYNCHRON, &aInfoItem, 0L ); StoreMacroDescription(); - EndDialog( MACRO_NEW ); + EndDialog(Macro_New); } } } @@ -780,7 +776,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) if ( nRet ) // not only closed { - EndDialog( MACRO_EDIT ); + EndDialog(Macro_Edit); return 0; } @@ -805,42 +801,50 @@ void MacroChooser::UpdateFields() aMacroNameEdit.SetText( aMacroBox.GetEntryText( pMacroEntry ) ); } -void MacroChooser::SetMode( sal_uInt16 nM ) +void MacroChooser::SetMode (Mode nM) { nMode = nM; - if ( nMode == MACROCHOOSER_ALL ) + switch (nMode) { - aRunButton.SetText( String( IDEResId( RID_STR_RUN ) ) ); - EnableButton( aNewDelButton, true ); - EnableButton( aOrganizeButton, true ); - } - else if ( nMode == MACROCHOOSER_CHOOSEONLY ) - { - aRunButton.SetText( String( IDEResId( RID_STR_CHOOSE ) ) ); - EnableButton( aNewDelButton, false ); - EnableButton( aOrganizeButton, false ); - } - else if ( nMode == MACROCHOOSER_RECORDING ) - { - aRunButton.SetText( String( IDEResId( RID_STR_RECORD ) ) ); - EnableButton( aNewDelButton, false ); - EnableButton( aOrganizeButton, false ); - - aAssignButton.Hide(); - aEditButton.Hide(); - aNewDelButton.Hide(); - aOrganizeButton.Hide(); - aMacroFromTxT.Hide(); - - aNewLibButton.Show(); - aNewModButton.Show(); - aMacrosSaveInTxt.Show(); - - Point aHelpPos = aHelpButton.GetPosPixel(); - Point aHelpPosLogic = PixelToLogic( aHelpPos, MapMode(MAP_APPFONT) ); - aHelpPosLogic.Y() -= 34; - aHelpPos = LogicToPixel( aHelpPosLogic, MapMode(MAP_APPFONT) ); - aHelpButton.SetPosPixel( aHelpPos ); + case All: + { + aRunButton.SetText( String( IDEResId( RID_STR_RUN ) ) ); + EnableButton( aNewDelButton, true ); + EnableButton( aOrganizeButton, true ); + break; + } + + case ChooseOnly: + { + aRunButton.SetText( String( IDEResId( RID_STR_CHOOSE ) ) ); + EnableButton( aNewDelButton, false ); + EnableButton( aOrganizeButton, false ); + break; + } + + case Recording: + { + aRunButton.SetText( String( IDEResId( RID_STR_RECORD ) ) ); + EnableButton( aNewDelButton, false ); + EnableButton( aOrganizeButton, false ); + + aAssignButton.Hide(); + aEditButton.Hide(); + aNewDelButton.Hide(); + aOrganizeButton.Hide(); + aMacroFromTxT.Hide(); + + aNewLibButton.Show(); + aNewModButton.Show(); + aMacrosSaveInTxt.Show(); + + Point aHelpPos = aHelpButton.GetPosPixel(); + Point aHelpPosLogic = PixelToLogic( aHelpPos, MapMode(MAP_APPFONT) ); + aHelpPosLogic.Y() -= 34; + aHelpPos = LogicToPixel( aHelpPosLogic, MapMode(MAP_APPFONT) ); + aHelpButton.SetPosPixel( aHelpPos ); + break; + } } CheckButtons(); } diff --git a/basctl/source/basicide/macrodlg.hxx b/basctl/source/basicide/macrodlg.hxx index c771ef9016d7..083cb2ef532a 100644 --- a/basctl/source/basicide/macrodlg.hxx +++ b/basctl/source/basicide/macrodlg.hxx @@ -32,17 +32,22 @@ namespace basctl { -#define MACRO_CLOSE 10 -#define MACRO_OK_RUN 11 -#define MACRO_NEW 12 -#define MACRO_EDIT 14 - -#define MACROCHOOSER_ALL 1 -#define MACROCHOOSER_CHOOSEONLY 2 -#define MACROCHOOSER_RECORDING 3 +enum MacroExitCode { + Macro_Close = 10, + Macro_OkRun = 11, + Macro_New = 12, + Macro_Edit = 14, +}; class MacroChooser : public SfxModalDialog { +public: + enum Mode { + All = 1, + ChooseOnly = 2, + Recording = 3, + }; + private: FixedText aMacroNameTxt; Edit aMacroNameEdit; @@ -66,7 +71,7 @@ private: bool bNewDelIsDel; bool bForceStoreBasic; - sal_uInt16 nMode; + Mode nMode; DECL_LINK( MacroSelectHdl, SvTreeListBox * ); DECL_LINK(MacroDoubleClickHdl, void *); @@ -95,8 +100,8 @@ public: virtual short Execute(); - void SetMode( sal_uInt16 nMode ); - sal_uInt16 GetMode() const { return nMode; } + void SetMode (Mode); + Mode GetMode () const { return nMode; } }; } // namespace basctl diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 94cd073c16a5..18f6bfdd2522 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -62,6 +62,8 @@ #include <com/sun/star/util/VetoException.hpp> #include <com/sun/star/script/ModuleSizeExceededRequest.hpp> +#include <cassert> + namespace basctl { @@ -162,9 +164,9 @@ void LibLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvLBoxEn CheckBox::CheckBox( Window* pParent, const ResId& rResId ) :SvTabListBox( pParent, rResId ) + ,eMode(ObjectMode::Module) ,m_aDocument( ScriptDocument::getApplicationScriptDocument() ) { - nMode = NEWOBJECTMODE_MOD; long aTabs_[] = { 1, 12 }; // TabPos needs at least one... // 12 because of the CheckBox SetTabs( aTabs_ ); @@ -192,7 +194,7 @@ void CheckBox::Init() { pCheckButton = new SvLBoxButtonData(this); - if ( nMode == LIBMODE_CHOOSER ) + if (eMode == ObjectMode::Library) EnableCheckButton( pCheckButton ); else EnableCheckButton( 0 ); @@ -202,11 +204,11 @@ void CheckBox::Init() //---------------------------------------------------------------------------- -void CheckBox::SetMode( NewObjectMode n ) +void CheckBox::SetMode (ObjectMode::Mode e) { - nMode = n; + eMode = e; - if ( nMode == LIBMODE_CHOOSER ) + if (eMode == ObjectMode::Library) EnableCheckButton( pCheckButton ); else EnableCheckButton( 0 ); @@ -262,7 +264,7 @@ void CheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const Imag { SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind ); - if ( nMode == NEWOBJECTMODE_MOD ) + if (eMode == ObjectMode::Module) { // initialize all columns with own string class (column 0 == bitmap) sal_uInt16 nCount = pEntry->ItemCount(); @@ -279,7 +281,7 @@ void CheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const Imag sal_Bool CheckBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) { - if ( nMode != NEWOBJECTMODE_MOD ) + if (eMode != ObjectMode::Module) return false; DBG_ASSERT( pEntry, "Kein Eintrag?" ); @@ -388,7 +390,7 @@ IMPL_LINK_NOARG(NewObjectDialog, OkButtonHandler) return 0; } -NewObjectDialog::NewObjectDialog(Window * pParent, NewObjectMode nMode, +NewObjectDialog::NewObjectDialog(Window * pParent, ObjectMode::Mode eMode, bool bCheckName) : ModalDialog( pParent, IDEResId( RID_DLG_NEWLIB ) ), aText( this, IDEResId( RID_FT_NEWLIB ) ), @@ -399,20 +401,22 @@ NewObjectDialog::NewObjectDialog(Window * pParent, NewObjectMode nMode, FreeResource(); aEdit.GrabFocus(); - switch (nMode) + switch (eMode) { - case NEWOBJECTMODE_LIB: - SetText( IDE_RESSTR(RID_STR_NEWLIB) ); - break; - case NEWOBJECTMODE_MOD: - SetText( IDE_RESSTR(RID_STR_NEWMOD) ); - break; - case NEWOBJECTMODE_METH: - SetText( IDE_RESSTR(RID_STR_NEWMETH) ); - break; - default: - SetText( IDE_RESSTR(RID_STR_NEWDLG) ); - break; + case ObjectMode::Library: + SetText( IDE_RESSTR(RID_STR_NEWLIB) ); + break; + case ObjectMode::Module: + SetText( IDE_RESSTR(RID_STR_NEWMOD) ); + break; + case ObjectMode::Method: + SetText( IDE_RESSTR(RID_STR_NEWMETH) ); + break; + case ObjectMode::Dialog: + SetText( IDE_RESSTR(RID_STR_NEWDLG) ); + break; + default: + assert(false); } if (bCheckName) @@ -523,7 +527,7 @@ LibPage::LibPage( Window * pParent ) aBasicsBox.SetSelectHdl( LINK( this, LibPage, BasicSelectHdl ) ); - aLibBox.SetMode( NEWOBJECTMODE_MOD ); + aLibBox.SetMode(ObjectMode::Module); aLibBox.EnableInplaceEditing(true); aLibBox.SetStyle( WB_HSCROLL | WB_BORDER | WB_TABSTOP ); aCloseButton.GrabFocus(); @@ -887,7 +891,7 @@ void LibPage::InsertLib() { pLibDlg = new LibDialog( this ); pLibDlg->SetStorageName( aURLObj.getName() ); - pLibDlg->GetLibBox().SetMode( NEWOBJECTMODE_LIB ); + pLibDlg->GetLibBox().SetMode(ObjectMode::Library); } // libbox entries @@ -1178,14 +1182,12 @@ void LibPage::Export( void ) } - Window* pWin = static_cast<Window*>( this ); - std::auto_ptr< ExportDialog > xNewDlg( new ExportDialog( pWin ) ); - - if ( xNewDlg->Execute() == RET_OK ) + ExportDialog aNewDlg(this); + if (aNewDlg.Execute() == RET_OK) { try { - if( xNewDlg->isExportAsPackage() ) + if (aNewDlg.isExportAsPackage()) ExportAsPackage( aLibName ); else ExportAsBasic( aLibName ); @@ -1595,13 +1597,13 @@ void createLibImpl( Window* pWin, const ScriptDocument& rDocument, i++; } - std::auto_ptr< NewObjectDialog > xNewDlg( new NewObjectDialog( pWin, NEWOBJECTMODE_LIB ) ); - xNewDlg->SetObjectName( aLibName ); + NewObjectDialog aNewDlg(pWin, ObjectMode::Library); + aNewDlg.SetObjectName(aLibName); - if ( xNewDlg->Execute() ) + if (aNewDlg.Execute()) { - if ( xNewDlg->GetObjectName().Len() ) - aLibName = xNewDlg->GetObjectName(); + if (aNewDlg.GetObjectName().Len()) + aLibName = aNewDlg.GetObjectName(); if ( aLibName.Len() > 30 ) { diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index 4ad0faaf06f9..0d0d867c4e4a 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -805,13 +805,12 @@ void ObjectPage::NewDialog() { aDocument.getOrCreateLibrary( E_DIALOGS, aLibName ); - boost::scoped_ptr< NewObjectDialog > xNewDlg( - new NewObjectDialog(this, NEWOBJECTMODE_DLG, true)); - xNewDlg->SetObjectName( aDocument.createObjectName( E_DIALOGS, aLibName ) ); + NewObjectDialog aNewDlg(this, ObjectMode::Dialog, true); + aNewDlg.SetObjectName( aDocument.createObjectName( E_DIALOGS, aLibName ) ); - if (xNewDlg->Execute() != 0) + if (aNewDlg.Execute() != 0) { - ::rtl::OUString aDlgName( xNewDlg->GetObjectName() ); + rtl::OUString aDlgName = aNewDlg.GetObjectName(); if (aDlgName.isEmpty()) aDlgName = aDocument.createObjectName( E_DIALOGS, aLibName); @@ -961,14 +960,13 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument, if ( aModName.isEmpty() ) aModName = rDocument.createObjectName( E_SCRIPTS, aLibName ); - boost::scoped_ptr< NewObjectDialog > xNewDlg( - new NewObjectDialog( pWin, NEWOBJECTMODE_MOD, true ) ); - xNewDlg->SetObjectName( aModName ); + NewObjectDialog aNewDlg(pWin, ObjectMode::Module, true); + aNewDlg.SetObjectName( aModName ); - if (xNewDlg->Execute() != 0) + if (aNewDlg.Execute() != 0) { - if ( xNewDlg->GetObjectName().Len() ) - aModName = xNewDlg->GetObjectName(); + if (aNewDlg.GetObjectName().Len() ) + aModName = aNewDlg.GetObjectName(); try { diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx index cef214336345..71f6e66c9554 100644 --- a/basctl/source/basicide/moduldlg.hxx +++ b/basctl/source/basicide/moduldlg.hxx @@ -40,13 +40,16 @@ class SvxPasswordDialog; namespace basctl { -enum NewObjectMode +namespace ObjectMode { - NEWOBJECTMODE_LIB = 1, - NEWOBJECTMODE_MOD = 2, - NEWOBJECTMODE_DLG = 3, - NEWOBJECTMODE_METH = 4 -}; + enum Mode + { + Library = 1, + Module = 2, + Dialog = 3, + Method = 4, + }; +} class NewObjectDialog : public ModalDialog { @@ -59,8 +62,8 @@ private: DECL_LINK(OkButtonHandler, void *); public: - NewObjectDialog(Window * pParent, NewObjectMode nMode, bool bCheckName = false); - ~NewObjectDialog(); + NewObjectDialog (Window* pParent, ObjectMode::Mode, bool bCheckName = false); + virtual ~NewObjectDialog (); String GetObjectName() const { return aEdit.GetText(); } void SetObjectName( const String& rName ) { aEdit.SetText( rName ); aEdit.SetSelection( Selection( 0, rName.Len() ) );} @@ -119,13 +122,10 @@ public: ~ExtTreeListBox(); }; -#define LIBMODE_CHOOSER 1 -#define LIBMODE_MANAGER 2 - class CheckBox : public SvTabListBox { private: - NewObjectMode nMode; + ObjectMode::Mode eMode; SvLBoxButtonData* pCheckButton; ScriptDocument m_aDocument; void Init(); @@ -146,8 +146,8 @@ public: void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; } - void SetMode( NewObjectMode n ); - NewObjectMode GetMode() const { return nMode; } + void SetMode (ObjectMode::Mode); + ObjectMode::Mode GetMode () const { return eMode; } }; class LibDialog: public ModalDialog diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index c087e67f3ec0..9d3119817fa5 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -135,7 +135,7 @@ void DlgEditor::ShowDialog() // create a peer uno::Reference< awt::XToolkit> xToolkit( xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.ExtToolkit" ) ) ), uno::UNO_QUERY ); - xDlg->createPeer( xToolkit, pWindow->GetComponentInterface() ); + xDlg->createPeer( xToolkit, rWindow.GetComponentInterface() ); uno::Reference< awt::XDialog > xD( xDlg, uno::UNO_QUERY ); xD->execute(); @@ -175,21 +175,20 @@ bool DlgEditor::RemarkDialog() DlgEditor::DlgEditor ( + Window& rWindow_, DialogWindowLayout& rLayout_, com::sun::star::uno::Reference<com::sun::star::frame::XModel> const& xModel, - DialogWindowLayout& rLayout_ + com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> xDialogModel ) :pHScroll(NULL) ,pVScroll(NULL) - ,pDlgEdModel(NULL) - ,pDlgEdPage(NULL) - ,pDlgEdView(NULL) - ,pDlgEdForm(NULL) - ,m_xUnoControlDialogModel(NULL) + ,pDlgEdModel(new DlgEdModel()) + ,pDlgEdPage(new DlgEdPage(*pDlgEdModel)) + ,pDlgEdView(new DlgEdView(*pDlgEdModel, rWindow_, *this)) ,m_ClipboardDataFlavors(1) ,m_ClipboardDataFlavorsResource(2) - ,pObjFac(NULL) - ,pWindow(NULL) - ,pFunc(NULL) + ,pObjFac(new DlgEdFactory(xModel)) + ,rWindow(rWindow_) + ,pFunc(new DlgEdFuncSelect(*this)) ,rLayout(rLayout_) ,eMode( DlgEditor::SELECT ) ,eActObj( OBJ_DLG_PUSHBUTTON ) @@ -202,7 +201,6 @@ DlgEditor::DlgEditor ( ,mnPaintGuard(0) ,m_xDocument( xModel ) { - pDlgEdModel = new DlgEdModel(); pDlgEdModel->GetItemPool().FreezeIdRanges(); pDlgEdModel->SetScaleUnit( MAP_100TH_MM ); @@ -210,12 +208,7 @@ DlgEditor::DlgEditor ( rAdmin.NewLayer( rAdmin.GetControlLayerName() ); rAdmin.NewLayer( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HiddenLayer")) ); - pDlgEdPage = new DlgEdPage( *pDlgEdModel ); - pDlgEdModel->InsertPage( pDlgEdPage ); - - pObjFac = new DlgEdFactory(xModel); - - pFunc = new DlgEdFuncSelect( this ); + pDlgEdModel->InsertPage(pDlgEdPage); // set clipboard data flavors m_ClipboardDataFlavors[0].MimeType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.xml.dialog" )); @@ -232,38 +225,10 @@ DlgEditor::DlgEditor ( aMarkTimer.SetTimeout( 100 ); aMarkTimer.SetTimeoutHdl( LINK( this, DlgEditor, MarkTimeout ) ); -} - - -DlgEditor::~DlgEditor() -{ - aPaintTimer.Stop(); - aMarkTimer.Stop(); - - ::comphelper::disposeComponent( m_xControlContainer ); - - delete pObjFac; - delete pFunc; - delete pDlgEdView; - delete pDlgEdModel; -} + rWindow.SetMapMode( MapMode( MAP_100TH_MM ) ); + pDlgEdPage->SetSize( rWindow.PixelToLogic( Size(DLGED_PAGE_WIDTH_MIN, DLGED_PAGE_HEIGHT_MIN) ) ); -Reference< awt::XControlContainer > DlgEditor::GetWindowControlContainer() -{ - if ( !m_xControlContainer.is() && pWindow ) - m_xControlContainer = VCLUnoHelper::CreateControlContainer( pWindow ); - return m_xControlContainer; -} - - -void DlgEditor::SetWindow( Window* pWindow_ ) -{ - DlgEditor::pWindow = pWindow_; - pWindow_->SetMapMode( MapMode( MAP_100TH_MM ) ); - pDlgEdPage->SetSize( pWindow_->PixelToLogic( Size( DLGED_PAGE_WIDTH_MIN, DLGED_PAGE_HEIGHT_MIN ) ) ); - - pDlgEdView = new DlgEdView( pDlgEdModel, pWindow_, this ); pDlgEdView->ShowSdrPage(pDlgEdView->GetModel()->GetPage(0)); pDlgEdView->SetLayerVisible( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HiddenLayer")), false ); pDlgEdView->SetMoveSnapOnlyTopLeft(true); @@ -278,6 +243,25 @@ void DlgEditor::SetWindow( Window* pWindow_ ) pDlgEdView->SetDesignMode(true); ::comphelper::disposeComponent( m_xControlContainer ); + + SetDialog(xDialogModel); +} + + +DlgEditor::~DlgEditor() +{ + aPaintTimer.Stop(); + aMarkTimer.Stop(); + + ::comphelper::disposeComponent( m_xControlContainer ); +} + + +Reference< awt::XControlContainer > DlgEditor::GetWindowControlContainer() +{ + if (!m_xControlContainer.is()) + m_xControlContainer = VCLUnoHelper::CreateControlContainer(&rWindow); + return m_xControlContainer; } @@ -297,7 +281,7 @@ void DlgEditor::InitScrollBars() if ( !pHScroll || !pVScroll ) return; - Size aOutSize = pWindow->GetOutputSize(); + Size aOutSize = rWindow.GetOutputSize(); Size aPgSize = pDlgEdPage->GetSize(); pHScroll->SetRange( Range( 0, aPgSize.Width() )); @@ -320,12 +304,12 @@ void DlgEditor::DoScroll( ScrollBar* ) if( !pHScroll || !pVScroll ) return; - MapMode aMap = pWindow->GetMapMode(); + MapMode aMap = rWindow.GetMapMode(); Point aOrg = aMap.GetOrigin(); Size aScrollPos( pHScroll->GetThumbPos(), pVScroll->GetThumbPos() ); - aScrollPos = pWindow->LogicToPixel( aScrollPos ); - aScrollPos = pWindow->PixelToLogic( aScrollPos ); + aScrollPos = rWindow.LogicToPixel( aScrollPos ); + aScrollPos = rWindow.PixelToLogic( aScrollPos ); long nX = aScrollPos.Width() + aOrg.X(); long nY = aScrollPos.Height() + aOrg.Y(); @@ -333,20 +317,20 @@ void DlgEditor::DoScroll( ScrollBar* ) if( !nX && !nY ) return; - pWindow->Update(); + rWindow.Update(); // #i31562# // When scrolling, someone was rescuing the Wallpaper and forced the window scroll to // be done without background refresh. I do not know why, but that causes the repaint // problems. Taking that out. - // Wallpaper aOldBackground = pWindow->GetBackground(); - // pWindow->SetBackground(); + // Wallpaper aOldBackground = rWindow.GetBackground(); + // rWindow.SetBackground(); // #i74769# children should be scrolled - pWindow->Scroll( -nX, -nY, SCROLL_CHILDREN); + rWindow.Scroll( -nX, -nY, SCROLL_CHILDREN); aMap.SetOrigin( Point( -aScrollPos.Width(), -aScrollPos.Height() ) ); - pWindow->SetMapMode( aMap ); - pWindow->Update(); + rWindow.SetMapMode( aMap ); + rWindow.Update(); DlgEdHint aHint( DlgEdHint::WINDOWSCROLLED ); Broadcast( aHint ); @@ -355,7 +339,7 @@ void DlgEditor::DoScroll( ScrollBar* ) void DlgEditor::UpdateScrollBars() { - MapMode aMap = pWindow->GetMapMode(); + MapMode aMap = rWindow.GetMapMode(); Point aOrg = aMap.GetOrigin(); if ( pHScroll ) @@ -372,10 +356,9 @@ void DlgEditor::SetDialog( uno::Reference< container::XNameContainer > xUnoContr m_xUnoControlDialogModel = xUnoControlDialogModel; // create dialog form - pDlgEdForm = new DlgEdForm(); + pDlgEdForm = new DlgEdForm(*this); uno::Reference< awt::XControlModel > xDlgMod( m_xUnoControlDialogModel , uno::UNO_QUERY ); pDlgEdForm->SetUnoControlModel(xDlgMod); - pDlgEdForm->SetDlgEditor( this ); ((DlgEdPage*)pDlgEdModel->GetPage(0))->SetDlgEdForm( pDlgEdForm ); pDlgEdModel->GetPage(0)->InsertObject( pDlgEdForm ); AdjustPageSize(); @@ -468,8 +451,7 @@ Reference< util::XNumberFormatsSupplier > const & DlgEditor::GetNumberFormatsSup void DlgEditor::MouseButtonDown( const MouseEvent& rMEvt ) { - if( pWindow ) - pWindow->GrabFocus(); + rWindow.GrabFocus(); pFunc->MouseButtonDown( rMEvt ); } @@ -504,15 +486,12 @@ void DlgEditor::Paint( const Rectangle& rRect ) IMPL_LINK_NOARG(DlgEditor, PaintTimeout) { - if( !pDlgEdView ) - return 0; - mnPaintGuard++; Size aMacSize; if( bFirstDraw && - pWindow->IsVisible() && - (pWindow->GetOutputSize() != aMacSize) ) + rWindow.IsVisible() && + (rWindow.GetOutputSize() != aMacSize) ) { bFirstDraw = false; @@ -528,7 +507,7 @@ IMPL_LINK_NOARG(DlgEditor, PaintTimeout) if ( nWidth == 0 && nHeight == 0 ) { - Size aSize = pWindow->PixelToLogic( Size( 400, 300 ) ); + Size aSize = rWindow.PixelToLogic( Size( 400, 300 ) ); // align with grid Size aGridSize_(long(pDlgEdView->GetSnapGridWidthX()), long(pDlgEdView->GetSnapGridWidthY())); @@ -536,7 +515,7 @@ IMPL_LINK_NOARG(DlgEditor, PaintTimeout) aSize.Height() -= aSize.Height() % aGridSize_.Height(); Point aPos; - Size aOutSize = pWindow->GetOutputSize(); + Size aOutSize = rWindow.GetOutputSize(); aPos.X() = (aOutSize.Width()>>1) - (aSize.Width()>>1); aPos.Y() = (aOutSize.Height()>>1) - (aSize.Height()>>1); @@ -545,7 +524,7 @@ IMPL_LINK_NOARG(DlgEditor, PaintTimeout) aPos.Y() -= aPos.Y() % aGridSize_.Height(); // don't put in the corner - Point aMinPos = pWindow->PixelToLogic( Point( 30, 20 ) ); + Point aMinPos = rWindow.PixelToLogic( Point( 30, 20 ) ); if( (aPos.X() < aMinPos.X()) || (aPos.Y() < aMinPos.Y()) ) { aPos = aMinPos; @@ -557,12 +536,11 @@ IMPL_LINK_NOARG(DlgEditor, PaintTimeout) pDlgEdForm->SetSnapRect( Rectangle( aPos, aSize ) ); pDlgEdForm->EndListening(false); pDlgEdForm->SetPropsFromRect(); - pDlgEdForm->GetDlgEditor()->SetDialogModelChanged(true); + pDlgEdForm->GetDlgEditor().SetDialogModelChanged(true); pDlgEdForm->StartListening(); // set position and size of controls - sal_uLong nObjCount; - if ( pDlgEdPage && ( ( nObjCount = pDlgEdPage->GetObjCount() ) > 0 ) ) + if (sal_uLong nObjCount = pDlgEdPage->GetObjCount()) { for ( sal_uLong i = 0 ; i < nObjCount ; i++ ) if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pDlgEdPage->GetObj(i))) @@ -584,7 +562,7 @@ IMPL_LINK_NOARG(DlgEditor, PaintTimeout) // mark repaint start if(pPgView) { - pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(pWindow, aPaintRectRegion); + pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(&rWindow, aPaintRectRegion); OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)"); } @@ -605,7 +583,6 @@ IMPL_LINK_NOARG(DlgEditor, PaintTimeout) mnPaintGuard--; - DBG_ASSERT(pWindow,"Window not set"); return 0; } @@ -621,12 +598,10 @@ void DlgEditor::SetMode (Mode eNewMode ) { if ( eNewMode != eMode ) { - delete pFunc; - if ( eNewMode == INSERT ) - pFunc = new DlgEdFuncInsert( this ); + pFunc.reset(new DlgEdFuncInsert(*this)); else - pFunc = new DlgEdFuncSelect( this ); + pFunc.reset(new DlgEdFuncSelect(*this)); if ( eNewMode == READONLY ) pDlgEdModel->SetReadOnly( true ); @@ -645,8 +620,7 @@ void DlgEditor::SetInsertObj( sal_uInt16 eObj ) { eActObj = eObj; - if( pDlgEdView ) - pDlgEdView->SetCurrentObj( eActObj, DlgInventor ); + pDlgEdView->SetCurrentObj( eActObj, DlgInventor ); } @@ -664,7 +638,7 @@ void DlgEditor::CreateDefaultObject() if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj)) { // set position and size - Size aSize = pWindow->PixelToLogic( Size( 96, 24 ) ); + Size aSize = rWindow.PixelToLogic( Size( 96, 24 ) ); Point aPoint = (pDlgEdForm->GetSnapRect()).Center(); aPoint.X() -= aSize.Width() / 2; aPoint.Y() -= aSize.Height() / 2; @@ -779,7 +753,7 @@ void DlgEditor::Copy() xStream->closeInput(); // set clipboard content - Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard(); + Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow().GetClipboard(); if ( xClipboard.is() ) { // With resource? @@ -872,7 +846,7 @@ void DlgEditor::Paste() pDlgEdView->UnmarkAll(); // get clipboard - Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard(); + Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow().GetClipboard(); if ( xClipboard.is() ) { // get clipboard content @@ -1110,7 +1084,7 @@ void DlgEditor::Delete() bool DlgEditor::IsPasteAllowed() { // get clipboard - Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard(); + Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow().GetClipboard(); if ( xClipboard.is() ) { // get clipboard content @@ -1148,20 +1122,21 @@ void DlgEditor::ClearModifyFlag() } -#define LMARGPRN 1700 -#define RMARGPRN 900 -#define TMARGPRN 2000 -#define BMARGPRN 1000 -#define BORDERPRN 300 - +namespace Print +{ + int const nLeftMargin = 1700; + int const nRightMargin = 900; + int const nTopMargin = 2000; + int const nBottomMargin = 1000; + int const nBorder = 300; +} void lcl_PrintHeader( Printer* pPrinter, const ::rtl::OUString& rTitle ) // not working yet { + pPrinter->Push(); - short nLeftMargin = LMARGPRN; - Size aSz = pPrinter->GetOutputSize(); - short nBorder = BORDERPRN; + Size const aSz = pPrinter->GetOutputSize(); pPrinter->SetLineColor( COL_BLACK ); pPrinter->SetFillColor(); @@ -1171,24 +1146,24 @@ void lcl_PrintHeader( Printer* pPrinter, const ::rtl::OUString& rTitle ) // not aFont.SetAlign( ALIGN_BOTTOM ); pPrinter->SetFont( aFont ); - long nFontHeight = pPrinter->GetTextHeight(); + long const nFontHeight = pPrinter->GetTextHeight(); // 1st border => line, 2+3 border = free space - long nYTop = TMARGPRN-3*nBorder-nFontHeight; + long const nYTop = Print::nTopMargin - 3*Print::nBorder - nFontHeight; - long nXLeft = nLeftMargin-nBorder; - long nXRight = aSz.Width()-RMARGPRN+nBorder; + long const nXLeft = Print::nLeftMargin - Print::nBorder; + long const nXRight = aSz.Width() - Print::nRightMargin + Print::nBorder; - pPrinter->DrawRect( Rectangle( - Point( nXLeft, nYTop ), - Size( nXRight-nXLeft, aSz.Height() - nYTop - BMARGPRN + nBorder ) ) ); + pPrinter->DrawRect(Rectangle( + Point(nXLeft, nYTop), + Size(nXRight - nXLeft, aSz.Height() - nYTop - Print::nBottomMargin + Print::nBorder) + )); - long nY = TMARGPRN-2*nBorder; - Point aPos( nLeftMargin, nY ); + long nY = Print::nTopMargin - 2*Print::nBorder; + Point aPos(Print::nLeftMargin, nY); pPrinter->DrawText( aPos, rTitle ); - nY = TMARGPRN-nBorder; - + nY = Print::nTopMargin - Print::nBorder; pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) ); pPrinter->Pop(); @@ -1209,7 +1184,6 @@ void DlgEditor::printPage( sal_Int32 nPage, Printer* pPrinter, const ::rtl::OUSt void DlgEditor::Print( Printer* pPrinter, const ::rtl::OUString& rTitle ) // not working yet { - if( pDlgEdView ) { MapMode aOldMap( pPrinter->GetMapMode()); Font aOldFont( pPrinter->GetFont() ); @@ -1222,8 +1196,8 @@ void DlgEditor::Print( Printer* pPrinter, const ::rtl::OUString& rTitle ) // pPrinter->SetFont( aFont ); Size aPaperSz = pPrinter->GetOutputSize(); - aPaperSz.Width() -= (LMARGPRN+RMARGPRN); - aPaperSz.Height() -= (TMARGPRN+BMARGPRN); + aPaperSz.Width() -= (Print::nLeftMargin + Print::nRightMargin); + aPaperSz.Height() -= (Print::nTopMargin + Print::nBottomMargin); lcl_PrintHeader( pPrinter, rTitle ); @@ -1252,8 +1226,8 @@ void DlgEditor::Print( Printer* pPrinter, const ::rtl::OUString& rTitle ) // (aPaperSz.Width() / 2) - (aOutputSz.Width() / 2), (aPaperSz.Height()/ 2) - (aOutputSz.Height() / 2)); - aPosOffs.X() += LMARGPRN; - aPosOffs.Y() += TMARGPRN; + aPosOffs.X() += Print::nLeftMargin; + aPosOffs.Y() += Print::nTopMargin; pPrinter->DrawBitmap( aPosOffs, aOutputSz, aDlg ); @@ -1279,17 +1253,13 @@ bool DlgEditor::AdjustPageSize() if ( pDlgEdForm && pDlgEdForm->TransformFormToSdrCoordinates( nFormXIn, nFormYIn, nFormWidthIn, nFormHeightIn, nFormX, nFormY, nFormWidth, nFormHeight ) ) { Size aPageSizeDelta( 400, 300 ); - DBG_ASSERT( pWindow, "DlgEditor::AdjustPageSize: no window!" ); - if ( pWindow ) - aPageSizeDelta = pWindow->PixelToLogic( aPageSizeDelta, MapMode( MAP_100TH_MM ) ); + aPageSizeDelta = rWindow.PixelToLogic( aPageSizeDelta, MapMode( MAP_100TH_MM ) ); sal_Int32 nNewPageWidth = nFormX + nFormWidth + aPageSizeDelta.Width(); sal_Int32 nNewPageHeight = nFormY + nFormHeight + aPageSizeDelta.Height(); Size aPageSizeMin( DLGED_PAGE_WIDTH_MIN, DLGED_PAGE_HEIGHT_MIN ); - DBG_ASSERT( pWindow, "DlgEditor::AdjustPageSize: no window!" ); - if ( pWindow ) - aPageSizeMin = pWindow->PixelToLogic( aPageSizeMin, MapMode( MAP_100TH_MM ) ); + aPageSizeMin = rWindow.PixelToLogic( aPageSizeMin, MapMode( MAP_100TH_MM ) ); sal_Int32 nPageWidthMin = aPageSizeMin.Width(); sal_Int32 nPageHeightMin = aPageSizeMin.Height(); @@ -1306,9 +1276,7 @@ bool DlgEditor::AdjustPageSize() { Size aNewPageSize( nNewPageWidth, nNewPageHeight ); pDlgEdPage->SetSize( aNewPageSize ); - DBG_ASSERT( pDlgEdView, "DlgEditor::AdjustPageSize: no view!" ); - if ( pDlgEdView ) - pDlgEdView->SetWorkArea( Rectangle( Point( 0, 0 ), aNewPageSize ) ); + pDlgEdView->SetWorkArea( Rectangle( Point( 0, 0 ), aNewPageSize ) ); bAdjustedPageSize = true; } } diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx index 5d49ee5ac01d..a53d68a1f46a 100644 --- a/basctl/source/dlged/dlgedfunc.cxx +++ b/basctl/source/dlged/dlgedfunc.cxx @@ -32,9 +32,9 @@ namespace basctl IMPL_LINK_INLINE_START( DlgEdFunc, ScrollTimeout, Timer *, pTimer ) { (void)pTimer; - Window* pWindow = pParent->GetWindow(); - Point aPos = pWindow->ScreenToOutputPixel( pWindow->GetPointerPosPixel() ); - aPos = pWindow->PixelToLogic( aPos ); + Window& rWindow = rParent.GetWindow(); + Point aPos = rWindow.ScreenToOutputPixel( rWindow.GetPointerPosPixel() ); + aPos = rWindow.PixelToLogic( aPos ); ForceScroll( aPos ); return 0; } @@ -46,14 +46,14 @@ void DlgEdFunc::ForceScroll( const Point& rPos ) { aScrollTimer.Stop(); - Window* pWindow = pParent->GetWindow(); + Window& rWindow = rParent.GetWindow(); static Point aDefPoint; - Rectangle aOutRect( aDefPoint, pWindow->GetOutputSizePixel() ); - aOutRect = pWindow->PixelToLogic( aOutRect ); + Rectangle aOutRect( aDefPoint, rWindow.GetOutputSizePixel() ); + aOutRect = rWindow.PixelToLogic( aOutRect ); - ScrollBar* pHScroll = pParent->GetHScroll(); - ScrollBar* pVScroll = pParent->GetVScroll(); + ScrollBar* pHScroll = rParent.GetHScroll(); + ScrollBar* pVScroll = rParent.GetVScroll(); long nDeltaX = pHScroll->GetLineSize(); long nDeltaY = pVScroll->GetLineSize(); @@ -77,9 +77,9 @@ void DlgEdFunc::ForceScroll( const Point& rPos ) pVScroll->SetThumbPos( pVScroll->GetThumbPos() + nDeltaY ); if( nDeltaX ) - pParent->DoScroll( pHScroll ); + rParent.DoScroll( pHScroll ); if( nDeltaY ) - pParent->DoScroll( pVScroll ); + rParent.DoScroll( pVScroll ); } aScrollTimer.Start(); @@ -87,9 +87,9 @@ void DlgEdFunc::ForceScroll( const Point& rPos ) //---------------------------------------------------------------------------- -DlgEdFunc::DlgEdFunc( DlgEditor* pParent_ ) +DlgEdFunc::DlgEdFunc (DlgEditor& rParent_) : + rParent(rParent_) { - DlgEdFunc::pParent = pParent_; aScrollTimer.SetTimeoutHdl( LINK( this, DlgEdFunc, ScrollTimeout ) ); aScrollTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL ); } @@ -128,8 +128,8 @@ bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) { bool bReturn = false; - SdrView* pView = pParent->GetView(); - Window* pWindow = pParent->GetWindow(); + SdrView& rView = rParent.GetView(); + Window& rWindow = rParent.GetWindow(); KeyCode aCode = rKEvt.GetKeyCode(); sal_uInt16 nCode = aCode.GetCode(); @@ -138,19 +138,19 @@ bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) { case KEY_ESCAPE: { - if ( pView->IsAction() ) + if ( rView.IsAction() ) { - pView->BrkAction(); + rView.BrkAction(); bReturn = true; } - else if ( pView->AreObjectsMarked() ) + else if ( rView.AreObjectsMarked() ) { - const SdrHdlList& rHdlList = pView->GetHdlList(); + const SdrHdlList& rHdlList = rView.GetHdlList(); SdrHdl* pHdl = rHdlList.GetFocusHdl(); if ( pHdl ) - ((SdrHdlList&)rHdlList).ResetFocusHdl(); + const_cast<SdrHdlList&>(rHdlList).ResetFocusHdl(); else - pView->UnmarkAll(); + rView.UnmarkAll(); bReturn = true; } @@ -161,31 +161,30 @@ bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) if ( !aCode.IsMod1() && !aCode.IsMod2() ) { // mark next object - if ( !pView->MarkNextObj( !aCode.IsShift() ) ) + if ( !rView.MarkNextObj( !aCode.IsShift() ) ) { // if no next object, mark first/last - pView->UnmarkAllObj(); - pView->MarkNextObj( !aCode.IsShift() ); + rView.UnmarkAllObj(); + rView.MarkNextObj( !aCode.IsShift() ); } - if ( pView->AreObjectsMarked() ) - pView->MakeVisible( pView->GetAllMarkedRect(), *pWindow ); + if ( rView.AreObjectsMarked() ) + rView.MakeVisible( rView.GetAllMarkedRect(), rWindow ); bReturn = true; } else if ( aCode.IsMod1() ) { // selected handle - const SdrHdlList& rHdlList = pView->GetHdlList(); - ((SdrHdlList&)rHdlList).TravelFocusHdl( !aCode.IsShift() ); + const SdrHdlList& rHdlList = rView.GetHdlList(); + const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl( !aCode.IsShift() ); // guarantee visibility of focused handle - SdrHdl* pHdl = rHdlList.GetFocusHdl(); - if ( pHdl ) + if (SdrHdl* pHdl = rHdlList.GetFocusHdl()) { Point aHdlPosition( pHdl->GetPos() ); Rectangle aVisRect( aHdlPosition - Point( 100, 100 ), Size( 200, 200 ) ); - pView->MakeVisible( aVisRect, *pWindow ); + rView.MakeVisible( aVisRect, rWindow ); } bReturn = true; @@ -225,12 +224,12 @@ bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) nY = 0; } - if ( pView->AreObjectsMarked() && !aCode.IsMod1() ) + if ( rView.AreObjectsMarked() && !aCode.IsMod1() ) { if ( aCode.IsMod2() ) { // move in 1 pixel distance - Size aPixelSize = pWindow ? pWindow->PixelToLogic( Size( 1, 1 ) ) : Size( 100, 100 ); + Size aPixelSize = rWindow.PixelToLogic(Size(1, 1)); nX *= aPixelSize.Width(); nY *= aPixelSize.Height(); } @@ -241,20 +240,20 @@ bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) nY *= 100; } - const SdrHdlList& rHdlList = pView->GetHdlList(); + const SdrHdlList& rHdlList = rView.GetHdlList(); SdrHdl* pHdl = rHdlList.GetFocusHdl(); if ( pHdl == 0 ) { // no handle selected - if ( pView->IsMoveAllowed() ) + if ( rView.IsMoveAllowed() ) { // restrict movement to work area - const Rectangle& rWorkArea = pView->GetWorkArea(); + const Rectangle& rWorkArea = rView.GetWorkArea(); if ( !rWorkArea.IsEmpty() ) { - Rectangle aMarkRect( pView->GetMarkedObjRect() ); + Rectangle aMarkRect( rView.GetMarkedObjRect() ); aMarkRect.Move( nX, nY ); if ( !rWorkArea.IsInside( aMarkRect ) ) @@ -275,8 +274,8 @@ bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) if ( nX != 0 || nY != 0 ) { - pView->MoveAllMarked( Size( nX, nY ) ); - pView->MakeVisible( pView->GetAllMarkedRect(), *pWindow ); + rView.MoveAllMarked( Size( nX, nY ) ); + rView.MakeVisible( rView.GetAllMarkedRect(), rWindow ); } } } @@ -287,42 +286,42 @@ bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) { Point aStartPoint( pHdl->GetPos() ); Point aEndPoint( pHdl->GetPos() + Point( nX, nY ) ); - const SdrDragStat& rDragStat = pView->GetDragStat(); + const SdrDragStat& rDragStat = rView.GetDragStat(); // start dragging - pView->BegDragObj( aStartPoint, 0, pHdl, 0 ); + rView.BegDragObj( aStartPoint, 0, pHdl, 0 ); - if ( pView->IsDragObj() ) + if ( rView.IsDragObj() ) { bool const bWasNoSnap = rDragStat.IsNoSnap(); - bool const bWasSnapEnabled = pView->IsSnapEnabled(); + bool const bWasSnapEnabled = rView.IsSnapEnabled(); // switch snapping off if ( !bWasNoSnap ) - ((SdrDragStat&)rDragStat).SetNoSnap(true); + const_cast<SdrDragStat&>(rDragStat).SetNoSnap(true); if ( bWasSnapEnabled ) - pView->SetSnapEnabled(false); + rView.SetSnapEnabled(false); - pView->MovAction( aEndPoint ); - pView->EndDragObj(); + rView.MovAction( aEndPoint ); + rView.EndDragObj(); // restore snap if ( !bWasNoSnap ) - ((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap ); + const_cast<SdrDragStat&>(rDragStat).SetNoSnap( bWasNoSnap ); if ( bWasSnapEnabled ) - pView->SetSnapEnabled( bWasSnapEnabled ); + rView.SetSnapEnabled( bWasSnapEnabled ); } // make moved handle visible Rectangle aVisRect( aEndPoint - Point( 100, 100 ), Size( 200, 200 ) ); - pView->MakeVisible( aVisRect, *pWindow ); + rView.MakeVisible( aVisRect, rWindow ); } } } else { // scroll page - ScrollBar* pScrollBar = ( nX != 0 ) ? pParent->GetHScroll() : pParent->GetVScroll(); + ScrollBar* pScrollBar = ( nX != 0 ) ? rParent.GetHScroll() : rParent.GetVScroll(); if ( pScrollBar ) { long nRangeMin = pScrollBar->GetRangeMin(); @@ -333,7 +332,7 @@ bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) if ( nThumbPos > nRangeMax ) nThumbPos = nRangeMax; pScrollBar->SetThumbPos( nThumbPos ); - pParent->DoScroll( pScrollBar ); + rParent.DoScroll( pScrollBar ); } } @@ -347,24 +346,24 @@ bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) } if ( bReturn ) - pWindow->ReleaseMouse(); + rWindow.ReleaseMouse(); return bReturn; } //---------------------------------------------------------------------------- -DlgEdFuncInsert::DlgEdFuncInsert( DlgEditor* pParent_ ) : - DlgEdFunc( pParent_ ) +DlgEdFuncInsert::DlgEdFuncInsert (DlgEditor& rParent_) : + DlgEdFunc(rParent_) { - pParent_->GetView()->SetCreateMode(true); + rParent.GetView().SetCreateMode(true); } //---------------------------------------------------------------------------- DlgEdFuncInsert::~DlgEdFuncInsert() { - pParent->GetView()->SetEditMode( true ); + rParent.GetView().SetEditMode( true ); } //---------------------------------------------------------------------------- @@ -374,35 +373,35 @@ bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt ) if( !rMEvt.IsLeft() ) return true; - SdrView* pView = pParent->GetView(); - Window* pWindow= pParent->GetWindow(); - pView->SetActualWin( pWindow ); + SdrView& rView = rParent.GetView(); + Window& rWindow = rParent.GetWindow(); + rView.SetActualWin(&rWindow); - Point aPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() ); - sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); - sal_uInt16 nDrgLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); + Point aPos = rWindow.PixelToLogic( rMEvt.GetPosPixel() ); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width()); + sal_uInt16 nDrgLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width()); - pWindow->CaptureMouse(); + rWindow.CaptureMouse(); if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 ) { - SdrHdl* pHdl = pView->PickHandle(aPos); + SdrHdl* pHdl = rView.PickHandle(aPos); // if selected object was hit, drag object - if ( pHdl!=NULL || pView->IsMarkedHit(aPos, nHitLog) ) - pView->BegDragObj(aPos, (OutputDevice*) NULL, pHdl, nDrgLog); - else if ( pView->AreObjectsMarked() ) - pView->UnmarkAll(); + if ( pHdl!=NULL || rView.IsMarkedHit(aPos, nHitLog) ) + rView.BegDragObj(aPos, (OutputDevice*) NULL, pHdl, nDrgLog); + else if ( rView.AreObjectsMarked() ) + rView.UnmarkAll(); // if no action, create object - if ( !pView->IsAction() ) - pView->BegCreateObj(aPos); + if ( !rView.IsAction() ) + rView.BegCreateObj(aPos); } else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 ) { // if object was hit, show property browser - if ( pView->IsMarkedHit(aPos, nHitLog) && pParent->GetMode() != DlgEditor::READONLY ) - pParent->ShowProperties(); + if ( rView.IsMarkedHit(aPos, nHitLog) && rParent.GetMode() != DlgEditor::READONLY ) + rParent.ShowProperties(); } return true; @@ -414,30 +413,30 @@ bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent& rMEvt ) { DlgEdFunc::MouseButtonUp( rMEvt ); - SdrView* pView = pParent->GetView(); - Window* pWindow= pParent->GetWindow(); - pView->SetActualWin( pWindow ); + SdrView& rView = rParent.GetView(); + Window& rWindow = rParent.GetWindow(); + rView.SetActualWin(&rWindow); - pWindow->ReleaseMouse(); + rWindow.ReleaseMouse(); // object creation active? - if ( pView->IsCreateObj() ) + if ( rView.IsCreateObj() ) { - pView->EndCreateObj(SDRCREATE_FORCEEND); + rView.EndCreateObj(SDRCREATE_FORCEEND); - if ( !pView->AreObjectsMarked() ) + if ( !rView.AreObjectsMarked() ) { - sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); - Point aPos( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); - pView->MarkObj(aPos, nHitLog); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width()); + Point aPos( rWindow.PixelToLogic( rMEvt.GetPosPixel() ) ); + rView.MarkObj(aPos, nHitLog); } - return pView->AreObjectsMarked(); + return rView.AreObjectsMarked(); } else { - if ( pView->IsDragObj() ) - pView->EndDragObj( rMEvt.IsMod1() ); + if ( rView.IsDragObj() ) + rView.EndDragObj( rMEvt.IsMod1() ); return true; } } @@ -446,28 +445,28 @@ bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent& rMEvt ) bool DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt ) { - SdrView* pView = pParent->GetView(); - Window* pWindow= pParent->GetWindow(); - pView->SetActualWin( pWindow ); + SdrView& rView = rParent.GetView(); + Window& rWindow = rParent.GetWindow(); + rView.SetActualWin(&rWindow); - Point aPos( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); - sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); + Point aPos = rWindow.PixelToLogic(rMEvt.GetPosPixel()); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width()); - if ( pView->IsAction() ) + if (rView.IsAction()) { ForceScroll(aPos); - pView->MovAction(aPos); + rView.MovAction(aPos); } - pWindow->SetPointer( pView->GetPreferedPointer( aPos, pWindow, nHitLog ) ); + rWindow.SetPointer( rView.GetPreferedPointer( aPos, &rWindow, nHitLog ) ); return true; } //---------------------------------------------------------------------------- -DlgEdFuncSelect::DlgEdFuncSelect( DlgEditor* pParent_ ) : - DlgEdFunc( pParent_ ), +DlgEdFuncSelect::DlgEdFuncSelect (DlgEditor& rParent_) : + DlgEdFunc(rParent_), bMarkAction(false) { } @@ -483,51 +482,51 @@ DlgEdFuncSelect::~DlgEdFuncSelect() bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt ) { // get view from parent - SdrView* pView = pParent->GetView(); - Window* pWindow = pParent->GetWindow(); - pView->SetActualWin( pWindow ); + SdrView& rView = rParent.GetView(); + Window& rWindow = rParent.GetWindow(); + rView.SetActualWin(&rWindow); - sal_uInt16 nDrgLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); - sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); - Point aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() ); + sal_uInt16 nDrgLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width()); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width()); + Point aMDPos = rWindow.PixelToLogic(rMEvt.GetPosPixel()); if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 ) { - SdrHdl* pHdl = pView->PickHandle(aMDPos); + SdrHdl* pHdl = rView.PickHandle(aMDPos); SdrObject* pObj; SdrPageView* pPV; // hit selected object? - if ( pHdl!=NULL || pView->IsMarkedHit(aMDPos, nHitLog) ) + if ( pHdl!=NULL || rView.IsMarkedHit(aMDPos, nHitLog) ) { - pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog); + rView.BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog); } else { // if not multi selection, unmark all if ( !rMEvt.IsShift() ) - pView->UnmarkAll(); + rView.UnmarkAll(); else { - if( pView->PickObj( aMDPos, nHitLog, pObj, pPV ) ) + if( rView.PickObj( aMDPos, nHitLog, pObj, pPV ) ) { //if (dynamic_cast<DlgEdForm*>(pObj)) - // pView->UnmarkAll(); + // rView.UnmarkAll(); //else - // pParent->UnmarkDialog(); + // rParent.UnmarkDialog(); } } - if ( pView->MarkObj(aMDPos, nHitLog) ) + if ( rView.MarkObj(aMDPos, nHitLog) ) { // drag object - pHdl=pView->PickHandle(aMDPos); - pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog); + pHdl = rView.PickHandle(aMDPos); + rView.BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog); } else { // select object - pView->BegMarkObj(aMDPos); + rView.BegMarkObj(aMDPos); bMarkAction = true; } } @@ -535,8 +534,8 @@ bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt ) else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 ) { // if object was hit, show property browser - if ( pView->IsMarkedHit(aMDPos, nHitLog) && pParent->GetMode() != DlgEditor::READONLY ) - pParent->ShowProperties(); + if ( rView.IsMarkedHit(aMDPos, nHitLog) && rParent.GetMode() != DlgEditor::READONLY ) + rParent.ShowProperties(); } return true; @@ -549,32 +548,31 @@ bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent& rMEvt ) DlgEdFunc::MouseButtonUp( rMEvt ); // get view from parent - SdrView* pView = pParent->GetView(); - Window* pWindow= pParent->GetWindow(); - pView->SetActualWin( pWindow ); + SdrView& rView = rParent.GetView(); + Window& rWindow = rParent.GetWindow(); + rView.SetActualWin(&rWindow); - Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); - sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); + Point aPnt = rWindow.PixelToLogic(rMEvt.GetPosPixel()); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width()); if ( rMEvt.IsLeft() ) { - if ( pView->IsDragObj() ) + if (rView.IsDragObj()) { // object was dragged - pView->EndDragObj( rMEvt.IsMod1() ); - pView->ForceMarkedToAnotherPage(); + rView.EndDragObj( rMEvt.IsMod1() ); + rView.ForceMarkedToAnotherPage(); } - else - if (pView->IsAction() ) + else if (rView.IsAction()) { - pView->EndAction(); + rView.EndAction(); } } bMarkAction = false; - pWindow->SetPointer( pView->GetPreferedPointer( aPnt, pWindow, nHitLog ) ); - pWindow->ReleaseMouse(); + rWindow.SetPointer( rView.GetPreferedPointer( aPnt, &rWindow, nHitLog ) ); + rWindow.ReleaseMouse(); return true; } @@ -583,23 +581,23 @@ bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent& rMEvt ) bool DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt ) { - SdrView* pView = pParent->GetView(); - Window* pWindow= pParent->GetWindow(); - pView->SetActualWin( pWindow ); + SdrView& rView = rParent.GetView(); + Window& rWindow = rParent.GetWindow(); + rView.SetActualWin(&rWindow); - Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); - sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); + Point aPnt = rWindow.PixelToLogic(rMEvt.GetPosPixel()); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width()); - if ( pView->IsAction() ) + if ( rView.IsAction() ) { - Point aPix(rMEvt.GetPosPixel()); - Point aPnt_(pWindow->PixelToLogic(aPix)); + Point aPix = rMEvt.GetPosPixel(); + Point aPnt_ = rWindow.PixelToLogic(aPix); ForceScroll(aPnt_); - pView->MovAction(aPnt_); + rView.MovAction(aPnt_); } - pWindow->SetPointer( pView->GetPreferedPointer( aPnt, pWindow, nHitLog ) ); + rWindow.SetPointer( rView.GetPreferedPointer( aPnt, &rWindow, nHitLog ) ); return true; } diff --git a/basctl/source/dlged/dlgedlist.cxx b/basctl/source/dlged/dlgedlist.cxx index d719ec5a27d3..fbcc89c26309 100644 --- a/basctl/source/dlged/dlgedlist.cxx +++ b/basctl/source/dlged/dlgedlist.cxx @@ -29,8 +29,8 @@ namespace basctl //---------------------------------------------------------------------------- -DlgEdPropListenerImpl::DlgEdPropListenerImpl(DlgEdObj* pObj) - :pDlgEdObj(pObj) +DlgEdPropListenerImpl::DlgEdPropListenerImpl (DlgEdObj& rObj) : + rDlgEdObj(rObj) { } @@ -52,7 +52,7 @@ void SAL_CALL DlgEdPropListenerImpl::disposing( const ::com::sun::star::lang::Ev void SAL_CALL DlgEdPropListenerImpl::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException) { - pDlgEdObj->_propertyChange( evt ); + rDlgEdObj._propertyChange( evt ); } //---------------------------------------------------------------------------- @@ -63,8 +63,8 @@ void SAL_CALL DlgEdPropListenerImpl::propertyChange( const ::com::sun::star::be //---------------------------------------------------------------------------- -DlgEdEvtContListenerImpl::DlgEdEvtContListenerImpl(DlgEdObj* pObj) - :pDlgEdObj(pObj) +DlgEdEvtContListenerImpl::DlgEdEvtContListenerImpl (DlgEdObj& rObj) : + rDlgEdObj(rObj) { } @@ -86,21 +86,21 @@ void SAL_CALL DlgEdEvtContListenerImpl::disposing( const ::com::sun::star::lang void SAL_CALL DlgEdEvtContListenerImpl::elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException) { - pDlgEdObj->_elementInserted( Event ); + rDlgEdObj._elementInserted( Event ); } //---------------------------------------------------------------------------- void SAL_CALL DlgEdEvtContListenerImpl::elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException) { - pDlgEdObj->_elementReplaced( Event ); + rDlgEdObj._elementReplaced( Event ); } //---------------------------------------------------------------------------- void SAL_CALL DlgEdEvtContListenerImpl::elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException) { - pDlgEdObj->_elementRemoved( Event ); + rDlgEdObj._elementRemoved( Event ); } //---------------------------------------------------------------------------- diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx index 0227bd6b3d7a..fa93236ecf56 100644 --- a/basctl/source/dlged/dlgedobj.cxx +++ b/basctl/source/dlged/dlgedobj.cxx @@ -54,7 +54,7 @@ using ::rtl::OUString; TYPEINIT1(DlgEdObj, SdrUnoObj); DBG_NAME(DlgEdObj); -DlgEditor* DlgEdObj::GetDialogEditor () +DlgEditor& DlgEdObj::GetDialogEditor () { if (DlgEdForm* pFormThis = dynamic_cast<DlgEdForm*>(this)) return pFormThis->GetDlgEditor(); @@ -125,16 +125,12 @@ namespace uno::Reference< awt::XControl > DlgEdObj::GetControl() const { - const DlgEdForm* pForm = GetDlgEdForm(); - const DlgEditor* pEditor = pForm ? pForm->GetDlgEditor() : NULL; - SdrView* pView = pEditor ? pEditor->GetView() : NULL; - Window* pWindow = pEditor ? pEditor->GetWindow() : NULL; - OSL_ENSURE( ( pView && pWindow ) || !pForm, "DlgEdObj::GetControl: no view or no window!" ); - uno::Reference< awt::XControl > xControl; - if ( pView && pWindow ) - xControl = GetUnoControl( *pView, *pWindow ); - + if (DlgEdForm const* pForm = GetDlgEdForm()) + { + DlgEditor const& rEditor = pForm->GetDlgEditor(); + xControl = GetUnoControl(rEditor.GetView(), rEditor.GetWindow()); + } return xControl; } @@ -419,19 +415,12 @@ void DlgEdObj::SetPropsFromRect() void DlgEdObj::PositionAndSizeChange( const beans::PropertyChangeEvent& evt ) { - DlgEdPage* pPage_ = 0; - if ( pDlgEdForm ) - { - DlgEditor* pEditor = pDlgEdForm->GetDlgEditor(); - if ( pEditor ) - pPage_ = pEditor->GetPage(); - } - DBG_ASSERT( pPage_, "DlgEdObj::PositionAndSizeChange: no page!" ); - if ( pPage_ ) + DBG_ASSERT( pDlgEdForm, "DlgEdObj::PositionAndSizeChange: no form!" ); + DlgEdPage& rPage = pDlgEdForm->GetDlgEditor().GetPage(); { sal_Int32 nPageXIn = 0; sal_Int32 nPageYIn = 0; - Size aPageSize = pPage_->GetSize(); + Size aPageSize = rPage.GetSize(); sal_Int32 nPageWidthIn = aPageSize.Width(); sal_Int32 nPageHeightIn = aPageSize.Height(); sal_Int32 nPageX, nPageY, nPageWidth, nPageHeight; @@ -524,7 +513,7 @@ void SAL_CALL DlgEdObj::NameChange( const ::com::sun::star::beans::PropertyChan xCont->insertByName( aNewName , aAny ); LocalizationMgr::renameControlResourceIDsForEditorObject( - GetDialogEditor(), aAny, aNewName + &GetDialogEditor(), aAny, aNewName ); } } @@ -1007,7 +996,7 @@ void DlgEdObj::NbcMove( const Size& rSize ) StartListening(); // dialog model changed - GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(true); + GetDlgEdForm()->GetDlgEditor().SetDialogModelChanged(true); } //---------------------------------------------------------------------------- @@ -1026,7 +1015,7 @@ void DlgEdObj::NbcResize(const Point& rRef, const Fraction& xFract, const Fracti StartListening(); // dialog model changed - GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(true); + GetDlgEdForm()->GetDlgEditor().SetDialogModelChanged(true); } //---------------------------------------------------------------------------- @@ -1077,7 +1066,7 @@ void DlgEdObj::SetDefaults() // set number formats supplier for formatted field if ( supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) ) { - Reference< util::XNumberFormatsSupplier > xSupplier = GetDlgEdForm()->GetDlgEditor()->GetNumberFormatsSupplier(); + Reference< util::XNumberFormatsSupplier > xSupplier = GetDlgEdForm()->GetDlgEditor().GetNumberFormatsSupplier(); if ( xSupplier.is() ) { Any aSupplier; @@ -1113,7 +1102,7 @@ void DlgEdObj::SetDefaults() xCont->insertByName( aOUniqueName , aAny ); LocalizationMgr::setControlResourceIDsForNewEditorObject( - GetDialogEditor(), aAny, aOUniqueName + &GetDialogEditor(), aAny, aOUniqueName ); // #110559# @@ -1122,7 +1111,7 @@ void DlgEdObj::SetDefaults() } // dialog model changed - pDlgEdForm->GetDlgEditor()->SetDialogModelChanged(true); + pDlgEdForm->GetDlgEditor().SetDialogModelChanged(true); } } @@ -1141,7 +1130,7 @@ void DlgEdObj::StartListening() if (!m_xPropertyChangeListener.is() && xControlModel.is()) { // create listener - m_xPropertyChangeListener = static_cast< ::com::sun::star::beans::XPropertyChangeListener*>( new DlgEdPropListenerImpl( (DlgEdObj*)this ) ); + m_xPropertyChangeListener = new DlgEdPropListenerImpl(*this); // register listener to properties xControlModel->addPropertyChangeListener( ::rtl::OUString() , m_xPropertyChangeListener ); @@ -1152,7 +1141,7 @@ void DlgEdObj::StartListening() if( !m_xContainerListener.is() && xEventsSupplier.is() ) { // create listener - m_xContainerListener = static_cast< ::com::sun::star::container::XContainerListener*>( new DlgEdEvtContListenerImpl( (DlgEdObj*)this ) ); + m_xContainerListener = new DlgEdEvtContListenerImpl(*this); // register listener to script event container Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents(); @@ -1207,17 +1196,17 @@ void SAL_CALL DlgEdObj::_propertyChange( const ::com::sun::star::beans::Propert { if (isListening()) { - DlgEdForm* pRealDlgEdForm = dynamic_cast< DlgEdForm* >(this); - if( pRealDlgEdForm == 0 ) + DlgEdForm* pRealDlgEdForm = dynamic_cast<DlgEdForm*>(this); + if (!pRealDlgEdForm) pRealDlgEdForm = GetDlgEdForm(); - - DlgEditor* pDlgEditor = pRealDlgEdForm ? pRealDlgEdForm->GetDlgEditor() : 0; - - if( !pDlgEditor || pDlgEditor->isInPaint() ) + if (!pRealDlgEdForm) + return; + DlgEditor& rDlgEditor = pRealDlgEdForm->GetDlgEditor(); + if (rDlgEditor.isInPaint()) return; // dialog model changed - pDlgEditor->SetDialogModelChanged(true); + rDlgEditor.SetDialogModelChanged(true); // update position and size if ( evt.PropertyName == DLGED_PROP_POSITIONX || evt.PropertyName == DLGED_PROP_POSITIONY || @@ -1227,7 +1216,7 @@ void SAL_CALL DlgEdObj::_propertyChange( const ::com::sun::star::beans::Propert PositionAndSizeChange( evt ); if ( evt.PropertyName == DLGED_PROP_DECORATION ) - GetDialogEditor()->ResetDialog(); + GetDialogEditor().ResetDialog(); } // change name of control in dialog model else if ( evt.PropertyName == DLGED_PROP_NAME ) @@ -1256,7 +1245,7 @@ void SAL_CALL DlgEdObj::_elementInserted(const ::com::sun::star::container::Cont if (isListening()) { // dialog model changed - GetDialogEditor()->SetDialogModelChanged(true); + GetDialogEditor().SetDialogModelChanged(true); } } @@ -1267,7 +1256,7 @@ void SAL_CALL DlgEdObj::_elementReplaced(const ::com::sun::star::container::Cont if (isListening()) { // dialog model changed - GetDialogEditor()->SetDialogModelChanged(true); + GetDialogEditor().SetDialogModelChanged(true); } } @@ -1278,7 +1267,7 @@ void SAL_CALL DlgEdObj::_elementRemoved(const ::com::sun::star::container::Conta if (isListening()) { // dialog model changed - GetDialogEditor()->SetDialogModelChanged(true); + GetDialogEditor().SetDialogModelChanged(true); } } @@ -1293,7 +1282,7 @@ void DlgEdObj::SetLayer(SdrLayerID nLayer) SdrUnoObj::SetLayer( nLayer ); DlgEdHint aHint( DlgEdHint::LAYERCHANGED, this ); - GetDlgEdForm()->GetDlgEditor()->Broadcast( aHint ); + GetDlgEdForm()->GetDlgEditor().Broadcast( aHint ); } } @@ -1304,8 +1293,8 @@ DBG_NAME(DlgEdForm); //---------------------------------------------------------------------------- -DlgEdForm::DlgEdForm() - :DlgEdObj() +DlgEdForm::DlgEdForm (DlgEditor& rDlgEditor_) : + rDlgEditor(rDlgEditor_) { DBG_CTOR(DlgEdForm, NULL); } @@ -1319,21 +1308,6 @@ DlgEdForm::~DlgEdForm() //---------------------------------------------------------------------------- -void DlgEdForm::SetDlgEditor( DlgEditor* pEditor ) -{ - pDlgEditor = pEditor; - ImplInvalidateDeviceInfo(); -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::ImplInvalidateDeviceInfo() -{ - mpDeviceInfo.reset(); -} - -//---------------------------------------------------------------------------- - void DlgEdForm::SetRectFromProps() { // get form position and size from properties @@ -1408,127 +1382,118 @@ void DlgEdForm::RemoveChild( DlgEdObj* pDlgEdObj ) void DlgEdForm::PositionAndSizeChange( const beans::PropertyChangeEvent& evt ) { - DlgEditor* pEditor = GetDlgEditor(); - DBG_ASSERT( pEditor, "DlgEdForm::PositionAndSizeChange: no dialog editor!" ); - if ( pEditor ) + DlgEditor& rEditor = GetDlgEditor(); + DlgEdPage& rPage = rEditor.GetPage(); + + sal_Int32 nPageXIn = 0; + sal_Int32 nPageYIn = 0; + Size aPageSize = rPage.GetSize(); + sal_Int32 nPageWidthIn = aPageSize.Width(); + sal_Int32 nPageHeightIn = aPageSize.Height(); + sal_Int32 nPageX, nPageY, nPageWidth, nPageHeight; + if ( TransformSdrToFormCoordinates( nPageXIn, nPageYIn, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) ) + { + Reference< beans::XPropertySet > xPSetForm( GetUnoControlModel(), UNO_QUERY ); + if ( xPSetForm.is() ) + { + sal_Int32 nValue = 0; + evt.NewValue >>= nValue; + sal_Int32 nNewValue = nValue; + + if ( evt.PropertyName == DLGED_PROP_POSITIONX ) + { + if ( nNewValue < nPageX ) + nNewValue = nPageX; + } + else if ( evt.PropertyName == DLGED_PROP_POSITIONY ) + { + if ( nNewValue < nPageY ) + nNewValue = nPageY; + } + else if ( evt.PropertyName == DLGED_PROP_WIDTH ) + { + if ( nNewValue < 1 ) + nNewValue = 1; + } + else if ( evt.PropertyName == DLGED_PROP_HEIGHT ) + { + if ( nNewValue < 1 ) + nNewValue = 1; + } + + if ( nNewValue != nValue ) + { + Any aNewValue; + aNewValue <<= nNewValue; + EndListening( false ); + xPSetForm->setPropertyValue( evt.PropertyName, aNewValue ); + StartListening(); + } + } + } + + bool bAdjustedPageSize = rEditor.AdjustPageSize(); + SetRectFromProps(); + std::vector<DlgEdObj*> const& aChildList = ((DlgEdForm*)this)->GetChildren(); + std::vector<DlgEdObj*>::const_iterator aIter; + + if ( bAdjustedPageSize ) { - DlgEdPage* pPage_ = pEditor->GetPage(); - DBG_ASSERT( pPage_, "DlgEdForm::PositionAndSizeChange: no page!" ); - if ( pPage_ ) + rEditor.InitScrollBars(); + aPageSize = rPage.GetSize(); + nPageWidthIn = aPageSize.Width(); + nPageHeightIn = aPageSize.Height(); + if ( TransformSdrToControlCoordinates( nPageXIn, nPageYIn, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) ) { - sal_Int32 nPageXIn = 0; - sal_Int32 nPageYIn = 0; - Size aPageSize = pPage_->GetSize(); - sal_Int32 nPageWidthIn = aPageSize.Width(); - sal_Int32 nPageHeightIn = aPageSize.Height(); - sal_Int32 nPageX, nPageY, nPageWidth, nPageHeight; - if ( TransformSdrToFormCoordinates( nPageXIn, nPageYIn, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) ) + for ( aIter = aChildList.begin(); aIter != aChildList.end(); ++aIter ) { - Reference< beans::XPropertySet > xPSetForm( GetUnoControlModel(), UNO_QUERY ); - if ( xPSetForm.is() ) + Reference< beans::XPropertySet > xPSet( (*aIter)->GetUnoControlModel(), UNO_QUERY ); + if ( xPSet.is() ) { - sal_Int32 nValue = 0; - evt.NewValue >>= nValue; - sal_Int32 nNewValue = nValue; - - if ( evt.PropertyName == DLGED_PROP_POSITIONX ) - { - if ( nNewValue < nPageX ) - nNewValue = nPageX; - } - else if ( evt.PropertyName == DLGED_PROP_POSITIONY ) + sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0; + xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nX; + xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nY; + xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidth; + xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeight; + + sal_Int32 nNewX = nX; + if ( nX + nWidth > nPageX + nPageWidth ) { - if ( nNewValue < nPageY ) - nNewValue = nPageY; + nNewX = nPageX + nPageWidth - nWidth; + if ( nNewX < nPageX ) + nNewX = nPageX; } - else if ( evt.PropertyName == DLGED_PROP_WIDTH ) + if ( nNewX != nX ) { - if ( nNewValue < 1 ) - nNewValue = 1; + Any aValue; + aValue <<= nNewX; + EndListening( false ); + xPSet->setPropertyValue( DLGED_PROP_POSITIONX, aValue ); + StartListening(); } - else if ( evt.PropertyName == DLGED_PROP_HEIGHT ) + + sal_Int32 nNewY = nY; + if ( nY + nHeight > nPageY + nPageHeight ) { - if ( nNewValue < 1 ) - nNewValue = 1; + nNewY = nPageY + nPageHeight - nHeight; + if ( nNewY < nPageY ) + nNewY = nPageY; } - - if ( nNewValue != nValue ) + if ( nNewY != nY ) { - Any aNewValue; - aNewValue <<= nNewValue; + Any aValue; + aValue <<= nNewY; EndListening( false ); - xPSetForm->setPropertyValue( evt.PropertyName, aNewValue ); + xPSet->setPropertyValue( DLGED_PROP_POSITIONY, aValue ); StartListening(); } } } - - bool bAdjustedPageSize = pEditor->AdjustPageSize(); - SetRectFromProps(); - ::std::vector< DlgEdObj* >::iterator aIter; - ::std::vector< DlgEdObj* > aChildList = ((DlgEdForm*)this)->GetChildren(); - - if ( bAdjustedPageSize ) - { - pEditor->InitScrollBars(); - aPageSize = pPage_->GetSize(); - nPageWidthIn = aPageSize.Width(); - nPageHeightIn = aPageSize.Height(); - if ( TransformSdrToControlCoordinates( nPageXIn, nPageYIn, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) ) - { - for ( aIter = aChildList.begin(); aIter != aChildList.end(); ++aIter ) - { - Reference< beans::XPropertySet > xPSet( (*aIter)->GetUnoControlModel(), UNO_QUERY ); - if ( xPSet.is() ) - { - sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0; - xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nX; - xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nY; - xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidth; - xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeight; - - sal_Int32 nNewX = nX; - if ( nX + nWidth > nPageX + nPageWidth ) - { - nNewX = nPageX + nPageWidth - nWidth; - if ( nNewX < nPageX ) - nNewX = nPageX; - } - if ( nNewX != nX ) - { - Any aValue; - aValue <<= nNewX; - EndListening( false ); - xPSet->setPropertyValue( DLGED_PROP_POSITIONX, aValue ); - StartListening(); - } - - sal_Int32 nNewY = nY; - if ( nY + nHeight > nPageY + nPageHeight ) - { - nNewY = nPageY + nPageHeight - nHeight; - if ( nNewY < nPageY ) - nNewY = nPageY; - } - if ( nNewY != nY ) - { - Any aValue; - aValue <<= nNewY; - EndListening( false ); - xPSet->setPropertyValue( DLGED_PROP_POSITIONY, aValue ); - StartListening(); - } - } - } - } - } - - for ( aIter = aChildList.begin(); aIter != aChildList.end(); ++aIter ) - { - (*aIter)->SetRectFromProps(); - } } } + + for ( aIter = aChildList.begin(); aIter != aChildList.end(); ++aIter ) + (*aIter)->SetRectFromProps(); } //---------------------------------------------------------------------------- @@ -1732,7 +1697,7 @@ void DlgEdForm::NbcMove( const Size& rSize ) } // dialog model changed - GetDlgEditor()->SetDialogModelChanged(true); + GetDlgEditor().SetDialogModelChanged(true); } //---------------------------------------------------------------------------- @@ -1756,7 +1721,7 @@ void DlgEdForm::NbcResize(const Point& rRef, const Fraction& xFract, const Fract } // dialog model changed - GetDlgEditor()->SetDialogModelChanged(true); + GetDlgEditor().SetDialogModelChanged(true); } //---------------------------------------------------------------------------- @@ -1772,7 +1737,7 @@ bool DlgEdForm::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SetPropsFromRect(); // dialog model changed - GetDlgEditor()->SetDialogModelChanged(true); + GetDlgEditor().SetDialogModelChanged(true); // start listening StartListening(); @@ -1786,15 +1751,8 @@ awt::DeviceInfo DlgEdForm::getDeviceInfo() const { awt::DeviceInfo aDeviceInfo; - DlgEditor* pEditor = GetDlgEditor(); - DBG_ASSERT( pEditor, "DlgEdForm::getDeviceInfo: no editor associated with the form object!" ); - if ( !pEditor ) - return aDeviceInfo; - - Window* pWindow = pEditor->GetWindow(); - DBG_ASSERT( pWindow, "DlgEdForm::getDeviceInfo: no window associated with the editor!" ); - if ( !pWindow ) - return aDeviceInfo; + DlgEditor& rEditor = GetDlgEditor(); + Window& rWindow = rEditor.GetWindow(); // obtain an XControl ::utl::SharedUNOComponent< awt::XControl > xDialogControl; // ensures auto-disposal, if needed @@ -1807,10 +1765,11 @@ awt::DeviceInfo DlgEdForm::getDeviceInfo() const if ( !!mpDeviceInfo ) return *mpDeviceInfo; - Reference< awt::XControlContainer > xEditorControlContainer( pEditor->GetWindowControlContainer() ); + Reference< awt::XControlContainer > xEditorControlContainer( rEditor.GetWindowControlContainer() ); xDialogControl.reset( - GetTemporaryControlForWindow( *pWindow, xEditorControlContainer ), - ::utl::SharedUNOComponent< awt::XControl >::TakeOwnership ); + GetTemporaryControlForWindow(rWindow, xEditorControlContainer), + utl::SharedUNOComponent< awt::XControl >::TakeOwnership + ); } Reference< awt::XDevice > xDialogDevice; diff --git a/basctl/source/dlged/dlgedpage.cxx b/basctl/source/dlged/dlgedpage.cxx index 95e39156a6f1..b2bfb6e8eabd 100644 --- a/basctl/source/dlged/dlgedpage.cxx +++ b/basctl/source/dlged/dlgedpage.cxx @@ -36,14 +36,6 @@ DlgEdPage::DlgEdPage( DlgEdModel& rModel, bool bMasterPage ) //---------------------------------------------------------------------------- -DlgEdPage::DlgEdPage( const DlgEdPage& rPage ) - :SdrPage( rPage ) -{ - pDlgEdForm = rPage.pDlgEdForm; -} - -//---------------------------------------------------------------------------- - DlgEdPage::~DlgEdPage() { Clear(); @@ -64,11 +56,7 @@ SdrObject* DlgEdPage::SetObjectOrdNum(sal_uLong nOldObjNum, sal_uLong nNewObjNum DlgEdHint aHint( DlgEdHint::OBJORDERCHANGED ); if ( pDlgEdForm ) - { - DlgEditor* pDlgEditor = pDlgEdForm->GetDlgEditor(); - if ( pDlgEditor ) - pDlgEditor->Broadcast( aHint ); - } + pDlgEdForm->GetDlgEditor().Broadcast( aHint ); return pObj; } diff --git a/basctl/source/dlged/dlgedview.cxx b/basctl/source/dlged/dlgedview.cxx index f3ff732ffec5..ee06f8ffda4b 100644 --- a/basctl/source/dlged/dlgedview.cxx +++ b/basctl/source/dlged/dlgedview.cxx @@ -35,9 +35,9 @@ TYPEINIT1( DlgEdView, SdrView ); //---------------------------------------------------------------------------- -DlgEdView::DlgEdView( SdrModel* pModel, OutputDevice* pOut, DlgEditor* pEditor ) - :SdrView( pModel, pOut ) - ,pDlgEditor( pEditor ) +DlgEdView::DlgEdView (SdrModel& rModel, OutputDevice& rOut, DlgEditor& rEditor) : + SdrView(&rModel, &rOut), + rDlgEditor(rEditor) { // #114898# SetBufferedOutputAllowed(true); @@ -57,11 +57,8 @@ void DlgEdView::MarkListHasChanged() SdrView::MarkListHasChanged(); DlgEdHint aHint( DlgEdHint::SELECTIONCHANGED ); - if ( pDlgEditor ) - { - pDlgEditor->Broadcast( aHint ); - pDlgEditor->UpdatePropertyBrowserDelayed(); - } + rDlgEditor.Broadcast( aHint ); + rDlgEditor.UpdatePropertyBrowserDelayed(); } //---------------------------------------------------------------------------- @@ -86,8 +83,8 @@ void DlgEdView::MakeVisible( const Rectangle& rRect, Window& rWin ) sal_Int32 nVisTop = aVisRect.Top(); sal_Int32 nVisBottom = aVisRect.Bottom(); - sal_Int32 nDeltaX = pDlgEditor->GetHScroll()->GetLineSize(); - sal_Int32 nDeltaY = pDlgEditor->GetVScroll()->GetLineSize(); + sal_Int32 nDeltaX = rDlgEditor.GetHScroll()->GetLineSize(); + sal_Int32 nDeltaY = rDlgEditor.GetVScroll()->GetLineSize(); while ( rRect.Right() > nVisRight + nScrollX ) nScrollX += nDeltaX; @@ -102,7 +99,7 @@ void DlgEdView::MakeVisible( const Rectangle& rRect, Window& rWin ) nScrollY -= nDeltaY; // don't scroll beyond the page size - Size aPageSize = pDlgEditor->GetPage()->GetSize(); + Size aPageSize = rDlgEditor.GetPage().GetSize(); sal_Int32 nPageWidth = aPageSize.Width(); sal_Int32 nPageHeight = aPageSize.Height(); @@ -127,12 +124,10 @@ void DlgEdView::MakeVisible( const Rectangle& rRect, Window& rWin ) rWin.Invalidate(); // update scroll bars - if ( pDlgEditor ) - pDlgEditor->UpdateScrollBars(); + rDlgEditor.UpdateScrollBars(); DlgEdHint aHint( DlgEdHint::WINDOWSCROLLED ); - if ( pDlgEditor ) - pDlgEditor->Broadcast( aHint ); + rDlgEditor.Broadcast( aHint ); } } diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx index 04a0a7948f06..11529c240369 100644 --- a/basctl/source/dlged/propbrw.cxx +++ b/basctl/source/dlged/propbrw.cxx @@ -38,6 +38,8 @@ #include <tools/diagnose_ex.h> #include <vcl/stdtext.hxx> +#include <boost/scoped_ptr.hpp> + namespace basctl { @@ -255,10 +257,10 @@ Sequence< Reference< XInterface > > { SdrObject* pCurrent = _rMarkList.GetMark(i)->GetMarkedSdrObj(); - SdrObjListIter* pGroupIterator = NULL; + boost::scoped_ptr<SdrObjListIter> pGroupIterator; if (pCurrent->IsGroupObject()) { - pGroupIterator = new SdrObjListIter(*pCurrent->GetSubList()); + pGroupIterator.reset(new SdrObjListIter(*pCurrent->GetSubList())); pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL; } @@ -274,7 +276,6 @@ Sequence< Reference< XInterface > > // next element pCurrent = pGroupIterator && pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL; } - delete pGroupIterator; } sal_Int32 nCount = aInterfaces.size(); diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx index 6e3216230651..5e389c54ed3c 100644 --- a/basctl/source/inc/baside3.hxx +++ b/basctl/source/inc/baside3.hxx @@ -32,6 +32,8 @@ #include <com/sun/star/script/XLibraryContainer.hpp> +#include <boost/scoped_ptr.hpp> + class Printer; class StarBASIC; class SfxItemSet; @@ -52,8 +54,8 @@ class DialogWindow: public BaseWindow { private: DialogWindowLayout& rLayout; - DlgEditor* pEditor; - SfxUndoManager* pUndoMgr; + boost::scoped_ptr<DlgEditor> pEditor; // never nullptr + boost::scoped_ptr<SfxUndoManager> pUndoMgr; // never nullptr Link aOldNotifyUndoActionHdl; ::rtl::OUString aCurPath; @@ -82,11 +84,11 @@ public: virtual void ExecuteCommand( SfxRequest& rReq ); virtual void GetState( SfxItemSet& ); - DlgEditor* GetEditor() const { return pEditor; } + DlgEditor& GetEditor() const { return *pEditor; } ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetDialog() const; - DlgEdModel* GetModel() const; - DlgEdPage* GetPage() const; - DlgEdView* GetView() const; + DlgEdModel& GetModel() const; + DlgEdPage& GetPage() const; + DlgEdView& GetView() const; bool RenameDialog( const ::rtl::OUString& rNewName ); void DisableBrowser(); void UpdateBrowser(); diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index c021a0583155..743b8b3f6fe0 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -67,7 +67,7 @@ public: private: friend class JavaDebuggingListenerImpl; friend class LocalizationMgr; - friend bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName ); + friend bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName ); // defined in baside3.cxx WindowTable aWindowTable; sal_uInt16 nCurKey; @@ -79,7 +79,7 @@ private: ScrollBar aHScrollBar; ScrollBar aVScrollBar; ScrollBarBox aScrollBarBox; - TabBar* pTabBar; // basctl::TabBar + boost::scoped_ptr<TabBar> pTabBar; // basctl::TabBar bool bTabBarSplitted; bool bCreatingWindow; // layout windows @@ -117,7 +117,7 @@ private: static unsigned nShellCount; -protected: +private: virtual void AdjustPosSizePixel( const Point &rPos, const Size &rSize ); virtual void OuterResizePixel( const Point &rPos, const Size &rSize ); virtual Size GetOptimalSizePixel() const; diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx index a564f97b820b..4a677737a605 100644 --- a/basctl/source/inc/dlged.hxx +++ b/basctl/source/inc/dlged.hxx @@ -30,6 +30,8 @@ #include <tools/gen.hxx> #include <vcl/timer.hxx> +#include <boost/scoped_ptr.hpp> + class ScrollBar; class Printer; class KeyEvent; @@ -107,18 +109,18 @@ private: private: ScrollBar* pHScroll; ScrollBar* pVScroll; - DlgEdModel* pDlgEdModel; - DlgEdPage* pDlgEdPage; - DlgEdView* pDlgEdView; - DlgEdForm* pDlgEdForm; + boost::scoped_ptr<DlgEdModel> pDlgEdModel; // never nullptr + DlgEdPage* pDlgEdPage; // never nullptr + boost::scoped_ptr<DlgEdView> pDlgEdView; // never nullptr + DlgEdForm* pDlgEdForm; // never nullptr ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xUnoControlDialogModel; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xControlContainer; ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_ClipboardDataFlavors; ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_ClipboardDataFlavorsResource; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xSupplier; - DlgEdFactory* pObjFac; - Window* pWindow; - DlgEdFunc* pFunc; + boost::scoped_ptr<DlgEdFactory> pObjFac; // never nullptr + Window& rWindow; // DialogWindow + boost::scoped_ptr<DlgEdFunc> pFunc; DialogWindowLayout& rLayout; Mode eMode; sal_uInt16 eActObj; @@ -134,13 +136,15 @@ private: long mnPaintGuard; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument; - DlgEditor(); // not implemented public: - DlgEditor (com::sun::star::uno::Reference<com::sun::star::frame::XModel> const& xModel, DialogWindowLayout&); + DlgEditor ( + Window&, DialogWindowLayout&, + com::sun::star::uno::Reference<com::sun::star::frame::XModel> const& xModel, + com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> xDialogModel + ); ~DlgEditor(); - void SetWindow( Window* pWindow ); - Window* GetWindow() const { return pWindow; } + Window& GetWindow() const { return rWindow; } /** returns the control container associated with our window @see GetWindow @@ -149,9 +153,6 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > GetWindowControlContainer(); - void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; } - DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; } - void SetScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll ); void InitScrollBars(); ScrollBar* GetHScroll() const { return pHScroll; } @@ -159,17 +160,16 @@ public: void DoScroll( ScrollBar* pActScroll ); void UpdateScrollBars(); - void SetDialog( ::com::sun::star::uno::Reference< - ::com::sun::star::container::XNameContainer > xUnoControlDialogModel ); - void ResetDialog( void ); + void SetDialog (com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> xUnoControlDialogModel); + void ResetDialog (); ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetDialog() const {return m_xUnoControlDialogModel;} ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > const & GetNumberFormatsSupplier(); - DlgEdModel* GetModel() const { return pDlgEdModel; } - DlgEdView* GetView() const { return pDlgEdView; } - DlgEdPage* GetPage() const { return pDlgEdPage; } + DlgEdModel& GetModel() const { return *pDlgEdModel; } + DlgEdView& GetView() const { return *pDlgEdView; } + DlgEdPage& GetPage() const { return *pDlgEdPage; } void ShowDialog(); diff --git a/basctl/source/inc/dlgeddef.hxx b/basctl/source/inc/dlgeddef.hxx index 9e190cba744a..16fb33e4dca7 100644 --- a/basctl/source/inc/dlgeddef.hxx +++ b/basctl/source/inc/dlgeddef.hxx @@ -30,57 +30,59 @@ const sal_uInt32 DlgInventor = sal_uInt32('D')*0x00000001+ sal_uInt32('G')*0x00010000+ sal_uInt32('1')*0x01000000; +enum +{ + OBJ_DLG_CONTROL = 1, + OBJ_DLG_DIALOG = 2, + OBJ_DLG_PUSHBUTTON = 3, + OBJ_DLG_RADIOBUTTON = 4, + OBJ_DLG_CHECKBOX = 5, + OBJ_DLG_LISTBOX = 6, + OBJ_DLG_COMBOBOX = 7, + OBJ_DLG_GROUPBOX = 8, + OBJ_DLG_EDIT = 9, + OBJ_DLG_FIXEDTEXT = 10, + OBJ_DLG_IMAGECONTROL = 11, + OBJ_DLG_PROGRESSBAR = 12, + OBJ_DLG_HSCROLLBAR = 13, + OBJ_DLG_VSCROLLBAR = 14, + OBJ_DLG_HFIXEDLINE = 15, + OBJ_DLG_VFIXEDLINE = 16, + OBJ_DLG_DATEFIELD = 17, + OBJ_DLG_TIMEFIELD = 18, + OBJ_DLG_NUMERICFIELD = 19, + OBJ_DLG_CURRENCYFIELD = 20, + OBJ_DLG_FORMATTEDFIELD = 21, + OBJ_DLG_PATTERNFIELD = 22, + OBJ_DLG_FILECONTROL = 23, + OBJ_DLG_TREECONTROL = 24, + OBJ_DLG_SPINBUTTON = 25, -#define OBJ_DLG_CONTROL ((sal_uInt16) 1) -#define OBJ_DLG_DIALOG ((sal_uInt16) 2) -#define OBJ_DLG_PUSHBUTTON ((sal_uInt16) 3) -#define OBJ_DLG_RADIOBUTTON ((sal_uInt16) 4) -#define OBJ_DLG_CHECKBOX ((sal_uInt16) 5) -#define OBJ_DLG_LISTBOX ((sal_uInt16) 6) -#define OBJ_DLG_COMBOBOX ((sal_uInt16) 7) -#define OBJ_DLG_GROUPBOX ((sal_uInt16) 8) -#define OBJ_DLG_EDIT ((sal_uInt16) 9) -#define OBJ_DLG_FIXEDTEXT ((sal_uInt16)10) -#define OBJ_DLG_IMAGECONTROL ((sal_uInt16)11) -#define OBJ_DLG_PROGRESSBAR ((sal_uInt16)12) -#define OBJ_DLG_HSCROLLBAR ((sal_uInt16)13) -#define OBJ_DLG_VSCROLLBAR ((sal_uInt16)14) -#define OBJ_DLG_HFIXEDLINE ((sal_uInt16)15) -#define OBJ_DLG_VFIXEDLINE ((sal_uInt16)16) -#define OBJ_DLG_DATEFIELD ((sal_uInt16)17) -#define OBJ_DLG_TIMEFIELD ((sal_uInt16)18) -#define OBJ_DLG_NUMERICFIELD ((sal_uInt16)19) -#define OBJ_DLG_CURRENCYFIELD ((sal_uInt16)20) -#define OBJ_DLG_FORMATTEDFIELD ((sal_uInt16)21) -#define OBJ_DLG_PATTERNFIELD ((sal_uInt16)22) -#define OBJ_DLG_FILECONTROL ((sal_uInt16)23) -#define OBJ_DLG_TREECONTROL ((sal_uInt16)24) -#define OBJ_DLG_SPINBUTTON ((sal_uInt16)25) - -#define OBJ_DLG_FORMRADIO ((sal_uInt16)26) -#define OBJ_DLG_FORMCHECK ((sal_uInt16)27) -#define OBJ_DLG_FORMLIST ((sal_uInt16)28) -#define OBJ_DLG_FORMCOMBO ((sal_uInt16)29) -#define OBJ_DLG_FORMSPIN ((sal_uInt16)30) -#define OBJ_DLG_FORMVSCROLL ((sal_uInt16)31) -#define OBJ_DLG_FORMHSCROLL ((sal_uInt16)32) + OBJ_DLG_FORMRADIO = 26, + OBJ_DLG_FORMCHECK = 27, + OBJ_DLG_FORMLIST = 28, + OBJ_DLG_FORMCOMBO = 29, + OBJ_DLG_FORMSPIN = 30, + OBJ_DLG_FORMVSCROLL = 31, + OBJ_DLG_FORMHSCROLL = 32, +}; // control properties -#define DLGED_PROP_BACKGROUNDCOLOR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BackgroundColor" ) ) -#define DLGED_PROP_DROPDOWN ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Dropdown" ) ) -#define DLGED_PROP_FORMATSSUPPLIER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormatsSupplier" ) ) -#define DLGED_PROP_HEIGHT ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) -#define DLGED_PROP_LABEL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" ) ) -#define DLGED_PROP_NAME ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) -#define DLGED_PROP_ORIENTATION ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Orientation" ) ) -#define DLGED_PROP_POSITIONX ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) -#define DLGED_PROP_POSITIONY ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) -#define DLGED_PROP_STEP ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Step" ) ) -#define DLGED_PROP_TABINDEX ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) ) -#define DLGED_PROP_TEXTCOLOR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ) -#define DLGED_PROP_TEXTLINECOLOR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextLineColor" ) ) -#define DLGED_PROP_WIDTH ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) -#define DLGED_PROP_DECORATION ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Decoration" ) ) +#define DLGED_PROP_BACKGROUNDCOLOR rtl::OUString("BackgroundColor") +#define DLGED_PROP_DROPDOWN rtl::OUString("Dropdown") +#define DLGED_PROP_FORMATSSUPPLIER rtl::OUString("FormatsSupplier") +#define DLGED_PROP_HEIGHT rtl::OUString("Height") +#define DLGED_PROP_LABEL rtl::OUString("Label") +#define DLGED_PROP_NAME rtl::OUString("Name") +#define DLGED_PROP_ORIENTATION rtl::OUString("Orientation") +#define DLGED_PROP_POSITIONX rtl::OUString("PositionX") +#define DLGED_PROP_POSITIONY rtl::OUString("PositionY") +#define DLGED_PROP_STEP rtl::OUString("Step") +#define DLGED_PROP_TABINDEX rtl::OUString("TabIndex") +#define DLGED_PROP_TEXTCOLOR rtl::OUString("TextColor") +#define DLGED_PROP_TEXTLINECOLOR rtl::OUString("TextLineColor") +#define DLGED_PROP_WIDTH rtl::OUString("Width") +#define DLGED_PROP_DECORATION rtl::OUString("Decoration") } // namespace basctl diff --git a/basctl/source/inc/dlgedfunc.hxx b/basctl/source/inc/dlgedfunc.hxx index 821b57d218fc..a911d1482b72 100644 --- a/basctl/source/inc/dlgedfunc.hxx +++ b/basctl/source/inc/dlgedfunc.hxx @@ -32,14 +32,14 @@ class DlgEditor; class DlgEdFunc /* : public LinkHdl */ { protected: - DlgEditor* pParent; - Timer aScrollTimer; + DlgEditor& rParent; + Timer aScrollTimer; DECL_LINK( ScrollTimeout, Timer * ); void ForceScroll( const Point& rPos ); public: - DlgEdFunc( DlgEditor* pParent ); + explicit DlgEdFunc (DlgEditor& rParent); virtual ~DlgEdFunc(); virtual bool MouseButtonDown( const MouseEvent& rMEvt ); @@ -55,8 +55,8 @@ public: class DlgEdFuncInsert : public DlgEdFunc { public: - DlgEdFuncInsert( DlgEditor* pParent ); - ~DlgEdFuncInsert(); + explicit DlgEdFuncInsert (DlgEditor& rParent); + virtual ~DlgEdFuncInsert (); virtual bool MouseButtonDown( const MouseEvent& rMEvt ); virtual bool MouseButtonUp( const MouseEvent& rMEvt ); @@ -73,8 +73,8 @@ protected: bool bMarkAction; public: - DlgEdFuncSelect( DlgEditor* pParent ); - ~DlgEdFuncSelect(); + explicit DlgEdFuncSelect (DlgEditor& rParent); + virtual ~DlgEdFuncSelect (); virtual bool MouseButtonDown( const MouseEvent& rMEvt ); virtual bool MouseButtonUp( const MouseEvent& rMEvt ); diff --git a/basctl/source/inc/dlgedlist.hxx b/basctl/source/inc/dlgedlist.hxx index bb53f08461ec..5a37dd16b009 100644 --- a/basctl/source/inc/dlgedlist.hxx +++ b/basctl/source/inc/dlgedlist.hxx @@ -38,10 +38,10 @@ typedef ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertyChangeListene class DlgEdPropListenerImpl: public PropertyChangeListenerHelper { private: - DlgEdObj* pDlgEdObj; + DlgEdObj& rDlgEdObj; public: - DlgEdPropListenerImpl(DlgEdObj* pObj); + explicit DlgEdPropListenerImpl (DlgEdObj&); virtual ~DlgEdPropListenerImpl(); // XEventListener @@ -61,10 +61,10 @@ typedef ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener class DlgEdEvtContListenerImpl: public ContainerListenerHelper { private: - DlgEdObj* pDlgEdObj; + DlgEdObj& rDlgEdObj; public: - DlgEdEvtContListenerImpl(DlgEdObj* pObj); + explicit DlgEdEvtContListenerImpl (DlgEdObj&); virtual ~DlgEdEvtContListenerImpl(); // XEventListener diff --git a/basctl/source/inc/dlgedobj.hxx b/basctl/source/inc/dlgedobj.hxx index d6119998f01f..d1b678b9cd62 100644 --- a/basctl/source/inc/dlgedobj.hxx +++ b/basctl/source/inc/dlgedobj.hxx @@ -55,7 +55,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener> m_xContainerListener; private: - DlgEditor* GetDialogEditor (); + DlgEditor& GetDialogEditor (); protected: DlgEdObj(); @@ -143,15 +143,15 @@ class DlgEdForm: public DlgEdObj friend class DlgEdFactory; private: - DlgEditor* pDlgEditor; + DlgEditor& rDlgEditor; ::std::vector<DlgEdObj*> pChildren; mutable ::boost::optional< ::com::sun::star::awt::DeviceInfo > mpDeviceInfo; +private: + explicit DlgEdForm (DlgEditor&); protected: - DlgEdForm(); - virtual void NbcMove( const Size& rSize ); virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd); @@ -161,12 +161,11 @@ public: virtual ~DlgEdForm(); - virtual void SetDlgEditor( DlgEditor* pEditor ); - virtual DlgEditor* GetDlgEditor() const { return pDlgEditor; } + virtual DlgEditor& GetDlgEditor () const { return rDlgEditor; } virtual void AddChild( DlgEdObj* pDlgEdObj ); virtual void RemoveChild( DlgEdObj* pDlgEdObj ); - virtual ::std::vector<DlgEdObj*> GetChildren() const { return pChildren; } + virtual std::vector<DlgEdObj*> const& GetChildren() const { return pChildren; } virtual void UpdateStep(); diff --git a/basctl/source/inc/dlgedpage.hxx b/basctl/source/inc/dlgedpage.hxx index 5a87b4248f61..1c5dee703a8c 100644 --- a/basctl/source/inc/dlgedpage.hxx +++ b/basctl/source/inc/dlgedpage.hxx @@ -41,7 +41,6 @@ public: TYPEINFO(); DlgEdPage( DlgEdModel& rModel, bool bMasterPage = false ); - DlgEdPage( const DlgEdPage& ); virtual ~DlgEdPage(); using SdrPage::Clone; diff --git a/basctl/source/inc/dlgedview.hxx b/basctl/source/inc/dlgedview.hxx index 77c353420714..8ae6b15c8989 100644 --- a/basctl/source/inc/dlgedview.hxx +++ b/basctl/source/inc/dlgedview.hxx @@ -35,12 +35,12 @@ class DlgEditor; class DlgEdView : public SdrView { private: - DlgEditor* pDlgEditor; + DlgEditor& rDlgEditor; public: TYPEINFO(); - DlgEdView( SdrModel* pModel, OutputDevice* pOut, DlgEditor* pEditor ); + DlgEdView (SdrModel& rModel, OutputDevice& rOut, DlgEditor& rEditor); virtual ~DlgEdView(); virtual void MarkListHasChanged(); diff --git a/basctl/source/inc/doceventnotifier.hxx b/basctl/source/inc/doceventnotifier.hxx index 145e18dea019..4b950b17b893 100644 --- a/basctl/source/inc/doceventnotifier.hxx +++ b/basctl/source/inc/doceventnotifier.hxx @@ -55,7 +55,6 @@ namespace basctl //==================================================================== //= DocumentEventNotifier //==================================================================== - class DocumentEventNotifier_Impl; /** allows registering at the GlobalEventBroadcaster for global document events */ class DocumentEventNotifier @@ -63,12 +62,11 @@ namespace basctl public: /** create a notifier instance which notifies about events of all documents in the whole application */ - DocumentEventNotifier( DocumentEventListener& _rListener ); + DocumentEventNotifier (DocumentEventListener&); /** creates a notifier instance which notifies about events at a single document */ - DocumentEventNotifier( DocumentEventListener& _rListener, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument ); + DocumentEventNotifier (DocumentEventListener&, com::sun::star::uno::Reference<com::sun::star::frame::XModel> const& rxDocument); ~DocumentEventNotifier(); @@ -76,7 +74,8 @@ namespace basctl void dispose(); private: - ::rtl::Reference< DocumentEventNotifier_Impl > m_pImpl; + class Impl; + rtl::Reference<Impl> m_pImpl; }; //........................................................................ diff --git a/basctl/source/inc/docsignature.hxx b/basctl/source/inc/docsignature.hxx index 4ff3e2a48c7b..9ec8852916ea 100644 --- a/basctl/source/inc/docsignature.hxx +++ b/basctl/source/inc/docsignature.hxx @@ -21,7 +21,7 @@ #include <com/sun/star/frame/XModel.hpp> -#include <memory> +#include <boost/scoped_ptr.hpp> //........................................................................ namespace basctl @@ -32,7 +32,6 @@ namespace basctl //==================================================================== //= DocumentSignature //==================================================================== - struct DocumentSignature_Data; /// encapsulates (actions on) the signature/state of a document class DocumentSignature { @@ -42,7 +41,7 @@ namespace basctl If the given ScriptDocument instance refers to the application, or to a document which does not support being signed, the DocumentSignature instance is invalid afterwards. */ - DocumentSignature( const ScriptDocument& _rDocument ); + explicit DocumentSignature (ScriptDocument const&); ~DocumentSignature(); /** determines whether the instance is valid @@ -69,7 +68,8 @@ namespace basctl DocumentSignature(); // not implemented private: - ::std::auto_ptr< DocumentSignature_Data > m_pData; + class Impl; + boost::scoped_ptr<Impl> m_pImpl; }; //........................................................................ diff --git a/basctl/source/inc/iderid.hxx b/basctl/source/inc/iderid.hxx index 1a253301ff8d..4cfb28211d1b 100644 --- a/basctl/source/inc/iderid.hxx +++ b/basctl/source/inc/iderid.hxx @@ -31,7 +31,10 @@ public: IDEResId( sal_uInt16 nId ); }; -#define IDE_RESSTR(x) IDEResId(x).toString() +inline rtl::OUString IDE_RESSTR (sal_uInt16 nId) +{ + return IDEResId(nId).toString(); +} } // namespace basctl diff --git a/basctl/source/inc/localizationmgr.hxx b/basctl/source/inc/localizationmgr.hxx index 612a2b777454..e3da88b37134 100644 --- a/basctl/source/inc/localizationmgr.hxx +++ b/basctl/source/inc/localizationmgr.hxx @@ -69,7 +69,7 @@ class LocalizationMgr void implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode ); public: - LocalizationMgr(Shell*, const ScriptDocument&, ::rtl::OUString aLibName, + LocalizationMgr(Shell*, ScriptDocument const&, rtl::OUString const& aLibName, const ::com::sun::star::uno::Reference < ::com::sun::star::resource::XStringResourceManager >& xStringResourceManager ); ::com::sun::star::uno::Reference |