[Libreoffice-commits] core.git: 25 commits - cui/source include/svtools include/svx include/tools include/vcl sc/qa svtools/source svx/source sw/source vcl/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Tue May 12 18:51:40 PDT 2015
cui/source/inc/paragrph.hxx | 4
cui/source/tabpages/paragrph.cxx | 16
include/svtools/toolbarmenu.hxx | 20
include/svx/charmap.hxx | 14
include/svx/dlgctrl.hxx | 48 -
include/svx/fntctrl.hxx | 15
include/svx/graphctl.hxx | 40 -
include/svx/measctrl.hxx | 16
include/svx/pagectrl.hxx | 236 ++++---
include/svx/paraprev.hxx | 119 ++-
include/svx/swframeexample.hxx | 6
include/tools/gen.hxx | 25
include/vcl/window.hxx | 13
sc/qa/extras/recordchanges-test.cxx | 12
svtools/source/control/toolbarmenu.cxx | 312 ++++-----
svtools/source/control/valueset.cxx | 8
svx/source/dialog/_bmpmask.cxx | 17
svx/source/dialog/charmap.cxx | 269 ++++----
svx/source/dialog/connctrl.cxx | 10
svx/source/dialog/contwnd.cxx | 79 +-
svx/source/dialog/dialcontrol.cxx | 14
svx/source/dialog/dlgctl3d.cxx | 4
svx/source/dialog/dlgctrl.cxx | 289 ++++-----
svx/source/dialog/fntctrl.cxx | 851 +++++++++++++--------------
svx/source/dialog/frmsel.cxx | 54 -
svx/source/dialog/graphctl.cxx | 12
svx/source/dialog/measctrl.cxx | 83 +-
svx/source/dialog/pagectrl.cxx | 174 ++---
svx/source/dialog/paraprev.cxx | 111 +--
svx/source/dialog/rubydialog.cxx | 435 +++++++------
svx/source/dialog/swframeexample.cxx | 63 +
svx/source/gallery2/galctrl.cxx | 115 +--
svx/source/inc/frmselimpl.hxx | 109 +--
svx/source/sidebar/line/LineWidthControl.cxx | 24
svx/source/sidebar/line/LineWidthControl.hxx | 47 -
svx/source/sidebar/tools/PopupControl.cxx | 10
svx/source/tbxctrls/layctrl.cxx | 121 ++-
sw/source/ui/dialog/uiregionsw.cxx | 2
sw/source/uibase/frmdlg/colex.cxx | 106 +--
sw/source/uibase/inc/colex.hxx | 25
vcl/source/window/paint.cxx | 156 ++++
41 files changed, 2175 insertions(+), 1909 deletions(-)
New commits:
commit 5b3a30f40a7ce476922649b734f6ede1c2fdef4b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 10:49:42 2015 +0900
fix warning when running "make check" with werror
Change-Id: I490568b715f21c94a1078fe04368ed7c9132c311
diff --git a/sc/qa/extras/recordchanges-test.cxx b/sc/qa/extras/recordchanges-test.cxx
index 67e84e3..fa3b36e 100644
--- a/sc/qa/extras/recordchanges-test.cxx
+++ b/sc/qa/extras/recordchanges-test.cxx
@@ -42,8 +42,8 @@ void ScRecordChangesTest::testSetRecordChanges()
uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComponent, UNO_QUERY_THROW);
uno::Reference< beans::XPropertySet > xDocSettingsPropSet (xDoc, UNO_QUERY_THROW);
- bool recordChangesValue;
- bool protectionValue;
+ bool recordChangesValue = true;
+ bool protectionValue = true;
CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("RecordChanges") >>= recordChangesValue);
CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("IsRecordChangesProtected") >>= protectionValue);
@@ -52,7 +52,7 @@ void ScRecordChangesTest::testSetRecordChanges()
CPPUNIT_ASSERT_MESSAGE("a new document does not protect record changes", !protectionValue);
// now activate recording
- uno::Any xValue;;
+ uno::Any xValue;
xValue <<= true;
xDocSettingsPropSet->setPropertyValue("RecordChanges", xValue);
@@ -72,8 +72,8 @@ void ScRecordChangesTest::testCheckRecordChangesProtection()
uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComponent, UNO_QUERY_THROW);
uno::Reference< beans::XPropertySet > xDocSettingsPropSet (xDoc, UNO_QUERY_THROW);
- bool recordChangesValue;
- bool protectionValue;
+ bool recordChangesValue = false;
+ bool protectionValue = false;
CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("RecordChanges") >>= recordChangesValue);
CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("IsRecordChangesProtected") >>= protectionValue);
@@ -82,7 +82,7 @@ void ScRecordChangesTest::testCheckRecordChangesProtection()
CPPUNIT_ASSERT_MESSAGE("the protection should be active", protectionValue);
// try to de-activate recording
- uno::Any xValue;;
+ uno::Any xValue;
xValue <<= false;
xDocSettingsPropSet->setPropertyValue("RecordChanges", xValue);
commit cb7b94bfcc6709ff3cf8fb98ca7a1a3768092b39
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 10:35:58 2015 +0900
refactor TableWindow, ColumnWindow to use RenderContext
Change-Id: I000ac253a57f9fdbb14c700e4a0163c3ba18a7bb
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index 36368ca..a36af3a 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -269,38 +269,41 @@ void TableWindow::MouseButtonUp( const MouseEvent& rMEvt )
-void TableWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& )
+void TableWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
- const long nSelectionWidth = mnTablePosX + nCol*mnTableCellWidth;
- const long nSelectionHeight = mnTablePosY + nLine*mnTableCellHeight;
+ const long nSelectionWidth = mnTablePosX + nCol * mnTableCellWidth;
+ const long nSelectionHeight = mnTablePosY + nLine * mnTableCellHeight;
// the non-selected parts of the table
- SetLineColor( aLineColor );
- SetFillColor( aFillColor );
- DrawRect( Rectangle( nSelectionWidth, mnTablePosY, mnTableWidth, nSelectionHeight ) );
- DrawRect( Rectangle( mnTablePosX, nSelectionHeight, nSelectionWidth, mnTableHeight ) );
- DrawRect( Rectangle( nSelectionWidth, nSelectionHeight, mnTableWidth, mnTableHeight ) );
+ rRenderContext.SetLineColor(aLineColor);
+ rRenderContext.SetFillColor(aFillColor);
+ rRenderContext.DrawRect(Rectangle(nSelectionWidth, mnTablePosY, mnTableWidth, nSelectionHeight));
+ rRenderContext.DrawRect(Rectangle(mnTablePosX, nSelectionHeight, nSelectionWidth, mnTableHeight));
+ rRenderContext.DrawRect(Rectangle(nSelectionWidth, nSelectionHeight, mnTableWidth, mnTableHeight));
// the selection
- if ( nCol > 0 && nLine > 0 )
+ if (nCol > 0 && nLine > 0)
{
- SetFillColor( aHighlightFillColor );
- DrawRect( Rectangle( mnTablePosX, mnTablePosY,
- nSelectionWidth, nSelectionHeight ) );
+ rRenderContext.SetFillColor(aHighlightFillColor);
+ rRenderContext.DrawRect(Rectangle(mnTablePosX, mnTablePosY, nSelectionWidth, nSelectionHeight));
}
// lines inside of the table
- SetLineColor( aLineColor );
- for ( long i = 1; i < TABLE_CELLS_VERT; ++i )
- DrawLine( Point( mnTablePosX, mnTablePosY + i*mnTableCellHeight ),
- Point( mnTableWidth, mnTablePosY + i*mnTableCellHeight ) );
+ rRenderContext.SetLineColor(aLineColor);
+ for (long i = 1; i < TABLE_CELLS_VERT; ++i)
+ {
+ rRenderContext.DrawLine(Point(mnTablePosX, mnTablePosY + i*mnTableCellHeight),
+ Point(mnTableWidth, mnTablePosY + i*mnTableCellHeight));
+ }
- for ( long i = 1; i < TABLE_CELLS_HORIZ; ++i )
- DrawLine( Point( mnTablePosX + i*mnTableCellWidth, mnTablePosY ),
- Point( mnTablePosX + i*mnTableCellWidth, mnTableHeight ) );
+ for (long i = 1; i < TABLE_CELLS_HORIZ; ++i)
+ {
+ rRenderContext.DrawLine(Point( mnTablePosX + i*mnTableCellWidth, mnTablePosY),
+ Point( mnTablePosX + i*mnTableCellWidth, mnTableHeight));
+ }
// the text near the mouse cursor telling the table dimensions
- if ( nCol && nLine )
+ if (nCol && nLine)
{
OUString aText;
aText += OUString::number( nCol );
@@ -312,28 +315,30 @@ void TableWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle
aText += SVX_RESSTR(RID_SVXSTR_PAGES);
}
- Size aTextSize( GetTextWidth( aText ), GetTextHeight() );
+ Size aTextSize(rRenderContext.GetTextWidth(aText), rRenderContext.GetTextHeight());
long nTextX = nSelectionWidth + mnTableCellWidth;
long nTextY = nSelectionHeight + mnTableCellHeight;
const long nTipBorder = 2;
- if ( aTextSize.Width() + mnTablePosX + mnTableCellWidth + 2*nTipBorder < nSelectionWidth )
+ if (aTextSize.Width() + mnTablePosX + mnTableCellWidth + 2 * nTipBorder < nSelectionWidth)
nTextX = nSelectionWidth - mnTableCellWidth - aTextSize.Width();
- if ( aTextSize.Height() + mnTablePosY + mnTableCellHeight + 2*nTipBorder < nSelectionHeight )
+ if (aTextSize.Height() + mnTablePosY + mnTableCellHeight + 2 * nTipBorder < nSelectionHeight)
nTextY = nSelectionHeight - mnTableCellHeight - aTextSize.Height();
- SetLineColor( aLineColor );
- SetFillColor( aBackgroundColor );
- DrawRect( Rectangle ( nTextX - 2*nTipBorder, nTextY - 2*nTipBorder,
- nTextX + aTextSize.Width() + nTipBorder, nTextY + aTextSize.Height() + nTipBorder ) );
+ rRenderContext.SetLineColor(aLineColor);
+ rRenderContext.SetFillColor(aBackgroundColor);
+ rRenderContext.DrawRect(Rectangle(nTextX - 2 * nTipBorder,
+ nTextY - 2 * nTipBorder,
+ nTextX + aTextSize.Width() + nTipBorder,
+ nTextY + aTextSize.Height() + nTipBorder));
// #i95350# force RTL output
- if ( IsRTLEnabled() )
+ if (IsRTLEnabled())
aText = OUString(0x202D) + aText;
- DrawText( Point( nTextX, nTextY ), aText );
+ rRenderContext.DrawText(Point(nTextX, nTextY), aText);
}
}
@@ -369,7 +374,7 @@ void TableWindow::Update( long nNewCol, long nNewLine )
{
nCol = nNewCol;
nLine = nNewLine;
- Invalidate( Rectangle( mnTablePosX, mnTablePosY, mnTableWidth, mnTableHeight ) );
+ Invalidate(Rectangle(mnTablePosX, mnTablePosY, mnTableWidth, mnTableHeight));
}
}
@@ -631,57 +636,63 @@ void ColumnsWindow::MouseButtonUp( const MouseEvent& rMEvt )
-void ColumnsWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& )
+void ColumnsWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
- long i;
- long nLineWidth;
- Size aSize = GetOutputSizePixel();
+ long i;
+ long nLineWidth;
+ Size aSize = rRenderContext.GetOutputSizePixel();
- for ( i = 0; i < nWidth; i++ )
+ for (i = 0; i < nWidth; i++)
{
- if ( i < nCol )
+ if (i < nCol)
{
- SetLineColor( aHighlightLineColor );
- SetFillColor( aHighlightFillColor );
+ rRenderContext.SetLineColor(aHighlightLineColor);
+ rRenderContext.SetFillColor(aHighlightFillColor);
}
else
{
- SetLineColor( aLineColor );
- SetFillColor( aFillColor );
+ rRenderContext.SetLineColor(aLineColor);
+ rRenderContext.SetFillColor(aFillColor);
}
- DrawRect( Rectangle( i*nMX-1, -1,
- i*nMX+nMX, aSize.Height()-nTextHeight+1 ) );
+ rRenderContext.DrawRect(Rectangle(i * nMX - 1, -1, i * nMX + nMX, aSize.Height() - nTextHeight + 1));
long j = 4;
- while ( j < aSize.Height()-nTextHeight-4 )
+ while (j < aSize.Height() - nTextHeight - 4)
{
- if ( !(j % 16) )
+ if (!(j % 16))
nLineWidth = 10;
else
nLineWidth = 4;
- DrawLine( Point( i*nMX+4, j ), Point( i*nMX+nMX-nLineWidth-4, j ) );
+ rRenderContext.DrawLine(Point(i * nMX + 4, j), Point(i * nMX + nMX - nLineWidth - 4, j));
j += 4;
}
}
- SetLineColor();
- SetFillColor( aFaceColor );
+ rRenderContext.SetLineColor();
+ rRenderContext.SetFillColor(aFaceColor);
OUString aText;
- if ( nCol )
+ if (nCol)
aText = OUString::number(nCol);
else
aText = comphelper::string::remove(Button::GetStandardText(StandardButtonType::Cancel), '~');
- Size aTextSize(GetTextWidth( aText ), GetTextHeight());
- DrawText( Point( ( aSize.Width() - aTextSize.Width() ) / 2, aSize.Height() - nTextHeight + 2 ), aText );
+ Size aTextSize(rRenderContext.GetTextWidth(aText), rRenderContext.GetTextHeight());
+ rRenderContext.DrawText(Point((aSize.Width() - aTextSize.Width()) / 2, aSize.Height() - nTextHeight + 2), aText);
+
+ rRenderContext.DrawRect(Rectangle(0,
+ aSize.Height() - nTextHeight + 2,
+ (aSize.Width() - aTextSize.Width()) / 2 - 1,
+ aSize.Height()));
- DrawRect( Rectangle( 0, aSize.Height()-nTextHeight+2, (aSize.Width()-aTextSize.Width())/2-1, aSize.Height() ) );
- DrawRect( Rectangle( (aSize.Width()-aTextSize.Width())/2+aTextSize.Width(), aSize.Height()-nTextHeight+2, aSize.Width(), aSize.Height() ) );
+ rRenderContext.DrawRect(Rectangle((aSize.Width() - aTextSize.Width()) / 2 + aTextSize.Width(),
+ aSize.Height() - nTextHeight + 2,
+ aSize.Width(),
+ aSize.Height()));
- SetLineColor( aLineColor );
- SetFillColor();
- DrawRect( Rectangle( 0, 0, aSize.Width() - 1, aSize.Height() - nTextHeight + 1 ) );
+ rRenderContext.SetLineColor(aLineColor);
+ rRenderContext.SetFillColor();
+ rRenderContext.DrawRect(Rectangle( 0, 0, aSize.Width() - 1, aSize.Height() - nTextHeight + 1));
}
commit 2a5ef299cecc56978dbd15fa4df8d145bae08d33
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 10:34:52 2015 +0900
refactor GalleryPreview to use RenderContext
Change-Id: I0fd307e0db532e9f49ecc0b1431ce59ba869b19d
diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx
index 1302046..cf03018 100644
--- a/svx/source/gallery2/galctrl.cxx
+++ b/svx/source/gallery2/galctrl.cxx
@@ -135,36 +135,38 @@ void GalleryPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle&
{
Window::Paint(rRenderContext, rRect);
- if( ImplGetGraphicCenterRect( aGraphicObj.GetGraphic(), aPreviewRect ) )
+ if (ImplGetGraphicCenterRect(aGraphicObj.GetGraphic(), aPreviewRect))
{
const Point aPos( aPreviewRect.TopLeft() );
const Size aSize( aPreviewRect.GetSize() );
if( aGraphicObj.IsAnimated() )
- aGraphicObj.StartAnimation( this, aPos, aSize );
+ aGraphicObj.StartAnimation(&rRenderContext, aPos, aSize);
else
- aGraphicObj.Draw( this, aPos, aSize );
+ aGraphicObj.Draw(&rRenderContext, aPos, aSize);
}
}
-void GalleryPreview::MouseButtonDown( const MouseEvent& rMEvt )
+void GalleryPreview::MouseButtonDown(const MouseEvent& rMEvt)
{
- if( mpTheme && ( rMEvt.GetClicks() == 2 ) )
- static_cast<GalleryBrowser2*>( GetParent() )->TogglePreview( this );
+ if (mpTheme && (rMEvt.GetClicks() == 2))
+ static_cast<GalleryBrowser2*>(GetParent())->TogglePreview(this);
}
-void GalleryPreview::Command(const CommandEvent& rCEvt )
+void GalleryPreview::Command(const CommandEvent& rCEvt)
{
- Window::Command( rCEvt );
+ Window::Command(rCEvt);
- if( mpTheme && ( rCEvt.GetCommand() == CommandEventId::ContextMenu ) )
- static_cast<GalleryBrowser2*>( GetParent() )->ShowContextMenu( this,
- ( rCEvt.IsMouseEvent() ? &rCEvt.GetMousePosPixel() : NULL ) );
+ if (mpTheme && (rCEvt.GetCommand() == CommandEventId::ContextMenu))
+ {
+ GalleryBrowser2* pGalleryBrowser = static_cast<GalleryBrowser2*>(GetParent());
+ pGalleryBrowser->ShowContextMenu(this, (rCEvt.IsMouseEvent() ? &rCEvt.GetMousePosPixel() : NULL));
+ }
}
-void GalleryPreview::KeyInput( const KeyEvent& rKEvt )
+void GalleryPreview::KeyInput(const KeyEvent& rKEvt)
{
- if( mpTheme )
+ if(mpTheme)
{
GalleryBrowser2* pBrowser = static_cast< GalleryBrowser2* >( GetParent() );
@@ -194,22 +196,24 @@ void GalleryPreview::KeyInput( const KeyEvent& rKEvt )
default:
{
- if( !pBrowser->KeyInput( rKEvt, this ) )
- Window::KeyInput( rKEvt );
+ if (!pBrowser->KeyInput(rKEvt, this))
+ Window::KeyInput(rKEvt);
}
break;
}
}
else
- Window::KeyInput( rKEvt );
+ {
+ Window::KeyInput(rKEvt);
+ }
}
sal_Int8 GalleryPreview::AcceptDrop( const AcceptDropEvent& rEvt )
{
sal_Int8 nRet;
- if( mpTheme )
- nRet = static_cast<GalleryBrowser2*>( GetParent() )->AcceptDrop( *this, rEvt );
+ if (mpTheme)
+ nRet = static_cast<GalleryBrowser2*>(GetParent())->AcceptDrop(*this, rEvt);
else
nRet = DND_ACTION_NONE;
@@ -220,8 +224,8 @@ sal_Int8 GalleryPreview::ExecuteDrop( const ExecuteDropEvent& rEvt )
{
sal_Int8 nRet;
- if( mpTheme )
- nRet = static_cast<GalleryBrowser2*>( GetParent() )->ExecuteDrop( *this, rEvt );
+ if (mpTheme)
+ nRet = static_cast<GalleryBrowser2*>(GetParent())->ExecuteDrop(*this, rEvt);
else
nRet = DND_ACTION_NONE;
@@ -230,32 +234,32 @@ sal_Int8 GalleryPreview::ExecuteDrop( const ExecuteDropEvent& rEvt )
void GalleryPreview::StartDrag( sal_Int8, const Point& )
{
- if( mpTheme )
- static_cast<GalleryBrowser2*>( GetParent() )->StartDrag( this );
+ if(mpTheme)
+ static_cast<GalleryBrowser2*>(GetParent())->StartDrag(this);
}
void GalleryPreview::PreviewMedia( const INetURLObject& rURL )
{
- if( rURL.GetProtocol() != INetProtocol::NotValid )
+ if (rURL.GetProtocol() != INetProtocol::NotValid)
{
::avmedia::MediaFloater* pFloater = avmedia::getMediaFloater();
- if( !pFloater )
+ if (!pFloater)
{
SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_AVMEDIA_PLAYER, SfxCallMode::SYNCHRON );
pFloater = avmedia::getMediaFloater();
}
- if( pFloater )
+ if (pFloater)
pFloater->setURL( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), "", true );
}
}
-void drawTransparenceBackground(OutputDevice& rOut, const Point& rPos, const Size& rSize)
+void drawTransparenceBackground(vcl::RenderContext& rOut, const Point& rPos, const Size& rSize)
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- if(rStyleSettings.GetPreviewUsesCheckeredBackground())
+ if (rStyleSettings.GetPreviewUsesCheckeredBackground())
{
// draw checkered background
static const sal_uInt32 nLen(8);
@@ -304,11 +308,11 @@ void GalleryIconView::DataChanged( const DataChangedEvent& rDCEvt )
ValueSet::DataChanged( rDCEvt );
}
-void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt )
+void GalleryIconView::UserDraw(const UserDrawEvent& rUDEvt)
{
const sal_uInt16 nId = rUDEvt.GetItemId();
- if( nId && mpTheme )
+ if (nId && mpTheme)
{
const Rectangle& rRect = rUDEvt.GetRect();
const Size aSize(rRect.GetWidth(), rRect.GetHeight());
@@ -321,17 +325,17 @@ void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt )
bool bNeedToCreate(aBitmapEx.IsEmpty());
- if(!bNeedToCreate && aItemTextTitle.isEmpty())
+ if (!bNeedToCreate && aItemTextTitle.isEmpty())
{
bNeedToCreate = true;
}
- if(!bNeedToCreate && aPreparedSize != aSize)
+ if (!bNeedToCreate && aPreparedSize != aSize)
{
bNeedToCreate = true;
}
- if(bNeedToCreate)
+ if (bNeedToCreate)
{
SgaObject* pObj = mpTheme->AcquireObject(nId - 1);
@@ -345,7 +349,7 @@ void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt )
}
}
- if(!aBitmapEx.IsEmpty())
+ if (!aBitmapEx.IsEmpty())
{
const Size aBitmapExSizePixel(aBitmapEx.GetSizePixel());
const Point aPos(
@@ -366,52 +370,51 @@ void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt )
}
}
-void GalleryIconView::MouseButtonDown( const MouseEvent& rMEvt )
+void GalleryIconView::MouseButtonDown(const MouseEvent& rMEvt)
{
- ValueSet::MouseButtonDown( rMEvt );
+ ValueSet::MouseButtonDown(rMEvt);
- if( rMEvt.GetClicks() == 2 )
- static_cast<GalleryBrowser2*>( GetParent() )->TogglePreview( this, &rMEvt.GetPosPixel() );
+ if (rMEvt.GetClicks() == 2)
+ static_cast<GalleryBrowser2*>(GetParent())->TogglePreview(this, &rMEvt.GetPosPixel());
}
-void GalleryIconView::Command( const CommandEvent& rCEvt )
+void GalleryIconView::Command(const CommandEvent& rCEvt)
{
- ValueSet::Command( rCEvt );
+ ValueSet::Command(rCEvt);
- if( rCEvt.GetCommand() == CommandEventId::ContextMenu )
+ if (rCEvt.GetCommand() == CommandEventId::ContextMenu)
{
- static_cast<GalleryBrowser2*>( GetParent() )->ShowContextMenu( this,
- ( rCEvt.IsMouseEvent() ? &rCEvt.GetMousePosPixel() : NULL ) );
+ GalleryBrowser2* pGalleryBrowser = static_cast<GalleryBrowser2*>(GetParent());
+ pGalleryBrowser->ShowContextMenu(this, (rCEvt.IsMouseEvent() ? &rCEvt.GetMousePosPixel() : nullptr));
}
}
-void GalleryIconView::KeyInput( const KeyEvent& rKEvt )
+void GalleryIconView::KeyInput(const KeyEvent& rKEvt)
{
- if( !mpTheme || !static_cast< GalleryBrowser2* >( GetParent() )->KeyInput( rKEvt, this ) )
- ValueSet::KeyInput( rKEvt );
+ if (!mpTheme || !static_cast<GalleryBrowser2*>(GetParent())->KeyInput(rKEvt, this))
+ ValueSet::KeyInput(rKEvt);
}
-sal_Int8 GalleryIconView::AcceptDrop( const AcceptDropEvent& rEvt )
+sal_Int8 GalleryIconView::AcceptDrop(const AcceptDropEvent& rEvt)
{
- return( static_cast< GalleryBrowser2* >( GetParent() )->AcceptDrop( *this, rEvt ) );
+ return(static_cast<GalleryBrowser2*>(GetParent())->AcceptDrop(*this, rEvt));
}
-sal_Int8 GalleryIconView::ExecuteDrop( const ExecuteDropEvent& rEvt )
+sal_Int8 GalleryIconView::ExecuteDrop(const ExecuteDropEvent& rEvt)
{
- return( static_cast< GalleryBrowser2* >( GetParent() )->ExecuteDrop( *this, rEvt ) );
+ return(static_cast<GalleryBrowser2*>(GetParent())->ExecuteDrop(*this, rEvt));
}
-void GalleryIconView::StartDrag( sal_Int8, const Point& )
+void GalleryIconView::StartDrag(sal_Int8, const Point&)
{
- const CommandEvent aEvt( GetPointerPosPixel(), CommandEventId::StartDrag, true );
- vcl::Region aRegion;
+ const CommandEvent aEvt(GetPointerPosPixel(), CommandEventId::StartDrag, true);
+ vcl::Region aRegion;
// call this to initiate dragging for ValueSet
- ValueSet::StartDrag( aEvt, aRegion );
- static_cast< GalleryBrowser2* >( GetParent() )->StartDrag( this );
+ ValueSet::StartDrag(aEvt, aRegion);
+ static_cast<GalleryBrowser2*>(GetParent())->StartDrag(this);
}
-
GalleryListView::GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme ) :
BrowseBox( pParent, WB_TABSTOP | WB_3DLOOK | WB_BORDER ),
mpTheme( pTheme ),
@@ -495,7 +498,7 @@ sal_Int32 GalleryListView::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColu
return nRet;
}
-void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 /*nColumnId*/ ) const
+void GalleryListView::PaintField(vcl::RenderContext& rDev, const Rectangle& rRect, sal_uInt16 /*nColumnId*/) const
{
rDev.Push( PushFlags::CLIPREGION );
rDev.IntersectClipRegion( rRect );
commit 7eb051447748e1a11648dfa63e9e038370bd095b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 10:32:42 2015 +0900
refactor PopupControl to use RenderContext
Change-Id: I3587cbe8a4025869422106b68c946981da1c6cb9
diff --git a/svx/source/sidebar/tools/PopupControl.cxx b/svx/source/sidebar/tools/PopupControl.cxx
index 4fc48ba..68b8bfa 100644
--- a/svx/source/sidebar/tools/PopupControl.cxx
+++ b/svx/source/sidebar/tools/PopupControl.cxx
@@ -35,15 +35,15 @@ PopupControl::PopupControl (
SetBackground(Theme::GetWallpaper(Theme::Paint_DropDownBackground));
}
-void PopupControl::Paint (vcl::RenderContext& rRenderContext, const Rectangle& rBox)
+void PopupControl::Paint (vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
- Control::Paint(rRenderContext, rBox);
+ Control::Paint(rRenderContext, rRect);
// The background is taken care of by setting the background color
// in the constructor. Here we just paint the border.
- SetFillColor();
- SetLineColor(Theme::GetColor(Theme::Color_DropDownBorder));
- DrawRect(Rectangle(Point(0,0), GetOutputSizePixel()));
+ rRenderContext.SetFillColor();
+ rRenderContext.SetLineColor(Theme::GetColor(Theme::Color_DropDownBorder));
+ rRenderContext.DrawRect(Rectangle(Point(0,0), GetOutputSizePixel()));
}
} } // end of namespace svx::sidebar
commit 571e597bc3c91f29c75d804028268255c282764d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 10:32:21 2015 +0900
refactor LineWidthControl to use RenderContext
Change-Id: I5ca1a367c4eba0a2f39c2aa9702e3d3bd5b2477f
diff --git a/svx/source/sidebar/line/LineWidthControl.cxx b/svx/source/sidebar/line/LineWidthControl.cxx
index f8b062e..6118293 100644
--- a/svx/source/sidebar/line/LineWidthControl.cxx
+++ b/svx/source/sidebar/line/LineWidthControl.cxx
@@ -83,27 +83,25 @@ void LineWidthControl::Paint(vcl::RenderContext& rRenderContext, const Rectangle
{
svx::sidebar::PopupControl::Paint(rRenderContext, rect);
- Color aOldLineColor = GetLineColor();
- Color aOldFillColor = GetFillColor();
+ rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR);
- Point aPos( LogicToPixel( Point( CUSTOM_X, CUSTOM_Y), MAP_APPFONT ));
- Size aSize( LogicToPixel( Size( CUSTOM_W, CUSTOM_H ), MAP_APPFONT ));
- Rectangle aRect( aPos, aSize );
+ Point aPos(rRenderContext.LogicToPixel(Point(CUSTOM_X, CUSTOM_Y), MAP_APPFONT));
+ Size aSize(rRenderContext.LogicToPixel(Size(CUSTOM_W, CUSTOM_H), MAP_APPFONT));
+ Rectangle aRect(aPos, aSize);
aRect.Left() -= 1;
aRect.Top() -= 1;
aRect.Right() += 1;
aRect.Bottom() += 1;
- Color aLineColor(189,201,219);
- if(!GetSettings().GetStyleSettings().GetHighContrastMode())
- SetLineColor(aLineColor);
+ Color aLineColor(189, 201, 219);
+ if (!GetSettings().GetStyleSettings().GetHighContrastMode())
+ rRenderContext.SetLineColor(aLineColor);
else
- SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
- SetFillColor(COL_TRANSPARENT);
- DrawRect(aRect);
+ rRenderContext.SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
+ rRenderContext.SetFillColor(COL_TRANSPARENT);
+ rRenderContext.DrawRect(aRect);
- SetLineColor(aOldLineColor);
- SetFillColor(aOldFillColor);
+ rRenderContext.Pop();
}
diff --git a/svx/source/sidebar/line/LineWidthControl.hxx b/svx/source/sidebar/line/LineWidthControl.hxx
index a1f5e43..0b14574 100644
--- a/svx/source/sidebar/line/LineWidthControl.hxx
+++ b/svx/source/sidebar/line/LineWidthControl.hxx
@@ -32,8 +32,7 @@ namespace svx { namespace sidebar {
class LinePropertyPanel;
-class LineWidthControl
- : public svx::sidebar::PopupControl
+class LineWidthControl : public svx::sidebar::PopupControl
{
public:
LineWidthControl (vcl::Window* pParent, LinePropertyPanel& rPanel);
@@ -41,30 +40,36 @@ public:
virtual void dispose() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
- virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rect) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& aRect) SAL_OVERRIDE;
void SetWidthSelect( long lValue, bool bValuable, SfxMapUnit eMapUnit);
- bool IsCloseByEdit() { return mbCloseByEdit;}
- long GetTmpCustomWidth() { return mnTmpCustomWidth;}
+ bool IsCloseByEdit()
+ {
+ return mbCloseByEdit;
+ }
+ long GetTmpCustomWidth()
+ {
+ return mnTmpCustomWidth;
+ }
private:
- LinePropertyPanel& mrLinePropertyPanel;
- SfxBindings* mpBindings;
- VclPtr<LineWidthValueSet> maVSWidth;
- VclPtr<FixedText> maFTCus;
- VclPtr<FixedText> maFTWidth;
- VclPtr<MetricField> maMFWidth;
- SfxMapUnit meMapUnit;
- OUString* rStr;
- OUString mstrPT;
- long mnCustomWidth;
- bool mbCustom;
- bool mbCloseByEdit;
- long mnTmpCustomWidth;
- bool mbVSFocus;
+ LinePropertyPanel& mrLinePropertyPanel;
+ SfxBindings* mpBindings;
+ VclPtr<LineWidthValueSet> maVSWidth;
+ VclPtr<FixedText> maFTCus;
+ VclPtr<FixedText> maFTWidth;
+ VclPtr<MetricField> maMFWidth;
+ SfxMapUnit meMapUnit;
+ OUString* rStr;
+ OUString mstrPT;
+ long mnCustomWidth;
+ bool mbCustom;
+ bool mbCloseByEdit;
+ long mnTmpCustomWidth;
+ bool mbVSFocus;
- Image maIMGCus;
- Image maIMGCusGray;
+ Image maIMGCus;
+ Image maIMGCusGray;
void Initialize();
DECL_LINK(VSSelectHdl, void *);
commit 6e4349411eea331e018c96952da8b6e49c469042
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 10:31:39 2015 +0900
refactor SvxRubyChildWindow to use RenderContext
Change-Id: Ia60e0027cc915fda68ee10dee25c78a84a5d7945
diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx
index 9fcc007..b22e5f8 100644
--- a/svx/source/dialog/rubydialog.cxx
+++ b/svx/source/dialog/rubydialog.cxx
@@ -41,16 +41,19 @@
#include <vcl/settings.hxx>
#include <vcl/builderfactory.hxx>
-using namespace com::sun::star::uno;
-using namespace com::sun::star::frame;
-using namespace com::sun::star::text;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::style;
-using namespace com::sun::star::view;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::container;
+using namespace css::uno;
+using namespace css::frame;
+using namespace css::text;
+using namespace css::beans;
+using namespace css::style;
+using namespace css::view;
+using namespace css::lang;
+using namespace css::container;
-SFX_IMPL_CHILDWINDOW( SvxRubyChildWindow, SID_RUBY_DIALOG );
+SFX_IMPL_CHILDWINDOW(SvxRubyChildWindow, SID_RUBY_DIALOG);
+
+namespace
+{
static const sal_Char cRubyBaseText[] = "RubyBaseText";
static const sal_Char cRubyText[] = "RubyText";
@@ -61,19 +64,20 @@ static const sal_Char cDisplayName[] = "DisplayName";
static const sal_Char cRubyCharStyleName[] = "RubyCharStyleName";
static const sal_Char cRubies[] = "Rubies";
-SvxRubyChildWindow::SvxRubyChildWindow( vcl::Window* _pParent, sal_uInt16 nId,
- SfxBindings* pBindings, SfxChildWinInfo* pInfo) :
- SfxChildWindow(_pParent, nId)
+} // end anonymous namespace
+
+SvxRubyChildWindow::SvxRubyChildWindow(vcl::Window* _pParent, sal_uInt16 nId,SfxBindings* pBindings, SfxChildWinInfo* pInfo)
+ : SfxChildWindow(_pParent, nId)
{
VclPtr<SvxRubyDialog> pDlg = VclPtr<SvxRubyDialog>::Create(pBindings, this, _pParent);
pWindow = pDlg;
- if ( pInfo->nFlags & SfxChildWindowFlags::ZOOMIN )
+ if (pInfo->nFlags & SfxChildWindowFlags::ZOOMIN)
pDlg->RollUp();
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
- pDlg->Initialize( pInfo );
+ pDlg->Initialize(pInfo);
}
SfxChildWinInfo SvxRubyChildWindow::GetInfo() const
@@ -81,51 +85,59 @@ SfxChildWinInfo SvxRubyChildWindow::GetInfo() const
return SfxChildWindow::GetInfo();
}
-class SvxRubyData_Impl : public cppu::WeakImplHelper1
- < ::com::sun::star::view::XSelectionChangeListener >
-{
- Reference<XModel> xModel;
- Reference<XRubySelection> xSelection;
- Sequence<PropertyValues> aRubyValues;
- Reference<XController> xController;
- bool bHasSelectionChanged;
- public:
- SvxRubyData_Impl();
- virtual ~SvxRubyData_Impl();
-
- void SetController(Reference<XController> xCtrl);
- Reference<XModel> GetModel()
- {
- if(!xController.is())
- xModel = 0;
- else
- xModel = xController->getModel();
- return xModel;
- }
- bool HasSelectionChanged() const{return bHasSelectionChanged;}
- Reference<XRubySelection> GetRubySelection()
- {
- xSelection = Reference<XRubySelection>(xController, UNO_QUERY);
- return xSelection;
- }
- void UpdateRubyValues()
- {
- if(!xSelection.is())
- aRubyValues.realloc(0);
- else
- aRubyValues = xSelection->getRubyList(false);
- bHasSelectionChanged = false;
- }
- Sequence<PropertyValues>& GetRubyValues() {return aRubyValues;}
- void AssertOneEntry();
-
- virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
+class SvxRubyData_Impl : public cppu::WeakImplHelper1<css::view::XSelectionChangeListener>
+{
+ Reference<XModel> xModel;
+ Reference<XRubySelection> xSelection;
+ Sequence<PropertyValues> aRubyValues;
+ Reference<XController> xController;
+ bool bHasSelectionChanged;
+
+public:
+ SvxRubyData_Impl();
+ virtual ~SvxRubyData_Impl();
+
+ void SetController(Reference<XController> xCtrl);
+ Reference<XModel> GetModel()
+ {
+ if (!xController.is())
+ xModel = 0;
+ else
+ xModel = xController->getModel();
+ return xModel;
+ }
+ bool HasSelectionChanged() const
+ {
+ return bHasSelectionChanged;
+ }
+ Reference<XRubySelection> GetRubySelection()
+ {
+ xSelection = Reference<XRubySelection>(xController, UNO_QUERY);
+ return xSelection;
+ }
+ void UpdateRubyValues()
+ {
+ if (!xSelection.is())
+ aRubyValues.realloc(0);
+ else
+ aRubyValues = xSelection->getRubyList(false);
+ bHasSelectionChanged = false;
+ }
+ Sequence<PropertyValues>& GetRubyValues()
+ {
+ return aRubyValues;
+ }
+ void AssertOneEntry();
+
+ virtual void SAL_CALL selectionChanged(const css::lang::EventObject& aEvent)
+ throw (RuntimeException, std::exception) SAL_OVERRIDE;
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source)
+ throw (RuntimeException, std::exception) SAL_OVERRIDE;
};
-SvxRubyData_Impl::SvxRubyData_Impl() :
- bHasSelectionChanged(false)
+SvxRubyData_Impl::SvxRubyData_Impl()
+ : bHasSelectionChanged(false)
{
}
@@ -133,20 +145,20 @@ SvxRubyData_Impl::~SvxRubyData_Impl()
{
}
-void SvxRubyData_Impl::SetController(Reference<XController> xCtrl)
+void SvxRubyData_Impl::SetController(Reference<XController> xCtrl)
{
- if(xCtrl.get() != xController.get())
+ if (xCtrl.get() != xController.get())
{
try
{
Reference<XSelectionSupplier> xSelSupp(xController, UNO_QUERY);
- if(xSelSupp.is())
+ if (xSelSupp.is())
xSelSupp->removeSelectionChangeListener(this);
bHasSelectionChanged = true;
xController = xCtrl;
xSelSupp = Reference<XSelectionSupplier>(xController, UNO_QUERY);
- if(xSelSupp.is())
+ if (xSelSupp.is())
xSelSupp->addSelectionChangeListener(this);
}
catch (const Exception&)
@@ -155,17 +167,17 @@ void SvxRubyData_Impl::SetController(Reference<XController> xCtrl)
}
}
-void SvxRubyData_Impl::selectionChanged( const EventObject& ) throw (RuntimeException, std::exception)
+void SvxRubyData_Impl::selectionChanged(const EventObject& ) throw (RuntimeException, std::exception)
{
bHasSelectionChanged = true;
}
-void SvxRubyData_Impl::disposing( const EventObject&) throw (RuntimeException, std::exception)
+void SvxRubyData_Impl::disposing(const EventObject&) throw (RuntimeException, std::exception)
{
try
{
Reference<XSelectionSupplier> xSelSupp(xController, UNO_QUERY);
- if(xSelSupp.is())
+ if (xSelSupp.is())
xSelSupp->removeSelectionChangeListener(this);
}
catch (const Exception&)
@@ -174,10 +186,10 @@ void SvxRubyData_Impl::disposing( const EventObject&) throw (RuntimeException, s
xController = 0;
}
-void SvxRubyData_Impl::AssertOneEntry()
+void SvxRubyData_Impl::AssertOneEntry()
{
//create one entry
- if(!aRubyValues.getLength())
+ if (!aRubyValues.getLength())
{
aRubyValues.realloc(1);
Sequence<PropertyValue>& rValues = aRubyValues.getArray()[0];
@@ -191,10 +203,8 @@ void SvxRubyData_Impl::AssertOneEntry()
}
}
-SvxRubyDialog::SvxRubyDialog(SfxBindings *pBind, SfxChildWindow *pCW,
- vcl::Window* _pParent)
- : SfxModelessDialog(pBind, pCW, _pParent, "AsianPhoneticGuideDialog",
- "svx/ui/asianphoneticguidedialog.ui")
+SvxRubyDialog::SvxRubyDialog(SfxBindings* pBind, SfxChildWindow* pCW, vcl::Window* _pParent)
+ : SfxModelessDialog(pBind, pCW, _pParent, "AsianPhoneticGuideDialog", "svx/ui/asianphoneticguidedialog.ui")
, nLastPos(0)
, nCurrentEdit(0)
, bModified(false)
@@ -237,17 +247,17 @@ SvxRubyDialog::SvxRubyDialog(SfxBindings *pBind, SfxChildWindow *pCW,
m_pCharStyleLB->SetSelectHdl(LINK(this, SvxRubyDialog, CharStyleHdl_Impl));
Link<> aScrLk(LINK(this, SvxRubyDialog, ScrollHdl_Impl));
- m_pScrollSB->SetScrollHdl( aScrLk );
- m_pScrollSB->SetEndScrollHdl( aScrLk );
+ m_pScrollSB->SetScrollHdl(aScrLk);
+ m_pScrollSB->SetEndScrollHdl(aScrLk);
Link<> aEditLk(LINK(this, SvxRubyDialog, EditModifyHdl_Impl));
Link<> aScrollLk(LINK(this, SvxRubyDialog, EditScrollHdl_Impl));
Link<> aJumpLk(LINK(this, SvxRubyDialog, EditJumpHdl_Impl));
- for(sal_uInt16 i = 0; i < 8; i++)
+ for (sal_uInt16 i = 0; i < 8; i++)
{
aEditArr[i]->SetModifyHdl(aEditLk);
aEditArr[i]->SetJumpHdl(aJumpLk);
- if(!i || 7 == i)
+ if (!i || 7 == i)
aEditArr[i]->SetScrollHdl(aScrollLk);
}
@@ -282,7 +292,7 @@ void SvxRubyDialog::dispose()
m_pRight3ED.clear();
m_pLeft4ED.clear();
m_pRight4ED.clear();
- for (int i=0; i<7; i++)
+ for (int i = 0; i < 7; i++)
aEditArr[i].clear();
m_pScrolledWindow.clear();
m_pScrollSB.clear();
@@ -299,7 +309,7 @@ void SvxRubyDialog::dispose()
void SvxRubyDialog::ClearCharStyleList()
{
- for(sal_uInt16 i = 0; i < m_pCharStyleLB->GetEntryCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pCharStyleLB->GetEntryCount(); i++)
{
void* pData = m_pCharStyleLB->GetEntryData(i);
delete static_cast<OUString*>(pData);
@@ -307,7 +317,7 @@ void SvxRubyDialog::ClearCharStyleList()
m_pCharStyleLB->Clear();
}
-bool SvxRubyDialog::Close()
+bool SvxRubyDialog::Close()
{
pBindings->GetDispatcher()->Execute( SID_RUBY_DIALOG,
SfxCallMode::ASYNCHRON |
@@ -327,19 +337,19 @@ void SvxRubyDialog::Activate()
SfxViewFrame* pCurFrm = SfxViewFrame::Current();
Reference< XController > xCtrl = pCurFrm->GetFrame().GetController();
pImpl->SetController(xCtrl);
- if(pImpl->HasSelectionChanged())
+ if (pImpl->HasSelectionChanged())
{
Reference< XRubySelection > xRubySel = pImpl->GetRubySelection();
pImpl->UpdateRubyValues();
EnableControls(xRubySel.is());
- if(xRubySel.is())
+ if (xRubySel.is())
{
Reference< XModel > xModel = pImpl->GetModel();
const OUString sCharStyleSelect = m_pCharStyleLB->GetSelectEntry();
ClearCharStyleList();
Reference<XStyleFamiliesSupplier> xSupplier(xModel, UNO_QUERY);
- if(xSupplier.is())
+ if (xSupplier.is())
{
try
{
@@ -348,32 +358,32 @@ void SvxRubyDialog::Activate()
Reference<XNameContainer> xChar;
aChar >>= xChar;
Reference<XIndexAccess> xCharIdx(xChar, UNO_QUERY);
- if(xCharIdx.is())
+ if (xCharIdx.is())
{
OUString sUIName(cDisplayName);
- for(sal_Int32 nStyle = 0; nStyle < xCharIdx->getCount(); nStyle++)
+ for (sal_Int32 nStyle = 0; nStyle < xCharIdx->getCount(); nStyle++)
{
Any aStyle = xCharIdx->getByIndex(nStyle);
Reference<XStyle> xStyle;
aStyle >>= xStyle;
Reference<XPropertySet> xPrSet(xStyle, UNO_QUERY);
OUString sName, sCoreName;
- if(xPrSet.is())
+ if (xPrSet.is())
{
Reference<XPropertySetInfo> xInfo = xPrSet->getPropertySetInfo();
- if(xInfo->hasPropertyByName(sUIName))
+ if (xInfo->hasPropertyByName(sUIName))
{
Any aName = xPrSet->getPropertyValue(sUIName);
aName >>= sName;
}
}
- if(xStyle.is())
+ if (xStyle.is())
{
sCoreName = xStyle->getName();
- if(sName.isEmpty())
+ if (sName.isEmpty())
sName = sCoreName;
}
- if(!sName.isEmpty())
+ if (!sName.isEmpty())
{
sal_uInt16 nPos = m_pCharStyleLB->InsertEntry(sName);
m_pCharStyleLB->SetEntryData( nPos, new OUString(sCoreName) );
@@ -397,7 +407,7 @@ void SvxRubyDialog::Activate()
}
}
-void SvxRubyDialog::Deactivate()
+void SvxRubyDialog::Deactivate()
{
SfxModelessDialog::Deactivate();
}
@@ -407,20 +417,22 @@ void SvxRubyDialog::SetRubyText(sal_Int32 nPos, Edit& rLeft, Edit& rRight)
OUString sLeft, sRight;
const Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
bool bEnable = aRubyValues.getLength() > nPos;
- if(bEnable)
+ if (bEnable)
{
const Sequence<PropertyValue> aProps = aRubyValues.getConstArray()[nPos];
const PropertyValue* pProps = aProps.getConstArray();
- for(sal_Int32 nProp = 0; nProp < aProps.getLength(); nProp++)
+ for (sal_Int32 nProp = 0; nProp < aProps.getLength(); nProp++)
{
- if ( pProps[nProp].Name == cRubyBaseText )
+ if (pProps[nProp].Name == cRubyBaseText)
pProps[nProp].Value >>= sLeft;
- else if ( pProps[nProp].Name == cRubyText )
+ else if (pProps[nProp].Name == cRubyText)
pProps[nProp].Value >>= sRight;
}
}
- else if(!nPos)
+ else if (!nPos)
+ {
bEnable = true;
+ }
rLeft.Enable(bEnable);
rRight.Enable(bEnable);
rLeft.SetText(sLeft);
@@ -432,22 +444,21 @@ void SvxRubyDialog::SetRubyText(sal_Int32 nPos, Edit& rLeft, Edit& rRight)
void SvxRubyDialog::GetRubyText()
{
long nTempLastPos = GetLastPos();
- for(int i = 0; i < 8; i+=2)
+ for (int i = 0; i < 8; i+=2)
{
- if(aEditArr[i]->IsEnabled() &&
- (aEditArr[i]->IsValueChangedFromSaved() ||
- aEditArr[i + 1]->IsValueChangedFromSaved()))
+ if (aEditArr[i]->IsEnabled() &&
+ (aEditArr[i]->IsValueChangedFromSaved() || aEditArr[i + 1]->IsValueChangedFromSaved()))
{
Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
DBG_ASSERT(aRubyValues.getLength() > (i / 2 + nTempLastPos), "wrong index" );
SetModified(true);
- Sequence<PropertyValue> &rProps = aRubyValues.getArray()[i / 2 + nTempLastPos];
+ Sequence<PropertyValue>& rProps = aRubyValues.getArray()[i / 2 + nTempLastPos];
PropertyValue* pProps = rProps.getArray();
- for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ for (sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
{
- if ( pProps[nProp].Name == cRubyBaseText )
+ if (pProps[nProp].Name == cRubyBaseText)
pProps[nProp].Value <<= OUString(aEditArr[i]->GetText());
- else if ( pProps[nProp].Name == cRubyText )
+ else if (pProps[nProp].Name == cRubyText)
pProps[nProp].Value <<= OUString(aEditArr[i + 1]->GetText());
}
}
@@ -468,59 +479,59 @@ void SvxRubyDialog::Update()
sal_Int16 nPosition = -1;
OUString sCharStyleName, sTmp;
bool bCharStyleEqual = true;
- for(sal_Int32 nRuby = 0; nRuby < nLen; nRuby++)
+ for (sal_Int32 nRuby = 0; nRuby < nLen; nRuby++)
{
const Sequence<PropertyValue> &rProps = aRubyValues.getConstArray()[nRuby];
const PropertyValue* pProps = rProps.getConstArray();
- for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ for (sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
{
- if(nAdjust > -2 && pProps[nProp].Name == cRubyAdjust )
+ if (nAdjust > -2 && pProps[nProp].Name == cRubyAdjust)
{
sal_Int16 nTmp = sal_Int16();
pProps[nProp].Value >>= nTmp;
- if(!nRuby)
+ if (!nRuby)
nAdjust = nTmp;
else if(nAdjust != nTmp)
nAdjust = -2;
}
- if(nPosition > -2 && pProps[nProp].Name == cRubyIsAbove )
+ if (nPosition > -2 && pProps[nProp].Name == cRubyIsAbove)
{
bool bTmp = *static_cast<sal_Bool const *>(pProps[nProp].Value.getValue());
- if(!nRuby)
+ if (!nRuby)
nPosition = bTmp ? 0 : 1;
- else if( (!nPosition && !bTmp) || (nPosition == 1 && bTmp) )
+ else if ((!nPosition && !bTmp) || (nPosition == 1 && bTmp))
nPosition = -2;
}
- if(bCharStyleEqual && pProps[nProp].Name == cRubyCharStyleName )
+ if (bCharStyleEqual && pProps[nProp].Name == cRubyCharStyleName)
{
pProps[nProp].Value >>= sTmp;
- if(!nRuby)
+ if (!nRuby)
sCharStyleName = sTmp;
- else if(sCharStyleName != sTmp)
+ else if (sCharStyleName != sTmp)
bCharStyleEqual = false;
}
}
}
- if(!nLen)
+ if (!nLen)
{
//enable selection if the ruby list is empty
nAdjust = 0;
nPosition = 0;
}
- if(nAdjust > -1)
+ if (nAdjust > -1)
m_pAdjustLB->SelectEntryPos(nAdjust);
else
m_pAdjustLB->SetNoSelection();
- if(nPosition > -1)
+ if (nPosition > -1)
m_pPositionLB->SelectEntryPos(nPosition ? 1 : 0);
- if(!nLen || (bCharStyleEqual && sCharStyleName.isEmpty()))
+ if (!nLen || (bCharStyleEqual && sCharStyleName.isEmpty()))
sCharStyleName = cRubies;
- if(!sCharStyleName.isEmpty())
+ if (!sCharStyleName.isEmpty())
{
- for(sal_uInt16 i = 0; i < m_pCharStyleLB->GetEntryCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pCharStyleLB->GetEntryCount(); i++)
{
const OUString* pCoreName = static_cast<const OUString*>(m_pCharStyleLB->GetEntryData(i));
- if(pCoreName && sCharStyleName == *pCoreName)
+ if (pCoreName && sCharStyleName == *pCoreName)
{
m_pCharStyleLB->SelectEntryPos(i);
break;
@@ -533,7 +544,7 @@ void SvxRubyDialog::Update()
ScrollHdl_Impl(m_pScrollSB);
}
-void SvxRubyDialog::GetCurrentText(OUString& rBase, OUString& rRuby)
+void SvxRubyDialog::GetCurrentText(OUString& rBase, OUString& rRuby)
{
rBase = aEditArr[nCurrentEdit * 2]->GetText();
rRuby = aEditArr[nCurrentEdit * 2 + 1]->GetText();
@@ -542,7 +553,7 @@ void SvxRubyDialog::GetCurrentText(OUString& rBase, OUString& rRuby)
IMPL_LINK(SvxRubyDialog, ScrollHdl_Impl, ScrollBar*, pScroll)
{
long nPos = pScroll->GetThumbPos();
- if(GetLastPos() != nPos)
+ if (GetLastPos() != nPos)
{
GetRubyText();
}
@@ -557,8 +568,8 @@ IMPL_LINK(SvxRubyDialog, ScrollHdl_Impl, ScrollBar*, pScroll)
IMPL_LINK_NOARG(SvxRubyDialog, ApplyHdl_Impl)
{
- const Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
- if(!aRubyValues.getLength())
+ const Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ if (!aRubyValues.getLength())
{
AssertOneEntry();
PositionHdl_Impl(m_pPositionLB);
@@ -569,8 +580,8 @@ IMPL_LINK_NOARG(SvxRubyDialog, ApplyHdl_Impl)
//reset all edit fields - SaveValue is called
ScrollHdl_Impl(m_pScrollSB);
- Reference<XRubySelection> xSelection = pImpl->GetRubySelection();
- if(IsModified() && xSelection.is())
+ Reference<XRubySelection> xSelection = pImpl->GetRubySelection();
+ if (IsModified() && xSelection.is())
{
try
{
@@ -592,13 +603,12 @@ IMPL_LINK_NOARG(SvxRubyDialog, CloseHdl_Impl)
IMPL_LINK_NOARG(SvxRubyDialog, StylistHdl_Impl)
{
- SfxPoolItem* pState = 0;
- SfxItemState eState = pBindings->QueryState( SID_STYLE_DESIGNER, pState );
- if(eState <= SfxItemState::SET || !pState || !static_cast<SfxBoolItem*>(pState)->GetValue())
+ SfxPoolItem* pState = nullptr;
+ SfxItemState eState = pBindings->QueryState(SID_STYLE_DESIGNER, pState);
+ if (eState <= SfxItemState::SET || !pState || !static_cast<SfxBoolItem*>(pState)->GetValue())
{
- pBindings->GetDispatcher()->Execute( SID_STYLE_DESIGNER,
- SfxCallMode::ASYNCHRON |
- SfxCallMode::RECORD);
+ pBindings->GetDispatcher()->Execute(SID_STYLE_DESIGNER,
+ SfxCallMode::ASYNCHRON | SfxCallMode::RECORD);
}
delete pState;
return 0;
@@ -609,13 +619,13 @@ IMPL_LINK(SvxRubyDialog, AdjustHdl_Impl, ListBox*, pBox)
AssertOneEntry();
sal_Int16 nAdjust = pBox->GetSelectEntryPos();
Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
- for(sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++)
+ for (sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++)
{
Sequence<PropertyValue> &rProps = aRubyValues.getArray()[nRuby];
PropertyValue* pProps = rProps.getArray();
- for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ for (sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
{
- if ( pProps[nProp].Name == cRubyAdjust )
+ if (pProps[nProp].Name == cRubyAdjust)
pProps[nProp].Value <<= nAdjust;
}
SetModified(true);
@@ -630,13 +640,13 @@ IMPL_LINK(SvxRubyDialog, PositionHdl_Impl, ListBox*, pBox)
sal_Bool bAbove = !pBox->GetSelectEntryPos();
const Type& rType = cppu::UnoType<bool>::get();
Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
- for(sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++)
+ for (sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++)
{
Sequence<PropertyValue> &rProps = aRubyValues.getArray()[nRuby];
PropertyValue* pProps = rProps.getArray();
- for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ for (sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
{
- if ( pProps[nProp].Name == cRubyIsAbove )
+ if (pProps[nProp].Name == cRubyIsAbove)
pProps[nProp].Value.setValue(&bAbove, rType);
}
SetModified(true);
@@ -649,16 +659,16 @@ IMPL_LINK_NOARG(SvxRubyDialog, CharStyleHdl_Impl)
{
AssertOneEntry();
OUString sStyleName;
- if(LISTBOX_ENTRY_NOTFOUND != m_pCharStyleLB->GetSelectEntryPos())
+ if (LISTBOX_ENTRY_NOTFOUND != m_pCharStyleLB->GetSelectEntryPos())
sStyleName = *static_cast<OUString*>(m_pCharStyleLB->GetSelectEntryData());
Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
- for(sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++)
+ for (sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++)
{
Sequence<PropertyValue> &rProps = aRubyValues.getArray()[nRuby];
PropertyValue* pProps = rProps.getArray();
- for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ for (sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
{
- if ( pProps[nProp].Name == cRubyCharStyleName )
+ if (pProps[nProp].Name == cRubyCharStyleName)
{
pProps[nProp].Value <<= sStyleName;
}
@@ -670,9 +680,9 @@ IMPL_LINK_NOARG(SvxRubyDialog, CharStyleHdl_Impl)
IMPL_LINK(SvxRubyDialog, EditModifyHdl_Impl, Edit*, pEdit)
{
- for(sal_uInt16 i = 0; i < 8; i++)
+ for (sal_uInt16 i = 0; i < 8; i++)
{
- if(pEdit == aEditArr[i])
+ if (pEdit == aEditArr[i])
{
nCurrentEdit = i / 2;
break;
@@ -685,12 +695,12 @@ IMPL_LINK(SvxRubyDialog, EditModifyHdl_Impl, Edit*, pEdit)
IMPL_LINK(SvxRubyDialog, EditScrollHdl_Impl, sal_Int32*, pParam)
{
long nRet = 0;
- if(m_pScrollSB->IsEnabled())
+ if (m_pScrollSB->IsEnabled())
{
//scroll forward
- if(*pParam > 0 && (aEditArr[7]->HasFocus() || aEditArr[6]->HasFocus() ))
+ if (*pParam > 0 && (aEditArr[7]->HasFocus() || aEditArr[6]->HasFocus() ))
{
- if(m_pScrollSB->GetRangeMax() > m_pScrollSB->GetThumbPos())
+ if (m_pScrollSB->GetRangeMax() > m_pScrollSB->GetThumbPos())
{
m_pScrollSB->SetThumbPos(m_pScrollSB->GetThumbPos() + 1);
aEditArr[6]->GrabFocus();
@@ -698,13 +708,13 @@ IMPL_LINK(SvxRubyDialog, EditScrollHdl_Impl, sal_Int32*, pParam)
}
}
//scroll backward
- else if(m_pScrollSB->GetThumbPos() && (aEditArr[0]->HasFocus()||aEditArr[1]->HasFocus()) )
+ else if (m_pScrollSB->GetThumbPos() && (aEditArr[0]->HasFocus()||aEditArr[1]->HasFocus()) )
{
m_pScrollSB->SetThumbPos(m_pScrollSB->GetThumbPos() - 1);
aEditArr[1]->GrabFocus();
nRet = 1;
}
- if(nRet)
+ if (nRet)
ScrollHdl_Impl(m_pScrollSB);
}
return nRet;
@@ -713,23 +723,23 @@ IMPL_LINK(SvxRubyDialog, EditScrollHdl_Impl, sal_Int32*, pParam)
IMPL_LINK(SvxRubyDialog, EditJumpHdl_Impl, sal_Int32*, pParam)
{
sal_uInt16 nIndex = USHRT_MAX;
- for(sal_uInt16 i = 0; i < 8; i++)
+ for (sal_uInt16 i = 0; i < 8; i++)
{
if(aEditArr[i]->HasFocus())
nIndex = i;
}
- if(nIndex < 8)
+ if (nIndex < 8)
{
- if(*pParam > 0)
+ if (*pParam > 0)
{
- if(nIndex < 6)
+ if (nIndex < 6)
aEditArr[nIndex + 2]->GrabFocus();
else if( EditScrollHdl_Impl(pParam))
aEditArr[nIndex]->GrabFocus();
}
else
{
- if(nIndex > 1)
+ if (nIndex > 1)
aEditArr[nIndex - 2]->GrabFocus();
else if( EditScrollHdl_Impl(pParam))
aEditArr[nIndex]->GrabFocus();
@@ -743,36 +753,32 @@ void SvxRubyDialog::AssertOneEntry()
pImpl->AssertOneEntry();
}
-
-
void SvxRubyDialog::UpdateColors()
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- svtools::ColorConfig aColorConfig;
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ svtools::ColorConfig aColorConfig;
- vcl::Font aFnt( m_pPreviewWin->GetFont() );
+ vcl::Font aFont(m_pPreviewWin->GetFont());
- Color aNewTextCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
- Color aNewFillCol( rStyleSettings.GetWindowColor() );
+ Color aNewTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
+ Color aNewFillColor(rStyleSettings.GetWindowColor());
- if( aNewFillCol != aFnt.GetFillColor() || aNewTextCol != aFnt.GetColor() )
+ if (aNewFillColor != aFont.GetFillColor() || aNewTextColor != aFont.GetColor())
{
- aFnt.SetFillColor( aNewFillCol );
- aFnt.SetColor( aNewTextCol );
- m_pPreviewWin->SetFont( aFnt );
-
- m_pPreviewWin->Invalidate();
+ aFont.SetFillColor(aNewFillColor);
+ aFont.SetColor(aNewTextColor);
+ m_pPreviewWin->SetFont(aFont);
}
}
-
-
void SvxRubyDialog::DataChanged( const DataChangedEvent& rDCEvt )
{
SfxModelessDialog::DataChanged( rDCEvt );
- if( ( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) && ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ) )
+ if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
+ {
UpdateColors();
+ }
}
void SvxRubyDialog::EnableControls(bool bEnable)
@@ -785,8 +791,7 @@ RubyPreview::RubyPreview(vcl::Window *pParent)
: Window(pParent, WB_BORDER)
, m_pParentDlg(NULL)
{
- SetMapMode(MAP_TWIP);
- SetBorderStyle( WindowBorderStyle::MONO );
+ SetBorderStyle(WindowBorderStyle::MONO);
}
RubyPreview::~RubyPreview()
@@ -802,34 +807,38 @@ void RubyPreview::dispose()
VCL_BUILDER_FACTORY(RubyPreview)
-void RubyPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& /* rRect */ )
+void RubyPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /*rRect*/)
{
- Size aWinSize = GetOutputSize();
+ rRenderContext.Push(PushFlags::MAPMODE);
+
+ rRenderContext.SetMapMode(MAP_TWIP);
- vcl::Font aSaveFont = GetFont();
+ Size aWinSize = rRenderContext.GetOutputSize();
+
+ vcl::Font aSaveFont = rRenderContext.GetFont();
aSaveFont.SetHeight(aWinSize.Height() / 4);
- SetFont(aSaveFont);
+ rRenderContext.SetFont(aSaveFont);
Rectangle aRect(Point(0, 0), aWinSize);
- SetLineColor();
- SetFillColor( aSaveFont.GetFillColor() );
- DrawRect(aRect);
+ rRenderContext.SetLineColor();
+ rRenderContext.SetFillColor(aSaveFont.GetFillColor());
+ rRenderContext.DrawRect(aRect);
OUString sBaseText, sRubyText;
m_pParentDlg->GetCurrentText(sBaseText, sRubyText);
- long nTextHeight = GetTextHeight();
- long nBaseWidth = GetTextWidth(sBaseText);
+ long nTextHeight = rRenderContext.GetTextHeight();
+ long nBaseWidth = rRenderContext.GetTextWidth(sBaseText);
vcl::Font aRubyFont(aSaveFont);
aRubyFont.SetHeight(aRubyFont.GetHeight() * 70 / 100);
- SetFont(aRubyFont);
- long nRubyWidth = GetTextWidth(sRubyText);
- SetFont(aSaveFont);
+ rRenderContext.SetFont(aRubyFont);
+ long nRubyWidth = rRenderContext.GetTextWidth(sRubyText);
+ rRenderContext.SetFont(aSaveFont);
sal_uInt16 nAdjust = m_pParentDlg->m_pAdjustLB->GetSelectEntryPos();
//use center if no adjustment is available
- if(nAdjust > 4)
+ if (nAdjust > 4)
nAdjust = 1;
//which part is stretched ?
@@ -844,46 +853,47 @@ void RubyPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle
//use above also if no selection is set
bool bAbove = m_pParentDlg->m_pPositionLB->GetSelectEntryPos() != 1;
- if(!bAbove)
+ if (!bAbove)
{
long nTmp = nYRuby;
nYRuby = nYBase;
nYBase = nTmp;
}
- long nYOutput, nOutTextWidth;
- OUString sOutputText;
+ long nYOutput;
+ long nOutTextWidth;
+ OUString sOutputText;
- if(bRubyStretch)
+ if (bRubyStretch)
{
- DrawText( Point( nLeftStart , nYBase), sBaseText );
+ rRenderContext.DrawText(Point(nLeftStart , nYBase), sBaseText);
nYOutput = nYRuby;
sOutputText = sRubyText;
nOutTextWidth = nRubyWidth;
- SetFont(aRubyFont);
+ rRenderContext.SetFont(aRubyFont);
}
else
{
- SetFont(aRubyFont);
- DrawText( Point( nLeftStart , nYRuby), sRubyText );
+ rRenderContext.SetFont(aRubyFont);
+ rRenderContext.DrawText(Point(nLeftStart , nYRuby), sRubyText);
nYOutput = nYBase;
sOutputText = sBaseText;
nOutTextWidth = nBaseWidth;
- SetFont(aSaveFont);
+ rRenderContext.SetFont(aSaveFont);
}
- switch(nAdjust)
+ switch (nAdjust)
{
case RubyAdjust_LEFT:
- DrawText( Point( nLeftStart , nYOutput), sOutputText );
+ rRenderContext.DrawText(Point(nLeftStart , nYOutput), sOutputText);
break;
case RubyAdjust_RIGHT:
- DrawText( Point( nRightEnd - nOutTextWidth, nYOutput), sOutputText );
+ rRenderContext.DrawText(Point(nRightEnd - nOutTextWidth, nYOutput), sOutputText);
break;
case RubyAdjust_INDENT_BLOCK:
{
long nCharWidth = GetTextWidth(OUString("X"));
- if(nOutTextWidth < (nRightEnd - nLeftStart - nCharWidth))
+ if (nOutTextWidth < (nRightEnd - nLeftStart - nCharWidth))
{
nCharWidth /= 2;
nLeftStart += nCharWidth;
@@ -892,25 +902,28 @@ void RubyPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle
}
// no break!
case RubyAdjust_BLOCK:
- if(sOutputText.getLength() > 1)
{
- sal_Int32 nCount = sOutputText.getLength();
- long nSpace = ((nRightEnd - nLeftStart) - GetTextWidth(sOutputText)) / (nCount - 1);
- for(sal_Int32 i = 0; i < nCount; i++)
+ if (sOutputText.getLength() > 1)
{
- OUString sChar(sOutputText[i]);
- DrawText( Point( nLeftStart , nYOutput), sChar);
- long nCharWidth = GetTextWidth(sChar);
- nLeftStart += nCharWidth + nSpace;
+ sal_Int32 nCount = sOutputText.getLength();
+ long nSpace = ((nRightEnd - nLeftStart) - GetTextWidth(sOutputText)) / (nCount - 1);
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ OUString sChar(sOutputText[i]);
+ rRenderContext.DrawText(Point(nLeftStart , nYOutput), sChar);
+ long nCharWidth = GetTextWidth(sChar);
+ nLeftStart += nCharWidth + nSpace;
+ }
+ break;
}
- break;
}
//no break;
case RubyAdjust_CENTER:
- DrawText( Point( nCenter - nOutTextWidth / 2 , nYOutput), sOutputText );
+ rRenderContext.DrawText(Point(nCenter - nOutTextWidth / 2 , nYOutput), sOutputText);
break;
}
- SetFont(aSaveFont);
+ rRenderContext.SetFont(aSaveFont);
+ rRenderContext.Pop();
}
Size RubyPreview::GetOptimalSize() const
@@ -924,28 +937,28 @@ void RubyEdit::GetFocus()
Edit::GetFocus();
}
-bool RubyEdit::PreNotify( NotifyEvent& rNEvt )
+bool RubyEdit::PreNotify(NotifyEvent& rNEvt)
{
bool nHandled = false;
- if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
+ if (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT)
{
const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
const vcl::KeyCode& rKeyCode = pKEvt->GetKeyCode();
sal_uInt16 nMod = rKeyCode.GetModifier();
sal_uInt16 nCode = rKeyCode.GetCode();
- if( nCode == KEY_TAB && (!nMod || KEY_SHIFT == nMod))
+ if (nCode == KEY_TAB && (!nMod || KEY_SHIFT == nMod))
{
sal_Int32 nParam = KEY_SHIFT == nMod ? -1 : 1;
if(aScrollHdl.IsSet() && aScrollHdl.Call(&nParam))
nHandled = true;
}
- else if(KEY_UP == nCode || KEY_DOWN == nCode)
+ else if (KEY_UP == nCode || KEY_DOWN == nCode)
{
sal_Int32 nParam = KEY_UP == nCode ? -1 : 1;
aJumpHdl.Call(&nParam);
}
}
- if(!nHandled)
+ if (!nHandled)
nHandled = Edit::PreNotify(rNEvt);
return nHandled;
}
commit 716f8e04a5bd1bde7d2ed9cae56b59eb7f7f77f1
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 10:30:04 2015 +0900
refactor SvxSwFrameExample to use RenderContext
Change-Id: Ice4ffab3bc98b76b7ee90aa4570b2858b01bf906
diff --git a/include/svx/swframeexample.hxx b/include/svx/swframeexample.hxx
index c816c17..5a813c7 100644
--- a/include/svx/swframeexample.hxx
+++ b/include/svx/swframeexample.hxx
@@ -62,11 +62,11 @@ class SVX_DLLPUBLIC SvxSwFrameExample : public vcl::Window
Point aRelPos;
void InitColors_Impl();
- void InitAllRects_Impl();
+ void InitAllRects_Impl(vcl::RenderContext& rRenderContext);
void CalcBoundRect_Impl(Rectangle &rRect);
- Rectangle DrawInnerFrame_Impl(const Rectangle &rRect, const Color &rFillColor, const Color &rBorderColor);
+ Rectangle DrawInnerFrame_Impl(vcl::RenderContext& rRenderContext, const Rectangle &rRect, const Color &rFillColor, const Color &rBorderColor);
- void DrawRect_Impl(const Rectangle &rRect, const Color &rFillColor, const Color &rLineColor);
+ void DrawRect_Impl(vcl::RenderContext& rRenderContext, const Rectangle &rRect, const Color &rFillColor, const Color &rLineColor);
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
protected:
diff --git a/svx/source/dialog/swframeexample.cxx b/svx/source/dialog/swframeexample.cxx
index c21adb0..2ed2c18 100644
--- a/svx/source/dialog/swframeexample.cxx
+++ b/svx/source/dialog/swframeexample.cxx
@@ -49,7 +49,6 @@ SvxSwFrameExample::SvxSwFrameExample( vcl::Window *pParent, WinBits nStyle ) :
aRelPos (Point(0,0))
{
InitColors_Impl();
- SetMapMode(MAP_PIXEL);
}
VCL_BUILDER_FACTORY_ARGS(SvxSwFrameExample, 0)
@@ -79,17 +78,17 @@ void SvxSwFrameExample::InitColors_Impl()
m_aBlankFrameCol = bHC? m_aTxtCol : Color( COL_GRAY );
}
-void SvxSwFrameExample::DataChanged( const DataChangedEvent& rDCEvt )
+void SvxSwFrameExample::DataChanged(const DataChangedEvent& rDCEvt)
{
- Window::DataChanged( rDCEvt );
+ Window::DataChanged(rDCEvt);
- if( rDCEvt.GetType() == DataChangedEventType::SETTINGS && ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ) )
+ if (rDCEvt.GetType() == DataChangedEventType::SETTINGS && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
InitColors_Impl();
}
-void SvxSwFrameExample::InitAllRects_Impl()
+void SvxSwFrameExample::InitAllRects_Impl(vcl::RenderContext& rRenderContext)
{
- aPage.SetSize( GetOutputSizePixel() );
+ aPage.SetSize(rRenderContext.GetOutputSizePixel());
sal_uIntPtr nOutWPix = aPage.GetWidth();
sal_uIntPtr nOutHPix = aPage.GetHeight();
@@ -171,7 +170,7 @@ void SvxSwFrameExample::InitAllRects_Impl()
else
{
aFont.SetSize(Size(0, aParaPrtArea.GetHeight() / 2));
- SetFont(aFont);
+ rRenderContext.SetFont(aFont);
aAutoCharFrame.SetSize(Size(GetTextWidth(OUString('A')), GetTextHeight()));
aAutoCharFrame.SetPos(Point(aParaPrtArea.Left() + (aParaPrtArea.GetWidth() - aAutoCharFrame.GetWidth()) / 2,
aParaPrtArea.Top() + (aParaPrtArea.GetHeight() - aAutoCharFrame.GetHeight()) / 2));
@@ -433,9 +432,10 @@ void SvxSwFrameExample::CalcBoundRect_Impl(Rectangle &rRect)
}
}
-Rectangle SvxSwFrameExample::DrawInnerFrame_Impl(const Rectangle &rRect, const Color &rFillColor, const Color &rBorderColor)
+Rectangle SvxSwFrameExample::DrawInnerFrame_Impl(vcl::RenderContext& rRenderContext, const Rectangle &rRect,
+ const Color &rFillColor, const Color &rBorderColor)
{
- DrawRect_Impl(rRect, rFillColor, rBorderColor);
+ DrawRect_Impl(rRenderContext, rRect, rFillColor, rBorderColor);
// Bereich, zu dem relativ positioniert wird, bestimmen
Rectangle aRect(rRect); // aPagePrtArea = Default
@@ -446,13 +446,13 @@ Rectangle SvxSwFrameExample::DrawInnerFrame_Impl(const Rectangle &rRect, const C
// Testabsatz zeichnen
Rectangle aTxt(aTextLine);
sal_Int32 nStep = aTxt.GetHeight() + 2;
- sal_uInt16 nLines = (sal_uInt16)(aParaPrtArea.GetHeight() / (aTextLine.GetHeight() + 2));
+ sal_uInt16 nLines = static_cast<sal_uInt16>(aParaPrtArea.GetHeight() / (aTextLine.GetHeight() + 2));
for (sal_uInt16 i = 0; i < nLines; i++)
{
if (i == nLines - 1)
aTxt.SetSize(Size(aTxt.GetWidth() / 2, aTxt.GetHeight()));
- DrawRect_Impl(aTxt, m_aTxtCol, m_aTransColor);
+ DrawRect_Impl(rRenderContext, aTxt, m_aTxtCol, m_aTransColor);
aTxt.Move(0, nStep);
}
}
@@ -460,21 +460,23 @@ Rectangle SvxSwFrameExample::DrawInnerFrame_Impl(const Rectangle &rRect, const C
return aRect;
}
-void SvxSwFrameExample::Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangle&)
+void SvxSwFrameExample::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
- InitAllRects_Impl();
+ rRenderContext.SetMapMode(MAP_PIXEL);
+
+ InitAllRects_Impl(rRenderContext);
// Draw page
- DrawRect_Impl( aPage, m_aBgCol, m_aBorderCol );
+ DrawRect_Impl(rRenderContext, aPage, m_aBgCol, m_aBorderCol);
// Draw PrintArea
- Rectangle aRect = DrawInnerFrame_Impl( aPagePrtArea, m_aTransColor, m_aPrintAreaCol );
+ Rectangle aRect = DrawInnerFrame_Impl(rRenderContext, aPagePrtArea, m_aTransColor, m_aPrintAreaCol);
if (nAnchor == TextContentAnchorType_AT_FRAME)
- aRect = DrawInnerFrame_Impl( aFrameAtFrame, m_aBgCol, m_aBorderCol );
+ aRect = DrawInnerFrame_Impl(rRenderContext, aFrameAtFrame, m_aBgCol, m_aBorderCol);
- long lXPos = 0;
- long lYPos = 0;
+ long lXPos = 0;
+ long lYPos = 0;
// Horizontal alignment
if (nAnchor != TextContentAnchorType_AS_CHARACTER)
@@ -503,7 +505,9 @@ void SvxSwFrameExample::Paint(vcl::RenderContext& /*rRenderContext*/, const Rect
}
}
else
+ {
lXPos = aRect.Right() + 2;
+ }
// Vertical Alignment
if (nAnchor != TextContentAnchorType_AS_CHARACTER)
@@ -576,7 +580,7 @@ void SvxSwFrameExample::Paint(vcl::RenderContext& /*rRenderContext*/, const Rect
Rectangle aFrmRect(Point(lXPos, lYPos), aFrmSize);
- Rectangle *pOuterFrame = &aPage;
+ Rectangle* pOuterFrame = &aPage;
if (nAnchor == TextContentAnchorType_AT_FRAME)
pOuterFrame = &aFrameAtFrame;
@@ -649,7 +653,7 @@ void SvxSwFrameExample::Paint(vcl::RenderContext& /*rRenderContext*/, const Rect
}
}
if (pOuterFrame->IsInside(aTxt))
- DrawRect_Impl( aTxt, m_aTxtCol, m_aTransColor );
+ DrawRect_Impl(rRenderContext, aTxt, m_aTxtCol, m_aTransColor );
aTxt.Move(0, nStep);
aTxt.Right() = nOldR;
@@ -670,20 +674,20 @@ void SvxSwFrameExample::Paint(vcl::RenderContext& /*rRenderContext*/, const Rect
aPara.Bottom() -= nDiff;
}
if (nAnchor == TextContentAnchorType_AT_CHARACTER && bIgnoreWrap)
- DrawText(aAutoCharFrame, OUString('A'));
+ rRenderContext.DrawText(aAutoCharFrame, OUString('A'));
}
else
{
- DrawText(aParaPrtArea, OUString(DEMOTEXT));
- DrawRect_Impl(aDrawObj, m_aBlankCol, m_aBlankFrameCol );
+ rRenderContext.DrawText(aParaPrtArea, OUString(DEMOTEXT));
+ DrawRect_Impl(rRenderContext, aDrawObj, m_aBlankCol, m_aBlankFrameCol );
}
// Draw rectangle on which the frame is aligned:
- DrawRect_Impl(aRect, m_aTransColor, m_aAlignColor);
+ DrawRect_Impl(rRenderContext, aRect, m_aTransColor, m_aAlignColor);
// Frame View
bool bDontFill = (nAnchor == TextContentAnchorType_AT_CHARACTER && aFrmRect.IsOver(aAutoCharFrame)) || bTrans;
- DrawRect_Impl( aFrmRect, bDontFill? m_aTransColor : m_aBgCol, m_aFrameColor );
+ DrawRect_Impl(rRenderContext, aFrmRect, bDontFill? m_aTransColor : m_aBgCol, m_aFrameColor);
}
void SvxSwFrameExample::SetRelPos(const Point& rP)
@@ -701,11 +705,12 @@ void SvxSwFrameExample::SetRelPos(const Point& rP)
aRelPos.Y() = -5;
}
-void SvxSwFrameExample::DrawRect_Impl(const Rectangle &rRect, const Color &rFillColor, const Color &rLineColor)
+void SvxSwFrameExample::DrawRect_Impl(vcl::RenderContext& rRenderContext, const Rectangle &rRect,
+ const Color &rFillColor, const Color &rLineColor)
{
- SetFillColor(rFillColor);
- SetLineColor(rLineColor);
- Window::DrawRect(rRect);
+ rRenderContext.SetFillColor(rFillColor);
+ rRenderContext.SetLineColor(rLineColor);
+ rRenderContext.DrawRect(rRect);
}
commit 7d6fea90d34b888e878eb7674e380c1c08522a16
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 09:46:59 2015 +0900
fixes of SvxParaPrevWindow refactoring
Change-Id: If9ca3234f9f3ea1ed176d3fc020d4b6d7a554937
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index 2dda774..7662a9d 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -87,7 +87,7 @@ private:
void SetLineSpacing_Impl( const SvxLineSpacingItem& rAttr );
void Init_Impl();
- void UpdateExample_Impl( bool bAll = false );
+ void UpdateExample_Impl();
DECL_LINK( LineDistHdl_Impl, ListBox* );
DECL_LINK(ModifyHdl_Impl, void *);
@@ -154,7 +154,7 @@ class SvxParaAlignTabPage : public SfxTabPage
DECL_LINK(LastLineHdl_Impl, void *);
DECL_LINK(TextDirectionHdl_Impl, void *);
- void UpdateExample_Impl( bool bAll = false );
+ void UpdateExample_Impl();
SvxParaAlignTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 8b647f4..94c0070 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -819,7 +819,7 @@ IMPL_LINK( SvxStdParagraphTabPage, LineDistHdl_Impl, ListBox *, pBox )
}
break;
}
- UpdateExample_Impl( true );
+ UpdateExample_Impl();
return 0;
}
@@ -856,7 +856,7 @@ void SvxStdParagraphTabPage::Init_Impl()
m_pLineDistAtMetricBox->SetMax( m_pLineDistAtMetricBox->Normalize( nAbst ), eUnit );
}
-void SvxStdParagraphTabPage::UpdateExample_Impl( bool bAll )
+void SvxStdParagraphTabPage::UpdateExample_Impl()
{
m_pExampleWin->SetFirstLineOfst( (short)m_pFLineIndent->Denormalize( m_pFLineIndent->GetValue( FUNIT_TWIP ) ) );
m_pExampleWin->SetLeftMargin( static_cast<long>(m_pLeftIndent->Denormalize( m_pLeftIndent->GetValue( FUNIT_TWIP ) ) ) );
@@ -886,7 +886,7 @@ void SvxStdParagraphTabPage::UpdateExample_Impl( bool bAll )
(sal_uInt16)GetCoreValue( *m_pLineDistAtMetricBox, SFX_MAPUNIT_TWIP ) );
break;
}
- m_pExampleWin->Draw( bAll );
+ m_pExampleWin->Invalidate();
}
void SvxStdParagraphTabPage::EnableRegisterMode()
@@ -1260,7 +1260,7 @@ void SvxParaAlignTabPage::Reset( const SfxItemSet* rSet )
m_pLastLineLB->SaveValue();
m_pExpandCB->SaveValue();
- UpdateExample_Impl(true);
+ UpdateExample_Impl();
}
IMPL_LINK_NOARG(SvxParaAlignTabPage, AlignHdl_Impl)
@@ -1270,7 +1270,7 @@ IMPL_LINK_NOARG(SvxParaAlignTabPage, AlignHdl_Impl)
m_pLastLineLB->Enable(bJustify);
bool bLastLineIsBlock = m_pLastLineLB->GetSelectEntryPos() == 2;
m_pExpandCB->Enable(bJustify && bLastLineIsBlock);
- UpdateExample_Impl(false);
+ UpdateExample_Impl();
return 0;
}
@@ -1279,7 +1279,7 @@ IMPL_LINK_NOARG(SvxParaAlignTabPage, LastLineHdl_Impl)
//fdo#41350 only enable 'Expand last word' if last line is also justified
bool bLastLineIsBlock = m_pLastLineLB->GetSelectEntryPos() == 2;
m_pExpandCB->Enable(bLastLineIsBlock);
- UpdateExample_Impl(false);
+ UpdateExample_Impl();
return 0;
}
@@ -1301,7 +1301,7 @@ IMPL_LINK_NOARG(SvxParaAlignTabPage, TextDirectionHdl_Impl)
return 0;
}
-void SvxParaAlignTabPage::UpdateExample_Impl( bool bAll )
+void SvxParaAlignTabPage::UpdateExample_Impl()
{
if ( m_pLeft->IsChecked() )
m_pExampleWin->SetAdjust( SVX_ADJUST_LEFT );
@@ -1321,7 +1321,7 @@ void SvxParaAlignTabPage::UpdateExample_Impl( bool bAll )
m_pExampleWin->SetLastLine( eLastBlock );
}
- m_pExampleWin->Draw( bAll );
+ m_pExampleWin->Invalidate();
}
void SvxParaAlignTabPage::EnableJustifyExt()
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 1f2520a..2ffb988 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -2242,7 +2242,7 @@ IMPL_LINK_NOARG(SwSectionIndentTabPage, IndentModifyHdl)
{
m_pPreviewWin->SetLeftMargin( static_cast< long >(m_pBeforeMF->Denormalize(m_pBeforeMF->GetValue(FUNIT_TWIP))) );
m_pPreviewWin->SetRightMargin( static_cast< long >(m_pAfterMF->Denormalize(m_pAfterMF->GetValue(FUNIT_TWIP))) );
- m_pPreviewWin->Draw(true);
+ m_pPreviewWin->Invalidate();
return 0;
}
commit 0e27079cbf1c99227afd8366dd0be03bd6496a0a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 08:35:08 2015 +0900
SvxShowCharSet cleanup
Change-Id: Iadb110bb6ec64c66f1a9b54c43d19664f890ec74
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index ee4ba74..c57a4e3 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -255,19 +255,19 @@ int SvxShowCharSet::PixelToMapIndex( const Point& point) const
-void SvxShowCharSet::KeyInput( const KeyEvent& rKEvt )
+void SvxShowCharSet::KeyInput(const KeyEvent& rKEvt)
{
vcl::KeyCode aCode = rKEvt.GetKeyCode();
- if( aCode.GetModifier() )
+ if (aCode.GetModifier())
{
- Control::KeyInput( rKEvt );
+ Control::KeyInput(rKEvt);
return;
}
int tmpSelected = nSelectedIndex;
- switch ( aCode.GetCode() )
+ switch (aCode.GetCode())
{
case KEY_SPACE:
aSelectHdl.Call( this );
@@ -299,17 +299,17 @@ void SvxShowCharSet::KeyInput( const KeyEvent& rKEvt )
case KEY_TAB: // some fonts have a character at these unicode control codes
case KEY_ESCAPE:
case KEY_RETURN:
- Control::KeyInput( rKEvt );
+ Control::KeyInput(rKEvt);
tmpSelected = - 1; // mark as invalid
break;
default:
{
sal_UCS4 cChar = rKEvt.GetCharCode();
- sal_UCS4 cNext = mpFontCharMap->GetNextChar( cChar - 1 );
- tmpSelected = mpFontCharMap->GetIndexFromChar( cNext );
- if( tmpSelected < 0 || (cChar != cNext) )
+ sal_UCS4 cNext = mpFontCharMap->GetNextChar(cChar - 1);
+ tmpSelected = mpFontCharMap->GetIndexFromChar(cNext);
+ if (tmpSelected < 0 || (cChar != cNext))
{
- Control::KeyInput( rKEvt );
+ Control::KeyInput(rKEvt);
tmpSelected = - 1; // mark as invalid
}
}
commit 83d33d35e113ccb5b24313ff48e18f1000a3b19d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 08:32:34 2015 +0900
refactor SvxParaPrevWindow to use RenderContext
Change-Id: I3eb7ad267b261c28b193dfc6de24e4facdf57850
diff --git a/include/svx/paraprev.hxx b/include/svx/paraprev.hxx
index 6a1e785..0183953 100644
--- a/include/svx/paraprev.hxx
+++ b/include/svx/paraprev.hxx
@@ -23,8 +23,6 @@
#include <editeng/svxenum.hxx>
#include <svx/svxdllapi.h>
-// enum ------------------------------------------------------------------
-
enum SvxPrevLineSpace
{
SVX_PREV_LINESPACE_1 = 0,
@@ -35,8 +33,6 @@ enum SvxPrevLineSpace
SVX_PREV_LINESPACE_DURCH
};
-// class SvxParaPrevWindow -----------------------------------------------
-
class SVX_DLLPUBLIC SvxParaPrevWindow : public vcl::Window
{
using Window::Draw;
@@ -62,39 +58,100 @@ private:
Rectangle Lines[9];
protected:
- virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
- void DrawParagraph( bool bAll );
+ void DrawParagraph(vcl::RenderContext& rRenderContext, bool bAll);
public:
SvxParaPrevWindow( vcl::Window* pParent, WinBits nBits);
- void SetFirstLineOfst( short nNew ) { nFirstLineOfst = nNew; }
- void SetLeftMargin( long nNew ) { nLeftMargin = nNew; }
- void SetRightMargin( long nNew ) { nRightMargin = nNew; }
- void SetUpper( sal_uInt16 nNew ) { nUpper = nNew; }
- void SetLower( sal_uInt16 nNew ) { nLower = nNew; }
- void SetAdjust( SvxAdjust eNew ) { eAdjust = eNew; }
- void SetLastLine( SvxAdjust eNew ) { eLastLine = eNew; }
- void SetLineSpace( SvxPrevLineSpace eNew, sal_uInt16 nNew = 0 )
- { eLine = eNew; nLineVal = nNew; }
- void SetText( const OUString& rStr ) SAL_OVERRIDE { aText = rStr; }
- void SetSize( Size aNew ) { aSize = aNew; }
-
- short GetFirstLineOfst() const { return nFirstLineOfst; }
- long GetLeftMargin() const { return nLeftMargin; }
- long GetRightMargin() const { return nRightMargin; }
- sal_uInt16 GetUpper() const { return nUpper; }
- sal_uInt16 GetLower() const { return nLower; }
- SvxAdjust GetAdjust() const { return eAdjust; }
-
- SvxPrevLineSpace GetLineEnum() const { return eLine; }
- sal_uInt16 GetLineValue() const { return nLineVal; }
- OUString GetText() const SAL_OVERRIDE { return aText; }
- Size GetSize() const { return aSize; }
-
- void Draw( bool bAll ) { DrawParagraph( bAll ); }
+ void SetFirstLineOfst( short nNew )
+ {
+ nFirstLineOfst = nNew;
+ }
+ void SetLeftMargin( long nNew )
+ {
+ nLeftMargin = nNew;
+ }
+ void SetRightMargin( long nNew )
+ {
+ nRightMargin = nNew;
+ }
+ void SetUpper( sal_uInt16 nNew )
+ {
+ nUpper = nNew;
+ }
+ void SetLower( sal_uInt16 nNew )
+ {
+ nLower = nNew;
+ }
+ void SetAdjust( SvxAdjust eNew )
+ {
+ eAdjust = eNew;
+ }
+ void SetLastLine( SvxAdjust eNew )
+ {
+ eLastLine = eNew;
+ }
+ void SetLineSpace( SvxPrevLineSpace eNew, sal_uInt16 nNew = 0 )
+ {
+ eLine = eNew; nLineVal = nNew;
+ }
+ void SetText( const OUString& rStr ) SAL_OVERRIDE
+ {
+ aText = rStr;
+ }
+ void SetSize( Size aNew )
+ {
+ aSize = aNew;
+ }
+
+ short GetFirstLineOfst() const
+ {
+ return nFirstLineOfst;
+ }
+ long GetLeftMargin() const
+ {
+ return nLeftMargin;
+ }
+ long GetRightMargin() const
+ {
+ return nRightMargin;
+ }
+ sal_uInt16 GetUpper() const
+ {
+ return nUpper;
+ }
+ sal_uInt16 GetLower() const
+ {
+ return nLower;
+ }
+ SvxAdjust GetAdjust() const
+ {
+ return eAdjust;
+ }
+ SvxPrevLineSpace GetLineEnum() const
+ {
+ return eLine;
+ }
+ sal_uInt16 GetLineValue() const
+ {
+ return nLineVal;
+ }
+ OUString GetText() const SAL_OVERRIDE
+ {
+ return aText;
+ }
+ Size GetSize() const
+ {
+ return aSize;
+ }
+
+ void Draw(vcl::RenderContext& rRenderContext, bool bAll)
+ {
+ DrawParagraph(rRenderContext, bAll);
+ }
};
#endif
diff --git a/svx/source/dialog/paraprev.cxx b/svx/source/dialog/paraprev.cxx
index ea0b7f0..188e197 100644
--- a/svx/source/dialog/paraprev.cxx
+++ b/svx/source/dialog/paraprev.cxx
@@ -23,9 +23,7 @@
#include <vcl/settings.hxx>
SvxParaPrevWindow::SvxParaPrevWindow( vcl::Window* pParent, WinBits nBits) :
-
Window( pParent, nBits),
-
nLeftMargin ( 0 ),
nRightMargin ( 0 ),
nFirstLineOfst ( 0 ),
@@ -38,11 +36,11 @@ SvxParaPrevWindow::SvxParaPrevWindow( vcl::Window* pParent, WinBits nBits) :
{
// Count in Twips by default
- SetMapMode( MapMode( MAP_TWIP ) );
+ SetMapMode(MapMode(MAP_TWIP));
- aSize = Size( 11905, 16837 );
+ aSize = Size(11905, 16837);
- SetBorderStyle( WindowBorderStyle::MONO );
+ SetBorderStyle(WindowBorderStyle::MONO);
}
VCL_BUILDER_FACTORY_ARGS(SvxParaPrevWindow, WB_BORDER)
@@ -52,62 +50,58 @@ Size SvxParaPrevWindow::GetOptimalSize() const
return getParagraphPreviewOptimalSize(this);
}
-
-
-void SvxParaPrevWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& )
+void SvxParaPrevWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
- DrawParagraph( true );
+ DrawParagraph(rRenderContext, true);
}
-
-
#define DEF_MARGIN 120
-void SvxParaPrevWindow::DrawParagraph( bool bAll )
+void SvxParaPrevWindow::DrawParagraph(vcl::RenderContext& rRenderContext, bool bAll)
{
- Size aWinSize = GetOutputSizePixel();
- aWinSize = PixelToLogic( aWinSize );
+ Size aWinSize = rRenderContext.GetOutputSizePixel();
+ aWinSize = rRenderContext.PixelToLogic(aWinSize);
Size aTmp(1, 1);
aTmp = PixelToLogic(aTmp);
aWinSize.Width() -= aTmp.Width() /2;
aWinSize.Height() -= aTmp.Height() /2;
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
const Color& rWinColor = rStyleSettings.GetWindowColor();
Color aGrayColor(COL_LIGHTGRAY);
- SetFillColor( Color( rWinColor ) );
- if( bAll )
- DrawRect( Rectangle( Point(), aWinSize ) );
+ rRenderContext.SetFillColor(Color(rWinColor));
+ if (bAll)
+ rRenderContext.DrawRect(Rectangle(Point(), aWinSize));
- SetLineColor();
+ rRenderContext.SetLineColor();
long nH = aWinSize.Height() / 19;
- Size aLineSiz( aWinSize.Width() - DEF_MARGIN, nH ),
- aSiz = aLineSiz;
+ Size aLineSiz(aWinSize.Width() - DEF_MARGIN, nH);
+ Size aSiz = aLineSiz;
Point aPnt;
aPnt.X() = DEF_MARGIN / 2;
- SetFillColor( aGrayColor );
+ rRenderContext.SetFillColor(aGrayColor);
- for ( sal_uInt16 i = 0; i < 9; ++i )
+ for (sal_uInt16 i = 0; i < 9; ++i)
{
- if ( 3 == i )
+ if (i == 3)
{
- SetFillColor( Color( COL_GRAY ) );
+ rRenderContext.SetFillColor(Color(COL_GRAY));
long nTop = nUpper * aLineSiz.Height() / aSize.Height();
aPnt.Y() += nTop * 2;
}
- if ( 6 == i )
- SetFillColor( aGrayColor );
+ if (i == 6 )
+ rRenderContext.SetFillColor(aGrayColor);
- if ( 3 <= i && 6 > i )
+ if (3 <= i && 6 > i)
{
long nLeft = nLeftMargin * aLineSiz.Width() / aSize.Width();
long nFirst = nFirstLineOfst * aLineSiz.Width() / aSize.Width();
long nTmp = nLeft + nFirst;
- if ( 3 == i )
+ if (i == 3)
{
aPnt.X() += nTmp;
aSiz.Width() -= nTmp;
@@ -121,36 +115,47 @@ void SvxParaPrevWindow::DrawParagraph( bool bAll )
aSiz.Width() -= nRight;
}
- if ( 4 == i || 5 == i || 6 == i )
+ if (4 == i || 5 == i || 6 == i)
{
- switch ( eLine )
+ switch (eLine)
{
- case SVX_PREV_LINESPACE_1: break;
- case SVX_PREV_LINESPACE_15: aPnt.Y() += nH / 2; break;
- case SVX_PREV_LINESPACE_2: aPnt.Y() += nH; break;
-
+ case SVX_PREV_LINESPACE_1:
+ break;
+ case SVX_PREV_LINESPACE_15:
+ aPnt.Y() += nH / 2;
+ break;
+ case SVX_PREV_LINESPACE_2:
+ aPnt.Y() += nH;
+ break;
case SVX_PREV_LINESPACE_PROP:
case SVX_PREV_LINESPACE_MIN:
- case SVX_PREV_LINESPACE_DURCH: break;
+ case SVX_PREV_LINESPACE_DURCH:
+ break;
}
}
aPnt.Y() += nH;
- if ( (3 <= i) && (5 >= i) )
+ if (3 <= i && 5 >= i)
{
long nLW = long();
- switch( i )
+ switch (i)
{
- case 3: nLW = aLineSiz.Width() * 8 / 10; break;
- case 4: nLW = aLineSiz.Width() * 9 / 10; break;
- case 5: nLW = aLineSiz.Width() / 2; break;
+ case 3:
+ nLW = aLineSiz.Width() * 8 / 10;
+ break;
+ case 4:
+ nLW = aLineSiz.Width() * 9 / 10;
+ break;
+ case 5:
+ nLW = aLineSiz.Width() / 2;
+ break;
}
- if ( nLW > aSiz.Width() )
+ if (nLW > aSiz.Width())
nLW = aSiz.Width();
- switch ( eAdjust )
+ switch (eAdjust)
{
case SVX_ADJUST_LEFT:
break;
@@ -162,9 +167,9 @@ void SvxParaPrevWindow::DrawParagraph( bool bAll )
break;
default: ; //prevent warning
}
- if( SVX_ADJUST_BLOCK == eAdjust )
+ if (SVX_ADJUST_BLOCK == eAdjust)
{
- if( 5 == i )
+ if(5 == i)
{
switch( eLastLine )
{
@@ -188,22 +193,22 @@ void SvxParaPrevWindow::DrawParagraph( bool bAll )
aSiz.Width() = nLW;
}
- Rectangle aRect( aPnt, aSiz );
+ Rectangle aRect(aPnt, aSiz);
- if ( Lines[i] != aRect || bAll )
+ if (Lines[i] != aRect || bAll)
{
- if ( !bAll )
+ if (!bAll)
{
- Color aFillCol = GetFillColor();
- SetFillColor( rWinColor );
- DrawRect( Lines[i] );
- SetFillColor( aFillCol );
+ Color aFillCol = rRenderContext.GetFillColor();
+ rRenderContext.SetFillColor(rWinColor);
+ rRenderContext.DrawRect(Lines[i]);
+ rRenderContext.SetFillColor(aFillCol);
}
DrawRect( aRect );
Lines[i] = aRect;
}
- if ( 5 == i )
+ if (5 == i)
{
long nBottom = nLower * aLineSiz.Height() / aSize.Height();
aPnt.Y() += nBottom * 2;
commit 02eff9d83734b99996b30cf65768f27bfc0e161b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 08:31:05 2015 +0900
fix crasher in ValueSet
Change-Id: I846ebbf70f90c417fafd8cba8148c88f70d0c398
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index ff7351c..29c9e18 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -2264,8 +2264,12 @@ long ValueSet::GetScrollWidth() const
{
if (GetStyle() & WB_VSCROLL)
{
- const_cast<ValueSet*>(this)->Invalidate();
- const_cast<ValueSet*>(this)->ImplInitScrollBar();
+ ValueSet* pValueSet = const_cast<ValueSet*>(this);
+ if (!mxScrollBar)
+ {
+ pValueSet->ImplInitScrollBar();
+ }
+ pValueSet->Invalidate();
return mxScrollBar->GetSizePixel().Width() + SCRBAR_OFFSET;
}
else
commit d85412e08c8817be7c80d8b1b76874b9da4b0aeb
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Tue May 12 20:15:40 2015 +0900
refactor SvxPageWindow & SvxXMeasurePreview to use RenderContext
Change-Id: Ic6f4d1238c0a4c8f4632cf26099ef406caf5dbda
diff --git a/include/svx/measctrl.hxx b/include/svx/measctrl.hxx
index 347e0f5..8edb179 100644
--- a/include/svx/measctrl.hxx
+++ b/include/svx/measctrl.hxx
@@ -22,23 +22,17 @@
#include <vcl/ctrl.hxx>
#include <svx/svxdllapi.h>
-
class SfxItemSet;
class SdrMeasureObj;
class SdrModel;
-/*************************************************************************
-|*
-|* SvxXMeasurePreview
-|*
-\************************************************************************/
class SVX_DLLPUBLIC SvxXMeasurePreview : public Control
{
friend class SvxMeasurePage;
private:
- SdrMeasureObj* pMeasureObj;
- SdrModel* pModel;
+ SdrMeasureObj* pMeasureObj;
+ SdrModel* pModel;
public:
SvxXMeasurePreview(vcl::Window* pParent, WinBits nStyle);
@@ -47,12 +41,12 @@ public:
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
- virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
+ virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
- void SetAttributes( const SfxItemSet& rInAttrs );
+ void SetAttributes(const SfxItemSet& rInAttrs);
- virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
+ virtual void DataChanged(const DataChangedEvent& rDCEvt) SAL_OVERRIDE;
};
#endif
diff --git a/include/svx/pagectrl.hxx b/include/svx/pagectrl.hxx
index 6f0c357..e0ec05b 100644
--- a/include/svx/pagectrl.hxx
+++ b/include/svx/pagectrl.hxx
@@ -23,38 +23,36 @@
#include <svx/svxdllapi.h>
#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
-// forward ---------------------------------------------------------------
class SvxBoxItem;
-// class SvxPageWindow ---------------------------------------------------
class SVX_DLLPUBLIC SvxPageWindow : public vcl::Window
{
using Window::GetBorder;
private:
- Size aWinSize;
- Size aSize;
-
- long nTop;
- long nBottom;
- long nLeft;
- long nRight;
-
- SvxBoxItem* pBorder;
- bool bResetBackground;
- bool bFrameDirection;
- sal_Int32 nFrameDirection;
-
- long nHdLeft;
- long nHdRight;
- long nHdDist;
- long nHdHeight;
+ Size aWinSize;
+ Size aSize;
+
+ long nTop;
+ long nBottom;
+ long nLeft;
+ long nRight;
+
+ SvxBoxItem* pBorder;
+ bool bResetBackground;
+ bool bFrameDirection;
+ sal_Int32 nFrameDirection;
+
+ long nHdLeft;
+ long nHdRight;
+ long nHdDist;
+ long nHdHeight;
SvxBoxItem* pHdBorder;
- long nFtLeft;
- long nFtRight;
- long nFtDist;
- long nFtHeight;
+ long nFtLeft;
+ long nFtRight;
+ long nFtDist;
+ long nFtHeight;
SvxBoxItem* pFtBorder;
//UUUU
@@ -62,106 +60,128 @@ private:
drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFooterFillAttributes;
drawinglayer::attribute::SdrAllFillAttributesHelperPtr maPageFillAttributes;
- bool bFooter :1;
- bool bHeader :1;
- bool bTable :1;
- bool bHorz :1;
- bool bVert :1;
+ bool bFooter : 1;
+ bool bHeader : 1;
+ bool bTable : 1;
+ bool bHorz : 1;
+ bool bVert : 1;
- sal_uInt16 eUsage;
+ sal_uInt16 eUsage;
- OUString aLeftText;
- OUString aRightText;
+ OUString aLeftText;
+ OUString aRightText;
protected:
- virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
- virtual void DrawPage( const Point& rPoint,
- const bool bSecond,
- const bool bEnabled );
+ virtual void DrawPage(vcl::RenderContext& rRenderContext, const Point& rPoint,
+ const bool bSecond, const bool bEnabled);
//UUUU
- void drawFillAttributes(
- const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
- const Rectangle& rPaintRange,
- const Rectangle& rDefineRange);
+ void drawFillAttributes(vcl::RenderContext& rRenderContext,
+ const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
+ const Rectangle& rPaintRange, const Rectangle& rDefineRange);
public:
- SvxPageWindow( vcl::Window* pParent );
+ SvxPageWindow(vcl::Window* pParent);
virtual ~SvxPageWindow();
virtual void dispose() SAL_OVERRIDE;
//UUUU
- void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maHeaderFillAttributes = rFillAttributes; }
- void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maFooterFillAttributes = rFillAttributes; }
- void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maPageFillAttributes = rFillAttributes; }
- const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& getPageFillAttributes() const { return maPageFillAttributes; }
-
- void SetWidth(long nW) { aSize.Width() = nW; }
- void SetHeight(long nH) { aSize.Height() = nH; }
-
- void SetSize(const Size& rSz) { aSize = rSz; }
- const Size& GetSize() const { return aSize; }
-
- void SetTop(long nNew) { nTop = nNew; }
- void SetBottom(long nNew) { nBottom = nNew; }
- void SetLeft(long nNew) { nLeft = nNew; }
- void SetRight(long nNew) { nRight = nNew; }
- void SetBorder(const SvxBoxItem& rNew);
-
- long GetTop() const { return nTop; }
- long GetBottom() const { return nBottom; }
- long GetLeft() const { return nLeft; }
- long GetRight() const { return nRight; }
-
- const SvxBoxItem& GetBorder() const;
-
- void SetHdLeft(long nNew) { nHdLeft = nNew; }
- void SetHdRight(long nNew) { nHdRight = nNew; }
- void SetHdDist(long nNew) { nHdDist = nNew; }
- void SetHdHeight(long nNew) { nHdHeight = nNew; }
- void SetHdBorder(const SvxBoxItem& rNew);
-
- long GetHdLeft() const { return nHdLeft; }
- long GetHdRight() const { return nHdRight; }
- long GetHdDist() const { return nHdDist; }
- long GetHdHeight() const { return nHdHeight; }
-
- const SvxBoxItem& GetHdBorder() const { return *pHdBorder; }
-
- void SetFtLeft(long nNew) { nFtLeft = nNew; }
- void SetFtRight(long nNew) { nFtRight = nNew; }
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list