basctl/source/dlged/propbrw.cxx | 52 - basctl/source/inc/propbrw.hxx | 5 cui/inc/pch/precompiled_cui.hxx | 4 cui/source/dialogs/cuicharmap.cxx | 1 cui/source/inc/acccfg.hxx | 1 cui/source/options/optgdlg.cxx | 1 cui/source/tabpages/align.cxx | 1 cui/source/tabpages/numfmt.cxx | 1 cui/source/tabpages/tpbitmap.cxx | 1 dbaccess/source/ui/dlg/adminpages.cxx | 1 dbaccess/source/ui/dlg/dbwiz.cxx | 1 extensions/UIConfig_spropctrlr.mk | 16 extensions/inc/strings.hrc | 1 extensions/source/propctrlr/browserline.cxx | 345 ++----- extensions/source/propctrlr/browserline.hxx | 64 - extensions/source/propctrlr/browserlistbox.cxx | 594 ++---------- extensions/source/propctrlr/browserlistbox.hxx | 45 extensions/source/propctrlr/browserpage.cxx | 53 - extensions/source/propctrlr/browserpage.hxx | 48 - extensions/source/propctrlr/browserview.cxx | 78 - extensions/source/propctrlr/browserview.hxx | 29 extensions/source/propctrlr/commoncontrol.cxx | 49 - extensions/source/propctrlr/commoncontrol.hxx | 137 +- extensions/source/propctrlr/eformspropertyhandler.cxx | 2 extensions/source/propctrlr/fontdialog.cxx | 2 extensions/source/propctrlr/formcomponenthandler.cxx | 95 + extensions/source/propctrlr/handlerhelper.cxx | 66 - extensions/source/propctrlr/handlerhelper.hxx | 12 extensions/source/propctrlr/inspectorhelpwindow.cxx | 95 - extensions/source/propctrlr/inspectorhelpwindow.hxx | 29 extensions/source/propctrlr/linedescriptor.hxx | 6 extensions/source/propctrlr/propcontroller.cxx | 219 ++-- extensions/source/propctrlr/propcontroller.hxx | 18 extensions/source/propctrlr/propertyeditor.cxx | 428 +++----- extensions/source/propctrlr/propertyeditor.hxx | 61 - extensions/source/propctrlr/propertyhandler.cxx | 5 extensions/source/propctrlr/propertyhandler.hxx | 1 extensions/source/propctrlr/standardcontrol.cxx | 857 +++--------------- extensions/source/propctrlr/standardcontrol.hxx | 298 +++--- extensions/source/propctrlr/usercontrol.cxx | 176 +-- extensions/source/propctrlr/usercontrol.hxx | 106 -- extensions/uiconfig/spropctrlr/ui/browserline.ui | 50 + extensions/uiconfig/spropctrlr/ui/browserpage.ui | 99 ++ extensions/uiconfig/spropctrlr/ui/colorlistbox.ui | 17 extensions/uiconfig/spropctrlr/ui/combobox.ui | 16 extensions/uiconfig/spropctrlr/ui/datefield.ui | 16 extensions/uiconfig/spropctrlr/ui/datetimefield.ui | 47 extensions/uiconfig/spropctrlr/ui/formattedcontrol.ui | 20 extensions/uiconfig/spropctrlr/ui/formattedsample.ui | 44 extensions/uiconfig/spropctrlr/ui/formproperties.ui | 40 extensions/uiconfig/spropctrlr/ui/hyperlinkfield.ui | 37 extensions/uiconfig/spropctrlr/ui/listbox.ui | 10 extensions/uiconfig/spropctrlr/ui/multiline.ui | 85 + extensions/uiconfig/spropctrlr/ui/numericfield.ui | 16 extensions/uiconfig/spropctrlr/ui/textfield.ui | 10 extensions/uiconfig/spropctrlr/ui/timefield.ui | 16 extensions/uiconfig/spropctrlr/ui/urlcontrol.ui | 16 include/sfx2/basedlgs.hxx | 38 include/sfx2/childwin.hxx | 8 include/sfx2/tabdlg.hxx | 1 include/svtools/ctrlbox.hxx | 5 include/svtools/inettbc.hxx | 8 include/svx/colorbox.hxx | 1 include/vcl/builderpage.hxx | 1 include/vcl/ivctrl.hxx | 2 include/vcl/weld.hxx | 19 reportdesign/source/ui/inc/propbrw.hxx | 6 reportdesign/source/ui/misc/UITools.cxx | 3 reportdesign/source/ui/report/propbrw.cxx | 71 - sc/source/ui/Accessibility/AccessibleEditObject.cxx | 1 sc/source/ui/inc/olinewin.hxx | 1 sc/source/ui/inc/tpsort.hxx | 3 sc/source/ui/view/viewutil.cxx | 1 sd/source/ui/docshell/docshel4.cxx | 1 sfx2/inc/pch/precompiled_sfx.hxx | 7 sfx2/source/appl/workwin.cxx | 2 sfx2/source/control/bindings.cxx | 1 sfx2/source/dialog/basedlgs.cxx | 199 ---- sfx2/source/dialog/dockwin.cxx | 2 sfx2/source/dialog/recfloat.cxx | 1 solenv/sanitizers/ui/modules/spropctrlr.suppr | 10 svtools/source/control/ctrlbox.cxx | 1 svtools/source/control/inettbc.cxx | 2 svx/UIConfig_svx.mk | 1 svx/inc/pch/precompiled_svx.hxx | 5 svx/inc/pch/precompiled_svxcore.hxx | 3 svx/source/fmcomp/fmgridcl.cxx | 1 svx/source/form/fmPropBrw.cxx | 162 --- svx/source/form/fmtextcontrolshell.cxx | 1 svx/source/gallery2/galbrws1.cxx | 1 svx/source/inc/fmPropBrw.hxx | 23 svx/uiconfig/ui/formpropertydialog.ui | 76 + sw/inc/pch/precompiled_sw.hxx | 7 sw/source/ui/dbui/createaddresslistdialog.cxx | 1 sw/source/ui/inc/mmresultdialogs.hxx | 1 sw/source/uibase/envelp/syncbtn.cxx | 1 sw/source/uibase/uiview/pview.cxx | 3 toolkit/source/awt/vclxtoolkit.cxx | 3 vcl/source/app/salvtables.cxx | 23 vcl/source/control/ivctrl.cxx | 15 vcl/unx/gtk3/gtk3gtkinst.cxx | 33 101 files changed, 2158 insertions(+), 3140 deletions(-)
New commits: commit f08b066f3c6a80fe3daa430f9099aae8b0850e80 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Dec 4 09:14:58 2019 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Dec 9 13:28:46 2019 +0100 drop newly unused SfxFloatingWindow Change-Id: I8ac3957579c76a89b9692bdb50cbe7a56e1693e3 Reviewed-on: https://gerrit.libreoffice.org/84444 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx index 729c5b85c7bd..447fde2a37aa 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 2019-12-03 09:19:08 using: + Generated on 2019-12-04 09:30:37 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: @@ -116,7 +116,6 @@ #include <vcl/edit.hxx> #include <vcl/errcode.hxx> #include <vcl/event.hxx> -#include <vcl/floatwin.hxx> #include <vcl/fntstyle.hxx> #include <vcl/font.hxx> #include <vcl/gfxlink.hxx> @@ -136,7 +135,6 @@ #include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> -#include <vcl/syswin.hxx> #include <vcl/task.hxx> #include <vcl/textfilter.hxx> #include <vcl/timer.hxx> diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx index dba595d5dd21..62dd835bb0e1 100644 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -31,6 +31,7 @@ #include <vcl/virdev.hxx> #include <svl/stritem.hxx> #include <officecfg/Office/Common.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/dispatchcommand.hxx> diff --git a/cui/source/inc/acccfg.hxx b/cui/source/inc/acccfg.hxx index 41df1d05896f..dc754a5edfb7 100644 --- a/cui/source/inc/acccfg.hxx +++ b/cui/source/inc/acccfg.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <sfx2/tabdlg.hxx> +#include <vcl/idle.hxx> #include <i18nutil/searchopt.hxx> #include "cfgutil.hxx" diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index cb6b53a08176..ae9cf9961ad8 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -71,6 +71,7 @@ #include <vcl/vclenum.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <vcl/window.hxx> #include <vcl/IconThemeInfo.hxx> #if HAVE_FEATURE_OPENGL #include <vcl/opengl/OpenGLWrapper.hxx> diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index e79a39607d73..c39c0b4bef2e 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -32,6 +32,7 @@ #include <svl/intitem.hxx> #include <vcl/settings.hxx> #include <vcl/event.hxx> +#include <vcl/image.hxx> #define IID_BOTTOMLOCK 1 #define IID_TOPLOCK 2 diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index a666ce2a508f..a4b4169a793c 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -20,6 +20,7 @@ #include <svl/eitem.hxx> #include <svl/intitem.hxx> #include <sfx2/objsh.hxx> +#include <vcl/outdev.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <i18nlangtag/lang.h> diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index aea68537a5fa..945d92315c94 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -37,6 +37,7 @@ #include <svx/dlgutil.hxx> #include <svl/intitem.hxx> #include <sfx2/opengrf.hxx> +#include <vcl/image.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <svx/svxdlg.hxx> diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx index d4d358338fbc..e4d75d15bcb4 100644 --- a/dbaccess/source/ui/dlg/adminpages.cxx +++ b/dbaccess/source/ui/dlg/adminpages.cxx @@ -48,7 +48,6 @@ namespace dbaui using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; using namespace ::dbtools; - using namespace ::svt; ISaveValueWrapper::~ISaveValueWrapper() { diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx index b136744ed975..35a61c62a39a 100644 --- a/dbaccess/source/ui/dlg/dbwiz.cxx +++ b/dbaccess/source/ui/dlg/dbwiz.cxx @@ -39,7 +39,6 @@ namespace dbaui { -using namespace svt; using namespace com::sun::star::uno; using namespace com::sun::star::sdbc; using namespace com::sun::star::lang; diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx index fedaa598109c..92da31ed12af 100644 --- a/include/sfx2/basedlgs.hxx +++ b/include/sfx2/basedlgs.hxx @@ -23,7 +23,6 @@ #include <sal/config.h> #include <sfx2/dllapi.h> #include <sal/types.h> -#include <vcl/floatwin.hxx> #include <vcl/weld.hxx> class SfxTabPage; @@ -83,43 +82,6 @@ public: SfxBindings& GetBindings() const { return *m_pBindings; } }; -// class SfxFloatingWindow -------------------------------------------------- -class SfxFloatingWindow_Impl; -class SFX2_DLLPUBLIC SfxFloatingWindow: public FloatingWindow -{ - SfxBindings* pBindings; - Size aSize; - std::unique_ptr< SfxFloatingWindow_Impl > pImpl; - - SfxFloatingWindow(SfxFloatingWindow const &) = delete; - SfxFloatingWindow& operator =(SfxFloatingWindow const &) = delete; - -protected: - SfxFloatingWindow( SfxBindings *pBindings, - SfxChildWindow *pCW, - vcl::Window* pParent, - WinBits nWinBits); - virtual ~SfxFloatingWindow() override; - virtual void dispose() override; - - virtual void StateChanged( StateChangedType nStateChange ) override; - virtual bool Close() override; - virtual void Resize() override; - virtual void Move() override; - virtual bool EventNotify( NotifyEvent& rNEvt ) override; - SfxBindings& GetBindings() - { return *pBindings; } - -public: - virtual void FillInfo(SfxChildWinInfo&) const; - void Initialize (SfxChildWinInfo const * pInfo); - - DECL_LINK(TimerHdl, Timer *, void); - -}; - -// class SfxNoLayoutSingleTabDialog -------------------------------------------------- - typedef const sal_uInt16* (*GetTabPageRanges)(); // provides international Which values class SFX2_DLLPUBLIC SfxOkDialogController : public SfxDialogController diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx index f5e64fdfedf3..68279262d11d 100644 --- a/include/sfx2/childwin.hxx +++ b/include/sfx2/childwin.hxx @@ -272,14 +272,6 @@ public: sal_uInt16 Class::GetChildWindowId () \ { return MyID; } \ -#define SFX_IMPL_FLOATINGWINDOW(Class, MyID) \ - SFX_IMPL_CHILDWINDOW(Class, MyID) \ - SfxChildWinInfo Class::GetInfo() const \ - { \ - SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ - static_cast<SfxFloatingWindow*>(GetWindow())->FillInfo( aInfo ); \ - return aInfo; } - #define SFX_IMPL_MODELESSDIALOGCONTOLLER(Class, MyID) \ SFX_IMPL_CHILDWINDOW(Class, MyID) \ SfxChildWinInfo Class::GetInfo() const \ diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index 325bfb8b4b4b..b8229ca338a0 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -24,6 +24,7 @@ #include <sfx2/dllapi.h> #include <sfx2/basedlgs.hxx> #include <sal/types.h> +#include <vcl/bitmapex.hxx> #include <vcl/builderpage.hxx> #include <svl/itempool.hxx> #include <svl/itemset.hxx> diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 21d6e3c8af7a..dca6d9210768 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -29,10 +29,11 @@ #include <tools/diagnose_ex.h> +#include <vcl/settings.hxx> +#include <vcl/syswin.hxx> #include <vcl/svapp.hxx> #include <vcl/unohelp.hxx> #include <vcl/window.hxx> -#include <vcl/settings.hxx> #include <com/sun/star/lang/NullPointerException.hpp> #include <com/sun/star/beans/NamedValue.hpp> diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx b/sc/source/ui/Accessibility/AccessibleEditObject.cxx index a846e8f9016d..6c40b685dc6f 100644 --- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx +++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx @@ -39,6 +39,7 @@ #include <editeng/editeng.hxx> #include <svx/svdmodel.hxx> #include <vcl/svapp.hxx> +#include <vcl/window.hxx> #include <sfx2/objsh.hxx> #include <cppuhelper/queryinterface.hxx> diff --git a/sc/source/ui/inc/olinewin.hxx b/sc/source/ui/inc/olinewin.hxx index daf40d437532..b601417b4cc4 100644 --- a/sc/source/ui/inc/olinewin.hxx +++ b/sc/source/ui/inc/olinewin.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_OLINEWIN_HXX #define INCLUDED_SC_SOURCE_UI_INC_OLINEWIN_HXX +#include <vcl/window.hxx> #include "viewdata.hxx" class ScOutlineEntry; diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx index 35be32afa3b2..1da61965b4b0 100644 --- a/sc/source/ui/inc/tpsort.hxx +++ b/sc/source/ui/inc/tpsort.hxx @@ -23,9 +23,10 @@ #include <vector> #include <sfx2/tabdlg.hxx> +#include <svtools/collatorres.hxx> #include <svx/langbox.hxx> #include <unotools/collatorwrapper.hxx> -#include <svtools/collatorres.hxx> +#include <vcl/idle.hxx> #include "sortkeydlg.hxx" diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index b4cf5faac6c1..8368cbee7c89 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -30,6 +30,7 @@ #include <svl/ctloptions.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <vcl/window.hxx> #include <sfx2/objsh.hxx> #include <sfx2/viewfrm.hxx> #include <svl/eitem.hxx> diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index e9e68c8ee706..b2a7bc8cc18c 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -43,6 +43,7 @@ #include <comphelper/classids.hxx> #include <sot/formats.hxx> #include <sfx2/viewfrm.hxx> +#include <vcl/syswin.hxx> #include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawView.hpp> diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx index 9495764d9d38..b107c99c11ae 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 2019-12-03 09:21:34 using: + Generated on 2019-12-04 09:32:44 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: @@ -88,8 +88,6 @@ #include <sal/saldllapi.h> #include <sal/types.h> #include <vcl/EnumContext.hxx> -#include <vcl/Scanline.hxx> -#include <vcl/alpha.hxx> #include <vcl/bitmapex.hxx> #include <vcl/builder.hxx> #include <vcl/builderfactory.hxx> @@ -103,7 +101,6 @@ #include <vcl/errcode.hxx> #include <vcl/event.hxx> #include <vcl/fixed.hxx> -#include <vcl/floatwin.hxx> #include <vcl/font.hxx> #include <vcl/gdimtf.hxx> #include <vcl/gradient.hxx> @@ -126,8 +123,10 @@ #include <vcl/stdtext.hxx> #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> +#include <vcl/taskpanelist.hxx> #include <vcl/timer.hxx> #include <vcl/toolbox.hxx> +#include <vcl/vclenum.hxx> #include <vcl/vclptr.hxx> #include <vcl/virdev.hxx> #include <vcl/weld.hxx> diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 1180050d6cc7..13d511fddec3 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -30,6 +30,7 @@ #include <svl/stritem.hxx> #include <svl/visitem.hxx> #include <vcl/svapp.hxx> +#include <vcl/timer.hxx> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatch.hpp> diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 905d27fd3a3e..330109b7ce94 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -62,24 +62,6 @@ void SfxModelessDialog_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint ) } } -class SfxFloatingWindow_Impl : public SfxListener -{ -public: - OString aWinState; - SfxChildWindow* pMgr; - bool bConstructed; - Idle aMoveIdle; - - void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; -}; - -void SfxFloatingWindow_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - if( rHint.GetId() == SfxHintId::Dying) { - pMgr->Destroy(); - } -} - void SfxModelessDialogController::Initialize(SfxChildWinInfo const *pInfo) /* [Description] @@ -226,187 +208,6 @@ void SfxModelessDialogController::Close() SfxCallMode::RECORD|SfxCallMode::SYNCHRON, { &aValue } ); } -bool SfxFloatingWindow::EventNotify( NotifyEvent& rEvt ) - -/* [Description] - - If a ModelessDialog is enabled, its ViewFrame will be activated. - This necessary for the PluginInFrames. -*/ - -{ - if ( pImpl ) - { - if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS ) - { - pBindings->SetActiveFrame( pImpl->pMgr->GetFrame() ); - pImpl->pMgr->Activate_Impl(); - } - else if ( rEvt.GetType() == MouseNotifyEvent::LOSEFOCUS ) - { - if ( !HasChildPathFocus() ) - { - pBindings->SetActiveFrame( nullptr ); - } - } - else if( rEvt.GetType() == MouseNotifyEvent::KEYINPUT ) - { - // First, allow KeyInput for Dialog functions - if (!FloatingWindow::EventNotify(rEvt) && SfxViewShell::Current()) - { - // then also for valid global accelerators. - return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() ); - } - return true; - } - } - - return FloatingWindow::EventNotify( rEvt ); -} - -SfxFloatingWindow::SfxFloatingWindow( SfxBindings *pBindinx, - SfxChildWindow *pCW, - vcl::Window* pParent, WinBits nWinBits) : - FloatingWindow (pParent, nWinBits), - pBindings(pBindinx), - pImpl( new SfxFloatingWindow_Impl ) -{ - pImpl->pMgr = pCW; - pImpl->bConstructed = false; - if ( pBindinx ) - pImpl->StartListening( *pBindinx ); - pImpl->aMoveIdle.SetPriority(TaskPriority::RESIZE); - pImpl->aMoveIdle.SetInvokeHandler(LINK(this,SfxFloatingWindow,TimerHdl)); -} - -bool SfxFloatingWindow::Close() - -/* [Description] - - The window is closed when the ChildWindow is destroyed by running the - ChildWindow-slots. If this is method is overridden by a derived class - method, then the SfxModelessDialogWindow: Close) must be called afterwards - if the Close() was not cancelled with "return sal_False". -*/ - -{ - // Execute with Parameters, since Toggle is ignored by some ChildWindows. - SfxBoolItem aValue( pImpl->pMgr->GetType(), false); - pBindings->GetDispatcher_Impl()->ExecuteList( - pImpl->pMgr->GetType(), - SfxCallMode::RECORD|SfxCallMode::SYNCHRON, { &aValue }); - - return true; -} - - -SfxFloatingWindow::~SfxFloatingWindow() -{ - disposeOnce(); -} - -void SfxFloatingWindow::dispose() -{ - if ( pImpl && pImpl->pMgr->GetFrame() == pBindings->GetActiveFrame() ) - pBindings->SetActiveFrame( nullptr ); - pImpl.reset(); - FloatingWindow::dispose(); -} - -void SfxFloatingWindow::Resize() - -/* [Description] - - This virtual method of the class FloatingWindow keeps track if a change - in size has been made. When this method is overridden by a derived class, - then the SfxFloatingWindow: Resize() must also be called. -*/ - -{ - FloatingWindow::Resize(); - if ( pImpl->bConstructed && pImpl->pMgr ) - { - // start timer for saving window status information - pImpl->aMoveIdle.Start(); - } -} - -void SfxFloatingWindow::Move() -{ - FloatingWindow::Move(); - if ( pImpl->bConstructed && pImpl->pMgr ) - { - // start timer for saving window status information - pImpl->aMoveIdle.Start(); - } -} - -/* - Implements a timer event that is triggered by a move or resize of the window - This will save config information to Views.xcu with a small delay -*/ -IMPL_LINK_NOARG(SfxFloatingWindow, TimerHdl, Timer *, void) -{ - pImpl->aMoveIdle.Stop(); - if ( pImpl->bConstructed && pImpl->pMgr ) - { - if ( !IsRollUp() ) - aSize = GetSizePixel(); - WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State; - if ( GetStyle() & WB_SIZEABLE ) - nMask |= WindowStateMask::Width | WindowStateMask::Height; - pImpl->aWinState = GetWindowState( nMask ); - GetBindings().GetWorkWindow_Impl()->ConfigChild_Impl( SfxChildIdentifier::DOCKINGWINDOW, SfxDockingConfig::ALIGNDOCKINGWINDOW, pImpl->pMgr->GetType() ); - } -} - - -void SfxFloatingWindow::StateChanged( StateChangedType nStateChange ) -{ - if ( nStateChange == StateChangedType::InitShow ) - { - // FloatingWindows are not centered by default - if ( !pImpl->aWinState.isEmpty() ) - SetWindowState( pImpl->aWinState ); - pImpl->bConstructed = true; - } - - FloatingWindow::StateChanged( nStateChange ); -} - - -void SfxFloatingWindow::Initialize(SfxChildWinInfo const *pInfo) - -/* [Description] - - Initialization of a class SfxFloatingWindow through a SfxChildWinInfo. - The initialization is done only in a 2nd step after the constructor and - should be called by the constructor of the derived class or from the - SfxChildWindows. -*/ -{ - if (pInfo) - pImpl->aWinState = pInfo->aWinState; -} - - -void SfxFloatingWindow::FillInfo(SfxChildWinInfo& rInfo) const - -/* [Description] - - Fills a SfxChildWinInfo with specific data from SfxFloatingWindow, - so that it can be written in the INI file. It is assumed that rinfo - receives all other possible relevant data in the ChildWindow class. - Insertions are marked with size and the ZoomIn flag. - If this method is overridden, the base implementation must be called first. -*/ - -{ - rInfo.aSize = aSize; - if ( IsRollUp() ) - rInfo.nFlags |= SfxChildWindowFlags::ZOOMIN; -} - SfxDialogController::SfxDialogController(weld::Widget* pParent, const OUString& rUIFile, const OString& rDialogId) : GenericDialogController(pParent, rUIFile, rDialogId) diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index d1ad9148ac4e..5f23221a0020 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -435,7 +435,7 @@ SfxDockingWindow_Impl::SfxDockingWindow_Impl(SfxDockingWindow* pBase) This virtual method of the class FloatingWindow keeps track of changes in FloatingSize. If this method is overridden by a derived class, - then the SfxFloatingWindow: Resize() must also be called. + then the FloatingWindow: Resize() must also be called. */ void SfxDockingWindow::Resize() { diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx index b431cc619298..992136fd0fa1 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -23,6 +23,7 @@ #include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <vcl/weldutils.hxx> +#include <vcl/windowstate.hxx> #include <recfloat.hxx> #include <sfx2/strings.hrc> diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index a1025a3dde90..55710e3fa399 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.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 2019-12-03 09:41:31 using: + Generated on 2019-12-04 09:33:31 using: ./bin/update_pch svx svx --cutoff=3 --exclude:system --exclude:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -61,11 +61,8 @@ #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> -#include <rtl/stringutils.hxx> #include <rtl/tencinfo.h> #include <rtl/textenc.h> #include <rtl/uri.hxx> diff --git a/svx/inc/pch/precompiled_svxcore.hxx b/svx/inc/pch/precompiled_svxcore.hxx index 35f4ea416ed7..eeeb473d20ca 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 2019-12-03 09:41:26 using: + Generated on 2019-12-04 09:34:08 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: @@ -62,6 +62,7 @@ #include <osl/interlck.h> #include <osl/mutex.hxx> #include <osl/process.h> +#include <osl/thread.h> #include <osl/time.h> #include <rtl/alloc.h> #include <rtl/character.hxx> diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index a96e8d984a5d..b2c9cd46b0a4 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -62,6 +62,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/viewfrm.hxx> #include <svl/eitem.hxx> +#include <vcl/builder.hxx> #include <vcl/commandevent.hxx> #include <vcl/fmtfield.hxx> #include <vcl/svapp.hxx> diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 8815d1a2be99..a828a55c7b82 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -62,6 +62,7 @@ #include <sal/log.hxx> #include <vcl/outdev.hxx> #include <vcl/svapp.hxx> +#include <vcl/window.hxx> #include <memory> diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index 6754f8feab42..d7adffee9982 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -22,6 +22,7 @@ #include <comphelper/processfactory.hxx> #include <tools/datetime.hxx> #include <unotools/datetime.hxx> +#include <vcl/builder.hxx> #include <vcl/commandevent.hxx> #include <vcl/event.hxx> #include <vcl/settings.hxx> diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index 0ce7dd018356..b0837ccab492 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.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 2019-12-03 09:23:47 using: + Generated on 2019-12-04 09:34:32 using: ./bin/update_pch sw sw --cutoff=7 --exclude:system --exclude:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -83,12 +83,10 @@ #include <sal/types.h> #include <sal/typesizes.h> #include <vcl/EnumContext.hxx> -#include <vcl/NotebookBarAddonsMerger.hxx> #include <vcl/Scanline.hxx> #include <vcl/alpha.hxx> #include <vcl/bitmap.hxx> #include <vcl/bitmapex.hxx> -#include <vcl/builder.hxx> #include <vcl/button.hxx> #include <vcl/commandevent.hxx> #include <vcl/ctrl.hxx> @@ -99,7 +97,6 @@ #include <vcl/errinf.hxx> #include <vcl/event.hxx> #include <vcl/fixed.hxx> -#include <vcl/floatwin.hxx> #include <vcl/fntstyle.hxx> #include <vcl/font.hxx> #include <vcl/graph.hxx> @@ -115,7 +112,6 @@ #include <vcl/outdev.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> -#include <vcl/syswin.hxx> #include <vcl/textfilter.hxx> #include <vcl/vclenum.hxx> #include <vcl/vclevent.hxx> @@ -124,7 +120,6 @@ #include <vcl/virdev.hxx> #include <vcl/weld.hxx> #include <vcl/window.hxx> -#include <vcl/windowstate.hxx> #endif // PCH_LEVEL >= 2 #if PCH_LEVEL >= 3 #include <basegfx/basegfxdllapi.h> diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 0d32e4980b36..5a7cf43d429e 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -44,6 +44,7 @@ #include <dbui.hrc> #include <strings.hrc> #include <unomid.h> +#include <map> using namespace ::com::sun::star; using namespace ::com::sun::star::ui::dialogs; diff --git a/sw/source/ui/inc/mmresultdialogs.hxx b/sw/source/ui/inc/mmresultdialogs.hxx index 4cc719c8fc01..6c02488fddff 100644 --- a/sw/source/ui/inc/mmresultdialogs.hxx +++ b/sw/source/ui/inc/mmresultdialogs.hxx @@ -21,6 +21,7 @@ #include <vcl/wizardmachine.hxx> #include <vcl/weld.hxx> +#include <vcl/print.hxx> #include <sfx2/basedlgs.hxx> #include <mailmergehelper.hxx> diff --git a/sw/source/uibase/envelp/syncbtn.cxx b/sw/source/uibase/envelp/syncbtn.cxx index 3f8a8d633fff..d67b1712a53d 100644 --- a/sw/source/uibase/envelp/syncbtn.cxx +++ b/sw/source/uibase/envelp/syncbtn.cxx @@ -19,6 +19,7 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> +#include <vcl/windowstate.hxx> #include <cmdid.h> #include <swmodule.hxx> diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index c77d65430b12..89014a5841ab 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -18,11 +18,12 @@ */ #include <sfx2/objface.hxx> -#include <vcl/timer.hxx> #include <vcl/help.hxx> #include <vcl/commandevent.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> +#include <vcl/syswin.hxx> +#include <vcl/timer.hxx> #include <vcl/weld.hxx> #include <svl/whiter.hxx> commit 1efeb17837c22499f00299c033ae59ba3910f7d7 Author: Caolán McNamara <[email protected]> AuthorDate: Mon Nov 4 13:06:04 2019 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Dec 9 13:28:35 2019 +0100 weld Property Browser Replaced the odd HyperlinkField Edit whose text can be clicked on to activate listeners, with an ordinary Edit and a Button beside it which can be clicked instead to do that. I couldn't find a real world use of this HyperlinkField in the forms or control properties, nor in casual experimentation in the sidebar in the basicide dialog editor. Also replaced the other strange Edit-alike TextView with a real Edit entry and a dropdown which can be used to support entry of multi-line labels Change-Id: Iad5265e404f6de14c8e760d617dbad49cd6ddead Reviewed-on: https://gerrit.libreoffice.org/82213 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx index c6565dda2a70..2f7ff78ab52b 100644 --- a/basctl/source/dlged/propbrw.cxx +++ b/basctl/source/dlged/propbrw.cxx @@ -85,6 +85,7 @@ const long WIN_BORDER = 2; PropBrw::PropBrw (DialogWindowLayout& rLayout_): DockingWindow(&rLayout_), + m_xContentArea(VclPtr<VclVBox>::Create(this)), m_bInitialStateChange(true), m_xContextDocument(SfxViewShell::Current() ? SfxViewShell::Current()->GetCurrentDocument() : Reference<XModel>()), pView(nullptr) @@ -93,11 +94,18 @@ PropBrw::PropBrw (DialogWindowLayout& rLayout_): SetMinOutputSizePixel(Size(STD_MIN_SIZE_X,STD_MIN_SIZE_Y)); SetOutputSizePixel(aPropWinSize); + // turn off WB_CLIPCHILDREN otherwise the bg won't extend "under" + // transparent children of the widget + m_xContentArea->SetControlBackground(m_xContentArea->GetSettings().GetStyleSettings().GetWindowColor()); + m_xContentArea->SetBackground(m_xContentArea->GetControlBackground()); + m_xContentArea->SetStyle(m_xContentArea->GetStyle() & ~WB_CLIPCHILDREN); + m_xContentArea->Show(); + try { // create a frame wrapper for myself m_xMeAsFrame = frame::Frame::create( comphelper::getProcessComponentContext() ); - m_xMeAsFrame->initialize( VCLUnoHelper::GetInterface ( this ) ); + m_xMeAsFrame->initialize(VCLUnoHelper::GetInterface(m_xContentArea)); m_xMeAsFrame->setName( "form property browser" ); // change name! } catch (const Exception&) @@ -126,7 +134,7 @@ void PropBrw::ImplReCreateController() // a ComponentContext for the ::cppu::ContextEntry_Init aHandlerContextInfo[] = { - ::cppu::ContextEntry_Init( "DialogParentWindow", Any( VCLUnoHelper::GetInterface ( this ) ) ), + ::cppu::ContextEntry_Init( "DialogParentWindow", Any(VCLUnoHelper::GetInterface(this))), ::cppu::ContextEntry_Init( "ContextDocument", Any( m_xContextDocument ) ) }; Reference< XComponentContext > xInspectorContext( @@ -153,8 +161,6 @@ void PropBrw::ImplReCreateController() else { xAsXController->attachFrame( Reference<XFrame>(m_xMeAsFrame,UNO_QUERY_THROW) ); - m_xBrowserComponentWindow = m_xMeAsFrame->getComponentWindow(); - DBG_ASSERT(m_xBrowserComponentWindow.is(), "PropBrw::PropBrw: attached the controller, but have no component window!"); } } @@ -163,13 +169,8 @@ void PropBrw::ImplReCreateController() aPropWinSize.AdjustWidth( -(2*WIN_BORDER) ); aPropWinSize.AdjustHeight( -(2*WIN_BORDER) ); - if ( m_xBrowserComponentWindow.is() ) - { - m_xBrowserComponentWindow->setPosSize(aPropWinPos.X(), aPropWinPos.Y(), aPropWinSize.Width(), aPropWinSize.Height(), - css::awt::PosSize::WIDTH | css::awt::PosSize::HEIGHT | - css::awt::PosSize::X | css::awt::PosSize::Y); - m_xBrowserComponentWindow->setVisible(true); - } + VclContainer::setLayoutAllocation(*m_xContentArea, aPropWinPos, aPropWinSize); + m_xContentArea->Show(); } catch (const Exception&) { @@ -177,20 +178,16 @@ void PropBrw::ImplReCreateController() try { ::comphelper::disposeComponent(m_xBrowserController); - ::comphelper::disposeComponent(m_xBrowserComponentWindow); } catch(const Exception&) { } m_xBrowserController.clear(); - m_xBrowserComponentWindow.clear(); } - Resize(); } - PropBrw::~PropBrw() { disposeOnce(); @@ -200,6 +197,7 @@ void PropBrw::dispose() { if ( m_xBrowserController.is() ) ImplDestroyController(); + m_xContentArea.disposeAndClear(); DockingWindow::dispose(); } @@ -227,7 +225,6 @@ void PropBrw::ImplDestroyController() m_xBrowserController.clear(); } - bool PropBrw::Close() { ImplDestroyController(); @@ -238,7 +235,6 @@ bool PropBrw::Close() return DockingWindow::Close(); } - Sequence< Reference< XInterface > > PropBrw::CreateMultiSelectionSequence( const SdrMarkList& _rMarkList ) { @@ -430,25 +426,6 @@ OUString PropBrw::GetHeadlineName( const Reference< XPropertySet >& _rxObject ) return aName; } - -void PropBrw::Resize() -{ - DockingWindow::Resize(); - - // adjust size - Size aSize_ = GetOutputSizePixel(); - Size aPropWinSize( aSize_ ); - aPropWinSize.AdjustWidth( -(2*WIN_BORDER) ); - aPropWinSize.AdjustHeight( -(2*WIN_BORDER) ); - - if (m_xBrowserComponentWindow.is()) - { - m_xBrowserComponentWindow->setPosSize(0, 0, aPropWinSize.Width(), aPropWinSize.Height(), - css::awt::PosSize::WIDTH | css::awt::PosSize::HEIGHT); - } -} - - void PropBrw::ImplUpdate( const Reference< XModel >& _rxContextDocument, SdrView* pNewView ) { Reference< XModel > xContextDocument( _rxContextDocument ); @@ -482,8 +459,7 @@ void PropBrw::ImplUpdate( const Reference< XModel >& _rxContextDocument, SdrView // set focus on initialization if ( m_bInitialStateChange ) { - if ( m_xBrowserComponentWindow.is() ) - m_xBrowserComponentWindow->setFocus(); + m_xContentArea->GrabFocus(); m_bInitialStateChange = false; } diff --git a/basctl/source/inc/propbrw.hxx b/basctl/source/inc/propbrw.hxx index 123b477bed92..6bc9066527ce 100644 --- a/basctl/source/inc/propbrw.hxx +++ b/basctl/source/inc/propbrw.hxx @@ -29,6 +29,7 @@ #include <svl/lstner.hxx> #include <svl/SfxBroadcaster.hxx> #include <svx/svdmark.hxx> +#include <vcl/layout.hxx> #include "bastypes.hxx" class SfxBindings; @@ -43,19 +44,17 @@ class DialogWindowLayout; class PropBrw final : public DockingWindow, public SfxListener, public SfxBroadcaster { private: + VclPtr<VclBox> m_xContentArea; bool m_bInitialStateChange; css::uno::Reference< css::frame::XFrame2 > m_xMeAsFrame; css::uno::Reference< css::beans::XPropertySet > m_xBrowserController; - css::uno::Reference< css::awt::XWindow > - m_xBrowserComponentWindow; css::uno::Reference< css::frame::XModel > m_xContextDocument; SdrView* pView; - virtual void Resize() override; virtual bool Close() override; typedef std::vector< css::uno::Reference< css::uno::XInterface> > InterfaceArray; diff --git a/extensions/UIConfig_spropctrlr.mk b/extensions/UIConfig_spropctrlr.mk index a0a078e1ebd7..a07d7737d4ba 100644 --- a/extensions/UIConfig_spropctrlr.mk +++ b/extensions/UIConfig_spropctrlr.mk @@ -10,12 +10,28 @@ $(eval $(call gb_UIConfig_UIConfig,modules/spropctrlr)) $(eval $(call gb_UIConfig_add_uifiles,modules/spropctrlr,\ + extensions/uiconfig/spropctrlr/ui/browserline \ + extensions/uiconfig/spropctrlr/ui/browserpage \ + extensions/uiconfig/spropctrlr/ui/colorlistbox \ + extensions/uiconfig/spropctrlr/ui/combobox \ extensions/uiconfig/spropctrlr/ui/controlfontdialog \ + extensions/uiconfig/spropctrlr/ui/datefield \ extensions/uiconfig/spropctrlr/ui/datatypedialog \ + extensions/uiconfig/spropctrlr/ui/datetimefield \ extensions/uiconfig/spropctrlr/ui/formlinksdialog \ + extensions/uiconfig/spropctrlr/ui/formattedcontrol \ + extensions/uiconfig/spropctrlr/ui/formattedsample \ + extensions/uiconfig/spropctrlr/ui/formproperties \ + extensions/uiconfig/spropctrlr/ui/hyperlinkfield \ extensions/uiconfig/spropctrlr/ui/labelselectiondialog \ + extensions/uiconfig/spropctrlr/ui/listbox \ extensions/uiconfig/spropctrlr/ui/listselectdialog \ + extensions/uiconfig/spropctrlr/ui/multiline \ + extensions/uiconfig/spropctrlr/ui/numericfield \ extensions/uiconfig/spropctrlr/ui/taborder \ + extensions/uiconfig/spropctrlr/ui/textfield \ + extensions/uiconfig/spropctrlr/ui/timefield \ + extensions/uiconfig/spropctrlr/ui/urlcontrol \ )) # vim: set noet sw=4 ts=4: diff --git a/extensions/inc/strings.hrc b/extensions/inc/strings.hrc index 1bece38c2cba..63dc3ced1b7d 100644 --- a/extensions/inc/strings.hrc +++ b/extensions/inc/strings.hrc @@ -257,7 +257,6 @@ #define RID_STR_STANDARD NC_("RID_STR_STANDARD", "Default") #define RID_STR_PROPPAGE_DEFAULT NC_("RID_STR_PROPPAGE_DEFAULT", "General") #define RID_STR_PROPPAGE_DATA NC_("RID_STR_PROPPAGE_DATA", "Data") -#define RID_STR_HELP_SECTION_LABEL NC_("RID_STR_HELP_SECTION_LABEL", "Help") #define RID_EMBED_IMAGE_PLACEHOLDER NC_("RID_EMBED_IMAGE_PLACEHOLDER", "<Embedded-Image>") #define RID_STR_TEXT_FORMAT NC_("RID_STR_TEXT_FORMAT", "Text") diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx index afb01b626153..6dcd483dc941 100644 --- a/extensions/source/propctrlr/browserline.cxx +++ b/extensions/source/propctrlr/browserline.cxx @@ -29,9 +29,10 @@ #include <tools/debug.hxx> #include <tools/diagnose_ex.h> #include <toolkit/helper/vclunohelper.hxx> -#include <vcl/svapp.hxx> #include <vcl/settings.hxx> - +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> +#include <vcl/weldutils.hxx> namespace pcr { @@ -51,235 +52,159 @@ namespace pcr namespace PropertyLineElement = ::com::sun::star::inspection::PropertyLineElement; - OBrowserLine::OBrowserLine( const OUString& _rEntryName, vcl::Window* pParent ) - :m_sEntryName( _rEntryName ) - ,m_aFtTitle(VclPtr<FixedText>::Create(pParent)) - ,m_pControlWindow( nullptr ) - ,m_pBrowseButton(nullptr) - ,m_pAdditionalBrowseButton( nullptr ) - ,m_pClickListener( nullptr ) - ,m_pTheParent(pParent) - ,m_nNameWidth(0) - ,m_nEnableFlags( 0xFFFF ) - ,m_bIndentTitle( false ) - ,m_bReadOnly( false ) + OBrowserLine::OBrowserLine(const OUString& rEntryName, weld::Container* pParent, weld::SizeGroup* pLabelGroup, + weld::Container* pInitialControlParent, bool bInterimBuilder) + : m_sEntryName(rEntryName) + , m_xBuilder(bInterimBuilder + ? Application::CreateInterimBuilder(pParent, "modules/spropctrlr/ui/browserline.ui") + : Application::CreateBuilder(pParent, "modules/spropctrlr/ui/browserline.ui")) + , m_xContainer(m_xBuilder->weld_container("BrowserLine")) + , m_xFtTitle(m_xBuilder->weld_label("label")) + , m_xBrowseButton(m_xBuilder->weld_button("browse")) + , m_xAdditionalBrowseButton(m_xBuilder->weld_button("morebrowse")) + , m_pInitialControlParent(pInitialControlParent) // controls start with this as their parent and need to be moved into m_xContainer + , m_pParent(pParent) + , m_pControlWindow( nullptr ) + , m_pBrowseButton(nullptr) + , m_pAdditionalBrowseButton( nullptr ) + , m_pClickListener( nullptr ) + , m_nNameWidth(0) + , m_nEnableFlags( 0xFFFF ) + , m_bIndentTitle( false ) + , m_bReadOnly( false ) { - m_aFtTitle->Show(); + pLabelGroup->add_widget(m_xFtTitle.get()); } OBrowserLine::~OBrowserLine() { implHideBrowseButton(true); implHideBrowseButton(false); - m_aFtTitle.disposeAndClear(); + m_pParent->move(m_xContainer.get(), nullptr); } - void OBrowserLine::IndentTitle( bool _bIndent ) { if ( m_bIndentTitle != _bIndent ) { m_bIndentTitle = _bIndent; - impl_layoutComponents(); } } - void OBrowserLine::SetComponentHelpIds(const OString& _rHelpId) + void OBrowserLine::SetComponentHelpIds(const OString& rHelpId) { - if ( m_pControlWindow ) - m_pControlWindow->SetHelpId( _rHelpId ); + if (m_pControlWindow) + m_pControlWindow->set_help_id(rHelpId); if ( m_pBrowseButton ) { - m_pBrowseButton->SetHelpId( _rHelpId ); + m_pBrowseButton->set_help_id(rHelpId); if ( m_pAdditionalBrowseButton ) { - m_pAdditionalBrowseButton->SetHelpId( _rHelpId ); + m_pAdditionalBrowseButton->set_help_id(rHelpId); } } } - void OBrowserLine::setControl( const Reference< XPropertyControl >& _rxControl ) + void OBrowserLine::setControl( const Reference< XPropertyControl >& rxControl ) { - m_xControl = _rxControl; - m_pControlWindow = m_xControl.is() ? VCLUnoHelper::GetWindow( _rxControl->getControlWindow() ) : VclPtr<vcl::Window>(); + m_xControl = rxControl; + auto xWindow = m_xControl->getControlWindow(); + if (weld::TransportAsXWindow* pTunnel = dynamic_cast<weld::TransportAsXWindow*>(xWindow.get())) + m_pControlWindow = pTunnel->getWidget(); + else + m_pControlWindow = nullptr; DBG_ASSERT( m_pControlWindow, "OBrowserLine::setControl: setting NULL controls/windows is not allowed!" ); if ( m_pControlWindow ) { - m_pControlWindow->SetParent( m_pTheParent ); - m_pControlWindow->Show(); + m_pInitialControlParent->move(m_pControlWindow, m_xContainer.get()); + m_pControlWindow->set_grid_left_attach(1); + m_xFtTitle->set_mnemonic_widget(m_pControlWindow); + m_pControlWindow->show(); } - impl_layoutComponents(); } - - vcl::Window* OBrowserLine::GetRefWindow() - { - vcl::Window* pRefWindow = m_aFtTitle.get(); - - if(m_pBrowseButton) - { - pRefWindow = m_pBrowseButton; - } - else if ( m_pControlWindow ) - { - pRefWindow = m_pControlWindow; - } - return pRefWindow; - } - - - void OBrowserLine::SetTabOrder(vcl::Window* pRefWindow, ZOrderFlags nFlags ) - { - m_aFtTitle->SetZOrder(pRefWindow,nFlags); - if ( m_pControlWindow ) - m_pControlWindow->SetZOrder( m_aFtTitle.get(), ZOrderFlags::Behind ); - - if ( m_pBrowseButton && m_pControlWindow ) - m_pBrowseButton->SetZOrder( m_pControlWindow, ZOrderFlags::Behind ); - - if ( m_pAdditionalBrowseButton && m_pBrowseButton ) - m_pAdditionalBrowseButton->SetZOrder( m_pBrowseButton, ZOrderFlags::Behind ); - } - - bool OBrowserLine::GrabFocus() { bool bRes=false; - if ( m_pControlWindow && m_pControlWindow->IsEnabled() ) + if (m_pControlWindow && m_pControlWindow->get_sensitive()) { - m_pControlWindow->GrabFocus(); + m_pControlWindow->grab_focus(); bRes = true; } - else if ( m_pAdditionalBrowseButton && m_pAdditionalBrowseButton->IsEnabled() ) + else if ( m_pAdditionalBrowseButton && m_pAdditionalBrowseButton->get_sensitive() ) { - m_pAdditionalBrowseButton->GrabFocus(); + m_pAdditionalBrowseButton->grab_focus(); bRes = true; } - else if ( m_pBrowseButton && m_pBrowseButton->IsEnabled() ) + else if ( m_pBrowseButton && m_pBrowseButton->get_sensitive() ) { - m_pBrowseButton->GrabFocus(); + m_pBrowseButton->grab_focus(); bRes = true; } return bRes; } - - void OBrowserLine::SetPosSizePixel( Point _rPos, Size _rSize ) - { - m_aLinePos = _rPos; - m_aOutputSize = _rSize; - - impl_layoutComponents(); - } - - void OBrowserLine::Show(bool bFlag) { - m_aFtTitle->Show(bFlag); - if ( m_pControlWindow ) - m_pControlWindow->Show( bFlag ); + m_xFtTitle->set_visible(bFlag); + if (m_pControlWindow) + m_pControlWindow->set_visible( bFlag ); if ( m_pBrowseButton ) - m_pBrowseButton->Show( bFlag ); + m_pBrowseButton->set_visible( bFlag ); if ( m_pAdditionalBrowseButton ) - m_pAdditionalBrowseButton->Show( bFlag ); + m_pAdditionalBrowseButton->set_visible( bFlag ); } - void OBrowserLine::Hide() { Show(false); } - bool OBrowserLine::IsVisible() const { - return m_aFtTitle->IsVisible(); - } - - - void OBrowserLine::impl_layoutComponents() - { - { - Point aTitlePos( m_aLinePos.X(), m_aLinePos.Y() + 8 ); - Size aTitleSize( m_nNameWidth - 3, m_aOutputSize.Height() ); - - if ( m_bIndentTitle ) - { - Size aIndent( m_pTheParent->LogicToPixel(Size(8, 0), MapMode(MapUnit::MapAppFont)) ); - aTitlePos.AdjustX(aIndent.Width() ); - aTitleSize.AdjustWidth( -(aIndent.Width()) ); - } - m_aFtTitle->SetPosSizePixel( aTitlePos, aTitleSize ); - } - - sal_Int32 nBrowseButtonSize = m_aOutputSize.Height() - 4; - - if ( m_pControlWindow ) - { - Point aControlPos( m_aLinePos.X() + m_nNameWidth, m_aLinePos.Y() + 2 ); - m_pControlWindow->SetPosPixel( aControlPos ); - - Size aControlSize( m_aOutputSize.Width() - 4 - m_nNameWidth - nBrowseButtonSize - 4, m_pControlWindow->GetSizePixel().Height() ); - if ( m_pAdditionalBrowseButton ) - aControlSize.AdjustWidth( -(nBrowseButtonSize + 4) ); - m_pControlWindow->SetSizePixel( aControlSize ); - } - - if ( m_pBrowseButton ) - { - Point aButtonPos( m_aOutputSize.Width() - 4 - nBrowseButtonSize, m_aLinePos.Y() + 2 ); - Size aButtonSize( nBrowseButtonSize, nBrowseButtonSize ); - m_pBrowseButton->SetPosSizePixel( aButtonPos, aButtonSize ); - - if ( m_pAdditionalBrowseButton ) - { - aButtonPos.AdjustX( -(nBrowseButtonSize + 4) ); - m_pAdditionalBrowseButton->SetPosSizePixel( aButtonPos, aButtonSize ); - } - } + return m_xFtTitle->get_visible(); } - - void OBrowserLine::SetTitle(const OUString& _rNewTitle ) + void OBrowserLine::SetTitle(const OUString& rNewTitle ) { - if ( GetTitle() == _rNewTitle ) + if ( GetTitle() == rNewTitle ) return; - m_aFtTitle->SetText( _rNewTitle ); - if ( m_pControlWindow ) - m_pControlWindow->SetAccessibleName( _rNewTitle ); + m_xFtTitle->set_label( rNewTitle ); + if (m_pControlWindow) + m_pControlWindow->set_accessible_name(rNewTitle); if ( m_pBrowseButton ) - m_pBrowseButton->SetAccessibleName( _rNewTitle ); + m_pBrowseButton->set_accessible_name( rNewTitle ); FullFillTitleString(); } void OBrowserLine::FullFillTitleString() { - if( m_pTheParent ) - { - OUStringBuffer aText( m_aFtTitle->GetText() ); - - while( m_pTheParent->GetTextWidth( aText.toString() ) < m_nNameWidth ) - aText.append("..........."); + OUStringBuffer aText(m_xFtTitle->get_label()); - // for Issue 69452 - if (AllSettings::GetLayoutRTL()) - { - sal_Unicode const cRTL_mark = 0x200F; - aText.append( OUString(cRTL_mark) ); - } + int n10DotsWidth = m_xFtTitle->get_pixel_size("..........").Width(); + int nTextWidth = m_xFtTitle->get_pixel_size(aText.toString()).Width(); + int nDiff = m_nNameWidth - nTextWidth; + int nExtraChars = (nDiff * 10) / n10DotsWidth; + for (int i = 0; i < nExtraChars; ++i) + aText.append("."); - m_aFtTitle->SetText( aText.makeStringAndClear() ); + // for Issue 69452 + if (AllSettings::GetLayoutRTL()) + { + sal_Unicode const cRTL_mark = 0x200F; + aText.append( OUString(cRTL_mark) ); } - } + m_xFtTitle->set_label(aText.makeStringAndClear()); + } OUString OBrowserLine::GetTitle() const { - OUString sDisplayName = m_aFtTitle->GetText(); + OUString sDisplayName = m_xFtTitle->get_label(); // for Issue 69452 if (AllSettings::GetLayoutRTL()) @@ -293,7 +218,6 @@ namespace pcr return sDisplayName; } - void OBrowserLine::SetReadOnly( bool _bReadOnly ) { if ( m_bReadOnly != _bReadOnly ) @@ -303,37 +227,35 @@ namespace pcr } } - namespace { - void implSetBitIfAffected( sal_uInt16& _nEnabledBits, sal_Int16 _nAffectedMask, sal_Int16 _nTestBit, bool _bSet ) + void implSetBitIfAffected(sal_uInt16& nEnabledBits, sal_Int16 _nAffectedMask, sal_Int16 _nTestBit, bool _bSet) { if ( _nAffectedMask & _nTestBit ) { if ( _bSet ) - _nEnabledBits |= _nTestBit; + nEnabledBits |= _nTestBit; else - _nEnabledBits &= ~_nTestBit; + nEnabledBits &= ~_nTestBit; } } - void implEnable( vcl::Window* _pWindow, sal_uInt16 _nEnabledBits, sal_uInt16 _nMatchBits ) + void implEnable(weld::Widget* pWindow, sal_uInt16 nEnabledBits, sal_uInt16 nMatchBits) { - if ( _pWindow ) - _pWindow->Enable( ( _nEnabledBits & _nMatchBits ) == _nMatchBits ); + if (pWindow) + pWindow->set_sensitive((nEnabledBits & nMatchBits) == nMatchBits); } - void implEnable( vcl::Window* _pWindow, bool _bEnable ) + void implEnable(weld::Widget* pWindow, bool bEnable) { - if ( _pWindow ) - _pWindow->Enable( _bEnable ); + if (pWindow) + pWindow->set_sensitive(bEnable); } } - void OBrowserLine::implUpdateEnabledDisabled() { - implEnable( m_aFtTitle.get(), m_nEnableFlags, PropertyLineElement::CompleteLine ); + implEnable( m_xFtTitle.get(), m_nEnableFlags, PropertyLineElement::CompleteLine ); if ( m_pControlWindow ) implEnable( m_pControlWindow, m_nEnableFlags, PropertyLineElement::CompleteLine | PropertyLineElement::InputControl ); @@ -349,7 +271,6 @@ namespace pcr } } - void OBrowserLine::EnablePropertyLine( bool _bEnable ) { implSetBitIfAffected( m_nEnableFlags, PropertyLineElement::CompleteLine, PropertyLineElement::CompleteLine, _bEnable ); @@ -365,33 +286,35 @@ namespace pcr implUpdateEnabledDisabled(); } - - PushButton& OBrowserLine::impl_ensureButton( bool _bPrimary ) + weld::Button& OBrowserLine::impl_ensureButton(bool bPrimary) { - VclPtr<PushButton>& rpButton = _bPrimary ? m_pBrowseButton : m_pAdditionalBrowseButton; + weld::Button* pButton; + if (bPrimary) + pButton = m_pBrowseButton; + else + pButton = m_pAdditionalBrowseButton; - if ( !rpButton ) + if (!pButton ) { - rpButton = VclPtr<PushButton>::Create( m_pTheParent, WB_NOPOINTERFOCUS ); - rpButton->SetGetFocusHdl( LINK( this, OBrowserLine, OnButtonFocus ) ); - rpButton->SetClickHdl( LINK( this, OBrowserLine, OnButtonClicked ) ); - rpButton->SetText("..."); + if (bPrimary) + pButton = m_pBrowseButton = m_xBrowseButton.get(); + else + pButton = m_pAdditionalBrowseButton = m_xAdditionalBrowseButton.get(); + pButton->connect_focus_in(LINK(this, OBrowserLine, OnButtonFocus)); + pButton->connect_clicked(LINK(this, OBrowserLine, OnButtonClicked)); } - rpButton->Show(); + pButton->show(); - impl_layoutComponents(); - - return *rpButton; + return *pButton; } - - void OBrowserLine::ShowBrowseButton( const OUString& _rImageURL, bool _bPrimary ) + void OBrowserLine::ShowBrowseButton( const OUString& rImageURL, bool bPrimary ) { - PushButton& rButton( impl_ensureButton( _bPrimary ) ); + weld::Button& rButton( impl_ensureButton( bPrimary ) ); - OSL_PRECOND( !_rImageURL.isEmpty(), "OBrowserLine::ShowBrowseButton: use the other version if you don't have an image!" ); - Image aImage; + OSL_PRECOND( !rImageURL.isEmpty(), "OBrowserLine::ShowBrowseButton: use the other version if you don't have an image!" ); + Reference<XGraphic> xGraphic; try { Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); @@ -399,73 +322,74 @@ namespace pcr Sequence< PropertyValue > aMediaProperties(1); aMediaProperties[0].Name = "URL"; - aMediaProperties[0].Value <<= _rImageURL; + aMediaProperties[0].Value <<= rImageURL; - Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties ), css::uno::UNO_SET_THROW ); - aImage = Image( xGraphic ); + xGraphic = Reference<XGraphic>(xGraphicProvider->queryGraphic(aMediaProperties), css::uno::UNO_SET_THROW); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION("extensions.propctrlr"); } - rButton.SetModeImage( aImage ); + rButton.set_image(xGraphic); } - void OBrowserLine::ShowBrowseButton( const Image& _rImage, bool _bPrimary ) + void OBrowserLine::ShowBrowseButton(const css::uno::Reference<css::graphic::XGraphic>& rGraphic, bool bPrimary) { - PushButton& rButton( impl_ensureButton( _bPrimary ) ); - if ( !!_rImage ) - rButton.SetModeImage( _rImage ); + weld::Button& rButton( impl_ensureButton( bPrimary ) ); + rButton.set_image(rGraphic); } - void OBrowserLine::ShowBrowseButton( bool _bPrimary ) + void OBrowserLine::ShowBrowseButton( bool bPrimary ) { - impl_ensureButton( _bPrimary ); + impl_ensureButton(bPrimary); } - void OBrowserLine::implHideBrowseButton(bool _bPrimary) + void OBrowserLine::implHideBrowseButton(bool bPrimary) { - VclPtr<PushButton>& rpButton = _bPrimary ? m_pBrowseButton : m_pAdditionalBrowseButton; - - if ( rpButton ) + if (bPrimary) + { + if (m_pBrowseButton) + { + m_pBrowseButton->hide(); + m_pBrowseButton = nullptr; + } + } + else { - rpButton->Hide(); - rpButton.disposeAndClear(); + if (m_pAdditionalBrowseButton) + { + m_pAdditionalBrowseButton->hide(); + m_pAdditionalBrowseButton = nullptr; + } } } - void OBrowserLine::HideBrowseButton(bool _bPrimary) + void OBrowserLine::HideBrowseButton(bool bPrimary) { - implHideBrowseButton(_bPrimary); - impl_layoutComponents(); + implHideBrowseButton(bPrimary); } void OBrowserLine::SetTitleWidth(sal_uInt16 nWidth) { - if (m_nNameWidth != nWidth+10) - { - m_nNameWidth = nWidth+10; - impl_layoutComponents(); - } + int nMinDotsWidth = m_xFtTitle->get_pixel_size("...").Width(); + if (m_nNameWidth != nWidth + nMinDotsWidth) + m_nNameWidth = nWidth + nMinDotsWidth; FullFillTitleString(); } - void OBrowserLine::SetClickListener( IButtonClickListener* _pListener ) { m_pClickListener = _pListener; } - - IMPL_LINK( OBrowserLine, OnButtonClicked, Button*, _pButton, void ) + IMPL_LINK(OBrowserLine, OnButtonClicked, weld::Button&, rButton, void) { if ( m_pClickListener ) - m_pClickListener->buttonClicked( this, _pButton == m_pBrowseButton ); + m_pClickListener->buttonClicked(this, &rButton == m_pBrowseButton); } - - IMPL_LINK_NOARG( OBrowserLine, OnButtonFocus, Control&, void ) + IMPL_LINK_NOARG( OBrowserLine, OnButtonFocus, weld::Widget&, void ) { if ( m_xControl.is() ) { @@ -483,5 +407,4 @@ namespace pcr } // namespace pcr - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserline.hxx b/extensions/source/propctrlr/browserline.hxx index 45b98a56128e..fb841740ac48 100644 --- a/extensions/source/propctrlr/browserline.hxx +++ b/extensions/source/propctrlr/browserline.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/inspection/XPropertyControl.hpp> #include <vcl/fixed.hxx> #include <vcl/button.hxx> +#include <vcl/weld.hxx> namespace com { namespace sun { namespace star { namespace inspection { namespace PropertyLineElement { @@ -40,7 +41,7 @@ namespace pcr class IButtonClickListener { public: - virtual void buttonClicked( OBrowserLine* _pLine, bool _bPrimary ) = 0; + virtual void buttonClicked( OBrowserLine* pLine, bool bPrimary ) = 0; protected: ~IButtonClickListener() {} @@ -51,77 +52,76 @@ namespace pcr { private: OUString m_sEntryName; - VclPtr<FixedText> m_aFtTitle; - Size m_aOutputSize; - Point m_aLinePos; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Container> m_xContainer; + std::unique_ptr<weld::Label> m_xFtTitle; + std::unique_ptr<weld::Button> m_xBrowseButton; + std::unique_ptr<weld::Button> m_xAdditionalBrowseButton; css::uno::Reference< css::inspection::XPropertyControl > m_xControl; - VclPtr<vcl::Window> m_pControlWindow; - VclPtr<PushButton> m_pBrowseButton; - VclPtr<PushButton> m_pAdditionalBrowseButton; + weld::Container* m_pInitialControlParent; + weld::Container* m_pParent; + weld::Widget* m_pControlWindow; + weld::Button* m_pBrowseButton; + weld::Button* m_pAdditionalBrowseButton; IButtonClickListener* m_pClickListener; - VclPtr<vcl::Window> m_pTheParent; sal_uInt16 m_nNameWidth; sal_uInt16 m_nEnableFlags; bool m_bIndentTitle; bool m_bReadOnly; public: - OBrowserLine( const OUString& _rEntryName, vcl::Window* pParent); - ~OBrowserLine(); + OBrowserLine(const OUString& rEntryName, weld::Container* pParent, weld::SizeGroup* pLabelGroup, + weld::Container* pInitialControlParent, bool bInterimBuilder); + ~OBrowserLine(); - void setControl( const css::uno::Reference< css::inspection::XPropertyControl >& _rxControl ); + void setControl( const css::uno::Reference< css::inspection::XPropertyControl >& rxControl ); const css::uno::Reference< css::inspection::XPropertyControl >& getControl() const { return m_xControl; } - vcl::Window* getControlWindow() const + weld::Widget* getControlWindow() const { return m_pControlWindow; } const OUString& GetEntryName() const { return m_sEntryName; } - void SetComponentHelpIds(const OString& _rHelpId); + void SetComponentHelpIds(const OString& rHelpId); void SetTitle(const OUString& rString ); void FullFillTitleString(); OUString GetTitle() const; void SetTitleWidth(sal_uInt16); - void SetPosSizePixel(Point aPos,Size aSize); + int GetRowHeight() const { return m_xContainer->get_preferred_size().Height(); } void Show(bool bFlag=true); void Hide(); bool IsVisible() const; - vcl::Window* GetRefWindow(); - void SetTabOrder(vcl::Window* pRefWindow, ZOrderFlags nFlags ); - bool GrabFocus(); - void ShowBrowseButton( const OUString& _rImageURL, bool _bPrimary ); - void ShowBrowseButton( const Image& _rImage, bool _bPrimary ); - void ShowBrowseButton( bool _bPrimary ); - void HideBrowseButton( bool _bPrimary ); + void ShowBrowseButton( const OUString& rImageURL, bool bPrimary ); + void ShowBrowseButton( const css::uno::Reference<css::graphic::XGraphic>& rGraphic, bool bPrimary ); + void ShowBrowseButton( bool bPrimary ); + void HideBrowseButton( bool bPrimary ); - void EnablePropertyControls( sal_Int16 _nControls, bool _bEnable ); - void EnablePropertyLine( bool _bEnable ); + void EnablePropertyControls( sal_Int16 nControls, bool bEnable ); + void EnablePropertyLine( bool bEnable ); - void SetReadOnly( bool _bReadOnly ); + void SetReadOnly( bool bReadOnly ); - void SetClickListener( IButtonClickListener* _pListener ); + void SetClickListener( IButtonClickListener* pListener ); - void IndentTitle( bool _bIndent ); + void IndentTitle( bool bIndent ); private: - DECL_LINK( OnButtonClicked, Button*, void ); - DECL_LINK( OnButtonFocus, Control&, void ); + DECL_LINK( OnButtonClicked, weld::Button&, void ); + DECL_LINK( OnButtonFocus, weld::Widget&, void ); - void implHideBrowseButton(bool _bPrimary); + void implHideBrowseButton(bool bPrimary); void implUpdateEnabledDisabled(); - void impl_layoutComponents(); - - PushButton& impl_ensureButton( bool _bPrimary ); + weld::Button& impl_ensureButton(bool bPrimary); }; diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index b98f3c1e25c0..11b6ecf178e6 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -41,12 +41,7 @@ namespace pcr { - - #define FRAME_OFFSET 4 - // TODO: find out what this is really for ... and check if it does make sense in the new - // browser environment - #define LAYOUT_HELP_WINDOW_DISTANCE_APPFONT 3 using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Exception; @@ -137,8 +132,8 @@ namespace pcr }; private: - VclPtr<OBrowserListBox> m_pContext; - NotificationMode m_eMode; + OBrowserListBox* m_pContext; + NotificationMode m_eMode; public: /** creates an instance @@ -188,7 +183,7 @@ namespace pcr /** checks whether the instance is already disposed */ - bool impl_isDisposed_nothrow() const { return m_pContext.get() == nullptr; } + bool impl_isDisposed_nothrow() const { return m_pContext == nullptr; } /** notifies the given event originating from the given control @throws DisposedException @@ -198,21 +193,18 @@ namespace pcr void impl_notify_throw( const Reference< XPropertyControl >& _rxControl, ControlEventType _eType ); }; - PropertyControlContext_Impl::PropertyControlContext_Impl( OBrowserListBox& _rContextImpl ) - :m_pContext( &_rContextImpl ) - ,m_eMode( eAsynchronously ) + : m_pContext( &_rContextImpl ) + , m_eMode( eAsynchronously ) { } - PropertyControlContext_Impl::~PropertyControlContext_Impl() { if ( !impl_isDisposed_nothrow() ) dispose(); } - void PropertyControlContext_Impl::dispose() { SolarMutexGuard aGuard; @@ -223,14 +215,12 @@ namespace pcr m_pContext = nullptr; } - void PropertyControlContext_Impl::setNotificationMode( NotificationMode _eMode ) { SolarMutexGuard aGuard; m_eMode = _eMode; } - void PropertyControlContext_Impl::impl_notify_throw( const Reference< XPropertyControl >& _rxControl, ControlEventType _eType ) { ::comphelper::AnyEventRef pEvent; @@ -251,37 +241,31 @@ namespace pcr SharedNotifier::getNotifier()->addEvent( pEvent, this ); } - void SAL_CALL PropertyControlContext_Impl::focusGained( const Reference< XPropertyControl >& Control ) { impl_notify_throw( Control, FOCUS_GAINED ); } - void SAL_CALL PropertyControlContext_Impl::valueChanged( const Reference< XPropertyControl >& Control ) { impl_notify_throw( Control, VALUE_CHANGED ); } - void SAL_CALL PropertyControlContext_Impl::activateNextControl( const Reference< XPropertyControl >& CurrentControl ) { impl_notify_throw( CurrentControl, ACTIVATE_NEXT ); } - void SAL_CALL PropertyControlContext_Impl::acquire() throw() { PropertyControlContext_Impl_Base::acquire(); } - void SAL_CALL PropertyControlContext_Impl::release() throw() { PropertyControlContext_Impl_Base::release(); } - void PropertyControlContext_Impl::processEvent( const ::comphelper::AnyEvent& _rEvent ) { SolarMutexGuard aGuard; @@ -300,7 +284,6 @@ namespace pcr } } - void PropertyControlContext_Impl::impl_processEvent_throw( const ::comphelper::AnyEvent& _rEvent ) { const ControlEvent& rControlEvent = static_cast< const ControlEvent& >( _rEvent ); @@ -318,70 +301,45 @@ namespace pcr } } - OBrowserListBox::OBrowserListBox( vcl::Window* pParent) - :Control(pParent, WB_DIALOGCONTROL | WB_CLIPCHILDREN) - ,m_aLinesPlayground(VclPtr<vcl::Window>::Create(this,WB_DIALOGCONTROL | WB_CLIPCHILDREN)) - ,m_aVScroll(VclPtr<ScrollBar>::Create(this,WB_VSCROLL|WB_REPEAT|WB_DRAG)) - ,m_pHelpWindow( VclPtr<InspectorHelpWindow>::Create( this ) ) - ,m_pLineListener(nullptr) - ,m_pControlObserver( nullptr ) - ,m_nYOffset(0) - ,m_nCurrentPreferredHelpHeight(0) - ,m_nTheNameSize(0) - ,m_bIsActive(false) - ,m_bUpdate(true) - ,m_pControlContextImpl( new PropertyControlContext_Impl( *this ) ) + OBrowserListBox::OBrowserListBox(weld::Builder& rBuilder, weld::Container* pContainer, bool bInterimBuilder) + : m_xScrolledWindow(rBuilder.weld_scrolled_window("scrolledwindow")) + , m_xLinesPlayground(rBuilder.weld_container("playground")) + , m_xSizeGroup(rBuilder.create_size_group()) + , m_xHelpWindow(new InspectorHelpWindow(rBuilder)) + , m_pInitialControlParent(pContainer) + , m_pLineListener(nullptr) + , m_pControlObserver( nullptr ) + , m_nTheNameSize(0) + , m_nRowHeight(0) + , m_bInterimBuilder(bInterimBuilder) + , m_pControlContextImpl( new PropertyControlContext_Impl( *this ) ) { - ScopedVclPtrInstance<ListBox> aListBox(this, WB_DROPDOWN); - ScopedVclPtrInstance<Edit> aEditBox(this); - m_nRowHeight = std::max(aListBox->get_preferred_size().Height(), - aEditBox->get_preferred_size().Height()); - m_nRowHeight += 2; - SetBackground( pParent->GetBackground() ); - m_aLinesPlayground->SetBackground( GetBackground() ); - - m_aLinesPlayground->SetPosPixel(Point(0,0)); - m_aLinesPlayground->SetPaintTransparent(true); - m_aLinesPlayground->Show(); - m_aVScroll->Hide(); - m_aVScroll->SetScrollHdl(LINK(this, OBrowserListBox, ScrollHdl)); + m_xScrolledWindow->set_size_request(-1, m_xScrolledWindow->get_text_height() * 20); } OBrowserListBox::~OBrowserListBox() { - disposeOnce(); - } - - void OBrowserListBox::dispose() - { OSL_ENSURE( !IsModified(), "OBrowserListBox::~OBrowserListBox: still modified - should have been committed before!" ); - // doing the commit here, while we, as well as our owner, as well as some other components, - // are already "half dead" (means within their dtor) is potentially dangerous. - // By definition, CommitModified has to be called (if necessary) before destruction + // doing the commit here, while we, as well as our owner, as well as some other components, + // are already "half dead" (means within their dtor) is potentially dangerous. + // By definition, CommitModified has to be called (if necessary) before destruction m_pControlContextImpl->dispose(); m_pControlContextImpl.clear(); - Hide(); Clear(); - m_aLinesPlayground.disposeAndClear(); - m_aVScroll.disposeAndClear(); - m_pHelpWindow.disposeAndClear(); - Control::dispose(); } - - bool OBrowserListBox::IsModified( ) const + bool OBrowserListBox::IsModified() const { bool bModified = false; - if ( m_bIsActive && m_xActiveControl.is() ) + if (m_xScrolledWindow->get_visible() && m_xActiveControl.is()) bModified = m_xActiveControl->isModified(); return bModified; } - void OBrowserListBox::CommitModified( ) { if ( IsModified() && m_xActiveControl.is() ) @@ -401,226 +359,48 @@ namespace pcr } } - - void OBrowserListBox::ActivateListBox(bool _bActive) - { - m_bIsActive = _bActive; - if (m_bIsActive) - { - // TODO: what's the sense of this? - m_aVScroll->SetThumbPos(100); - MoveThumbTo(0); - Resize(); - } - } - - long OBrowserListBox::impl_getPrefererredHelpHeight() { - return HasHelpSection() ? m_pHelpWindow->GetOptimalHeightPixel() : 0; - } - - - void OBrowserListBox::Resize() - { - tools::Rectangle aPlayground( Point( 0, 0 ), GetOutputSizePixel() ); - Size aHelpWindowDistance( LogicToPixel(Size(0, LAYOUT_HELP_WINDOW_DISTANCE_APPFONT), MapMode(MapUnit::MapAppFont)) ); - - long nHelpWindowHeight = m_nCurrentPreferredHelpHeight = impl_getPrefererredHelpHeight(); - bool bPositionHelpWindow = ( nHelpWindowHeight != 0 ); - - tools::Rectangle aLinesArea( aPlayground ); - if ( bPositionHelpWindow ) - { - aLinesArea.AdjustBottom( -nHelpWindowHeight ); - aLinesArea.AdjustBottom( -(aHelpWindowDistance.Height()) ); - } - m_aLinesPlayground->SetPosSizePixel( aLinesArea.TopLeft(), aLinesArea.GetSize() ); - - UpdateVScroll(); - - bool bNeedScrollbar = m_aLines.size() > static_cast<sal_uInt32>(CalcVisibleLines()); - if ( !bNeedScrollbar ) - { - if ( m_aVScroll->IsVisible() ) - m_aVScroll->Hide(); - // scroll to top - m_nYOffset = 0; - m_aVScroll->SetThumbPos( 0 ); - } - else - { - Size aVScrollSize( m_aVScroll->GetSizePixel() ); - - // adjust the playground's width - aLinesArea.AdjustRight( -(aVScrollSize.Width()) ); - m_aLinesPlayground->SetPosSizePixel( aLinesArea.TopLeft(), aLinesArea.GetSize() ); - - // position the scrollbar - aVScrollSize.setHeight( aLinesArea.GetHeight() ); - Point aVScrollPos( aLinesArea.GetWidth(), 0 ); - m_aVScroll->SetPosSizePixel( aVScrollPos, aVScrollSize ); - } - - for ( ListBoxLines::size_type i = 0; i < m_aLines.size(); ++i ) - m_aOutOfDateLines.insert( i ); - - // repaint - EnablePaint(false); - UpdatePlayGround(); - EnablePaint(true); - - // show the scrollbar - if ( bNeedScrollbar ) - m_aVScroll->Show(); - - // position the help window - if ( bPositionHelpWindow ) - { - tools::Rectangle aHelpArea( aPlayground ); - aHelpArea.SetTop( aLinesArea.Bottom() + aHelpWindowDistance.Height() ); - m_pHelpWindow->SetPosSizePixel( aHelpArea.TopLeft(), aHelpArea.GetSize() ); - } + return HasHelpSection() ? m_xHelpWindow->GetOptimalHeightPixel() : 0; } - void OBrowserListBox::SetListener( IPropertyLineListener* _pListener ) { m_pLineListener = _pListener; } - void OBrowserListBox::SetObserver( IPropertyControlObserver* _pObserver ) { m_pControlObserver = _pObserver; } - void OBrowserListBox::EnableHelpSection( bool _bEnable ) { - m_pHelpWindow->Show( _bEnable ); - Resize(); + m_xHelpWindow->Show( _bEnable ); } - bool OBrowserListBox::HasHelpSection() const { - return m_pHelpWindow->IsVisible(); + return m_xHelpWindow->IsVisible(); } - void OBrowserListBox::SetHelpText( const OUString& _rHelpText ) { OSL_ENSURE( HasHelpSection(), "OBrowserListBox::SetHelpText: help section not visible!" ); - m_pHelpWindow->SetText( _rHelpText ); - if ( m_nCurrentPreferredHelpHeight != impl_getPrefererredHelpHeight() ) - Resize(); - } - - - void OBrowserListBox::SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines ) - { - m_pHelpWindow->SetLimits( _nMinLines, _nMaxLines ); - } - - - sal_uInt16 OBrowserListBox::CalcVisibleLines() - { - Size aSize(m_aLinesPlayground->GetOutputSizePixel()); - sal_uInt16 nResult = 0; - if (0 != m_nRowHeight) - nResult = static_cast<sal_uInt16>(aSize.Height())/m_nRowHeight; - - return nResult; - } - - - void OBrowserListBox::UpdateVScroll() - { - sal_uInt16 nLines = CalcVisibleLines(); - m_aVScroll->SetPageSize(nLines-1); - m_aVScroll->SetVisibleSize(nLines-1); - - size_t nCount = m_aLines.size(); - if (nCount>0) - { - m_aVScroll->SetRange(Range(0,nCount-1)); - m_nYOffset = -m_aVScroll->GetThumbPos()*m_nRowHeight; - } - else - { - m_aVScroll->SetRange(Range(0,0)); - m_nYOffset = 0; - } - } - - - void OBrowserListBox::PositionLine( ListBoxLines::size_type _nIndex ) - { - Size aSize(m_aLinesPlayground->GetOutputSizePixel()); - Point aPos(0, m_nYOffset); - - aSize.setHeight( m_nRowHeight ); - - aPos.AdjustY(_nIndex * m_nRowHeight ); - - if ( _nIndex < m_aLines.size() ) - { - BrowserLinePointer pLine = m_aLines[ _nIndex ].pLine; - - pLine->SetPosSizePixel( aPos, aSize ); - pLine->SetTitleWidth( m_nTheNameSize + 2 * FRAME_OFFSET ); - - // show the line if necessary - if ( !pLine->IsVisible() ) - pLine->Show(); - } + m_xHelpWindow->SetText( _rHelpText ); } - - void OBrowserListBox::UpdatePosNSize() + void OBrowserListBox::SetHelpLineLimites(sal_Int32 nMinLines, sal_Int32 nMaxLines) { - for ( auto const & aLoop: m_aOutOfDateLines ) - { - DBG_ASSERT( aLoop < m_aLines.size(), "OBrowserListBox::UpdatePosNSize: invalid line index!" ); - if ( aLoop < m_aLines.size() ) - PositionLine( aLoop ); - } - m_aOutOfDateLines.clear(); + m_xHelpWindow->SetLimits(nMinLines, nMaxLines); } - void OBrowserListBox::UpdatePlayGround() { - sal_Int32 nThumbPos = m_aVScroll->GetThumbPos(); - sal_Int32 nLines = CalcVisibleLines(); - - ListBoxLines::size_type nEnd = nThumbPos + nLines; - if (nEnd >= m_aLines.size()) - nEnd = m_aLines.size()-1; - - if ( !m_aLines.empty() ) - { - for ( ListBoxLines::size_type i = nThumbPos; i <= nEnd; ++i ) - m_aOutOfDateLines.insert( i ); - UpdatePosNSize(); - } - } - - - void OBrowserListBox::DisableUpdate() - { - m_bUpdate = false; + for (auto& line : m_aLines) + line.pLine->SetTitleWidth(m_nTheNameSize); } - - void OBrowserListBox::EnableUpdate() - { - m_bUpdate = true; - Resize(); - } - - void OBrowserListBox::SetPropertyValue(const OUString& _rEntryName, const Any& _rValue, bool _bUnknownValue ) { ListBoxLines::iterator line = std::find_if(m_aLines.begin(), m_aLines.end(), @@ -640,7 +420,6 @@ namespace pcr } } - sal_uInt16 OBrowserListBox::GetPropertyPos( const OUString& _rEntryName ) const { sal_uInt16 nPos = 0; @@ -656,7 +435,6 @@ namespace pcr return EDITOR_LIST_ENTRY_NOTFOUND; } - bool OBrowserListBox::impl_getBrowserLineForName( const OUString& _rEntryName, BrowserLinePointer& _out_rpLine ) const { ListBoxLines::const_iterator line = std::find_if(m_aLines.begin(), m_aLines.end(), @@ -669,7 +447,6 @@ namespace pcr return ( nullptr != _out_rpLine.get() ); } - void OBrowserListBox::EnablePropertyControls( const OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable ) { BrowserLinePointer pLine; @@ -677,7 +454,6 @@ namespace pcr pLine->EnablePropertyControls( _nControls, _bEnable ); } - void OBrowserListBox::EnablePropertyLine( const OUString& _rEntryName, bool _bEnable ) { BrowserLinePointer pLine; @@ -685,7 +461,6 @@ namespace pcr pLine->EnablePropertyLine( _bEnable ); } - Reference< XPropertyControl > OBrowserListBox::GetPropertyControl( const OUString& _rEntryName ) { BrowserLinePointer pLine; @@ -694,23 +469,24 @@ namespace pcr return nullptr; } - - void OBrowserListBox::InsertEntry(const OLineDescriptor& _rPropertyData, sal_uInt16 _nPos) + void OBrowserListBox::InsertEntry(const OLineDescriptor& rPropertyData, sal_uInt16 _nPos) { // create a new line - BrowserLinePointer pBrowserLine( new OBrowserLine( _rPropertyData.sName, m_aLinesPlayground.get() ) ); + BrowserLinePointer pBrowserLine(new OBrowserLine(rPropertyData.sName, m_xLinesPlayground.get(), + m_xSizeGroup.get(), m_pInitialControlParent, + m_bInterimBuilder)); // check that the name is unique for (auto const& line : m_aLines) { - if (line.aName == _rPropertyData.sName) + if (line.aName == rPropertyData.sName) { // already have another line for this name! assert(false); } } - ListBoxLine aNewLine( _rPropertyData.sName, pBrowserLine, _rPropertyData.xPropertyHandler ); + ListBoxLine aNewLine( rPropertyData.sName, pBrowserLine, rPropertyData.xPropertyHandler ); ListBoxLines::size_type nInsertPos = _nPos; if ( _nPos >= m_aLines.size() ) { @@ -721,29 +497,19 @@ namespace pcr m_aLines.insert( m_aLines.begin() + _nPos, aNewLine ); pBrowserLine->SetTitleWidth(m_nTheNameSize); - if (m_bUpdate) - { - UpdateVScroll(); - Invalidate(); - } // initialize the entry - ChangeEntry(_rPropertyData, nInsertPos); + ChangeEntry(rPropertyData, nInsertPos); - // update the positions of possibly affected lines - ListBoxLines::size_type nUpdatePos = nInsertPos; - while ( nUpdatePos < m_aLines.size() ) - m_aOutOfDateLines.insert( nUpdatePos++ ); - UpdatePosNSize( ); + m_nRowHeight = std::max(m_nRowHeight, pBrowserLine->GetRowHeight() + 6); // 6 is spacing of the "playground" in browserpage.ui + m_xScrolledWindow->vadjustment_set_step_increment(m_nRowHeight); } - sal_Int32 OBrowserListBox::GetMinimumWidth() const { return m_nTheNameSize + 2 * FRAME_OFFSET + (m_nRowHeight - 4) * 8; } - sal_Int32 OBrowserListBox::GetMinimumHeight() { // assume that we want to display 5 rows, at least @@ -751,106 +517,56 @@ namespace pcr if ( HasHelpSection() ) { - Size aHelpWindowDistance( LogicToPixel(Size(0, LAYOUT_HELP_WINDOW_DISTANCE_APPFONT), MapMode(MapUnit::MapAppFont)) ); - nMinHeight += aHelpWindowDistance.Height(); - - nMinHeight += m_pHelpWindow->GetMinimalHeightPixel(); + nMinHeight += m_xHelpWindow->GetMinimalHeightPixel(); } return nMinHeight; } - - void OBrowserListBox::ShowEntry(sal_uInt16 _nPos) + void OBrowserListBox::ShowEntry(sal_uInt16 nPos) { - if ( _nPos < m_aLines.size() ) + if (nPos == 0) { - sal_Int32 nThumbPos = m_aVScroll->GetThumbPos(); - - if (_nPos < nThumbPos) - MoveThumbTo(_nPos); - else - { - sal_Int32 nLines = CalcVisibleLines(); - if (_nPos >= nThumbPos + nLines) - MoveThumbTo(_nPos - nLines + 1); - } + // special case the simple entry 0 situation + m_xScrolledWindow->vadjustment_set_value(0); + return; } - } - - - void OBrowserListBox::MoveThumbTo(sal_Int32 _nNewThumbPos) - { - // disable painting to prevent flicker - m_aLinesPlayground->EnablePaint(false); - - sal_Int32 nDelta = _nNewThumbPos - m_aVScroll->GetThumbPos(); - // adjust the scrollbar - m_aVScroll->SetThumbPos(_nNewThumbPos); - sal_Int32 nThumbPos = _nNewThumbPos; - - m_nYOffset = -m_aVScroll->GetThumbPos() * m_nRowHeight; - - sal_Int32 nLines = CalcVisibleLines(); - ListBoxLines::size_type nEnd = nThumbPos + nLines; - - m_aLinesPlayground->Scroll(0, -nDelta * m_nRowHeight, ScrollFlags::Children); - - if (1 == nDelta) - { - // TODO: what's the sense of this two PositionLines? Why not just one call? - PositionLine(nEnd-1); - PositionLine(nEnd); - } - else if (-1 == nDelta) + if (nPos < m_aLines.size()) { - PositionLine(nThumbPos); - } - else if (0 != nDelta) - { - UpdatePlayGround(); - } + unsigned const nWinHeight = m_xScrolledWindow->vadjustment_get_page_size(); - m_aLinesPlayground->EnablePaint(true); - m_aLinesPlayground->Invalidate(InvalidateFlags::Children); - } - - - IMPL_LINK(OBrowserListBox, ScrollHdl, ScrollBar*, _pScrollBar, void ) - { - DBG_ASSERT(_pScrollBar == m_aVScroll.get(), "OBrowserListBox::ScrollHdl: where does this come from?"); - - // disable painting to prevent flicker - m_aLinesPlayground->EnablePaint(false); - - sal_Int32 nThumbPos = m_aVScroll->GetThumbPos(); + auto nThumbPos = m_xScrolledWindow->vadjustment_get_value(); + int const nWinTop = nThumbPos; + int const nWinBottom = nWinTop + nWinHeight; - sal_Int32 nDelta = m_aVScroll->GetDelta(); - m_nYOffset = -nThumbPos * m_nRowHeight; + auto nCtrlPosY = nPos * m_nRowHeight; - ListBoxLines::size_type nEnd = nThumbPos + CalcVisibleLines(); + int const nSelectedItemTop = nCtrlPosY; + int const nSelectedItemBottom = nCtrlPosY + m_nRowHeight; + bool const shouldScrollDown = nSelectedItemBottom >= nWinBottom; + bool const shouldScrollUp = nSelectedItemTop <= nWinTop; + bool const isNeedToScroll = shouldScrollDown || shouldScrollUp; - m_aLinesPlayground->Scroll(0, -nDelta * m_nRowHeight, ScrollFlags::Children); - - if (1 == nDelta) - { - PositionLine(nEnd-1); - PositionLine(nEnd); - } - else if (nDelta==-1) - { - PositionLine(nThumbPos); - } - else if (nDelta!=0 || m_aVScroll->GetType() == ScrollType::DontKnow) - { - UpdatePlayGround(); + if (isNeedToScroll) + { + if (shouldScrollDown) + { + int nOffset = nSelectedItemBottom - nWinBottom; + nThumbPos += nOffset; + } + else + { + int nOffset = nWinTop - nSelectedItemTop; + nThumbPos -= nOffset; + if(nThumbPos < 0) + nThumbPos = 0; + } + m_xScrolledWindow->vadjustment_set_value(nThumbPos); + } } - - m_aLinesPlayground->EnablePaint(true); } - void OBrowserListBox::buttonClicked( OBrowserLine* _pLine, bool _bPrimary ) { DBG_ASSERT( _pLine, "OBrowserListBox::buttonClicked: invalid browser line!" ); @@ -860,7 +576,6 @@ namespace pcr } } - void OBrowserListBox::impl_setControlAsPropertyValue( const ListBoxLine& _rLine, const Any& _rPropertyValue ) { Reference< XPropertyControl > xControl( _rLine.pLine->getControl() ); @@ -889,7 +604,6 @@ namespace pcr } } - Any OBrowserListBox::impl_getControlAsPropertyValue( const ListBoxLine& _rLine ) { Reference< XPropertyControl > xControl( _rLine.pLine->getControl() ); @@ -911,7 +625,6 @@ namespace pcr return aPropertyValue; } - sal_uInt16 OBrowserListBox::impl_getControlPos( const Reference< XPropertyControl >& _rxControl ) const { sal_uInt16 nPos = 0; @@ -1006,7 +719,6 @@ namespace pcr } } - void OBrowserListBox::Clear() { for (auto const& line : m_aLines) @@ -1020,7 +732,6 @@ namespace pcr clearContainer( m_aLines ); } - bool OBrowserListBox::RemoveEntry( const OUString& _rName ) { ListBoxLines::iterator it = std::find_if(m_aLines.begin(), m_aLines.end(), @@ -1029,34 +740,22 @@ namespace pcr if ( it == m_aLines.end() ) return false; - ListBoxLines::size_type nPos = static_cast<ListBoxLines::size_type>(std::distance(m_aLines.begin(), it)); m_aLines.erase( it ); - m_aOutOfDateLines.erase( m_aLines.size() ); - - // update the positions of possibly affected lines - while ( nPos < m_aLines.size() ) - m_aOutOfDateLines.insert( nPos++ ); - UpdatePosNSize( ); return true; } - - void OBrowserListBox::ChangeEntry( const OLineDescriptor& _rPropertyData, ListBoxLines::size_type nPos ) + void OBrowserListBox::ChangeEntry( const OLineDescriptor& rPropertyData, ListBoxLines::size_type nPos ) { - OSL_PRECOND( _rPropertyData.Control.is(), "OBrowserListBox::ChangeEntry: invalid control!" ); - if ( !_rPropertyData.Control.is() ) + OSL_PRECOND( rPropertyData.Control.is(), "OBrowserListBox::ChangeEntry: invalid control!" ); + if ( !rPropertyData.Control.is() ) return; if ( nPos == EDITOR_LIST_REPLACE_EXISTING ) - nPos = GetPropertyPos( _rPropertyData.sName ); + nPos = GetPropertyPos( rPropertyData.sName ); if ( nPos < m_aLines.size() ) { - vcl::Window* pRefWindow = nullptr; - if ( nPos > 0 ) - pRefWindow = m_aLines[nPos-1].pLine->GetRefWindow(); - // the current line and control ListBoxLine& rLine = m_aLines[nPos]; @@ -1067,40 +766,36 @@ namespace pcr lcl_implDisposeControl_nothrow( xControl ); // set the new control at the line - rLine.pLine->setControl( _rPropertyData.Control ); + rLine.pLine->setControl( rPropertyData.Control ); xControl = rLine.pLine->getControl(); if ( xControl.is() ) xControl->setControlContext( m_pControlContextImpl.get() ); // the initial property value - if ( _rPropertyData.bUnknownValue ) + if ( rPropertyData.bUnknownValue ) xControl->setValue( Any() ); else - impl_setControlAsPropertyValue( rLine, _rPropertyData.aValue ); - - rLine.pLine->SetTitle(_rPropertyData.DisplayName); - rLine.xHandler = _rPropertyData.xPropertyHandler; + impl_setControlAsPropertyValue( rLine, rPropertyData.aValue ); - sal_uInt16 nTextWidth = static_cast<sal_uInt16>(m_aLinesPlayground->GetTextWidth(_rPropertyData.DisplayName)); - if (m_nTheNameSize< nTextWidth) - m_nTheNameSize = nTextWidth; + rLine.pLine->SetTitle(rPropertyData.DisplayName); + rLine.xHandler = rPropertyData.xPropertyHandler; - if ( _rPropertyData.HasPrimaryButton ) + if ( rPropertyData.HasPrimaryButton ) { - if ( !_rPropertyData.PrimaryButtonImageURL.isEmpty() ) - rLine.pLine->ShowBrowseButton( _rPropertyData.PrimaryButtonImageURL, true ); - else if ( _rPropertyData.PrimaryButtonImage.is() ) - rLine.pLine->ShowBrowseButton( Image( _rPropertyData.PrimaryButtonImage ), true ); + if ( !rPropertyData.PrimaryButtonImageURL.isEmpty() ) + rLine.pLine->ShowBrowseButton( rPropertyData.PrimaryButtonImageURL, true ); + else if ( rPropertyData.PrimaryButtonImage.is() ) + rLine.pLine->ShowBrowseButton( rPropertyData.PrimaryButtonImage, true ); else rLine.pLine->ShowBrowseButton( true ); - if ( _rPropertyData.HasSecondaryButton ) + if ( rPropertyData.HasSecondaryButton ) { - if ( !_rPropertyData.SecondaryButtonImageURL.isEmpty() ) - rLine.pLine->ShowBrowseButton( _rPropertyData.SecondaryButtonImageURL, false ); - else if ( _rPropertyData.SecondaryButtonImage.is() ) - rLine.pLine->ShowBrowseButton( Image( _rPropertyData.SecondaryButtonImage ), false ); + if ( !rPropertyData.SecondaryButtonImageURL.isEmpty() ) + rLine.pLine->ShowBrowseButton( rPropertyData.SecondaryButtonImageURL, false ); + else if ( rPropertyData.SecondaryButtonImage.is() ) + rLine.pLine->ShowBrowseButton( rPropertyData.SecondaryButtonImage, false ); else rLine.pLine->ShowBrowseButton( false ); } @@ -1115,21 +810,15 @@ namespace pcr rLine.pLine->HideBrowseButton( false ); } - DBG_ASSERT( ( _rPropertyData.IndentLevel == 0 ) || ( _rPropertyData.IndentLevel == 1 ), + DBG_ASSERT( ( rPropertyData.IndentLevel == 0 ) || ( rPropertyData.IndentLevel == 1 ), "OBrowserListBox::ChangeEntry: unsupported indent level!" ); - rLine.pLine->IndentTitle( _rPropertyData.IndentLevel > 0 ); - - if ( nPos > 0 ) - rLine.pLine->SetTabOrder( pRefWindow, ZOrderFlags::Behind ); - else - rLine.pLine->SetTabOrder( pRefWindow, ZOrderFlags::First ); + rLine.pLine->IndentTitle( rPropertyData.IndentLevel > 0 ); - m_aOutOfDateLines.insert( nPos ); rLine.pLine->SetComponentHelpIds( - HelpIdUrl::getHelpId( _rPropertyData.HelpURL ) + HelpIdUrl::getHelpId( rPropertyData.HelpURL ) ); - if ( _rPropertyData.bReadOnly ) + if ( rPropertyData.bReadOnly ) { rLine.pLine->SetReadOnly( true ); @@ -1140,98 +829,23 @@ namespace pcr // So, we manually switch this to read-only. if ( xControl.is() && ( xControl->getControlType() == PropertyControlType::Unknown ) ) { - vcl::Window *pWindow = rLine.pLine->getControlWindow(); - Edit* pControlWindowAsEdit = dynamic_cast<Edit*>(pWindow); + weld::Widget* pWindow = rLine.pLine->getControlWindow(); + weld::Entry* pControlWindowAsEdit = dynamic_cast<weld::Entry*>(pWindow); if (pControlWindowAsEdit) - pControlWindowAsEdit->SetReadOnly(); + pControlWindowAsEdit->set_editable(false); else - pWindow->Enable(false); + pWindow->set_sensitive(false); } } - } - } - - bool OBrowserListBox::PreNotify( NotifyEvent& _rNEvt ) - { - switch ( _rNEvt.GetType() ) - { - case MouseNotifyEvent::KEYINPUT: - { - const KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent(); - if ( ( pKeyEvent->GetKeyCode().GetModifier() != 0 ) - || ( ( pKeyEvent->GetKeyCode().GetCode() != KEY_PAGEUP ) - && ( pKeyEvent->GetKeyCode().GetCode() != KEY_PAGEDOWN ) - ) - ) - break; - - long nScrollOffset = 0; - if ( m_aVScroll->IsVisible() ) - { - if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEUP ) - nScrollOffset = -m_aVScroll->GetPageSize(); - else if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEDOWN ) - nScrollOffset = m_aVScroll->GetPageSize(); - } - - if ( nScrollOffset ) - { - long nNewThumbPos = m_aVScroll->GetThumbPos() + nScrollOffset; - nNewThumbPos = std::max( nNewThumbPos, m_aVScroll->GetRangeMin() ); - nNewThumbPos = std::min( nNewThumbPos, m_aVScroll->GetRangeMax() ); - m_aVScroll->DoScroll( nNewThumbPos ); - nNewThumbPos = m_aVScroll->GetThumbPos(); - - sal_uInt16 nFocusControlPos = 0; - sal_uInt16 nActiveControlPos = impl_getControlPos( m_xActiveControl ); - if ( nActiveControlPos < nNewThumbPos ) - nFocusControlPos = static_cast<sal_uInt16>(nNewThumbPos); - else if ( nActiveControlPos >= nNewThumbPos + CalcVisibleLines() ) - nFocusControlPos = static_cast<sal_uInt16>(nNewThumbPos) + CalcVisibleLines() - 1; - if ( nFocusControlPos ) - { - if ( nFocusControlPos < m_aLines.size() ) - { - m_aLines[ nFocusControlPos ].pLine->GrabFocus(); - } - else - OSL_FAIL( "OBrowserListBox::PreNotify: internal error, invalid focus control position!" ); - } - } - - return true; - // handled this. In particular, we also consume PageUp/Down events if we do not use them for scrolling, - // otherwise they would be used to scroll the document view, which does not sound like it is desired by - // the user. - } - default: - break; - } - return Control::PreNotify( _rNEvt ); - } - - bool OBrowserListBox::EventNotify( NotifyEvent& _rNEvt ) - { - if ( _rNEvt.GetType() == MouseNotifyEvent::COMMAND) - { - const CommandEvent* pCommand = _rNEvt.GetCommandEvent(); - if ( ( CommandEventId::Wheel == pCommand->GetCommand() ) - || ( CommandEventId::StartAutoScroll == pCommand->GetCommand() ) - || ( CommandEventId::AutoScroll == pCommand->GetCommand() ) - ) + sal_uInt16 nTextWidth = m_xLinesPlayground->get_pixel_size(rPropertyData.DisplayName).Width(); + if (m_nTheNameSize< nTextWidth) { - // interested in scroll events if we have a scrollbar - if ( m_aVScroll->IsVisible() ) - { - HandleScrollCommand( *pCommand, nullptr, m_aVScroll.get() ); - } + m_nTheNameSize = nTextWidth; + UpdatePlayGround(); } } - return Control::EventNotify(_rNEvt); } - - } // namespace pcr diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx index c99bf87dd2e8..8ebbee9c573f 100644 --- a/extensions/source/propctrlr/browserlistbox.hxx +++ b/extensions/source/propctrlr/browserlistbox.hxx @@ -28,6 +28,7 @@ #include <com/sun/star/inspection/XPropertyHandler.hpp> #include <vcl/scrbar.hxx> #include <vcl/button.hxx> +#include <vcl/weld.hxx> #include <tools/link.hxx> #include <rtl/ref.hxx> @@ -71,48 +72,30 @@ namespace pcr typedef std::vector< ListBoxLine > ListBoxLines; - class OBrowserListBox final : public Control - ,public IButtonClickListener + class OBrowserListBox final : public IButtonClickListener { - VclPtr<Window> m_aLinesPlayground; - VclPtr<ScrollBar> m_aVScroll; - VclPtr<InspectorHelpWindow> m_pHelpWindow; + std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow; + std::unique_ptr<weld::Container> m_xLinesPlayground; + std::unique_ptr<weld::SizeGroup> m_xSizeGroup; + std::unique_ptr<InspectorHelpWindow> m_xHelpWindow; + weld::Container* m_pInitialControlParent; ListBoxLines m_aLines; IPropertyLineListener* m_pLineListener; IPropertyControlObserver* m_pControlObserver; - long m_nYOffset; - long m_nCurrentPreferredHelpHeight; css::uno::Reference< css::inspection::XPropertyControl > m_xActiveControl; sal_uInt16 m_nTheNameSize; - long m_nRowHeight; - std::set<ListBoxLines::size_type> m_aOutOfDateLines; - bool m_bIsActive : 1; - bool m_bUpdate : 1; + int m_nRowHeight; + bool m_bInterimBuilder; ::rtl::Reference< PropertyControlContext_Impl > m_pControlContextImpl; - void PositionLine( ListBoxLines::size_type _nIndex ); - void UpdatePosNSize(); void UpdatePlayGround(); - void UpdateVScroll(); void ShowEntry(sal_uInt16 nPos); - void MoveThumbTo(sal_Int32 nNewThumbPos); - void Resize() override; public: - explicit OBrowserListBox( vcl::Window* pParent ); - - virtual ~OBrowserListBox() override; - virtual void dispose() override; - - void ActivateListBox( bool _bActive ); - - sal_uInt16 CalcVisibleLines(); - void EnableUpdate(); - void DisableUpdate(); - bool EventNotify( NotifyEvent& _rNEvt ) override; - virtual bool PreNotify( NotifyEvent& _rNEvt ) override; ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
