compilerplugins/clang/mergeclasses.results | 4 include/vcl/layout.hxx | 32 ------- svtools/source/contnr/fileview.cxx | 44 +++------- vcl/source/window/layout.cxx | 74 +++++++++++------- xmloff/Library_xo.mk | 1 xmloff/inc/forms/property_handler.hxx | 7 - xmloff/source/forms/handler/property_handler_base.cxx | 32 ------- xmloff/source/forms/handler/property_handler_base.hxx | 41 --------- xmloff/source/forms/handler/vcl_date_handler.hxx | 2 xmloff/source/forms/handler/vcl_time_handler.hxx | 2 10 files changed, 70 insertions(+), 169 deletions(-)
New commits: commit 946b9a04c4a9d252661fe7190213c225fa79bf92 Author: Noel Grandin <[email protected]> Date: Mon Oct 5 16:00:07 2015 +0200 loplugin:mergeclasses and move the boost-depending code inside the module, no need to expose that dependency and include that header in all client code. Change-Id: Ib991572d7a54a9ad16825d688e76f8e3a824803c diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index 412b395..9981e45 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -91,7 +91,6 @@ merge UpdateCheckConfigListener with UpdateCheck merge ValueGetter with CellValueGetter merge ValueSetter with CellValueSetter merge VariableTextField with VariableDateTimeField -merge VclGrid::GridEntry with VclGrid::ExtendedGridEntry merge Viewport3D with Camera3D merge XFDate with XFDateStart merge XFDateTimePart with XFTimePart diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index ac6f44f..0be5645 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -18,7 +18,6 @@ #include <vcl/vclmedit.hxx> #include <vcl/window.hxx> #include <vcl/vclptr.hxx> -#include <boost/multi_array.hpp> #include <set> class VCL_DLLPUBLIC VclContainer : public vcl::Window @@ -310,36 +309,6 @@ private: int m_nRowSpacing; int m_nColumnSpacing; - struct GridEntry - { - VclPtr<vcl::Window> pChild; - sal_Int32 nSpanWidth; - sal_Int32 nSpanHeight; - GridEntry() - : pChild(0) - , nSpanWidth(0) - , nSpanHeight(0) - { - } - }; - - typedef boost::multi_array<GridEntry, 2> array_type; - - struct ExtendedGridEntry : GridEntry - { - int x; - int y; - ExtendedGridEntry() - : x(-1) - , y(-1) - { - } - }; - - typedef boost::multi_array<ExtendedGridEntry, 2> ext_array_type; - - array_type assembleGrid() const; - static bool isNullGrid(const array_type& A); public: struct Value { @@ -348,7 +317,6 @@ public: Value() : m_nValue(0), m_bExpand(false) {} }; private: - static void calcMaxs(const array_type &A, std::vector<Value> &rWidths, std::vector<Value> &rHeights); Size calculateRequisitionForSpacings(sal_Int32 nRowSpacing, sal_Int32 nColSpacing) const; virtual Size calculateRequisition() const SAL_OVERRIDE; diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index a15bcbb..893640f 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -14,6 +14,7 @@ #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include "window.h" +#include <boost/multi_array.hpp> VclContainer::VclContainer(vcl::Window *pParent, WinBits nStyle) : Window(WINDOW_CONTAINER) @@ -748,11 +749,34 @@ void VclButtonBox::sort_native_button_order() VclBuilder::reorderWithinParent(aChilds, true); } -VclGrid::array_type VclGrid::assembleGrid() const +struct GridEntry { - ext_array_type A; + VclPtr<vcl::Window> pChild; + sal_Int32 nSpanWidth; + sal_Int32 nSpanHeight; + int x; + int y; + GridEntry() + : pChild(0) + , nSpanWidth(0) + , nSpanHeight(0) + , x(-1) + , y(-1) + { + } +}; - for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild; +typedef boost::multi_array<GridEntry, 2> array_type; + +static array_type assembleGrid(const VclGrid &rGrid); +static bool isNullGrid(const array_type& A); +static void calcMaxs(const array_type &A, std::vector<VclGrid::Value> &rWidths, std::vector<VclGrid::Value> &rHeights); + +array_type assembleGrid(const VclGrid &rGrid) +{ + array_type A; + + for (vcl::Window* pChild = rGrid.GetWindow(GetWindowType::FirstChild); pChild; pChild = pChild->GetWindow(GetWindowType::Next)) { sal_Int32 nLeftAttach = std::max<sal_Int32>(pChild->get_grid_left_attach(), 0); @@ -772,7 +796,7 @@ VclGrid::array_type VclGrid::assembleGrid() const A.resize(boost::extents[nCurrentMaxXPos+1][nCurrentMaxYPos+1]); } - ExtendedGridEntry &rEntry = A[nLeftAttach][nTopAttach]; + GridEntry &rEntry = A[nLeftAttach][nTopAttach]; rEntry.pChild = pChild; rEntry.nSpanWidth = nWidth; rEntry.nSpanHeight = nHeight; @@ -783,7 +807,7 @@ VclGrid::array_type VclGrid::assembleGrid() const { for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY) { - ExtendedGridEntry &rSpan = A[nLeftAttach+nSpanX][nTopAttach+nSpanY]; + GridEntry &rSpan = A[nLeftAttach+nSpanX][nTopAttach+nSpanY]; rSpan.x = nLeftAttach; rSpan.y = nTopAttach; } @@ -806,13 +830,13 @@ VclGrid::array_type VclGrid::assembleGrid() const if (pChild && pChild->IsVisible()) { aNonEmptyCols[x] = true; - if (get_column_homogeneous()) + if (rGrid.get_column_homogeneous()) { for (sal_Int32 nSpanX = 1; nSpanX < rEntry.nSpanWidth; ++nSpanX) aNonEmptyCols[x+nSpanX] = true; } aNonEmptyRows[y] = true; - if (get_row_homogeneous()) + if (rGrid.get_row_homogeneous()) { for (sal_Int32 nSpanY = 1; nSpanY < rEntry.nSpanHeight; ++nSpanY) aNonEmptyRows[y+nSpanY] = true; @@ -821,17 +845,17 @@ VclGrid::array_type VclGrid::assembleGrid() const } } - if (!get_column_homogeneous()) + if (!rGrid.get_column_homogeneous()) { //reduce the spans of elements that span empty columns for (sal_Int32 x = 0; x < nMaxX; ++x) { - std::set<ExtendedGridEntry*> candidates; + std::set<GridEntry*> candidates; for (sal_Int32 y = 0; y < nMaxY; ++y) { if (aNonEmptyCols[x]) continue; - ExtendedGridEntry &rSpan = A[x][y]; + GridEntry &rSpan = A[x][y]; //cell x/y is spanned by the widget at cell rSpan.x/rSpan.y, //just points back to itself if there's no cell spanning if ((rSpan.x == -1) || (rSpan.y == -1)) @@ -840,29 +864,29 @@ VclGrid::array_type VclGrid::assembleGrid() const //with no widget in it, or spanned by any other widget continue; } - ExtendedGridEntry &rEntry = A[rSpan.x][rSpan.y]; + GridEntry &rEntry = A[rSpan.x][rSpan.y]; candidates.insert(&rEntry); } - for (std::set<ExtendedGridEntry*>::iterator aI = candidates.begin(), aEnd = candidates.end(); + for (std::set<GridEntry*>::iterator aI = candidates.begin(), aEnd = candidates.end(); aI != aEnd; ++aI) { - ExtendedGridEntry *pEntry = *aI; + GridEntry *pEntry = *aI; --pEntry->nSpanWidth; } } } - if (!get_row_homogeneous()) + if (!rGrid.get_row_homogeneous()) { //reduce the spans of elements that span empty rows for (sal_Int32 y = 0; y < nMaxY; ++y) { - std::set<ExtendedGridEntry*> candidates; + std::set<GridEntry*> candidates; for (sal_Int32 x = 0; x < nMaxX; ++x) { if (aNonEmptyRows[y]) continue; - ExtendedGridEntry &rSpan = A[x][y]; + GridEntry &rSpan = A[x][y]; //cell x/y is spanned by the widget at cell rSpan.x/rSpan.y, //just points back to itself if there's no cell spanning if ((rSpan.x == -1) || (rSpan.y == -1)) @@ -871,13 +895,13 @@ VclGrid::array_type VclGrid::assembleGrid() const //with no widget in it, or spanned by any other widget continue; } - ExtendedGridEntry &rEntry = A[rSpan.x][rSpan.y]; + GridEntry &rEntry = A[rSpan.x][rSpan.y]; candidates.insert(&rEntry); } - for (std::set<ExtendedGridEntry*>::iterator aI = candidates.begin(), aEnd = candidates.end(); + for (std::set<GridEntry*>::iterator aI = candidates.begin(), aEnd = candidates.end(); aI != aEnd; ++aI) { - ExtendedGridEntry *pEntry = *aI; + GridEntry *pEntry = *aI; --pEntry->nSpanHeight; } } @@ -905,7 +929,7 @@ VclGrid::array_type VclGrid::assembleGrid() const return B; } -bool VclGrid::isNullGrid(const array_type &A) +static bool isNullGrid(const array_type &A) { sal_Int32 nMaxX = A.shape()[0]; sal_Int32 nMaxY = A.shape()[1]; @@ -915,7 +939,7 @@ bool VclGrid::isNullGrid(const array_type &A) return false; } -void VclGrid::calcMaxs(const array_type &A, std::vector<Value> &rWidths, std::vector<Value> &rHeights) +static void calcMaxs(const array_type &A, std::vector<VclGrid::Value> &rWidths, std::vector<VclGrid::Value> &rHeights) { sal_Int32 nMaxX = A.shape()[0]; sal_Int32 nMaxY = A.shape()[1]; @@ -944,7 +968,7 @@ void VclGrid::calcMaxs(const array_type &A, std::vector<Value> &rWidths, std::ve if (nWidth == 1 || nHeight == 1) { - Size aChildSize = getLayoutRequisition(*pChild); + Size aChildSize = VclContainer::getLayoutRequisition(*pChild); if (nWidth == 1) rWidths[x].m_nValue = std::max(rWidths[x].m_nValue, aChildSize.Width()); if (nHeight == 1) @@ -970,7 +994,7 @@ void VclGrid::calcMaxs(const array_type &A, std::vector<Value> &rWidths, std::ve if (nWidth == 1 && nHeight == 1) continue; - Size aChildSize = getLayoutRequisition(*pChild); + Size aChildSize = VclContainer::getLayoutRequisition(*pChild); if (nWidth > 1) { @@ -1053,7 +1077,7 @@ Size VclGrid::calculateRequisition() const Size VclGrid::calculateRequisitionForSpacings(sal_Int32 nRowSpacing, sal_Int32 nColSpacing) const { - array_type A = assembleGrid(); + array_type A = assembleGrid(*this); if (isNullGrid(A)) return Size(); @@ -1093,7 +1117,7 @@ Size VclGrid::calculateRequisitionForSpacings(sal_Int32 nRowSpacing, sal_Int32 n void VclGrid::setAllocation(const Size& rAllocation) { - array_type A = assembleGrid(); + array_type A = assembleGrid(*this); if (isNullGrid(A)) return; commit d451de7f08ba984f103364e167c8c6d097e493a8 Author: Noel Grandin <[email protected]> Date: Mon Oct 5 14:55:06 2015 +0200 loplugin:mergeclasses Change-Id: I592eef7503bd0b492f73ea5216f436302ad79ca8 diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index 0ed5086..412b395 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -326,4 +326,4 @@ merge ww8::WW8Struct with ww8::WW8Sttb merge xmloff::IEventAttacher with xmloff::OElementImport merge xmloff::IEventAttacherManager with xmloff::ODefaultEventAttacherManager merge xmloff::IFormsExportContext with xmloff::OFormLayerXMLExport_Impl -merge xmloff::IPropertyHandler with xmloff::PropertyHandlerBase + diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk index bbda106..9575643 100644 --- a/xmloff/Library_xo.mk +++ b/xmloff/Library_xo.mk @@ -176,7 +176,6 @@ $(eval $(call gb_Library_add_exception_objects,xo,\ xmloff/source/forms/property_meta_data \ xmloff/source/forms/valueproperties \ xmloff/source/forms/handler/form_handler_factory \ - xmloff/source/forms/handler/property_handler_base \ xmloff/source/forms/handler/vcl_date_handler \ xmloff/source/forms/handler/vcl_time_handler \ xmloff/source/meta/MetaExportComponent \ diff --git a/xmloff/inc/forms/property_handler.hxx b/xmloff/inc/forms/property_handler.hxx index 48658f1..daa1f0f 100644 --- a/xmloff/inc/forms/property_handler.hxx +++ b/xmloff/inc/forms/property_handler.hxx @@ -35,8 +35,7 @@ namespace xmloff typedef ::std::map< PropertyId, ::com::sun::star::uno::Any > PropertyValues; - //= IPropertyHandler - class IPropertyHandler : public ::salhelper::SimpleReferenceObject + class PropertyHandlerBase : public ::salhelper::SimpleReferenceObject { public: /** retrieves the XML attribute value for the given property values @@ -54,11 +53,11 @@ namespace xmloff virtual bool getPropertyValues( const OUString& i_attributeValue, PropertyValues& o_propertyValues ) const = 0; - virtual ~IPropertyHandler() { } + virtual ~PropertyHandlerBase() {} }; //= PPropertyHandler - typedef ::rtl::Reference< IPropertyHandler > PPropertyHandler; + typedef rtl::Reference< PropertyHandlerBase > PPropertyHandler; //= PropertyHandlerFactory typedef PPropertyHandler (*PropertyHandlerFactory)( const PropertyId i_propertyId ); diff --git a/xmloff/source/forms/handler/property_handler_base.cxx b/xmloff/source/forms/handler/property_handler_base.cxx deleted file mode 100644 index ea8f16b..0000000 --- a/xmloff/source/forms/handler/property_handler_base.cxx +++ /dev/null @@ -1,32 +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 "property_handler_base.hxx" - -namespace xmloff -{ - - //= PropertyHandlerBase - PropertyHandlerBase::~PropertyHandlerBase() - { - } - -} // namespace xmloff - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/forms/handler/property_handler_base.hxx b/xmloff/source/forms/handler/property_handler_base.hxx deleted file mode 100644 index 0cf4d0d..0000000 --- a/xmloff/source/forms/handler/property_handler_base.hxx +++ /dev/null @@ -1,41 +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_XMLOFF_SOURCE_FORMS_HANDLER_PROPERTY_HANDLER_BASE_HXX -#define INCLUDED_XMLOFF_SOURCE_FORMS_HANDLER_PROPERTY_HANDLER_BASE_HXX - -#include "forms/property_handler.hxx" - -namespace xmloff -{ - - //= PropertyHandlerBase - class PropertyHandlerBase : public IPropertyHandler - { - protected: - PropertyHandlerBase() {} - - virtual ~PropertyHandlerBase(); - }; - -} // namespace xmloff - -#endif // INCLUDED_XMLOFF_SOURCE_FORMS_HANDLER_PROPERTY_HANDLER_BASE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/forms/handler/vcl_date_handler.hxx b/xmloff/source/forms/handler/vcl_date_handler.hxx index d188ca5..673efc7 100644 --- a/xmloff/source/forms/handler/vcl_date_handler.hxx +++ b/xmloff/source/forms/handler/vcl_date_handler.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_XMLOFF_SOURCE_FORMS_HANDLER_VCL_DATE_HANDLER_HXX #define INCLUDED_XMLOFF_SOURCE_FORMS_HANDLER_VCL_DATE_HANDLER_HXX -#include "property_handler_base.hxx" +#include "forms/property_handler.hxx" namespace xmloff { diff --git a/xmloff/source/forms/handler/vcl_time_handler.hxx b/xmloff/source/forms/handler/vcl_time_handler.hxx index 67a95ef..7dcc873 100644 --- a/xmloff/source/forms/handler/vcl_time_handler.hxx +++ b/xmloff/source/forms/handler/vcl_time_handler.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_XMLOFF_SOURCE_FORMS_HANDLER_VCL_TIME_HANDLER_HXX #define INCLUDED_XMLOFF_SOURCE_FORMS_HANDLER_VCL_TIME_HANDLER_HXX -#include "property_handler_base.hxx" +#include "forms/property_handler.hxx" namespace xmloff { commit 4e2a8b78be17001cf7a3f648261559754a24e555 Author: Noel Grandin <[email protected]> Date: Mon Oct 5 14:33:35 2015 +0200 loplugin:mergeclasses Change-Id: I7c8c60aab31517d595a7e37c3789fa1e515ec3ee diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index 40dfe8f..0ed5086 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -1,5 +1,4 @@ merge (anonymous namespace)::Data with cppu::PropertySetMixinImpl::Impl -merge (anonymous namespace)::ITimeoutHandler with SvtFileView_Impl merge (anonymous namespace)::VCLXToolkit_Impl with (anonymous namespace)::VCLXToolkit merge AbstractMailMergeWizard with AbstractMailMergeWizard_Impl merge AbstractSearchProgress with AbstractSearchProgress_Impl diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index fa2a2c4..e0f9214 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -113,42 +113,21 @@ namespace o3tl namespace { - //= ITimeoutHandler - - class CallbackTimer; - class ITimeoutHandler - { - public: - virtual void onTimeout( CallbackTimer* _pInstigator ) = 0; - - protected: - ~ITimeoutHandler() {} - }; - - //= CallbackTimer class CallbackTimer : public ::salhelper::Timer { protected: - ITimeoutHandler* m_pTimeoutHandler; + SvtFileView_Impl* m_pTimeoutHandler; public: - CallbackTimer( ITimeoutHandler* _pHandler ) : m_pTimeoutHandler( _pHandler ) { } + CallbackTimer( SvtFileView_Impl* _pHandler ) : m_pTimeoutHandler( _pHandler ) { } protected: virtual void SAL_CALL onShot() SAL_OVERRIDE; }; - void SAL_CALL CallbackTimer::onShot() - { - OSL_ENSURE( m_pTimeoutHandler, "CallbackTimer::onShot: nobody interested in?" ); - ITimeoutHandler* pHandler( m_pTimeoutHandler ); - if ( pHandler ) - pHandler->onTimeout( this ); - } - } @@ -330,7 +309,6 @@ public: class SvtFileView_Impl :public ::svt::IEnumerationResultHandler - ,public ITimeoutHandler { protected: VclPtr<SvtFileView> mpAntiImpl; @@ -417,16 +395,14 @@ public: inline void EndEditing( bool _bCancel ); + void onTimeout(); + protected: DECL_LINK_TYPED( SelectionMultiplexer, SvTreeListBox*, void ); -protected: // IEnumerationResultHandler overridables virtual void enumerationDone( ::svt::EnumerationResult eResult ) SAL_OVERRIDE; void implEnumerationSuccess(); - - // ITimeoutHandler - virtual void onTimeout( CallbackTimer* _pInstigator ) SAL_OVERRIDE; }; inline void SvtFileView_Impl::EnableDelete( bool bEnable ) @@ -1835,7 +1811,7 @@ void SvtFileView_Impl::CancelRunningAsyncAction() } -void SvtFileView_Impl::onTimeout( CallbackTimer* ) +void SvtFileView_Impl::onTimeout() { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( maMutex ); @@ -2262,4 +2238,14 @@ void QueryDeleteDlg_Impl::dispose() } +namespace { + void SAL_CALL CallbackTimer::onShot() + { + OSL_ENSURE( m_pTimeoutHandler, "CallbackTimer::onShot: nobody interested in?" ); + SvtFileView_Impl* pHandler( m_pTimeoutHandler ); + if ( pHandler ) + pHandler->onTimeout(); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
