[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - include/sfx2 sfx2/source
Jan Holesovsky
kendy at collabora.com
Fri Jul 3 12:55:17 PDT 2015
include/sfx2/thumbnailview.hxx | 9 +++++----
include/sfx2/thumbnailviewitem.hxx | 1 +
sfx2/source/control/recentdocsview.cxx | 1 +
sfx2/source/control/templateabstractview.cxx | 2 +-
sfx2/source/control/templatecontaineritem.cxx | 12 ++++--------
sfx2/source/control/templatedefaultview.cxx | 21 +++++++++++++++++++++
sfx2/source/control/templateviewitem.cxx | 8 ++------
sfx2/source/control/thumbnailview.cxx | 6 ++++++
sfx2/source/control/thumbnailviewitem.cxx | 6 +-----
9 files changed, 42 insertions(+), 24 deletions(-)
New commits:
commit 56c1103d6a83b46d5cacdc9d0e249d2959256f76
Author: Jan Holesovsky <kendy at collabora.com>
Date: Tue Jun 30 17:53:49 2015 +0200
tdf#90452: Templates should adhere to the recent docs colors too.
Change-Id: I5df89581796eca4e48e0a305d4319e4674f8dd87
Reviewed-on: https://gerrit.libreoffice.org/16625
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx
index 9000d32..bf0ea16 100644
--- a/include/sfx2/thumbnailview.hxx
+++ b/include/sfx2/thumbnailview.hxx
@@ -324,10 +324,11 @@ protected:
bool mbIsTransientChildrenDisabled : 1;
bool mbHasVisibleItems : 1;
bool mbShowTooltips : 1;
- Color maFillColor;
- Color maTextColor;
- Color maHighlightColor;
- Color maHighlightTextColor;
+ Color maFillColor; ///< Background color of the thumbnail view widget.
+ Color maTextColor; ///< Text color.
+ Color maHighlightColor; ///< Color of the highlight (background) of the hovered / selected item.
+ Color maHighlightTextColor; ///< Color of the text for the higlighted item.
+ double mfHighlightTransparence; ///< Transparence of the highlight.
Link<> maItemStateHdl;
ThumbnailItemAttributes* mpItemAttrs;
diff --git a/include/sfx2/thumbnailviewitem.hxx b/include/sfx2/thumbnailviewitem.hxx
index ab2194b..8929b8e 100644
--- a/include/sfx2/thumbnailviewitem.hxx
+++ b/include/sfx2/thumbnailviewitem.hxx
@@ -60,6 +60,7 @@ struct ThumbnailItemAttributes
basegfx::BColor aTextColor;
basegfx::BColor aHighlightColor;
basegfx::BColor aHighlightTextColor;
+ double fHighlightTransparence;
basegfx::B2DVector aFontSize;
drawinglayer::attribute::FontAttribute aFontAttr;
};
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 471645e..69952e1 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -74,6 +74,7 @@ RecentDocsView::RecentDocsView( vcl::Window* pParent )
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());
+ mfHighlightTransparence = 0.25;
}
VCL_BUILDER_FACTORY(RecentDocsView)
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index dbd2379..11b985d 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -312,7 +312,7 @@ void TemplateAbstractView::Paint(vcl::RenderContext& rRenderContext, const Recta
drawinglayer::primitive2d::Primitive2DSequence aSeq(1);
aSeq[0] = drawinglayer::primitive2d::Primitive2DReference(
new PolyPolygonColorPrimitive2D(B2DPolyPolygon(Polygon(aRect).getB2DPolygon()),
- BColor(1.0, 1.0, 1.0)));
+ maFillColor.getBColor()));
const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> mpProcessor(
diff --git a/sfx2/source/control/templatecontaineritem.cxx b/sfx2/source/control/templatecontaineritem.cxx
index 16e05d1..b4f2f63 100644
--- a/sfx2/source/control/templatecontaineritem.cxx
+++ b/sfx2/source/control/templatecontaineritem.cxx
@@ -22,7 +22,6 @@
#include <sfx2/templateviewitem.hxx>
#include <vcl/button.hxx>
#include <vcl/graph.hxx>
-#include <svtools/optionsdrawinglayer.hxx>
using namespace basegfx;
using namespace basegfx::tools;
@@ -75,10 +74,7 @@ void TemplateContainerItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p
aFillColor = pAttrs->aHighlightColor;
if (mbHover)
- {
- const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
- fTransparence = aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01;
- }
+ fTransparence = pAttrs->fHighlightTransparence;
aSeq[nCount++] = drawinglayer::primitive2d::Primitive2DReference( new PolyPolygonSelectionPrimitive2D(
B2DPolyPolygon(Polygon(maDrawArea,5,5).getB2DPolygon()),
@@ -88,9 +84,9 @@ void TemplateContainerItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p
true));
// Create rounded rectangle border
- aSeq[nCount++] = drawinglayer::primitive2d::Primitive2DReference( new PolygonStrokePrimitive2D(
- Polygon(maThumbnailArea,5,5).getB2DPolygon(),
- LineAttribute(BColor(0.8, 0.8, 0.8), 2.0)));
+ aSeq[nCount++] = drawinglayer::primitive2d::Primitive2DReference(new PolygonStrokePrimitive2D(
+ Polygon(maThumbnailArea, 5, 5).getB2DPolygon(),
+ LineAttribute(BColor(0.5, 0.5, 0.5), 2.0)));
// Paint the thumbnails side by side on a 2x2 grid
long nThumbPadding = 4;
diff --git a/sfx2/source/control/templatedefaultview.cxx b/sfx2/source/control/templatedefaultview.cxx
index 61c3f2c..39ee415 100644
--- a/sfx2/source/control/templatedefaultview.cxx
+++ b/sfx2/source/control/templatedefaultview.cxx
@@ -12,6 +12,8 @@
#include <vcl/builderfactory.hxx>
#include <sfx2/app.hxx>
+#include <officecfg/Office/Common.hxx>
+
VCL_BUILDER_FACTORY(TemplateDefaultView)
TemplateDefaultView::TemplateDefaultView( Window* pParent)
@@ -23,6 +25,25 @@ TemplateDefaultView::TemplateDefaultView( Window* pParent)
Rectangle aScreen = Application::GetScreenPosSizePixel(Application::GetDisplayBuiltInScreen());
mnItemMaxSize = std::min(aScreen.GetWidth(),aScreen.GetHeight()) > 800 ? 256 : 192;
ThumbnailView::setItemDimensions( mnItemMaxSize, mnItemMaxSize, mnTextHeight, mnItemPadding );
+
+ // startcenter specific settings
+ 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());
+ mfHighlightTransparence = 0.25;
+
+
+ maAllButton->SetControlForeground(maTextColor);
+ maFTName->SetControlForeground(maTextColor);
+
+ // TODO - convert the TemplateAbstractView to .ui (instead of fixed layout
+ // of the button and the fixed text), and do the following:
+ // const float fMultiplier = 1.4;
+ // vcl::Font aFont(maAllButton->GetSettings().GetStyleSettings().GetPushButtonFont());
+ // aFont.SetSize(Size(0, aFont.GetSize().Height() * fMultiplier));
+ // maAllButton->SetControlFont(aFont);
+ // maFTName->SetControlFont(aFont);
}
void TemplateDefaultView::reload()
diff --git a/sfx2/source/control/templateviewitem.cxx b/sfx2/source/control/templateviewitem.cxx
index c2ce8d2..05b7ebb 100644
--- a/sfx2/source/control/templateviewitem.cxx
+++ b/sfx2/source/control/templateviewitem.cxx
@@ -20,7 +20,6 @@
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <vcl/button.hxx>
#include <vcl/graph.hxx>
-#include <svtools/optionsdrawinglayer.hxx>
#define SUBTITLE_SCALE_FACTOR 0.85
@@ -77,11 +76,8 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces
if ( mbSelected || mbHover )
aFillColor = pAttrs->aHighlightColor;
- if(mbHover)
- {
- const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
- fTransparence = aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01;
- }
+ if (mbHover)
+ fTransparence = pAttrs->fHighlightTransparence;
aSeq[0] = drawinglayer::primitive2d::Primitive2DReference( new PolyPolygonSelectionPrimitive2D(
B2DPolyPolygon(Polygon(maDrawArea,5,5).getB2DPolygon()),
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index b9f50d9..ff050df 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -29,6 +29,7 @@
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
#include <rtl/ustring.hxx>
+#include <svtools/optionsdrawinglayer.hxx>
#include <vcl/decoview.hxx>
#include <vcl/svapp.hxx>
#include <vcl/scrbar.hxx>
@@ -151,6 +152,10 @@ void ThumbnailView::ImplInit()
maTextColor = GetSettings().GetStyleSettings().GetWindowTextColor();
maHighlightColor = GetSettings().GetStyleSettings().GetHighlightColor();
maHighlightTextColor = GetSettings().GetStyleSettings().GetWindowTextColor();
+
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ mfHighlightTransparence = aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01;
+
mpStartSelRange = mFilteredItemList.end();
ApplySettings(*this);
@@ -203,6 +208,7 @@ void ThumbnailView::ApplySettings(vcl::RenderContext& rRenderContext)
mpItemAttrs->aTextColor = maTextColor.getBColor();
mpItemAttrs->aHighlightColor = maHighlightColor.getBColor();
mpItemAttrs->aHighlightTextColor = maHighlightTextColor.getBColor();
+ mpItemAttrs->fHighlightTransparence = mfHighlightTransparence;
mpItemAttrs->aFontAttr = getFontAttributeFromVclFont(mpItemAttrs->aFontSize,GetFont(),false,true);
mpItemAttrs->nMaxTextLength = 0;
}
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index 7a0390c..68586ba 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -37,7 +37,6 @@
#include <vcl/graph.hxx>
#include <vcl/svapp.hxx>
#include <vcl/texteng.hxx>
-#include <svtools/optionsdrawinglayer.hxx>
using namespace basegfx;
using namespace basegfx::tools;
@@ -277,10 +276,7 @@ void ThumbnailViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *pProc
aFillColor = pAttrs->aHighlightColor;
if (mbHover)
- {
- const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
- fTransparence = 0.25;
- }
+ fTransparence = pAttrs->fHighlightTransparence;
sal_uInt32 nPrimitive = 0;
aSeq[nPrimitive++] = drawinglayer::primitive2d::Primitive2DReference( new PolyPolygonSelectionPrimitive2D(
More information about the Libreoffice-commits
mailing list