summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-13 21:07:25 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-14 09:58:14 +0900
commit607582291eaad26a18b1df6f7aea434b391d548c (patch)
treebef3e4563ab3c9b4d940eb50a1739d148fd8a431 /basctl
parent9128ef6850984924c27e6f794d05fc70d3243527 (diff)
refactor "basctl" classes to use RenderContext
Change-Id: I6eb54af9f793c614c823123c6f16a3dc4f3a0c0b
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/baside2.cxx59
-rw-r--r--basctl/source/basicide/baside2.hxx4
-rw-r--r--basctl/source/basicide/baside2b.cxx220
-rw-r--r--basctl/source/basicide/baside3.cxx46
-rw-r--r--basctl/source/basicide/linenumberwindow.cxx20
-rw-r--r--basctl/source/basicide/linenumberwindow.hxx2
-rw-r--r--basctl/source/dlged/dlged.cxx38
-rw-r--r--basctl/source/inc/baside3.hxx2
-rw-r--r--basctl/source/inc/dlged.hxx3
9 files changed, 155 insertions, 239 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 2d8d794727bf..6079ed448b02 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -78,7 +78,7 @@ char const FilterMask_All[] = "*";
char const FilterMask_All[] = "*.*";
#endif
-} // namespace
+} // end anonymous namespace
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -179,22 +179,13 @@ bool bSourceLinesEnabled = false;
} // namespace
-
-
-// ModulWindow
-
-
-
-ModulWindow::ModulWindow (
- ModulWindowLayout* pParent,
- ScriptDocument const& rDocument,
- const OUString& aLibName, const OUString& aName, OUString& aModule
-) :
- BaseWindow(pParent, rDocument, aLibName, aName),
- rLayout(*pParent),
- nValid(ValidWindow),
- aXEditorWindow(VclPtr<ComplexEditorWindow>::Create(this)),
- m_aModule(aModule)
+ModulWindow::ModulWindow (ModulWindowLayout* pParent, ScriptDocument const& rDocument,
+ const OUString& aLibName, const OUString& aName, OUString& aModule)
+ : BaseWindow(pParent, rDocument, aLibName, aName)
+ , rLayout(*pParent)
+ , nValid(ValidWindow)
+ , aXEditorWindow(VclPtr<ComplexEditorWindow>::Create(this))
+ , m_aModule(aModule)
{
aXEditorWindow->Show();
SetBackground();
@@ -250,14 +241,13 @@ void ModulWindow::GetFocus()
void ModulWindow::DoInit()
{
- if ( GetVScrollBar() )
+ if (GetVScrollBar())
GetVScrollBar()->Hide();
GetHScrollBar()->Show();
GetEditorWindow().InitScrollBars();
}
-
-void ModulWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& )
+void ModulWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangle&)
{
}
@@ -267,7 +257,6 @@ void ModulWindow::Resize()
Size( GetOutputSizePixel() ) );
}
-
void ModulWindow::CheckCompileBasic()
{
if ( XModule().Is() )
@@ -775,7 +764,6 @@ void ModulWindow::EditMacro( const OUString& rMacroName )
}
}
-
void ModulWindow::StoreData()
{
// StoreData is called when the BasicManager is destroyed or
@@ -789,13 +777,11 @@ bool ModulWindow::CanClose()
return true;
}
-
bool ModulWindow::AllowUndo()
{
return GetEditorWindow().CanModify();
}
-
void ModulWindow::UpdateData()
{
DBG_ASSERT( XModule().Is(), "Kein Modul!" );
@@ -901,7 +887,6 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
return nCurPage;
}
-
void ModulWindow::ExecuteCommand (SfxRequest& rReq)
{
AssertValidEditEngine();
@@ -1179,7 +1164,6 @@ void ModulWindow::GetState( SfxItemSet &rSet )
}
}
-
void ModulWindow::DoScroll( ScrollBar* pCurScrollBar )
{
if ( ( pCurScrollBar == GetHScrollBar() ) && GetEditView() )
@@ -1193,14 +1177,11 @@ void ModulWindow::DoScroll( ScrollBar* pCurScrollBar )
}
}
-
bool ModulWindow::IsModified()
{
return GetEditEngine() && GetEditEngine()->IsModified();
}
-
-
void ModulWindow::GoOnTop()
{
GetShell()->GetViewFrame()->ToTop();
@@ -1234,7 +1215,6 @@ void ModulWindow::ShowCursor( bool bOn )
}
}
-
void ModulWindow::AssertValidEditEngine()
{
if ( !GetEditEngine() )
@@ -1295,7 +1275,7 @@ sal_uInt16 ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem,
return nFound;
}
-::svl::IUndoManager* ModulWindow::GetUndoManager()
+svl::IUndoManager* ModulWindow::GetUndoManager()
{
if ( GetEditEngine() )
return &GetEditEngine()->GetUndoManager();
@@ -1462,12 +1442,6 @@ void ModulWindow::UpdateModule ()
MarkDocumentModified(m_aDocument);
}
-
-
-// ModulWindowLayout
-
-
-
ModulWindowLayout::ModulWindowLayout (vcl::Window* pParent, ObjectCatalog& rObjectCatalog_) :
Layout(pParent),
pChild(0),
@@ -1495,9 +1469,9 @@ void ModulWindowLayout::UpdateDebug (bool bBasicStopped)
aStackWindow->UpdateCalls();
}
-void ModulWindowLayout::Paint (vcl::RenderContext& /*rRenderContext*/, Rectangle const&)
+void ModulWindowLayout::Paint (vcl::RenderContext& rRenderContext, Rectangle const&)
{
- DrawText(Point(), IDEResId(RID_STR_NOMODULE).toString());
+ rRenderContext.DrawText(Point(), IDEResId(RID_STR_NOMODULE).toString());
}
// virtual
@@ -1508,7 +1482,6 @@ void ModulWindowLayout::DataChanged (DataChangedEvent const& rDCEvt)
aSyntaxColors.SettingsChanged();
}
-
void ModulWindowLayout::Activating (BaseWindow& rChild)
{
assert(dynamic_cast<ModulWindow*>(&rChild));
@@ -1563,12 +1536,6 @@ void ModulWindowLayout::OnFirstSize (long const nWidth, long const nHeight)
AddToBottom(aStackWindow.get(), Size(nWidth * 0.33, nHeight * 0.25));
}
-
-
-// SyntaxColors
-
-
-
ModulWindowLayout::SyntaxColors::SyntaxColors () :
pEditor(0)
{
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index d71ae5a07653..326c621ea53d 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -177,9 +177,9 @@ private:
void setBackgroundColor(Color aColor);
protected:
- virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) SAL_OVERRIDE;
BreakPoint* FindBreakPoint( const Point& rMousePos );
- void ShowMarker( bool bShow );
+ void ShowMarker(vcl::RenderContext& rRenderContext);
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 8d84a28bbb24..55d67ac0185b 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -119,21 +119,21 @@ void setTextEngineText (ExtTextEngine& rEngine, OUString const& aStr)
namespace
{
-void lcl_DrawIDEWindowFrame( DockingWindow* pWin )
+void lcl_DrawIDEWindowFrame(DockingWindow* pWin, vcl::RenderContext& rRenderContext)
{
- if ( pWin->IsFloatingMode() )
+ if (pWin->IsFloatingMode())
return;
- Size aSz = pWin->GetOutputSizePixel();
- const Color aOldLineColor( pWin->GetLineColor() );
- pWin->SetLineColor( Color( COL_WHITE ) );
+ Size aSz = rRenderContext.GetOutputSizePixel();
+ const Color aOldLineColor(rRenderContext.GetLineColor());
+ rRenderContext.SetLineColor(Color(COL_WHITE));
// White line on top
- pWin->DrawLine( Point( 0, 0 ), Point( aSz.Width(), 0 ) );
+ rRenderContext.DrawLine(Point(0, 0), Point(aSz.Width(), 0));
// Black line at bottom
- pWin->SetLineColor( Color( COL_BLACK ) );
- pWin->DrawLine( Point( 0, aSz.Height() - 1 ),
- Point( aSz.Width(), aSz.Height() - 1 ) );
- pWin->SetLineColor( aOldLineColor );
+ rRenderContext.SetLineColor(Color(COL_BLACK));
+ rRenderContext.DrawLine(Point(0, aSz.Height() - 1),
+ Point(aSz.Width(), aSz.Height() - 1));
+ rRenderContext.SetLineColor(aOldLineColor);
}
void lcl_SeparateNameAndIndex( const OUString& rVName, OUString& rVar, OUString& rIndex )
@@ -965,7 +965,7 @@ sal_Int32 searchEOL( const OUString& rStr, sal_Int32 fromIndex )
void EditorWindow::CreateEditEngine()
{
- if ( pEditEngine )
+ if (pEditEngine)
return;
pEditEngine.reset(new ExtTextEngine);
@@ -989,35 +989,32 @@ void EditorWindow::CreateEditEngine()
nLines++;
nIndex = searchEOL( aOUSource, nIndex+1 );
}
- while ( nIndex >= 0 );
+ while (nIndex >= 0);
// 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.reset(new ProgressInfo(
- GetShell()->GetViewFrame()->GetObjectShell(),
- IDEResId(RID_STR_GENERATESOURCE).toString(),
- nLines*4
- ));
+ pProgress.reset(new ProgressInfo(GetShell()->GetViewFrame()->GetObjectShell(),
+ IDEResId(RID_STR_GENERATESOURCE).toString(),
+ nLines * 4));
setTextEngineText(*pEditEngine, aOUSource);
- pEditView->SetStartDocPos( Point( 0, 0 ) );
- pEditView->SetSelection( TextSelection() );
+ pEditView->SetStartDocPos(Point(0, 0));
+ pEditView->SetSelection(TextSelection());
rModulWindow.GetBreakPointWindow().GetCurYOffset() = 0;
rModulWindow.GetLineNumberWindow().GetCurYOffset() = 0;
pEditEngine->SetUpdateMode(true);
rModulWindow.Update(); // has only been invalidated at UpdateMode = true
- pEditView->ShowCursor( true, true );
+ pEditView->ShowCursor(true, true);
- StartListening( *pEditEngine );
+ StartListening(*pEditEngine);
aSyntaxIdle.Stop();
bDoSyntaxHighlight = bWasDoSyntaxHighlight;
-
- for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ )
- aSyntaxLineTable.insert( nLine );
+ for (sal_uInt16 nLine = 0; nLine < nLines; nLine++)
+ aSyntaxLineTable.insert(nLine);
ForceSyntaxTimeout();
pProgress.reset();
@@ -1030,22 +1027,24 @@ void EditorWindow::CreateEditEngine()
if (SfxBindings* pBindings = GetBindingsPtr())
{
- pBindings->Invalidate( SID_BASICIDE_STAT_POS );
- pBindings->Invalidate( SID_BASICIDE_STAT_TITLE );
+ pBindings->Invalidate(SID_BASICIDE_STAT_POS);
+ pBindings->Invalidate(SID_BASICIDE_STAT_TITLE);
}
- DBG_ASSERT( rModulWindow.GetBreakPointWindow().GetCurYOffset() == 0, "CreateEditEngine: Brechpunkte verschoben?" );
+ DBG_ASSERT(rModulWindow.GetBreakPointWindow().GetCurYOffset() == 0, "CreateEditEngine: Brechpunkte verschoben?");
// set readonly mode for readonly libraries
ScriptDocument aDocument(rModulWindow.GetDocument());
OUString aOULibName(rModulWindow.GetLibName());
Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) )
+ if (xModLibContainer.is()
+ && xModLibContainer->hasByName(aOULibName)
+ && xModLibContainer->isLibraryReadOnly(aOULibName))
{
rModulWindow.SetReadOnly(true);
}
- if ( aDocument.isDocument() && aDocument.isReadOnly() )
+ if (aDocument.isDocument() && aDocument.isReadOnly())
rModulWindow.SetReadOnly(true);
}
@@ -1181,23 +1180,23 @@ void EditorWindow::SetScrollBarRanges()
void EditorWindow::InitScrollBars()
{
- if ( !pEditEngine )
+ if (!pEditEngine)
return;
SetScrollBarRanges();
- Size aOutSz( GetOutputSizePixel() );
- rModulWindow.GetEditVScrollBar().SetVisibleSize( aOutSz.Height() );
- rModulWindow.GetEditVScrollBar().SetPageSize( aOutSz.Height() * 8 / 10 );
- rModulWindow.GetEditVScrollBar().SetLineSize( GetTextHeight() );
- rModulWindow.GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() );
+ Size aOutSz(GetOutputSizePixel());
+ rModulWindow.GetEditVScrollBar().SetVisibleSize(aOutSz.Height());
+ rModulWindow.GetEditVScrollBar().SetPageSize(aOutSz.Height() * 8 / 10);
+ rModulWindow.GetEditVScrollBar().SetLineSize(GetTextHeight());
+ rModulWindow.GetEditVScrollBar().SetThumbPos(pEditView->GetStartDocPos().Y());
rModulWindow.GetEditVScrollBar().Show();
- if ( rModulWindow.GetHScrollBar() )
+ if (rModulWindow.GetHScrollBar())
{
- rModulWindow.GetHScrollBar()->SetVisibleSize( aOutSz.Width() );
- rModulWindow.GetHScrollBar()->SetPageSize( aOutSz.Width() * 8 / 10 );
- rModulWindow.GetHScrollBar()->SetLineSize( GetTextWidth( "x" ) );
- rModulWindow.GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() );
+ rModulWindow.GetHScrollBar()->SetVisibleSize(aOutSz.Width());
+ rModulWindow.GetHScrollBar()->SetPageSize(aOutSz.Width() * 8 / 10);
+ rModulWindow.GetHScrollBar()->SetLineSize(GetTextWidth( "x" ) );
+ rModulWindow.GetHScrollBar()->SetThumbPos(pEditView->GetStartDocPos().X());
rModulWindow.GetHScrollBar()->Show();
}
}
@@ -1216,10 +1215,10 @@ void EditorWindow::ImpDoHighlight( sal_uLong nLine )
i != aPortions.end(); ++i)
{
Color const aColor = rModulWindow.GetLayout().GetSyntaxColor(i->tokenType);
- pEditEngine->SetAttrib( TextAttribFontColor(aColor), nLine, i->nBegin, i->nEnd, true );
+ pEditEngine->SetAttrib(TextAttribFontColor(aColor), nLine, i->nBegin, i->nEnd, true);
}
- pEditEngine->SetModified( bWasModified );
+ pEditEngine->SetModified(bWasModified);
}
}
@@ -1232,28 +1231,28 @@ void EditorWindow::UpdateSyntaxHighlighting ()
void EditorWindow::ImplSetFont()
{
- OUString sFontName(
- officecfg::Office::Common::Font::SourceViewFont::FontName::get().
- get_value_or( OUString() ) );
- if ( sFontName.isEmpty() )
+ OUString sFontName(officecfg::Office::Common::Font::SourceViewFont::FontName::get().get_value_or(OUString()));
+ if (sFontName.isEmpty())
{
- vcl::Font aTmpFont( OutputDevice::GetDefaultFont( DefaultFontType::FIXED, Application::GetSettings().GetUILanguageTag().getLanguageType(), 0 , this ) );
+ vcl::Font aTmpFont(OutputDevice::GetDefaultFont(DefaultFontType::FIXED,
+ Application::GetSettings().GetUILanguageTag().getLanguageType(),
+ 0 , this));
sFontName = aTmpFont.GetName();
}
Size aFontSize(0, officecfg::Office::Common::Font::SourceViewFont::FontHeight::get());
- vcl::Font aFont( sFontName, aFontSize );
- aFont.SetColor( GetSettings().GetStyleSettings().GetFieldTextColor() );
- SetPointFont( aFont );
+ vcl::Font aFont(sFontName, aFontSize);
+ aFont.SetColor(Application::GetSettings().GetStyleSettings().GetFieldTextColor());
+ SetPointFont(aFont);
aFont = GetFont();
- rModulWindow.GetBreakPointWindow().SetFont( aFont );
- rModulWindow.GetLineNumberWindow().SetFont( aFont );
+ rModulWindow.GetBreakPointWindow().SetFont(aFont);
+ rModulWindow.GetLineNumberWindow().SetFont(aFont);
- if ( pEditEngine )
+ if (pEditEngine)
{
bool const bModified = pEditEngine->IsModified();
- pEditEngine->SetFont( aFont );
- pEditEngine->SetModified( bModified );
+ pEditEngine->SetFont(aFont);
+ pEditEngine->SetModified(bModified);
}
}
@@ -1364,12 +1363,8 @@ void EditorWindow::ForceSyntaxTimeout()
aSyntaxIdle.GetIdleHdl().Call(&aSyntaxIdle);
}
-
-
// BreakPointWindow
-
-
BreakPointWindow::BreakPointWindow (vcl::Window* pParent, ModulWindow* pModulWindow)
: Window(pParent, WB_BORDER)
, rModulWindow(*pModulWindow)
@@ -1381,32 +1376,34 @@ BreakPointWindow::BreakPointWindow (vcl::Window* pParent, ModulWindow* pModulWin
SetHelpId(HID_BASICIDE_BREAKPOINTWINDOW);
}
-void BreakPointWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangle&)
+void BreakPointWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
- if ( SyncYOffset() )
+ if (SyncYOffset())
return;
- Size const aOutSz = GetOutputSize();
- long const nLineHeight = GetTextHeight();
+ Size const aOutSz = rRenderContext.GetOutputSize();
+ long const nLineHeight = rRenderContext.GetTextHeight();
+
+ Image const aBrk[2] =
+ {
+ GetImage(IMGID_BRKDISABLED),
+ GetImage(IMGID_BRKENABLED)
+ };
- Image const aBrk[2] = { GetImage(IMGID_BRKDISABLED), GetImage(IMGID_BRKENABLED) };
- Size const aBmpSz = PixelToLogic(aBrk[1].GetSizePixel());
- Point const aBmpOff(
- (aOutSz.Width() - aBmpSz.Width()) / 2,
- (nLineHeight - aBmpSz.Height()) / 2
- );
+ Size const aBmpSz = rRenderContext.PixelToLogic(aBrk[1].GetSizePixel());
+ Point const aBmpOff((aOutSz.Width() - aBmpSz.Width()) / 2,
+ (nLineHeight - aBmpSz.Height()) / 2);
for (size_t i = 0, n = GetBreakPoints().size(); i < n; ++i)
{
BreakPoint& rBrk = *GetBreakPoints().at(i);
size_t const nLine = rBrk.nLine - 1;
size_t const nY = nLine*nLineHeight - nCurYOffset;
- DrawImage(Point(0, nY) + aBmpOff, aBrk[rBrk.bEnabled]);
+ rRenderContext.DrawImage(Point(0, nY) + aBmpOff, aBrk[rBrk.bEnabled]);
}
- ShowMarker(true);
-}
-
+ Invalidate();
+}
void BreakPointWindow::DoScroll( long nHorzScroll, long nVertScroll )
{
@@ -1414,17 +1411,14 @@ void BreakPointWindow::DoScroll( long nHorzScroll, long nVertScroll )
Window::Scroll( nHorzScroll, nVertScroll );
}
-
-
void BreakPointWindow::SetMarkerPos( sal_uInt16 nLine, bool bError )
{
if ( SyncYOffset() )
Update();
- ShowMarker( false );
nMarkerPos = nLine;
bErrorMarker = bError;
- ShowMarker( true );
+ Invalidate();
}
void BreakPointWindow::SetNoMarker ()
@@ -1432,9 +1426,9 @@ void BreakPointWindow::SetNoMarker ()
SetMarkerPos(NoMarker);
}
-void BreakPointWindow::ShowMarker( bool bShow )
+void BreakPointWindow::ShowMarker(vcl::RenderContext& rRenderContext)
{
- if ( nMarkerPos == NoMarker )
+ if (nMarkerPos == NoMarker)
return;
Size const aOutSz = GetOutputSize();
@@ -1442,23 +1436,18 @@ void BreakPointWindow::ShowMarker( bool bShow )
Image aMarker = GetImage(bErrorMarker ? IMGID_ERRORMARKER : IMGID_STEPMARKER);
- Size aMarkerSz( aMarker.GetSizePixel() );
- aMarkerSz = PixelToLogic( aMarkerSz );
- Point aMarkerOff( 0, 0 );
- aMarkerOff.X() = ( aOutSz.Width() - aMarkerSz.Width() ) / 2;
- aMarkerOff.Y() = ( nLineHeight - aMarkerSz.Height() ) / 2;
+ Size aMarkerSz(aMarker.GetSizePixel());
+ aMarkerSz = rRenderContext.PixelToLogic(aMarkerSz);
+ Point aMarkerOff(0, 0);
+ aMarkerOff.X() = (aOutSz.Width() - aMarkerSz.Width()) / 2;
+ aMarkerOff.Y() = (nLineHeight - aMarkerSz.Height()) / 2;
- sal_uLong nY = nMarkerPos*nLineHeight - nCurYOffset;
- Point aPos( 0, nY );
+ sal_uLong nY = nMarkerPos * nLineHeight - nCurYOffset;
+ Point aPos(0, nY);
aPos += aMarkerOff;
- if ( bShow )
- DrawImage( aPos, aMarker );
- else
- Invalidate( Rectangle( aPos, aMarkerSz ) );
-}
-
-
+ rRenderContext.DrawImage(aPos, aMarker);
+}
BreakPoint* BreakPointWindow::FindBreakPoint( const Point& rMousePos )
{
@@ -1493,8 +1482,6 @@ void BreakPointWindow::MouseButtonDown( const MouseEvent& rMEvt )
}
}
-
-
void BreakPointWindow::Command( const CommandEvent& rCEvt )
{
if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
@@ -1581,12 +1568,6 @@ void BreakPointWindow::setBackgroundColor(Color aColor)
SetBackground(Wallpaper(aColor));
}
-
-
-// WatchWindow
-
-
-
namespace
{
const sal_uInt16 ITEM_ID_VARIABLE = 1;
@@ -1687,16 +1668,12 @@ void WatchWindow::dispose()
DockingWindow::dispose();
}
-
-
-void WatchWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& )
+void WatchWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
- DrawText( Point( DWBORDER, 7 ), aWatchStr );
- lcl_DrawIDEWindowFrame( this );
+ rRenderContext.DrawText(Point(DWBORDER, 7), aWatchStr);
+ lcl_DrawIDEWindowFrame(this, rRenderContext);
}
-
-
void WatchWindow::Resize()
{
Size aSz = GetOutputSizePixel();
@@ -1927,20 +1904,16 @@ void StackWindow::dispose()
DockingWindow::dispose();
}
-
-
-void StackWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& )
+void StackWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
- DrawText( Point( DWBORDER, 7 ), aStackStr );
- lcl_DrawIDEWindowFrame( this );
+ rRenderContext.DrawText(Point(DWBORDER, 7), aStackStr);
+ lcl_DrawIDEWindowFrame(this, rRenderContext);
}
-
-
void StackWindow::Resize()
{
Size aSz = GetOutputSizePixel();
- Size aBoxSz( aSz.Width() - 2*DWBORDER, aSz.Height() - nVirtToolBoxHeight - DWBORDER );
+ Size aBoxSz(aSz.Width() - 2*DWBORDER, aSz.Height() - nVirtToolBoxHeight - DWBORDER);
if ( aBoxSz.Width() < 4 )
aBoxSz.Width() = 0;
@@ -1957,7 +1930,7 @@ void StackWindow::UpdateCalls()
aTreeListBox->SetUpdateMode(false);
aTreeListBox->Clear();
- if ( StarBASIC::IsRunning() )
+ if (StarBASIC::IsRunning())
{
SbxError eOld = SbxBase::GetError();
aTreeListBox->SetSelectionMode( SINGLE_SELECTION );
@@ -2027,12 +2000,6 @@ void StackWindow::UpdateCalls()
aTreeListBox->SetUpdateMode(true);
}
-
-
-// ComplexEditorWindow
-
-
-
ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
Window( pParent, WB_3DLOOK | WB_CLIPCHILDREN ),
aBrkWindow(VclPtr<BreakPointWindow>::Create(this, pParent)),
@@ -2049,7 +2016,6 @@ ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
aEWVScrollBar->Show();
}
-
ComplexEditorWindow::~ComplexEditorWindow()
{
disposeOnce();
@@ -2067,7 +2033,7 @@ void ComplexEditorWindow::dispose()
void ComplexEditorWindow::Resize()
{
Size aOutSz = GetOutputSizePixel();
- Size aSz( aOutSz );
+ Size aSz(aOutSz);
aSz.Width() -= 2*DWBORDER;
aSz.Height() -= 2*DWBORDER;
long nBrkWidth = 20;
@@ -2094,9 +2060,9 @@ void ComplexEditorWindow::Resize()
aEWVScrollBar->SetPosSizePixel( Point( aOutSz.Width() - DWBORDER - nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) );
}
-IMPL_LINK( ComplexEditorWindow, ScrollHdl, ScrollBar *, pCurScrollBar )
+IMPL_LINK(ComplexEditorWindow, ScrollHdl, ScrollBar *, pCurScrollBar )
{
- if ( aEdtWindow->GetEditView() )
+ if (aEdtWindow->GetEditView())
{
DBG_ASSERT( pCurScrollBar == aEWVScrollBar.get(), "Wer scrollt hier ?" );
long nDiff = aEdtWindow->GetEditView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos();
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 8dc391e4d608..3d7587ab7e05 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -71,23 +71,20 @@ char const FilterMask_All[] = "*";
TYPEINIT1( DialogWindow, BaseWindow );
-DialogWindow::DialogWindow (
- DialogWindowLayout* pParent,
- ScriptDocument const& rDocument,
- const OUString& aLibName, const OUString& aName,
- com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> const& xDialogModel
-) :
- BaseWindow(pParent, rDocument, aLibName, aName),
- rLayout(*pParent),
- pEditor(new DlgEditor(*this, rLayout, rDocument.isDocument() ? rDocument.getDocument() : Reference<frame::XModel>(), xDialogModel)),
- pUndoMgr(new SfxUndoManager)
+DialogWindow::DialogWindow(DialogWindowLayout* pParent, ScriptDocument const& rDocument,
+ const OUString& aLibName, const OUString& aName,
+ css::uno::Reference<css::container::XNameContainer> const& xDialogModel)
+ : BaseWindow(pParent, rDocument, aLibName, aName)
+ ,rLayout(*pParent)
+ ,pEditor(new DlgEditor(*this, rLayout, rDocument.isDocument()
+ ? rDocument.getDocument()
+ : Reference<frame::XModel>(), xDialogModel))
+ ,pUndoMgr(new SfxUndoManager)
{
InitSettings( true, true, true );
aOldNotifyUndoActionHdl = pEditor->GetModel().GetNotifyUndoActionHdl();
- pEditor->GetModel().SetNotifyUndoActionHdl(
- LINK(this, DialogWindow, NotifyUndoActionHdl)
- );
+ pEditor->GetModel().SetNotifyUndoActionHdl(LINK(this, DialogWindow, NotifyUndoActionHdl));
SetHelpId( HID_BASICIDE_DIALOGWINDOW );
@@ -108,24 +105,19 @@ void DialogWindow::LoseFocus()
Window::LoseFocus();
}
-
-
-void DialogWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect )
+void DialogWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
- pEditor->Paint( rRect );
+ pEditor->Paint(rRenderContext, rRect);
}
-
-
void DialogWindow::Resize()
{
- if ( GetHScrollBar() && GetVScrollBar() ) {
+ if (GetHScrollBar() && GetVScrollBar())
+ {
pEditor->SetScrollBars( GetHScrollBar(), GetVScrollBar() );
}
}
-
-
void DialogWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
pEditor->MouseButtonDown( rMEvt );
@@ -134,8 +126,6 @@ void DialogWindow::MouseButtonDown( const MouseEvent& rMEvt )
pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
}
-
-
void DialogWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
pEditor->MouseButtonUp( rMEvt );
@@ -155,15 +145,11 @@ void DialogWindow::MouseButtonUp( const MouseEvent& rMEvt )
}
}
-
-
void DialogWindow::MouseMove( const MouseEvent& rMEvt )
{
pEditor->MouseMove( rMEvt );
}
-
-
void DialogWindow::KeyInput( const KeyEvent& rKEvt )
{
SfxBindings* pBindings = GetBindingsPtr();
@@ -238,8 +224,6 @@ IMPL_STATIC_LINK(
return 0;
}
-
-
void DialogWindow::DoInit()
{
GetHScrollBar()->Show();
@@ -247,8 +231,6 @@ void DialogWindow::DoInit()
pEditor->SetScrollBars( GetHScrollBar(), GetVScrollBar() );
}
-
-
void DialogWindow::DoScroll( ScrollBar* pCurScrollBar )
{
pEditor->DoScroll( pCurScrollBar );
diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx
index 03ee52029492..0c3ed9156235 100644
--- a/basctl/source/basicide/linenumberwindow.cxx
+++ b/basctl/source/basicide/linenumberwindow.cxx
@@ -36,24 +36,24 @@ void LineNumberWindow::dispose()
Window::dispose();
}
-void LineNumberWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& )
+void LineNumberWindow::Paint( vcl::RenderContext& rRenderContext, const Rectangle&)
{
if(SyncYOffset())
return;
ExtTextEngine* txtEngine = m_pModulWindow->GetEditEngine();
- if(!txtEngine)
+ if (!txtEngine)
return;
TextView* txtView = m_pModulWindow->GetEditView();
- if(!txtView)
+ if (!txtView)
return;
GetParent()->Resize();
- int windowHeight = GetOutputSize().Height();
- int nLineHeight = GetTextHeight();
- if(!nLineHeight)
+ int windowHeight = rRenderContext.GetOutputSize().Height();
+ int nLineHeight = rRenderContext.GetTextHeight();
+ if (!nLineHeight)
{
return;
}
@@ -62,7 +62,7 @@ void LineNumberWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rect
int nStartLine = startY / nLineHeight + 1;
int nEndLine = (startY + windowHeight) / nLineHeight + 1;
- if(txtEngine->GetParagraphCount() + 1 < (unsigned int)nEndLine)
+ if (txtEngine->GetParagraphCount() + 1 < (unsigned int)nEndLine)
nEndLine = txtEngine->GetParagraphCount() + 1;
// FIXME: it would be best if we could get notified of a font change
@@ -72,15 +72,15 @@ void LineNumberWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rect
// reserve enough for 3 sigit minimum, with a bit to spare for confort
m_nWidth = m_nBaseWidth * 3 + m_nBaseWidth / 2;
int i = (nEndLine + 1) / 1000;
- while(i)
+ while (i)
{
i /= 10;
m_nWidth += m_nBaseWidth;
}
sal_Int64 y = (nStartLine - 1) * (sal_Int64)nLineHeight;
- for(sal_Int32 n = nStartLine; n <= nEndLine; ++n, y += nLineHeight)
- DrawText(Point(0, y - m_nCurYOffset), OUString::number(n));
+ for (sal_Int32 n = nStartLine; n <= nEndLine; ++n, y += nLineHeight)
+ rRenderContext.DrawText(Point(0, y - m_nCurYOffset), OUString::number(n));
}
void LineNumberWindow::DataChanged(DataChangedEvent const & rDCEvt)
diff --git a/basctl/source/basicide/linenumberwindow.hxx b/basctl/source/basicide/linenumberwindow.hxx
index ada976593556..3da08a26ed75 100644
--- a/basctl/source/basicide/linenumberwindow.hxx
+++ b/basctl/source/basicide/linenumberwindow.hxx
@@ -26,7 +26,7 @@ private:
virtual void DataChanged (DataChangedEvent const& rDCEvt) SAL_OVERRIDE;
protected:
- virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& ) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
public:
LineNumberWindow (vcl::Window* pParent, ModulWindow* pModulWin);
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 1c7946dbb7dc..f9cb691efc2a 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -472,31 +472,29 @@ bool DlgEditor::KeyInput( const KeyEvent& rKEvt )
}
-void DlgEditor::Paint( const Rectangle& rRect )
+void DlgEditor::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
aPaintRect = rRect;
mnPaintGuard++;
Size aMacSize;
- if( bFirstDraw &&
- rWindow.IsVisible() &&
- (rWindow.GetOutputSize() != aMacSize) )
+ if (bFirstDraw && rWindow.IsVisible() && (rRenderContext.GetOutputSize() != aMacSize))
{
bFirstDraw = false;
// get property set
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet(pDlgEdForm->GetUnoControlModel(), ::com::sun::star::uno::UNO_QUERY);
+ css::uno::Reference<css::beans::XPropertySet> xPSet(pDlgEdForm->GetUnoControlModel(), css::uno::UNO_QUERY);
- if ( xPSet.is() )
+ if (xPSet.is())
{
// get dialog size from properties
sal_Int32 nWidth = 0, nHeight = 0;
xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidth;
xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeight;
- if ( nWidth == 0 && nHeight == 0 )
+ if (nWidth == 0 && nHeight == 0)
{
- Size aSize = rWindow.PixelToLogic( Size( 400, 300 ) );
+ Size aSize = rRenderContext.PixelToLogic( Size( 400, 300 ) );
// align with grid
Size aGridSize_(long(pDlgEdView->GetSnapGridWidthX()), long(pDlgEdView->GetSnapGridWidthY()));
@@ -504,7 +502,7 @@ void DlgEditor::Paint( const Rectangle& rRect )
aSize.Height() -= aSize.Height() % aGridSize_.Height();
Point aPos;
- Size aOutSize = rWindow.GetOutputSize();
+ Size aOutSize = rRenderContext.GetOutputSize();
aPos.X() = (aOutSize.Width()>>1) - (aSize.Width()>>1);
aPos.Y() = (aOutSize.Height()>>1) - (aSize.Height()>>1);
@@ -513,7 +511,7 @@ void DlgEditor::Paint( const Rectangle& rRect )
aPos.Y() -= aPos.Y() % aGridSize_.Height();
// don't put in the corner
- Point aMinPos = rWindow.PixelToLogic( Point( 30, 20 ) );
+ Point aMinPos = rRenderContext.PixelToLogic( Point( 30, 20 ) );
if( (aPos.X() < aMinPos.X()) || (aPos.Y() < aMinPos.Y()) )
{
aPos = aMinPos;
@@ -531,10 +529,16 @@ void DlgEditor::Paint( const Rectangle& rRect )
// set position and size of controls
if (const size_t nObjCount = pDlgEdPage->GetObjCount())
{
- for ( size_t i = 0 ; i < nObjCount ; ++i )
+ for (size_t i = 0 ; i < nObjCount ; ++i)
+ {
if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pDlgEdPage->GetObj(i)))
+ {
if (!dynamic_cast<DlgEdForm*>(pDlgEdObj))
+ {
pDlgEdObj->SetRectFromProps();
+ }
+ }
+ }
}
}
}
@@ -544,27 +548,26 @@ void DlgEditor::Paint( const Rectangle& rRect )
SdrPageView* pPgView = pDlgEdView->GetSdrPageView();
const vcl::Region aPaintRectRegion(aPaintRect);
-
// #i74769#
SdrPaintWindow* pTargetPaintWindow = 0;
// mark repaint start
- if(pPgView)
+ if (pPgView)
{
- pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(&rWindow, aPaintRectRegion);
+ pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(&rRenderContext, aPaintRectRegion);
OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
}
// draw background self using wallpaper
// #i79128# ...and use correct OutDev for that
- if(pTargetPaintWindow)
+ if (pTargetPaintWindow)
{
OutputDevice& rTargetOutDev = pTargetPaintWindow->GetTargetOutputDevice();
rTargetOutDev.DrawWallpaper(aPaintRect, Wallpaper(Color(COL_WHITE)));
}
// do paint (unbuffered) and mark repaint end
- if(pPgView)
+ if (pPgView)
{
// paint of control layer is done in EndDrawLayers anyway...
pPgView->GetView().EndDrawLayers(*pTargetPaintWindow, true);
@@ -609,9 +612,6 @@ void DlgEditor::SetInsertObj( sal_uInt16 eObj )
pDlgEdView->SetCurrentObj( eActObj, DlgInventor );
}
-
-
-
void DlgEditor::CreateDefaultObject()
{
// create object by factory
diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx
index 7654ef31f5d1..155748dcba2b 100644
--- a/basctl/source/inc/baside3.hxx
+++ b/basctl/source/inc/baside3.hxx
@@ -62,7 +62,7 @@ private:
OUString aCurPath;
protected:
- virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx
index 3b1c25b7faae..9309b911e147 100644
--- a/basctl/source/inc/dlged.hxx
+++ b/basctl/source/inc/dlged.hxx
@@ -31,6 +31,7 @@
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
#include <vcl/vclptr.hxx>
+#include <vcl/window.hxx>
#include <boost/scoped_ptr.hpp>
@@ -184,7 +185,7 @@ public:
void MouseButtonDown( const MouseEvent& rMEvt );
void MouseButtonUp( const MouseEvent& rMEvt );
void MouseMove( const MouseEvent& rMEvt );
- void Paint( const Rectangle& rRect );
+ void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
bool KeyInput( const KeyEvent& rKEvt );
void SetMode (Mode eMode);