diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /include/vcl/toolkit | |
parent | Initial commit. (diff) | |
download | libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | include/vcl/toolkit/README | 2 | ||||
-rw-r--r-- | include/vcl/toolkit/button.hxx | 51 | ||||
-rw-r--r-- | include/vcl/toolkit/combobox.hxx | 194 | ||||
-rw-r--r-- | include/vcl/toolkit/controllayout.hxx | 81 | ||||
-rw-r--r-- | include/vcl/toolkit/dialog.hxx | 161 | ||||
-rw-r--r-- | include/vcl/toolkit/field.hxx | 255 | ||||
-rw-r--r-- | include/vcl/toolkit/fixedhyper.hxx | 121 | ||||
-rw-r--r-- | include/vcl/toolkit/group.hxx | 60 | ||||
-rw-r--r-- | include/vcl/toolkit/imgctrl.hxx | 55 | ||||
-rw-r--r-- | include/vcl/toolkit/morebtn.hxx | 59 | ||||
-rw-r--r-- | include/vcl/toolkit/prgsbar.hxx | 83 | ||||
-rw-r--r-- | include/vcl/toolkit/roadmap.hxx | 118 | ||||
-rw-r--r-- | include/vcl/toolkit/spin.hxx | 101 | ||||
-rw-r--r-- | include/vcl/toolkit/svtabbx.hxx | 216 | ||||
-rw-r--r-- | include/vcl/toolkit/tabdlg.hxx | 52 | ||||
-rw-r--r-- | include/vcl/toolkit/throbber.hxx | 88 | ||||
-rw-r--r-- | include/vcl/toolkit/unowrap.hxx | 100 |
17 files changed, 1797 insertions, 0 deletions
diff --git a/include/vcl/toolkit/README b/include/vcl/toolkit/README new file mode 100644 index 000000000..889f0b20a --- /dev/null +++ b/include/vcl/toolkit/README @@ -0,0 +1,2 @@ +These are includes which are now only used by the toolkit module, which exposes +them via uno. Don't use these in any new code. diff --git a/include/vcl/toolkit/button.hxx b/include/vcl/toolkit/button.hxx new file mode 100644 index 000000000..6f8910e43 --- /dev/null +++ b/include/vcl/toolkit/button.hxx @@ -0,0 +1,51 @@ +/* -*- 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 . + */ +#pragma once + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <vcl/button.hxx> + +class CloseButton final : public CancelButton +{ +public: + explicit CloseButton(vcl::Window* pParent, WinBits nStyle = 0); +}; + +class VCL_DLLPUBLIC HelpButton : public PushButton +{ +protected: + using PushButton::ImplInit; +private: + SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); + + HelpButton( const HelpButton & ) = delete; + HelpButton & operator= ( const HelpButton & ) = delete; + + virtual void StateChanged( StateChangedType nStateChange ) override; + +public: + explicit HelpButton( vcl::Window* pParent, WinBits nStyle = 0 ); + + virtual void Click() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/combobox.hxx b/include/vcl/toolkit/combobox.hxx new file mode 100644 index 000000000..611bce590 --- /dev/null +++ b/include/vcl/toolkit/combobox.hxx @@ -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 . + */ + +#ifndef INCLUDED_VCL_COMBOBOX_HXX +#define INCLUDED_VCL_COMBOBOX_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <memory> +#include <vcl/dllapi.h> +#include <vcl/edit.hxx> + +#define COMBOBOX_APPEND (SAL_MAX_INT32) +#define COMBOBOX_ENTRY_NOTFOUND (SAL_MAX_INT32) +#define COMBOBOX_MAX_ENTRIES (SAL_MAX_INT32 - 1) + +class UserDrawEvent; + +/// A widget used to choose from a list of items and which has an entry. +class VCL_DLLPUBLIC ComboBox : public Edit +{ +private: + struct SAL_DLLPRIVATE Impl; + std::unique_ptr<Impl> m_pImpl; + +protected: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle ); + SAL_DLLPRIVATE void ImplCalcEditHeight(); + SAL_DLLPRIVATE long getMaxWidthScrollBarAndDownButton() const; + +protected: + bool IsDropDownBox() const; + + virtual void FillLayoutData() const override; + +public: + explicit ComboBox( vcl::Window* pParent, WinBits nStyle = 0 ); + virtual ~ComboBox() override; + virtual void dispose() override; + + virtual void Draw( OutputDevice* pDev, const Point& rPos, DrawFlags nFlags ) override; + virtual void Resize() override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void StateChanged( StateChangedType nType ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + void Select(); + void DoubleClick(); + + virtual void Modify() override; + + virtual const Wallpaper& GetDisplayBackground() const override; + + virtual void setPosSizePixel( long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags = PosSizeFlags::All ) override; + + tools::Rectangle GetDropDownPosSizePixel() const; + + void AdaptDropDownLineCountToMaximum(); + void SetDropDownLineCount( sal_uInt16 nLines ); + sal_uInt16 GetDropDownLineCount() const; + + void EnableAutoSize( bool bAuto ); + bool IsAutoSizeEnabled() const; + + virtual void SetText( const OUString& rStr ) override; + virtual void SetText( const OUString& rStr, const Selection& rNewSelection ) override; + + sal_Int32 InsertEntry(const OUString& rStr, sal_Int32 nPos = COMBOBOX_APPEND); + sal_Int32 InsertEntryWithImage( const OUString& rStr, const Image& rImage, sal_Int32 nPos = COMBOBOX_APPEND ); + + void RemoveEntryAt(sal_Int32 nPos); + + void Clear(); + sal_Int32 GetEntryPos( const OUString& rStr ) const; + Image GetEntryImage( sal_Int32 nPos ) const; + OUString GetEntry( sal_Int32 nPos ) const; + sal_Int32 GetEntryCount() const; + + bool IsTravelSelect() const; + bool IsInDropDown() const; + void ToggleDropDown(); + + void SetUserItemSize( const Size& rSz ); + void EnableUserDraw( bool bUserDraw ); + bool IsUserDrawEnabled() const; + + void DrawEntry( const UserDrawEvent& rEvt ); + void SetBorderStyle( WindowBorderStyle nBorderStyle ); + + /** + * Adds a new separator at the given position n. + */ + void AddSeparator( sal_Int32 n ); + + void EnableAutocomplete( bool bEnable, bool bMatchCase = false ); + bool IsAutocompleteEnabled() const; + + bool IsMultiSelectionEnabled() const; + + void SetSelectHdl(const Link<ComboBox&,void>& rLink); + void SetEntryActivateHdl(const Link<Edit&,bool>& rLink); + void SetUserDrawHdl(const Link<UserDrawEvent*, void>& rLink); + + Size CalcMinimumSize() const override; + virtual Size GetOptimalSize() const override; + Size CalcAdjustedSize( const Size& rPrefSize ) const; + Size CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const; + void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const; + + void SetMRUEntries( const OUString& rEntries ); + OUString GetMRUEntries() const; + void SetMaxMRUCount( sal_Int32 n ); + sal_Int32 GetMaxMRUCount() const; + void SetEntryData( sal_Int32 nPos, void* pNewData ); + void* GetEntryData( sal_Int32 nPos ) const; + + sal_Int32 GetTopEntry() const; + + sal_uInt16 GetDisplayLineCount() const; + + sal_Int32 GetSelectedEntryCount() const; + sal_Int32 GetSelectedEntryPos( sal_Int32 nSelIndex = 0 ) const; + bool IsEntryPosSelected( sal_Int32 nPos ) const; + void SelectEntryPos( sal_Int32 nPos, bool bSelect = true ); + void SetNoSelection(); + tools::Rectangle GetBoundingRectangle( sal_Int32 nItem ) const; + + // determine if Select was called due to typing or cursoring in the + // combobox, as opposed to something selected from the menu or via some + // other route. e.g. the toolbar fontsize combobox wants to immediately + // change size only if something is picked from the combobox menu, other + // changes don't auto-apply until the user presses return + bool IsModifyByKeyboard() const; + + // determine if Edit::Modify was called due to the ComboBox changing the edit area + // itself + bool IsSyntheticModify() const; + + + /** checks whether a certain point lies within the bounds of + a list item and returns the item as well as the character position + the point is at. + + <p>If the point is inside an item the item pos is put into <code>rPos</code> and + the item-relative character index is returned. If the point is not inside + an item -1 is returned and rPos is unchanged.</p> + + @param rPoint + tells the point for which an item is requested. + + @param rPos + gets the item at the specified point <code>rPoint</code> + + @returns + the item-relative character index at point <code>rPos</code> or -1 + if no item is at that point. + */ + using Control::GetIndexForPoint; + long GetIndexForPoint( const Point& rPoint, sal_Int32 & rPos ) const; + + void setMaxWidthChars(sal_Int32 nWidth); + + void SetWidthInChars(sal_Int32 nWidthInChars); + + long GetDropDownEntryHeight() const; + + virtual bool set_property(const OString &rKey, const OUString &rValue) override; + + virtual FactoryFunction GetUITestFactory() const override; +}; + +#endif // _COMBOBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/controllayout.hxx b/include/vcl/toolkit/controllayout.hxx new file mode 100644 index 000000000..ffd643f64 --- /dev/null +++ b/include/vcl/toolkit/controllayout.hxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_CONTROLLAYOUT_HXX +#define INCLUDED_VCL_CONTROLLAYOUT_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <vector> +#include <vcl/ctrl.hxx> +#include <vcl/dllapi.h> + +namespace vcl +{ + +struct VCL_DLLPUBLIC ControlLayoutData +{ + // contains the string really displayed + // there must be exactly one bounding rectangle in m_aUnicodeBoundRects + // for every character in m_aDisplayText + OUString m_aDisplayText; + // the bounding rectangle of every character + // where one character may consist of many glyphs + std::vector< tools::Rectangle > m_aUnicodeBoundRects; + // start indices of lines + std::vector< long > m_aLineIndices; + // notify parent control on destruction + VclPtr<const Control> m_pParent; + + ControlLayoutData(); + ~ControlLayoutData(); + + tools::Rectangle GetCharacterBounds( long nIndex ) const; + // returns the character index for corresponding to rPoint (in control coordinates) + // -1 is returned if no character is at that point + long GetIndexForPoint( const Point& rPoint ) const; + // returns the number of lines in the result of GetDisplayText() + long GetLineCount() const; + // returns the interval [start,end] of line nLine + // returns [-1,-1] for an invalid line + ::Pair GetLineStartEnd( long nLine ) const; + /** ToRelativeLineIndex changes a layout data index to a count relative to its line. + + This is equivalent to getting the line start/end pairs with + GetLineStartEnd until the index lies within [start,end] of a line + + @param nIndex + the absolute index inside the display text to be changed to a relative index + + @returns + the relative index inside the displayed line or -1 if the absolute index does + not match any line + */ + long ToRelativeLineIndex( long nIndex ) const; +}; + +} // namespace vcl + +#endif // INCLUDED_VCL_CONTROLLAYOUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/dialog.hxx b/include/vcl/toolkit/dialog.hxx new file mode 100644 index 000000000..c663f21a2 --- /dev/null +++ b/include/vcl/toolkit/dialog.hxx @@ -0,0 +1,161 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_DIALOG_HXX +#define INCLUDED_VCL_DIALOG_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <memory> +#include <vcl/dllapi.h> +#include <vcl/syswin.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/abstdlg.hxx> + +struct DialogImpl; +class PushButton; +class VclBox; +class VclButtonBox; + +class VCL_DLLPUBLIC Dialog : public SystemWindow +{ +public: + enum class InitFlag + { + /** Use given parent or get a default one using GetDefaultParent(...) */ + Default, + + /** No Parent */ + NoParent + }; + +private: + std::unique_ptr<DialogImpl> mpDialogImpl; + long mnMousePositioned; + bool mbInExecute; + bool mbInSyncExecute; + bool mbInClose; + bool mbModalMode; + InitFlag mnInitFlag; // used for deferred init + + VclPtr<VclButtonBox> mpActionArea; + VclPtr<VclBox> mpContentArea; + + SAL_DLLPRIVATE void RemoveFromDlgList(); + SAL_DLLPRIVATE void ImplInitDialogData(); + SAL_DLLPRIVATE void ImplInitSettings(); + SAL_DLLPRIVATE VclPtr<vcl::Window> AddBorderWindow(vcl::Window* pParent, WinBits nBits); + + virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + + SAL_DLLPRIVATE Dialog (const Dialog &) = delete; + SAL_DLLPRIVATE Dialog & operator= (const Dialog &) = delete; + + DECL_DLLPRIVATE_LINK(ImplAsyncCloseHdl, void*, void); + DECL_DLLPRIVATE_LINK(ResponseHdl, Button*, void); + +protected: + void ImplInitDialog( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag = InitFlag::Default ); + + /// Find and set the LOK notifier according to the pParent. + void ImplLOKNotifier(vcl::Window* pParent); + +public: + SAL_DLLPRIVATE bool IsInClose() const { return mbInClose; } + virtual void doDeferredInit(WinBits nBits) override; + SAL_DLLPRIVATE void disposeOwnedButtons(); + +protected: + explicit Dialog( WindowType nType ); + explicit Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription); + virtual void Draw( OutputDevice* pDev, const Point& rPos, DrawFlags nFlags ) override; + virtual void settingOptimalLayoutSize(Window *pBox) override; + +protected: + friend class VclBuilder; + friend class SalInstanceBuilder; + void set_action_area(VclButtonBox* pBox); + virtual void set_content_area(VclBox* pBox); + +public: + explicit Dialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG, InitFlag eFlag = InitFlag::Default ); + virtual ~Dialog() override; + virtual void dispose() override; + + // get the default parent for a dialog as is done in standard initialization + static vcl::Window* GetDefaultParent(WinBits nStyle); + + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void StateChanged( StateChangedType nStateChange ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + virtual void Command( const CommandEvent& rCEvt ) override; + + virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override; + virtual bool set_property(const OString &rKey, const OUString &rValue) override; + VclButtonBox* get_action_area() { return mpActionArea; } + VclBox* get_content_area() { return mpContentArea; } + + virtual bool Close() override; + + short Execute(); + bool IsInExecute() const { return mbInExecute; } + // Return true when dialog is synchronously executed (calling ::Execute()) + bool IsInSyncExecute() const { return mbInSyncExecute; }; + + virtual FactoryFunction GetUITestFactory() const override; + +private: + bool ImplStartExecute(); + static void ImplEndExecuteModal(); + void ImplSetModalInputMode(bool bModal); +public: + + /// Commence execution of a modal dialog, disposes owner on failure + bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx); + + // Dialog::Execute replacement API + + + void EndDialog( long nResult = RET_CANCEL ); + + void GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const; + + void SetModalInputMode( bool bModal ); + bool IsModalInputMode() const { return mbModalMode; } + + void GrabFocusToFirstControl(); + virtual void Resize() override; + + void Activate() override; + + void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink); + void SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink); + + void add_button(PushButton* pButton, int nResponse, bool bTransferOwnership); + void set_default_response(int nResponse); + int get_default_response() const; + vcl::Window* get_widget_for_response(int nResponse); +}; + +#endif // INCLUDED_VCL_DIALOG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/field.hxx b/include/vcl/toolkit/field.hxx new file mode 100644 index 000000000..e78b174e7 --- /dev/null +++ b/include/vcl/toolkit/field.hxx @@ -0,0 +1,255 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_TOOLKIT_FIELD_HXX +#define INCLUDED_VCL_TOOLKIT_FIELD_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <config_options.h> +#include <vcl/toolkit/combobox.hxx> +#include <vcl/field.hxx> +#include <vcl/longcurr.hxx> + +class VCL_DLLPUBLIC MetricFormatter : public NumericFormatter +{ +public: + virtual ~MetricFormatter() override; + + virtual void Reformat() override; + + virtual void SetUnit( FieldUnit meUnit ); + FieldUnit GetUnit() const { return meUnit; } + void SetCustomUnitText( const OUString& rStr ); + const OUString& GetCustomUnitText() const { return maCustomUnitText; } + + using NumericFormatter::SetMax; + void SetMax( sal_Int64 nNewMax, FieldUnit eInUnit ); + using NumericFormatter::GetMax; + sal_Int64 GetMax( FieldUnit eOutUnit ) const; + using NumericFormatter::SetMin; + void SetMin( sal_Int64 nNewMin, FieldUnit eInUnit ); + using NumericFormatter::GetMin; + sal_Int64 GetMin( FieldUnit eOutUnit ) const; + + void SetValue( sal_Int64 nNewValue, FieldUnit eInUnit ); + virtual void SetValue( sal_Int64 nValue ) override; + using NumericFormatter::SetUserValue; + void SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit ); + using NumericFormatter::GetValue; + sal_Int64 GetValue( FieldUnit eOutUnit ) const; + virtual OUString CreateFieldText( sal_Int64 nValue ) const override; + sal_Int64 GetCorrectedValue( FieldUnit eOutUnit ) const; + +protected: + FieldUnit meUnit; + + MetricFormatter(Edit* pEdit); + + SAL_DLLPRIVATE void ImplMetricReformat( const OUString& rStr, double& rValue, OUString& rOutStr ); + + virtual sal_Int64 GetValueFromString(const OUString& rStr) const override; + sal_Int64 GetValueFromStringUnit(const OUString& rStr, FieldUnit eOutUnit) const; + +private: + OUString maCustomUnitText; +}; + +class VCL_DLLPUBLIC MetricField : public SpinField, public MetricFormatter +{ +public: + explicit MetricField( vcl::Window* pParent, WinBits nWinStyle ); + + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + virtual Size CalcMinimumSize() const override; + + virtual void Modify() override; + + virtual void Up() override; + virtual void Down() override; + virtual void First() override; + virtual void Last() override; + + virtual void SetUnit( FieldUnit meUnit ) override; + + void SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit ); + sal_Int64 GetFirst( FieldUnit eOutUnit ) const; + void SetLast( sal_Int64 nNewLast, FieldUnit eInUnit ); + sal_Int64 GetLast( FieldUnit eOutUnit ) const; + + virtual bool set_property(const OString &rKey, const OUString &rValue) override; + virtual void dispose() override; + + virtual boost::property_tree::ptree DumpAsPropertyTree() override; + virtual FactoryFunction GetUITestFactory() const override; +}; + +class VCL_DLLPUBLIC MetricBox : public ComboBox, public MetricFormatter +{ +public: + explicit MetricBox( vcl::Window* pParent, WinBits nWinStyle ); + + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + virtual Size CalcMinimumSize() const override; + + virtual void Modify() override; + + virtual void ReformatAll() override; + + // Needed, because GetValue() with nPos hide these functions + using MetricFormatter::GetValue; + + virtual void dispose() override; +}; + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) CurrencyFormatter : public NumericFormatter +{ +protected: + CurrencyFormatter(Edit* pEdit); + SAL_DLLPRIVATE void ImplCurrencyReformat( const OUString& rStr, OUString& rOutStr ); + virtual sal_Int64 GetValueFromString(const OUString& rStr) const override; + +public: + virtual ~CurrencyFormatter() override; + + virtual void Reformat() override; + + virtual void SetValue( sal_Int64 nNewValue ) override; + virtual OUString CreateFieldText( sal_Int64 nValue ) const override; +}; + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) CurrencyField final : public SpinField, public CurrencyFormatter +{ +public: + CurrencyField( vcl::Window* pParent, WinBits nWinStyle ); + + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + virtual void Modify() override; + + virtual void Up() override; + virtual void Down() override; + virtual void First() override; + virtual void Last() override; + virtual void dispose() override; +}; + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) NumericBox : public ComboBox, public NumericFormatter +{ + SAL_DLLPRIVATE void ImplNumericReformat( const OUString& rStr, sal_Int64& rValue, OUString& rOutStr ); +public: + explicit NumericBox( vcl::Window* pParent, WinBits nWinStyle ); + + virtual Size CalcMinimumSize() const override; + + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + virtual void Modify() override; + + virtual void ReformatAll() override; + + virtual void dispose() override; +}; + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) PatternBox final : public ComboBox, public PatternFormatter +{ +public: + PatternBox( vcl::Window* pParent, WinBits nWinStyle ); + + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + + virtual void Modify() override; + + virtual void ReformatAll() override; + virtual void dispose() override; +}; + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) CurrencyBox final : public ComboBox, public CurrencyFormatter +{ +public: + explicit CurrencyBox( vcl::Window* pParent, WinBits nWinStyle ); + + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + virtual void Modify() override; + + virtual void ReformatAll() override; + + virtual void dispose() override; +}; + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DateBox final : public ComboBox, public DateFormatter +{ +public: + explicit DateBox( vcl::Window* pParent, WinBits nWinStyle ); + + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + virtual void Modify() override; + + virtual void ReformatAll() override; + virtual void dispose() override; +}; + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) TimeBox final : public ComboBox, public TimeFormatter +{ +public: + explicit TimeBox( vcl::Window* pParent, WinBits nWinStyle ); + + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + virtual void Modify() override; + + virtual void ReformatAll() override; + virtual void dispose() override; +}; + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) LongCurrencyBox final : public ComboBox, public LongCurrencyFormatter +{ +public: + LongCurrencyBox( vcl::Window* pParent, WinBits nWinStyle ); + + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + + void Modify() override; + void ReformatAll() override; +}; + +#endif // INCLUDED_VCL_FIELD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/fixedhyper.hxx b/include/vcl/toolkit/fixedhyper.hxx new file mode 100644 index 000000000..cb4e6bae2 --- /dev/null +++ b/include/vcl/toolkit/fixedhyper.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_FIXEDHYPER_HXX +#define INCLUDED_VCL_FIXEDHYPER_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <config_options.h> +#include <vcl/dllapi.h> +#include <vcl/fixed.hxx> + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) FixedHyperlink final : public FixedText +{ +private: + long m_nTextLen; + PointerStyle m_aOldPointer; + Link<FixedHyperlink&,void> m_aClickHdl; + OUString m_sURL; + + /** initializes the font (link color and underline). + + Called by the Ctors. + */ + void Initialize(); + + /** is position X position hitting text */ + SAL_DLLPRIVATE bool ImplIsOverText(Point rPosition); + + DECL_LINK(HandleClick, FixedHyperlink&, void); + + /** overwrites Window::MouseMove(). + + Changes the pointer only over the text. + */ + virtual void MouseMove( const MouseEvent& rMEvt ) override; + + /** overwrites Window::MouseButtonUp(). + + Calls the set link if the mouse is over the text. + */ + virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; + + /** overwrites Window::RequestHelp(). + + Shows tooltip only if the mouse is over the text. + */ + virtual void RequestHelp( const HelpEvent& rHEvt ) override; + +public: + /** ctors + + With WinBits. + */ + FixedHyperlink( vcl::Window* pParent, WinBits nWinStyle = 0 ); + + /** overwrites Window::GetFocus(). + + Changes the color of the text and shows a focus rectangle. + */ + virtual void GetFocus() override; + + /** overwrites Window::LoseFocus(). + + Changes the color of the text and hides the focus rectangle. + */ + virtual void LoseFocus() override; + + /** overwrites Window::KeyInput(). + + KEY_RETURN and KEY_SPACE calls the link handler. + */ + virtual void KeyInput( const KeyEvent& rKEvt ) override; + + virtual bool set_property(const OString &rKey, const OUString &rValue) override; + + + /** sets m_aClickHdl with rLink. + + m_aClickHdl is called if the text is clicked. + */ + void SetClickHdl( const Link<FixedHyperlink&,void>& rLink ) { m_aClickHdl = rLink; } + const Link<FixedHyperlink&,void>& GetClickHdl() const { return m_aClickHdl; } + + // ::FixedHyperbaseLink + + /** sets the URL of the hyperlink and uses it as tooltip. */ + void SetURL(const OUString& rNewURL); + + /** returns the URL of the hyperlink. + + @return + m_sURL + */ + const OUString& GetURL() const { return m_sURL;} + + /** sets new text and recalculates the text length. */ + virtual void SetText(const OUString& rNewDescription) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/group.hxx b/include/vcl/toolkit/group.hxx new file mode 100644 index 000000000..2bbd344df --- /dev/null +++ b/include/vcl/toolkit/group.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_GROUP_HXX +#define INCLUDED_VCL_GROUP_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <config_options.h> +#include <vcl/dllapi.h> +#include <vcl/ctrl.hxx> + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) GroupBox : public Control +{ +private: + using Control::ImplInitSettings; + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE static WinBits ImplInitStyle( WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings( bool bBackground ); + SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, + const Point& rPos, const Size& rSize, bool bLayout = false ); + + virtual void FillLayoutData() const override; + virtual const vcl::Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const override; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const override; + +public: + explicit GroupBox( vcl::Window* pParent, WinBits nStyle ); + + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual void Draw( OutputDevice* pDev, const Point& rPos, DrawFlags nFlags ) override; + virtual void Resize() override; + virtual void StateChanged( StateChangedType nType ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; +}; + +#endif // INCLUDED_VCL_GROUP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/imgctrl.hxx b/include/vcl/toolkit/imgctrl.hxx new file mode 100644 index 000000000..00ac76fae --- /dev/null +++ b/include/vcl/toolkit/imgctrl.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_IMGCTRL_HXX +#define INCLUDED_VCL_IMGCTRL_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <config_options.h> +#include <vcl/dllapi.h> +#include <vcl/fixed.hxx> + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) ImageControl : public FixedImage +{ +private: + ::sal_Int16 mnScaleMode; + +public: + ImageControl( vcl::Window* pParent, WinBits nStyle ); + + // set/get the scale mode. This is one of the css.awt.ImageScaleMode constants + void SetScaleMode( const ::sal_Int16 _nMode ); + ::sal_Int16 GetScaleMode() const { return mnScaleMode; } + + virtual void Resize() override; + virtual void Draw( OutputDevice* pDev, const Point& rPos, DrawFlags nFlags ) override; + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual void GetFocus() override; + virtual void LoseFocus() override; + +protected: + void ImplDraw( OutputDevice& rDev, const Point& rPos, const Size& rSize ) const; +}; + +#endif // INCLUDED_VCL_IMGCTRL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/morebtn.hxx b/include/vcl/toolkit/morebtn.hxx new file mode 100644 index 000000000..b0648f443 --- /dev/null +++ b/include/vcl/toolkit/morebtn.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_MOREBTN_HXX +#define INCLUDED_VCL_MOREBTN_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <config_options.h> +#include <vcl/dllapi.h> +#include <vcl/button.hxx> +#include <memory> + +struct ImplMoreButtonData; + + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MoreButton final : public PushButton +{ + std::unique_ptr<ImplMoreButtonData> mpMBData; + bool mbState; + + MoreButton( const MoreButton & ) = delete; + MoreButton& operator=( const MoreButton & ) = delete; + SAL_DLLPRIVATE void ShowState(); + + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); + +public: + explicit MoreButton( vcl::Window* pParent, WinBits nStyle ); + virtual ~MoreButton() override; + virtual void dispose() override; + + void Click() override; + + using PushButton::SetState; +}; + +#endif // INCLUDED_VCL_MOREBTN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/prgsbar.hxx b/include/vcl/toolkit/prgsbar.hxx new file mode 100644 index 000000000..7f248b19a --- /dev/null +++ b/include/vcl/toolkit/prgsbar.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_PRGSBAR_HXX +#define INCLUDED_VCL_PRGSBAR_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <config_options.h> +#include <vcl/dllapi.h> +#include <vcl/window.hxx> + +/************************************************************************* + * + * class ProgressBar + * + * this class is used to display the ProgressBar + * + * ----------------------------------------------------------------------- + * + * WinBits + * + * WB_BORDER border around the window + * WB_3DLOOK 3D representation + * + * ----------------------------------------------------------------------- + * + * Methods + * + * Use SetValue() to set a percentage between 0 and 100. A value larger + * than 100 will cause the last rectangle to start flashing + * + ************************************************************************/ + + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) ProgressBar final : public vcl::Window +{ +private: + Point maPos; + long mnPrgsWidth; + long mnPrgsHeight; + sal_uInt16 mnPercent; + sal_uInt16 mnPercentCount; + bool mbCalcNew; + + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit(); + SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); + SAL_DLLPRIVATE void ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt16 nNewPerc); + +public: + ProgressBar( vcl::Window* pParent, WinBits nWinBits ); + + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual void Resize() override; + virtual void StateChanged( StateChangedType nStateChange ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + virtual Size GetOptimalSize() const override; + + void SetValue( sal_uInt16 nNewPercent ); +}; + +#endif // INCLUDED_VCL_PRGSBAR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/roadmap.hxx b/include/vcl/toolkit/roadmap.hxx new file mode 100644 index 000000000..c2654c1fd --- /dev/null +++ b/include/vcl/toolkit/roadmap.hxx @@ -0,0 +1,118 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_VCL_INC_ROADMAP_HXX +#define INCLUDED_VCL_INC_ROADMAP_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <config_options.h> +#include <vcl/dllapi.h> +#include <vcl/ctrl.hxx> +#include <vcl/toolkit/imgctrl.hxx> +#include <memory> + +class Bitmap; + +namespace vcl +{ + +struct RoadmapTypes +{ +public: + typedef sal_Int16 ItemId; + typedef sal_Int32 ItemIndex; +}; + +class HyperLabel; +class RoadmapImpl; +class RoadmapItem; + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) ORoadmap final : public Control, public RoadmapTypes +{ +public: + ORoadmap( vcl::Window* _pParent, WinBits _nWinStyle ); + virtual ~ORoadmap( ) override; + virtual void dispose() override; + + void SetRoadmapBitmap( const BitmapEx& maBitmap ); + + void EnableRoadmapItem( ItemId _nItemId, bool _bEnable ); + + void ChangeRoadmapItemLabel( ItemId _nID, const OUString& sLabel ); + void ChangeRoadmapItemID( ItemId _nID, ItemId NewID ); + + void SetRoadmapInteractive( bool _bInteractive ); + bool IsRoadmapInteractive() const; + + void SetRoadmapComplete( bool _bComplete ); + bool IsRoadmapComplete() const; + + ItemIndex GetItemCount() const; + ItemId GetItemID( ItemIndex _nIndex ) const; + + void InsertRoadmapItem( ItemIndex Index, const OUString& RoadmapItem, ItemId _nUniqueId, bool _bEnabled ); + void ReplaceRoadmapItem( ItemIndex Index, const OUString& RoadmapItem, ItemId _nUniqueId, bool _bEnabled ); + void DeleteRoadmapItem( ItemIndex _nIndex ); + + ItemId GetCurrentRoadmapItemID() const; + bool SelectRoadmapItemByID( ItemId _nItemID ); + + void SetItemSelectHdl( const Link<LinkParamNone*,void>& _rHdl ); + Link<LinkParamNone*,void> const & GetItemSelectHdl( ) const; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + virtual void GetFocus() override; + virtual void ApplySettings( vcl::RenderContext& rRenderContext ) override; + +private: + bool PreNotify( NotifyEvent& rNEvt ) override; + + /// called when an item has been selected by any means + void Select(); + + DECL_LINK(ImplClickHdl, HyperLabel*, void); + + RoadmapItem* GetByIndex( ItemIndex _nItemIndex ); + const RoadmapItem* GetByIndex( ItemIndex _nItemIndex ) const; + + RoadmapItem* GetByID( ItemId _nID ); + const RoadmapItem* GetByID( ItemId _nID ) const; + RoadmapItem* GetPreviousHyperLabel( ItemIndex Index); + + void DrawHeadline(vcl::RenderContext& rRenderContext); + void DeselectOldRoadmapItems(); + ItemId GetNextAvailableItemId( ItemIndex NewIndex ); + ItemId GetPreviousAvailableItemId( ItemIndex NewIndex ); + RoadmapItem* GetByPointer(vcl::Window const * pWindow); + RoadmapItem* InsertHyperLabel( ItemIndex Index, const OUString& _aStr, ItemId RMID, bool _bEnabled, bool _bIncomplete ); + void UpdatefollowingHyperLabels( ItemIndex Index ); + + // Window overridables + void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& _rRect) override; + void implInit(vcl::RenderContext& rRenderContext); + + std::unique_ptr<RoadmapImpl> m_pImpl; +}; + +} // namespace vcl + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/spin.hxx b/include/vcl/toolkit/spin.hxx new file mode 100644 index 000000000..cc68f9d87 --- /dev/null +++ b/include/vcl/toolkit/spin.hxx @@ -0,0 +1,101 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_SPIN_HXX +#define INCLUDED_VCL_SPIN_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <config_options.h> +#include <vcl/dllapi.h> +#include <vcl/ctrl.hxx> +#include <vcl/timer.hxx> + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) SpinButton final : public Control +{ +private: + AutoTimer maRepeatTimer; + tools::Rectangle maUpperRect; + tools::Rectangle maLowerRect; + tools::Rectangle maFocusRect; + bool mbRepeat : 1; + bool mbUpperIn : 1; + bool mbLowerIn : 1; + bool mbInitialUp : 1; + bool mbInitialDown : 1; + bool mbHorz : 1; + bool mbUpperIsFocused : 1; + long mnMinRange; + long mnMaxRange; + long mnValue; + long mnValueStep; + + SAL_DLLPRIVATE tools::Rectangle* ImplFindPartRect( const Point& rPt ); + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); + DECL_DLLPRIVATE_LINK( ImplTimeout, Timer*, void ); + +public: + explicit SpinButton( vcl::Window* pParent, WinBits nStyle ); + + void Up(); + void Down(); + + virtual void Resize() override; + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual void Draw( OutputDevice* pDev, const Point& rPos, DrawFlags nFlags ) override; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; + virtual void MouseMove( const MouseEvent& rMEvt ) override; + virtual void KeyInput( const KeyEvent& rKEvt ) override; + virtual void StateChanged( StateChangedType nStateChange ) override; + virtual void GetFocus() override; + virtual void LoseFocus() override; + + void SetRangeMin( long nNewRange ); + long GetRangeMin() const { return mnMinRange; } + void SetRangeMax( long nNewRange ); + long GetRangeMax() const { return mnMaxRange; } + void SetRange( const Range& rRange ); + void SetValue( long nValue ); + long GetValue() const { return mnValue; } + void SetValueStep( long nNewStep ) { mnValueStep = nNewStep; } + long GetValueStep() const { return mnValueStep; } + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + +private: + // moves the focus to the upper or lower rect. Return sal_True if the focus rect actually changed. + SAL_DLLPRIVATE bool ImplMoveFocus( bool _bUpper ); + SAL_DLLPRIVATE void ImplCalcFocusRect( bool _bUpper ); + + SAL_DLLPRIVATE bool ImplIsUpperEnabled( ) const + { + return mnValue + mnValueStep <= mnMaxRange; + } + SAL_DLLPRIVATE bool ImplIsLowerEnabled( ) const + { + return mnValue >= mnMinRange + mnValueStep; + } +}; + +#endif // INCLUDED_VCL_SPIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx new file mode 100644 index 000000000..17a0b3282 --- /dev/null +++ b/include/vcl/toolkit/svtabbx.hxx @@ -0,0 +1,216 @@ +/* -*- 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 . + */ +#pragma once + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <vcl/dllapi.h> +#include <vcl/treelistbox.hxx> +#include <vcl/accessibletableprovider.hxx> + +#include <tools/debug.hxx> + +#include <memory> +#include <vector> + +enum class SvTabJustify +{ + AdjustRight = static_cast<int>(SvLBoxTabFlags::ADJUST_RIGHT), + AdjustLeft = static_cast<int>(SvLBoxTabFlags::ADJUST_LEFT), + AdjustCenter = static_cast<int>(SvLBoxTabFlags::ADJUST_CENTER) +}; + +class VCL_DLLPUBLIC SvTabListBox : public SvTreeListBox +{ +private: + std::vector<SvLBoxTab> mvTabList; + OUString aCurEntry; + +protected: + static OUString GetToken( const OUString &sStr, sal_Int32 &nIndex ); + + virtual void SetTabs() override; + virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&) override; + + OUString GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const; + SvTreeListEntry* GetEntryOnPos( sal_uLong _nEntryPos ) const; + SvTreeListEntry* GetChildOnPos( SvTreeListEntry* _pParent, sal_uLong _nEntryPos, sal_uLong& _rPos ) const; + +public: + SvTabListBox( vcl::Window* pParent, WinBits ); + virtual ~SvTabListBox() override; + virtual void dispose() override; + void SetTabs(sal_uInt16 nTabs, long const pTabPositions[], MapUnit = MapUnit::MapAppFont); + using SvTreeListBox::GetTab; + long GetLogicTab( sal_uInt16 nTab ); + + virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent = nullptr, + bool bChildrenOnDemand = false, + sal_uLong nPos=TREELIST_APPEND, void* pUserData = nullptr ) override; + + virtual SvTreeListEntry* InsertEntry( const OUString& rText, + const Image& rExpandedEntryBmp, + const Image& rCollapsedEntryBmp, + SvTreeListEntry* pParent = nullptr, + bool bChildrenOnDemand = false, + sal_uLong nPos = TREELIST_APPEND, void* pUserData = nullptr ) override; + + virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent, + sal_uLong nPos, sal_uInt16 nCol, void* pUserData = nullptr ); + virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, const Image& rExpandedEntryBmp, + const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent, + sal_uLong nPos = TREELIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = nullptr ); + + virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const override; + static OUString GetEntryText( SvTreeListEntry*, sal_uInt16 nCol ); + OUString GetEntryText( sal_uLong nPos, sal_uInt16 nCol = 0xffff ) const; + using SvTreeListBox::SetEntryText; + OUString GetCellText( sal_uLong nPos, sal_uInt16 nCol ) const; + sal_uLong GetEntryPos( const SvTreeListEntry* pEntry ) const; + + void SetTabJustify( sal_uInt16 nTab, SvTabJustify ); + void SetTabEditable( sal_uInt16 nTab, bool bEditable ); +}; + +// class SvHeaderTabListBox --------------------------------------------------- + +class HeaderBar; +namespace vcl { + struct SvHeaderTabListBoxImpl; +} + +class VCL_DLLPUBLIC SvHeaderTabListBox : public SvTabListBox, public vcl::IAccessibleTableProvider +{ +private: + typedef ::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren; + + bool m_bFirstPaint; + std::unique_ptr<::vcl::SvHeaderTabListBoxImpl> m_pImpl; + ::vcl::IAccessibleTabListBox* m_pAccessible; + AccessibleChildren m_aAccessibleChildren; + + DECL_DLLPRIVATE_LINK( ScrollHdl_Impl, SvTreeListBox*, void ); + DECL_DLLPRIVATE_LINK( CreateAccessibleHdl_Impl, HeaderBar*, void ); + + void RecalculateAccessibleChildren(); + +public: + SvHeaderTabListBox( vcl::Window* pParent, WinBits nBits ); + virtual ~SvHeaderTabListBox() override; + virtual void dispose() override; + + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override; + + void InitHeaderBar(HeaderBar* pHeaderBar); + HeaderBar* GetHeaderBar(); + static bool IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol ); + + virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent, + sal_uLong nPos, sal_uInt16 nCol, void* pUserData = nullptr ) override; + virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, const Image& rExpandedEntryBmp, + const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent, + sal_uLong nPos = TREELIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = nullptr ) override; + virtual sal_uLong Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uLong nPos=TREELIST_APPEND) override; + virtual sal_uLong Insert( SvTreeListEntry* pEntry, sal_uLong nRootPos = TREELIST_APPEND ) override; + + // Accessible ------------------------------------------------------------- + + bool IsCellCheckBox( long _nRow, sal_uInt16 _nColumn, TriState& _rState ); + + /** @return The count of the rows. */ + virtual long GetRowCount() const override; + /** @return The count of the columns. */ + virtual sal_uInt16 GetColumnCount() const override; + + /** @return The position of the current row. */ + virtual sal_Int32 GetCurrRow() const override; + /** @return The position of the current column. */ + virtual sal_uInt16 GetCurrColumn() const override; + + /** @return The description of a row. + @param _nRow The row which description is in demand. */ + virtual OUString GetRowDescription( sal_Int32 _nRow ) const override; + /** @return The description of a column. + @param _nColumn The column which description is in demand. */ + virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const override; + + /** @return <TRUE/>, if the object has a row header. */ + virtual bool HasRowHeader() const override; //GetColumnId + /** @return <TRUE/>, if the object can focus a cell. */ + virtual bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override; + + virtual void SetNoSelection() override; + using SvTabListBox::SelectAll; + virtual void SelectAll() override; + virtual void SelectRow( long _nRow, bool _bSelect = true, bool bExpand = true ) override; + virtual void SelectColumn( sal_uInt16 _nColumn, bool _bSelect = true ) override; + virtual sal_Int32 GetSelectedRowCount() const override; + virtual sal_Int32 GetSelectedColumnCount() const override; + /** @return <TRUE/>, if the row is selected. */ + virtual bool IsRowSelected( long _nRow ) const override; + virtual bool IsColumnSelected( long _nColumn ) const override; + virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const override; + virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const override; + + /** @return <TRUE/>, if the cell is visible. */ + virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const override; + virtual OUString GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const override; + + virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) override; + virtual tools::Rectangle calcTableRect( bool _bOnScreen = true ) override; + virtual tools::Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen = true ) override; + + virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) override; + + virtual sal_Int32 GetAccessibleControlCount() const override; + virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) override; + virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) override; + + virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) override; + virtual bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) override; + virtual bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint ) override; + + virtual OUString GetAccessibleObjectName( ::vcl::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override; + virtual OUString GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override; + virtual vcl::Window* GetWindowInstance() override; + + virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, ::vcl::AccessibleBrowseBoxObjType _eType ) const override; + virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumn ) const override; + virtual void GrabTableFocus() override; + + // OutputDevice + virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, MetricVector& rVector ) override; + + // Window + virtual tools::Rectangle GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const override; + virtual void GrabFocus() override; + virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override; + /** Creates and returns the accessible object of the whole BrowseBox. */ + virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; + virtual vcl::Window* GetAccessibleParentWindow() const override; + + virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override; + virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/tabdlg.hxx b/include/vcl/toolkit/tabdlg.hxx new file mode 100644 index 000000000..dc2e370c1 --- /dev/null +++ b/include/vcl/toolkit/tabdlg.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_TABDLG_HXX +#define INCLUDED_VCL_TABDLG_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <config_options.h> +#include <vcl/dllapi.h> +#include <vcl/toolkit/dialog.hxx> + +class FixedLine; + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) TabDialog final : public Dialog +{ +private: + VclPtr<FixedLine> mpFixedLine; + bool mbPosControls; + + SAL_DLLPRIVATE void ImplInitTabDialogData(); + SAL_DLLPRIVATE void ImplPosControls(); + +public: + TabDialog( vcl::Window* pParent, WinBits nStyle ); + virtual ~TabDialog() override; + virtual void dispose() override; + + virtual void StateChanged( StateChangedType nStateChange ) override; +}; + +#endif // INCLUDED_VCL_TABDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/throbber.hxx b/include/vcl/toolkit/throbber.hxx new file mode 100644 index 000000000..2159e3d14 --- /dev/null +++ b/include/vcl/toolkit/throbber.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_THROBBER_HXX +#define INCLUDED_VCL_THROBBER_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <config_options.h> +#include <vcl/dllapi.h> +#include <vcl/toolkit/imgctrl.hxx> +#include <vcl/timer.hxx> + +#include <vector> + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) Throbber final : public ImageControl +{ +public: + enum class ImageSet + { + /// default images, 16x16 pixels + N16px, + /// default images, 32x32 pixels + N32px, + /// default images, 64x64 pixels + N64px, + }; + +public: + Throbber(vcl::Window* i_parentWindow, WinBits i_style); + virtual ~Throbber() override; + virtual void dispose() override; + + // Properties + void setStepTime( sal_Int32 nStepTime ) { mnStepTime = nStepTime; } + sal_Int32 getStepTime() const { return mnStepTime; } + + void setRepeat( bool bRepeat ) { mbRepeat = bRepeat; } + bool getRepeat() const { return mbRepeat; } + + // animation control + void start(); + void stop(); + bool isRunning() const; + + void setImageList( ::std::vector< Image > const& i_images ); + + // default images + static ::std::vector< OUString > + getDefaultImageURLs( const ImageSet i_imageSet ); + +private: + // Window overridables + virtual void Resize() override; + + SAL_DLLPRIVATE void initImages(); + + ::std::vector< Image > maImageList; + + bool mbRepeat; + sal_Int32 mnStepTime; + sal_Int32 mnCurStep; + AutoTimer maWaitTimer; + + DECL_LINK( TimeOutHdl, Timer*, void ); +}; + +#endif // INCLUDED_VCL_THROBBER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/toolkit/unowrap.hxx b/include/vcl/toolkit/unowrap.hxx new file mode 100644 index 000000000..fe8a60b19 --- /dev/null +++ b/include/vcl/toolkit/unowrap.hxx @@ -0,0 +1,100 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_UNOWRAP_HXX +#define INCLUDED_VCL_UNOWRAP_HXX + +#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS) +#error "don't use this in new code" +#endif + +#include <config_options.h> +#include <com/sun/star/uno/Reference.h> +#include <vcl/dllapi.h> +#include <vcl/vclptr.hxx> + +namespace vcl { class Window; } +class OutputDevice; +class Menu; + +namespace com { +namespace sun { +namespace star { +namespace awt { + class XGraphics; + class XToolkit; + class XWindow; + class XWindowPeer; +} +} } } + +namespace com { +namespace sun { +namespace star { +namespace accessibility { + class XAccessible; +}}}} + +class UNLESS_MERGELIBS(VCL_DLLPUBLIC) UnoWrapperBase +{ +public: + virtual void Destroy() = 0; + + // Toolkit + virtual css::uno::Reference< css::awt::XToolkit > GetVCLToolkit() = 0; + + // Graphics + virtual css::uno::Reference< css::awt::XGraphics > CreateGraphics( OutputDevice* pOutDev ) = 0; + virtual void ReleaseAllGraphics( OutputDevice* pOutDev ) = 0; + + // Window + virtual css::uno::Reference< css::awt::XWindowPeer> GetWindowInterface( vcl::Window* pWindow ) = 0; + virtual void SetWindowInterface( vcl::Window* pWindow, css::uno::Reference< css::awt::XWindowPeer > xIFace ) = 0; + virtual VclPtr<vcl::Window> GetWindow(const css::uno::Reference<css::awt::XWindow>& rxWindow) = 0; + + virtual void WindowDestroyed( vcl::Window* pWindow ) = 0; + + // Accessibility + virtual css::uno::Reference< css::accessibility::XAccessible > + CreateAccessible( Menu* pMenu, bool bIsMenuBar ) = 0; + + /** Get the application's UNO wrapper object. + + Note that this static function will only ever try to create UNO wrapper object once, and + if it fails then it will not ever try again, even if the function is called multiple times. + + @param bCreateIfNotExists Create the UNO wrapper object if it doesn't exist when true. + + @return UNO wrapper object. + */ + static UnoWrapperBase* GetUnoWrapper( bool bCreateIfNotExists = true ); + + /** Sets the application's UNO Wrapper object. + + @param pWrapper Pointer to UNO wrapper object. + */ + static void SetUnoWrapper( UnoWrapperBase* pWrapper ); + +protected: + ~UnoWrapperBase() {} +}; + +#endif // INCLUDED_VCL_UNOWRAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |