summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-06 08:57:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-06 11:50:32 +0200
commitd24ff5a0664beeb22ad8eb50f07ccc2b93df9ae7 (patch)
tree649541e6a6e03afc0e9ce3b7baf54e22adea26b7
parent04f4702eb896a330bc3b10443b7303a1d07d7a11 (diff)
merge CellBorderUpdater into CellAppearancePropertyPanel
no point in having it separate, the code flow is cleaner this way Change-Id: Ibc04eb4fa0ee6438b84f181a2cbdb6de22872ac5 Reviewed-on: https://gerrit.libreoffice.org/52487 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/Library_sc.mk1
-rw-r--r--sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx46
-rw-r--r--sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx2
-rw-r--r--sc/source/ui/sidebar/CellBorderUpdater.cxx74
-rw-r--r--sc/source/ui/sidebar/CellBorderUpdater.hxx43
5 files changed, 39 insertions, 127 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 9d04c29f0d3f..00db6e4a44c0 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -502,7 +502,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/sidebar/AlignmentPropertyPanel \
sc/source/ui/sidebar/CellLineStyleControl \
sc/source/ui/sidebar/CellLineStyleValueSet \
- sc/source/ui/sidebar/CellBorderUpdater \
sc/source/ui/sidebar/CellAppearancePropertyPanel \
sc/source/ui/sidebar/CellBorderStyleControl \
sc/source/ui/sidebar/NumberFormatControl \
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
index 29a76f8e9a75..96ad5468136b 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -34,7 +34,6 @@
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include "CellLineStyleControl.hxx"
-#include "CellBorderUpdater.hxx"
#include "CellBorderStyleControl.hxx"
using namespace css;
@@ -100,9 +99,6 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
get(mpTBLineStyle, "borderlinestyle");
get(mpTBLineColor, "borderlinecolor");
- mpCellBorderUpdater.reset( new CellBorderUpdater(
- mpTBCellBorder->GetItemId( UNO_SETBORDERSTYLE ), *mpTBCellBorder) );
-
Initialize();
}
@@ -273,9 +269,9 @@ void CellAppearancePropertyPanel::NotifyItemUpdate(
mbBottom = true;
if(!AllSettings::GetLayoutRTL())
- mpCellBorderUpdater->UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, maIMGCellBorder, mbVer, mbHor);
+ UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, mbVer, mbHor);
else
- mpCellBorderUpdater->UpdateCellBorder(mbTop, mbBottom, mbRight, mbLeft, maIMGCellBorder, mbVer, mbHor);
+ UpdateCellBorder(mbTop, mbBottom, mbRight, mbLeft, mbVer, mbHor);
if(mbLeft || mbRight || mbTop || mbBottom)
mbOuterBorder = true;
@@ -317,9 +313,9 @@ void CellAppearancePropertyPanel::NotifyItemUpdate(
bBottom = true;
if(!AllSettings::GetLayoutRTL())
- mpCellBorderUpdater->UpdateCellBorder(bTop, bBottom, bLeft, bRight, maIMGCellBorder, mbVer, mbHor);
+ UpdateCellBorder(bTop, bBottom, bLeft, bRight, mbVer, mbHor);
else
- mpCellBorderUpdater->UpdateCellBorder(bTop, bBottom, bRight, bLeft, maIMGCellBorder, mbVer, mbHor);
+ UpdateCellBorder(bTop, bBottom, bRight, bLeft, mbVer, mbHor);
if(mbVer || mbHor || bLeft || bRight || bTop || bBottom)
mbInnerBorder = true;
@@ -511,6 +507,40 @@ void CellAppearancePropertyPanel::UpdateControlState()
}
}
+void CellAppearancePropertyPanel::UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, bool bVer, bool bHor)
+{
+ const Size aBmpSize = maIMGCellBorder.GetBitmapEx().GetSizePixel();
+
+ ScopedVclPtr<VirtualDevice> pVirDev(VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(),
+ DeviceFormat::DEFAULT, DeviceFormat::DEFAULT));
+ pVirDev->SetOutputSizePixel(aBmpSize);
+ pVirDev->SetBackground(COL_TRANSPARENT);
+ pVirDev->Erase();
+ pVirDev->SetLineColor( ::Application::GetSettings().GetStyleSettings().GetFieldTextColor() ) ;
+ pVirDev->SetFillColor(COL_BLACK);
+
+ const int btnId = mpTBCellBorder->GetItemId( UNO_SETBORDERSTYLE );
+
+ if(aBmpSize.Width() == 43 && aBmpSize.Height() == 43)
+ {
+ Point aTL(2, 1), aTR(42,1), aBL(2, 41), aBR(42, 41), aHL(2,21), aHR(42, 21), aVT(22,1), aVB(22, 41);
+ if(bLeft)
+ pVirDev->DrawLine( aTL,aBL );
+ if(bRight)
+ pVirDev->DrawLine( aTR,aBR );
+ if(bTop)
+ pVirDev->DrawLine( aTL,aTR );
+ if(bBot)
+ pVirDev->DrawLine( aBL,aBR );
+ if(bVer)
+ pVirDev->DrawLine( aVT,aVB );
+ if(bHor)
+ pVirDev->DrawLine( aHL,aHR );
+ mpTBCellBorder->SetItemOverlayImage( btnId, Image( pVirDev->GetBitmapEx(Point(0,0), aBmpSize) ) );
+ }
+
+ mpTBCellBorder->SetItemImage( btnId, maIMGCellBorder );
+}
// namespace close
}} // end of namespace ::sc::sidebar
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
index 3889020263aa..8a5c6a924256 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
@@ -78,7 +78,6 @@ private:
VclPtr<ToolBox> mpTBCellBorder;
VclPtr<ToolBox> mpTBLineStyle;
VclPtr<ToolBox> mpTBLineColor;
- std::unique_ptr< CellBorderUpdater > mpCellBorderUpdater;
::sfx2::sidebar::ControllerItem maLineStyleControl;
::sfx2::sidebar::ControllerItem maBorderOuterControl;
@@ -139,6 +138,7 @@ private:
void Initialize();
void SetStyleIcon();
void UpdateControlState();
+ void UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, bool bVer, bool bHor);
};
} } // end of namespace ::sc::sidebar
diff --git a/sc/source/ui/sidebar/CellBorderUpdater.cxx b/sc/source/ui/sidebar/CellBorderUpdater.cxx
deleted file mode 100644
index 394835ff4d57..000000000000
--- a/sc/source/ui/sidebar/CellBorderUpdater.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "CellBorderUpdater.hxx"
-#include <vcl/virdev.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/settings.hxx>
-
-namespace sc { namespace sidebar {
-
-CellBorderUpdater::CellBorderUpdater(
- sal_uInt16 nTbxBtnId,
- ToolBox& rTbx)
-: mnBtnId(nTbxBtnId),
- mrTbx(rTbx)
-{
-}
-
-CellBorderUpdater::~CellBorderUpdater()
-{
-}
-
-void CellBorderUpdater::UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, Image const & aImg, bool bVer, bool bHor)
-{
- const Size aBmpSize = aImg.GetBitmapEx().GetSizePixel();
-
- ScopedVclPtr<VirtualDevice> pVirDev(VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(),
- DeviceFormat::DEFAULT, DeviceFormat::DEFAULT));
- pVirDev->SetOutputSizePixel(aBmpSize);
- pVirDev->SetBackground(COL_TRANSPARENT);
- pVirDev->Erase();
- pVirDev->SetLineColor( ::Application::GetSettings().GetStyleSettings().GetFieldTextColor() ) ;
- pVirDev->SetFillColor(COL_BLACK);
-
- if(aBmpSize.Width() == 43 && aBmpSize.Height() == 43)
- {
- Point aTL(2, 1), aTR(42,1), aBL(2, 41), aBR(42, 41), aHL(2,21), aHR(42, 21), aVT(22,1), aVB(22, 41);
- if(bLeft)
- pVirDev->DrawLine( aTL,aBL );
- if(bRight)
- pVirDev->DrawLine( aTR,aBR );
- if(bTop)
- pVirDev->DrawLine( aTL,aTR );
- if(bBot)
- pVirDev->DrawLine( aBL,aBR );
- if(bVer)
- pVirDev->DrawLine( aVT,aVB );
- if(bHor)
- pVirDev->DrawLine( aHL,aHR );
- mrTbx.SetItemOverlayImage( mnBtnId, Image( pVirDev->GetBitmapEx(Point(0,0), aBmpSize) ) );
- }
-
- mrTbx.SetItemImage( mnBtnId, aImg );
-}
-
-} } // end of namespace svx::sidebar
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/sidebar/CellBorderUpdater.hxx b/sc/source/ui/sidebar/CellBorderUpdater.hxx
deleted file mode 100644
index 7f48af9ae435..000000000000
--- a/sc/source/ui/sidebar/CellBorderUpdater.hxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_SC_SOURCE_UI_SIDEBAR_CELLBORDERUPDATER_HXX
-#define INCLUDED_SC_SOURCE_UI_SIDEBAR_CELLBORDERUPDATER_HXX
-
-#include <vcl/toolbox.hxx>
-
-namespace sc { namespace sidebar {
-
-class CellBorderUpdater
-{
-private:
- sal_uInt16 mnBtnId;
- ToolBox& mrTbx;
-
-public:
- CellBorderUpdater(sal_uInt16 nTbxBtnId, ToolBox& rTbx);
- ~CellBorderUpdater();
-
- void UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, Image const & aImg, bool bVer, bool bHor);
-};
-
-} } // end of namespace svx::sidebar
-
-#endif // INCLUDED_SC_SOURCE_UI_SIDEBAR_CELLBORDERUPDATER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */