diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-12-07 11:18:33 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-12-07 21:05:06 +0100 |
commit | 35b5f03e41e21085b67b56e29c52dcddc9a36c30 (patch) | |
tree | fdd93138f52d9f2f83a02fb3f54f50f23eb8732f | |
parent | a91e21b9acab16bd31dbefa4640d2e5f3c3c7d63 (diff) |
move various notebookbar widgets into vcl
and we can drop their factories then
Change-Id: I1e261886dd7700710ba628da4bbeeba65efa1531
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107134
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
46 files changed, 431 insertions, 371 deletions
diff --git a/accessibility/inc/pch/precompiled_acc.hxx b/accessibility/inc/pch/precompiled_acc.hxx index fe8854898eae..12380b639d04 100644 --- a/accessibility/inc/pch/precompiled_acc.hxx +++ b/accessibility/inc/pch/precompiled_acc.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:03 using: + Generated on 2020-12-07 11:30:23 using: ./bin/update_pch accessibility acc --cutoff=4 --exclude:system --include:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -86,7 +86,6 @@ #include <sal/typesizes.h> #include <vcl/AccessibleBrowseBoxObjType.hxx> #include <vcl/EnumContext.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> #include <vcl/NotebookbarContextControl.hxx> #include <vcl/Scanline.hxx> #include <vcl/accessibletable.hxx> @@ -114,6 +113,7 @@ #include <vcl/mapmod.hxx> #include <vcl/menu.hxx> #include <vcl/metaactiontypes.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vcl/outdev.hxx> #include <vcl/outdevmap.hxx> #include <vcl/outdevstate.hxx> diff --git a/basctl/inc/pch/precompiled_basctl.hxx b/basctl/inc/pch/precompiled_basctl.hxx index 56231839e9bc..f113bc8d1bcd 100644 --- a/basctl/inc/pch/precompiled_basctl.hxx +++ b/basctl/inc/pch/precompiled_basctl.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:03 using: + Generated on 2020-12-07 11:30:23 using: ./bin/update_pch basctl basctl --cutoff=3 --exclude:system --include:module --exclude:local If after updating build fails, use the following command to locate conflicting headers: @@ -98,7 +98,6 @@ #include <vcl/GraphicObject.hxx> #include <vcl/IDialogRenderable.hxx> #include <vcl/InterimItemWindow.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> #include <vcl/PrinterSupport.hxx> #include <vcl/Scanline.hxx> #include <vcl/alpha.hxx> @@ -131,6 +130,7 @@ #include <vcl/menu.hxx> #include <vcl/metaactiontypes.hxx> #include <vcl/metric.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vcl/outdev.hxx> #include <vcl/outdevmap.hxx> #include <vcl/outdevstate.hxx> diff --git a/chart2/inc/pch/precompiled_chartcontroller.hxx b/chart2/inc/pch/precompiled_chartcontroller.hxx index a7590ead0568..08f4475879e6 100644 --- a/chart2/inc/pch/precompiled_chartcontroller.hxx +++ b/chart2/inc/pch/precompiled_chartcontroller.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:05 using: + Generated on 2020-12-07 11:30:25 using: ./bin/update_pch chart2 chartcontroller --cutoff=6 --exclude:system --include:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -92,7 +92,6 @@ #include <vcl/GraphicAttributes.hxx> #include <vcl/GraphicExternalLink.hxx> #include <vcl/GraphicObject.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> #include <vcl/Scanline.hxx> #include <vcl/alpha.hxx> #include <vcl/animate/Animation.hxx> @@ -121,6 +120,7 @@ #include <vcl/mapmod.hxx> #include <vcl/menu.hxx> #include <vcl/metaactiontypes.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vcl/outdev.hxx> #include <vcl/outdevmap.hxx> #include <vcl/outdevstate.hxx> diff --git a/connectivity/inc/pch/precompiled_ado.hxx b/connectivity/inc/pch/precompiled_ado.hxx index 236641004a7e..63c8173261d6 100644 --- a/connectivity/inc/pch/precompiled_ado.hxx +++ b/connectivity/inc/pch/precompiled_ado.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:06 using: + Generated on 2020-12-07 11:30:26 using: ./bin/update_pch connectivity ado --cutoff=2 --exclude:system --exclude:module --exclude:local If after updating build fails, use the following command to locate conflicting headers: diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx index 2ceb9ab4e41f..09b1dcd8996b 100644 --- a/cui/inc/pch/precompiled_cui.hxx +++ b/cui/inc/pch/precompiled_cui.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:10 using: + Generated on 2020-12-07 11:30:30 using: ./bin/update_pch cui cui --cutoff=8 --exclude:system --include:module --exclude:local If after updating build fails, use the following command to locate conflicting headers: @@ -99,7 +99,6 @@ #include <vcl/GraphicExternalLink.hxx> #include <vcl/GraphicObject.hxx> #include <vcl/IDialogRenderable.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> #include <vcl/Scanline.hxx> #include <vcl/alpha.hxx> #include <vcl/animate/Animation.hxx> @@ -130,6 +129,7 @@ #include <vcl/menu.hxx> #include <vcl/metaactiontypes.hxx> #include <vcl/metric.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vcl/outdev.hxx> #include <vcl/outdevmap.hxx> #include <vcl/outdevstate.hxx> diff --git a/drawinglayer/inc/pch/precompiled_drawinglayer.hxx b/drawinglayer/inc/pch/precompiled_drawinglayer.hxx index ac5318777d1e..68b621086090 100644 --- a/drawinglayer/inc/pch/precompiled_drawinglayer.hxx +++ b/drawinglayer/inc/pch/precompiled_drawinglayer.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:13 using: + Generated on 2020-12-07 11:30:33 using: ./bin/update_pch drawinglayer drawinglayer --cutoff=4 --exclude:system --exclude:module --exclude:local If after updating build fails, use the following command to locate conflicting headers: @@ -44,6 +44,7 @@ #include <rtl/instance.hxx> #include <rtl/math.hxx> #include <rtl/ref.hxx> +#include <rtl/strbuf.h> #include <rtl/string.h> #include <rtl/string.hxx> #include <rtl/stringconcat.hxx> diff --git a/include/vcl/IPrioritable.hxx b/include/vcl/notebookbar/IPrioritable.hxx index 55faf6431243..55faf6431243 100644 --- a/include/vcl/IPrioritable.hxx +++ b/include/vcl/notebookbar/IPrioritable.hxx diff --git a/include/vcl/NotebookBarAddonsMerger.hxx b/include/vcl/notebookbar/NotebookBarAddonsMerger.hxx index ef0e7d677e17..ef0e7d677e17 100644 --- a/include/vcl/NotebookBarAddonsMerger.hxx +++ b/include/vcl/notebookbar/NotebookBarAddonsMerger.hxx diff --git a/sfx2/source/notebookbar/NotebookbarPopup.hxx b/include/vcl/notebookbar/NotebookbarPopup.hxx index c417a75f4328..76ab84bee86e 100644 --- a/sfx2/source/notebookbar/NotebookbarPopup.hxx +++ b/include/vcl/notebookbar/NotebookbarPopup.hxx @@ -28,7 +28,7 @@ * and after close moved to the original parent */ -class NotebookbarPopup : public FloatingWindow +class VCL_DLLPUBLIC NotebookbarPopup : public FloatingWindow { private: VclPtr<VclHBox> m_pBox; diff --git a/include/vcl/notebookbar.hxx b/include/vcl/notebookbar/notebookbar.hxx index 759e0a143a09..35d37aec7b8d 100644 --- a/include/vcl/notebookbar.hxx +++ b/include/vcl/notebookbar/notebookbar.hxx @@ -7,12 +7,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_VCL_NOTEBOOKBAR_HXX -#define INCLUDED_VCL_NOTEBOOKBAR_HXX +#pragma once #include <vcl/builder.hxx> #include <vcl/ctrl.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vcl/settings.hxx> #include <set> #include <vector> @@ -75,6 +74,4 @@ private: void UpdatePersonaSettings(); }; -#endif // INCLUDED_VCL_NOTEBOOKBAR_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx index da7620a55ce6..6238e9f382ca 100644 --- a/include/vcl/syswin.hxx +++ b/include/vcl/syswin.hxx @@ -27,7 +27,7 @@ #include <vcl/window.hxx> #include <vcl/windowstate.hxx> #include <memory> -#include <vcl/NotebookBarAddonsMerger.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> class MenuBar; class NotebookBar; diff --git a/reportdesign/inc/pch/precompiled_rptui.hxx b/reportdesign/inc/pch/precompiled_rptui.hxx index 58070c2ce7f8..fcebe21cda4e 100644 --- a/reportdesign/inc/pch/precompiled_rptui.hxx +++ b/reportdesign/inc/pch/precompiled_rptui.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:17 using: + Generated on 2020-12-07 11:30:37 using: ./bin/update_pch reportdesign rptui --cutoff=4 --exclude:system --include:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -97,7 +97,6 @@ #include <vcl/GraphicExternalLink.hxx> #include <vcl/GraphicObject.hxx> #include <vcl/IDialogRenderable.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> #include <vcl/Scanline.hxx> #include <vcl/abstdlg.hxx> #include <vcl/alpha.hxx> @@ -128,6 +127,7 @@ #include <vcl/mapmod.hxx> #include <vcl/menu.hxx> #include <vcl/metaactiontypes.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vcl/outdev.hxx> #include <vcl/outdevmap.hxx> #include <vcl/outdevstate.hxx> diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx index 18ee9518e19a..73e1ca1fb48b 100644 --- a/sc/inc/pch/precompiled_sc.hxx +++ b/sc/inc/pch/precompiled_sc.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:30 using: + Generated on 2020-12-07 11:30:50 using: ./bin/update_pch sc sc --cutoff=12 --exclude:system --include:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -113,7 +113,6 @@ #include <vcl/GraphicExternalLink.hxx> #include <vcl/GraphicObject.hxx> #include <vcl/IDialogRenderable.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> #include <vcl/Scanline.hxx> #include <vcl/alpha.hxx> #include <vcl/animate/Animation.hxx> @@ -138,6 +137,7 @@ #include <vcl/keycodes.hxx> #include <vcl/mapmod.hxx> #include <vcl/menu.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vcl/outdev.hxx> #include <vcl/region.hxx> #include <vcl/scopedbitmapaccess.hxx> diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index e1109da50c0e..a542737da227 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -66,7 +66,7 @@ #include <scabstdlg.hxx> #include <vcl/EnumContext.hxx> -#include <vcl/notebookbar.hxx> +#include <vcl/notebookbar/notebookbar.hxx> // for mouse wheel #define MINZOOM_SLIDER 10 diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx index 422a5591d01f..7e11704fc090 100644 --- a/sd/inc/pch/precompiled_sd.hxx +++ b/sd/inc/pch/precompiled_sd.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:37 using: + Generated on 2020-12-07 11:30:57 using: ./bin/update_pch sd sd --cutoff=4 --exclude:system --exclude:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -43,7 +43,6 @@ #include <utility> #include <vector> #include <boost/property_tree/json_parser.hpp> -#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ptree_fwd.hpp> #endif // PCH_LEVEL >= 1 #if PCH_LEVEL >= 2 @@ -69,7 +68,6 @@ #include <rtl/tencinfo.h> #include <rtl/textenc.h> #include <rtl/ustrbuf.hxx> -#include <rtl/ustring.h> #include <rtl/ustring.hxx> #include <sal/config.h> #include <sal/log.hxx> @@ -355,7 +353,6 @@ #include <sfx2/zoomitem.hxx> #include <sot/exchange.hxx> #include <sot/formats.hxx> -#include <sot/storage.hxx> #include <svl/SfxBroadcaster.hxx> #include <svl/eitem.hxx> #include <svl/hint.hxx> @@ -365,6 +362,7 @@ #include <svl/languageoptions.hxx> #include <svl/lstner.hxx> #include <svl/macitem.hxx> +#include <svl/metitem.hxx> #include <svl/poolitem.hxx> #include <svl/ptitem.hxx> #include <svl/srchitem.hxx> @@ -374,11 +372,10 @@ #include <svl/typedwhich.hxx> #include <svl/urlbmk.hxx> #include <svl/whiter.hxx> -#include <svtools/popupwindowcontroller.hxx> +#include <svtools/ehdl.hxx> #include <svtools/sfxecode.hxx> #include <svtools/svtdllapi.h> #include <svtools/svtresid.hxx> -#include <svtools/toolboxcontroller.hxx> #include <svx/AccessibleShapeTreeInfo.hxx> #include <svx/IAccessibleViewForwarder.hxx> #include <svx/IAccessibleViewForwarderListener.hxx> @@ -445,9 +442,7 @@ #include <svx/xlnclit.hxx> #include <svx/xlndsit.hxx> #include <svx/xlnedit.hxx> -#include <svx/xlnedwit.hxx> #include <svx/xlnstit.hxx> -#include <svx/xlnstwit.hxx> #include <svx/xlnwtit.hxx> #include <svx/xtable.hxx> #include <toolkit/helper/vclunohelper.hxx> diff --git a/sd/inc/pch/precompiled_sdui.hxx b/sd/inc/pch/precompiled_sdui.hxx index c508458c6391..e4f4ec3a163e 100644 --- a/sd/inc/pch/precompiled_sdui.hxx +++ b/sd/inc/pch/precompiled_sdui.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:39 using: + Generated on 2020-12-07 11:30:59 using: ./bin/update_pch sd sdui --cutoff=4 --exclude:system --include:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -99,7 +99,6 @@ #include <vcl/GraphicObject.hxx> #include <vcl/IDialogRenderable.hxx> #include <vcl/ITiledRenderable.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> #include <vcl/Scanline.hxx> #include <vcl/alpha.hxx> #include <vcl/animate/Animation.hxx> @@ -131,6 +130,7 @@ #include <vcl/menu.hxx> #include <vcl/metaactiontypes.hxx> #include <vcl/metric.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vcl/outdev.hxx> #include <vcl/outdevmap.hxx> #include <vcl/outdevstate.hxx> @@ -349,7 +349,6 @@ #include <sot/formats.hxx> #include <sot/sotdllapi.h> #include <svl/SfxBroadcaster.hxx> -#include <svl/aeitem.hxx> #include <svl/eitem.hxx> #include <svl/hint.hxx> #include <svl/intitem.hxx> diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 3f1b76ecd80f..4673541ec989 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -241,12 +241,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/doc/saveastemplatedlg \ sfx2/source/explorer/nochaos \ sfx2/source/inet/inettbc \ - sfx2/source/notebookbar/ContextVBox \ - sfx2/source/notebookbar/DropdownBox \ - sfx2/source/notebookbar/PriorityHBox \ - sfx2/source/notebookbar/PriorityMergedHBox \ sfx2/source/notebookbar/SfxNotebookBar \ - sfx2/source/notebookbar/NotebookbarPopup \ sfx2/source/notebookbar/NotebookbarTabControl \ sfx2/source/notify/eventsupplier \ sfx2/source/notify/globalevents \ diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx index f3e5ecb809aa..77a97600c3c3 100644 --- a/sfx2/inc/pch/precompiled_sfx.hxx +++ b/sfx2/inc/pch/precompiled_sfx.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:39 using: + Generated on 2020-12-07 11:30:59 using: ./bin/update_pch sfx2 sfx --cutoff=3 --exclude:system --exclude:module --exclude:local If after updating build fails, use the following command to locate conflicting headers: @@ -93,7 +93,7 @@ #include <vcl/Scanline.hxx> #include <vcl/alpha.hxx> #include <vcl/bitmapex.hxx> -#include <vcl/builderfactory.hxx> +#include <vcl/builder.hxx> #include <vcl/commandevent.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/ctrl.hxx> diff --git a/sfx2/source/notebookbar/ContextVBox.cxx b/sfx2/source/notebookbar/ContextVBox.cxx deleted file mode 100644 index b1494340fdc8..000000000000 --- a/sfx2/source/notebookbar/ContextVBox.cxx +++ /dev/null @@ -1,76 +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 <sal/config.h> - -#include <vcl/NotebookbarContextControl.hxx> -#include <vcl/builderfactory.hxx> -#include <vcl/layout.hxx> -#include <sfx2/dllapi.h> - -/* - * ContextVBox is a VclVBox which shows own children depending on current context. - * This control can be used in the notebookbar .ui files - */ - -class SFX2_DLLPUBLIC ContextVBox : public VclVBox, - public NotebookbarContextControl -{ -public: - explicit ContextVBox( vcl::Window *pParent ) - : VclVBox( pParent ) - { - } - - virtual ~ContextVBox() override - { - disposeOnce(); - } - - void SetContext( vcl::EnumContext::Context eContext ) override - { - for (int nChild = 0; nChild < GetChildCount(); ++nChild) - { - if ( GetChild( nChild )->GetType() == WindowType::CONTAINER ) - { - VclContainer* pChild = static_cast<VclContainer*>( GetChild( nChild ) ); - - if ( pChild->HasContext( eContext ) || pChild->HasContext( vcl::EnumContext::Context::Any ) ) - { - Size aSize( pChild->GetOptimalSize() ); - aSize.AdjustHeight(6 ); - pChild->Show(); - pChild->SetSizePixel( aSize ); - } - else - { - pChild->Hide(); - pChild->SetSizePixel( Size( 0, 0 ) ); - } - } - } - Size aSize( GetOptimalSize() ); - aSize.AdjustWidth(6 ); - SetSizePixel( aSize ); - } -}; - -VCL_BUILDER_FACTORY(ContextVBox) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx index a8362087a263..8a637ae1af48 100644 --- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx +++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx @@ -19,7 +19,7 @@ #include <vcl/builderfactory.hxx> #include <vcl/layout.hxx> -#include <vcl/notebookbar.hxx> +#include <vcl/notebookbar/notebookbar.hxx> #include <vcl/tabpage.hxx> #include <sfx2/viewfrm.hxx> #include <notebookbar/NotebookbarTabControl.hxx> diff --git a/sfx2/source/notebookbar/PriorityMergedHBox.cxx b/sfx2/source/notebookbar/PriorityMergedHBox.cxx deleted file mode 100644 index bb4e00b0fe52..000000000000 --- a/sfx2/source/notebookbar/PriorityMergedHBox.cxx +++ /dev/null @@ -1,213 +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 <vcl/builderfactory.hxx> -#include <vcl/button.hxx> -#include <vcl/layout.hxx> -#include <bitmaps.hlst> -#include "PriorityHBox.hxx" -#include "NotebookbarPopup.hxx" -#include <comphelper/lok.hxx> - -#define DUMMY_WIDTH 50 -#define BUTTON_WIDTH 30 - -/* -* PriorityMergedHBox is a VclHBox which hides its own children if there is no sufficient space. -*/ - -namespace -{ -class PriorityMergedHBox : public PriorityHBox -{ -private: - VclPtr<PushButton> m_pButton; - VclPtr<NotebookbarPopup> m_pPopup; - - DECL_LINK(PBClickHdl, Button*, void); - -public: - explicit PriorityMergedHBox(vcl::Window* pParent) - : PriorityHBox(pParent) - { - m_pButton = VclPtr<PushButton>::Create(this, WB_FLATBUTTON); - m_pButton->SetClickHdl(LINK(this, PriorityMergedHBox, PBClickHdl)); - m_pButton->SetModeImage(Image(StockImage::Yes, CHEVRON)); - m_pButton->set_width_request(25); - m_pButton->set_pack_type(VclPackType::End); - m_pButton->Show(); - } - - virtual ~PriorityMergedHBox() override { disposeOnce(); } - - virtual void Resize() override - { - if (comphelper::LibreOfficeKit::isActive()) - return VclHBox::Resize(); - - if (!m_bInitialized) - Initialize(); - - if (!m_bInitialized) - { - return VclHBox::Resize(); - } - - tools::Long nWidth = GetSizePixel().Width(); - tools::Long nCurrentWidth = VclHBox::calculateRequisition().getWidth() + BUTTON_WIDTH; - - // Hide lower priority controls - for (int i = GetChildCount() - 1; i >= 0; i--) - { - vcl::Window* pWindow = GetChild(i); - - if (nCurrentWidth <= nWidth) - break; - - if (pWindow && pWindow->GetParent() == this && pWindow->IsVisible()) - { - if (pWindow->GetOutputWidthPixel()) - nCurrentWidth -= pWindow->GetOutputWidthPixel(); - else - nCurrentWidth -= DUMMY_WIDTH; - pWindow->Hide(); - } - } - - // Show higher priority controls if we already have enough space - for (int i = 0; i < GetChildCount(); i++) - { - vcl::Window* pWindow = GetChild(i); - - if (pWindow->GetParent() != this) - { - continue; - } - - if (pWindow && !pWindow->IsVisible()) - { - pWindow->Show(); - nCurrentWidth += getLayoutRequisition(*pWindow).Width() + get_spacing(); - - if (nCurrentWidth > nWidth) - { - pWindow->Hide(); - break; - } - } - } - - VclHBox::Resize(); - - if (GetHiddenCount()) - m_pButton->Show(); - else - m_pButton->Hide(); - } - - virtual void dispose() override - { - m_pButton.disposeAndClear(); - if (m_pPopup) - m_pPopup.disposeAndClear(); - PriorityHBox::dispose(); - } - - int GetHiddenCount() const override - { - int nCount = 0; - - for (int i = GetChildCount() - 1; i >= 0; i--) - { - vcl::Window* pWindow = GetChild(i); - if (pWindow && pWindow->GetParent() == this && !pWindow->IsVisible()) - nCount++; - } - - return nCount; - } - - Size calculateRequisition() const override - { - if (!m_bInitialized) - { - return VclHBox::calculateRequisition(); - } - - sal_uInt16 nVisibleChildren = 0; - - Size aSize; - for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild; - pChild = pChild->GetWindow(GetWindowType::Next)) - { - if (!pChild->IsVisible()) - continue; - ++nVisibleChildren; - Size aChildSize = getLayoutRequisition(*pChild); - - tools::Long nPrimaryDimension = getPrimaryDimension(aChildSize); - nPrimaryDimension += pChild->get_padding() * 2; - setPrimaryDimension(aChildSize, nPrimaryDimension); - - accumulateMaxes(aChildSize, aSize); - } - - setPrimaryDimension(aSize, 200); - return finalizeMaxes(aSize, nVisibleChildren); - } - - void GetChildrenWithPriorities() override{}; -}; -} - -IMPL_LINK(PriorityMergedHBox, PBClickHdl, Button*, /*pButton*/, void) -{ - if (m_pPopup) - m_pPopup.disposeAndClear(); - - m_pPopup = VclPtr<NotebookbarPopup>::Create(this); - - for (int i = 0; i < GetChildCount(); i++) - { - vcl::Window* pWindow = GetChild(i); - if (pWindow != m_pButton) - { - if (!pWindow->IsVisible()) - { - pWindow->Show(); - pWindow->SetParent(m_pPopup->getBox()); - // count is decreased because we moved child - i--; - } - } - } - - m_pPopup->hideSeparators(true); - - tools::Long x = m_pButton->GetPosPixel().getX(); - tools::Long y = m_pButton->GetPosPixel().getY() + GetSizePixel().Height(); - tools::Rectangle aRect(x, y, x, y); - - m_pPopup->StartPopupMode(aRect, FloatWinPopupFlags::Down | FloatWinPopupFlags::GrabFocus - | FloatWinPopupFlags::AllMouseButtonClose); -} - -VCL_BUILDER_FACTORY(PriorityMergedHBox) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index c87c37118755..f2690c9e04b7 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -11,7 +11,7 @@ #include <sfx2/viewsh.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/notebookbar/SfxNotebookBar.hxx> -#include <vcl/notebookbar.hxx> +#include <vcl/notebookbar/notebookbar.hxx> #include <vcl/syswin.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/sfxsids.hrc> @@ -26,7 +26,7 @@ #include <unotools/confignode.hxx> #include <comphelper/types.hxx> #include <framework/addonsoptions.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vector> #include <map> #include <vcl/WeldedTabbedNotebookbar.hxx> diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 6eefce978bb9..2cfccbfa705b 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -714,12 +714,8 @@ constructor_map = { } custom_widgets = [ - 'ContextVBox', - 'DropdownBox', 'NotebookbarTabControl', 'NotebookbarToolBox', - 'PriorityHBox', - 'PriorityMergedHBox', ] def get_constructor_guard(constructor): diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index b7105c4d962d..096f3862d12a 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -6455,7 +6455,6 @@ include/vcl/EnumContext.hxx include/vcl/FilterConfigItem.hxx include/vcl/GraphicObject.hxx include/vcl/IDialogRenderable.hxx -include/vcl/IPrioritable.hxx include/vcl/ITiledRenderable.hxx include/vcl/ImageTree.hxx include/vcl/Scanline.hxx @@ -6528,7 +6527,8 @@ include/vcl/metaact.hxx include/vcl/metaactiontypes.hxx include/vcl/metric.hxx include/vcl/mnemonic.hxx -include/vcl/notebookbar.hxx +include/vcl/notebookbar/IPrioritable.hxx +include/vcl/notebookbar/notebookbar.hxx include/vcl/oldprintadaptor.hxx include/vcl/opengl/OpenGLContext.hxx include/vcl/opengl/OpenGLHelper.hxx @@ -10666,7 +10666,6 @@ sfx2/source/inc/templdgi.hxx sfx2/source/inc/tplcitem.hxx sfx2/source/inc/workwin.hxx sfx2/source/inet/inettbc.cxx -sfx2/source/notebookbar/ContextVBox.cxx sfx2/source/notebookbar/NotebookbarTabControl.cxx sfx2/source/notebookbar/SfxNotebookBar.cxx sfx2/source/notify/eventsupplier.cxx @@ -14979,6 +14978,7 @@ vcl/source/control/button.cxx vcl/source/control/calendar.cxx vcl/source/control/combobox.cxx vcl/source/control/ctrl.cxx +vcl/source/control/ContextVBox.cxx vcl/source/control/edit.cxx vcl/source/control/field.cxx vcl/source/control/field2.cxx diff --git a/svl/inc/pch/precompiled_svl.hxx b/svl/inc/pch/precompiled_svl.hxx index 47bfedd12c6c..16f433ce9bc9 100644 --- a/svl/inc/pch/precompiled_svl.hxx +++ b/svl/inc/pch/precompiled_svl.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:40 using: + Generated on 2020-12-07 11:31:00 using: ./bin/update_pch svl svl --cutoff=6 --exclude:system --exclude:module --exclude:local If after updating build fails, use the following command to locate conflicting headers: @@ -44,7 +44,6 @@ #include <osl/diagnose.h> #include <osl/doublecheckedlocking.h> #include <osl/endian.h> -#include <osl/file.h> #include <osl/getglobalmutex.hxx> #include <osl/interlck.h> #include <osl/mutex.hxx> @@ -59,12 +58,14 @@ #include <rtl/locale.h> #include <rtl/math.hxx> #include <rtl/ref.hxx> +#include <rtl/strbuf.h> #include <rtl/string.h> #include <rtl/string.hxx> #include <rtl/stringconcat.hxx> #include <rtl/stringutils.hxx> #include <rtl/textenc.h> #include <rtl/ustrbuf.hxx> +#include <rtl/ustring.h> #include <rtl/ustring.hxx> #include <rtl/uuid.h> #include <sal/backtrace.hxx> diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx index c5c5fb3fcc46..b7aae9abb4f1 100644 --- a/svtools/inc/pch/precompiled_svt.hxx +++ b/svtools/inc/pch/precompiled_svt.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:40 using: + Generated on 2020-12-07 11:31:00 using: ./bin/update_pch svtools svt --cutoff=4 --exclude:system --include:module --exclude:local If after updating build fails, use the following command to locate conflicting headers: @@ -92,7 +92,6 @@ #include <sal/typesizes.h> #include <vcl/EnumContext.hxx> #include <vcl/GraphicExternalLink.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> #include <vcl/Scanline.hxx> #include <vcl/accessiblefactory.hxx> #include <vcl/alpha.hxx> @@ -121,6 +120,7 @@ #include <vcl/keycodes.hxx> #include <vcl/mapmod.hxx> #include <vcl/menu.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vcl/outdev.hxx> #include <vcl/prntypes.hxx> #include <vcl/ptrstyle.hxx> @@ -237,7 +237,6 @@ #include <com/sun/star/view/PrintableState.hpp> #include <comphelper/broadcasthelper.hxx> #include <comphelper/comphelperdllapi.h> -#include <comphelper/interfacecontainer2.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propagg.hxx> #include <comphelper/propertycontainer.hxx> diff --git a/svx/inc/pch/precompiled_svxcore.hxx b/svx/inc/pch/precompiled_svxcore.hxx index 0e3af39f1892..1b2848ce6d24 100644 --- a/svx/inc/pch/precompiled_svxcore.hxx +++ b/svx/inc/pch/precompiled_svxcore.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 09:59:43 using: + Generated on 2020-12-07 11:31:03 using: ./bin/update_pch svx svxcore --cutoff=7 --exclude:system --include:module --exclude:local If after updating build fails, use the following command to locate conflicting headers: @@ -97,7 +97,6 @@ #include <vcl/GraphicAttributes.hxx> #include <vcl/GraphicExternalLink.hxx> #include <vcl/InterimItemWindow.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> #include <vcl/Scanline.hxx> #include <vcl/alpha.hxx> #include <vcl/animate/Animation.hxx> @@ -128,6 +127,7 @@ #include <vcl/keycodes.hxx> #include <vcl/mapmod.hxx> #include <vcl/menu.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vcl/outdev.hxx> #include <vcl/ptrstyle.hxx> #include <vcl/region.hxx> diff --git a/sw/inc/pch/precompiled_swui.hxx b/sw/inc/pch/precompiled_swui.hxx index 3b3021716e1a..8f50e045f78f 100644 --- a/sw/inc/pch/precompiled_swui.hxx +++ b/sw/inc/pch/precompiled_swui.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 10:00:05 using: + Generated on 2020-12-07 11:31:25 using: ./bin/update_pch sw swui --cutoff=3 --exclude:system --include:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -95,7 +95,6 @@ #include <vcl/GraphicExternalLink.hxx> #include <vcl/GraphicObject.hxx> #include <vcl/IDialogRenderable.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> #include <vcl/Scanline.hxx> #include <vcl/accessibletableprovider.hxx> #include <vcl/alpha.hxx> @@ -130,6 +129,7 @@ #include <vcl/menu.hxx> #include <vcl/metaactiontypes.hxx> #include <vcl/metric.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vcl/outdev.hxx> #include <vcl/outdevmap.hxx> #include <vcl/outdevstate.hxx> diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 038428d9290e..a873e4695419 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -67,7 +67,7 @@ #include <memory> #include <vcl/EnumContext.hxx> -#include <vcl/notebookbar.hxx> +#include <vcl/notebookbar/notebookbar.hxx> using namespace ::com::sun::star; SFX_IMPL_NAMED_VIEWFACTORY(SwPagePreview, "PrintPreview") diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index efddab108293..927954e7b49b 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -184,6 +184,8 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/control/calendar \ vcl/source/control/combobox \ vcl/source/control/ctrl \ + vcl/source/control/ContextVBox \ + vcl/source/control/DropdownBox \ vcl/source/control/edit \ vcl/source/control/field2 \ vcl/source/control/field \ @@ -201,6 +203,9 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/control/listbox \ vcl/source/control/managedmenubutton \ vcl/source/control/menubtn \ + vcl/source/control/NotebookbarPopup \ + vcl/source/control/PriorityHBox \ + vcl/source/control/PriorityMergedHBox \ vcl/source/control/notebookbar \ vcl/source/control/WeldedTabbedNotebookbar \ vcl/source/control/quickselectionengine \ diff --git a/vcl/inc/ContextVBox.hxx b/vcl/inc/ContextVBox.hxx new file mode 100644 index 000000000000..1dc31656adb7 --- /dev/null +++ b/vcl/inc/ContextVBox.hxx @@ -0,0 +1,38 @@ +/* -*- 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 <sal/config.h> + +#include <vcl/NotebookbarContextControl.hxx> +#include <vcl/layout.hxx> + +/* + * ContextVBox is a VclVBox which shows own children depending on current context. + * This control can be used in the notebookbar .ui files + */ + +class ContextVBox : public VclVBox, public NotebookbarContextControl +{ +public: + explicit ContextVBox(vcl::Window* pParent); + virtual ~ContextVBox() override; + void SetContext(vcl::EnumContext::Context eContext) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/notebookbar/DropdownBox.hxx b/vcl/inc/DropdownBox.hxx index 769cd2e42fae..3aa55b5ef367 100644 --- a/sfx2/source/notebookbar/DropdownBox.hxx +++ b/vcl/inc/DropdownBox.hxx @@ -20,9 +20,9 @@ #ifndef INCLUDED_SFX2_NOTEBOOKBAR_DROPDOWNBOX_HXX #define INCLUDED_SFX2_NOTEBOOKBAR_DROPDOWNBOX_HXX -#include <vcl/IPrioritable.hxx> +#include <vcl/notebookbar/IPrioritable.hxx> +#include <vcl/notebookbar/NotebookbarPopup.hxx> #include <vcl/layout.hxx> -#include "NotebookbarPopup.hxx" class DropdownBox : public VclHBox, public vcl::IPrioritable { diff --git a/vcl/inc/OptionalBox.hxx b/vcl/inc/OptionalBox.hxx index 326fc7536c2d..54c7b720508b 100644 --- a/vcl/inc/OptionalBox.hxx +++ b/vcl/inc/OptionalBox.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_VCL_OPTIONALBOX_HXX #define INCLUDED_VCL_OPTIONALBOX_HXX -#include <vcl/IPrioritable.hxx> +#include <vcl/notebookbar/IPrioritable.hxx> #include <vcl/layout.hxx> class OptionalBox final : public VclHBox, public vcl::IPrioritable diff --git a/sfx2/source/notebookbar/PriorityHBox.hxx b/vcl/inc/PriorityHBox.hxx index 7e797327642e..e3e8c4c19b9c 100644 --- a/sfx2/source/notebookbar/PriorityHBox.hxx +++ b/vcl/inc/PriorityHBox.hxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vcl/IPrioritable.hxx> +#include <vcl/notebookbar/IPrioritable.hxx> #include <vcl/layout.hxx> #include <vector> diff --git a/vcl/inc/PriorityMergedHBox.hxx b/vcl/inc/PriorityMergedHBox.hxx new file mode 100644 index 000000000000..15972d2d7531 --- /dev/null +++ b/vcl/inc/PriorityMergedHBox.hxx @@ -0,0 +1,49 @@ +/* -*- 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 <vcl/toolkit/button.hxx> +#include <vcl/layout.hxx> +#include "PriorityHBox.hxx" +#include <vcl/notebookbar/NotebookbarPopup.hxx> + +class PriorityMergedHBox : public PriorityHBox +{ +private: + VclPtr<PushButton> m_pButton; + VclPtr<NotebookbarPopup> m_pPopup; + + DECL_LINK(PBClickHdl, Button*, void); + +public: + explicit PriorityMergedHBox(vcl::Window* pParent); + + virtual ~PriorityMergedHBox() override { disposeOnce(); } + + virtual void Resize() override; + + virtual void dispose() override; + + int GetHiddenCount() const override; + + Size calculateRequisition() const override; + + void GetChildrenWithPriorities() override{}; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx index b32fd963fb57..deb2cdd182a8 100644 --- a/vcl/inc/brdwin.hxx +++ b/vcl/inc/brdwin.hxx @@ -20,10 +20,10 @@ #ifndef INCLUDED_VCL_INC_BRDWIN_HXX #define INCLUDED_VCL_INC_BRDWIN_HXX -#include <vcl/notebookbar.hxx> +#include <vcl/notebookbar/notebookbar.hxx> #include <vcl/window.hxx> #include <o3tl/typed_flags_set.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <com/sun/star/frame/XFrame.hpp> diff --git a/vcl/source/control/ContextVBox.cxx b/vcl/source/control/ContextVBox.cxx new file mode 100644 index 000000000000..94090d5cd680 --- /dev/null +++ b/vcl/source/control/ContextVBox.cxx @@ -0,0 +1,62 @@ +/* -*- 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 <sal/config.h> + +#include <vcl/NotebookbarContextControl.hxx> +#include <ContextVBox.hxx> + +ContextVBox::ContextVBox( vcl::Window *pParent ) + : VclVBox( pParent ) +{ +} + +ContextVBox::~ContextVBox() +{ + disposeOnce(); +} + +void ContextVBox::SetContext( vcl::EnumContext::Context eContext ) +{ + for (int nChild = 0; nChild < GetChildCount(); ++nChild) + { + if ( GetChild( nChild )->GetType() == WindowType::CONTAINER ) + { + VclContainer* pChild = static_cast<VclContainer*>( GetChild( nChild ) ); + + if ( pChild->HasContext( eContext ) || pChild->HasContext( vcl::EnumContext::Context::Any ) ) + { + Size aSize( pChild->GetOptimalSize() ); + aSize.AdjustHeight(6 ); + pChild->Show(); + pChild->SetSizePixel( aSize ); + } + else + { + pChild->Hide(); + pChild->SetSizePixel( Size( 0, 0 ) ); + } + } + } + Size aSize( GetOptimalSize() ); + aSize.AdjustWidth(6 ); + SetSizePixel( aSize ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/notebookbar/DropdownBox.cxx b/vcl/source/control/DropdownBox.cxx index 315c30a2f95d..8155a8bac5c9 100644 --- a/sfx2/source/notebookbar/DropdownBox.cxx +++ b/vcl/source/control/DropdownBox.cxx @@ -17,10 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vcl/builderfactory.hxx> #include <vcl/button.hxx> #include <vcl/layout.hxx> -#include "DropdownBox.hxx" +#include <DropdownBox.hxx> #define NOTEBOOK_HEADER_HEIGHT 30 @@ -114,6 +113,4 @@ IMPL_LINK(DropdownBox, PBClickHdl, Button*, /*pButton*/, void) | FloatWinPopupFlags::AllMouseButtonClose); } -VCL_BUILDER_FACTORY(DropdownBox) - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/notebookbar/NotebookbarPopup.cxx b/vcl/source/control/NotebookbarPopup.cxx index cba325a43c56..a1a3571d2dc0 100644 --- a/sfx2/source/notebookbar/NotebookbarPopup.cxx +++ b/vcl/source/control/NotebookbarPopup.cxx @@ -7,8 +7,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "NotebookbarPopup.hxx" -#include <vcl/IPrioritable.hxx> +#include <vcl/notebookbar/NotebookbarPopup.hxx> +#include <vcl/notebookbar/IPrioritable.hxx> #include <vcl/layout.hxx> NotebookbarPopup::NotebookbarPopup(const VclPtr<VclHBox>& pParent) diff --git a/sfx2/source/notebookbar/PriorityHBox.cxx b/vcl/source/control/PriorityHBox.cxx index 5851e51cdaf4..cb3219bf5a5c 100644 --- a/sfx2/source/notebookbar/PriorityHBox.cxx +++ b/vcl/source/control/PriorityHBox.cxx @@ -17,9 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vcl/builderfactory.hxx> #include <vcl/layout.hxx> -#include "PriorityHBox.hxx" +#include <PriorityHBox.hxx> #include <comphelper/lok.hxx> namespace @@ -195,6 +194,4 @@ void PriorityHBox::GetChildrenWithPriorities() std::sort(m_aSortedChildren.begin(), m_aSortedChildren.end(), lcl_comparePriority); } -VCL_BUILDER_FACTORY(PriorityHBox) - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/PriorityMergedHBox.cxx b/vcl/source/control/PriorityMergedHBox.cxx new file mode 100644 index 000000000000..be89d8f35cf5 --- /dev/null +++ b/vcl/source/control/PriorityMergedHBox.cxx @@ -0,0 +1,194 @@ +/* -*- 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 <vcl/button.hxx> +#include <vcl/layout.hxx> +#include <bitmaps.hlst> +#include <PriorityHBox.hxx> +#include <PriorityMergedHBox.hxx> +#include <vcl/notebookbar/NotebookbarPopup.hxx> +#include <comphelper/lok.hxx> + +#define DUMMY_WIDTH 50 +#define BUTTON_WIDTH 30 + +/* +* PriorityMergedHBox is a VclHBox which hides its own children if there is no sufficient space. +*/ + +PriorityMergedHBox::PriorityMergedHBox(vcl::Window* pParent) + : PriorityHBox(pParent) +{ + m_pButton = VclPtr<PushButton>::Create(this, WB_FLATBUTTON); + m_pButton->SetClickHdl(LINK(this, PriorityMergedHBox, PBClickHdl)); + m_pButton->SetModeImage(Image(StockImage::Yes, CHEVRON)); + m_pButton->set_width_request(25); + m_pButton->set_pack_type(VclPackType::End); + m_pButton->Show(); +} + +void PriorityMergedHBox::Resize() +{ + if (comphelper::LibreOfficeKit::isActive()) + return VclHBox::Resize(); + + if (!m_bInitialized) + Initialize(); + + if (!m_bInitialized) + { + return VclHBox::Resize(); + } + + tools::Long nWidth = GetSizePixel().Width(); + tools::Long nCurrentWidth = VclHBox::calculateRequisition().getWidth() + BUTTON_WIDTH; + + // Hide lower priority controls + for (int i = GetChildCount() - 1; i >= 0; i--) + { + vcl::Window* pWindow = GetChild(i); + + if (nCurrentWidth <= nWidth) + break; + + if (pWindow && pWindow->GetParent() == this && pWindow->IsVisible()) + { + if (pWindow->GetOutputWidthPixel()) + nCurrentWidth -= pWindow->GetOutputWidthPixel(); + else + nCurrentWidth -= DUMMY_WIDTH; + pWindow->Hide(); + } + } + + // Show higher priority controls if we already have enough space + for (int i = 0; i < GetChildCount(); i++) + { + vcl::Window* pWindow = GetChild(i); + + if (pWindow->GetParent() != this) + { + continue; + } + + if (pWindow && !pWindow->IsVisible()) + { + pWindow->Show(); + nCurrentWidth += getLayoutRequisition(*pWindow).Width() + get_spacing(); + + if (nCurrentWidth > nWidth) + { + pWindow->Hide(); + break; + } + } + } + + VclHBox::Resize(); + + if (GetHiddenCount()) + m_pButton->Show(); + else + m_pButton->Hide(); +} + +void PriorityMergedHBox::dispose() +{ + m_pButton.disposeAndClear(); + if (m_pPopup) + m_pPopup.disposeAndClear(); + PriorityHBox::dispose(); +} + +int PriorityMergedHBox::GetHiddenCount() const +{ + int nCount = 0; + + for (int i = GetChildCount() - 1; i >= 0; i--) + { + vcl::Window* pWindow = GetChild(i); + if (pWindow && pWindow->GetParent() == this && !pWindow->IsVisible()) + nCount++; + } + + return nCount; +} + +Size PriorityMergedHBox::calculateRequisition() const +{ + if (!m_bInitialized) + { + return VclHBox::calculateRequisition(); + } + + sal_uInt16 nVisibleChildren = 0; + + Size aSize; + for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild; + pChild = pChild->GetWindow(GetWindowType::Next)) + { + if (!pChild->IsVisible()) + continue; + ++nVisibleChildren; + Size aChildSize = getLayoutRequisition(*pChild); + + tools::Long nPrimaryDimension = getPrimaryDimension(aChildSize); + nPrimaryDimension += pChild->get_padding() * 2; + setPrimaryDimension(aChildSize, nPrimaryDimension); + + accumulateMaxes(aChildSize, aSize); + } + + setPrimaryDimension(aSize, 200); + return finalizeMaxes(aSize, nVisibleChildren); +} + +IMPL_LINK(PriorityMergedHBox, PBClickHdl, Button*, /*pButton*/, void) +{ + if (m_pPopup) + m_pPopup.disposeAndClear(); + + m_pPopup = VclPtr<NotebookbarPopup>::Create(this); + + for (int i = 0; i < GetChildCount(); i++) + { + vcl::Window* pWindow = GetChild(i); + if (pWindow != m_pButton) + { + if (!pWindow->IsVisible()) + { + pWindow->Show(); + pWindow->SetParent(m_pPopup->getBox()); + // count is decreased because we moved child + i--; + } + } + } + + m_pPopup->hideSeparators(true); + + tools::Long x = m_pButton->GetPosPixel().getX(); + tools::Long y = m_pButton->GetPosPixel().getY() + GetSizePixel().Height(); + tools::Rectangle aRect(x, y, x, y); + + m_pPopup->StartPopupMode(aRect, FloatWinPopupFlags::Down | FloatWinPopupFlags::GrabFocus + | FloatWinPopupFlags::AllMouseButtonClose); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx index 64686e1729b5..8feb96ee51fd 100644 --- a/vcl/source/control/notebookbar.cxx +++ b/vcl/source/control/notebookbar.cxx @@ -8,7 +8,7 @@ */ #include <vcl/layout.hxx> -#include <vcl/notebookbar.hxx> +#include <vcl/notebookbar/notebookbar.hxx> #include <vcl/syswin.hxx> #include <vcl/taskpanelist.hxx> #include <vcl/NotebookbarContextControl.hxx> diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index faeb70ecd4e1..dee5e226452c 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -20,7 +20,7 @@ #include <sal/config.h> #include <sal/log.hxx> -#include <vcl/notebookbar.hxx> +#include <vcl/notebookbar/notebookbar.hxx> #include <vcl/svapp.hxx> #include <vcl/help.hxx> #include <vcl/event.hxx> diff --git a/vcl/source/window/NotebookBarAddonsMerger.cxx b/vcl/source/window/NotebookBarAddonsMerger.cxx index 1bbbc66b9452..b2e3d4649939 100644 --- a/vcl/source/window/NotebookBarAddonsMerger.cxx +++ b/vcl/source/window/NotebookBarAddonsMerger.cxx @@ -21,11 +21,11 @@ #include <cstddef> -#include <vcl/NotebookBarAddonsMerger.hxx> +#include <vcl/notebookbar/IPrioritable.hxx> +#include <vcl/notebookbar/NotebookBarAddonsMerger.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/vclenum.hxx> #include <vcl/toolbox.hxx> -#include <vcl/IPrioritable.hxx> #include <OptionalBox.hxx> const char STYLE_TEXT[] = "Text"; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 4c264b3e4bfe..4d252f579adf 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -32,7 +32,7 @@ #include <vcl/toolkit/fixed.hxx> #include <vcl/toolkit/fixedhyper.hxx> #include <vcl/headbar.hxx> -#include <vcl/IPrioritable.hxx> +#include <vcl/notebookbar/IPrioritable.hxx> #include <vcl/toolkit/ivctrl.hxx> #include <vcl/layout.hxx> #include <vcl/toolkit/lstbox.hxx> @@ -59,7 +59,11 @@ #include <bitmaps.hlst> #include <managedmenubutton.hxx> #include <messagedialog.hxx> +#include <ContextVBox.hxx> +#include <DropdownBox.hxx> #include <OptionalBox.hxx> +#include <PriorityMergedHBox.hxx> +#include <PriorityHBox.hxx> #include <window.h> #include <xmlreader/xmlreader.hxx> #include <desktop/crashreport.hxx> @@ -1979,6 +1983,26 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & m_pParserState->m_aButtonMenuMaps.emplace_back(id, sMenu); setupFromActionName(static_cast<Button*>(xWindow.get()), rMap, m_xFrame); } + else if (name == "sfxlo-PriorityMergedHBox") + { + // like tdf#135495 above, keep the sfxlo-PriorityMergedHBox even though its not in sfx anymore + xWindow = VclPtr<PriorityMergedHBox>::Create(pParent); + } + else if (name == "sfxlo-PriorityHBox") + { + // like tdf#135495 above, keep the sfxlo-PriorityMergedHBox even though its not in sfx anymore + xWindow = VclPtr<PriorityHBox>::Create(pParent); + } + else if (name == "sfxlo-DropdownBox") + { + // like tdf#135495 above, keep the sfxlo-PriorityMergedHBox even though its not in sfx anymore + xWindow = VclPtr<DropdownBox>::Create(pParent); + } + else if (name == "sfxlo-ContextVBox") + { + // like tdf#135495 above, keep the sfxlo-PriorityMergedHBox even though its not in sfx anymore + xWindow = VclPtr<ContextVBox>::Create(pParent); + } else if (name == "GtkIconView") { assert(rMap.find(OString("model")) != rMap.end() && "GtkIconView must have a model"); diff --git a/xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx b/xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx index c61a96bbe6a3..262dbf0abdff 100644 --- a/xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx +++ b/xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-12-04 10:00:13 using: + Generated on 2020-12-07 11:31:33 using: ./bin/update_pch xmlsecurity xsec_xmlsec --cutoff=2 --exclude:system --include:module --include:local If after updating build fails, use the following command to locate conflicting headers: |