diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-06-30 16:13:23 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-06-30 17:57:38 +0200 |
commit | 562d2c3337051da5d98d55a28dc391dab387b692 (patch) | |
tree | 23f2c945057aa1919cc099cd6542aa1461e0bf1f /sfx2 | |
parent | 1a8915ef8302b13b781977209ae1fa41f5f659dc (diff) |
tdf#90452: Implement the new design of the startcenter.
See the comment 45 in the bug for the agreed design.
Change-Id: I428f339df48f530f606525434a4a2be8a79acaab
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/recentdocsview.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/control/thumbnailview.cxx | 57 | ||||
-rw-r--r-- | sfx2/source/control/thumbnailviewitem.cxx | 24 | ||||
-rw-r--r-- | sfx2/source/dialog/backingwindow.cxx | 17 | ||||
-rw-r--r-- | sfx2/source/dialog/backingwindow.hxx | 3 |
5 files changed, 47 insertions, 62 deletions
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index ad451197d148..b396719d19ff 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -32,6 +32,8 @@ #include <com/sun/star/frame/XFrame.hpp> #include <templateview.hrc> +#include <officecfg/Office/Common.hxx> + using namespace ::com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -67,6 +69,11 @@ RecentDocsView::RecentDocsView( vcl::Window* pParent ) SetStyle(GetStyle() | WB_VSCROLL); setItemMaxTextLength( mnItemMaxTextLength ); setItemDimensions( mnItemMaxSize, mnItemMaxSize, mnTextHeight, mnItemPadding ); + + maFillColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsBackgroundColor::get()); + maTextColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsTextColor::get()); + maHighlightColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightColor::get()); + maHighlightTextColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightTextColor::get()); } VCL_BUILDER_FACTORY(RecentDocsView) @@ -297,7 +304,6 @@ void RecentDocsView::LoseFocus() ThumbnailView::LoseFocus(); } - void RecentDocsView::Clear() { Invalidate(); diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index 08675c06b199..b9f50d96262e 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -58,8 +58,8 @@ enum ThumbnailView::ThumbnailView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren) : Control( pParent, nWinStyle ) + , mpItemAttrs(new ThumbnailItemAttributes) { - mpItemAttrs = NULL; ImplInit(); mbIsTransientChildrenDisabled = bDisableTransientChildren; } @@ -147,10 +147,13 @@ void ThumbnailView::ImplInit() mbHasVisibleItems = false; mbShowTooltips = false; maFilterFunc = ViewFilterAll(); - maColor = GetSettings().GetStyleSettings().GetFieldColor(); + maFillColor = GetSettings().GetStyleSettings().GetFieldColor(); + maTextColor = GetSettings().GetStyleSettings().GetWindowTextColor(); + maHighlightColor = GetSettings().GetStyleSettings().GetHighlightColor(); + maHighlightTextColor = GetSettings().GetStyleSettings().GetWindowTextColor(); mpStartSelRange = mFilteredItemList.end(); - ImplInitSettings(true, true, true); + ApplySettings(*this); } void ThumbnailView::ImplDeleteItems() @@ -194,35 +197,12 @@ void ThumbnailView::ApplySettings(vcl::RenderContext& rRenderContext) ApplyControlFont(*this, rStyleSettings.GetAppFont()); ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); rRenderContext.SetTextFillColor(); - Color aColor = rStyleSettings.GetFieldColor(); - rRenderContext.SetBackground(aColor); -} - -void ThumbnailView::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) -{ - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + rRenderContext.SetBackground(maFillColor); - if (bFont) - { - ApplyControlFont(*this, rStyleSettings.GetAppFont()); - } - - if (bForeground || bFont) - { - ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); - SetTextFillColor(); - } - - if (bBackground) - { - Color aColor = rStyleSettings.GetFieldColor(); - SetBackground(aColor); - } - - delete mpItemAttrs; - mpItemAttrs = new ThumbnailItemAttributes; - mpItemAttrs->aFillColor = maColor.getBColor(); - mpItemAttrs->aHighlightColor = rStyleSettings.GetHighlightColor().getBColor(); + mpItemAttrs->aFillColor = maFillColor.getBColor(); + mpItemAttrs->aTextColor = maTextColor.getBColor(); + mpItemAttrs->aHighlightColor = maHighlightColor.getBColor(); + mpItemAttrs->aHighlightTextColor = maHighlightTextColor.getBColor(); mpItemAttrs->aFontAttr = getFontAttributeFromVclFont(mpItemAttrs->aFontSize,GetFont(),false,true); mpItemAttrs->nMaxTextLength = 0; } @@ -862,15 +842,15 @@ void ThumbnailView::Paint(vcl::RenderContext& rRenderContext, const Rectangle& r // Draw background drawinglayer::primitive2d::Primitive2DSequence aSeq(1); aSeq[0] = drawinglayer::primitive2d::Primitive2DReference(new PolyPolygonColorPrimitive2D( - B2DPolyPolygon(Polygon(rRect, 5, 5).getB2DPolygon()), - maColor.getBColor())); + B2DPolyPolygon(Polygon(Rectangle(Point(), GetOutputSizePixel()), 0, 0).getB2DPolygon()), + maFillColor.getBColor())); // Create the processor and process the primitives const drawinglayer::geometry::ViewInformation2D aNewViewInfos; - std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> mpProcessor( + std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor( drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(rRenderContext, aNewViewInfos)); - mpProcessor->process(aSeq); + pProcessor->process(aSeq); // draw items for (size_t i = 0; i < nItemCount; i++) @@ -879,7 +859,7 @@ void ThumbnailView::Paint(vcl::RenderContext& rRenderContext, const Rectangle& r if (pItem->isVisible()) { - pItem->Paint(mpProcessor.get(), mpItemAttrs); + pItem->Paint(pProcessor.get(), mpItemAttrs); } } @@ -949,22 +929,18 @@ void ThumbnailView::StateChanged( StateChangedType nType ) else if ( (nType == StateChangedType::Zoom) || (nType == StateChangedType::ControlFont) ) { - ImplInitSettings( true, false, false ); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ImplInitSettings( false, true, false ); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings( false, false, true ); Invalidate(); } else if ( (nType == StateChangedType::Style) || (nType == StateChangedType::Enable) ) { - ImplInitSettings( false, false, true ); Invalidate(); } } @@ -979,7 +955,6 @@ void ThumbnailView::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ImplInitSettings( true, true, true ); Invalidate(); } } diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx index ee0e5598b331..7a0390c911cb 100644 --- a/sfx2/source/control/thumbnailviewitem.cxx +++ b/sfx2/source/control/thumbnailviewitem.cxx @@ -279,7 +279,7 @@ void ThumbnailViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *pProc if (mbHover) { const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; - fTransparence = aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01; + fTransparence = 0.25; } sal_uInt32 nPrimitive = 0; @@ -304,8 +304,8 @@ void ThumbnailViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *pProc )); // draw thumbnail borders - float fWidth = aImageSize.Width(); - float fHeight = aImageSize.Height(); + float fWidth = aImageSize.Width() - 1; + float fHeight = aImageSize.Height() - 1; float fPosX = maPrev1Pos.getX(); float fPosY = maPrev1Pos.getY(); @@ -319,8 +319,7 @@ void ThumbnailViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *pProc aSeq[nPrimitive++] = drawinglayer::primitive2d::Primitive2DReference(createBorderLine(aBounds)); // Draw text below thumbnail - aPos = maTextPos; - addTextPrimitives( maTitle, pAttrs, aPos, aSeq ); + addTextPrimitives(maTitle, pAttrs, maTextPos, aSeq); pProcessor->process(aSeq); } @@ -370,13 +369,18 @@ void ThumbnailViewItem::addTextPrimitives (const OUString& rText, const Thumbnai pAttrs->aFontSize.getX(), pAttrs->aFontSize.getY(), nLineX, double( aPos.Y() ) ) ); + // setup color + BColor aTextColor = pAttrs->aTextColor; + if (mbSelected || mbHover) + aTextColor = pAttrs->aHighlightTextColor; + rSeq[nPrimitives++] = drawinglayer::primitive2d::Primitive2DReference( new TextSimplePortionPrimitive2D(aTextMatrix, - aText,nLineStart,nLineLength, - std::vector< double >( ), + aText, nLineStart, nLineLength, + std::vector<double>(), pAttrs->aFontAttr, com::sun::star::lang::Locale(), - Color(COL_BLACK).getBColor() ) ); + aTextColor)); nLineStart += nLineLength; aPos.setY(aPos.getY() + aTextEngine.GetCharHeight()); @@ -388,9 +392,7 @@ void ThumbnailViewItem::addTextPrimitives (const OUString& rText, const Thumbnai drawinglayer::primitive2d::PolygonHairlinePrimitive2D* ThumbnailViewItem::createBorderLine (const basegfx::B2DPolygon& rPolygon) { - return new PolygonHairlinePrimitive2D(rPolygon, Color(186,186,186).getBColor()); + return new PolygonHairlinePrimitive2D(rPolygon, Color(128, 128, 128).getBColor()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - - diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index e77b332d61e9..4eca52aa9275 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -71,8 +71,8 @@ const char TEMPLATE_URL[] = ".uno:NewDoc"; const char OPEN_URL[] = ".uno:Open"; const char SERVICENAME_CFGREADACCESS[] = "com.sun.star.configuration.ConfigurationAccess"; +// increase size of the text in the buttons on the left fMultiplier-times float fMultiplier = 1.4f; -const Color aButtonsText(COL_WHITE); /*** * @@ -91,6 +91,7 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) : Window( i_pParent ), mxDesktop( Desktop::create(comphelper::getProcessComponentContext()) ), mbLocalViewInitialized(false), + maButtonsTextColor(officecfg::Office::Common::Help::StartCenter::StartCenterTextColor::get()), mbIsSaveMode( false ), mbInitControls( false ), mnHideExternalLinks( 0 ), @@ -310,13 +311,13 @@ void BackingWindow::initControls() mpExtensionsButton->SetClickHdl(LINK(this, BackingWindow, ExtLinkClickHdl)); // setup nice colors - mpCreateLabel->SetControlForeground(aButtonsText); + mpCreateLabel->SetControlForeground(maButtonsTextColor); vcl::Font aFont(mpCreateLabel->GetSettings().GetStyleSettings().GetLabelFont()); aFont.SetSize(Size(0, aFont.GetSize().Height() * fMultiplier)); mpCreateLabel->SetControlFont(aFont); - mpHelpButton->SetControlForeground(aButtonsText); - mpExtensionsButton->SetControlForeground(aButtonsText); + mpHelpButton->SetControlForeground(maButtonsTextColor); + mpExtensionsButton->SetControlForeground(maButtonsTextColor); const Color aButtonsBackground(officecfg::Office::Common::Help::StartCenter::StartCenterBackgroundColor::get()); @@ -333,8 +334,8 @@ void BackingWindow::initControls() mpButtonsBox->SetBackground(aWallpaper); // thin white rectangle around the Help and Extensions buttons - mpThinBox1->SetBackground(aButtonsText); - mpThinBox2->SetBackground(aButtonsText); + mpThinBox1->SetBackground(maButtonsTextColor); + mpThinBox2->SetBackground(maButtonsTextColor); Resize(); @@ -371,7 +372,7 @@ void BackingWindow::setupButton( PushButton* pButton ) pButton->SetControlFont(aFont); // color that fits the theme - pButton->SetControlForeground(aButtonsText); + pButton->SetControlForeground(maButtonsTextColor); pButton->SetClickHdl( LINK( this, BackingWindow, ClickHdl ) ); } @@ -382,7 +383,7 @@ void BackingWindow::setupButton( MenuButton* pButton ) pButton->SetControlFont(aFont); // color that fits the theme - pButton->SetControlForeground(aButtonsText); + pButton->SetControlForeground(maButtonsTextColor); PopupMenu* pMenu = pButton->GetPopupMenu(); pMenu->SetMenuFlags(pMenu->GetMenuFlags() | MenuFlags::AlwaysShowDisabledEntries); diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx index 796d8ad06e5b..8ef01fb5d09e 100644 --- a/sfx2/source/dialog/backingwindow.hxx +++ b/sfx2/source/dialog/backingwindow.hxx @@ -89,10 +89,11 @@ class BackingWindow : public vcl::Window, public VclBuilderContainer std::vector< VclPtr<vcl::Window> > maDndWindows; + Color maButtonsTextColor; Rectangle maStartCentButtons; bool mbIsSaveMode; - bool mbInitControls; + bool mbInitControls; sal_Int32 mnHideExternalLinks; svt::AcceleratorExecute* mpAccExec; |