diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sw/source/uibase/inc | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
195 files changed, 19099 insertions, 0 deletions
diff --git a/sw/source/uibase/inc/DashedLine.hxx b/sw/source/uibase/inc/DashedLine.hxx new file mode 100644 index 000000000..a2d2aa1b0 --- /dev/null +++ b/sw/source/uibase/inc/DashedLine.hxx @@ -0,0 +1,29 @@ +/* -*- 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/. + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_DASHEDLINE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DASHEDLINE_HXX + +#include <vcl/ctrl.hxx> + +/** Class for displaying a dashed line in the Writer GUI. + */ +class SwDashedLine : public Control +{ + Color& (*m_pColorFn)(); + +public: + SwDashedLine(vcl::Window* pParent, Color& (*pColorFn)()); + virtual ~SwDashedLine() override; + + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/DateFormFieldDialog.hxx b/sw/source/uibase/inc/DateFormFieldDialog.hxx new file mode 100644 index 000000000..2b4573af7 --- /dev/null +++ b/sw/source/uibase/inc/DateFormFieldDialog.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_DATEFORMFIELDDIALOG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DATEFORMFIELDDIALOG_HXX + +#include <vcl/weld.hxx> +#include "numfmtlb.hxx" + +class SvNumberFormatter; +class SwDoc; +namespace sw::mark +{ +class IDateFieldmark; +} + +/// Dialog to specify the properties of date form field +namespace sw +{ +class DateFormFieldDialog final : public weld::GenericDialogController +{ +private: + sw::mark::IDateFieldmark* m_pDateField; + SvNumberFormatter* m_pNumberFormatter; + + std::unique_ptr<SwNumFormatTreeView> m_xFormatLB; + + void Apply(); + void InitControls(); + +public: + DateFormFieldDialog(weld::Widget* pParent, sw::mark::IDateFieldmark* pDateField, SwDoc& rDoc); + virtual ~DateFormFieldDialog() override; + + virtual short run() override + { + short nRet = GenericDialogController::run(); + if (nRet == RET_OK) + Apply(); + return nRet; + } +}; + +} // namespace sw + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/source/uibase/inc/DropDownFieldDialog.hxx b/sw/source/uibase/inc/DropDownFieldDialog.hxx new file mode 100644 index 000000000..b8b60f20c --- /dev/null +++ b/sw/source/uibase/inc/DropDownFieldDialog.hxx @@ -0,0 +1,66 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_DROPDOWNFIELDDIALOG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DROPDOWNFIELDDIALOG_HXX + +#include <vcl/weld.hxx> + +class SwDropDownField; +class SwField; +class SwWrtShell; + +// Dialog to edit drop down field selection +namespace sw +{ +class DropDownFieldDialog final : public weld::GenericDialogController +{ + SwWrtShell &m_rSh; + SwDropDownField* m_pDropField; + + weld::Button* m_pPressedButton; + std::unique_ptr<weld::TreeView> m_xListItemsLB; + std::unique_ptr<weld::Button> m_xOKPB; + std::unique_ptr<weld::Button> m_xPrevPB; + std::unique_ptr<weld::Button> m_xNextPB; + std::unique_ptr<weld::Button> m_xEditPB; + + DECL_LINK(EditHdl, weld::Button&, void); + DECL_LINK(PrevHdl, weld::Button&, void); + DECL_LINK(NextHdl, weld::Button&, void); + void Apply(); + DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); +public: + DropDownFieldDialog(weld::Widget *pParent, SwWrtShell &rSh, + SwField* pField, bool bPrevButton, bool bNextButton); + virtual ~DropDownFieldDialog() override; + bool PrevButtonPressed() const; + bool NextButtonPressed() const; + virtual short run() override + { + short nRet = GenericDialogController::run(); + if (nRet == RET_OK) + Apply(); + return nRet; + } +}; +} //namespace sw + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/DropDownFormFieldDialog.hxx b/sw/source/uibase/inc/DropDownFormFieldDialog.hxx new file mode 100644 index 000000000..c6bcc9837 --- /dev/null +++ b/sw/source/uibase/inc/DropDownFormFieldDialog.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_DROPDOWNFORMFIELDDIALOG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DROPDOWNFORMFIELDDIALOG_HXX + +#include <vcl/weld.hxx> + +namespace sw::mark +{ +class IFieldmark; +} + +/// Dialog to specify the properties of drop-down form field +namespace sw +{ +class DropDownFormFieldDialog final : public weld::GenericDialogController +{ +private: + mark::IFieldmark* m_pDropDownField; + bool m_bListHasChanged; + + std::unique_ptr<weld::Entry> m_xListItemEntry; + std::unique_ptr<weld::Button> m_xListAddButton; + + std::unique_ptr<weld::TreeView> m_xListItemsTreeView; + + std::unique_ptr<weld::Button> m_xListRemoveButton; + std::unique_ptr<weld::Button> m_xListUpButton; + std::unique_ptr<weld::Button> m_xListDownButton; + + DECL_LINK(ListChangedHdl, weld::TreeView&, void); + DECL_LINK(KeyPressedHdl, const KeyEvent&, bool); + DECL_LINK(EntryChangedHdl, weld::Entry&, void); + DECL_LINK(ButtonPushedHdl, weld::Button&, void); + + void InitControls(); + void AppendItemToList(); + void UpdateButtons(); + void Apply(); + +public: + DropDownFormFieldDialog(weld::Widget* pParent, mark::IFieldmark* pDropDownField); + virtual ~DropDownFormFieldDialog() override; + + virtual short run() override + { + short nRet = GenericDialogController::run(); + if (nRet == RET_OK) + Apply(); + return nRet; + } +}; + +} // namespace sw + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/source/uibase/inc/FrameControl.hxx b/sw/source/uibase/inc/FrameControl.hxx new file mode 100644 index 000000000..561dac78f --- /dev/null +++ b/sw/source/uibase/inc/FrameControl.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/. + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_FRAMECONTROL_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_FRAMECONTROL_HXX + +#include <vcl/InterimItemWindow.hxx> +#include <vcl/virdev.hxx> + +#include "edtwin.hxx" + +class SwEditWin; +class SwPageFrame; +class SwFrame; +class Point; + +/// Abstract interface to be implemented by writer FrameControls +class ISwFrameControl +{ +public: + virtual ~ISwFrameControl(); + virtual void SetReadonly( bool bReadonly ) = 0; + virtual void ShowAll( bool bShow ) = 0; + + /// Returns true if the point is inside the control. + virtual bool Contains( const Point &rDocPt ) const = 0; + + virtual const SwFrame* GetFrame() = 0; + virtual SwEditWin* GetEditWin() = 0; +}; + +class SwFrameControl final +{ + VclPtr<vcl::Window> mxWindow; + ISwFrameControl *mpIFace; +public: + SwFrameControl( const VclPtr<vcl::Window> &pWindow ); + ~SwFrameControl(); + + vcl::Window* GetWindow() { return mxWindow.get(); } + ISwFrameControl* GetIFacePtr() { return mpIFace; } + + void SetReadonly( bool bReadonly ) { mpIFace->SetReadonly( bReadonly ); } + void ShowAll( bool bShow ) { mpIFace->ShowAll( bShow ); } + bool Contains( const Point &rDocPt ) const { return mpIFace->Contains( rDocPt ); } +}; + +/** Class sharing some MenuButton code + */ +class SwFrameMenuButtonBase : public InterimItemWindow, public ISwFrameControl +{ +protected: + VclPtr<VirtualDevice> m_xVirDev; +private: + VclPtr<SwEditWin> m_pEditWin; + const SwFrame* m_pFrame; + +protected: + virtual ~SwFrameMenuButtonBase() override { disposeOnce(); } + virtual void dispose() override; + + void SetVirDevFont(); + +public: + SwFrameMenuButtonBase(SwEditWin* pEditWin, const SwFrame* pFrame, + const OUString& rUIXMLDescription, const OString& rID); + + virtual const SwFrame* GetFrame() override { return m_pFrame; } + virtual SwEditWin* GetEditWin() override { return m_pEditWin; } + const SwPageFrame* GetPageFrame() const; + + static const SwPageFrame* GetPageFrame(const SwFrame* pFrame); + static void SetVirDevFont(OutputDevice& rDevice); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/FrameControlsManager.hxx b/sw/source/uibase/inc/FrameControlsManager.hxx new file mode 100644 index 000000000..f73f226b3 --- /dev/null +++ b/sw/source/uibase/inc/FrameControlsManager.hxx @@ -0,0 +1,56 @@ +/* -*- 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/. + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_FRAMECONTROLSMANAGER_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_FRAMECONTROLSMANAGER_HXX + +#include "FrameControl.hxx" + +#include <tools/gen.hxx> + +#include <map> +#include <memory> + +class SwPageFrame; +class SwEditWin; +class SwContentFrame; +class SwTextNode; + +typedef std::shared_ptr< SwFrameControl > SwFrameControlPtr; + +typedef std::map<const SwFrame*, SwFrameControlPtr> SwFrameControlPtrMap; + +/** A container for the Header/Footer, PageBreak, and Outline Content Visibility controls. +*/ +class SwFrameControlsManager +{ + private: + VclPtr<SwEditWin> m_pEditWin; + std::map< FrameControlType, SwFrameControlPtrMap > m_aControls; + + public: + SwFrameControlsManager( SwEditWin* pEditWin ); + ~SwFrameControlsManager(); + void dispose(); + + SwFrameControlPtr GetControl( FrameControlType eType, const SwFrame* pFrame ); + void RemoveControls( const SwFrame* pFrame ); + void RemoveControlsByType( FrameControlType eType, const SwFrame* pFrame ); + void HideControls( FrameControlType eType ); + void SetReadonlyControls( bool bReadonly ); + + // Helper methods + void SetHeaderFooterControl( const SwPageFrame* pPageFrame, FrameControlType eType, Point aOffset ); + void SetPageBreakControl( const SwPageFrame* pPageFrame ); + void SetUnfloatTableButton( const SwFlyFrame* pFlyFrame, bool bShow, Point aTopRightPixel = Point() ); + void SetOutlineContentVisibilityButton(const SwContentFrame* pContentFrame); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/HeaderFooterWin.hxx b/sw/source/uibase/inc/HeaderFooterWin.hxx new file mode 100644 index 000000000..54d8136f6 --- /dev/null +++ b/sw/source/uibase/inc/HeaderFooterWin.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/. + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_HEADERFOOTERWIN_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_HEADERFOOTERWIN_HXX + +#include "edtwin.hxx" +#include "DashedLine.hxx" +#include "FrameControl.hxx" +#include <vcl/timer.hxx> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> + +/** + * Button painter helper class used to paint a runtime button positioned to a writer frame. + * See header/footer button. + */ +class SwFrameButtonPainter +{ +public: + + static void PaintButton(drawinglayer::primitive2d::Primitive2DContainer& rSeq, + const tools::Rectangle& rRect, bool bOnTop); +}; + +class SwHeaderFooterWin; + +/** Class for the header and footer separator control window. + + This control is showing the header / footer style name and provides + a few useful actions to the user. + */ +class SwHeaderFooterDashedLine : public SwDashedLine, public ISwFrameControl +{ +private: + VclPtr<SwHeaderFooterWin> m_pWin; + VclPtr<SwEditWin> m_pEditWin; + const SwFrame* m_pFrame; + bool m_bIsHeader; + + void EnsureWin(); + + bool IsOnScreen(); + +public: + SwHeaderFooterDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame, bool bIsHeader); + + virtual ~SwHeaderFooterDashedLine() override { disposeOnce(); } + virtual void dispose() override { m_pWin.disposeAndClear(); m_pEditWin.clear(); SwDashedLine::dispose(); } + + virtual const SwFrame* GetFrame() override { return m_pFrame; } + virtual SwEditWin* GetEditWin() override { return m_pEditWin; } + virtual void ShowAll(bool bShow) override; + virtual bool Contains(const Point &rDocPt) const override; + virtual void SetReadonly(bool bReadonly) override; + + void SetOffset( Point aOffset, tools::Long nXLineStart, tools::Long nXLineEnd ); + bool IsHeader() const { return m_bIsHeader; }; +}; + +class SwHeaderFooterWin final : public InterimItemWindow +{ + std::unique_ptr<weld::MenuButton> m_xMenuButton; + std::unique_ptr<weld::Button> m_xPushButton; + VclPtr<SwEditWin> m_pEditWin; + VclPtr<VirtualDevice> m_xVirDev; + const SwFrame* m_pFrame; + OUString m_sLabel; + bool m_bIsHeader; + bool m_bIsAppearing; + int m_nFadeRate; + Timer m_aFadeTimer; + +public: + SwHeaderFooterWin(SwEditWin *pEditWin, const SwFrame *pFrame, bool bHeader); + virtual ~SwHeaderFooterWin( ) override; + virtual void dispose() override; + + void SetOffset(Point aOffset); + void ShowAll(bool bShow); + bool Contains(const Point &rDocPt) const; + + bool IsHeader() const { return m_bIsHeader; }; + bool IsEmptyHeaderFooter( ) const; + + void ExecuteCommand(std::string_view rIdent); + +private: + DECL_LINK(FadeHandler, Timer *, void); + DECL_LINK(ClickHdl, weld::Button&, void); + DECL_LINK(SelectHdl, const OString&, void); + void PaintButton(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/OutlineContentVisibilityWin.hxx b/sw/source/uibase/inc/OutlineContentVisibilityWin.hxx new file mode 100644 index 000000000..a03c3c1f1 --- /dev/null +++ b/sw/source/uibase/inc/OutlineContentVisibilityWin.hxx @@ -0,0 +1,57 @@ +/* -*- 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/. + */ +#pragma once + +#include <vcl/InterimItemWindow.hxx> +#include "edtwin.hxx" +#include "FrameControl.hxx" + +enum class ButtonSymbol +{ + SHOW, + HIDE, + NONE +}; + +class SwOutlineContentVisibilityWin final : public InterimItemWindow, public ISwFrameControl +{ +private: + std::unique_ptr<weld::Button> m_xShowBtn; + std::unique_ptr<weld::Button> m_xHideBtn; + + VclPtr<SwEditWin> m_pEditWin; + const SwFrame* m_pFrame; + int m_nDelayAppearing; ///< Before we show the control, wait a few timer ticks to avoid appearing with every mouse over. + Timer m_aDelayTimer; + bool m_bDestroyed; + size_t m_nOutlinePos; + +public: + SwOutlineContentVisibilityWin(SwEditWin* pEditWin, const SwFrame* pFrame); + virtual ~SwOutlineContentVisibilityWin() override { disposeOnce(); } + virtual void dispose() override; + + virtual void ShowAll(bool bShow) override; + virtual bool Contains(const Point& rDocPt) const override; + virtual void SetReadonly(bool /*bReadonly*/) override {} + virtual const SwFrame* GetFrame() override { return m_pFrame; } + virtual SwEditWin* GetEditWin() override { return m_pEditWin; } + + void Set(); + + void SetSymbol(ButtonSymbol eTyle); + ButtonSymbol GetSymbol() const; + +private: + DECL_LINK(DelayAppearHandler, Timer*, void); + DECL_LINK(MousePressHdl, const MouseEvent&, bool); + DECL_LINK(MouseMoveHdl, const MouseEvent&, bool); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/PageBreakWin.hxx b/sw/source/uibase/inc/PageBreakWin.hxx new file mode 100644 index 000000000..6d9a98ec3 --- /dev/null +++ b/sw/source/uibase/inc/PageBreakWin.hxx @@ -0,0 +1,93 @@ +/* -*- 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/. + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_PAGEBREAKWIN_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_PAGEBREAKWIN_HXX + +#include "edtwin.hxx" +#include "DashedLine.hxx" +#include "FrameControl.hxx" +#include <vcl/timer.hxx> +#include <optional> + +class Menu; +class SwPageFrame; + +class SwPageBreakWin; + +/** Class for the page break control window. + + This control shows a line indicating a manual page break and a + button providing a few actions on that page break. + */ +class SwBreakDashedLine : public SwDashedLine, public ISwFrameControl +{ +private: + VclPtr<SwPageBreakWin> m_pWin; + VclPtr<SwEditWin> m_pEditWin; + std::optional<Point> m_xMousePt; + ::tools::Rectangle m_aBtnRect; + const SwFrame* m_pFrame; + + SwPageBreakWin& GetOrCreateWin(); + +public: + SwBreakDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame); + + virtual ~SwBreakDashedLine() override { disposeOnce(); } + virtual void dispose() override { m_pWin.disposeAndClear(); m_pEditWin.clear(); SwDashedLine::dispose(); } + + virtual void MouseMove(const MouseEvent& rMEvt) override; + + virtual const SwFrame* GetFrame() override { return m_pFrame; } + virtual SwEditWin* GetEditWin() override { return m_pEditWin; } + virtual void ShowAll(bool bShow) override; + virtual bool Contains(const Point &rDocPt) const override; + virtual void SetReadonly(bool bReadonly) override; + + void execute(std::string_view rIdent); + + virtual FactoryFunction GetUITestFactory() const override; + + void UpdatePosition(const std::optional<Point>& xEvtPt = std::optional<Point>()); + void DestroyWin(); +}; + +class SwPageBreakWin final : public InterimItemWindow +{ + std::unique_ptr<weld::MenuButton> m_xMenuButton; + VclPtr<SwBreakDashedLine> m_pLine; + VclPtr<SwEditWin> m_pEditWin; + VclPtr<VirtualDevice> m_xVirDev; + const SwFrame* m_pFrame; + bool m_bIsAppearing; + int m_nFadeRate; + int m_nDelayAppearing; ///< Before we show the control, let it transparent for a few timer ticks to avoid appearing with every mouse over. + Timer m_aFadeTimer; + bool m_bDestroyed; + +public: + SwPageBreakWin(SwBreakDashedLine* pLine, SwEditWin* pEditWin, const SwFrame *pFrame); + virtual ~SwPageBreakWin() override; + virtual void dispose() override; + + void Fade( bool bFadeIn ); + + void SetRectanglePixel(const ::tools::Rectangle& rRect); + +private: + DECL_LINK( FadeHandler, Timer *, void ); + /// Hide the button when the menu is toggled closed, e.g by clicking outside + DECL_LINK(ToggleHdl, weld::Toggleable&, void); + DECL_LINK(SelectHdl, const OString&, void); + void PaintButton(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/SidebarWindowsConsts.hxx b/sw/source/uibase/inc/SidebarWindowsConsts.hxx new file mode 100644 index 000000000..2e920b990 --- /dev/null +++ b/sw/source/uibase/inc/SidebarWindowsConsts.hxx @@ -0,0 +1,33 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SIDEBARWINDOWSCONSTS_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SIDEBARWINDOWSCONSTS_HXX + +#include <sal/types.h> + +namespace sw::sidebarwindows +{ +const sal_Int8 ANCHORLINE_WIDTH = 1; + +} // end of namespace sw::sidebarwindows + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/SwSpellDialogChildWindow.hxx b/sw/source/uibase/inc/SwSpellDialogChildWindow.hxx new file mode 100644 index 000000000..8599256da --- /dev/null +++ b/sw/source/uibase/inc/SwSpellDialogChildWindow.hxx @@ -0,0 +1,66 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SWSPELLDIALOGCHILDWINDOW_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SWSPELLDIALOGCHILDWINDOW_HXX + +#include <svx/SpellDialogChildWindow.hxx> +#include <view.hxx> + +class SwWrtShell; +struct SpellState; +class SwSpellDialogChildWindow final + : public svx::SpellDialogChildWindow +{ + bool m_bIsGrammarCheckingOn; + std::unique_ptr<SpellState> m_pSpellState; + + SwWrtShell* GetWrtShell_Impl(); + void MakeTextSelection_Impl(SwWrtShell& rSh, ShellMode eSelMode); + bool FindNextDrawTextError_Impl(SwWrtShell& rSh); + bool SpellDrawText_Impl(SwWrtShell& rSh, svx::SpellPortions& rPortions); + void LockFocusNotification(bool bLock); + + virtual svx::SpellPortions GetNextWrongSentence(bool bRecheck) override; + virtual void ApplyChangedSentence(const svx::SpellPortions& rChanged, bool bRecheck) override; + virtual void AddAutoCorrection(const OUString& rOld, const OUString& rNew, LanguageType eLanguage) override; + virtual bool HasAutoCorrection() override; + virtual bool HasGrammarChecking() override; + virtual bool IsGrammarChecking() override; + virtual void SetGrammarChecking(bool bOn) override; + virtual void GetFocus() override; + virtual void LoseFocus() override; + +public: + SwSpellDialogChildWindow ( + vcl::Window*pParent, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo); + virtual ~SwSpellDialogChildWindow() override; + + SFX_DECL_CHILDWINDOW_WITHID(SwSpellDialogChildWindow); + + void InvalidateSpellDialog(); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/SwXFilterOptions.hxx b/sw/source/uibase/inc/SwXFilterOptions.hxx new file mode 100644 index 000000000..2ca1aabe6 --- /dev/null +++ b/sw/source/uibase/inc/SwXFilterOptions.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_SW_SOURCE_UIBASE_INC_SWXFILTEROPTIONS_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SWXFILTEROPTIONS_HXX + +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase.hxx> + +namespace com::sun::star::io { class XInputStream; } + +class SwXFilterOptions final : public ::cppu::WeakImplHelper< + css::beans::XPropertyAccess, + css::ui::dialogs::XExecutableDialog, + css::document::XImporter, + css::document::XExporter, + css::lang::XInitialization, + css::lang::XServiceInfo > +{ + OUString m_sFilterOptions; + + css::uno::Reference< css::io::XInputStream > m_xInputStream; + css::uno::Reference< css::lang::XComponent > m_xModel; + css::uno::Reference< css::awt::XWindow > m_xDialogParent; + +public: + SwXFilterOptions(); + virtual ~SwXFilterOptions() override; + + // XPropertyAccess + virtual css::uno::Sequence< css::beans::PropertyValue > + SAL_CALL getPropertyValues() override; + virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< + css::beans::PropertyValue >& aProps ) override; + + // XExecutableDialog + virtual void SAL_CALL setTitle( const OUString& aTitle ) override; + virtual sal_Int16 SAL_CALL execute() override; + + // XImporter + virtual void SAL_CALL setTargetDocument( const css::uno::Reference< + css::lang::XComponent >& xDoc ) override; + + // XExporter + virtual void SAL_CALL setSourceDocument( const css::uno::Reference< + css::lang::XComponent >& xDoc ) override; + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/UnfloatTableButton.hxx b/sw/source/uibase/inc/UnfloatTableButton.hxx new file mode 100644 index 000000000..164b240f2 --- /dev/null +++ b/sw/source/uibase/inc/UnfloatTableButton.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_SW_SOURCE_UIBASE_DOCVW_UNFLOATTABLEBUTTON_HXX +#define INCLUDED_SW_SOURCE_UIBASE_DOCVW_UNFLOATTABLEBUTTON_HXX + +#include "edtwin.hxx" +#include "FrameControl.hxx" + +/** Class for unfloat table button + * + * This unfloat button is used to convert a floating table into a simple writer table embedded to the text body. + * This unfloat operation is useful typically for documents imported from MSO file formats containing + * multi-page floating tables. In case of a multi-page table the text frame cuts off the table because + * the frame can't span across multiple pages. With unfloating we can get a multi-page table without + * floating properties. + * + */ +class UnfloatTableButton final : public SwFrameMenuButtonBase +{ + std::unique_ptr<weld::Button> m_xPushButton; + OUString m_sLabel; + +public: + UnfloatTableButton(SwEditWin* pEditWin, const SwFrame* pFrame); + virtual void dispose() override; + virtual ~UnfloatTableButton() override; + + void SetOffset(Point aTopRightPixel); + + virtual void MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void ShowAll(bool bShow) override; + virtual bool Contains(const Point& rDocPt) const override; + + virtual void SetReadonly(bool bReadonly) override; + +private: + void PaintButton(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/source/uibase/inc/abstract.hxx b/sw/source/uibase/inc/abstract.hxx new file mode 100644 index 000000000..ded62f0ff --- /dev/null +++ b/sw/source/uibase/inc/abstract.hxx @@ -0,0 +1,36 @@ +/* -*- 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 + +#include <sfx2/basedlgs.hxx> + +class SwInsertAbstractDlg final : public SfxDialogController +{ + std::unique_ptr<weld::SpinButton> m_xLevelNF; + std::unique_ptr<weld::SpinButton> m_xParaNF; + +public: + SwInsertAbstractDlg(weld::Window* pParent); + virtual ~SwInsertAbstractDlg() override; + + sal_uInt8 GetLevel() const; + sal_uInt8 GetPara() const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/addrdlg.hxx b/sw/source/uibase/inc/addrdlg.hxx new file mode 100644 index 000000000..66706915a --- /dev/null +++ b/sw/source/uibase/inc/addrdlg.hxx @@ -0,0 +1,32 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_ADDRDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_ADDRDLG_HXX + +#include <sfx2/basedlgs.hxx> + +class SwAddrDlg final : public SfxSingleTabDialogController +{ +public: + SwAddrDlg(weld::Window* pParent, const SfxItemSet& rSet); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/annotsh.hxx b/sw/source/uibase/inc/annotsh.hxx new file mode 100644 index 000000000..7c3a5fef9 --- /dev/null +++ b/sw/source/uibase/inc/annotsh.hxx @@ -0,0 +1,80 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_ANNOTSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_ANNOTSH_HXX + +#include <sfx2/shell.hxx> +#include <shellid.hxx> +#include <swmodule.hxx> +#include <unotools/caserotate.hxx> + +class SwView; +class SwAnnotationShell final : public SfxShell +{ + SwView& m_rView; + RotateTransliteration m_aRotateCase; + +public: + SFX_DECL_INTERFACE(SW_ANNOTATIONSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwAnnotationShell(SwView&); + virtual ~SwAnnotationShell() override; + + static void StateDisableItems(SfxItemSet &); + void Exec(SfxRequest &); + + void GetState(SfxItemSet &); + void StateInsert(SfxItemSet &rSet); + + void NoteExec(SfxRequest const &); + void GetNoteState(SfxItemSet &); + + void ExecLingu(SfxRequest &rReq); + void GetLinguState(SfxItemSet &); + + void ExecClpbrd(SfxRequest const &rReq); + void StateClpbrd(SfxItemSet &rSet); + + void ExecTransliteration(SfxRequest const &); + void ExecRotateTransliteration(SfxRequest const &); + + void ExecUndo(SfxRequest &rReq); + void StateUndo(SfxItemSet &rSet); + + static void StateStatusLine(SfxItemSet &rSet); + + void InsertSymbol(SfxRequest& rReq); + + void ExecSearch(SfxRequest&); + void StateSearch(SfxItemSet &); + + virtual SfxUndoManager* + GetUndoManager() override; + + static SfxItemPool* GetAnnotationPool(SwView const & rV); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/ascfldlg.hxx b/sw/source/uibase/inc/ascfldlg.hxx new file mode 100644 index 000000000..f62e6574f --- /dev/null +++ b/sw/source/uibase/inc/ascfldlg.hxx @@ -0,0 +1,65 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_ASCFLDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_ASCFLDLG_HXX + +#include <sfx2/basedlgs.hxx> +#include <svx/txencbox.hxx> +#include <svx/langbox.hxx> +#include <tools/lineend.hxx> + +class SwAsciiOptions; +class SvStream; +class SwDocShell; + +class SwAsciiFilterDlg final : public SfxDialogController +{ + bool m_bSaveLineStatus; + OUString m_sExtraData; + + std::unique_ptr<SvxTextEncodingBox> m_xCharSetLB; + std::unique_ptr<weld::Label> m_xFontFT; + std::unique_ptr<weld::ComboBox> m_xFontLB; + std::unique_ptr<weld::Label> m_xLanguageFT; + std::unique_ptr<SvxLanguageBox> m_xLanguageLB; + std::unique_ptr<weld::RadioButton> m_xCRLF_RB; + std::unique_ptr<weld::RadioButton> m_xCR_RB; + std::unique_ptr<weld::RadioButton> m_xLF_RB; + std::unique_ptr<weld::CheckButton> m_xIncludeBOM_CB; + + DECL_LINK(CharSetSelHdl, weld::ComboBox&, void); + DECL_LINK(LineEndHdl, weld::Toggleable&, void); + void SetCRLF(LineEnd eEnd); + LineEnd GetCRLF() const; + void SetIncludeBOM(bool bIncludeBOM); + bool GetIncludeBOM() const; + void UpdateIncludeBOMSensitiveState(); + +public: + // CTOR: for import - pStream is the inputstream + // for export - pStream must be 0 + SwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh, SvStream* pStream); + virtual ~SwAsciiFilterDlg() override; + + void FillOptions(SwAsciiOptions& rOptions); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/autoformatpreview.hxx b/sw/source/uibase/inc/autoformatpreview.hxx new file mode 100644 index 000000000..e1cb91ca6 --- /dev/null +++ b/sw/source/uibase/inc/autoformatpreview.hxx @@ -0,0 +1,82 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_AUTOFORMATPREVIEW_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_AUTOFORMATPREVIEW_HXX + +#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <sal/types.h> +#include <svx/framelinkarray.hxx> +#include <svl/numformat.hxx> +#include <tools/gen.hxx> +#include <rtl/ustring.hxx> +#include <vcl/customweld.hxx> +#include <vcl/font.hxx> + +#include "wrtsh.hxx" +#include <tblafmt.hxx> + +class AutoFormatPreview final : public weld::CustomWidgetController +{ +public: + AutoFormatPreview(); + + void NotifyChange(const SwTableAutoFormat& rNewData); + + void DetectRTL(SwWrtShell const* pWrtShell); + +private: + SwTableAutoFormat maCurrentData; + svx::frame::Array maArray; /// Implementation to draw the frame borders. + bool mbFitWidth; + bool mbRTL; + Size maPreviousSize; + tools::Long mnLabelColumnWidth; + tools::Long mnDataColumnWidth1; + tools::Long mnDataColumnWidth2; + tools::Long mnRowHeight; + const OUString maStringJan; + const OUString maStringFeb; + const OUString maStringMar; + const OUString maStringNorth; + const OUString maStringMid; + const OUString maStringSouth; + const OUString maStringSum; + std::unique_ptr<SvNumberFormatter> mxNumFormat; + + uno::Reference<i18n::XBreakIterator> m_xBreak; + + void Init(); + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + virtual void Resize() override; + void CalcCellArray(bool bFitWidth); + void CalcLineMap(); + void PaintCells(vcl::RenderContext& rRenderContext); + + sal_uInt8 GetFormatIndex(size_t nCol, size_t nRow) const; + + void DrawString(vcl::RenderContext& rRenderContext, size_t nCol, size_t nRow); + void DrawBackground(vcl::RenderContext& rRenderContext); + + void MakeFonts(vcl::RenderContext const& rRenderContext, sal_uInt8 nIndex, vcl::Font& rFont, + vcl::Font& rCJKFont, vcl::Font& rCTLFont); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/barcfg.hxx b/sw/source/uibase/inc/barcfg.hxx new file mode 100644 index 000000000..96060ad28 --- /dev/null +++ b/sw/source/uibase/inc/barcfg.hxx @@ -0,0 +1,46 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_BARCFG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_BARCFG_HXX + +#include <sfx2/toolbarids.hxx> +#include <unotools/configitem.hxx> + +enum class SelectionType : sal_Int32; + +class SwToolbarConfigItem final : public utl::ConfigItem +{ + sal_Int32 m_aTbxIdArray[5]; + + static css::uno::Sequence<OUString> GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SwToolbarConfigItem(bool bWeb); + virtual ~SwToolbarConfigItem() override; + + virtual void Notify(const css::uno::Sequence<OUString>& aPropertyNames) override; + + void SetTopToolbar(SelectionType nSelType, ToolbarId eBarId); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/basesh.hxx b/sw/source/uibase/inc/basesh.hxx new file mode 100644 index 000000000..8937f817c --- /dev/null +++ b/sw/source/uibase/inc/basesh.hxx @@ -0,0 +1,123 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_BASESH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_BASESH_HXX + +#include <shellid.hxx> + +#include <tools/link.hxx> +#include <sfx2/module.hxx> +#include <sfx2/shell.hxx> +#include <mdiexp.hxx> +#include <memory> +#include <set> +#include <vector> + +class SwPaM; +class SwWrtShell; +class SwView; +class SfxItemSet; +class SwCursorShell; + +struct DBTextStruct_Impl; +class SW_DLLPUBLIC SwBaseShell: public SfxShell +{ + SwView &m_rView; + + // DragMode + static FlyMode s_eFrameMode; + + // Bug 75078 - if in GetState the async call of GetGraphic returns + // synch, the set the state directly into the itemset + SfxItemSet* m_pGetStateSet; + + // Update-Timer for graphic + std::set<sal_uInt16> m_aGrfUpdateSlots; + + DECL_DLLPRIVATE_LINK( GraphicArrivedHdl, SwCursorShell&, void ); + +protected: + SwWrtShell& GetShell(); + SwWrtShell* GetShellPtr(); + + SwView& GetView() { return m_rView; } + void SetGetStateSet( SfxItemSet* p ) { m_pGetStateSet = p; } + bool AddGrfUpdateSlot( sal_uInt16 nSlot ){ return m_aGrfUpdateSlots.insert( nSlot ).second; } + + DECL_DLLPRIVATE_LINK( InsertDBTextHdl, void*, void ); + + void InsertURLButton( const OUString& rURL, const OUString& rTarget, const OUString& rText ); + void InsertTable( SfxRequest& _rRequest ); + +public: + SwBaseShell(SwView &rShell); + virtual ~SwBaseShell() override; + + SFX_DECL_INTERFACE(SW_BASESHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + void ExecDelete(SfxRequest &); + + void ExecClpbrd(SfxRequest &); + void StateClpbrd(SfxItemSet &); + + void ExecUndo(SfxRequest &); + void StateUndo(SfxItemSet &); + + void Execute(SfxRequest &); + void GetState(SfxItemSet &); + void StateStyle(SfxItemSet &); + + void ExecuteGallery(SfxRequest&); + void GetGalleryState(SfxItemSet&); + + void ExecDlg(SfxRequest &); + + void ExecTextCtrl(SfxRequest& rReq); + void GetTextFontCtrlState(SfxItemSet& rSet); + void GetTextCtrlState(SfxItemSet& rSet); + void GetBorderState(SfxItemSet &rSet); + void GetBckColState(SfxItemSet &rSet); + + void ExecBckCol(SfxRequest& rReq); + void SetWrapMode( sal_uInt16 nSlot ); + + static void StateDisableItems(SfxItemSet &); + + void EditRegionDialog(SfxRequest const & rReq); + void InsertRegionDialog(SfxRequest& rReq); + + void ExecField(SfxRequest const & rReq); + + static void SetFrameMode( FlyMode eMode, SwWrtShell *pShell ); // with update! + static void SetFrameMode_( FlyMode eMode ) { s_eFrameMode = eMode; } + static FlyMode GetFrameMode() { return s_eFrameMode; } + + // duplicate rOrig and rOrig's multi-selection Ring so the first element of the returned + // vector can be used equivalently to rOrig to affect the same selections + static std::shared_ptr<std::vector<std::unique_ptr<SwPaM>>> CopyPaMRing(SwPaM& rOrig); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/beziersh.hxx b/sw/source/uibase/inc/beziersh.hxx new file mode 100644 index 000000000..47eced7d3 --- /dev/null +++ b/sw/source/uibase/inc/beziersh.hxx @@ -0,0 +1,42 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_BEZIERSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_BEZIERSH_HXX + +#include "basesh.hxx" + +class SwBezierShell final : public SwBaseShell +{ +public: + SFX_DECL_INTERFACE(SW_BEZIERSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwBezierShell(SwView& rView); + + void GetState(SfxItemSet&); + void Execute(SfxRequest const&); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/bmpwin.hxx b/sw/source/uibase/inc/bmpwin.hxx new file mode 100644 index 000000000..20d31100b --- /dev/null +++ b/sw/source/uibase/inc/bmpwin.hxx @@ -0,0 +1,53 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_BMPWIN_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_BMPWIN_HXX + +#include <vcl/customweld.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/graph.hxx> + +// extended page for graphics +class BmpWindow final : public weld::CustomWidgetController +{ +private: + Graphic aGraphic; + BitmapEx aBmp; + + bool bHorz : 1; + bool bVert : 1; + bool bGraphic : 1; + + virtual void Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect) override; + + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + +public: + BmpWindow(); + virtual ~BmpWindow() override; + void MirrorVert(bool bMirror) { bVert = bMirror; Invalidate(); } + void MirrorHorz(bool bMirror) { bHorz = bMirror; Invalidate(); } + void SetGraphic(const Graphic& rGrf); + void SetBitmapEx(const BitmapEx& rGrf); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/bookctrl.hxx b/sw/source/uibase/inc/bookctrl.hxx new file mode 100644 index 000000000..7d6b8d4ba --- /dev/null +++ b/sw/source/uibase/inc/bookctrl.hxx @@ -0,0 +1,41 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_BOOKCTRL_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_BOOKCTRL_HXX + +#include <sfx2/stbitem.hxx> + +class SwBookmarkControl final : public SfxStatusBarControl +{ + virtual void Command(const CommandEvent& rCEvt) override; + +public: + virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState) override; + virtual void Paint(const UserDrawEvent& rEvt) override; + + SFX_DECL_STATUSBAR_CONTROL(); + + SwBookmarkControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb); + virtual ~SwBookmarkControl() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/bookmark.hxx b/sw/source/uibase/inc/bookmark.hxx new file mode 100644 index 000000000..6441a5f16 --- /dev/null +++ b/sw/source/uibase/inc/bookmark.hxx @@ -0,0 +1,107 @@ +/* -*- 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 + +#include <sfx2/basedlgs.hxx> +#include <vcl/weld.hxx> +#include <IMark.hxx> +#include "condedit.hxx" + +class SwWrtShell; +class SfxRequest; + +class BookmarkTable +{ + std::unique_ptr<weld::TreeView> m_xControl; + std::unique_ptr<weld::TreeIter> GetRowByBookmarkName(const OUString& sName); +public: + BookmarkTable(std::unique_ptr<weld::TreeView> xControl); + void InsertBookmark(sw::mark::IMark* pMark); + void SelectByName(const OUString& sName); + sw::mark::IMark* GetBookmarkByName(const OUString& sName); + OUString GetNameProposal() const; + + void unselect_all() { m_xControl->unselect_all(); } + bool has_focus() const { return m_xControl->has_focus(); } + std::unique_ptr<weld::TreeIter> get_selected() const; + void clear() { m_xControl->clear(); } + void select(const weld::TreeIter& rIter) { m_xControl->select(rIter); } + void remove_selection() { m_xControl->remove_selection(); } + OUString get_id(const weld::TreeIter& rIter) const { return m_xControl->get_id(rIter); } + void set_sort_indicator(TriState eState, int nColumn = -1) { m_xControl->set_sort_indicator(eState, nColumn); } + void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) { m_xControl->selected_foreach(func); } + + void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xControl->connect_changed(rLink); } + void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { m_xControl->connect_row_activated(rLink); } + void connect_column_clicked(const Link<int, void>& rLink) { m_xControl->connect_column_clicked(rLink); } + void make_sorted() { m_xControl->make_sorted(); } + bool get_sort_order() const { return m_xControl->get_sort_order(); } + void set_sort_order(bool bAscending) { m_xControl->set_sort_order(bAscending); } + int get_sort_column() const { return m_xControl->get_sort_column(); } + void set_sort_column(int nColumn) { m_xControl->set_sort_column(nColumn); } + + static constexpr OUStringLiteral aForbiddenChars = u"/\\@*?\",#"; + static const char cSeparator; +}; + +class SwInsertBookmarkDlg final : public SfxDialogController +{ + SwWrtShell& rSh; + std::vector<std::pair<sw::mark::IMark*, OUString>> aTableBookmarks; + sal_Int32 m_nLastBookmarksCount; + bool m_bSorted; + bool m_bAreProtected; + + std::unique_ptr<weld::Entry> m_xEditBox; + std::unique_ptr<weld::Button> m_xInsertBtn; + std::unique_ptr<weld::Button> m_xDeleteBtn; + std::unique_ptr<weld::Button> m_xGotoBtn; + std::unique_ptr<weld::Button> m_xRenameBtn; + std::unique_ptr<weld::CheckButton> m_xHideCB; + std::unique_ptr<weld::Label> m_xConditionFT; + std::unique_ptr<ConditionEdit> m_xConditionED; + std::unique_ptr<BookmarkTable> m_xBookmarksBox; + std::unique_ptr<weld::Label> m_xForbiddenChars; + + DECL_LINK(ModifyHdl, weld::Entry&, void); + DECL_LINK(InsertHdl, weld::Button&, void); + DECL_LINK(DeleteHdl, weld::Button&, void); + DECL_LINK(RenameHdl, weld::Button&, void); + DECL_LINK(GotoHdl, weld::Button&, void); + DECL_LINK(SelectionChangedHdl, weld::TreeView&, void); + DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); + DECL_LINK(HeaderBarClick, int, void); + DECL_LINK(ChangeHideHdl, weld::Toggleable&, void); + + // Fill table with bookmarks + void PopulateTable(); + /** + * Check if displayed bookmarks are up-to date, if not update them. + * @return True if no update was needed. + */ + bool ValidateBookmarks(); + bool HaveBookmarksChanged(); + void GotoSelectedBookmark(); + +public: + SwInsertBookmarkDlg(weld::Window* pParent, SwWrtShell& rSh); + virtual ~SwInsertBookmarkDlg() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/break.hxx b/sw/source/uibase/inc/break.hxx new file mode 100644 index 000000000..79cf295eb --- /dev/null +++ b/sw/source/uibase/inc/break.hxx @@ -0,0 +1,69 @@ + +/* -*- 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_SW_SOURCE_UIBASE_INC_BREAK_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_BREAK_HXX + +#include <vcl/weld.hxx> +#include <optional> + +class SwWrtShell; +enum class SwLineBreakClear; + +class SwBreakDlg final : public weld::GenericDialogController +{ + std::unique_ptr<weld::RadioButton> m_xLineBtn; + std::unique_ptr<weld::Label> m_xLineClearText; + std::unique_ptr<weld::ComboBox> m_xLineClearBox; + std::unique_ptr<weld::RadioButton> m_xColumnBtn; + std::unique_ptr<weld::RadioButton> m_xPageBtn; + std::unique_ptr<weld::Label> m_xPageCollText; + std::unique_ptr<weld::ComboBox> m_xPageCollBox; + std::unique_ptr<weld::CheckButton> m_xPageNumBox; + std::unique_ptr<weld::SpinButton> m_xPageNumEdit; + std::unique_ptr<weld::Button> m_xOkBtn; + + SwWrtShell& rSh; + OUString m_aTemplate; + sal_uInt16 nKind; + ::std::optional<sal_uInt16> oPgNum; + std::optional<SwLineBreakClear> m_eClear; + + bool bHtmlMode; + + DECL_LINK(ToggleHdl, weld::Toggleable&, void); + DECL_LINK(ChangeHdl, weld::ComboBox&, void); + DECL_LINK(PageNumHdl, weld::Toggleable&, void); + DECL_LINK(PageNumModifyHdl, weld::SpinButton&, void); + DECL_LINK(OkHdl, weld::Button&, void); + + void CheckEnable(); + void rememberResult(); + +public: + SwBreakDlg(weld::Window* pParent, SwWrtShell& rSh); + const OUString& GetTemplateName() const { return m_aTemplate; } + sal_uInt16 GetKind() const { return nKind; } + const ::std::optional<sal_uInt16>& GetPageNumber() const { return oPgNum; } + const std::optional<SwLineBreakClear>& GetClear() const { return m_eClear; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/caption.hxx b/sw/source/uibase/inc/caption.hxx new file mode 100644 index 000000000..d762091b1 --- /dev/null +++ b/sw/source/uibase/inc/caption.hxx @@ -0,0 +1,89 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_CAPTION_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CAPTION_HXX + +#include <rtl/ustring.hxx> +#include <tools/globname.hxx> +#include <SwCapObjType.hxx> +#include <swdllapi.h> + +class SW_DLLPUBLIC InsCaptionOpt +{ +private: + bool m_bUseCaption; + SwCapObjType m_eObjType; + SvGlobalName m_aOleId; + OUString m_sCategory; + sal_uInt16 m_nNumType; + OUString m_sNumberSeparator; + OUString m_sCaption; + sal_uInt16 m_nPos; + sal_uInt16 m_nLevel; + OUString m_sSeparator; + OUString m_sCharacterStyle; + + bool m_bIgnoreSeqOpts; // is not being saved + bool m_bCopyAttributes; // -""- + +public: + InsCaptionOpt(const SwCapObjType eType = FRAME_CAP, const SvGlobalName* pOleId = nullptr); + + bool& UseCaption() { return m_bUseCaption; } + bool UseCaption() const { return m_bUseCaption; } + + SwCapObjType GetObjType() const { return m_eObjType; } + + const SvGlobalName& GetOleId() const { return m_aOleId; } + + const OUString& GetCategory() const { return m_sCategory; } + void SetCategory(const OUString& rCat) { m_sCategory = rCat; } + + sal_uInt16 GetNumType() const { return m_nNumType; } + void SetNumType(const sal_uInt16 nNT) { m_nNumType = nNT; } + + const OUString& GetNumSeparator() const { return m_sNumberSeparator; } + void SetNumSeparator(const OUString& rSet) {m_sNumberSeparator = rSet;} + + const OUString& GetCaption() const { return m_sCaption; } + void SetCaption(const OUString& rCap) { m_sCaption = rCap; } + + sal_uInt16 GetPos() const { return m_nPos; } + void SetPos(const sal_uInt16 nP) { m_nPos = nP; } + + sal_uInt16 GetLevel() const { return m_nLevel; } + void SetLevel(const sal_uInt16 nLvl) { m_nLevel = nLvl; } + + const OUString& GetSeparator() const { return m_sSeparator; } + void SetSeparator(const OUString& rSep) { m_sSeparator = rSep; } + + const OUString& GetCharacterStyle() const { return m_sCharacterStyle; } + void SetCharacterStyle(const OUString& rStyle) + { m_sCharacterStyle = rStyle; } + + bool& IgnoreSeqOpts() { return m_bIgnoreSeqOpts; } + bool IgnoreSeqOpts() const { return m_bIgnoreSeqOpts; } + + bool& CopyAttributes() { return m_bCopyAttributes; } + bool CopyAttributes() const { return m_bCopyAttributes; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/cfgitems.hxx b/sw/source/uibase/inc/cfgitems.hxx new file mode 100644 index 000000000..34ffa2d24 --- /dev/null +++ b/sw/source/uibase/inc/cfgitems.hxx @@ -0,0 +1,166 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_CFGITEMS_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CFGITEMS_HXX + +#include <svl/poolitem.hxx> +#include <swdllapi.h> +#include <printdata.hxx> + +#include <cmdid.h> + +class SwModule; +#ifdef DBG_UTIL +class SwTestTabPage; +#endif +class SwAddPrinterTabPage; +class SfxPrinter; +class SwViewShell; +class SwViewOption; +class SwContentOptPage; +class SwShdwCursorOptionsTabPage; +enum class SwFillMode; + +/// Item for settings dialog - document view +class SW_DLLPUBLIC SwDocDisplayItem final : public SfxPoolItem +{ + friend class SwShdwCursorOptionsTabPage; + friend class SwModule; + + bool m_bParagraphEnd :1; + bool m_bTab :1; + bool m_bSpace :1; + bool m_bNonbreakingSpace :1; + bool m_bSoftHyphen :1; + bool m_bCharHiddenText :1; + bool m_bBookmarks :1; + bool m_bManualBreak :1; + sal_Int32 m_xDefaultAnchor; + +public: + SwDocDisplayItem(); + SwDocDisplayItem( const SwViewOption& rVOpt ); + + virtual SwDocDisplayItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + void FillViewOptions( SwViewOption& rVOpt) const; +}; + +// OS 12.01.95 +// Item for settings dialog, element page +class SW_DLLPUBLIC SwElemItem final : public SfxPoolItem +{ + //view + bool m_bVertRuler :1; + bool m_bVertRulerRight:1; + bool m_bSmoothScroll :1; + //visual aids + bool m_bCrosshair :1; + //display + bool m_bTable :1; + bool m_bGraphic :1; + bool m_bDrawing :1; + bool m_bNotes :1; + bool m_bShowInlineTooltips :1; + bool m_bShowOutlineContentVisibilityButton :1; + bool m_bTreatSubOutlineLevelsAsContent :1; + bool m_bShowChangesInMargin :1; + bool m_bFieldHiddenText :1; + bool m_bShowHiddenPara :1; + + friend class SwContentOptPage; + +public: + SwElemItem(); + SwElemItem(const SwViewOption& rVOpt); + + virtual SwElemItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + + void FillViewOptions( SwViewOption& rVOpt) const; + +}; + +// OS 12.01.95 +// Item for settings dialog - printer/add-ons +class SW_DLLPUBLIC SwAddPrinterItem final : public SfxPoolItem, public SwPrintData +{ + using SwPrintData::operator ==; + +public: + SwAddPrinterItem(); + SwAddPrinterItem( const SwPrintData& rPrtData ); + + virtual SwAddPrinterItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool operator==( const SfxPoolItem& ) const override; +}; + +/// Item for settings dialog, ShadowCursorPage +class SW_DLLPUBLIC SwShadowCursorItem final : public SfxPoolItem +{ + SwFillMode m_eMode; + bool m_bOn; +public: + SwShadowCursorItem(); + SwShadowCursorItem( const SwViewOption& rVOpt ); + + virtual SwShadowCursorItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + + void FillViewOptions( SwViewOption& rVOpt) const; + + SwFillMode GetMode() const { return m_eMode; } + bool IsOn() const { return m_bOn; } + + void SetMode( SwFillMode eM ) { m_eMode = eM; } + void SetOn( bool bFlag ) { m_bOn = bFlag; } +}; + +#ifdef DBG_UTIL + +// Item for settings dialog - test settings +class SW_DLLPUBLIC SwTestItem final : public SfxPoolItem +{ + friend class SwModule; + friend class SwTestTabPage; + + bool m_bTest1:1; + bool m_bTest2:1; + bool m_bTest3:1; + bool m_bTest4:1; + bool m_bTest5:1; + bool m_bTest6:1; + bool m_bTest7:1; + bool m_bTest8:1; + bool m_bTest9:1; + bool m_bTest10:1; + +public: + SwTestItem() : SfxPoolItem(FN_PARAM_SWTEST) {}; + + virtual SwTestItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + +}; +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/changedb.hxx b/sw/source/uibase/inc/changedb.hxx new file mode 100644 index 000000000..0e2ffbdb5 --- /dev/null +++ b/sw/source/uibase/inc/changedb.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_SW_SOURCE_UIBASE_INC_CHANGEDB_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CHANGEDB_HXX + +#include <sfx2/basedlgs.hxx> +#include "dbtree.hxx" + +class SwFieldMgr; +class SwView; +class SwWrtShell; +struct SwDBData; + +// exchange database at fields +class SwChangeDBDlg final : public SfxDialogController +{ + SwWrtShell *pSh; + + std::unique_ptr<weld::TreeView> m_xUsedDBTLB; + std::unique_ptr<SwDBTreeList> m_xAvailDBTLB; + std::unique_ptr<weld::Button> m_xAddDBPB; + std::unique_ptr<weld::Label> m_xDocDBNameFT; + std::unique_ptr<weld::Button> m_xDefineBT; + + void TreeSelect(); + + DECL_LINK(TreeSelectHdl, weld::TreeView&, void); + DECL_LINK(ButtonHdl, weld::Button&, void); + DECL_LINK(AddDBHdl, weld::Button&, void); + + void UpdateFields(); + void FillDBPopup(); + std::unique_ptr<weld::TreeIter> Insert(std::u16string_view rDBName); + void ShowDBName(const SwDBData& rDBData); + +public: + SwChangeDBDlg(SwView const & rVw); + virtual short run() override; + virtual ~SwChangeDBDlg() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/chartins.hxx b/sw/source/uibase/inc/chartins.hxx new file mode 100644 index 000000000..dcac7be0b --- /dev/null +++ b/sw/source/uibase/inc/chartins.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_CHARTINS_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CHARTINS_HXX + +#include <tools/gen.hxx> +#include <tools/link.hxx> +#include <com/sun/star/ui/dialogs/DialogClosedEvent.hpp> + +namespace vcl { class Window; } + +Point SwGetChartDialogPos( const vcl::Window *pParentWin, const Size& rDialogSize, const tools::Rectangle& rLogicChart ); + +class SwInsertChart +{ +public: + SwInsertChart( const Link<css::ui::dialogs::DialogClosedEvent*,void>& rLink ); +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_CHARTINS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/chldwrap.hxx b/sw/source/uibase/inc/chldwrap.hxx new file mode 100644 index 000000000..7253d7702 --- /dev/null +++ b/sw/source/uibase/inc/chldwrap.hxx @@ -0,0 +1,47 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_CHLDWRAP_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CHLDWRAP_HXX + +#include <sfx2/childwin.hxx> +#include <vcl/timer.hxx> + +class SwDocShell; + +class SAL_DLLPUBLIC_RTTI SwChildWinWrapper : public SfxChildWindow +{ + Timer m_aUpdateTimer; + SwDocShell* m_pDocSh; + + DECL_DLLPRIVATE_LINK( UpdateHdl, Timer*, void ); + + // Implementation in fldtdlg.cxx +protected: + SwChildWinWrapper(vcl::Window *pParentWindow, sal_uInt16 nId); + +public: + virtual bool ReInitDlg(SwDocShell *pDocSh); + + SwDocShell* GetOldDocShell() { return m_pDocSh; } + void SetOldDocShell(SwDocShell *pDcSh) { m_pDocSh = pDcSh; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/chrdlg.hxx b/sw/source/uibase/inc/chrdlg.hxx new file mode 100644 index 000000000..687d16e0c --- /dev/null +++ b/sw/source/uibase/inc/chrdlg.hxx @@ -0,0 +1,75 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_CHRDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CHRDLG_HXX + +#include <sfx2/tabdlg.hxx> +#include "chrdlgmodes.hxx" +#include <svl/macitem.hxx> +#include <optional> + +class SwView; + +class SwCharDlg final : public SfxTabDialogController +{ + SwView& m_rView; + SwCharDlgMode m_nDialogMode; + +public: + SwCharDlg(weld::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, + SwCharDlgMode nDialogMode, const OUString* pFormatStr); + + virtual ~SwCharDlg() override; + + virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; +}; + +class SwCharURLPage final : public SfxTabPage +{ + std::optional<SvxMacroTableDtor> m_oINetMacroTable; + bool bModified; + + std::unique_ptr<weld::Entry> m_xURLED; + std::unique_ptr<weld::Label> m_xTextFT; + std::unique_ptr<weld::Entry> m_xTextED; + std::unique_ptr<weld::Entry> m_xNameED; + std::unique_ptr<weld::ComboBox> m_xTargetFrameLB; + std::unique_ptr<weld::Button> m_xURLPB; + std::unique_ptr<weld::Button> m_xEventPB; + std::unique_ptr<weld::ComboBox> m_xVisitedLB; + std::unique_ptr<weld::ComboBox> m_xNotVisitedLB; + std::unique_ptr<weld::Widget> m_xCharStyleContainer; + + DECL_LINK(InsertFileHdl, weld::Button&, void); + DECL_LINK(EventHdl, weld::Button&, void); + +public: + SwCharURLPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + + virtual ~SwCharURLPage() override; + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet* rAttrSet); + + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/chrdlgmodes.hxx b/sw/source/uibase/inc/chrdlgmodes.hxx new file mode 100644 index 000000000..cddb6a9c2 --- /dev/null +++ b/sw/source/uibase/inc/chrdlgmodes.hxx @@ -0,0 +1,20 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_CHRDLGMODES_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CHRDLGMODES_HXX + +// DialogModes for SwCharDlg +enum class SwCharDlgMode { + Std, Draw, Env, Ann +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_CHRDLGMODES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/cnttab.hxx b/sw/source/uibase/inc/cnttab.hxx new file mode 100644 index 000000000..e95cc5c62 --- /dev/null +++ b/sw/source/uibase/inc/cnttab.hxx @@ -0,0 +1,57 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_CNTTAB_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CNTTAB_HXX + +#include <sal/types.h> + +#include <toxe.hxx> + +#define TOX_PAGE_SELECT 1 +#define TOX_PAGE_ENTRY 2 +#define TOX_PAGE_STYLES 3 + +#define TO_CONTENT 1 +#define TO_INDEX 2 +#define TO_ILLUSTRATION 4 +#define TO_TABLE 8 +#define TO_USER 16 +#define TO_OBJECT 32 +#define TO_AUTHORITIES 64 +#define TO_BIBLIOGRAPHY 128 + +struct CurTOXType +{ + TOXTypes eType; + sal_uInt16 nIndex; //for TOX_USER only + + bool operator==(const CurTOXType& rCmp) const + { + return eType == rCmp.eType && nIndex == rCmp.nIndex; + } + sal_uInt16 GetFlatIndex() const; + + CurTOXType () : eType (TOX_INDEX), nIndex (0) {}; + + CurTOXType (TOXTypes t) : eType (t), nIndex (0) {}; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/colex.hxx b/sw/source/uibase/inc/colex.hxx new file mode 100644 index 000000000..2abe44298 --- /dev/null +++ b/sw/source/uibase/inc/colex.hxx @@ -0,0 +1,105 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_COLEX_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_COLEX_HXX + +#include <svx/pagectrl.hxx> +#include <editeng/paperinf.hxx> +#include <swdllapi.h> +#include <tgrditem.hxx> +#include <fmtclds.hxx> + +class SwColMgr; +class SfxItemSet; + +class SW_DLLPUBLIC SwPageExample : public SvxPageWindow +{ +protected: + bool m_bVertical; +public: + SwPageExample() + : m_bVertical(false) + { + SetSize(SvxPaperInfo::GetPaperSize(PAPER_A4)); + } + + void UpdateExample( const SfxItemSet& rSet ); +}; + +class SW_DLLPUBLIC SwPageGridExample final : public SwPageExample +{ + std::unique_ptr<SwTextGridItem> m_pGridItem; + + virtual void DrawPage(vcl::RenderContext& rRenderContext, + const Point& rPoint, + const bool bSecond, + const bool bEnabled) override; +public: + SwPageGridExample(); + + void UpdateExample( const SfxItemSet& rSet ); +}; + + +class SW_DLLPUBLIC SwColExample final : public SwPageExample +{ + SwColMgr* m_pColMgr; + + using SwPageExample::UpdateExample; + + virtual void DrawPage(vcl::RenderContext& rRenderContext, + const Point& rPoint, + const bool bSecond, + const bool bEnabled) override; + +public: + SwColExample() + : m_pColMgr(nullptr) + { + } + + void UpdateExample( const SfxItemSet& rSet, SwColMgr* pMgr ) + { + m_pColMgr = pMgr; + SwPageExample::UpdateExample(rSet); + } +}; + +class SW_DLLPUBLIC SwColumnOnlyExample final : public weld::CustomWidgetController +{ +private: + Size m_aWinSize; + + Size m_aFrameSize; + SwFormatCol m_aCols; + + virtual void Resize() override; + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + +public: + SwColumnOnlyExample(); + + void SetColumns(const SwFormatCol& rCol); + + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_COLEX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/colmgr.hxx b/sw/source/uibase/inc/colmgr.hxx new file mode 100644 index 000000000..3a4f43ef6 --- /dev/null +++ b/sw/source/uibase/inc/colmgr.hxx @@ -0,0 +1,126 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_COLMGR_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_COLMGR_HXX + +#include <swdllapi.h> +#include <fmtclds.hxx> + +#include <climits> + +SW_DLLPUBLIC void FitToActualSize(SwFormatCol& rCol, sal_uInt16 nWidth); + +class SW_DLLPUBLIC SwColMgr +{ +public: + // lActWidth is passed directly from the page dialogs edits + SwColMgr(const SfxItemSet &rSet); + ~SwColMgr(); + + inline sal_uInt16 GetCount() const; + void SetCount(sal_uInt16 nCount, sal_uInt16 nGutterWidth); + sal_uInt16 GetGutterWidth(sal_uInt16 nPos = USHRT_MAX) const; + void SetGutterWidth(sal_uInt16 nWidth, sal_uInt16 nPos = USHRT_MAX); + + sal_uInt16 GetColWidth(sal_uInt16 nIdx) const; + void SetColWidth(sal_uInt16 nIdx, sal_uInt16 nWidth); + + inline bool IsAutoWidth() const; + void SetAutoWidth(bool bOn, sal_uInt16 lGutterWidth = 0); + + inline bool HasLine() const; + inline void SetNoLine(); + + void SetLineWidthAndColor(SvxBorderLineStyle eStyle, sal_uLong nWidth, const Color& rCol); + inline SvxBorderLineStyle GetLineStyle() const; + inline sal_uLong GetLineWidth() const; + inline const Color& GetLineColor() const; + + inline SwColLineAdj GetAdjust() const; + inline void SetAdjust(SwColLineAdj); + + short GetLineHeightPercent() const; + void SetLineHeightPercent(short nPercent); + + inline void NoCols(); + + const SwFormatCol& GetColumns() const { return m_aFormatCol; } + + void SetActualWidth(sal_uInt16 nW); + sal_uInt16 GetActualSize() const { return m_nWidth; } + +private: + SwFormatCol m_aFormatCol; + sal_uInt16 m_nWidth; +}; + +inline sal_uInt16 SwColMgr::GetCount() const +{ + return m_aFormatCol.GetNumCols(); +} + +inline SvxBorderLineStyle SwColMgr::GetLineStyle() const +{ + return m_aFormatCol.GetLineStyle(); +} +inline sal_uLong SwColMgr::GetLineWidth() const +{ + return m_aFormatCol.GetLineWidth(); +} + +inline const Color& SwColMgr::GetLineColor() const +{ + return m_aFormatCol.GetLineColor(); +} + +inline SwColLineAdj SwColMgr::GetAdjust() const +{ + return m_aFormatCol.GetLineAdj(); +} + +inline void SwColMgr::SetAdjust(SwColLineAdj eAdj) +{ + m_aFormatCol.SetLineAdj(eAdj); +} +inline bool SwColMgr::IsAutoWidth() const +{ + return m_aFormatCol.IsOrtho(); +} +inline void SwColMgr::SetAutoWidth(bool bOn, sal_uInt16 nGutterWidth) +{ + m_aFormatCol.SetOrtho(bOn, nGutterWidth, m_nWidth); +} + +inline void SwColMgr::NoCols() +{ + m_aFormatCol.GetColumns().clear(); +} +inline bool SwColMgr::HasLine() const +{ + return GetAdjust() != COLADJ_NONE; +} + +inline void SwColMgr::SetNoLine() +{ + SetAdjust(COLADJ_NONE); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx new file mode 100644 index 000000000..98b335a8a --- /dev/null +++ b/sw/source/uibase/inc/column.hxx @@ -0,0 +1,203 @@ +/* -*- 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 + +#include <svtools/ctrlbox.hxx> +#include <svtools/valueset.hxx> +#include <sfx2/basedlgs.hxx> +#include <sfx2/tabdlg.hxx> +#include <svx/colorbox.hxx> +#include <svx/frmdirlbox.hxx> +#include <map> +#include "colex.hxx" +#include "prcntfld.hxx" + +const int nMaxCols = 99; +class SwColMgr; +class SwWrtShell; +class SwColumnPage; + +class SwColumnDlg final : public SfxDialogController +{ + SwWrtShell& m_rWrtShell; + std::unique_ptr<SwColumnPage> m_xTabPage; + std::unique_ptr<SfxItemSet> m_pPageSet; + std::unique_ptr<SfxItemSet> m_pSectionSet; + std::unique_ptr<SfxItemSet> m_pSelectionSet; + SfxItemSet* m_pFrameSet; + + tools::Long m_nOldSelection; + tools::Long m_nSelectionWidth; + tools::Long m_nPageWidth; + + bool m_bPageChanged : 1; + bool m_bSectionChanged : 1; + bool m_bSelSectionChanged : 1; + bool m_bFrameChanged : 1; + + std::unique_ptr<weld::Container> m_xContentArea; + std::unique_ptr<weld::Button> m_xOkButton; + + DECL_LINK(ObjectListBoxHdl, weld::ComboBox&, void); + DECL_LINK(OkHdl, weld::Button&, void); + void ObjectHdl(const weld::ComboBox*); + SfxItemSet* EvalCurrentSelection(void); + +public: + SwColumnDlg(weld::Window* pParent, SwWrtShell& rSh); + virtual ~SwColumnDlg() override; +}; + +class ColumnValueSet final : public ValueSet +{ +public: + ColumnValueSet() + : ValueSet(nullptr) + { + } + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override + { + ValueSet::SetDrawingArea(pDrawingArea); + SetStyle(WB_TABSTOP | WB_ITEMBORDER | WB_DOUBLEBORDER); + } + virtual void UserDraw(const UserDrawEvent& rUDEvt) override; + virtual void StyleUpdated() override; +}; + +// column dialog now as TabPage +class SwColumnPage final : public SfxTabPage +{ + std::unique_ptr<SwColMgr> m_xColMgr; + + sal_uInt16 m_nFirstVis; + sal_uInt16 m_nCols; + tools::Long m_nColWidth[nMaxCols]; + tools::Long m_nColDist[nMaxCols]; + SwPercentField* m_pModifiedField; + + std::map<weld::MetricSpinButton*, SwPercentField*> m_aPercentFieldsMap; + + bool m_bFormat; + bool m_bFrame; + bool m_bHtmlMode; + bool m_bLockUpdate; + + ColumnValueSet m_aDefaultVS; + SwColExample m_aPgeExampleWN; + SwColumnOnlyExample m_aFrameExampleWN; + + std::unique_ptr<weld::SpinButton> m_xCLNrEdt; + std::unique_ptr<weld::CheckButton> m_xBalanceColsCB; + std::unique_ptr<weld::Button> m_xBtnBack; + std::unique_ptr<weld::Label> m_xLbl1; + std::unique_ptr<weld::Label> m_xLbl2; + std::unique_ptr<weld::Label> m_xLbl3; + std::unique_ptr<weld::Button> m_xBtnNext; + std::unique_ptr<weld::CheckButton> m_xAutoWidthBox; + std::unique_ptr<weld::Label> m_xLineTypeLbl; + std::unique_ptr<weld::Label> m_xLineWidthLbl; + std::unique_ptr<weld::MetricSpinButton> m_xLineWidthEdit; + std::unique_ptr<weld::Label> m_xLineColorLbl; + std::unique_ptr<weld::Label> m_xLineHeightLbl; + std::unique_ptr<weld::MetricSpinButton> m_xLineHeightEdit; + std::unique_ptr<weld::Label> m_xLinePosLbl; + std::unique_ptr<weld::ComboBox> m_xLinePosDLB; + std::unique_ptr<weld::Label> m_xTextDirectionFT; + std::unique_ptr<svx::FrameDirectionListBox> m_xTextDirectionLB; + std::unique_ptr<ColorListBox> m_xLineColorDLB; + std::unique_ptr<SvtLineListBox> m_xLineTypeDLB; + std::unique_ptr<SwPercentField> m_xEd1; + std::unique_ptr<SwPercentField> m_xEd2; + std::unique_ptr<SwPercentField> m_xEd3; + std::unique_ptr<SwPercentField> m_xDistEd1; + std::unique_ptr<SwPercentField> m_xDistEd2; + std::unique_ptr<weld::CustomWeld> m_xDefaultVS; + // Example + std::unique_ptr<weld::CustomWeld> m_xPgeExampleWN; + std::unique_ptr<weld::CustomWeld> m_xFrameExampleWN; + + std::unique_ptr<weld::Label> m_xApplyToFT; + std::unique_ptr<weld::ComboBox> m_xApplyToLB; + + // Handler + DECL_LINK(ColModify, weld::SpinButton&, void); + void ColModify(bool bForceColReset); + DECL_LINK(GapModify, weld::MetricSpinButton&, void); + DECL_LINK(EdModify, weld::MetricSpinButton&, void); + DECL_LINK(AutoWidthHdl, weld::Toggleable&, void ); + DECL_LINK(SetDefaultsHdl, ValueSet *, void); + + DECL_LINK(Up, weld::Button&, void); + DECL_LINK(Down, weld::Button&, void); + DECL_LINK(UpdateColMgr, weld::MetricSpinButton&, void); + DECL_LINK(UpdateColMgrListBox, weld::ComboBox&, void); + DECL_LINK(UpdateColMgrLineBox, SvtLineListBox&, void); + DECL_LINK(UpdateColMgrColorBox, ColorListBox&, void); + void Timeout(); + + void Update(const weld::MetricSpinButton* pInteractiveField); + void UpdateCols(); + void Init(); + void ResetColWidth(); + void SetLabels( sal_uInt16 nVis ); + + virtual void ActivatePage(const SfxItemSet& rSet) override; + virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; + + void connectPercentField(SwPercentField &rWrap); + + bool isLineNotNone() const; + + static const WhichRangesContainer aPageRg; + +public: + SwColumnPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet); + virtual ~SwColumnPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet); + static WhichRangesContainer GetRanges() { return aPageRg; } + + virtual bool FillItemSet(SfxItemSet *rSet) override; + virtual void Reset(const SfxItemSet *rSet) override; + + void SetFrameMode(bool bMod); + void SetPageWidth(tools::Long nPageWidth); + + void SetFormatUsed(bool bFormatUsed) + { + m_bFormat = bFormatUsed; + } + + void ShowBalance(bool bShow) + { + m_xBalanceColsCB->set_visible(bShow); + } + + void SetInSection(bool bSet); + + void ActivateColumnControl() + { + m_xCLNrEdt->grab_focus(); + } + + weld::Label* GetApplyLabel() { return m_xApplyToFT.get(); } + weld::ComboBox* GetApplyComboBox() { return m_xApplyToLB.get(); } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/conarc.hxx b/sw/source/uibase/inc/conarc.hxx new file mode 100644 index 000000000..eb65042f3 --- /dev/null +++ b/sw/source/uibase/inc/conarc.hxx @@ -0,0 +1,43 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_CONARC_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CONARC_HXX + +#include "drawbase.hxx" + +// draw rectangle +class ConstArc final : public SwDrawBase +{ + Point m_aStartPoint; + sal_uInt16 m_nButtonUpCount; + +public: + ConstArc(SwWrtShell* pSh, SwEditWin* pWin, SwView* pView); + + // Mouse- & Key-Events + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate(const sal_uInt16 nSlotId) override; // activate function + virtual void Deactivate() override; +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_CONARC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/concustomshape.hxx b/sw/source/uibase/inc/concustomshape.hxx new file mode 100644 index 000000000..cc2358cee --- /dev/null +++ b/sw/source/uibase/inc/concustomshape.hxx @@ -0,0 +1,58 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_CONCUSTOMSHAPE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CONCUSTOMSHAPE_HXX + +#include <rtl/ustring.hxx> +#include "drawbase.hxx" + +class SdrObject; +class SfxRequest; + +// draw rectangle +class ConstCustomShape final : public SwDrawBase +{ + + OUString m_aCustomShape; + + void SetAttributes( SdrObject* pObj ); + + public: + + ConstCustomShape( SwWrtShell* pSh, SwEditWin* pWin, SwView* pView, SfxRequest const & rReq ); + + // Mouse- & Key-Events + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate(const sal_uInt16 nSlotId) override; // activate function + + const OUString& GetShapeType() const; + static OUString GetShapeTypeFromRequest( SfxRequest const & rReq ); + + virtual void CreateDefaultObject() override; + virtual void CreateDefaultObjectAtPosWithSize(Point aPos, Size aSize) override; + + // #i33136# + virtual bool doConstructOrthogonal() const override; +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_CONCUSTOMSHAPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/condedit.hxx b/sw/source/uibase/inc/condedit.hxx new file mode 100644 index 000000000..ec11b8872 --- /dev/null +++ b/sw/source/uibase/inc/condedit.hxx @@ -0,0 +1,75 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_CONDEDIT_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CONDEDIT_HXX + +#include <vcl/transfer.hxx> +#include <vcl/weld.hxx> +#include <swdllapi.h> + +class ConditionEdit; + +class SW_DLLPUBLIC ConditionEditDropTarget final : public DropTargetHelper +{ +private: + ConditionEdit& m_rEdit; + + SAL_DLLPRIVATE virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override; + SAL_DLLPRIVATE virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override; + +public: + ConditionEditDropTarget(ConditionEdit& rEdit); +}; + +class SW_DLLPUBLIC ConditionEdit +{ + std::unique_ptr<weld::Entry> m_xControl; + ConditionEditDropTarget m_aDropTargetHelper; + bool m_bBrackets, m_bEnableDrop; + +public: + ConditionEdit(std::unique_ptr<weld::Entry> xControl); + + OUString get_text() const { return m_xControl->get_text(); } + void set_text(const OUString& rText) { m_xControl->set_text(rText); } + void set_visible(bool bVisible) { m_xControl->set_visible(bVisible); } + void set_accessible_name(const OUString& rName) { m_xControl->set_accessible_name(rName); } + void save_value() { m_xControl->save_value(); } + bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); } + void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); } + void connect_changed(const Link<weld::Entry&, void>& rLink) + { + m_xControl->connect_changed(rLink); + } + void replace_selection(const OUString& rText) { m_xControl->replace_selection(rText); } + void hide() { m_xControl->hide(); } + weld::Entry& get_widget() { return *m_xControl; } + + OString get_buildable_name() const { return m_xControl->get_buildable_name(); } + void set_buildable_name(const OString& rId) { m_xControl->set_buildable_name(rId); } + + void ShowBrackets(bool bShow) { m_bBrackets = bShow; } + bool GetBrackets() const { return m_bBrackets; } + void SetDropEnable(bool bFlag) { m_bEnableDrop = bFlag; } + bool GetDropEnable() const { return m_bEnableDrop; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/conform.hxx b/sw/source/uibase/inc/conform.hxx new file mode 100644 index 000000000..e0585f262 --- /dev/null +++ b/sw/source/uibase/inc/conform.hxx @@ -0,0 +1,39 @@ +/* -*- 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 + +#include "drawbase.hxx" +#include <svx/svdobjkind.hxx> + +class ConstFormControl final : public SwDrawBase +{ +private: + SdrObjKind m_eObjKind; + +public: + ConstFormControl(SwWrtShell* pSh, SwEditWin* pWin, SwView* pView, SdrObjKind eObjKind); + + // Mouse- & Key-Events + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate(const sal_uInt16 nSlotId) override; // activate function + virtual void CreateDefaultObject() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/conpoly.hxx b/sw/source/uibase/inc/conpoly.hxx new file mode 100644 index 000000000..377eb685b --- /dev/null +++ b/sw/source/uibase/inc/conpoly.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_CONPOLY_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CONPOLY_HXX + +#include "drawbase.hxx" + +// base class for all functions +class ConstPolygon final : public SwDrawBase +{ +public: + ConstPolygon(SwWrtShell* pSh, SwEditWin* pWin, SwView* pView); + + // Mouse- & Key-Events + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + + virtual void Activate(const sal_uInt16 nSlotId) override; // activate function +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_CONPOLY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/conrect.hxx b/sw/source/uibase/inc/conrect.hxx new file mode 100644 index 000000000..bc290f8e8 --- /dev/null +++ b/sw/source/uibase/inc/conrect.hxx @@ -0,0 +1,45 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_CONRECT_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CONRECT_HXX + +#include "drawbase.hxx" + +// draw rectangle +class ConstRectangle final : public SwDrawBase +{ + bool m_bMarquee; + bool m_bCapVertical; + + bool mbVertical; + + public: + ConstRectangle(SwWrtShell* pSh, SwEditWin* pWin, SwView* pView); + + // Mouse- & Key-Events + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + + virtual void Activate(const sal_uInt16 nSlotId) override; // activate function +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_CONRECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/content.hxx b/sw/source/uibase/inc/content.hxx new file mode 100644 index 000000000..0acc45197 --- /dev/null +++ b/sw/source/uibase/inc/content.hxx @@ -0,0 +1,222 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_CONTENT_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CONTENT_HXX +#include <memory> +#include "swcont.hxx" + +#include <ndarr.hxx> +#include <tools/long.hxx> + +class SwWrtShell; +class SwContentArr; +class SwContentType; +class SwFormatField; +class SwTextINetFormat; +class SwTOXBase; +class SwRangeRedline; +class SwTextFootnote; + +// helper classes + +class SwOutlineContent final : public SwContent +{ + SwOutlineNodes::size_type m_nOutlinePos; + sal_uInt8 m_nOutlineLevel; + bool m_bIsMoveable; + public: + SwOutlineContent( const SwContentType* pCnt, + const OUString& rName, + SwOutlineNodes::size_type nArrPos, + sal_uInt8 nLevel, + bool bMove, + double nYPos) : + SwContent(pCnt, rName, nYPos), + m_nOutlinePos(nArrPos), m_nOutlineLevel(nLevel), m_bIsMoveable(bMove) {} + + SwOutlineNodes::size_type GetOutlinePos() const {return m_nOutlinePos;} + sal_uInt8 GetOutlineLevel() const {return m_nOutlineLevel;} + bool IsMoveable() const {return m_bIsMoveable;}; +}; + +class SwRegionContent final : public SwContent +{ + + sal_uInt8 m_nRegionLevel; + + public: + SwRegionContent( const SwContentType* pCnt, + const OUString& rName, + sal_uInt8 nLevel, + tools::Long nYPos) : + SwContent(pCnt, rName, nYPos), + m_nRegionLevel(nLevel){} + sal_uInt8 GetRegionLevel() const {return m_nRegionLevel;} +}; + +class SwURLFieldContent final : public SwContent +{ + OUString m_sURL; + const SwTextINetFormat* m_pINetAttr; + +public: + SwURLFieldContent( const SwContentType* pCnt, + const OUString& rName, + const OUString& rURL, + const SwTextINetFormat* pAttr, + tools::Long nYPos ) + : SwContent( pCnt, rName, nYPos ), m_sURL( rURL ), m_pINetAttr( pAttr ) + {} + + virtual bool IsProtect() const override; + const OUString& GetURL() const { return m_sURL; } + const SwTextINetFormat* GetINetAttr() const { return m_pINetAttr; } +}; + +class SwTextFieldContent final : public SwContent +{ + const SwFormatField* m_pFormatField; +public: + SwTextFieldContent(const SwContentType* pCnt, + const OUString& rName, + const SwFormatField* pFormatField, + tools::Long nYPos) + : SwContent(pCnt, rName, nYPos), + m_pFormatField(pFormatField) + {} + + const SwFormatField* GetFormatField() const {return m_pFormatField;} + virtual bool IsProtect() const override; +}; + +class SwTextFootnoteContent final : public SwContent +{ + const SwTextFootnote* m_pTextFootnote; +public: + SwTextFootnoteContent(const SwContentType* pCnt, + const OUString& rName, + const SwTextFootnote* pTextFootnote, + tools::Long nYPos) + : SwContent(pCnt, rName, nYPos), + m_pTextFootnote(pTextFootnote) + {} + + const SwTextFootnote* GetTextFootnote() const {return m_pTextFootnote;} +}; + +class SwPostItContent final : public SwContent +{ + const SwFormatField* m_pField; +public: + SwPostItContent( const SwContentType* pCnt, + const OUString& rName, + const SwFormatField* pFormatField, + tools::Long nYPos ) + : SwContent(pCnt, rName, nYPos) + , m_pField(pFormatField) + {} + + const SwFormatField* GetPostIt() const { return m_pField; } + virtual bool IsProtect() const override; +}; + +class SwGraphicContent final : public SwContent +{ + OUString m_sLink; +public: + SwGraphicContent(const SwContentType* pCnt, const OUString& rName, const OUString& rLink, tools::Long nYPos) + : SwContent( pCnt, rName, nYPos ), m_sLink( rLink ) + {} + virtual ~SwGraphicContent() override; + + const OUString& GetLink() const {return m_sLink;} +}; + +class SwTOXBaseContent final : public SwContent +{ + const SwTOXBase* m_pBase; +public: + SwTOXBaseContent(const SwContentType* pCnt, const OUString& rName, tools::Long nYPos, const SwTOXBase& rBase) + : SwContent( pCnt, rName, nYPos ), m_pBase(&rBase) + {} + virtual ~SwTOXBaseContent() override; + + const SwTOXBase* GetTOXBase() const {return m_pBase;} +}; + +/** + * Content type, knows it's contents and the WrtShell. + * + * The class ContentType contains information to one type of content. + * MemberArray is only populated if the content is requested by + * GetMember. It is reloaded after Invalidate() only if the content + * should be read again. +*/ +class SwContentType final : public SwTypeNumber +{ + SwWrtShell* m_pWrtShell; + std::unique_ptr<SwContentArr> + m_pMember; // array for content + OUString m_sContentTypeName; // name of content type + OUString m_sSingleContentTypeName; // name of content type, singular + OUString m_sTypeToken; // attachment for URL + size_t m_nMemberCount; // content count + ContentTypeId m_nContentType; // content type's Id + sal_uInt8 m_nOutlineLevel; + bool m_bDataValid : 1; + bool m_bEdit: 1; // can this type be edited? + bool m_bDelete: 1; // can this type be deleted? + + bool m_bAlphabeticSort = false; + + static OUString RemoveNewline(const OUString&); +public: + SwContentType(SwWrtShell* pParent, ContentTypeId nType, sal_uInt8 nLevel ); + virtual ~SwContentType() override; + + /** Fill the List of contents */ + void FillMemberList(bool* pbContentChanged = nullptr); + size_t GetMemberCount() const + {return m_nMemberCount;}; + ContentTypeId GetType() const {return m_nContentType;} + + /** Deliver content, for that if necessary fill the list */ + const SwContent* GetMember(size_t nIndex); + const OUString& GetName() const {return m_sContentTypeName;} + const OUString& GetSingleName() const {return m_sSingleContentTypeName;} + const OUString& GetTypeToken() const{return m_sTypeToken;} + + void SetOutlineLevel(sal_uInt8 nNew) + { + m_nOutlineLevel = nNew; + Invalidate(); + } + + bool GetSortType() const {return m_bAlphabeticSort;} + void SetSortType(bool bAlphabetic) {m_bAlphabeticSort = bAlphabetic;} + + void Invalidate(); // only nMemberCount is read again + + bool IsEditable() const {return m_bEdit;} + bool IsDeletable() const {return m_bDelete;} +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/contentcontroldlg.hxx b/sw/source/uibase/inc/contentcontroldlg.hxx new file mode 100644 index 000000000..7654e3d6b --- /dev/null +++ b/sw/source/uibase/inc/contentcontroldlg.hxx @@ -0,0 +1,72 @@ +/* -*- 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 + +#include <sfx2/basedlgs.hxx> +#include <vcl/weld.hxx> + +class SwWrtShell; +class SwContentControl; +class SwContentControlListItem; +class SwNumFormatTreeView; + +/** + * The content control dialog allows editing the properties of the content control under the + * cursor. + */ +class SwContentControlDlg final : public SfxDialogController +{ + SwWrtShell& m_rWrtShell; + std::shared_ptr<SwContentControl> m_pContentControl; + std::vector<SwContentControlListItem> m_aSavedListItems; + + std::unique_ptr<weld::CheckButton> m_xShowingPlaceHolderCB; + std::unique_ptr<weld::Frame> m_xCheckboxFrame; + std::unique_ptr<weld::Entry> m_xCheckedState; + std::unique_ptr<weld::Button> m_xCheckedStateBtn; + std::unique_ptr<weld::Entry> m_xUncheckedState; + std::unique_ptr<weld::Button> m_xUncheckedStateBtn; + std::unique_ptr<weld::Frame> m_xListItemsFrame; + std::unique_ptr<weld::TreeView> m_xListItems; + std::unique_ptr<weld::Box> m_xListItemButtons; + std::unique_ptr<weld::Button> m_xInsertBtn; + std::unique_ptr<weld::Button> m_xRenameBtn; + std::unique_ptr<weld::Button> m_xDeleteBtn; + std::unique_ptr<weld::Button> m_xMoveUpBtn; + std::unique_ptr<weld::Button> m_xMoveDownBtn; + std::unique_ptr<weld::Frame> m_xDateFrame; + std::unique_ptr<SwNumFormatTreeView> m_xDateFormat; + + std::unique_ptr<weld::Button> m_xOk; + + DECL_LINK(InsertHdl, weld::Button&, void); + DECL_LINK(RenameHdl, weld::Button&, void); + DECL_LINK(DeleteHdl, weld::Button&, void); + DECL_LINK(MoveUpHdl, weld::Button&, void); + DECL_LINK(MoveDownHdl, weld::Button&, void); + DECL_LINK(SelectionChangedHdl, weld::TreeView&, void); + DECL_LINK(OkHdl, weld::Button&, void); + DECL_LINK(SelectCharHdl, weld::Button&, void); + +public: + SwContentControlDlg(weld::Window* pParent, SwWrtShell& rSh); + virtual ~SwContentControlDlg() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/contentcontrollistitemdlg.hxx b/sw/source/uibase/inc/contentcontrollistitemdlg.hxx new file mode 100644 index 000000000..2367de484 --- /dev/null +++ b/sw/source/uibase/inc/contentcontrollistitemdlg.hxx @@ -0,0 +1,40 @@ +/* -*- 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 + +#include <vcl/weld.hxx> + +class SwContentControlListItem; + +/// Edits the properties of a sing list item in a (drop-down) content control. +class SwContentControlListItemDlg final : public weld::GenericDialogController +{ + SwContentControlListItem& m_rItem; + + std::unique_ptr<weld::Entry> m_xDisplayNameED; + std::unique_ptr<weld::Entry> m_xValueED; + std::unique_ptr<weld::Button> m_xOk; + + DECL_LINK(OkHdl, weld::Button&, void); + +public: + SwContentControlListItemDlg(weld::Widget* pParent, SwContentControlListItem& rItem); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx new file mode 100644 index 000000000..9f595def2 --- /dev/null +++ b/sw/source/uibase/inc/conttree.hxx @@ -0,0 +1,387 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_CONTTREE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CONTTREE_HXX + +#include <svl/lstner.hxx> +#include <vcl/timer.hxx> +#include <vcl/transfer.hxx> +#include <vcl/weld.hxx> +#include <ndarr.hxx> +#include "swcont.hxx" + +#include <map> +#include <memory> + +#include <o3tl/enumarray.hxx> +#include <o3tl/typed_flags_set.hxx> + +class SwWrtShell; +class SwContentType; +class SwNavigationPI; +class SwNavigationConfig; +class Menu; +class ToolBox; +class SwGlblDocContents; +class SwGlblDocContent; +class SfxObjectShell; +class SdrObject; + +enum class EditEntryMode +{ + EDIT = 0, + UPD_IDX = 1, + RMV_IDX = 2, + UNPROTECT_TABLE = 3, + DELETE = 4, + RENAME = 5, +}; + +// Flags for PopupMenu-enable/disable +enum class MenuEnableFlags { + NONE = 0x0000, + InsertIdx = 0x0001, + InsertFile = 0x0002, + InsertText = 0x0004, + Edit = 0x0008, + Delete = 0x0010, + Update = 0x0020, + UpdateSel = 0x0040, + EditLink = 0x0080 +}; +namespace o3tl { + template<> struct typed_flags<MenuEnableFlags> : is_typed_flags<MenuEnableFlags, 0x00ff> {}; +} + +class SwContentTree; + +class SwContentTreeDropTarget final : public DropTargetHelper +{ +private: + SwContentTree& m_rTreeView; + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; + +public: + SwContentTreeDropTarget(SwContentTree& rTreeView); +}; + +/** TreeListBox for content indicator */ +class SwContentTree final : public SfxListener +{ + std::unique_ptr<weld::TreeView> m_xTreeView; + std::unique_ptr<weld::TreeIter> m_xScratchIter; + SwContentTreeDropTarget m_aDropTargetHelper; + SwNavigationPI* m_pDialog; + OUString m_sSpace; + AutoTimer m_aUpdTimer; + + o3tl::enumarray<ContentTypeId,std::unique_ptr<SwContentType>> m_aActiveContentArr; + o3tl::enumarray<ContentTypeId,std::unique_ptr<SwContentType>> m_aHiddenContentArr; + OUString m_aContextStrings[CONTEXT_COUNT + 1]; + OUString m_sInvisible; + + SwWrtShell* m_pHiddenShell; // dropped Doc + SwWrtShell* m_pActiveShell; // the active or a const. open view + SwNavigationConfig* m_pConfig; + + std::map< void*, bool > mOutLineNodeMap; + + sal_Int32 m_nActiveBlock; + sal_Int32 m_nHiddenBlock; + size_t m_nEntryCount; + ContentTypeId m_nRootType; + ContentTypeId m_nLastSelType; + sal_uInt8 m_nOutlineLevel; + + sal_uInt8 m_nOutlineTracking = 1; // 1 default, 2 focus, 3 off + o3tl::enumarray<ContentTypeId, bool> mTrackContentType; + + SwOutlineNodes::size_type m_nLastGotoContentWasOutlinePos = SwOutlineNodes::npos; + + enum class State { ACTIVE, CONSTANT, HIDDEN } m_eState; + + bool m_bIsRoot :1; + bool m_bIsIdleClear :1; + bool m_bIsLastReadOnly :1; + bool m_bIsOutlineMoveable :1; + bool m_bViewHasChanged :1; + + // outline root mode drag & drop + std::vector<std::unique_ptr<weld::TreeIter>> m_aDndOutlinesSelected; + + bool m_bDocHasChanged = true; + bool m_bIgnoreDocChange = false; // used to prevent tracking update + + /** + * Before any data will be deleted, the last active entry has to be found. + * After this the UserData will be deleted + */ + void FindActiveTypeAndRemoveUserData(); + + void insert(const weld::TreeIter* pParent, const OUString& rStr, const OUString& rId, + bool bChildrenOnDemand, weld::TreeIter* pRet); + + void remove(const weld::TreeIter& rIter); + + SwNavigationPI* GetParentWindow(); + + bool FillTransferData( TransferDataContainer& rTransfer, + sal_Int8& rDragMode ); + + /** Check if the displayed content is valid. */ + bool HasContentChanged(); + + size_t GetAbsPos(const weld::TreeIter& rIter); + + void EditEntry(const weld::TreeIter& rEntry, EditEntryMode nMode); + + void GotoContent(const SwContent* pCnt); + + void ExecuteContextMenuAction(const OString& rSelectedPopupEntry); + + void DeleteOutlineSelections(); + void CopyOutlineSelections(); + + size_t GetEntryCount() const; + + size_t GetChildCount(const weld::TreeIter& rParent) const; + + std::unique_ptr<weld::TreeIter> GetEntryAtAbsPos(size_t nAbsPos) const; + + void Expand(const weld::TreeIter& rParent, std::vector<std::unique_ptr<weld::TreeIter>>* pNodesToExpand); + + void MoveOutline(SwOutlineNodes::size_type nTargetPos); + + void UpdateLastSelType(); + + /** Expand - Remember the state for content types */ + DECL_LINK(ExpandHdl, const weld::TreeIter&, bool); + /** Collapse - Remember the state for content types. */ + DECL_LINK(CollapseHdl, const weld::TreeIter&, bool); + DECL_LINK(ContentDoubleClickHdl, weld::TreeView&, bool); + DECL_LINK(SelectHdl, weld::TreeView&, void); + DECL_LINK(FocusInHdl, weld::Widget&, void); + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(CommandHdl, const CommandEvent&, bool); + DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString); + DECL_LINK(DragBeginHdl, bool&, bool); + DECL_LINK(TimerUpdate, Timer *, void); + +public: + SwContentTree(std::unique_ptr<weld::TreeView> xTreeView, SwNavigationPI* pDialog); + ~SwContentTree(); + SdrObject* GetDrawingObjectsByContent(const SwContent *pCnt); + + /** Switch the display to Root */ + void ToggleToRoot(); + void SetRootType(ContentTypeId nType); + + /** Show the file */ + void Display( bool bActiveView ); + /** In the clear the content types have to be deleted, also. */ + void clear(); + + /** After a file is dropped on the Navigator, the new shell will be set */ + void SetHiddenShell(SwWrtShell* pSh); + void ShowHiddenShell(); + void ShowActualView(); + + /** Document change - set new Shell */ + void SetActiveShell(SwWrtShell* pSh); + + /** Set an open view as active. */ + void SetConstantShell(SwWrtShell* pSh); + + SwWrtShell* GetWrtShell() + { return State::HIDDEN == m_eState ? m_pHiddenShell : m_pActiveShell; } + + bool IsInDrag() const; + + sal_uInt8 GetOutlineLevel()const {return m_nOutlineLevel;} + void SetOutlineLevel(sal_uInt8 nSet); + + void SetOutlineTracking(sal_uInt8 nSet); + void SetContentTypeTracking(ContentTypeId eCntTypeId, bool bSet); + + /** Execute commands of the Navigator */ + void ExecCommand(std::string_view rCmd, bool bModifier); + + void ShowTree(); + void HideTree(); + + bool IsConstantView() const { return State::CONSTANT == m_eState; } + bool IsActiveView() const { return State::ACTIVE == m_eState; } + bool IsHiddenView() const { return State::HIDDEN == m_eState; } + + const SwWrtShell* GetActiveWrtShell() const {return m_pActiveShell;} + SwWrtShell* GetHiddenWrtShell() {return m_pHiddenShell;} + + void Select(); + + void UpdateTracking(); + void SelectOutlinesWithSelection(); + void SelectContentType(std::u16string_view rContentTypeName); + + // return true if it has any children + bool RequestingChildren(const weld::TreeIter& rParent); + + virtual void Notify(SfxBroadcaster& rBC, SfxHint const& rHint) override; + + sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt); + sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt); + + bool IsDropFormatSupported(SotClipboardFormatId nFormat) + { + return m_aDropTargetHelper.IsDropFormatSupported(nFormat); + } + + void set_accessible_name(const OUString& rName) + { + m_xTreeView->set_accessible_name(rName); + } + + void grab_focus() + { + m_xTreeView->grab_focus(); + } + + void set_selection_mode(SelectionMode eMode) + { + m_xTreeView->set_selection_mode(eMode); + } + + weld::TreeView& get_widget() + { + return *m_xTreeView; + } +}; + +namespace sfx2 { class DocumentInserter; } +namespace sfx2 { class FileDialogHelper; } + +class SwGlobalTree; + +class SwGlobalTreeDropTarget final : public DropTargetHelper +{ +private: + SwGlobalTree& m_rTreeView; + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; + +public: + SwGlobalTreeDropTarget(SwGlobalTree& rTreeView); +}; + +class SwGlobalTree final : public SfxListener +{ +private: + std::unique_ptr<weld::TreeView> m_xTreeView; + SwGlobalTreeDropTarget m_aDropTargetHelper; + SwNavigationPI* m_pDialog; + AutoTimer m_aUpdateTimer; + OUString m_aContextStrings[GLOBAL_CONTEXT_COUNT]; + + SwWrtShell* m_pActiveShell; + std::unique_ptr<SwGlblDocContents> m_pSwGlblDocContents; // array with sorted content + + std::unique_ptr<SwGlblDocContent> m_pDocContent; + std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter; + + static const SfxObjectShell* s_pShowShell; + + void InsertRegion( const SwGlblDocContent* _pContent, + const css::uno::Sequence< OUString >& _rFiles ); + + DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper*, void ); + + void Select(); + + DECL_LINK(Timeout, Timer*, void); + DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); + DECL_LINK(SelectHdl, weld::TreeView&, void); + DECL_LINK(FocusInHdl, weld::Widget&, void); + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(CommandHdl, const CommandEvent&, bool); + DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString); + + SwNavigationPI* GetParentWindow(); + + void OpenDoc(const SwGlblDocContent*); + void GotoContent(const SwGlblDocContent*); + MenuEnableFlags GetEnableFlags() const; + + static void SetShowShell(const SfxObjectShell*pSet) {s_pShowShell = pSet;} + DECL_STATIC_LINK(SwGlobalTree, ShowFrameHdl, void*, void); + +public: + SwGlobalTree(std::unique_ptr<weld::TreeView> xTreeView, SwNavigationPI* pDialog); + ~SwGlobalTree(); + + bool get_visible() const { return m_xTreeView->get_visible(); } + + void set_accessible_name(const OUString& rName) + { + m_xTreeView->set_accessible_name(rName); + } + + void grab_focus() + { + m_xTreeView->grab_focus(); + } + + void set_selection_mode(SelectionMode eMode) + { + m_xTreeView->set_selection_mode(eMode); + } + + weld::TreeView& get_widget() + { + return *m_xTreeView; + } + + void MoveSelectionTo(const weld::TreeIter* pDropTarget); + + void TbxMenuHdl(std::string_view rCommand, weld::Menu& rMenu); + void InsertRegion( const SwGlblDocContent* pCont, + const OUString* pFileName = nullptr ); + void EditContent(const SwGlblDocContent* pCont ); + + void ShowTree(); + void HideTree(); + + void ExecCommand(std::string_view rCmd); + + void Display(bool bOnlyUpdateUserData = false); + + bool Update(bool bHard); + + void ExecuteContextMenuAction(std::string_view rSelectedPopupEntry); + + const SwWrtShell* GetActiveWrtShell() const {return m_pActiveShell;} + + virtual void Notify(SfxBroadcaster& rBC, SfxHint const& rHint) override; + void UpdateTracking(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/convert.hxx b/sw/source/uibase/inc/convert.hxx new file mode 100644 index 000000000..fabfeca26 --- /dev/null +++ b/sw/source/uibase/inc/convert.hxx @@ -0,0 +1,68 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_CONVERT_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CONVERT_HXX + +#include <sfx2/basedlgs.hxx> +#include <tblafmt.hxx> + +class VclContainer; +class SwTableAutoFormat; +class SwView; +class SwWrtShell; +struct SwInsertTableOptions; + +class SwConvertTableDlg final : public SfxDialogController +{ + std::unique_ptr<weld::RadioButton> m_xTabBtn; + std::unique_ptr<weld::RadioButton> m_xSemiBtn; + std::unique_ptr<weld::RadioButton> m_xParaBtn; + std::unique_ptr<weld::RadioButton> m_xOtherBtn; + std::unique_ptr<weld::Entry> m_xOtherEd; + std::unique_ptr<weld::CheckButton> m_xKeepColumn; + + std::unique_ptr<weld::Container> m_xOptions; + + std::unique_ptr<weld::CheckButton> m_xHeaderCB; + std::unique_ptr<weld::CheckButton> m_xRepeatHeaderCB; + + std::unique_ptr<weld::Container> m_xRepeatRows; + std::unique_ptr<weld::SpinButton> m_xRepeatHeaderNF; + + std::unique_ptr<weld::CheckButton> m_xDontSplitCB; + std::unique_ptr<weld::Button> m_xAutoFormatBtn; + + std::unique_ptr<SwTableAutoFormat> mxTAutoFormat; + SwWrtShell* pShell; + + DECL_LINK(AutoFormatHdl, weld::Button&, void); + DECL_LINK(BtnHdl, weld::Toggleable&, void); + DECL_LINK(CheckBoxHdl, weld::Toggleable&, void); + DECL_LINK(RepeatHeaderCheckBoxHdl, weld::Toggleable&, void); + +public: + SwConvertTableDlg(SwView& rView, bool bToTable); + + void GetValues(sal_Unicode& rDelim, SwInsertTableOptions& rInsTableOpts, + SwTableAutoFormat const*& prTAFormat); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx new file mode 100644 index 000000000..b442857a4 --- /dev/null +++ b/sw/source/uibase/inc/cption.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_SW_SOURCE_UIBASE_INC_CPTION_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CPTION_HXX + +#include <sfx2/basedlgs.hxx> + +#include <com/sun/star/container/XNameAccess.hpp> + +#include "wrtsh.hxx" +#include "optload.hxx" + +class SwFieldMgr; +class SwView; + +class SwCaptionDialog final : public SfxDialogController +{ + OUString m_sNone; + TextFilterAutoConvert m_aTextFilter; + SwView& rView; // search per active, avoid View + std::unique_ptr<SwFieldMgr> pMgr; // pointer to save the include + + OUString sCharacterStyle; + bool bCopyAttributes; + bool bOrderNumberingFirst; //#i61007# order of captions + + css::uno::Reference<css::container::XNameAccess> xNameAccess; + + SwCaptionPreview m_aPreview; + std::unique_ptr<weld::Entry> m_xTextEdit; + std::unique_ptr<weld::ComboBox> m_xCategoryBox; + std::unique_ptr<weld::Label> m_xFormatText; + std::unique_ptr<weld::ComboBox> m_xFormatBox; + //#i61007# order of captions + std::unique_ptr<weld::Label> m_xNumberingSeparatorFT; + std::unique_ptr<weld::Entry> m_xNumberingSeparatorED; + std::unique_ptr<weld::Label> m_xSepText; + std::unique_ptr<weld::Entry> m_xSepEdit; + std::unique_ptr<weld::Label> m_xPosText; + std::unique_ptr<weld::ComboBox> m_xPosBox; + std::unique_ptr<weld::Button> m_xOKButton; + std::unique_ptr<weld::Button> m_xAutoCaptionButton; + std::unique_ptr<weld::Button> m_xOptionButton; + std::unique_ptr<weld::CustomWeld> m_xPreview; + + DECL_LINK(SelectListBoxHdl, weld::ComboBox&, void); + DECL_LINK(ModifyEntryHdl, weld::Entry&, void); + DECL_LINK(ModifyComboHdl, weld::ComboBox&, void); + DECL_LINK(OptionHdl, weld::Button&, void); + DECL_LINK(CaptionHdl, weld::Button&, void); + + void Apply(); + + void ModifyHdl(); + void DrawSample(); + void ApplyCaptionOrder(); //#i61007# order of captions + + static OUString our_aSepTextSave; // Save caption separator text +public: + SwCaptionDialog(weld::Window* pParent, SwView& rV); + virtual short run() override; + virtual ~SwCaptionDialog() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/dbconfig.hxx b/sw/source/uibase/inc/dbconfig.hxx new file mode 100644 index 000000000..66ebfc2b9 --- /dev/null +++ b/sw/source/uibase/inc/dbconfig.hxx @@ -0,0 +1,48 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_DBCONFIG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DBCONFIG_HXX + +#include <unotools/configitem.hxx> +#include <swdllapi.h> + +struct SwDBData; + +class SW_DLLPUBLIC SwDBConfig final : public utl::ConfigItem +{ +private: + SAL_DLLPRIVATE static const css::uno::Sequence<OUString>& GetPropertyNames(); + virtual void ImplCommit() override; + + std::unique_ptr<SwDBData> m_pAdrImpl; + std::unique_ptr<SwDBData> m_pBibImpl; + +public: + SwDBConfig(); + virtual ~SwDBConfig() override; + + void Load(); + const SwDBData& GetAddressSource(); + const SwDBData& GetBibliographySource(); + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/dbinsdlg.hxx b/sw/source/uibase/inc/dbinsdlg.hxx new file mode 100644 index 000000000..be1496229 --- /dev/null +++ b/sw/source/uibase/inc/dbinsdlg.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_SW_SOURCE_UIBASE_INC_DBINSDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DBINSDLG_HXX + +#include <vcl/weld.hxx> +#include <sfx2/basedlgs.hxx> +#include <unotools/configitem.hxx> +#include "numfmtlb.hxx" +#include <swdbdata.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> +#include <o3tl/sorted_vector.hxx> + +#include <memory> +#include <vector> + +namespace com::sun::star{ + namespace sdbcx{ + class XColumnsSupplier; + } + namespace sdbc{ + class XDataSource; + class XConnection; + class XResultSet; + } +} + +class SwTableAutoFormat; +class SwView; +class SfxItemSet; +class SwTableRep; +struct DB_Column; + +typedef std::vector<std::unique_ptr<DB_Column>> DB_Columns; + +struct SwInsDBColumn +{ + OUString sColumn, sUsrNumFormat; + sal_Int32 nDBNumFormat; + sal_uInt32 nUsrNumFormat; + LanguageType eUsrNumFormatLng; + bool bHasFormat : 1; + bool bIsDBFormat : 1; + + SwInsDBColumn( const OUString& rStr ) + : sColumn( rStr ), + nDBNumFormat( 0 ), + nUsrNumFormat( 0 ), + eUsrNumFormatLng( LANGUAGE_SYSTEM ), + bHasFormat(false), + bIsDBFormat(true) + {} + + bool operator<( const SwInsDBColumn& rCmp ) const; +}; + +class SwInsDBColumns : public o3tl::sorted_vector<std::unique_ptr<SwInsDBColumn>, o3tl::less_uniqueptr_to<SwInsDBColumn> > +{ +}; + +class SwInsertDBColAutoPilot final : public SfxDialogController, public utl::ConfigItem +{ + SwInsDBColumns aDBColumns; + const SwDBData aDBData; + + OUString sNoTmpl; + + SwView* pView; + std::unique_ptr<SwTableAutoFormat> m_xTAutoFormat; + + std::unique_ptr<SfxItemSet> pTableSet; + std::unique_ptr<SwTableRep> pRep; + sal_Int32 nGBFormatLen; + + std::unique_ptr<weld::RadioButton> m_xRbAsTable; + std::unique_ptr<weld::RadioButton> m_xRbAsField; + std::unique_ptr<weld::RadioButton> m_xRbAsText; + + std::unique_ptr<weld::Frame> m_xHeadFrame; + + std::unique_ptr<weld::TreeView> m_xLbTableDbColumn; + std::unique_ptr<weld::TreeView> m_xLbTextDbColumn; + + std::unique_ptr<weld::Frame> m_xFormatFrame; + std::unique_ptr<weld::RadioButton> m_xRbDbFormatFromDb; + std::unique_ptr<weld::RadioButton> m_xRbDbFormatFromUsr; + std::unique_ptr<NumFormatListBox> m_xLbDbFormatFromUsr; + + // Page Text/Field + std::unique_ptr<weld::Button> m_xIbDbcolToEdit; + std::unique_ptr<weld::TextView> m_xEdDbText; + std::unique_ptr<weld::Label> m_xFtDbParaColl; + std::unique_ptr<weld::ComboBox> m_xLbDbParaColl; + + // Page Table + std::unique_ptr<weld::Button> m_xIbDbcolAllTo; + std::unique_ptr<weld::Button> m_xIbDbcolOneTo; + std::unique_ptr<weld::Button> m_xIbDbcolOneFrom; + std::unique_ptr<weld::Button> m_xIbDbcolAllFrom; + std::unique_ptr<weld::Label> m_xFtTableCol; + std::unique_ptr<weld::TreeView> m_xLbTableCol; + std::unique_ptr<weld::CheckButton> m_xCbTableHeadon; + std::unique_ptr<weld::RadioButton> m_xRbHeadlColnms; + std::unique_ptr<weld::RadioButton> m_xRbHeadlEmpty; + std::unique_ptr<weld::Button> m_xPbTableFormat; + std::unique_ptr<weld::Button> m_xPbTableAutofmt; + + DECL_LINK( PageHdl, weld::Toggleable&, void ); + DECL_LINK( AutoFormatHdl, weld::Button&, void ); + DECL_LINK( TableFormatHdl, weld::Button&, void ); + DECL_LINK( DBFormatHdl, weld::Toggleable&, void ); + DECL_LINK( TableToFromHdl, weld::Button&, void ); + DECL_LINK( TVSelectHdl, weld::TreeView&, void ); + DECL_LINK( CBSelectHdl, weld::ComboBox&, void ); + DECL_LINK( DblClickHdl, weld::TreeView&, bool ); + DECL_LINK( HeaderHdl, weld::Toggleable&, void ); + + bool SplitTextToColArr( const OUString& rText, DB_Columns& rColArr, bool bInsField ); + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + virtual void ImplCommit() override; + void Load(); + + // set the tables - properties + void SetTabSet(); + +public: + SwInsertDBColAutoPilot( SwView& rView, + css::uno::Reference< css::sdbc::XDataSource> const & rxSource, + css::uno::Reference<css::sdbcx::XColumnsSupplier> const & xColSupp, + const SwDBData& rData ); + + virtual ~SwInsertDBColAutoPilot() override; + + void DataToDoc( const css::uno::Sequence< css::uno::Any >& rSelection, + css::uno::Reference< css::sdbc::XDataSource> const & rxSource, + css::uno::Reference< css::sdbc::XConnection> const & xConnection, + css::uno::Reference< css::sdbc::XResultSet > const & xResultSet); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/dbtree.hxx b/sw/source/uibase/inc/dbtree.hxx new file mode 100644 index 000000000..c6806cdfe --- /dev/null +++ b/sw/source/uibase/inc/dbtree.hxx @@ -0,0 +1,68 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_DBTREE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DBTREE_HXX + +#include <memory> +#include <vcl/weld.hxx> + +#include <swdllapi.h> + +class SwDBTreeList_Impl; +class SwWrtShell; + +class SW_DLLPUBLIC SwDBTreeList +{ + bool m_bInitialized; + bool m_bShowColumns; + + rtl::Reference<SwDBTreeList_Impl> m_pImpl; + std::unique_ptr<weld::TreeView> m_xTreeView; + std::unique_ptr<weld::TreeIter> m_xScratchIter; + + DECL_DLLPRIVATE_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool); + SAL_DLLPRIVATE void InitTreeList(); + +public: + SwDBTreeList(std::unique_ptr<weld::TreeView> xTreeView); + ~SwDBTreeList(); + + OUString GetDBName(OUString& rTableName, OUString& rColumnName, sal_Bool* pbIsTable = nullptr); + + void Select( std::u16string_view rDBName, std::u16string_view rTableName, + std::u16string_view rColumnName ); + + void ShowColumns(bool bShowCol); + + void SetWrtShell(SwWrtShell& rSh); + + void AddDataSource(const OUString& rSource); + + void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xTreeView->connect_changed(rLink); } + void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { m_xTreeView->connect_row_activated(rLink); } + std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig = nullptr) const { return m_xTreeView->make_iterator(pOrig); } + bool get_selected(weld::TreeIter* pIter) const { return m_xTreeView->get_selected(pIter); } + bool iter_parent(weld::TreeIter& rIter) const { return m_xTreeView->iter_parent(rIter); } + int get_iter_depth(const weld::TreeIter& rIter) const { return m_xTreeView->get_iter_depth(rIter); } + void set_size_request(int nWidth, int nHeight) { m_xTreeView->set_size_request(nWidth, nHeight); } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/dbui.hxx b/sw/source/uibase/inc/dbui.hxx new file mode 100644 index 000000000..b58b2abed --- /dev/null +++ b/sw/source/uibase/inc/dbui.hxx @@ -0,0 +1,70 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_DBUI_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DBUI_HXX + +#include <vcl/weld.hxx> + +#include <swdllapi.h> + +class PrintMonitor final : public weld::GenericDialogController +{ +public: + std::unique_ptr<weld::Label> m_xDocName; + std::unique_ptr<weld::Label> m_xPrinter; + std::unique_ptr<weld::Label> m_xPrintInfo; + + PrintMonitor(weld::Window* pParent); + virtual ~PrintMonitor() override; +}; + +class SW_DLLPUBLIC SaveMonitor final : public weld::GenericDialogController +{ +public: + std::unique_ptr<weld::Label> m_xDocName; + std::unique_ptr<weld::Label> m_xPrinter; + std::unique_ptr<weld::Label> m_xPrintInfo; + + SaveMonitor(weld::Window* pParent); + virtual ~SaveMonitor() override; +}; + +class CreateMonitor final : public weld::GenericDialogController +{ +public: + CreateMonitor(weld::Window* pParent); + virtual ~CreateMonitor() override; + + void SetTotalCount(sal_Int32 nTotal); + void SetCurrentPosition(sal_Int32 nCurrent); + +private: + void UpdateCountingText(); + +private: + OUString m_sCountingPattern; + sal_Int32 m_nTotalCount; + sal_Int32 m_nCurrentPosition; + + std::unique_ptr<weld::Label> m_xCounting; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/docfnote.hxx b/sw/source/uibase/inc/docfnote.hxx new file mode 100644 index 000000000..1719349ab --- /dev/null +++ b/sw/source/uibase/inc/docfnote.hxx @@ -0,0 +1,40 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_DOCFNOTE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DOCFNOTE_HXX + +#include <sfx2/tabdlg.hxx> + +class SwWrtShell; + +class SwFootNoteOptionDlg final : public SfxTabDialogController +{ + SwWrtShell& rSh; + + virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; + + DECL_LINK(OkHdl, weld::Button&, void); + +public: + SwFootNoteOptionDlg(weld::Window* pParent, SwWrtShell& rSh); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/docstdlg.hxx b/sw/source/uibase/inc/docstdlg.hxx new file mode 100644 index 000000000..56119d057 --- /dev/null +++ b/sw/source/uibase/inc/docstdlg.hxx @@ -0,0 +1,61 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_DOCSTDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DOCSTDLG_HXX + +#include <sfx2/tabdlg.hxx> +#include <docstat.hxx> + +// DocInfo now as page +class SwDocStatPage final : public SfxTabPage +{ +public: + SwDocStatPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet); + virtual ~SwDocStatPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet); + +private: + virtual bool FillItemSet( SfxItemSet *rSet) override; + virtual void Reset (const SfxItemSet *rSet) override; + + DECL_LINK(UpdateHdl, weld::Button&, void); + + std::unique_ptr<weld::Label> m_xPageNo; + std::unique_ptr<weld::Label> m_xTableNo; + std::unique_ptr<weld::Label> m_xGrfNo; + std::unique_ptr<weld::Label> m_xOLENo; + std::unique_ptr<weld::Label> m_xParaNo; + std::unique_ptr<weld::Label> m_xWordNo; + std::unique_ptr<weld::Label> m_xCharNo; + std::unique_ptr<weld::Label> m_xCharExclSpacesNo; + std::unique_ptr<weld::Label> m_xLineLbl; + std::unique_ptr<weld::Label> m_xLineNo; + std::unique_ptr<weld::Button> m_xUpdatePB; + + SwDocStat aDocStat; + + void Update(); + + void SetData(const SwDocStat &rStat); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/drawbase.hxx b/sw/source/uibase/inc/drawbase.hxx new file mode 100644 index 000000000..ccc045ced --- /dev/null +++ b/sw/source/uibase/inc/drawbase.hxx @@ -0,0 +1,74 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_DRAWBASE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DRAWBASE_HXX + +#include <tools/gen.hxx> +#include <vcl/vclptr.hxx> + +class SwView; +class SwWrtShell; +class SwEditWin; +class KeyEvent; +class MouseEvent; + +// base class for all functions +class SwDrawBase +{ +protected: + SwView* m_pView; + SwWrtShell* m_pSh; + VclPtr<SwEditWin> m_pWin; + Point m_aStartPos; // position of BeginCreate + sal_uInt16 m_nSlotId; + bool m_bCreateObj :1; + bool m_bInsForm :1; + + Point GetDefaultCenterPos() const; +public: + SwDrawBase(SwWrtShell *pSh, SwEditWin* pWin, SwView* pView); + virtual ~SwDrawBase(); + + void SetDrawPointer(); + void EnterSelectMode(const MouseEvent& rMEvt); + bool IsInsertForm() const { return m_bInsForm; } + bool IsCreateObj() const { return m_bCreateObj; } + + // mouse- & key events; return value=true: event was edited + bool MouseMove(const MouseEvent& rMEvt); + virtual bool MouseButtonUp(const MouseEvent& rMEvt); + virtual bool MouseButtonDown(const MouseEvent& rMEvt); + + void BreakCreate(); + void SetSlotId(sal_uInt16 nSlot) {m_nSlotId = nSlot;} + sal_uInt16 GetSlotId() const { return m_nSlotId;} + + virtual void Activate(const sal_uInt16 nSlotId); // activate function + virtual void Deactivate(); // deactivate function + + virtual void CreateDefaultObject(); + virtual void CreateDefaultObjectAtPosWithSize(Point aPos, Size aSize); + + // #i33136# + virtual bool doConstructOrthogonal() const; +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_DRAWBASE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/drawsh.hxx b/sw/source/uibase/inc/drawsh.hxx new file mode 100644 index 000000000..ca164e95e --- /dev/null +++ b/sw/source/uibase/inc/drawsh.hxx @@ -0,0 +1,56 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_DRAWSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DRAWSH_HXX + +#include "drwbassh.hxx" + +#include <svx/svdobj.hxx> + +class SwDrawBaseShell; + +class SwDrawShell final : public SwDrawBaseShell +{ +public: + SFX_DECL_INTERFACE(SW_DRAWSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwDrawShell(SwView &rView); + + void Execute(SfxRequest &); + void GetState(SfxItemSet &); + void ExecDrawDlg(SfxRequest& rReq); + void ExecDrawAttrArgs(SfxRequest const & rReq); + void GetDrawAttrState(SfxItemSet &rSet); + + void ExecFormText(SfxRequest const & rReq); + void GetFormTextState(SfxItemSet& rSet); + + // #i123922# added helper methods to handle applying graphic data to draw objects + SdrObject* IsSingleFillableNonOLESelected(); + void InsertPictureFromFile(SdrObject& rObject); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/drformsh.hxx b/sw/source/uibase/inc/drformsh.hxx new file mode 100644 index 000000000..9c8602d14 --- /dev/null +++ b/sw/source/uibase/inc/drformsh.hxx @@ -0,0 +1,45 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_DRFORMSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DRFORMSH_HXX + +#include "drwbassh.hxx" + +class SwDrawBaseShell; + +class SwDrawFormShell: public SwDrawBaseShell +{ +public: + SFX_DECL_INTERFACE(SW_DRAWFORMSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwDrawFormShell(SwView &rView); + virtual ~SwDrawFormShell() override; + + void Execute(SfxRequest const &); + void GetState(SfxItemSet &); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/drpcps.hxx b/sw/source/uibase/inc/drpcps.hxx new file mode 100644 index 000000000..49da98d7f --- /dev/null +++ b/sw/source/uibase/inc/drpcps.hxx @@ -0,0 +1,163 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_DRPCPS_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DRPCPS_HXX + +#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <editeng/svxfont.hxx> +#include <sfx2/basedlgs.hxx> +#include <sfx2/tabdlg.hxx> +#include <vcl/customweld.hxx> +#include <vcl/print.hxx> + +class SwWrtShell; + +class SwDropCapsDlg final : public SfxSingleTabDialogController +{ +public: + SwDropCapsDlg(weld::Window *pParent, const SfxItemSet &rSet); +}; + +class SwDropCapsPage; + +class SwDropCapsPict final : public weld::CustomWidgetController +{ + SwDropCapsPage* mpPage; + OUString maText; + OUString maScriptText; + Color maBackColor; + Color maTextLineColor; + sal_uInt8 mnLines; + tools::Long mnTotLineH; + tools::Long mnLineH; + tools::Long mnTextH; + sal_uInt16 mnDistance; + VclPtr<Printer> mpPrinter; + bool mbDelPrinter; + /// The ScriptInfo structure holds information on where we change from one + /// script to another. + struct ScriptInfo + { + sal_uLong textWidth; ///< Physical width of this segment. + sal_uInt16 scriptType; ///< Script type (e.g. Latin, Asian, Complex) + sal_Int32 changePos; ///< Character position where the script changes. + ScriptInfo(sal_uInt16 scrptType, sal_Int32 position) + : textWidth(0), scriptType(scrptType), changePos(position) {} + }; + std::vector<ScriptInfo> maScriptChanges; + SvxFont maFont; + SvxFont maCJKFont; + SvxFont maCTLFont; + Size maTextSize; + css::uno::Reference< css::i18n::XBreakIterator > xBreak; + + virtual void Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle &rRect) override; + void CheckScript(); + Size CalcTextSize(); + inline void InitPrinter(); + void InitPrinter_(); + static void GetFontSettings( vcl::Font& _rFont, sal_uInt16 _nWhich ); + void GetFirstScriptSegment(sal_Int32 &start, sal_Int32 &end, sal_uInt16 &scriptType); + bool GetNextScriptSegment(size_t &nIdx, sal_Int32 &start, sal_Int32 &end, sal_uInt16 &scriptType); + +public: + + SwDropCapsPict() + : mpPage(nullptr) + , mnLines(0) + , mnTotLineH(0) + , mnLineH(0) + , mnTextH(0) + , mnDistance(0) + , mpPrinter(nullptr) + , mbDelPrinter(false) + {} + + void SetDropCapsPage(SwDropCapsPage* pPage) { mpPage = pPage; } + + virtual ~SwDropCapsPict() override; + + void UpdatePaintSettings(); // also invalidates control! + + virtual void Resize() override; + + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + + void SetText( const OUString& rT ); + void SetLines( sal_uInt8 nL ); + void SetDistance( sal_uInt16 nD ); + void SetValues( const OUString& rText, sal_uInt8 nLines, sal_uInt16 nDistance ); + + void DrawPrev(vcl::RenderContext& rRenderContext, const Point& rPt); +}; + +class SwDropCapsPage final : public SfxTabPage +{ +friend class SwDropCapsPict; + SwDropCapsPict m_aPict; + + bool bModified; + bool bFormat; + bool bHtmlMode; + + std::unique_ptr<weld::CheckButton> m_xDropCapsBox; + std::unique_ptr<weld::CheckButton> m_xWholeWordCB; + std::unique_ptr<weld::Label> m_xSwitchText; + std::unique_ptr<weld::SpinButton> m_xDropCapsField; + std::unique_ptr<weld::Label> m_xLinesText; + std::unique_ptr<weld::SpinButton> m_xLinesField; + std::unique_ptr<weld::Label> m_xDistanceText; + std::unique_ptr<weld::MetricSpinButton> m_xDistanceField; + std::unique_ptr<weld::Label> m_xTextText; + std::unique_ptr<weld::Entry> m_xTextEdit; + std::unique_ptr<weld::Label> m_xTemplateText; + std::unique_ptr<weld::ComboBox> m_xTemplateBox; + std::unique_ptr<weld::CustomWeld> m_xPict; + + virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; + void FillSet( SfxItemSet &rSet ); + + void ModifyEntry(const weld::Entry& rEdit); + + DECL_LINK(ClickHdl, weld::Toggleable&, void); + DECL_LINK(MetricValueChangedHdl, weld::MetricSpinButton&, void); + DECL_LINK(ValueChangedHdl, weld::SpinButton&, void); + DECL_LINK(ModifyHdl, weld::Entry&, void); + DECL_LINK(SelectHdl, weld::ComboBox&, void); + DECL_LINK(WholeWordHdl, weld::Toggleable&, void); + + static const WhichRangesContainer aPageRg; + +public: + SwDropCapsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet); + virtual ~SwDropCapsPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet); + static WhichRangesContainer GetRanges() { return aPageRg; } + + + virtual bool FillItemSet( SfxItemSet *rSet) override; + virtual void Reset (const SfxItemSet *rSet) override; + + void SetFormat(bool bSet){bFormat = bSet;} +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/drwbassh.hxx b/sw/source/uibase/inc/drwbassh.hxx new file mode 100644 index 000000000..e75576dec --- /dev/null +++ b/sw/source/uibase/inc/drwbassh.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_SW_SOURCE_UIBASE_INC_DRWBASSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DRWBASSH_HXX + +#include "basesh.hxx" + +class SwView; +class SfxItemSet; +class SwDrawBase; +class AbstractSvxObjectNameDialog; +struct SvxSwFrameValidation; + +class SwDrawBaseShell: public SwBaseShell +{ + DECL_LINK( CheckGroupShapeNameHdl, AbstractSvxObjectNameDialog&, bool ); + DECL_LINK(ValidatePosition, SvxSwFrameValidation&, void ); +public: + SwDrawBaseShell(SwView &rShell); + virtual ~SwDrawBaseShell() override; + + SFX_DECL_INTERFACE(SW_DRAWBASESHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + void Execute(SfxRequest const &); + void GetState(SfxItemSet &); + void GetDrawAttrStateForIFBX( SfxItemSet& rSet ); + void DisableState(SfxItemSet &rSet); + bool Disable(SfxItemSet& rSet, sal_uInt16 nWhich = 0); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/drwtxtsh.hxx b/sw/source/uibase/inc/drwtxtsh.hxx new file mode 100644 index 000000000..8c3f4da5d --- /dev/null +++ b/sw/source/uibase/inc/drwtxtsh.hxx @@ -0,0 +1,85 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_DRWTXTSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DRWTXTSH_HXX + +#include <sfx2/shell.hxx> +#include <shellid.hxx> +#include <unotools/caserotate.hxx> + +class SdrView; +class SwView; +class SwWrtShell; + +/// SfxShell subclass that is used while interacting with the editeng-based text of a shape. +class SwDrawTextShell final : public SfxShell +{ + SwView &m_rView; + RotateTransliteration m_aRotateCase; + + SdrView *m_pSdrView; + + void SetAttrToMarked(const SfxItemSet& rAttr); + void InsertSymbol(SfxRequest& rReq); + bool IsTextEdit() const; + +public: + SFX_DECL_INTERFACE(SW_DRWTXTSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwView &GetView() { return m_rView; } + SwWrtShell &GetShell(); + + SwDrawTextShell(SwView &rView); + virtual ~SwDrawTextShell() override; + + virtual SfxUndoManager* + GetUndoManager() override; + + static void StateDisableItems(SfxItemSet &); + + void Execute(SfxRequest &); + void ExecDraw(SfxRequest &); + void GetStatePropPanelAttr(SfxItemSet &); + void GetState(SfxItemSet &); + void GetDrawTextCtrlState(SfxItemSet&); + + void ExecFontWork(SfxRequest const & rReq); + void StateFontWork(SfxItemSet& rSet); + void ExecFormText(SfxRequest const & rReq); + void GetFormTextState(SfxItemSet& rSet); + void ExecDrawLingu(SfxRequest const &rReq); + void ExecUndo(SfxRequest &rReq); + void StateUndo(SfxItemSet &rSet); + void ExecClpbrd(SfxRequest const &rReq); + void StateClpbrd(SfxItemSet &rSet); + void StateInsert(SfxItemSet &rSet); + void ExecTransliteration(SfxRequest const &); + void ExecRotateTransliteration(SfxRequest const &); + + void Init(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/dselect.hxx b/sw/source/uibase/inc/dselect.hxx new file mode 100644 index 000000000..4f53feb31 --- /dev/null +++ b/sw/source/uibase/inc/dselect.hxx @@ -0,0 +1,35 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_DSELECT_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_DSELECT_HXX + +#include "drawbase.hxx" + +// draw rectangle +class DrawSelection final : public SwDrawBase +{ +public: + DrawSelection(SwWrtShell* pSh, SwEditWin* pWin, SwView* pView); + + virtual void Activate(const sal_uInt16 nSlotId) override; // activate function +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_DSELECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/edtdd.hxx b/sw/source/uibase/inc/edtdd.hxx new file mode 100644 index 000000000..4416bc73c --- /dev/null +++ b/sw/source/uibase/inc/edtdd.hxx @@ -0,0 +1,19 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_EDTDD_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_EDTDD_HXX + +#include <sal/config.h> + +extern bool g_bExecuteDrag; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx new file mode 100644 index 000000000..9fb3da476 --- /dev/null +++ b/sw/source/uibase/inc/edtwin.hxx @@ -0,0 +1,308 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_EDTWIN_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_EDTWIN_HXX + +#include <o3tl/deleter.hxx> +#include <sot/exchange.hxx> +#include <svx/svdobj.hxx> +#include <tools/link.hxx> +#include <vcl/timer.hxx> +#include <vcl/window.hxx> +#include <vcl/transfer.hxx> +#include <swevent.hxx> +#include <swtypes.hxx> + +class SwWrtShell; +class SwView; +class SwRect; +class SwViewShell; +class SwAnchorMarker; +class SdrObject; +class SwShadowCursor; +class DataChangedEvent; +class SvxAutoCorrCfg; +class SvxAutoCorrect; +class SwPaM; +struct SwApplyTemplate; +struct QuickHelpData; +class SdrDropMarkerOverlay; +class SwFrameControlsManager; +enum class SdrHitKind; +class SwTextFrame; + +// input window + +/** Window class for the Writer edit area, this is the one handling mouse + and keyboard events and doing the final painting of the document from + the buffered layout. + + To translate the pixel positions from the buffer OutputDevice to the real + pixel positions, use the PixelToLogic methods of this class. + */ +class SW_DLLPUBLIC SwEditWin final : public vcl::Window, + public DropTargetHelper, public DragSourceHelper +{ + static QuickHelpData* s_pQuickHlpData; + + static tools::Long s_nDDStartPosX; + static tools::Long s_nDDStartPosY; + + Color m_aWaterCanTextColor; // text color; for the watering can + Color m_aWaterCanTextBackColor; // text background; for the watering can + + /* + * timer and handler for scrolling on when the mousepointer + * stops outside of EditWin during a drag-operation. + * The selection is increased towards the mouse position + * regularly. + */ + AutoTimer m_aTimer; + // timer for ANY-KeyInput question without a following KeyInputEvent + Timer m_aKeyInputFlushTimer; + + OUString m_aInBuffer; + LanguageType m_eBufferLanguage; + Point m_aStartPos; + Point m_aMovePos; + Point m_aRszMvHdlPt; + Timer m_aTemplateTimer; + + // type/object where the mouse pointer is + SwCallMouseEvent m_aSaveCallEvent; + + std::unique_ptr<SwApplyTemplate> m_pApplyTempl; + std::unique_ptr<SwAnchorMarker> m_pAnchorMarker; // for relocating the anchor + + std::unique_ptr<SdrDropMarkerOverlay> m_pUserMarker; + SdrObject *m_pUserMarkerObj; + std::unique_ptr<SwShadowCursor, o3tl::default_delete<SwShadowCursor>> m_pShadCursor; + std::optional<Point> m_xRowColumnSelectionStart; // save position where table row/column selection has been started + + SwView &m_rView; + + SdrHitKind m_aActHitType; // current mouse pointer + + SotClipboardFormatId m_nDropFormat; // format from the last QueryDrop + sal_uInt8 m_nDropAction; // action from the last QueryDrop + SotExchangeDest m_nDropDestination; // destination from the last QueryDrop + + sal_uInt16 m_eBezierMode; + sal_uInt16 m_nInsFrameColCount; // column number for interactive frame + SdrObjKind m_eDrawMode; + bool m_bMBPressed : 1, + m_bInsDraw : 1, + m_bInsFrame : 1, + m_bIsInMove : 1, + m_bIsInDrag : 1, // don't execute StartExecuteDrag twice + m_bOldIdle : 1, // to stop to idle + m_bOldIdleSet : 1, // during QeueryDrop + m_bChainMode : 1, // connect frames + m_bWasShdwCursor : 1, // ShadowCursor was on in MouseButtonDown + m_bLockInput : 1, // lock while calc panel is active + m_bIsRowDrag : 1, //selection of rows is used, in combination with m_pRowColumnSelectionStart + /** #i42732# display status of font size/name depending on either the input language or the + selection position depending on what has changed lately + */ + m_bUseInputLanguage: 1, + m_bObjectSelect : 1; + + sal_uInt16 m_nKS_NUMDOWN_Count; // #i23725# + sal_uInt16 m_nKS_NUMINDENTINC_Count; + + std::unique_ptr<SwFrameControlsManager> m_pFrameControlsManager; + + SwTextFrame* m_pSavedOutlineFrame = nullptr; + + void LeaveArea(const Point &); + void JustifyAreaTimer(); + inline void EnterArea(); + + void RstMBDownFlags(); + + void ChangeFly( sal_uInt8 nDir, bool bWeb ); + void ChangeDrawing( sal_uInt8 nDir ); + + bool EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos); + bool RulerColumnDrag( const MouseEvent& rMEvt, bool bVerticalMode); + + // helper function for D&D + void DropCleanup(); + void CleanupDropUserMarker(); + SotExchangeDest GetDropDestination( const Point& rPixPnt, + SdrObject ** ppObj = nullptr ); + //select the object/cursor at the mouse position of the context menu request + void SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos ); + + /* + * handler for scrolling on when the mousepointer + * stops outside of EditWin during a drag-operation. + * The selection is regularly increased towards the mouse + * position. + */ + DECL_DLLPRIVATE_LINK( TimerHandler, Timer *, void ); + void StartDDTimer(); + void StopDDTimer(SwWrtShell *, const Point &); + DECL_DLLPRIVATE_LINK( DDHandler, Timer *, void ); + + // timer for ANY-KeyInut question without a following KeyInputEvent + DECL_DLLPRIVATE_LINK( KeyInputFlushHandler, Timer *, void ); + + // timer for ApplyTemplates via mouse (in disguise Drag&Drop) + DECL_DLLPRIVATE_LINK( TemplateTimerHdl, Timer *, void ); + + void MoveCursor( SwWrtShell &rSh, const Point& rDocPos, + const bool bOnlyText, bool bLockView ); + + virtual void DataChanged( const DataChangedEvent& ) override; + virtual void PrePaint(vcl::RenderContext& rRenderContext) override; + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + + virtual void GetFocus() override; + virtual void LoseFocus() override; + + bool changeMousePointer(Point const & rDocPoint); + + virtual void MouseMove(const MouseEvent& rMEvt) override; + virtual void MouseButtonDown(const MouseEvent& rMEvt) override; + virtual void MouseButtonUp(const MouseEvent& rMEvt) override; + virtual void RequestHelp(const HelpEvent& rEvt) override; + + // Drag & Drop Interface + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; + virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override; + + virtual OUString GetSurroundingText() const override; + virtual Selection GetSurroundingTextSelection() const override; + virtual bool DeleteSurroundingText(const Selection& rSelection) override; + + void ShowAutoCorrectQuickHelp(const OUString& rWord, SvxAutoCorrect& rACorr); + bool ShowAutoText(const std::vector<OUString>& rChunkCandidates); + + /// Returns true if in header/footer area, or in the header/footer control. + bool IsInHeaderFooter( const Point &rDocPt, FrameControlType &rControl ) const; + + bool IsOverHeaderFooterFly( const Point& rDocPos, FrameControlType& rControl, bool& bOverFly, bool& bPageAnchored ) const; + +public: + virtual void KeyInput(const KeyEvent &rKEvt) override; + void UpdatePointer(const Point &, sal_uInt16 nButtons = 0); + + bool IsDrawSelMode() const; + bool IsDrawAction() const { return m_bInsDraw; } + void SetDrawAction(bool bFlag) { m_bInsDraw = bFlag; } + + void SetObjectSelect( bool bVal ) { m_bObjectSelect = bVal; } + bool IsObjectSelect() const { return m_bObjectSelect; } + + SdrObjKind GetSdrDrawMode() const { return m_eDrawMode; } + void SetSdrDrawMode( SdrObjKind eSdrObjectKind ) { m_eDrawMode = eSdrObjectKind; SetObjectSelect( false ); } + void StdDrawMode( SdrObjKind eSdrObjectKind, bool bObjSelect ); + + bool IsFrameAction() const { return m_bInsFrame; } + sal_uInt16 GetBezierMode() const { return m_eBezierMode; } + void SetBezierMode(sal_uInt16 eBezMode) { m_eBezierMode = eBezMode; } + void EnterDrawTextMode(const Point& aDocPos); // turn on DrawTextEditMode + void InsFrame(sal_uInt16 nCols); + void StopInsFrame(); + sal_uInt16 GetFrameColCount() const {return m_nInsFrameColCount;} // column number for interactive frame + + void SetChainMode( bool bOn ); + bool IsChainMode() const { return m_bChainMode; } + + void FlushInBuffer(); + static bool IsInputSequenceCheckingRequired( const OUString &rText, const SwPaM& rCursor ); + + void SetApplyTemplate(const SwApplyTemplate &); + SwApplyTemplate* GetApplyTemplate() const { return m_pApplyTempl.get(); } + + void StartExecuteDrag(); + void DragFinished(); + + void SetWaterCanTextColor(const Color& rCol ) { m_aWaterCanTextColor = rCol; } + + void SetWaterCanTextBackColor(const Color& rCol ) { m_aWaterCanTextBackColor = rCol; } + + void LockKeyInput(bool bSet){m_bLockInput = bSet;} + + const SwView &GetView() const { return m_rView; } + SwView &GetView() { return m_rView; } + + virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; + + static tools::Long GetDDStartPosX() { return s_nDDStartPosX; } + static tools::Long GetDDStartPosY() { return s_nDDStartPosY; } + + static void InitStaticData(); + static void FinitStaticData(); + + //#i3370# remove quick help to prevent saving of autocorrection suggestions + void StopQuickHelp(); + + // #i42921# - add parameter <bVerticalMode> + bool RulerMarginDrag( const MouseEvent& rMEvt, + const bool bVerticalMode ); + + /** #i42732# display status of font size/name depending on either the input + language or the selection position depending on what has changed lately + */ + void SetUseInputLanguage( bool bNew ); + bool IsUseInputLanguage() const { return m_bUseInputLanguage; } + + /** fdo#55546 cut very long tooltips to 2/3 of the width of the screen + via center ellipsis + */ + OUString ClipLongToolTip(const OUString& rText); + + SwFrameControlsManager& GetFrameControlsManager(); + + SwEditWin(vcl::Window *pParent, SwView &); + virtual ~SwEditWin() override; + virtual void dispose() override; + + virtual void Command( const CommandEvent& rCEvt ) override; + + /// @see Window::LogicInvalidate(). + void LogicInvalidate(const tools::Rectangle* pRectangle) override; + /// Same as MouseButtonDown(), but coordinates are in logic unit. + virtual void LogicMouseButtonDown(const MouseEvent& rMouseEvent) override; + /// Same as MouseButtonUp(), but coordinates are in logic unit. + virtual void LogicMouseButtonUp(const MouseEvent& rMouseEvent) override; + /// Same as MouseMove(), but coordinates are in logic unit. + virtual void LogicMouseMove(const MouseEvent& rMouseEvent) override; + /// Allows adjusting the point or mark of the selection to a document coordinate. + void SetCursorTwipPosition(const Point& rPosition, bool bPoint, bool bClearMark); + /// Allows starting or ending a graphic move or resize action. + void SetGraphicTwipPosition(bool bStart, const Point& rPosition); + + const SwTextFrame* GetSavedOutlineFrame() const { return m_pSavedOutlineFrame; } + void SetSavedOutlineFrame(SwTextFrame* pFrame) { m_pSavedOutlineFrame = pFrame; } + void ToggleOutlineContentVisibility(const size_t nOutlinePos, const bool bSubs); + + virtual FactoryFunction GetUITestFactory() const override; +}; + +extern bool g_bFrameDrag; +extern bool g_bDDTimerStarted; +extern bool g_bDDINetAttr; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/envimg.hxx b/sw/source/uibase/inc/envimg.hxx new file mode 100644 index 000000000..15c2560b9 --- /dev/null +++ b/sw/source/uibase/inc/envimg.hxx @@ -0,0 +1,89 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_ENVIMG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_ENVIMG_HXX + +#include <svl/poolitem.hxx> +#include <unotools/configitem.hxx> +#include <swdllapi.h> + +SW_DLLPUBLIC OUString MakeSender(); + +enum SwEnvAlign +{ + ENV_HOR_LEFT = 0, + ENV_HOR_CNTR, + ENV_HOR_RGHT, + ENV_VER_LEFT, + ENV_VER_CNTR, + ENV_VER_RGHT +}; + +class SW_DLLPUBLIC SwEnvItem final : public SfxPoolItem +{ +public: + + OUString m_aAddrText; // text for receiver + bool m_bSend; // sender? + OUString m_aSendText; // text for sender + sal_Int32 m_nAddrFromLeft; // left gap for receiver (twips) + sal_Int32 m_nAddrFromTop; // upper gap for receiver (twips) + sal_Int32 m_nSendFromLeft; // left gap for sender (twips) + sal_Int32 m_nSendFromTop; // upper gap for sender (twips) + sal_Int32 m_nWidth; // envelope's width (twips) + sal_Int32 m_nHeight; // envelope's height (twips) + SwEnvAlign m_eAlign; // alignment at indent + bool m_bPrintFromAbove; // print from above? + sal_Int32 m_nShiftRight; // shift to right (twips) + sal_Int32 m_nShiftDown; // shift down (twips) + + SwEnvItem(); + + static SfxPoolItem* CreateDefault(); + SwEnvItem& operator =(const SwEnvItem& rItem); + SwEnvItem(SwEnvItem const &) = default; // SfxPoolItem copy function dichotomy + + virtual bool operator ==(const SfxPoolItem& rItem) const override; + + virtual SwEnvItem* Clone(SfxItemPool* = nullptr) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; +}; + +class SwEnvCfgItem final : public utl::ConfigItem +{ +private: + SwEnvItem m_aEnvItem; + + static css::uno::Sequence<OUString> GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SwEnvCfgItem(); + virtual ~SwEnvCfgItem() override; + + SwEnvItem& GetItem() {return m_aEnvItem;} + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/envlop.hxx b/sw/source/uibase/inc/envlop.hxx new file mode 100644 index 000000000..49a1d9429 --- /dev/null +++ b/sw/source/uibase/inc/envlop.hxx @@ -0,0 +1,124 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_ENVLOP_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_ENVLOP_HXX + +#include <sfx2/tabdlg.hxx> +#include <vcl/weld.hxx> +#include <vcl/customweld.hxx> +#include "envimg.hxx" + +#define GetFieldVal(rField) (rField).Denormalize((rField).GetValue(FieldUnit::TWIP)) +#define SetFieldVal(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FieldUnit::TWIP) + +inline int getfieldval(const weld::MetricSpinButton& rField) +{ + return rField.denormalize(rField.get_value(FieldUnit::TWIP)); +} + +inline void setfieldval(weld::MetricSpinButton& rField, int lValue) +{ + rField.set_value(rField.normalize(lValue), FieldUnit::TWIP); +} + +class SwEnvDlg; +class SwEnvPage; +class SwEnvFormatPage; +class SwWrtShell; +class Printer; + +class SwEnvPreview final : public weld::CustomWidgetController +{ +private: + SwEnvDlg* m_pDialog; + + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + +public: + SwEnvPreview(); + void SetDialog(SwEnvDlg* pDialog) { m_pDialog = pDialog; } +}; + +class SwEnvDlg final : public SfxTabDialogController +{ + friend class SwEnvPage; + friend class SwEnvFormatPage; + friend class SwEnvPrtPage; + friend class SwEnvPreview; + + SwEnvItem aEnvItem; + SwWrtShell* pSh; + VclPtr<Printer> pPrinter; + std::unique_ptr<SfxItemSet> pAddresseeSet; + std::unique_ptr<SfxItemSet> pSenderSet; + + std::unique_ptr<weld::Button> m_xModify; + + virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; + virtual short Ok() override; + +public: + SwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, + bool bInsert); + virtual ~SwEnvDlg() override; +}; + +class SwEnvPage final : public SfxTabPage +{ + SwEnvDlg* m_pDialog; + SwWrtShell* m_pSh; + OUString m_sActDBName; + + SwEnvPreview m_aPreview; + std::unique_ptr<weld::TextView> m_xAddrEdit; + std::unique_ptr<weld::ComboBox> m_xDatabaseLB; + std::unique_ptr<weld::ComboBox> m_xTableLB; + std::unique_ptr<weld::ComboBox> m_xDBFieldLB; + std::unique_ptr<weld::Button> m_xInsertBT; + std::unique_ptr<weld::CheckButton> m_xSenderBox; + std::unique_ptr<weld::TextView> m_xSenderEdit; + std::unique_ptr<weld::CustomWeld> m_xPreview; + + DECL_LINK(DatabaseHdl, weld::ComboBox&, void); + DECL_LINK(FieldHdl, weld::Button&, void); + DECL_LINK(SenderHdl, weld::Toggleable&, void); + + void InitDatabaseBox(); + + SwEnvDlg* GetParentSwEnvDlg() { return m_pDialog; } + +public: + SwEnvPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + void Init(SwEnvDlg* pDialog); + virtual ~SwEnvPage() override; + + static std::unique_ptr<SfxTabPage> + Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet); + + virtual void ActivatePage(const SfxItemSet& rSet) override; + virtual DeactivateRC DeactivatePage(SfxItemSet* pSet) override; + void FillItem(SwEnvItem& rItem); + virtual bool FillItemSet(SfxItemSet* rSet) override; + virtual void Reset(const SfxItemSet* rSet) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/fldedt.hxx b/sw/source/uibase/inc/fldedt.hxx new file mode 100644 index 000000000..ecb2ff04a --- /dev/null +++ b/sw/source/uibase/inc/fldedt.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_SW_SOURCE_UIBASE_INC_FLDEDT_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_FLDEDT_HXX + +#include <fldbas.hxx> + +#include <sfx2/basedlgs.hxx> + +class SwView; +class SwWrtShell; +class SwFieldMgr; + +class SwFieldEditDlg final : public SfxSingleTabDialogController +{ + SwWrtShell* pSh; + std::unique_ptr<weld::Button> m_xPrevBT; + std::unique_ptr<weld::Button> m_xNextBT; + std::unique_ptr<weld::Button> m_xAddressBT; + + DECL_LINK(AddressHdl, weld::Button&, void); + DECL_LINK(NextPrevHdl, weld::Button&, void); + + void Init(); + SfxTabPage* CreatePage(sal_uInt16 nGroup); + + void EnsureSelection(SwField *pCurField, SwFieldMgr &rMgr); +public: + + SwFieldEditDlg(SwView const & rVw); + virtual ~SwFieldEditDlg() override; + + DECL_LINK(OKHdl, weld::Button&, void); + + virtual short run() override; + + void EnableInsert(bool bEnable); + void InsertHdl(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/fldmgr.hxx b/sw/source/uibase/inc/fldmgr.hxx new file mode 100644 index 000000000..8c1a9d591 --- /dev/null +++ b/sw/source/uibase/inc/fldmgr.hxx @@ -0,0 +1,202 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_FLDMGR_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_FLDMGR_HXX + +#include <fldbas.hxx> +#include <pam.hxx> +#include <swdllapi.h> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Any.h> +#include <memory> +#include <vector> + +namespace com::sun::star{ + namespace container{ + class XNameAccess; + } + namespace text{ + class XNumberingTypeInfo; + } +} + +class SwWrtShell; +class SwField; +class SwFieldType; +class SwPaM; +class SbModule; +class SvxMacroItem; +class SvNumberFormatter; +namespace weld { class Widget; class Window; } +enum class SwFieldIds : sal_uInt16; + +// the groups of fields +enum SwFieldGroups +{ + GRP_DOC, + GRP_FKT, + GRP_REF, + GRP_REG, + GRP_DB, + GRP_VAR +}; + +struct SwFieldGroupRgn +{ + sal_uInt16 nStart; + sal_uInt16 nEnd; +}; + +// the field manager handles the insertation of fields +// with command strings +struct SwInsertField_Data +{ + SwFieldTypesEnum m_nTypeId; + sal_uInt16 m_nSubType; + const OUString m_sPar1; + const OUString m_sPar2; + sal_uInt32 m_nFormatId; + SwWrtShell* m_pSh; + sal_Unicode m_cSeparator; + bool m_bIsAutomaticLanguage; + css::uno::Any m_aDBDataSource; + css::uno::Any m_aDBConnection; + css::uno::Any m_aDBColumn; + weld::Widget* m_pParent; // parent widget used for SwWrtShell::StartInputFieldDlg() + /// Marks the PostIt field's annotation start/end if it differs from the cursor selection. + std::unique_ptr<SwPaM> m_pAnnotationRange; + + SwInsertField_Data(SwFieldTypesEnum nType, sal_uInt16 nSub, const OUString& rPar1, const OUString& rPar2, + sal_uInt32 nFormatId, SwWrtShell* pShell = nullptr, sal_Unicode cSep = ' ', bool bIsAutoLanguage = true) : + m_nTypeId(nType), + m_nSubType(nSub), + m_sPar1(rPar1), + m_sPar2(rPar2), + m_nFormatId(nFormatId), + m_pSh(pShell), + m_cSeparator(cSep), + m_bIsAutomaticLanguage(bIsAutoLanguage), + m_pParent(nullptr) {} +}; + +class SW_DLLPUBLIC SwFieldMgr +{ +private: + SwField* m_pCurField; + SwWrtShell* m_pWrtShell; // can be ZERO too! + OUString m_aCurPar1; + OUString m_aCurPar2; + OUString m_sCurFrame; + + OUString m_sMacroPath; + OUString m_sMacroName; + + sal_uInt32 m_nCurFormat; + bool m_bEvalExp; + + SAL_DLLPRIVATE LanguageType GetCurrLanguage() const; + + css::uno::Reference<css::text::XNumberingTypeInfo> m_xNumberingInfo; + SAL_DLLPRIVATE css::uno::Reference<css::text::XNumberingTypeInfo> const & GetNumberingInfo()const; + +public: + explicit SwFieldMgr(SwWrtShell* pSh = nullptr); + ~SwFieldMgr(); + + void SetWrtShell( SwWrtShell* pShell ) + { m_pWrtShell = pShell; } + + // insert field using TypeID (TYP_ ...) + bool InsertField( const SwInsertField_Data& rData ); + + // change the current field directly + void UpdateCurField(sal_uInt32 nFormat, + const OUString& rPar1, + const OUString& rPar2, + std::unique_ptr<SwField> _pField = nullptr); + + const OUString& GetCurFieldPar1() const { return m_aCurPar1; } + const OUString& GetCurFieldPar2() const { return m_aCurPar2; } + + // determine a field + SwField* GetCurField(); + + void InsertFieldType(SwFieldType const & rType); + + bool ChooseMacro(weld::Window* pDialogParent); + void SetMacroPath(const OUString& rPath); + const OUString& GetMacroPath() const { return m_sMacroPath; } + const OUString& GetMacroName() const { return m_sMacroName; } + + // previous and next of the same type + bool GoNextPrev( bool bNext = true, SwFieldType* pTyp = nullptr ); + bool GoNext() { return GoNextPrev(); } + bool GoPrev() { return GoNextPrev( false ); } + + bool IsDBNumeric(const OUString& rDBName, const OUString& rTableQryName, + bool bIsTable, const OUString& rFieldName); + + // organise RefMark with names + bool CanInsertRefMark( std::u16string_view rStr ); + + // access to field types via ResId + size_t GetFieldTypeCount() const; + SwFieldType* GetFieldType(SwFieldIds nResId, size_t nField = 0) const; + SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName) const; + + void RemoveFieldType(SwFieldIds nResId, const OUString& rName); + + // access via TypeId from the dialog + // Ids for a range of fields + static const SwFieldGroupRgn& GetGroupRange(bool bHtmlMode, sal_uInt16 nGrpId); + static sal_uInt16 GetGroup(SwFieldTypesEnum nTypeId, sal_uInt16 nSubType); + + // the current field's TypeId + SwFieldTypesEnum GetCurTypeId() const; + + // TypeId for a concrete position in the list + static SwFieldTypesEnum GetTypeId(sal_uInt16 nPos); + // name of the type in the list of fields + static const OUString & GetTypeStr(sal_uInt16 nPos); + + // Pos in the list of fields + static sal_uInt16 GetPos(SwFieldTypesEnum nTypeId); + + // subtypes to a type + void GetSubTypes(SwFieldTypesEnum nId, std::vector<OUString>& rToFill); + + // format to a type + sal_uInt16 GetFormatCount(SwFieldTypesEnum nTypeId, bool bHtmlMode) const; + OUString GetFormatStr(SwFieldTypesEnum nTypeId, sal_uInt32 nFormatId) const; + sal_uInt16 GetFormatId(SwFieldTypesEnum nTypeId, sal_uInt32 nFormatId) const; + sal_uInt32 GetDefaultFormat(SwFieldTypesEnum nTypeId, bool bIsText, SvNumberFormatter* pFormatter); + + // turn off evaluation of expression fields for insertation + // of many expression fields (see labels) + + inline void SetEvalExpFields(bool bEval); + void EvalExpFields(SwWrtShell* pSh); +}; + +inline void SwFieldMgr::SetEvalExpFields(bool bEval) + { m_bEvalExp = bEval; } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/fldtdlg.hxx b/sw/source/uibase/inc/fldtdlg.hxx new file mode 100644 index 000000000..b7bda89f9 --- /dev/null +++ b/sw/source/uibase/inc/fldtdlg.hxx @@ -0,0 +1,68 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_FLDTDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_FLDTDLG_HXX + +#include <sal/config.h> + +#include <string_view> +#include <memory> +#include <sfx2/tabdlg.hxx> + +class SfxBindings; +class SfxTabPage; +class SwChildWinWrapper; +struct SfxChildWinInfo; + +class SwFieldDlg final : public SfxTabDialogController +{ + SwChildWinWrapper* m_pChildWin; + SfxBindings* m_pBindings; + bool m_bHtmlMode; + bool m_bDataBaseMode; + bool m_bClosing; + std::unique_ptr<SfxItemSet> mxInputItemSet; + + virtual SfxItemSet* CreateInputItemSet(const OString& rId) override; + virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; + + void ReInitTabPage(std::string_view rPageId, + bool bOnlyActivate = false); + +public: + SwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, weld::Window *pParent); + virtual ~SwFieldDlg() override; + + DECL_LINK(OKHdl, weld::Button&, void); + DECL_LINK(CancelHdl, weld::Button&, void); + + void Initialize(SfxChildWinInfo const *pInfo); + void ReInitDlg(); + void EnableInsert(bool bEnable); + void InsertHdl(); + void ActivateDatabasePage(); + void ShowReferencePage(); + virtual void Close() override; + virtual void EndDialog(int nResponse) override; + virtual void Activate() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/fldwrap.hxx b/sw/source/uibase/inc/fldwrap.hxx new file mode 100644 index 000000000..b696d3061 --- /dev/null +++ b/sw/source/uibase/inc/fldwrap.hxx @@ -0,0 +1,57 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_FLDWRAP_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_FLDWRAP_HXX + +#include <vcl/vclptr.hxx> + +#include <swabstdlg.hxx> + +#include "chldwrap.hxx" +class AbstractSwFieldDlg; + +class SwFieldDlgWrapper final : public SwChildWinWrapper +{ + ScopedVclPtr<AbstractSwFieldDlg> m_pDlgInterface; +public: + SwFieldDlgWrapper(vcl::Window* pParent, sal_uInt16 nId, + SfxBindings* pBindings, SfxChildWinInfo* pInfo); + + SFX_DECL_CHILDWINDOW_WITHID(SwFieldDlgWrapper); + + virtual bool ReInitDlg(SwDocShell *pDocSh) override; + void ShowReferencePage(); +}; + +// field dialog only showing database page to support mail merge +class SwFieldDataOnlyDlgWrapper final : public SwChildWinWrapper +{ + ScopedVclPtr<AbstractSwFieldDlg> m_pDlgInterface; +public: + SwFieldDataOnlyDlgWrapper(vcl::Window* pParent, sal_uInt16 nId, + SfxBindings* pBindings, SfxChildWinInfo* pInfo); + + SFX_DECL_CHILDWINDOW(SwFieldDataOnlyDlgWrapper); + + virtual bool ReInitDlg(SwDocShell *pDocSh) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/fontcfg.hxx b/sw/source/uibase/inc/fontcfg.hxx new file mode 100644 index 000000000..3fede9ba9 --- /dev/null +++ b/sw/source/uibase/inc/fontcfg.hxx @@ -0,0 +1,112 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_FONTCFG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_FONTCFG_HXX + +#include <rtl/ustring.hxx> +#include <unotools/configitem.hxx> +#include <i18nlangtag/lang.h> +#include <swdllapi.h> + +#define FONT_STANDARD 0 +#define FONT_OUTLINE 1 +#define FONT_LIST 2 +#define FONT_CAPTION 3 +#define FONT_INDEX 4 +#define FONT_STANDARD_CJK 5 +#define FONT_OUTLINE_CJK 6 +#define FONT_LIST_CJK 7 +#define FONT_CAPTION_CJK 8 +#define FONT_INDEX_CJK 9 +#define FONT_STANDARD_CTL 10 +#define FONT_OUTLINE_CTL 11 +#define FONT_LIST_CTL 12 +#define FONT_CAPTION_CTL 13 +#define FONT_INDEX_CTL 14 +#define DEF_FONT_COUNT 15 + +#define FONT_PER_GROUP 5 + +#define FONT_GROUP_DEFAULT 0 +#define FONT_GROUP_CJK 1 +#define FONT_GROUP_CTL 2 + +//pt-size of fonts +#define FONTSIZE_DEFAULT 240 +#define FONTSIZE_CJK_DEFAULT 210 +#define FONTSIZE_OUTLINE 280 + +class SW_DLLPUBLIC SwStdFontConfig final : public utl::ConfigItem +{ + OUString m_sDefaultFonts[DEF_FONT_COUNT]; + sal_Int32 m_nDefaultFontHeight[DEF_FONT_COUNT]; + + SAL_DLLPRIVATE static css::uno::Sequence<OUString> const & GetPropertyNames(); + + void ChangeString(sal_uInt16 nFontType, const OUString& rSet) + { + if(m_sDefaultFonts[nFontType] != rSet) + { + SetModified(); + m_sDefaultFonts[nFontType] = rSet; + } + } + + void ChangeInt( sal_uInt16 nFontType, sal_Int32 nHeight ); + + virtual void ImplCommit() override; + +public: + SwStdFontConfig(); + virtual ~SwStdFontConfig() override; + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + + const OUString& GetFontStandard(sal_uInt8 nFontGroup) const {return m_sDefaultFonts[FONT_STANDARD + FONT_PER_GROUP * nFontGroup];} + const OUString& GetFontOutline(sal_uInt8 nFontGroup) const {return m_sDefaultFonts[FONT_OUTLINE + FONT_PER_GROUP * nFontGroup];} + const OUString& GetFontList (sal_uInt8 nFontGroup) const {return m_sDefaultFonts[FONT_LIST + FONT_PER_GROUP * nFontGroup];} + const OUString& GetFontCaption(sal_uInt8 nFontGroup) const {return m_sDefaultFonts[FONT_CAPTION + FONT_PER_GROUP * nFontGroup];} + const OUString& GetFontIndex (sal_uInt8 nFontGroup) const {return m_sDefaultFonts[FONT_INDEX + FONT_PER_GROUP * nFontGroup];} + + const OUString& GetFontFor(sal_uInt16 nFontType) const {return m_sDefaultFonts[nFontType];} + bool IsFontDefault(sal_uInt16 nFontType) const; + + void SetFontStandard(const OUString& rSet, sal_uInt8 nFontGroup) + {ChangeString(FONT_STANDARD + FONT_PER_GROUP * nFontGroup, rSet);} + + void SetFontOutline(const OUString& rSet, sal_uInt8 nFontGroup) + { ChangeString(FONT_OUTLINE + FONT_PER_GROUP * nFontGroup, rSet);} + void SetFontList (const OUString& rSet, sal_uInt8 nFontGroup) + { ChangeString(FONT_LIST + FONT_PER_GROUP * nFontGroup, rSet);} + void SetFontCaption(const OUString& rSet, sal_uInt8 nFontGroup) + { ChangeString(FONT_CAPTION + FONT_PER_GROUP * nFontGroup, rSet);} + void SetFontIndex (const OUString& rSet, sal_uInt8 nFontGroup) + { ChangeString(FONT_INDEX + FONT_PER_GROUP * nFontGroup, rSet);} + + void SetFontHeight( sal_Int32 nHeight, sal_uInt8 nFont, sal_uInt8 nScriptType ) + { ChangeInt(nFont + FONT_PER_GROUP * nScriptType, nHeight);} + + sal_Int32 GetFontHeight( sal_uInt8 nFont, sal_uInt8 nScriptType, LanguageType eLang ); + + static OUString GetDefaultFor(sal_uInt16 nFontType, LanguageType eLang); + static sal_Int32 GetDefaultHeightFor(sal_uInt16 nFontType, LanguageType eLang); +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/formatclipboard.hxx b/sw/source/uibase/inc/formatclipboard.hxx new file mode 100644 index 000000000..e83267bd7 --- /dev/null +++ b/sw/source/uibase/inc/formatclipboard.hxx @@ -0,0 +1,95 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_FORMATCLIPBOARD_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_FORMATCLIPBOARD_HXX + +#include <sal/config.h> + +#include <memory> + +#include "wrtsh.hxx" +#include <svl/itemset.hxx> +#include <svl/style.hxx> + +/** This class acts as data container and execution class for the format paintbrush feature in writer. +*/ + +class SwFormatClipboard +{ +public: + SwFormatClipboard(); + + /** + * Test if the object contains text or paragraph attribute + */ + bool HasContent() const; + bool HasContentForThisType(SelectionType nSelectionType) const; + static bool CanCopyThisType(SelectionType nSelectionType); + + /** + * Store/Backup the text and paragraph attribute of the current selection. + * + * @param bPersistentCopy + * input parameter - specify if the Paste function will erase the current object. + */ + void Copy(SwWrtShell& rWrtShell, SfxItemPool& rPool, bool bPersistentCopy); + + /** + * Paste the stored text and paragraph attributes on the current selection and current paragraph. + * + * @param bNoCharacterFormats + * Do not paste the character formats. + * + * @param bNoParagraphFormats + * Do not paste the paragraph formats. + */ + void Paste(SwWrtShell& rWrtShell, SfxStyleSheetBasePool* pPool, bool bNoCharacterFormats, + bool bNoParagraphFormats); + + /** + * Clear the currently stored text and paragraph attributes. + */ + void Erase(); + +private: + SelectionType m_nSelectionType; + + /** automatic/named character attribute set */ + std::unique_ptr<SfxItemSet> m_pItemSet_TextAttr; + /** automatic/named paragraph attribute set + * (it can be character attribute applied to the paragraph) */ + std::unique_ptr<SfxItemSet> m_pItemSet_ParAttr; + + /** table attribute set */ + std::unique_ptr<SfxItemSet> m_pTableItemSet; + + /** name of the character format (if it exist) */ + OUString m_aCharStyle; + /** name of the paragraph format (if it exist) */ + OUString m_aParaStyle; + //no frame style because it contains position information + + /** specify if the Paste function have to clear the current object */ + bool m_bPersistentCopy; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/frmdlg.hxx b/sw/source/uibase/inc/frmdlg.hxx new file mode 100644 index 000000000..87f03d8cc --- /dev/null +++ b/sw/source/uibase/inc/frmdlg.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_SW_SOURCE_UIBASE_INC_FRMDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_FRMDLG_HXX + +#include <sfx2/tabdlg.hxx> +#include <sfx2/viewfrm.hxx> + +class SwWrtShell; + +// frame dialog +class SwFrameDlg final : public SfxTabDialogController +{ + bool m_bFormat; + bool m_bNew; + const SfxItemSet& m_rSet; + OUString m_sDlgType; + SwWrtShell* m_pWrtShell; + + virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; + +public: + SwFrameDlg(SfxViewFrame const *pFrame, weld::Window* pParent, + const SfxItemSet& rCoreSet, + bool bNewFrame, + const OUString& sResType, + bool bFormat, + const OString& sDefPage = OString(), + const OUString* pFormatStr = nullptr); + + virtual ~SwFrameDlg() override; + + SwWrtShell* GetWrtShell() { return m_pWrtShell; } +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_FRMDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/frmmgr.hxx b/sw/source/uibase/inc/frmmgr.hxx new file mode 100644 index 000000000..92e23853f --- /dev/null +++ b/sw/source/uibase/inc/frmmgr.hxx @@ -0,0 +1,174 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_FRMMGR_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_FRMMGR_HXX + +#include <swtypes.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/shaditem.hxx> +#include <tools/gen.hxx> +#include <fmtfsize.hxx> +#include <fmtornt.hxx> +#include <fmtanchr.hxx> +#include <swdllapi.h> + +class SwWrtShell; +struct SvxSwFrameValidation; +struct SwPosition; + +class SwFormatCol; +class SvGlobalName; + +constexpr SwTwips DFLT_WIDTH = o3tl::toTwips(20, o3tl::Length::mm); +constexpr SwTwips DFLT_HEIGHT = o3tl::toTwips(5, o3tl::Length::mm); + +enum class Frmmgr_Type +{ + NONE = 0x00, + TEXT = 0x01, + GRF = 0x02, + OLE = 0x04, + ENVELP = 0x10 +}; + +class SW_DLLPUBLIC SwFlyFrameAttrMgr +{ + SfxItemSet m_aSet; + Point m_aAbsPos; + SwWrtShell* m_pOwnSh; + + bool m_bAbsPos, + m_bNewFrame; + bool m_bIsInVertical; + // #mongolianlayout# + bool m_bIsInVerticalL2R; + + // internal calculation for borders + SAL_DLLPRIVATE SwTwips CalcTopSpace(); + SAL_DLLPRIVATE SwTwips CalcBottomSpace(); + SAL_DLLPRIVATE SwTwips CalcLeftSpace(); + SAL_DLLPRIVATE SwTwips CalcRightSpace(); + + SAL_DLLPRIVATE void UpdateFlyFrame_(); // post-treatment after insert or update + +public: + SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nType, const SvGlobalName* pName ); + + //CopyCtor for dialogs to check the metrics + SwFlyFrameAttrMgr( bool bNew, SwWrtShell *pSh, const SfxItemSet &rSet ); + + void SetAnchor(RndStdIds eId); + inline RndStdIds GetAnchor() const; + + void SetHorzOrientation(sal_Int16 eOrient); + void SetVertOrientation(sal_Int16 eOrient); + + // absolute position + void SetAbsPos(const Point& rLPoint); + + // anchor's relative position + void SetPos(const Point& rLPoint); + inline Point GetPos() const; + + // size + void SetSize(const Size& rLSize); + inline const Size& GetSize() const; + + void SetHeightSizeType(SwFrameSize eType); + + // rotation + void SetRotation(Degree10 nOld, Degree10 nNew, const Size& rUnrotatedSize); + + // space to content + void SetLRSpace( tools::Long nLeft, + tools::Long nRight ); + void SetULSpace( tools::Long nTop, + tools::Long nBottom ); + + void SetCol( const SwFormatCol &rCol); + + // change and query attributes + void UpdateAttrMgr(); + void UpdateFlyFrame(); + + // create new frame + void InsertFlyFrame(); + void InsertFlyFrame(RndStdIds eAnchorType, + const Point &rPos, + const Size &rSize); + + // check and change metrics + void ValidateMetrics(SvxSwFrameValidation& rVal, + const SwPosition* pToCharContentPos, + bool bOnlyPercentRefValue = false); + + void DelAttr(sal_uInt16 nId); + + // reach out the set + const SfxItemSet &GetAttrSet() const { return m_aSet; } + SfxItemSet &GetAttrSet() { return m_aSet; } + void SetAttrSet(const SfxItemSet& rSet); + + inline const SwFormatVertOrient &GetVertOrient() const; + inline const SwFormatHoriOrient &GetHoriOrient() const; + inline const SvxShadowItem &GetShadow() const; + inline const SvxBoxItem &GetBox() const; + inline const SwFormatFrameSize &GetFrameSize() const; + + tools::Long CalcWidthBorder() { return CalcLeftSpace()+CalcRightSpace(); } + tools::Long CalcHeightBorder() { return CalcTopSpace()+CalcBottomSpace(); } +}; + +inline const Size& SwFlyFrameAttrMgr::GetSize() const +{ + return m_aSet.Get(RES_FRM_SIZE).GetSize(); +} + +inline const SwFormatVertOrient &SwFlyFrameAttrMgr::GetVertOrient() const +{ + return m_aSet.Get(RES_VERT_ORIENT); +} +inline const SwFormatHoriOrient &SwFlyFrameAttrMgr::GetHoriOrient() const +{ + return m_aSet.Get(RES_HORI_ORIENT); +} +inline const SwFormatFrameSize& SwFlyFrameAttrMgr::GetFrameSize() const +{ + return m_aSet.Get(RES_FRM_SIZE); +} +inline const SvxShadowItem &SwFlyFrameAttrMgr::GetShadow() const +{ + return m_aSet.Get(RES_SHADOW); +} +inline const SvxBoxItem &SwFlyFrameAttrMgr::GetBox() const +{ + return m_aSet.Get(RES_BOX); +} +inline Point SwFlyFrameAttrMgr::GetPos() const +{ + return Point( GetHoriOrient().GetPos(), GetVertOrient().GetPos() ); +} +inline RndStdIds SwFlyFrameAttrMgr::GetAnchor() const +{ + return m_aSet.Get(RES_ANCHOR).GetAnchorId(); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx new file mode 100644 index 000000000..1e01a6fa1 --- /dev/null +++ b/sw/source/uibase/inc/frmpage.hxx @@ -0,0 +1,327 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_FRMPAGE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_FRMPAGE_HXX + +#include <sfx2/tabdlg.hxx> +#include <svx/dialcontrol.hxx> +#include <svx/frmdirlbox.hxx> +#include <svx/swframeexample.hxx> +#include <swtypes.hxx> +#include "bmpwin.hxx" +#include "prcntfld.hxx" + +namespace sfx2{class FileDialogHelper;} +class SwWrtShell; +struct FrameMap; +// OD 12.11.2003 #i22341# +struct SwPosition; + +// frame dialog +class SwFramePage final : public SfxTabPage +{ + bool m_bAtHorzPosModified; + bool m_bAtVertPosModified; + + bool m_bFormat; + bool m_bNew; + bool m_bNoModifyHdl; + bool m_bIsVerticalFrame; //current frame is in vertical environment - strings are exchanged + // #mongolianlayout# + bool m_bIsVerticalL2R; + bool m_bIsInRightToLeft; // current frame is in right-to-left environment - strings are exchanged + bool m_bHtmlMode; + sal_uInt16 m_nHtmlMode; + OUString m_sDlgType; + Size m_aGrfSize; + SwTwips m_nUpperBorder; + SwTwips m_nLowerBorder; + double m_fWidthHeightRatio; //width-to-height ratio to support the KeepRatio button + + // OD 12.11.2003 #i22341# - keep content position of character for + // to character anchored objects. + const SwPosition* mpToCharContentPos; + + // old alignment + sal_Int16 m_nOldH; + sal_Int16 m_nOldHRel; + sal_Int16 m_nOldV; + sal_Int16 m_nOldVRel; + + FrameMap const * m_pVMap; + FrameMap const * m_pHMap; + + bool m_bAllowVertPositioning; + bool m_bIsMathOLE; + bool m_bIsMathBaselineAlignment; + + SwFrameExample m_aExampleWN; + + // size + std::unique_ptr<weld::Label> m_xWidthFT; + std::unique_ptr<weld::Label> m_xWidthAutoFT; + std::unique_ptr<weld::CheckButton> m_xRelWidthCB; + std::unique_ptr<weld::ComboBox> m_xRelWidthRelationLB; + std::unique_ptr<weld::CheckButton> m_xAutoWidthCB; + + std::unique_ptr<weld::Label> m_xHeightFT; + std::unique_ptr<weld::Label> m_xHeightAutoFT; + std::unique_ptr<weld::CheckButton> m_xRelHeightCB; + std::unique_ptr<weld::ComboBox> m_xRelHeightRelationLB; + std::unique_ptr<weld::CheckButton> m_xAutoHeightCB; + + std::unique_ptr<weld::CheckButton> m_xFixedRatioCB; + std::unique_ptr<weld::Button> m_xRealSizeBT; + + // anchor + std::unique_ptr<weld::Widget> m_xAnchorFrame; + std::unique_ptr<weld::RadioButton> m_xAnchorAtPageRB; + std::unique_ptr<weld::RadioButton> m_xAnchorAtParaRB; + std::unique_ptr<weld::RadioButton> m_xAnchorAtCharRB; + std::unique_ptr<weld::RadioButton> m_xAnchorAsCharRB; + std::unique_ptr<weld::RadioButton> m_xAnchorAtFrameRB; + + // position + std::unique_ptr<weld::Label> m_xHorizontalFT; + std::unique_ptr<weld::ComboBox> m_xHorizontalDLB; + std::unique_ptr<weld::Label> m_xAtHorzPosFT; + std::unique_ptr<weld::MetricSpinButton> m_xAtHorzPosED; + std::unique_ptr<weld::Label> m_xHoriRelationFT; + std::unique_ptr<weld::ComboBox> m_xHoriRelationLB; + + std::unique_ptr<weld::CheckButton> m_xMirrorPagesCB; + + std::unique_ptr<weld::Label> m_xVerticalFT; + std::unique_ptr<weld::ComboBox> m_xVerticalDLB; + std::unique_ptr<weld::Label> m_xAtVertPosFT; + std::unique_ptr<weld::MetricSpinButton> m_xAtVertPosED; + std::unique_ptr<weld::Label> m_xVertRelationFT; + std::unique_ptr<weld::ComboBox> m_xVertRelationLB; + // #i18732# - check box for new option 'FollowTextFlow' + std::unique_ptr<weld::CheckButton> m_xFollowTextFlowCB; + + // example + std::unique_ptr<weld::CustomWeld> m_xExampleWN; + + std::unique_ptr<SwPercentField> m_xWidthED; + std::unique_ptr<SwPercentField> m_xHeightED; + + virtual void ActivatePage(const SfxItemSet& rSet) override; + virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; + + DECL_LINK(RangeModifyClickHdl, weld::Toggleable&, void); + void RangeModifyHdl(); + DECL_LINK(AnchorTypeHdl, weld::Toggleable&, void); + DECL_LINK(PosHdl, weld::ComboBox&, void); + DECL_LINK(RelHdl, weld::ComboBox&, void); + void InitPos(RndStdIds eId, sal_Int16 nH, sal_Int16 nHRel, + sal_Int16 nV, sal_Int16 nVRel, + tools::Long nX, tools::Long nY); + + DECL_LINK(RealSizeHdl, weld::Button&, void); + DECL_LINK(RelSizeClickHdl, weld::Toggleable&, void); + DECL_LINK(MirrorHdl, weld::Toggleable&, void); + + DECL_LINK(AutoWidthClickHdl, weld::Toggleable&, void); + DECL_LINK(AutoHeightClickHdl, weld::Toggleable&, void); + + // update example + void UpdateExample(); + DECL_LINK(ModifyHdl, weld::MetricSpinButton&, void); + + void Init(const SfxItemSet& rSet); + // OD 12.11.2003 #i22341# - adjustment to handle maps, that are ambiguous + // in the alignment. + sal_Int32 FillPosLB( const FrameMap* _pMap, + const sal_Int16 _nAlign, + const sal_Int16 _nRel, + weld::ComboBox& _rLB ); + // OD 14.11.2003 #i22341# - adjustment to handle maps, that are ambiguous + // in their string entries. + void FillRelLB( const FrameMap* _pMap, + const sal_uInt16 _nLBSelPos, + const sal_Int16 _nAlign, + const sal_Int16 _nRel, + weld::ComboBox& _rLB, + weld::Label& _rFT ); + static sal_Int32 GetMapPos(const FrameMap *pMap, const weld::ComboBox& rAlignLB); + static sal_Int16 GetAlignment(FrameMap const *pMap, sal_Int32 nMapPos, const weld::ComboBox& rRelationLB); + static sal_Int16 GetRelation(const weld::ComboBox& rRelationLB); + RndStdIds GetAnchor() const; + + void setOptimalFrameWidth(); + void setOptimalRelWidth(); + + void EnableGraficMode(); // hides auto check boxes and re-org controls for "Real Size" button + + SwWrtShell *getFrameDlgParentShell(); + + static const WhichRangesContainer aPageRg; + +public: + SwFramePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet); + virtual ~SwFramePage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet); + static WhichRangesContainer GetRanges() { return aPageRg; } + + virtual bool FillItemSet(SfxItemSet *rSet) override; + virtual void Reset(const SfxItemSet *rSet) override; + + void SetNewFrame(bool bNewFrame) { m_bNew = bNewFrame; } + void SetFormatUsed(bool bFormat); + void SetFrameType(const OUString &rType) { m_sDlgType = rType; } + bool IsInGraficMode() const { return m_sDlgType == "PictureDialog" || m_sDlgType == "ObjectDialog"; } + void EnableVerticalPositioning( bool bEnable ); +}; + +class SwGrfExtPage final : public SfxTabPage +{ + OUString aFilterName; + OUString aGrfName, aNewGrfName; + + std::unique_ptr<::sfx2::FileDialogHelper> m_xGrfDlg; + + bool m_bHtmlMode; + + // mirror + BmpWindow m_aBmpWin; + std::unique_ptr<weld::Widget> m_xMirror; + std::unique_ptr<weld::CheckButton> m_xMirrorVertBox; + std::unique_ptr<weld::CheckButton> m_xMirrorHorzBox; + std::unique_ptr<weld::RadioButton> m_xAllPagesRB; + std::unique_ptr<weld::RadioButton> m_xLeftPagesRB; + std::unique_ptr<weld::RadioButton> m_xRightPagesRB; + + std::unique_ptr<weld::Entry> m_xConnectED; + std::unique_ptr<weld::Button> m_xBrowseBT; + std::unique_ptr<weld::Frame> m_xLinkFrame; + + // RotGrfFlyFrame: Need Angle and RotateControls now + std::unique_ptr<weld::Frame> m_xFlAngle; + std::unique_ptr<weld::MetricSpinButton> m_xNfAngle; + std::unique_ptr<svx::DialControl> m_xCtlAngle; + std::unique_ptr<weld::CustomWeld> m_xCtlAngleWin; + std::unique_ptr<weld::CustomWeld> m_xBmpWin; + + // tdf#138843 add place holder for the graphic type + std::unique_ptr<weld::Label> m_xLabelGraphicType; + + // handler for mirroring + DECL_LINK(MirrorHdl, weld::Toggleable&, void); + DECL_LINK(BrowseHdl, weld::Button&, void); + + virtual void ActivatePage(const SfxItemSet& rSet) override; + +public: + SwGrfExtPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet); + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet); + virtual ~SwGrfExtPage() override; + + virtual bool FillItemSet(SfxItemSet *rSet) override; + virtual void Reset(const SfxItemSet *rSet) override; + virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; +}; + +class SwFrameURLPage final : public SfxTabPage +{ + // hyperlink + std::unique_ptr<weld::Entry> m_xURLED; + std::unique_ptr<weld::Button> m_xSearchPB; + std::unique_ptr<weld::Entry> m_xNameED; + std::unique_ptr<weld::ComboBox> m_xFrameCB; + + // image map + std::unique_ptr<weld::CheckButton> m_xServerCB; + std::unique_ptr<weld::CheckButton> m_xClientCB; + + DECL_LINK(InsertFileHdl, weld::Button&, void); + +public: + SwFrameURLPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet); + virtual ~SwFrameURLPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet); + + virtual bool FillItemSet(SfxItemSet *rSet) override; + virtual void Reset(const SfxItemSet *rSet) override; +}; + +class SwFrameAddPage final : public SfxTabPage +{ + SwWrtShell* m_pWrtSh; + + OUString m_sDlgType; + bool m_bHtmlMode; + bool m_bFormat; + bool m_bNew; + + std::unique_ptr<weld::Widget> m_xNameFrame; + std::unique_ptr<weld::Label> m_xNameFT; + std::unique_ptr<weld::Entry> m_xNameED; + std::unique_ptr<weld::Label> m_xAltNameFT; + std::unique_ptr<weld::Entry> m_xAltNameED; + std::unique_ptr<weld::Label> m_xDescriptionFT; + std::unique_ptr<weld::TextView> m_xDescriptionED; + std::unique_ptr<weld::Widget> m_xSequenceFrame; + std::unique_ptr<weld::Label> m_xPrevFT; + std::unique_ptr<weld::ComboBox> m_xPrevLB; + std::unique_ptr<weld::Label> m_xNextFT; + std::unique_ptr<weld::ComboBox> m_xNextLB; + + std::unique_ptr<weld::Widget> m_xProtectFrame; + std::unique_ptr<weld::CheckButton> m_xProtectContentCB; + std::unique_ptr<weld::CheckButton> m_xProtectFrameCB; + std::unique_ptr<weld::CheckButton> m_xProtectSizeCB; + + std::unique_ptr<weld::Widget> m_xContentAlignFrame; + std::unique_ptr<weld::ComboBox> m_xVertAlignLB; + + std::unique_ptr<weld::Widget> m_xPropertiesFrame; + std::unique_ptr<weld::CheckButton> m_xEditInReadonlyCB; + std::unique_ptr<weld::CheckButton> m_xPrintFrameCB; + std::unique_ptr<weld::Label> m_xTextFlowFT; + std::unique_ptr<svx::FrameDirectionListBox> m_xTextFlowLB; + + DECL_LINK(EditModifyHdl, weld::Entry&, void); + DECL_LINK(ChainModifyHdl, weld::ComboBox&, void); + + static const WhichRangesContainer aAddPgRg; + +public: + SwFrameAddPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet); + virtual ~SwFrameAddPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet); + static WhichRangesContainer GetRanges() { return aAddPgRg; } + + virtual bool FillItemSet(SfxItemSet *rSet) override; + virtual void Reset(const SfxItemSet *rSet) override; + + void SetFormatUsed(bool bFormat); + void SetFrameType(const OUString &rType) { m_sDlgType = rType; } + void SetNewFrame(bool bNewFrame) { m_bNew = bNewFrame; } + void SetShell(SwWrtShell* pSh) { m_pWrtSh = pSh; } + +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_FRMPAGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/frmsh.hxx b/sw/source/uibase/inc/frmsh.hxx new file mode 100644 index 000000000..3bb36497b --- /dev/null +++ b/sw/source/uibase/inc/frmsh.hxx @@ -0,0 +1,54 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_FRMSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_FRMSH_HXX + +#include "basesh.hxx" + +class SwFrameShell: public SwBaseShell +{ +public: + SFX_DECL_INTERFACE(SW_FRAMESHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwFrameShell(SwView &rView); + virtual ~SwFrameShell() override; + + void Execute(SfxRequest &); + void ExecMove(SfxRequest& rReq); + void ExecField(const SfxRequest& rReq); + void GetState(SfxItemSet &); + void ExecFrameStyle(SfxRequest const & rReq); + void GetLineStyleState(SfxItemSet &rSet); + void StateInsert(SfxItemSet &rSet); + + void GetDrawAttrStateTextFrame(SfxItemSet &rSet); + void ExecDrawAttrArgsTextFrame(SfxRequest const & rReq); + + void ExecDrawDlgTextFrame(SfxRequest const & rReq); + void DisableStateTextFrame(SfxItemSet &rSet); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/globals.h b/sw/source/uibase/inc/globals.h new file mode 100644 index 000000000..8617d791c --- /dev/null +++ b/sw/source/uibase/inc/globals.h @@ -0,0 +1,31 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_GLOBALS_H +#define INCLUDED_SW_SOURCE_UIBASE_INC_GLOBALS_H + +enum SwChangeState +{ + STATE_OFF = 0, + STATE_ON = 1, + STATE_TOGGLE = 2 +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/glosbib.hxx b/sw/source/uibase/inc/glosbib.hxx new file mode 100644 index 000000000..a012381ce --- /dev/null +++ b/sw/source/uibase/inc/glosbib.hxx @@ -0,0 +1,80 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_GLOSBIB_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_GLOSBIB_HXX + +#include <sfx2/basedlgs.hxx> +#include <rtl/ustring.hxx> +#include <vcl/weld.hxx> + +#include <vector> + +class SwGlossaryHdl; + +struct GlosBibUserData +{ + OUString sPath; + OUString sGroupName; + OUString sGroupTitle; +}; + +class SwGlossaryGroupDlg final : public SfxDialogController +{ + std::vector<OUString> m_RemovedArr; + std::vector<OUString> m_InsertedArr; + std::vector<OUString> m_RenamedArr; + + weld::Window* m_pParent; + SwGlossaryHdl* pGlosHdl; + + OUString sCreatedGroup; + + std::unique_ptr<weld::Entry> m_xNameED; + std::unique_ptr<weld::ComboBox> m_xPathLB; + std::unique_ptr<weld::TreeView> m_xGroupTLB; + + std::unique_ptr<weld::Button> m_xNewPB; + std::unique_ptr<weld::Button> m_xDelPB; + std::unique_ptr<weld::Button> m_xRenamePB; + + bool IsDeleteAllowed(const OUString& rGroup); + + void Apply(); + DECL_LINK(SelectHdl, weld::TreeView&, void); + DECL_LINK(NewHdl, weld::Button&, void); + DECL_LINK(DeleteHdl, weld::Button&, void); + DECL_LINK(ModifyHdl, weld::Entry&, void); + DECL_LINK(ModifyListBoxHdl, weld::ComboBox&, void); + DECL_LINK(RenameHdl, weld::Button&, void); + DECL_STATIC_LINK(SwGlossaryGroupDlg, EditInsertTextHdl, OUString&, bool); + DECL_LINK(EntrySizeAllocHdl, const Size&, void); + +public: + SwGlossaryGroupDlg(weld::Window* pParent, std::vector<OUString> const& rPathArr, + SwGlossaryHdl* pGlosHdl); + virtual short run() override; + virtual ~SwGlossaryGroupDlg() override; + + const OUString& GetCreatedGroupName() const { return sCreatedGroup; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/glosdoc.hxx b/sw/source/uibase/inc/glosdoc.hxx new file mode 100644 index 000000000..e6d01aa44 --- /dev/null +++ b/sw/source/uibase/inc/glosdoc.hxx @@ -0,0 +1,125 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_GLOSDOC_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_GLOSDOC_HXX + +#include <rtl/ustring.hxx> +#include <com/sun/star/text/XAutoTextGroup.hpp> + +class SwTextBlocks; +class SwDocShell; + +#ifndef SW_DECL_SWDOCSHELL_DEFINED +#define SW_DECL_SWDOCSHELL_DEFINED +#include <tools/ref.hxx> +typedef tools::SvRef<SwDocShell> SwDocShellRef; +#endif +#include <cppuhelper/weakref.hxx> + +#include <vector> +#include <swdllapi.h> + +typedef std::vector< css::uno::WeakReference< css::text::XAutoTextGroup > > UnoAutoTextGroups; +typedef std::vector< css::uno::WeakReference< css::text::XAutoTextEntry > > UnoAutoTextEntries; + +#define GLOS_DELIM u'*' + +class SW_DLLPUBLIC SwGlossaries +{ + UnoAutoTextGroups m_aGlossaryGroups; + UnoAutoTextEntries m_aGlossaryEntries; + + OUString m_aPath; + std::vector<OUString> m_aInvalidPaths; + std::vector<OUString> m_PathArr; + std::vector<OUString> m_GlosArr; + bool m_bError; + + SAL_DLLPRIVATE std::unique_ptr<SwTextBlocks> GetGlosDoc(const OUString &rName, bool bCreate = true) const; + SAL_DLLPRIVATE std::vector<OUString> & GetNameList(); + + // implementation in unoatxt.cxx + SAL_DLLPRIVATE void RemoveFileFromList( const OUString& rGroup ); + SAL_DLLPRIVATE void InvalidateUNOOjects(); + +public: + SwGlossaries(); + ~SwGlossaries(); + + /** returns the cached AutoTextGroup (if any) for the given group name + The group is created if it does not yet exist + + @precond + If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method. + + @param _rGroupName + the name of the glossaries group + */ + css::uno::Reference< css::text::XAutoTextGroup > + GetAutoTextGroup( + std::u16string_view _rGroupName + ); + + /** returns the cached AutoTextEntry (if any) for the given group/with the given name + The entry is created if it does not yet exist + + @precond + If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method. + + @param _rGroupAccessName + the name to access the group + @param _rGroupName + the name of the glossaries group, as to be passed to the entry + @param _rEntryName + the name of the auto text entry + */ + css::uno::Reference< css::text::XAutoTextEntry > + GetAutoTextEntry( + const OUString& _rCompleteGroupName, + const OUString& _rGroupName, + const OUString& _rEntryName + ); + + size_t GetGroupCnt(); + OUString const & GetGroupName(size_t); + OUString GetGroupTitle( const OUString& rGroupName ); + + bool FindGroupName(OUString& rGroup); + + std::unique_ptr<SwTextBlocks> + GetGroupDoc(const OUString &rName, + bool bCreate = false); + static OUString GetDefName(); + static OUString GetExtension(); + + OUString GetCompleteGroupName( std::u16string_view GroupName ); + + bool NewGroupDoc(OUString &rGroupName, const OUString& rTitle); + bool RenameGroupDoc(const OUString& sOldGroup, OUString& sNewGroup, const OUString& rNewTitle); + bool DelGroupDoc(std::u16string_view); + SwDocShellRef EditGroupDoc(const OUString &rGrpName, const OUString& rShortName, bool bShow = true ); + void UpdateGlosPath(bool bFull); + void ShowError(); + bool IsGlosPathErr() const { return m_bError; } + std::vector<OUString> const& GetPathArray() const { return m_PathArr; } +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_GLOSDOC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/gloshdl.hxx b/sw/source/uibase/inc/gloshdl.hxx new file mode 100644 index 000000000..8b34947cb --- /dev/null +++ b/sw/source/uibase/inc/gloshdl.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_SW_SOURCE_UIBASE_INC_GLOSHDL_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_GLOSHDL_HXX + +#include <memory> +#include <rtl/ustring.hxx> +#include <vcl/weld.hxx> + +#include <swdllapi.h> + +class SwWrtShell; +class SwTextBlocks; +class SvxMacro; +class SwGlossaries; +class SfxViewFrame; + +class SW_DLLPUBLIC SwGlossaryHdl +{ + + SwGlossaries& m_rStatGlossaries; + OUString m_aCurGrp; + SfxViewFrame* m_pViewFrame; + SwWrtShell* m_pWrtShell; + std::unique_ptr<SwTextBlocks> + m_pCurGrp; + + SAL_DLLPRIVATE bool Expand(weld::Window* pParent, const OUString& rShortName, + SwGlossaries* pGlossaries, + std::unique_ptr<SwTextBlocks> pGlossary ); + +public: + void GlossaryDlg(); + + size_t GetGroupCnt() const; + OUString GetGroupName( size_t, OUString* pTitle ); + void NewGroup(OUString & rGroupName, const OUString& rTitle); + bool DelGroup(const OUString &); + void RenameGroup(const OUString& rOld, OUString& rNew, const OUString& rNewTitle); + void SetCurGroup(const OUString &aGrp, bool bApi = false, bool bAlwaysCreateNew = false); + + sal_uInt16 GetGlossaryCnt() const; + OUString GetGlossaryName(sal_uInt16); + OUString GetGlossaryShortName(const OUString &rName); + OUString GetGlossaryShortName(sal_uInt16); + + bool Rename( const OUString& rOldShortName, const OUString& rNewShortName, + const OUString& rNewName); + bool CopyOrMove( const OUString& rSourceGroupName, OUString& rSourceShortName, + const OUString& rDestGroupName, const OUString& rLongName, bool bMove ); + bool HasShortName(const OUString &rShortName) const; + // when NewGlossary is called from Basic then the previously set group should + // be newly created if applicable. + bool NewGlossary(const OUString &rName, const OUString &rShortName, + bool bApiCall = false, bool bNoAttr = false ); + bool DelGlossary(const OUString&); + bool CopyToClipboard(SwWrtShell& rSh, const OUString& rShortName); + + bool ExpandGlossary(weld::Window* pParent); + bool InsertGlossary(const OUString &rName); + + void SetMacros(const OUString& rName, + const SvxMacro* pStart, + const SvxMacro* pEnd, + SwTextBlocks *pGlossary = nullptr ); + void GetMacros(const OUString& rShortName, + SvxMacro& rStart, + SvxMacro& rEnd, + SwTextBlocks* pGlossary = nullptr ); + + bool IsReadOnly( const OUString* = nullptr ) const; + bool IsOld() const; + + bool FindGroupName(OUString& rGroup); // find group without path index + + bool ImportGlossaries( const OUString& rName ); + + SwGlossaryHdl(SfxViewFrame* pViewFrame, SwWrtShell *); + ~SwGlossaryHdl(); +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_GLOSHDL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/gloslst.hxx b/sw/source/uibase/inc/gloslst.hxx new file mode 100644 index 000000000..65e09f5cf --- /dev/null +++ b/sw/source/uibase/inc/gloslst.hxx @@ -0,0 +1,82 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_GLOSLST_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_GLOSLST_HXX + +#include <rtl/ustring.hxx> +#include <tools/datetime.hxx> +#include <vcl/timer.hxx> + +#include <vector> + +class SwGlossaries; + +struct AutoTextGroup +{ + sal_uInt16 nCount; + OUString sName; + OUString sTitle; + OUString sLongNames; // by 0x0A separated long names + OUString sShortNames; // by 0x0A separated short names + DateTime aDateModified; + + AutoTextGroup() + : nCount(0) + , aDateModified(DateTime::EMPTY) + { + } +}; + +class SwGlossaryList final : public AutoTimer +{ + std::vector<std::unique_ptr<AutoTextGroup>> m_aGroupArr; + OUString m_sPath; + bool m_bFilled; + + AutoTextGroup* FindGroup(std::u16string_view rGroupName); + static void FillGroup(AutoTextGroup* pGroup, SwGlossaries* pGloss); + +public: + SwGlossaryList(); + virtual ~SwGlossaryList() override; + + void HasLongName(const std::vector<OUString>& rBeginCandidates, + std::vector<std::pair<OUString, sal_uInt16>>& rLongNames); + bool GetShortName(std::u16string_view rLongName, + OUString& rShortName, OUString& rGroupName ); + + size_t GetGroupCount(); + OUString GetGroupName(size_t nPos); + OUString GetGroupTitle(size_t nPos); + + sal_uInt16 GetBlockCount(size_t nGroup); + OUString GetBlockLongName(size_t nGroup, sal_uInt16 nBlock); + OUString GetBlockShortName(size_t nGroup, sal_uInt16 nBlock); + + void Update(); + + virtual void Invoke() override; + + void ClearGroups(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/glossary.hxx b/sw/source/uibase/inc/glossary.hxx new file mode 100644 index 000000000..d0a99a86a --- /dev/null +++ b/sw/source/uibase/inc/glossary.hxx @@ -0,0 +1,126 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_GLOSSARY_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_GLOSSARY_HXX + +#include <vcl/customweld.hxx> +#include <vcl/textfilter.hxx> +#include <vcl/weld.hxx> + +#include <com/sun/star/text/XAutoTextContainer2.hpp> + +#include <rtl/ustring.hxx> +#include <sfx2/basedlgs.hxx> + +struct GroupUserData; +class SwGlossaryHdl; +class SwNewGlosNameDlg; +class SwWrtShell; +class SfxViewFrame; +class PopupMenu; +class Menu; +class SwOneExampleFrame; + +const short RET_EDIT = 100; + +class SwGlossaryDropTarget; + +class SwGlossaryDlg final : public SfxDialogController +{ + friend class SwNewGlosNameDlg; + + OUString const m_sReadonlyPath; + + css::uno::Reference< css::text::XAutoTextContainer2 > m_xAutoText; + + SwGlossaryHdl* m_pGlossaryHdl; + + OUString m_sResumeGroup; + OUString m_sResumeShortName; + bool m_bResume; + + const bool m_bSelection : 1; + bool m_bReadOnly : 1; + bool m_bIsOld : 1; + bool m_bIsDocReadOnly:1; + + SwWrtShell* m_pShell; + + std::vector<std::unique_ptr<GroupUserData>> m_xGroupData; + + std::unique_ptr<weld::CheckButton> m_xInsertTipCB; + std::unique_ptr<weld::Entry> m_xNameED; + std::unique_ptr<weld::Label> m_xShortNameLbl; + TextFilter m_aNoSpaceFilter; + std::unique_ptr<weld::Entry> m_xShortNameEdit; + std::unique_ptr<weld::TreeView> m_xCategoryBox; + std::unique_ptr<weld::CheckButton> m_xFileRelCB; + std::unique_ptr<weld::CheckButton> m_xNetRelCB; + std::unique_ptr<weld::Button> m_xInsertBtn; + std::unique_ptr<weld::MenuButton> m_xEditBtn; + std::unique_ptr<weld::Button> m_xBibBtn; + std::unique_ptr<weld::Button> m_xPathBtn; + std::unique_ptr<SwOneExampleFrame> m_xExampleFrame; + std::unique_ptr<weld::CustomWeld> m_xExampleFrameWin; + std::unique_ptr<SwGlossaryDropTarget> m_xDropTarget; + + void EnableShortName(bool bOn = true); + void ShowPreview(); + + DECL_LINK( NameModify, weld::Entry&, void ); + DECL_LINK( NameDoubleClick, weld::TreeView&, bool ); + DECL_LINK( GrpSelect, weld::TreeView&, void ); + DECL_LINK( MenuHdl, const OString&, void ); + DECL_LINK( EnableHdl, weld::Toggleable&, void ); + DECL_LINK( BibHdl, weld::Button&, void ); + DECL_LINK( InsertHdl, weld::Button&, void ); + DECL_LINK( PathHdl, weld::Button&, void ); + DECL_LINK( CheckBoxHdl, weld::Toggleable&, void ); + DECL_LINK( PreviewLoadedHdl, SwOneExampleFrame&, void ); + DECL_LINK( KeyInputHdl, const KeyEvent&, bool ); + DECL_LINK( TextFilterHdl, OUString&, bool ); + + void Apply(); + void Init(); + std::unique_ptr<weld::TreeIter> DoesBlockExist(std::u16string_view sBlock, std::u16string_view rShort); + void ShowAutoText(const OUString& rGroup, const OUString& rShortName); + void ResumeShowAutoText(); + + bool GetResumeData(OUString& rGroup, OUString& rShortName) + {rGroup = m_sResumeGroup; rShortName = m_sResumeShortName; return m_bResume;} + void SetResumeData(const OUString& rGroup, const OUString& rShortName) + {m_sResumeGroup = rGroup; m_sResumeShortName = rShortName; m_bResume = true;} + + void DeleteEntry(); +public: + SwGlossaryDlg(SfxViewFrame const * pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell); + virtual short run() override; + virtual ~SwGlossaryDlg() override; + OUString GetCurrGrpName() const; + OUString GetCurrShortName() const + { + return m_xShortNameEdit->get_text(); + } + static OUString GetCurrGroup(); + static void SetActGroup(const OUString& rNewGroup); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/glshell.hxx b/sw/source/uibase/inc/glshell.hxx new file mode 100644 index 000000000..0b13b7681 --- /dev/null +++ b/sw/source/uibase/inc/glshell.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_SW_SOURCE_UIBASE_INC_GLSHELL_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_GLSHELL_HXX +#include <wdocsh.hxx> + +class SwGlosDocShell final : public SwDocShell +{ + OUString m_aLongName; + OUString m_aShortName; + OUString m_aGroupName; + + virtual bool Save() override; + +public: + SFX_DECL_INTERFACE(SW_GLOSDOCSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwGlosDocShell( bool bNewShow); + virtual ~SwGlosDocShell() override; + + void Execute( SfxRequest& ); + void GetState( SfxItemSet& ); + void SetLongName( const OUString& rLongName ) + { m_aLongName = rLongName; } + void SetShortName( const OUString& rShortName ) + { m_aShortName = rShortName; } + void SetGroupName( const OUString& rGroupName ) + { m_aGroupName = rGroupName; } +}; + +class SwWebGlosDocShell final : public SwWebDocShell +{ + OUString m_aLongName; + OUString m_aShortName; + OUString m_aGroupName; + + virtual bool Save() override; + +public: + SFX_DECL_INTERFACE(SW_WEBGLOSDOCSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwWebGlosDocShell(); + virtual ~SwWebGlosDocShell() override; + + void Execute( SfxRequest& ); + void GetState( SfxItemSet& ); + void SetLongName( const OUString& rLongName ) + { m_aLongName = rLongName; } + void SetShortName( const OUString& rShortName ) + { m_aShortName = rShortName; } + void SetGroupName( const OUString& rGroupName ) + { m_aGroupName = rGroupName; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/grfsh.hxx b/sw/source/uibase/inc/grfsh.hxx new file mode 100644 index 000000000..c5de73202 --- /dev/null +++ b/sw/source/uibase/inc/grfsh.hxx @@ -0,0 +1,56 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_GRFSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_GRFSH_HXX + +#include <memory> +#include <vector> + +#include "basesh.hxx" +#include <shellid.hxx> + +#include <sfx2/shell.hxx> + +class SwGrfShell : public SwBaseShell +{ + class SwExternalToolEdit; + std::vector<std::unique_ptr<SwExternalToolEdit>> m_ExternalEdits; + +public: + SFX_DECL_INTERFACE(SW_GRFSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + void Execute(SfxRequest& rRequest); + void ExecAttr(SfxRequest const& rRequest); + void GetAttrState(SfxItemSet& rRequest); + + void ExecuteRotation(SfxRequest const& rRequest); + void GetAttrStateForRotation(SfxItemSet& rRequest); + + SwGrfShell(SwView& rView); + virtual ~SwGrfShell() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/hyp.hxx b/sw/source/uibase/inc/hyp.hxx new file mode 100644 index 000000000..bbe8208f9 --- /dev/null +++ b/sw/source/uibase/inc/hyp.hxx @@ -0,0 +1,53 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_HYP_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_HYP_HXX + +#include <editeng/splwrap.hxx> +#include <com/sun/star/linguistic2/XHyphenator.hpp> +#include <swdllapi.h> + +class SwView; + +class SW_DLLPUBLIC SwHyphWrapper final : public SvxSpellWrapper { +private: + SwView* m_pView; + sal_uInt16 m_nPageCount; // page count for progress view + sal_uInt16 m_nPageStart; // 1st checked page + bool m_bInSelection : 1; // separating selected text + bool m_bAutomatic : 1; // insert separators without further inquiry + bool m_bInfoBox : 1; // display info-box when ending + + virtual void SpellStart( SvxSpellArea eSpell ) override; + virtual void SpellContinue() override; + virtual void SpellEnd( ) override; + virtual bool SpellMore() override; + virtual void InsertHyphen( const sal_Int32 nPos ) override; // insert hyphen + +public: + SwHyphWrapper( SwView* pVw, + css::uno::Reference< css::linguistic2::XHyphenator > const &rxHyph, + bool bStart, bool bOther, bool bSelect ); + virtual ~SwHyphWrapper() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/idxmrk.hxx b/sw/source/uibase/inc/idxmrk.hxx new file mode 100644 index 000000000..37dfa76c1 --- /dev/null +++ b/sw/source/uibase/inc/idxmrk.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_SW_SOURCE_UIBASE_INC_IDXMRK_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_IDXMRK_HXX + +#include <sfx2/childwin.hxx> + +#include <swabstdlg.hxx> + +class SwWrtShell; + +class SwInsertIdxMarkWrapper final : public SfxChildWindow +{ + ScopedVclPtr<AbstractMarkFloatDlg> m_xAbstDlg; + +public: + SwInsertIdxMarkWrapper(vcl::Window *pParentWindow, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo); + + SFX_DECL_CHILDWINDOW_WITHID(SwInsertIdxMarkWrapper); + + void ReInitDlg(SwWrtShell& rWrtShell); +}; + +class SwInsertAuthMarkWrapper final : public SfxChildWindow +{ + ScopedVclPtr<AbstractMarkFloatDlg> m_xAbstDlg; + +public: + SwInsertAuthMarkWrapper(vcl::Window *pParentWindow, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo); + + SFX_DECL_CHILDWINDOW_WITHID(SwInsertAuthMarkWrapper); + + void ReInitDlg(SwWrtShell& rWrtShell); +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_IDXMRK_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/imaildsplistener.hxx b/sw/source/uibase/inc/imaildsplistener.hxx new file mode 100644 index 000000000..8852a8800 --- /dev/null +++ b/sw/source/uibase/inc/imaildsplistener.hxx @@ -0,0 +1,61 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_IMAILDSPLISTENER_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_IMAILDSPLISTENER_HXX + +#include <com/sun/star/mail/XMailMessage.hpp> +#include <salhelper/simplereferenceobject.hxx> +#include <rtl/ref.hxx> + +class MailDispatcher; + +/** + MailDispatcher listener interface. + Clients may implement and register instances of the + mail dispatcher interface in order to get notifications + about the MailDispatcher status. + + @see MailDispatcher +*/ +class IMailDispatcherListener : public salhelper::SimpleReferenceObject +{ +public: + /** + Called when there are no more mail messages + to deliver. + */ + virtual void idle() = 0; + + /** + Called for every mail message that has been + successfully delivered. + */ + virtual void mailDelivered(css::uno::Reference< css::mail::XMailMessage> xMailMessage) = 0; + + /** + Called for every mail message whose delivery + failed. + */ + virtual void mailDeliveryError(::rtl::Reference<MailDispatcher> xMailDispatcher, css::uno::Reference< css::mail::XMailMessage> xMailMessage, const OUString& sErrorMessage) = 0; +}; + +#endif // INCLUDED_IMAILDISPATCHERLISTENER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/initui.hxx b/sw/source/uibase/inc/initui.hxx new file mode 100644 index 000000000..a74f7b393 --- /dev/null +++ b/sw/source/uibase/inc/initui.hxx @@ -0,0 +1,42 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_INITUI_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_INITUI_HXX + +#include <swdllapi.h> +#include <rtl/ustring.hxx> + +SW_DLLPUBLIC const OUString& GetCurrGlosGroup(); +SW_DLLPUBLIC void SetCurrGlosGroup(const OUString& sStr); + +// provides textblock management +class SwGlossaries; +SW_DLLPUBLIC SwGlossaries* GetGlossaries(); + +class SwGlossaryList; + +bool HasGlossaryList(); +SwGlossaryList* GetGlossaryList(); + +extern void InitUI(); +extern void FinitUI(); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/inpdlg.hxx b/sw/source/uibase/inc/inpdlg.hxx new file mode 100644 index 000000000..c724e3b76 --- /dev/null +++ b/sw/source/uibase/inc/inpdlg.hxx @@ -0,0 +1,68 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_INPDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_INPDLG_HXX + +#include <vcl/weld.hxx> + +class SwInputField; +class SwSetExpField; +class SwUserFieldType; +class SwField; +class SwWrtShell; +class SwFieldMgr; + +// insert fields +class SwFieldInputDlg final : public weld::GenericDialogController +{ + void Apply(); + + SwWrtShell& rSh; + SwInputField* pInpField; + SwSetExpField* pSetField; + SwUserFieldType* pUsrType; + + weld::Button* m_pPressedButton; + std::unique_ptr<weld::Entry> m_xLabelED; + std::unique_ptr<weld::TextView> m_xEditED; + std::unique_ptr<weld::Button> m_xPrevBT; + std::unique_ptr<weld::Button> m_xNextBT; + std::unique_ptr<weld::Button> m_xOKBT; + + DECL_LINK(NextHdl, weld::Button&, void); + DECL_LINK(PrevHdl, weld::Button&, void); + +public: + SwFieldInputDlg(weld::Widget *pParent, SwWrtShell &rSh, + SwField* pField, bool bPrevButton, bool bNextButton); + virtual short run() override + { + short nRet = GenericDialogController::run(); + if (nRet == RET_OK) + Apply(); + return nRet; + } + virtual ~SwFieldInputDlg() override; + bool PrevButtonPressed() const; + bool NextButtonPressed() const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/inputwin.hxx b/sw/source/uibase/inc/inputwin.hxx new file mode 100644 index 000000000..4d7d205cc --- /dev/null +++ b/sw/source/uibase/inc/inputwin.hxx @@ -0,0 +1,211 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_INPUTWIN_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_INPUTWIN_HXX + +#include <sal/config.h> + +#include <string_view> + +#include <vcl/InterimItemWindow.hxx> +#include <vcl/toolbox.hxx> + +#include <sfx2/childwin.hxx> + +class SwFieldMgr; +class SwWrtShell; +class SwView; +class SfxDispatcher; + +class InputEdit final : public InterimItemWindow +{ +private: + std::unique_ptr<weld::Entry> m_xWidget; + + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(ActivateHdl, weld::Entry&, bool); +public: + InputEdit(vcl::Window* pParent) + : InterimItemWindow(pParent, "modules/swriter/ui/inputeditbox.ui", "InputEditBox") + , m_xWidget(m_xBuilder->weld_entry("entry")) + { + InitControlBase(m_xWidget.get()); + + m_xWidget->connect_key_press(LINK(this, InputEdit, KeyInputHdl)); + m_xWidget->connect_activate(LINK(this, InputEdit, ActivateHdl)); + SetSizePixel(m_xWidget->get_preferred_size()); + } + + void UpdateRange(std::u16string_view rSel, const OUString& rTableName); + + virtual void dispose() override + { + m_xWidget.reset(); + InterimItemWindow::dispose(); + } + + void set_text(const OUString& rText) + { + m_xWidget->set_text(rText); + } + + OUString get_text() const + { + return m_xWidget->get_text(); + } + + void set_accessible_name(const OUString& rName) + { + m_xWidget->set_accessible_name(rName); + } + + void replace_selection(const OUString& rText) + { + int nStartPos, nEndPos; + m_xWidget->get_selection_bounds(nStartPos, nEndPos); + if (nStartPos > nEndPos) + std::swap(nStartPos, nEndPos); + + m_xWidget->replace_selection(rText); + + nStartPos = nStartPos + rText.getLength(); + m_xWidget->select_region(nStartPos, nStartPos); + } + + void select_region(int nStartPos, int nEndPos) + { + m_xWidget->select_region(nStartPos, nEndPos); + } + + void connect_changed(const Link<weld::Entry&, void>& rLink) + { + m_xWidget->connect_changed(rLink); + } + + virtual ~InputEdit() override + { + disposeOnce(); + } +}; + + +class PosEdit final : public InterimItemWindow +{ +private: + std::unique_ptr<weld::Entry> m_xWidget; + + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); +public: + PosEdit(vcl::Window* pParent) + : InterimItemWindow(pParent, "modules/swriter/ui/poseditbox.ui", "PosEditBox") + , m_xWidget(m_xBuilder->weld_entry("entry")) + { + InitControlBase(m_xWidget.get()); + + m_xWidget->connect_key_press(LINK(this, PosEdit, KeyInputHdl)); + SetSizePixel(m_xWidget->get_preferred_size()); + } + + virtual void dispose() override + { + m_xWidget.reset(); + InterimItemWindow::dispose(); + } + + void set_text(const OUString& rText) + { + m_xWidget->set_text(rText); + } + + void set_accessible_name(const OUString& rName) + { + m_xWidget->set_accessible_name(rName); + } + + virtual ~PosEdit() override + { + disposeOnce(); + } +}; + +class SwInputWindow final : public ToolBox +{ +friend class InputEdit; + + VclPtr<PosEdit> mxPos; + VclPtr<InputEdit> mxEdit; + std::unique_ptr<SwFieldMgr> m_pMgr; + SwWrtShell* m_pWrtShell; + SwView* m_pView; + OUString m_aCurrentTableName, m_sOldFormula; + + bool m_bFirst : 1; // initialisations at first call + bool m_bIsTable : 1; + bool m_bDelSel : 1; + bool m_bDoesUndo : 1; + bool m_bResetUndo : 1; + bool m_bCallUndo : 1; + + void CleanupUglyHackWithUndo(); + + void DelBoxContent(); + DECL_LINK(ModifyHdl, weld::Entry&, void); + + using Window::IsActive; + + virtual void Resize() override; + virtual void Click() override; + void MenuHdl(std::string_view command); + DECL_LINK( DropdownClickHdl, ToolBox*, void ); + void ApplyFormula(); + void CancelFormula(); + +public: + SwInputWindow(vcl::Window* pParent, SfxDispatcher const * pDispatcher); + virtual ~SwInputWindow() override; + virtual void dispose() override; + + void ShowWin(); + + DECL_LINK( SelTableCellsNotify, SwWrtShell&, void ); + + void SetFormula( const OUString& rFormula ); + const SwView* GetView() const{return m_pView;} +}; + +class SwInputChild final : public SfxChildWindow +{ + SfxDispatcher* m_pDispatch; +public: + SwInputChild( vcl::Window* , + sal_uInt16 nId, + SfxBindings const *, + SfxChildWinInfo* ); + virtual ~SwInputChild() override; + SFX_DECL_CHILDWINDOW_WITHID( SwInputChild ); + void SetFormula( const OUString& rFormula ) + { static_cast<SwInputWindow*>(GetWindow())->SetFormula( rFormula ); } + const SwView* GetView() const + { return static_cast<SwInputWindow*>(GetWindow())->GetView();} + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/insfnote.hxx b/sw/source/uibase/inc/insfnote.hxx new file mode 100644 index 000000000..396e87404 --- /dev/null +++ b/sw/source/uibase/inc/insfnote.hxx @@ -0,0 +1,84 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_INSFNOTE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_INSFNOTE_HXX + +#include <vcl/weld.hxx> + +class SwWrtShell; + +class VclFrame; + +class SwInsFootNoteDlg final : public weld::GenericDialogController +{ + SwWrtShell &m_rSh; + + // everything for the character(s) + OUString m_aFontName; + rtl_TextEncoding m_eCharSet; + bool m_bExtCharAvailable; + bool m_bEdit; + + std::unique_ptr<weld::Widget> m_xNumberFrame; + std::unique_ptr<weld::RadioButton> m_xNumberAutoBtn; + std::unique_ptr<weld::RadioButton> m_xNumberCharBtn; + std::unique_ptr<weld::Entry> m_xNumberCharEdit; + std::unique_ptr<weld::Button> m_xNumberExtChar; + + // everything for the selection footnote/endnote + std::unique_ptr<weld::RadioButton> m_xFootnoteBtn; + std::unique_ptr<weld::RadioButton> m_xEndNoteBtn; + + std::unique_ptr<weld::Button> m_xOkBtn; + std::unique_ptr<weld::Button> m_xPrevBT; + std::unique_ptr<weld::Button> m_xNextBT; + + DECL_LINK(NumberToggleHdl, weld::Toggleable&, void); + DECL_LINK(NumberEditHdl, weld::Entry&, void); + DECL_LINK(NumberExtCharHdl, weld::Button&, void); + DECL_LINK(NextPrevHdl, weld::Button&, void); + + void Apply(); + + void Init(); + +public: + SwInsFootNoteDlg(weld::Window * pParent, SwWrtShell &rSh, bool bEd); + virtual ~SwInsFootNoteDlg() COVERITY_NOEXCEPT_FALSE override; + + const OUString& GetFontName() const { return m_aFontName; } + bool IsEndNote() const { return m_xEndNoteBtn->get_active(); } + OUString GetStr() const + { + if (m_xNumberCharBtn->get_active()) + return m_xNumberCharEdit->get_text(); + return OUString(); + } + virtual short run() override + { + short nRet = GenericDialogController::run(); + if (nRet == RET_OK) + Apply(); + return nRet; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/instable.hxx b/sw/source/uibase/inc/instable.hxx new file mode 100644 index 000000000..cc3fd0204 --- /dev/null +++ b/sw/source/uibase/inc/instable.hxx @@ -0,0 +1,89 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_INSTABLE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_INSTABLE_HXX + +#include <sfx2/basedlgs.hxx> +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <tools/link.hxx> +#include <vcl/textfilter.hxx> + +#include "wrtsh.hxx" +#include "autoformatpreview.hxx" +#include <view.hxx> +#include <tblafmt.hxx> +#include <itabenum.hxx> +#include <memory> + +class SwInsTableDlg final : public SfxDialogController +{ + TextFilter m_aTextFilter; + + SwWrtShell* pShell; + std::unique_ptr<SwTableAutoFormatTable> m_xTableTable; + std::unique_ptr<SwTableAutoFormat> m_xTAutoFormat; + + sal_uInt8 lbIndex; + sal_uInt8 tbIndex; + sal_uInt8 minTableIndexInLb; + sal_uInt8 maxTableIndexInLb; + sal_Int64 nEnteredValRepeatHeaderNF; + + AutoFormatPreview m_aWndPreview; + + std::unique_ptr<weld::Entry> m_xNameEdit; + std::unique_ptr<weld::Label> m_xWarning; + std::unique_ptr<weld::SpinButton> m_xColSpinButton; + std::unique_ptr<weld::SpinButton> m_xRowSpinButton; + std::unique_ptr<weld::CheckButton> m_xHeaderCB; + std::unique_ptr<weld::CheckButton> m_xRepeatHeaderCB; + std::unique_ptr<weld::SpinButton> m_xRepeatHeaderNF; + std::unique_ptr<weld::Widget> m_xRepeatGroup; + std::unique_ptr<weld::CheckButton> m_xDontSplitCB; + std::unique_ptr<weld::Button> m_xInsertBtn; + std::unique_ptr<weld::TreeView> m_xLbFormat; + std::unique_ptr<weld::CustomWeld> m_xWndPreview; + std::unique_ptr<weld::Frame> m_xStyleFrame; + + // Returns 255 if mapping is not possible. + // This means there cannot be more than 255 autotable style. + sal_uInt8 lbIndexToTableIndex(const sal_uInt8 listboxIndex); + void InitAutoTableFormat(); + + DECL_LINK(TextFilterHdl, OUString&, bool); + DECL_LINK(SelFormatHdl, weld::TreeView&, void); + DECL_LINK(ModifyName, weld::Entry&, void); + DECL_LINK(ModifyRowCol, weld::Entry&, void); + DECL_LINK(OKHdl, weld::Button&, void); + DECL_LINK(CheckBoxHdl, weld::Toggleable&, void); + DECL_LINK(RepeatHeaderCheckBoxHdl, weld::Toggleable&, void); + DECL_LINK(ModifyRepeatHeaderNF_Hdl, weld::SpinButton&, void); + +public: + SwInsTableDlg(SwView& rView); + + void GetValues(OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol, + SwInsertTableOptions& rInsTableOpts, OUString& rTableAutoFormatName, + std::unique_ptr<SwTableAutoFormat>& prTAFormat); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/javaedit.hxx b/sw/source/uibase/inc/javaedit.hxx new file mode 100644 index 000000000..0b4ca37ca --- /dev/null +++ b/sw/source/uibase/inc/javaedit.hxx @@ -0,0 +1,77 @@ +/* -*- 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 + +#include <vcl/weld.hxx> + +class SwWrtShell; +class SwFieldMgr; +class SwScriptField; + +namespace sfx2 { class FileDialogHelper; } + +class SwJavaEditDialog final : public weld::GenericDialogController +{ +private: + OUString m_aText; + OUString m_aType; + + bool m_bNew; + bool m_bIsUrl; + + SwScriptField* m_pField; + std::unique_ptr<SwFieldMgr> m_pMgr; + SwWrtShell* m_pSh; + std::unique_ptr<sfx2::FileDialogHelper> m_pFileDlg; + + std::unique_ptr<weld::Entry> m_xTypeED; + std::unique_ptr<weld::RadioButton> m_xUrlRB; + std::unique_ptr<weld::RadioButton> m_xEditRB; + std::unique_ptr<weld::Button> m_xUrlPB; + std::unique_ptr<weld::Entry> m_xUrlED; + std::unique_ptr<weld::TextView> m_xEditED; + std::unique_ptr<weld::Button> m_xOKBtn; + std::unique_ptr<weld::Button> m_xPrevBtn; + std::unique_ptr<weld::Button> m_xNextBtn; + + DECL_LINK(OKHdl, weld::Button&, void); + DECL_LINK(PrevHdl, weld::Button&, void); + DECL_LINK(NextHdl, weld::Button&, void); + DECL_LINK(RadioButtonHdl, weld::Toggleable&, void); + DECL_LINK(InsertFileHdl, weld::Button&, void); + DECL_LINK(DlgClosedHdl, sfx2::FileDialogHelper *, void); + + void UpdateFromRadioButtons(); + void CheckTravel(); + void SetField(); + +public: + SwJavaEditDialog(weld::Window* pParent, SwWrtShell* pWrtSh); + virtual ~SwJavaEditDialog() override; + + const OUString& GetScriptText() const { return m_aText; } + + const OUString& GetScriptType() const { return m_aType; } + + bool IsUrl() const { return m_bIsUrl; } + bool IsNew() const { return m_bNew; } + bool IsUpdate() const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/label.hxx b/sw/source/uibase/inc/label.hxx new file mode 100644 index 000000000..591442369 --- /dev/null +++ b/sw/source/uibase/inc/label.hxx @@ -0,0 +1,84 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_LABEL_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_LABEL_HXX + +#include <sfx2/tabdlg.hxx> +#include <com/sun/star/frame/XModel.hpp> +#include "labelcfg.hxx" +#include <vector> + +class SwLabItem; +class SwLabPrtPage; +class SwDBManager; +class Printer; + +class SwLabDlg final : public SfxTabDialogController +{ + SwLabelConfig aLabelsCfg; + SwDBManager* pDBManager; + SwLabPrtPage* m_pPrtPage; + + std::vector<sal_uInt16> aTypeIds; + std::vector<OUString> aMakes; + + std::unique_ptr<SwLabRecs> m_pRecs; + OUString aLstGroup; + OUString m_sBusinessCardDlg; + bool m_bLabel; + void ReplaceGroup_( const OUString &rMake ); + + virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; +public: + + SwLabDlg(weld::Window* pParent, const SfxItemSet& rSet, + SwDBManager* pDBManager, bool bLabel); + virtual ~SwLabDlg() override; + + SwLabRec* GetRecord(std::u16string_view rRecName, bool bCont); + void GetLabItem(SwLabItem &rItem); + + SwLabRecs &Recs() { return *m_pRecs; } + const SwLabRecs &Recs() const { return *m_pRecs; } + + std::vector<sal_uInt16> &TypeIds() { return aTypeIds; } + const std::vector<sal_uInt16> &TypeIds() const { return aTypeIds; } + + std::vector<OUString> &Makes() { return aMakes; } + const std::vector<OUString> &Makes() const { return aMakes; } + + Printer *GetPrt(); + void ReplaceGroup( const OUString &rMake ) + { + if ( rMake != aLstGroup ) + ReplaceGroup_( rMake ); + } + + void UpdateGroup( const OUString &rMake ) {ReplaceGroup_( rMake );} + static void UpdateFieldInformation(css::uno::Reference< css::frame::XModel> const & xModel, + const SwLabItem& rItem); + const OUString& GetBusinessCardStr() const {return m_sBusinessCardDlg;} + + SwLabelConfig& GetLabelsConfig() {return aLabelsCfg;} + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/labelcfg.hxx b/sw/source/uibase/inc/labelcfg.hxx new file mode 100644 index 000000000..2a88d5902 --- /dev/null +++ b/sw/source/uibase/inc/labelcfg.hxx @@ -0,0 +1,61 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_LABELCFG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_LABELCFG_HXX + +#include <unotools/configitem.hxx> +#include <swdllapi.h> +#include "labrec.hxx" + +#include <map> +#include <vector> + +struct SwLabelMeasure +{ + OUString m_aMeasure; // string contains the label dimensions + bool m_bPredefined; // used to distinguish predefined from user-defined labels +}; + +class SW_DLLPUBLIC SwLabelConfig final : public utl::ConfigItem +{ +private: + std::vector<OUString> m_aManufacturers; + std::map< OUString, std::map<OUString, SwLabelMeasure> > m_aLabels; + + virtual void ImplCommit() override; + +public: + SwLabelConfig(); + virtual ~SwLabelConfig() override; + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + + void FillLabels(const OUString& rManufacturer, SwLabRecs& rLabArr); + const std::vector<OUString>& GetManufacturers() const {return m_aManufacturers;} + + bool HasLabel(const OUString& rManufacturer, const OUString& rType); + bool IsPredefinedLabel(const OUString& rManufacturer, const OUString& rType) + { return m_aLabels[rManufacturer][rType].m_bPredefined; }; + void SaveLabel(const OUString& rManufacturer, const OUString& rType, + const SwLabRec& rRec); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/labimg.hxx b/sw/source/uibase/inc/labimg.hxx new file mode 100644 index 000000000..5e5c428bd --- /dev/null +++ b/sw/source/uibase/inc/labimg.hxx @@ -0,0 +1,125 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_LABIMG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_LABIMG_HXX + +#include <svl/poolitem.hxx> +#include <unotools/configitem.hxx> +#include <swdllapi.h> + +class SwLabCfgItem; + +class SW_DLLPUBLIC SwLabItem final : public SfxPoolItem +{ + +public: + + SwLabItem(); + + SwLabItem& operator =(const SwLabItem& rItem); + SwLabItem(SwLabItem const &) = default; // SfxPoolItem copy function dichotomy + + virtual bool operator ==(const SfxPoolItem& rItem) const override; + + virtual SwLabItem* Clone(SfxItemPool* = nullptr) const override; + + OUString m_aLstMake; // remember last selection + OUString m_aLstType; + OUString m_sDBName; // used database + + OUString m_aWriting; // label + OUString m_aMake; // label mark + OUString m_aType; // label type + sal_Int32 m_lHDist; // horizontal distance (user) + sal_Int32 m_lVDist; // vertical distance (user) + sal_Int32 m_lWidth; // width (user) + sal_Int32 m_lHeight; // height (user) + sal_Int32 m_lLeft; // left border (user) + sal_Int32 m_lUpper; // upper border (user) + sal_Int32 m_nCols; // number of columns (user) + sal_Int32 m_nRows; // number of rows (user) + sal_Int32 m_nCol; // column for single print + sal_Int32 m_nRow; // row for single print + sal_Int32 m_lPHeight; // paper height + sal_Int32 m_lPWidth; // paper width + bool m_bAddr;// address as label? + bool m_bCont;// continuous paper? + bool m_bPage;// whole page or single labels? + bool m_bSynchron;// synchronise all labels + + //parts of the business card + OUString m_aPrivFirstName; + OUString m_aPrivName; + OUString m_aPrivShortCut; + OUString m_aPrivFirstName2; + OUString m_aPrivName2; + OUString m_aPrivShortCut2; + OUString m_aPrivStreet; + OUString m_aPrivZip; + OUString m_aPrivCity; + OUString m_aPrivCountry; + OUString m_aPrivState; + OUString m_aPrivTitle; + OUString m_aPrivProfession; + OUString m_aPrivPhone; + OUString m_aPrivMobile; + OUString m_aPrivFax; + OUString m_aPrivWWW; + OUString m_aPrivMail; + OUString m_aCompCompany; + OUString m_aCompCompanyExt; + OUString m_aCompSlogan; + OUString m_aCompStreet; + OUString m_aCompZip; + OUString m_aCompCity; + OUString m_aCompCountry; + OUString m_aCompState; + OUString m_aCompPosition; + OUString m_aCompPhone; + OUString m_aCompMobile; + OUString m_aCompFax; + OUString m_aCompWWW; + OUString m_aCompMail; + + OUString m_sGlossaryGroup; + OUString m_sGlossaryBlockName; +}; + +class SwLabCfgItem final : public utl::ConfigItem +{ +private: + SwLabItem m_aItem; + bool m_bIsLabel; + + css::uno::Sequence<OUString> GetPropertyNames() const; + + virtual void ImplCommit() override; + +public: + SwLabCfgItem(bool bLabel); + + SwLabItem& GetItem() {return m_aItem;} + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/labimp.hxx b/sw/source/uibase/inc/labimp.hxx new file mode 100644 index 000000000..e8db8aab1 --- /dev/null +++ b/sw/source/uibase/inc/labimp.hxx @@ -0,0 +1,36 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_LABIMP_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_LABIMP_HXX + +#include <vcl/weld.hxx> + +inline int getfldval(const weld::MetricSpinButton& rField) +{ + return rField.denormalize(rField.get_value(FieldUnit::TWIP)); +} + +inline void setfldval(weld::MetricSpinButton& rField, int lValue) +{ + rField.set_value(rField.normalize(lValue), FieldUnit::TWIP); +} + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_LABIMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/labrec.hxx b/sw/source/uibase/inc/labrec.hxx new file mode 100644 index 000000000..feb7fdf65 --- /dev/null +++ b/sw/source/uibase/inc/labrec.hxx @@ -0,0 +1,58 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_LABREC_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_LABREC_HXX + +#include <rtl/ustring.hxx> +#include <tools/long.hxx> + +#include <memory> +#include <vector> + + +class SwLabItem; + +class SwLabRec +{ +public: + SwLabRec(): m_nHDist(0), m_nVDist(0), m_nWidth(0), m_nHeight(0), m_nLeft(0), m_nUpper(0), m_nPWidth(0), m_nPHeight(0), m_nCols(0), m_nRows(0), m_bCont(false) {} + + void SetFromItem( const SwLabItem& rItem ); + void FillItem( SwLabItem& rItem ) const; + + OUString m_aMake; + OUString m_aType; + tools::Long m_nHDist; + tools::Long m_nVDist; + tools::Long m_nWidth; + tools::Long m_nHeight; + tools::Long m_nLeft; + tools::Long m_nUpper; + tools::Long m_nPWidth; + tools::Long m_nPHeight; + sal_Int32 m_nCols; + sal_Int32 m_nRows; + bool m_bCont; +}; + +typedef std::vector<std::unique_ptr<SwLabRec>> SwLabRecs; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/langhelper.hxx b/sw/source/uibase/inc/langhelper.hxx new file mode 100644 index 000000000..9e4e46754 --- /dev/null +++ b/sw/source/uibase/inc/langhelper.hxx @@ -0,0 +1,64 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_LANGHELPER_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_LANGHELPER_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <i18nlangtag/lang.h> + +class SwWrtShell; +class SwView; +class EditEngine; +class EditView; +class OutlinerView; +class SfxItemSet; +class SfxRequest; +struct ESelection; +enum class SvtScriptType : sal_uInt8; + +namespace SwLangHelper +{ + extern void GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet ); + extern bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView const &rView, SwWrtShell &rSh ); + + extern void SetLanguage( SwWrtShell &rWrtSh, std::u16string_view rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage( SwWrtShell &rWrtSh, OutlinerView const * pOLV, const ESelection& rSelection, std::u16string_view rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage_None( SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage_None( SwWrtShell &rWrtSh, OutlinerView const * pOLV, const ESelection& rSelection, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void ResetLanguages( SwWrtShell &rWrtSh, OutlinerView const * pOLV = nullptr ); + + // document + extern void SelectCurrentPara( SwWrtShell &rWrtSh ); + // EditView + extern void SelectPara( EditView &rEditView, const ESelection &rCurSel ); + + extern OUString GetTextForLanguageGuessing(EditEngine const * rEditEngine, const ESelection& rDocSelection); + extern OUString GetTextForLanguageGuessing(SwWrtShell const &rSh); + + extern LanguageType GetLanguage( SfxItemSet const & aSet, sal_uInt16 nLangWhichId ); + extern LanguageType GetLanguage( SwWrtShell &rSh, sal_uInt16 nLangWhichId ); + + extern LanguageType GetCurrentLanguage( SfxItemSet const & aSet, SvtScriptType nScriptType ); + extern LanguageType GetCurrentLanguage( SwWrtShell &rSh ); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/linenum.hxx b/sw/source/uibase/inc/linenum.hxx new file mode 100644 index 000000000..eaed16129 --- /dev/null +++ b/sw/source/uibase/inc/linenum.hxx @@ -0,0 +1,61 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_LINENUM_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_LINENUM_HXX + +#include <sfx2/basedlgs.hxx> +#include "numberingtypelistbox.hxx" + +class SwView; +class SwWrtShell; + +class SwLineNumberingDlg final : public SfxDialogController +{ +private: + SwWrtShell* m_pSh; + std::unique_ptr<weld::Widget> m_xBodyContent; + std::unique_ptr<weld::Widget> m_xDivIntervalFT; + std::unique_ptr<weld::SpinButton> m_xDivIntervalNF; + std::unique_ptr<weld::Widget> m_xDivRowsFT; + std::unique_ptr<weld::SpinButton> m_xNumIntervalNF; + std::unique_ptr<weld::ComboBox> m_xCharStyleLB; + std::unique_ptr<SwNumberingTypeListBox> m_xFormatLB; + std::unique_ptr<weld::ComboBox> m_xPosLB; + std::unique_ptr<weld::MetricSpinButton> m_xOffsetMF; + std::unique_ptr<weld::Entry> m_xDivisorED; + std::unique_ptr<weld::CheckButton> m_xCountEmptyLinesCB; + std::unique_ptr<weld::CheckButton> m_xCountFrameLinesCB; + std::unique_ptr<weld::CheckButton> m_xRestartEachPageCB; + std::unique_ptr<weld::CheckButton> m_xNumberingOnCB; + std::unique_ptr<weld::CheckButton> m_xNumberingOnFooterHeader; + std::unique_ptr<weld::Button> m_xOKButton; + std::unique_ptr<weld::Widget> m_xNumIntervalFT; + std::unique_ptr<weld::Widget> m_xNumRowsFT; + DECL_LINK(OKHdl, weld::Button&, void); + DECL_LINK(LineOnOffHdl, weld::Toggleable&, void); + DECL_LINK(ModifyHdl, weld::Entry&, void); + +public: + SwLineNumberingDlg(const SwView& rVw); + virtual ~SwLineNumberingDlg() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/listsh.hxx b/sw/source/uibase/inc/listsh.hxx new file mode 100644 index 000000000..83bc9b321 --- /dev/null +++ b/sw/source/uibase/inc/listsh.hxx @@ -0,0 +1,42 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_LISTSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_LISTSH_HXX + +#include "basesh.hxx" + +class SwListShell : public SwBaseShell +{ +public: + SFX_DECL_INTERFACE(SW_LISTSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwListShell(SwView& rView); + + void Execute(SfxRequest&); + void GetState(SfxItemSet&); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/macassgn.hxx b/sw/source/uibase/inc/macassgn.hxx new file mode 100644 index 000000000..4311e9107 --- /dev/null +++ b/sw/source/uibase/inc/macassgn.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_MACASSGN_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_MACASSGN_HXX + +#include <sfx2/evntconf.hxx> +#include <vcl/weld.hxx> +#include <svl/macitem.hxx> +#include <optional> + +class SwWrtShell; + +enum DlgEventType +{ + MACASSGN_AUTOTEXT, + MACASSGN_GRAPHIC, + MACASSGN_OLE, + MACASSGN_FRMURL, + MACASSGN_INETFMT, + MACASSGN_ALLFRM +}; + +class SwMacroAssignDlg +{ +public: + static SfxEventNamesItem AddEvents(DlgEventType eType); + static bool INetFormatDlg(weld::Window* pParent, SwWrtShell& rSh, + std::optional<SvxMacroTableDtor>& rpINetItem); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/mailconfigpage.hxx b/sw/source/uibase/inc/mailconfigpage.hxx new file mode 100644 index 000000000..734b39aa9 --- /dev/null +++ b/sw/source/uibase/inc/mailconfigpage.hxx @@ -0,0 +1,69 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_MAILCONFIGPAGE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_MAILCONFIGPAGE_HXX + +#include <sfx2/tabdlg.hxx> +#include <sfx2/basedlgs.hxx> + +class SwTestAccountSettingsDialog; +class SwMailMergeConfigItem; + +class SwMailConfigPage final : public SfxTabPage +{ + friend class SwTestAccountSettingsDialog; + + std::unique_ptr<SwMailMergeConfigItem> m_pConfigItem; + + std::unique_ptr<weld::Entry> m_xDisplayNameED; + std::unique_ptr<weld::Entry> m_xAddressED; + std::unique_ptr<weld::CheckButton> m_xReplyToCB; + std::unique_ptr<weld::Label> m_xReplyToFT; + std::unique_ptr<weld::Entry> m_xReplyToED; + std::unique_ptr<weld::Entry> m_xServerED; + std::unique_ptr<weld::SpinButton> m_xPortNF; + std::unique_ptr<weld::CheckButton> m_xSecureCB; + std::unique_ptr<weld::Button> m_xServerAuthenticationPB; + std::unique_ptr<weld::Button> m_xTestPB; + + DECL_LINK(ReplyToHdl, weld::Toggleable&, void); + DECL_LINK(AuthenticationHdl, weld::Button&, void); + DECL_LINK(TestHdl, weld::Button&, void); + DECL_LINK(SecureHdl, weld::Toggleable&, void); + +public: + SwMailConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + virtual ~SwMailConfigPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet* rAttrSet); + + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; +}; + +class SwMailConfigDlg final : public SfxSingleTabDialogController +{ +public: + SwMailConfigDlg(weld::Window* pParent, const SfxItemSet& rSet); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/maildispatcher.hxx b/sw/source/uibase/inc/maildispatcher.hxx new file mode 100644 index 000000000..5fd862d36 --- /dev/null +++ b/sw/source/uibase/inc/maildispatcher.hxx @@ -0,0 +1,156 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_MAILDISPATCHER_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_MAILDISPATCHER_HXX + +#include <com/sun/star/mail/XSmtpService.hpp> +#include <com/sun/star/mail/XMailMessage.hpp> +#include <osl/thread.hxx> +#include <osl/conditn.hxx> +#include <rtl/ref.hxx> +#include <salhelper/simplereferenceobject.hxx> + +#include <list> +#include <vector> + +#include <swdllapi.h> + +class IMailDispatcherListener; + +/** + A MailDispatcher should be used for sending a bunch a mail messages + asynchronously. Usually a client enqueues a number of mail messages + and then calls start to begin sending them. An instance of this class + must not be shared among different client threads. Instead each client + thread should create an own instance of this class. +*/ +class SW_DLLPUBLIC MailDispatcher final : public salhelper::SimpleReferenceObject, + private ::osl::Thread +{ +public: + // bringing operator new/delete into scope + using osl::Thread::operator new; + using osl::Thread::operator delete; + using osl::Thread::join; + + /** + @param xSmtpService + [in] a reference to a mail server. A user must be + connected to the mail server otherwise errors occur + during the delivery of mail messages. + + @throws css::uno::RuntimeException + on errors during construction of an instance of this class. + */ + MailDispatcher(css::uno::Reference<css::mail::XSmtpService> const& xMailService); + + /** + Shutdown the mail dispatcher. Every mail messages + not yet sent will be discarded. + */ + virtual ~MailDispatcher() override; + + /** + Enqueue a mail message for delivery. A client must + start the mail dispatcher in order to send the + enqueued mail messages. + + @param xMailMessage + [in] a mail message that should be send. + */ + void enqueueMailMessage(css::uno::Reference<css::mail::XMailMessage> const& xMailMessage); + /** + Dequeues a mail message. + This enables the caller to remove attachments when sending mails is to be cancelled. + */ + css::uno::Reference<css::mail::XMailMessage> dequeueMailMessage(); + + /** + Start sending mail messages asynchronously. A client may register + a listener for mail dispatcher events. For every mail message sent + the notification will be sent. While handling such notification a + client may enqueue new mail messages. If there are no more mail + messages to send a respective notification is sent and the mail + dispatcher waits for more mail messages. + + @precond not isStarted() + */ + void start(); + + /** + Stop sending mail messages. + + @precond isStarted() + */ + void stop(); + + /** + Request shutdown of the mail dispatcher thread. + NOTE: You must call this method before you release + your last reference to this class otherwise the + mail dispatcher thread will never end. + */ + void shutdown(); + + /** + Check whether the mail dispatcher is started or not. + + @return + <TRUE/> if the sending thread is running. + */ + bool isStarted() const { return m_bActive; } + + /** returns if the thread is still running + */ + using osl::Thread::isRunning; + + /** + * returns if shutdown has already been called + */ + bool isShutdownRequested() const { return m_bShutdownRequested; } + + /** + * Register a listener for mail dispatcher events + */ + void addListener(::rtl::Reference<IMailDispatcherListener> const& listener); + +private: + virtual void SAL_CALL run() override; + virtual void SAL_CALL onTerminated() override; + + std::vector<::rtl::Reference<IMailDispatcherListener>> cloneListener(); + void sendMailMessageNotifyListener(css::uno::Reference<css::mail::XMailMessage> const& message); + + css::uno::Reference<css::mail::XSmtpService> m_xMailserver; + std::list<css::uno::Reference<css::mail::XMailMessage>> m_aXMessageList; + std::vector<::rtl::Reference<IMailDispatcherListener>> m_aListenerVector; + ::osl::Mutex m_aMessageContainerMutex; + ::osl::Mutex m_aListenerContainerMutex; + ::osl::Mutex m_aThreadStatusMutex; + ::osl::Condition m_aRunCondition; + ::osl::Condition m_aWakeupCondition; + ::rtl::Reference<MailDispatcher> m_xSelfReference; + bool m_bActive; + bool m_bShutdownRequested; +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_MAILDISPATCHER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/mailmergehelper.hxx b/sw/source/uibase/inc/mailmergehelper.hxx new file mode 100644 index 000000000..8d7d33de9 --- /dev/null +++ b/sw/source/uibase/inc/mailmergehelper.hxx @@ -0,0 +1,279 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_MAILMERGEHELPER_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_MAILMERGEHELPER_HXX + +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/mail/XAuthenticator.hpp> +#include <com/sun/star/mail/XConnectionListener.hpp> +#include <com/sun/star/uno/XCurrentContext.hpp> +#include <com/sun/star/mail/XMailMessage.hpp> +#include <com/sun/star/datatransfer/XTransferable.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/compbase.hxx> +#include <vcl/customweld.hxx> +#include <vcl/weld.hxx> +#include <rtl/ustring.hxx> +#include <swdllapi.h> + +class SwMailMergeConfigItem; + +namespace com::sun::star::mail { + class XMailService; + class XSmtpService; +} + +namespace SwMailMergeHelper +{ + SW_DLLPUBLIC OUString CallSaveAsDialog(weld::Window* pParent, OUString& rFilter); + SW_DLLPUBLIC bool CheckMailAddress(const OUString& rMailAddress); + SW_DLLPUBLIC css::uno::Reference<css::mail::XSmtpService> ConnectToSmtpServer( + SwMailMergeConfigItem const & rConfigItem, + css::uno::Reference<css::mail::XMailService>& xInMailService, + const OUString& rInMailServerPassword, + const OUString& rOutMailServerPassword, + weld::Window* pDialogParentWindow = nullptr); +} + +struct SwAddressPreview_Impl; + +// Preview window used to show the possible selection of address blocks +// and also the resulting address filled with database data +class SW_DLLPUBLIC SwAddressPreview final : public weld::CustomWidgetController +{ + std::unique_ptr<SwAddressPreview_Impl> m_pImpl; + std::unique_ptr<weld::ScrolledWindow> m_xVScrollBar; + Link<LinkParamNone*,void> m_aSelectHdl; + + void DrawText_Impl(vcl::RenderContext& rRenderContext, std::u16string_view rAddress, + const Point& rTopLeft, const Size& rSize, bool bIsSelected); + + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; + virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual bool KeyInput( const KeyEvent& rKEvt ) override; + void UpdateScrollBar(); + + DECL_DLLPRIVATE_LINK(ScrollHdl, weld::ScrolledWindow&,void); + +public: + SwAddressPreview(std::unique_ptr<weld::ScrolledWindow> xParent); + virtual ~SwAddressPreview() override; + + /** The address string is a list of address elements separated by spaces + and breaks. The addresses fit into the given layout. If more addresses then + rows/columns should be used a scrollbar will be added. + + AddAddress appends the new address to the already added ones. + Initially the first added address will be selected + */ + void AddAddress(const OUString& rAddress); + // for preview mode - replaces the currently used address by the given one + void SetAddress(const OUString& rAddress); + // removes all addresses + void Clear(); + + // returns the selected address + sal_uInt16 GetSelectedAddress() const; + void SelectAddress(sal_uInt16 nSelect); + void ReplaceSelectedAddress(const OUString&); + void RemoveSelectedAddress(); + + // set the number of rows and columns of addresses + void SetLayout(sal_uInt16 nRows, sal_uInt16 nColumns); + void EnableScrollBar(); + + // fill the actual data into a string (address block or greeting) + static OUString FillData(const OUString& rAddress, SwMailMergeConfigItem const & rConfigItem, + const css::uno::Sequence<OUString>* pAssignments = nullptr); + + void SetSelectHdl (const Link<LinkParamNone*,void>& rLink) { m_aSelectHdl = rLink; } +}; + + +// iterate over an address block or a greeting line the iterator returns the +// parts either as pure string or as column +struct SwMergeAddressItem +{ + OUString sText; + bool bIsColumn; + bool bIsReturn; + + SwMergeAddressItem() + : bIsColumn(false) + , bIsReturn(false) + {} +}; + +class SW_DLLPUBLIC SwAddressIterator +{ + OUString m_sAddress; +public: + SwAddressIterator(const OUString& rAddress) : + m_sAddress(rAddress) + {} + + SwMergeAddressItem Next(); + bool HasMore() const { return !m_sAddress.isEmpty(); } +}; + +class SW_DLLPUBLIC SwAuthenticator final : + public cppu::WeakImplHelper<css::mail::XAuthenticator> +{ + OUString m_aUserName; + OUString m_aPassword; + weld::Window* m_pParentWindow; +public: + SwAuthenticator() + : m_pParentWindow(nullptr) + {} + SwAuthenticator(const OUString& username, const OUString& password, weld::Window* pParent) + : m_aUserName(username) + , m_aPassword(password) + , m_pParentWindow(pParent) + {} + virtual ~SwAuthenticator() override; + + virtual OUString SAL_CALL getUserName() override; + virtual OUString SAL_CALL getPassword() override; + +}; + +class SW_DLLPUBLIC SwConnectionContext final : public cppu::WeakImplHelper<css::uno::XCurrentContext> +{ + OUString m_sMailServer; + sal_Int16 m_nPort; + OUString m_sConnectionType; + +public: + SwConnectionContext(const OUString& rMailServer, sal_Int16 nPort, const OUString& rConnectionType); + virtual ~SwConnectionContext() override; + + virtual css::uno::Any SAL_CALL getValueByName(const OUString& Name) override; +}; + +class SW_DLLPUBLIC SwConnectionListener final : + public cppu::BaseMutex, + public cppu::WeakComponentImplHelper<css::mail::XConnectionListener> +{ + using cppu::WeakComponentImplHelperBase::disposing; + +public: + SwConnectionListener() : + cppu::WeakComponentImplHelper<css::mail::XConnectionListener>(m_aMutex) + {} + virtual ~SwConnectionListener() override; + + virtual void SAL_CALL connected(const css::lang::EventObject& aEvent) override; + + virtual void SAL_CALL disconnected(const css::lang::EventObject& aEvent) override; + + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override; +}; + +class SW_DLLPUBLIC SwMailTransferable final : + public cppu::BaseMutex, + public cppu::WeakComponentImplHelper<css::datatransfer::XTransferable, css::beans::XPropertySet> +{ + OUString m_aMimeType; + OUString m_sBody; + OUString m_aURL; + OUString m_aName; + bool m_bIsBody; + + public: + SwMailTransferable(const OUString& rURL, const OUString& rName, const OUString& rMimeType); + SwMailTransferable(const OUString& rBody, const OUString& rMimeType); + virtual ~SwMailTransferable() override; + virtual css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& aFlavor) override; + + virtual css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL getTransferDataFlavors() override; + virtual sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor& aFlavor) override; + + //XPropertySet + virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; + virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName, const css::uno::Any& aValue) override; + + virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName) override; + virtual void SAL_CALL addPropertyChangeListener(const OUString& aPropertyName, + const css::uno::Reference<css::beans::XPropertyChangeListener>& xListener) override; + virtual void SAL_CALL removePropertyChangeListener(const OUString& aPropertyName, + const css::uno::Reference<css::beans::XPropertyChangeListener >& aListener) override; + virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, + const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener) override; + virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName, + const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener) override; + +}; + +class SW_DLLPUBLIC SwMailMessage final : + public cppu::BaseMutex, + public cppu::WeakComponentImplHelper<css::mail::XMailMessage> +{ + OUString m_sSenderName; + OUString m_sSenderAddress; + OUString m_sReplyToAddress; + OUString m_sSubject; + + css::uno::Reference<css::datatransfer::XTransferable> m_xBody; +// css::mail::MailMessageBody m_aBody; + + css::uno::Sequence<OUString> m_aRecipients; + css::uno::Sequence<OUString> m_aCcRecipients; + css::uno::Sequence<OUString> m_aBccRecipients; +// css::uno::Sequence<css::mail::MailAttachmentDescriptor> m_aAttachments; + css::uno::Sequence<css::mail::MailAttachment> m_aAttachments; +public: + SwMailMessage(); + virtual ~SwMailMessage() override; + + // attributes + virtual OUString SAL_CALL getSenderName() override; + virtual OUString SAL_CALL getSenderAddress() override; + virtual OUString SAL_CALL getReplyToAddress() override; + virtual void SAL_CALL setReplyToAddress( const OUString& _replytoaddress ) override; + virtual OUString SAL_CALL getSubject() override; + virtual void SAL_CALL setSubject(const OUString& _subject) override; + + virtual css::uno::Reference<css::datatransfer::XTransferable> SAL_CALL getBody() override; + virtual void SAL_CALL setBody(const css::uno::Reference<css::datatransfer::XTransferable>& _body) override; + + // methods + virtual void SAL_CALL addRecipient( const OUString& sRecipientAddress ) override; + virtual void SAL_CALL addCcRecipient( const OUString& sRecipientAddress ) override; + virtual void SAL_CALL addBccRecipient( const OUString& sRecipientAddress ) override; + virtual css::uno::Sequence<OUString> SAL_CALL getRecipients() override; + virtual css::uno::Sequence<OUString> SAL_CALL getCcRecipients() override; + virtual css::uno::Sequence<OUString> SAL_CALL getBccRecipients() override; + virtual void SAL_CALL addAttachment(const css::mail::MailAttachment& aMailAttachment) override; + virtual css::uno::Sequence<css::mail::MailAttachment> SAL_CALL getAttachments() override; + void SetSenderName(const OUString& rSenderName) + { + m_sSenderName = rSenderName; + } + void SetSenderAddress(const OUString& rSenderAddress) + { + m_sSenderAddress = rSenderAddress; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/mailmergewizard.hxx b/sw/source/uibase/inc/mailmergewizard.hxx new file mode 100644 index 000000000..657341cf3 --- /dev/null +++ b/sw/source/uibase/inc/mailmergewizard.hxx @@ -0,0 +1,86 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_MAILMERGEWIZARD_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_MAILMERGEWIZARD_HXX + +#include <vcl/roadmapwizard.hxx> +#include <rtl/ustring.hxx> + +class SwView; +class SwMailMergeConfigItem; + +using vcl::WizardTypes::WizardState; +using vcl::WizardTypes::CommitPageReason; + +#define MM_DOCUMENTSELECTPAGE 0 +#define MM_OUTPUTTYPETPAGE 1 +#define MM_ADDRESSBLOCKPAGE 2 +#define MM_GREETINGSPAGE 3 +#define MM_LAYOUTPAGE 4 + +class SwMailMergeWizard final : public ::vcl::RoadmapWizardMachine +{ + SwView* m_pSwView; + OUString sDocumentURL; + bool m_bDocumentLoad; + + std::shared_ptr<SwMailMergeConfigItem> m_xConfigItem; + + OUString m_sStarting; + OUString m_sDocumentType; + OUString m_sAddressBlock; + OUString m_sAddressList; + OUString m_sGreetingsLine; + OUString m_sLayout; + + sal_uInt16 m_nRestartPage; + + using vcl::WizardMachine::skipUntil; + + virtual std::unique_ptr<BuilderPage> createPage( WizardState _nState ) override; + virtual void enterState( WizardState _nState ) override; + + virtual OUString getStateDisplayName( WizardState _nState ) const override; + +public: + SwMailMergeWizard(SwView& rView, std::shared_ptr<SwMailMergeConfigItem> const & rConfigItem); + virtual ~SwMailMergeWizard() override; + + SwView* GetSwView() {return m_pSwView;} + SwMailMergeConfigItem& GetConfigItem() { return *m_xConfigItem;} + + void SetReloadDocument(const OUString& rURL) {sDocumentURL = rURL;} + const OUString& GetReloadDocument() const {return sDocumentURL;} + + //next step requires loading of document + void SetDocumentLoad(bool bSet) {m_bDocumentLoad = bSet;} + + void UpdateRoadmap(); + + sal_uInt16 GetRestartPage() const {return m_nRestartPage;} + void SetRestartPage(sal_uInt16 nPage) { m_nRestartPage = nPage;} + + bool skipUntil( sal_uInt16 nPage) + {return ::vcl::RoadmapWizardMachine::skipUntil(WizardState(nPage));} + + virtual short run() override; +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/mailmrge.hxx b/sw/source/uibase/inc/mailmrge.hxx new file mode 100644 index 000000000..c141029e3 --- /dev/null +++ b/sw/source/uibase/inc/mailmrge.hxx @@ -0,0 +1,167 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_MAILMRGE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_MAILMRGE_HXX + +#include <memory> +#include <sfx2/basedlgs.hxx> + +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/uno/Reference.h> + +#include <dbmgr.hxx> + +class SwWrtShell; +class SwModuleOptions; +class SwXSelChgLstnr_Impl; +struct SwMailMergeDlg_Impl; +namespace com::sun::star{ + namespace frame{ + class XFrame2; + } + namespace sdbc{ + class XResultSet; + class XConnection; + } +} + +class SwMailMergeDlg final : public SfxDialogController +{ + friend class SwXSelChgLstnr_Impl; + + std::unique_ptr<SwMailMergeDlg_Impl> pImpl; + + SwWrtShell& rSh; + SwModuleOptions* pModOpt; + + DBManagerOptions nMergeType; + css::uno::Sequence< css::uno::Any > m_aSelection; + css::uno::Reference< css::frame::XFrame2 > m_xFrame; + + OUString m_sSaveFilter; + OUString m_sFilename; + + std::unique_ptr<weld::Container> m_xBeamerWin; + + std::unique_ptr<weld::RadioButton> m_xAllRB; + std::unique_ptr<weld::RadioButton> m_xMarkedRB; + std::unique_ptr<weld::RadioButton> m_xFromRB; + std::unique_ptr<weld::SpinButton> m_xFromNF; + std::unique_ptr<weld::SpinButton> m_xToNF; + + std::unique_ptr<weld::RadioButton> m_xPrinterRB; + std::unique_ptr<weld::RadioButton> m_xMailingRB; + std::unique_ptr<weld::RadioButton> m_xFileRB; + + std::unique_ptr<weld::CheckButton> m_xSingleJobsCB; + std::unique_ptr<weld::CheckButton> m_xPasswordCB; + + std::unique_ptr<weld::Label> m_xSaveMergedDocumentFT; + std::unique_ptr<weld::RadioButton> m_xSaveSingleDocRB; + std::unique_ptr<weld::RadioButton> m_xSaveIndividualRB; + + std::unique_ptr<weld::CheckButton> m_xGenerateFromDataBaseCB; + + std::unique_ptr<weld::Label> m_xColumnFT; + std::unique_ptr<weld::ComboBox> m_xColumnLB; + std::unique_ptr<weld::Label> m_xPasswordFT; + std::unique_ptr<weld::ComboBox> m_xPasswordLB; + std::unique_ptr<weld::Label> m_xPathFT; + std::unique_ptr<weld::Entry> m_xPathED; + std::unique_ptr<weld::Button> m_xPathPB; + std::unique_ptr<weld::Label> m_xFilterFT; + std::unique_ptr<weld::ComboBox> m_xFilterLB; + + std::unique_ptr<weld::ComboBox> m_xAddressFieldLB; + std::unique_ptr<weld::Label> m_xSubjectFT; + std::unique_ptr<weld::Entry> m_xSubjectED; + std::unique_ptr<weld::Label> m_xFormatFT; + std::unique_ptr<weld::Label> m_xAttachFT; + std::unique_ptr<weld::Entry> m_xAttachED; + std::unique_ptr<weld::Button> m_xAttachPB; + std::unique_ptr<weld::CheckButton> m_xFormatHtmlCB; + std::unique_ptr<weld::CheckButton> m_xFormatRtfCB; + std::unique_ptr<weld::CheckButton> m_xFormatSwCB; + + std::unique_ptr<weld::Button> m_xOkBTN; + + DECL_LINK( ButtonHdl, weld::Button&, void ); + DECL_LINK( InsertPathHdl, weld::Button&, void ); + DECL_LINK( OutputTypeHdl, weld::Toggleable&, void ); + DECL_LINK( FilenameHdl, weld::Toggleable&, void ); + DECL_LINK( ModifyHdl, weld::SpinButton&, void ); + DECL_LINK( SaveTypeHdl, weld::Toggleable&, void ); + DECL_LINK( FileFormatHdl, weld::ComboBox&, void ); + + bool ExecQryShell(); + bool AskUserFilename() const; + OUString GetURLfromPath() const; + +public: + SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rSh, + const OUString& rSourceName, + const OUString& rTableName, + sal_Int32 nCommandType, + const css::uno::Reference< css::sdbc::XConnection>& xConnection, + css::uno::Sequence< css::uno::Any > const * pSelection); + virtual ~SwMailMergeDlg() override; + + DBManagerOptions GetMergeType() const { return nMergeType; } + + bool IsSaveSingleDoc() const { return m_xSaveSingleDocRB->get_active(); } + bool IsGenerateFromDataBase() const { return m_xGenerateFromDataBaseCB->get_active(); } + bool IsFileEncryptedFromDataBase() const { return m_xPasswordCB->get_active(); } + OUString GetColumnName() const { return m_xColumnLB->get_active_text(); } + OUString GetPasswordColumnName() const { return m_xPasswordLB->get_active_text(); } + OUString GetTargetURL() const; + + const OUString& GetSaveFilter() const {return m_sSaveFilter;} + const css::uno::Sequence< css::uno::Any >& GetSelection() const { return m_aSelection; } + css::uno::Reference< css::sdbc::XResultSet> GetResultSet() const; + +}; + +class SwMailMergeCreateFromDlg final : public weld::GenericDialogController +{ + std::unique_ptr<weld::RadioButton> m_xThisDocRB; +public: + SwMailMergeCreateFromDlg(weld::Window* pParent); + virtual ~SwMailMergeCreateFromDlg() override; + bool IsThisDocument() const + { + return m_xThisDocRB->get_active(); + } +}; + +class SwMailMergeFieldConnectionsDlg final : public weld::GenericDialogController +{ + std::unique_ptr<weld::RadioButton> m_xUseExistingRB; +public: + SwMailMergeFieldConnectionsDlg(weld::Window* pParent); + virtual ~SwMailMergeFieldConnectionsDlg() override; + + bool IsUseExistingConnections() const + { + return m_xUseExistingRB->get_active(); + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/mediash.hxx b/sw/source/uibase/inc/mediash.hxx new file mode 100644 index 000000000..da13c88b5 --- /dev/null +++ b/sw/source/uibase/inc/mediash.hxx @@ -0,0 +1,46 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_MEDIASH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_MEDIASH_HXX + +#include <sfx2/module.hxx> +#include <sfx2/shell.hxx> + +#include "basesh.hxx" +#include <shellid.hxx> + +class SwMediaShell final : public SwBaseShell +{ +public: + SFX_DECL_INTERFACE(SW_MEDIASHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + void ExecMedia(SfxRequest const&); + void GetMediaState(SfxItemSet&); + + SwMediaShell(SwView& rView); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/mergetbl.hxx b/sw/source/uibase/inc/mergetbl.hxx new file mode 100644 index 000000000..5b4ef970e --- /dev/null +++ b/sw/source/uibase/inc/mergetbl.hxx @@ -0,0 +1,40 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_MERGETBL_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_MERGETBL_HXX + +#include <vcl/weld.hxx> + +class SwMergeTableDlg final : public weld::GenericDialogController +{ + bool& m_rMergePrev; + + std::unique_ptr<weld::RadioButton> m_xMergePrevRB; + +private: + void Apply(); + +public: + SwMergeTableDlg(weld::Window* pParent, bool& rWithPrev); + virtual short run() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/mmconfigitem.hxx b/sw/source/uibase/inc/mmconfigitem.hxx new file mode 100644 index 000000000..d1296dfe4 --- /dev/null +++ b/sw/source/uibase/inc/mmconfigitem.hxx @@ -0,0 +1,259 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_MMCONFIGITEM_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_MMCONFIGITEM_HXX + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/view/XSelectionChangeListener.hpp> +#include <memory> +#include <set> +#include <vector> +#include <swdbdata.hxx> +#include <swdllapi.h> +#include "sharedconnection.hxx" + +namespace com::sun::star{ + namespace sdbc{ + class XDataSource; + class XResultSet; + } + namespace sdbcx{ + class XColumnsSupplier; + } +} + +class SwMailMergeConfigItem_Impl; +class SwView; +namespace sw::mark { class IMark; } + +struct SwDocMergeInfo +{ + sw::mark::IMark* startPageInTarget; + sal_Int32 nDBRow; +}; + +class SW_DLLPUBLIC SwMailMergeConfigItem +{ + std::unique_ptr<SwMailMergeConfigItem_Impl> m_pImpl; + //session information - not stored in configuration + bool m_bAddressInserted; + bool m_bGreetingInserted; + sal_Int32 m_nGreetingMoves; + sal_uInt32 m_nBegin; + sal_uInt32 m_nEnd; + std::set<sal_Int32> m_aExcludedRecords; + css::uno::Reference<css::view::XSelectionChangeListener> m_xDBChangedListener; + + OUString m_sSelectedPrinter; + + SwView* m_pSourceView; + SwView* m_pTargetView; +public: + SwMailMergeConfigItem(); + ~SwMailMergeConfigItem(); + + enum Gender + { + FEMALE, + MALE, + NEUTRAL + }; + + void Commit(); + + const std::vector<std::pair<OUString, int>>& GetDefaultAddressHeaders() const; + + void SetCurrentConnection( + css::uno::Reference< css::sdbc::XDataSource> const & xSource, + const SharedConnection& rConnection, + css::uno::Reference< css::sdbcx::XColumnsSupplier> const & xColumnsSupplier, + const SwDBData& rDBData); + + css::uno::Reference< css::sdbc::XDataSource> const & GetSource() const; + + SharedConnection const & GetConnection() const; + + css::uno::Reference< css::sdbcx::XColumnsSupplier> const & GetColumnsSupplier(); + + css::uno::Reference< css::sdbc::XResultSet> const & GetResultSet() const; + + void DisposeResultSet(); + + OUString& GetFilter() const; + void SetFilter(OUString const &); + + void SetCurrentDBData( const SwDBData& rDBData); + const SwDBData& GetCurrentDBData() const; + + // move absolute, nTarget == -1 -> goto last record + sal_Int32 MoveResultSet(sal_Int32 nTarget); + sal_Int32 GetResultSetPosition()const; + bool IsResultSetFirstLast(bool& bIsFirst, bool& bIsLast); + + bool IsRecordIncluded(sal_uInt32 nRecord) const; + bool IsRecordExcluded(sal_uInt32 nRecord) const; + void ExcludeRecord(sal_Int32 nRecord, bool bExclude); + css::uno::Sequence< css::uno::Any> GetSelection() const; + + const css::uno::Sequence<OUString>& GetSavedDocuments() const; + + bool IsOutputToLetter()const; + void SetOutputToLetter(bool bSet); + + bool IsAddressBlock()const; + void SetAddressBlock(bool bSet); + + bool IsHideEmptyParagraphs() const; + void SetHideEmptyParagraphs(bool bSet); + + css::uno::Sequence<OUString> GetAddressBlocks() const; + void SetAddressBlocks(const css::uno::Sequence< OUString>& rBlocks); + + void SetCurrentAddressBlockIndex( sal_Int32 nSet ); + sal_Int32 GetCurrentAddressBlockIndex() const; + + bool IsIncludeCountry() const; + OUString& GetExcludeCountry() const; + void SetCountrySettings(bool bSet, const OUString& sCountry); + + bool IsIndividualGreeting(bool bInEMail) const; + void SetIndividualGreeting(bool bSet, bool bInEMail); + + bool IsGreetingLine(bool bInEMail) const; + void SetGreetingLine(bool bSet, bool bInEMail); + + css::uno::Sequence<OUString> GetGreetings(Gender eType) const; + void SetGreetings(Gender eType, const css::uno::Sequence< OUString>& rBlocks); + + sal_Int32 GetCurrentGreeting(Gender eType) const; + void SetCurrentGreeting(Gender eType, sal_Int32 nIndex); + + //the content of the gender column that marks it as female + const OUString& GetFemaleGenderValue() const; + void SetFemaleGenderValue(const OUString& rValue); + + //returns the assignment in the order of the default headers (GetDefaultAddressHeaders()) + css::uno::Sequence<OUString> GetColumnAssignment( const SwDBData& rDBData ) const; + void SetColumnAssignment( + const SwDBData& rDBData, + const css::uno::Sequence< OUString>& ); + + bool IsAddressFieldsAssigned() const; + bool IsGreetingFieldsAssigned() const; + + //e-Mail settings: + OUString const & GetMailDisplayName() const; + void SetMailDisplayName(const OUString& rName); + + OUString const & GetMailAddress() const; + void SetMailAddress(const OUString& rAddress); + + bool IsMailReplyTo() const; + void SetMailReplyTo(bool bSet); + + OUString const & GetMailReplyTo() const; + void SetMailReplyTo(const OUString& rReplyTo); + + OUString const & GetMailServer() const; + void SetMailServer(const OUString& rAddress); + + sal_Int16 GetMailPort() const; + void SetMailPort(sal_Int16 nSet); + + bool IsSecureConnection() const; + void SetSecureConnection(bool bSet); + + bool IsAuthentication() const; + void SetAuthentication(bool bSet); + + OUString const & GetMailUserName() const; + void SetMailUserName(const OUString& rName); + + OUString const & GetMailPassword() const; + void SetMailPassword(const OUString& rPassword); + + bool IsSMTPAfterPOP() const; + void SetSMTPAfterPOP(bool bSet); + + OUString const & GetInServerName() const; + void SetInServerName(const OUString& rServer); + + sal_Int16 GetInServerPort() const; + void SetInServerPort(sal_Int16 nSet); + + bool IsInServerPOP() const; + void SetInServerPOP(bool bSet); + + OUString const & GetInServerUserName() const; + void SetInServerUserName(const OUString& rName); + + OUString const & GetInServerPassword() const; + void SetInServerPassword(const OUString& rPassword); + + //session information + bool IsAddressInserted() const { return m_bAddressInserted; } + void SetAddressInserted() + { + m_bAddressInserted = true; + } + + bool IsGreetingInserted() const + { return m_bGreetingInserted; } + void SetGreetingInserted() + { m_bGreetingInserted = true; } + + void SetBeginEnd(sal_uInt32 nBegin, sal_uInt32 nEnd) + { m_nBegin = nBegin; m_nEnd = nEnd; } + + // counts the moves in the layout page + void MoveGreeting( sal_Int32 nMove) { m_nGreetingMoves += nMove;} + sal_Int32 GetGreetingMoves() const { return m_nGreetingMoves;} + + // new source document - reset some flags + void DocumentReloaded(); + + bool IsMailAvailable() const; + + // notify a completed merge, provide the appropriate e-Mail address if available + void AddMergedDocument(SwDocMergeInfo const & rInfo); + //returns the page and database cursor information of each merged document + SwDocMergeInfo& GetDocumentMergeInfo(sal_uInt32 nDocument); + sal_uInt32 GetMergedDocumentCount(); + + const OUString& GetSelectedPrinter() const + { return m_sSelectedPrinter; } + void SetSelectedPrinter(const OUString& rSet) + { m_sSelectedPrinter = rSet; } + + SwView* GetTargetView(); + void SetTargetView(SwView* pView); + + SwView* GetSourceView(); + void SetSourceView(SwView* pView); + + //helper methods + OUString GetAssignedColumn(sal_uInt32 nColumn) const; + void stopDBChangeListening(); + void updateCurrentDBDataFromDocument(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/multmrk.hxx b/sw/source/uibase/inc/multmrk.hxx new file mode 100644 index 000000000..7e2fead65 --- /dev/null +++ b/sw/source/uibase/inc/multmrk.hxx @@ -0,0 +1,45 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_MULTMRK_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_MULTMRK_HXX + +#include <vcl/weld.hxx> + +class SwTOXMgr; + +// insert mark for index entry +class SwMultiTOXMarkDlg final : public weld::GenericDialogController +{ + DECL_LINK(SelectHdl, weld::TreeView&, void); + SwTOXMgr& m_rMgr; + sal_uInt16 m_nPos; + + std::unique_ptr<weld::Label> m_xTextFT; + std::unique_ptr<weld::TreeView> m_xTOXLB; + +public: + SwMultiTOXMarkDlg(weld::Window* pParent, SwTOXMgr& rTOXMgr); + virtual ~SwMultiTOXMarkDlg() override; + virtual short run() override; +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_MULTMRK_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/navicfg.hxx b/sw/source/uibase/inc/navicfg.hxx new file mode 100644 index 000000000..ad4bb10af --- /dev/null +++ b/sw/source/uibase/inc/navicfg.hxx @@ -0,0 +1,132 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_NAVICFG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_NAVICFG_HXX + +#include <unotools/configitem.hxx> +#include <o3tl/enumarray.hxx> +#include "swcont.hxx" + +class SwNavigationConfig final : public utl::ConfigItem +{ + ContentTypeId m_nRootType; //RootType + sal_Int32 m_nSelectedPos; //SelectedPosition + sal_Int32 m_nOutlineLevel; //OutlineLevel + RegionMode m_nRegionMode; //InsertMode + sal_Int32 m_nActiveBlock; //ActiveBlock//Expand/CollapsState + bool m_bIsSmall; //ShowListBox + bool m_bIsGlobalActive; //GlobalDocMode// global view for GlobalDoc valid? + sal_Int32 m_nOutlineTracking; + bool m_bIsNavigateOnSelect; + + o3tl::enumarray<ContentTypeId, bool> mContentTypeTrack; + + static css::uno::Sequence<OUString> GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SwNavigationConfig(); + virtual ~SwNavigationConfig() override; + + void Load(); + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + + ContentTypeId GetRootType()const {return m_nRootType;} + void SetRootType(ContentTypeId nSet){ + if(m_nRootType != nSet) + { + SetModified(); + m_nRootType = nSet; + } + } + + sal_Int32 GetOutlineLevel()const {return m_nOutlineLevel;} + void SetOutlineLevel(sal_Int32 nSet){ + if(m_nOutlineLevel != nSet) + { + SetModified(); + m_nOutlineLevel = nSet; + } + } + + RegionMode GetRegionMode()const {return m_nRegionMode;} + void SetRegionMode(RegionMode nSet){ + if(m_nRegionMode != nSet) + { + SetModified(); + m_nRegionMode = nSet; + } + } + + sal_Int32 GetActiveBlock()const {return m_nActiveBlock;} + void SetActiveBlock(sal_Int32 nSet){ + if(m_nActiveBlock != nSet) + { + SetModified(); + m_nActiveBlock = nSet; + } + } + + bool IsSmall() const {return m_bIsSmall;} + void SetSmall(bool bSet){ + if(m_bIsSmall != bSet) + { + SetModified(); + m_bIsSmall = bSet; + } + } + + bool IsGlobalActive() const {return m_bIsGlobalActive;} + void SetGlobalActive(bool bSet){ + if(m_bIsGlobalActive != bSet) + { + SetModified(); + m_bIsGlobalActive = bSet; + } + } + + sal_Int32 GetOutlineTracking()const {return m_nOutlineTracking;} + void SetOutlineTracking(sal_Int32 nSet){ + if(m_nOutlineTracking != nSet) + { + SetModified(); + m_nOutlineTracking = nSet; + } + } + + bool IsContentTypeTrack(ContentTypeId eCntTypeId) + { + return mContentTypeTrack[eCntTypeId]; + } + void SetContentTypeTrack(ContentTypeId eCntTypeId, const bool bSet) + { + if (mContentTypeTrack[eCntTypeId] != bSet) + { + SetModified(); + mContentTypeTrack[eCntTypeId] = bSet; + } + } + + bool IsNavigateOnSelect() const {return m_bIsNavigateOnSelect;} +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/navicont.hxx b/sw/source/uibase/inc/navicont.hxx new file mode 100644 index 000000000..e6ee7e30f --- /dev/null +++ b/sw/source/uibase/inc/navicont.hxx @@ -0,0 +1,56 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_NAVICONT_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_NAVICONT_HXX + +#include <rtl/ustring.hxx> +#include <tools/long.hxx> + +class SwDocShell; +class TransferDataContainer; +class TransferableDataHelper; +enum class RegionMode; + +/* + navigator bookmark for distinct identification in Sw +*/ + +class NaviContentBookmark +{ + OUString m_aUrl; // URL including jump mark + OUString m_aDescription; // description + tools::Long m_nDocSh; // address of DocShell + RegionMode m_nDefaultDrag; // description contains defaultDragType + +public: + NaviContentBookmark(); + NaviContentBookmark( const OUString &rUrl, const OUString& rDesc, + RegionMode nDragType, const SwDocShell* ); + + const OUString& GetURL() const { return m_aUrl; } + const OUString& GetDescription() const { return m_aDescription; } + RegionMode GetDefaultDragType() const { return m_nDefaultDrag; } + void Copy( TransferDataContainer& rData ) const; + bool Paste( const TransferableDataHelper& rData ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx new file mode 100644 index 000000000..32b82ab69 --- /dev/null +++ b/sw/source/uibase/inc/navipi.hxx @@ -0,0 +1,178 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_NAVIPI_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_NAVIPI_HXX + +#include <vcl/idle.hxx> +#include <svl/lstner.hxx> +#include <vcl/transfer.hxx> +#include <sfx2/childwin.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/navigat.hxx> +#include <sfx2/weldutils.hxx> +#include <sfx2/sidebar/PanelLayout.hxx> +#include "conttree.hxx" +#include <ndarr.hxx> +#include <memory> + +class SwWrtShell; +class SfxBindings; +class SwNavigationConfig; +class SwView; +class SfxObjectShellLock; +enum class RegionMode; +class SpinField; + +class SwNavigationPI final : public PanelLayout + , public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface + , public SfxListener +{ + friend class SwNavigatorWin; + friend class SwContentTree; + friend class SwGlobalTree; + + ::sfx2::sidebar::ControllerItem m_aDocFullName; + ::sfx2::sidebar::ControllerItem m_aPageStats; + + std::unique_ptr<weld::Toolbar> m_xContent1ToolBox; + std::unique_ptr<weld::Toolbar> m_xContent2ToolBox; + std::unique_ptr<weld::Toolbar> m_xContent3ToolBox; + std::unique_ptr<weld::Toolbar> m_xContent4ToolBox; + std::unique_ptr<weld::Toolbar> m_xContent5ToolBox; + std::unique_ptr<weld::Toolbar> m_xContent6ToolBox; + std::unique_ptr<ToolbarUnoDispatcher> m_xContent2Dispatch; + std::unique_ptr<ToolbarUnoDispatcher> m_xContent3Dispatch; + std::unique_ptr<weld::Menu> m_xHeadingsMenu; + std::unique_ptr<weld::Menu> m_xDragModeMenu; + std::unique_ptr<weld::Menu> m_xUpdateMenu; + std::unique_ptr<weld::Menu> m_xInsertMenu; + std::unique_ptr<weld::Toolbar> m_xGlobalToolBox; + std::unique_ptr<weld::SpinButton> m_xEdit; + std::unique_ptr<weld::Widget> m_xContentBox; + std::unique_ptr<SwContentTree> m_xContentTree; + std::unique_ptr<weld::Widget> m_xGlobalBox; + std::unique_ptr<SwGlobalTree> m_xGlobalTree; + std::unique_ptr<weld::ComboBox> m_xDocListBox; + Idle m_aPageChgIdle; + OUString m_sContentFileName; + OUString m_aStatusArr[4]; + + VclPtr<SfxNavigator> m_xNavigatorDlg; + + std::unique_ptr<SfxObjectShellLock> m_pxObjectShell; + SwView *m_pContentView; + SwWrtShell *m_pContentWrtShell; + SwView *m_pActContView; + SwView *m_pCreateView; + + SwNavigationConfig *m_pConfig; + SfxBindings &m_rBindings; + + RegionMode m_nRegionMode; // 0 - URL, 1 - region with link 2 - region without link + Size m_aExpandedSize; + + bool m_bIsZoomedIn : 1; + bool m_bGlobalMode : 1; + + weld::ComboBox* m_pNavigateByComboBox; + + bool IsZoomedIn() const {return m_bIsZoomedIn;} + void ZoomOut(); + void ZoomIn(); + + void FillBox(); + + DECL_LINK( DocListBoxSelectHdl, weld::ComboBox&, void ); + DECL_LINK( ToolBoxSelectHdl, const OString&, void ); + DECL_LINK( ToolBoxClickHdl, const OString&, void ); + DECL_LINK( ToolBox5DropdownClickHdl, const OString&, void ); + DECL_LINK( ToolBox6DropdownClickHdl, const OString&, void ); + DECL_LINK( DoneLink, SfxPoolItem const *, void ); + DECL_LINK( DropModeMenuSelectHdl, const OString&, void ); + DECL_LINK( HeadingsMenuSelectHdl, const OString&, void ); + DECL_LINK( GlobalMenuSelectHdl, const OString&, void ); + DECL_LINK( ChangePageHdl, Timer*, void ); + DECL_LINK( PageEditModifyHdl, weld::SpinButton&, void ); + DECL_LINK( EditActionHdl, weld::Entry&, bool ); + DECL_LINK( SetFocusChildHdl, weld::Container&, void ); + DECL_LINK( NavigateByComboBoxSelectHdl, weld::ComboBox&, void ); + + bool EditAction(); + void UsePage(); + + void UpdateInitShow(); + + // release ObjectShellLock early enough for app end + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + void ToggleTree(); + void SetGlobalMode(bool bSet) {m_bGlobalMode = bSet;} + + void UpdateNavigateBy(); + +public: + + static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + SfxBindings* pBindings); + SwNavigationPI(weld::Widget* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + SfxBindings* _pBindings, SfxNavigator* pNavigatorDlg); + virtual ~SwNavigationPI() override; + + void UpdateListBox(); + void MoveOutline(SwOutlineNodes::size_type nSource, SwOutlineNodes::size_type nTarget); + + virtual void NotifyItemUpdate(const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState) override; + + virtual void GetControlState(const sal_uInt16 /*nSId*/, + boost::property_tree::ptree& /*rState*/) override {}; + + static OUString CreateDropFileName( const TransferableDataHelper& rData ); + static OUString CleanEntry(const OUString& rEntry); + + RegionMode GetRegionDropMode() const {return m_nRegionMode;} + void SetRegionDropMode(RegionMode nNewMode); + + sal_Int8 AcceptDrop(); + sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); + + bool IsGlobalDoc() const; + bool IsGlobalMode() const {return m_bGlobalMode;} + + SwView* GetCreateView() const; + + virtual weld::Window* GetFrameWeld() const override; + + void SelectNavigateByContentType(const OUString& rContentTypeName); +}; + +class SwNavigatorWrapper final : public SfxNavigatorWrapper +{ +public: + SwNavigatorWrapper(vcl::Window *pParent, sal_uInt16 nId, + SfxBindings* pBindings, SfxChildWinInfo* pInfo); + SFX_DECL_CHILDWINDOW(SwNavigatorWrapper); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/navmgr.hxx b/sw/source/uibase/inc/navmgr.hxx new file mode 100644 index 000000000..858b990fd --- /dev/null +++ b/sw/source/uibase/inc/navmgr.hxx @@ -0,0 +1,58 @@ +/* -*- 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/. + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_NAVMGR_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_NAVMGR_HXX + +#include <vector> + +#include <unocrsr.hxx> + +class SwWrtShell; +struct SwPosition; +class SwUnoCursor; + +class SwNavigationMgr final : public SfxListener +{ +private: + /* + * List of entries in the navigation history + * Entries are SwUnoCursor because these gets corrected automatically + * when nodes are deleted. + * + * The navigation history behaves as a stack, to which items are added when we jump to a new position + * (e.g. click a link, or double click an entry from the navigator). + * Every use of the back/forward buttons results in moving the stack pointer within the navigation history + */ + typedef std::vector< sw::UnoCursorPointer > Stack_t; + Stack_t m_entries; + Stack_t::size_type m_nCurrent; /* Current position within the navigation history */ + SwWrtShell & m_rMyShell; /* The active shell within which the navigation occurs */ + + void GotoSwPosition(const SwPosition &rPos); + +public: + /* Constructor that initializes the shell to the current shell */ + SwNavigationMgr( SwWrtShell & rShell ); + ~SwNavigationMgr() override; + /* Can we go back in the history ? */ + bool backEnabled() ; + /* Can we go forward in the history ? */ + bool forwardEnabled(); + /* The method that is called when we click the back button */ + void goBack() ; + /* The method that is called when we click the forward button */ + void goForward() ; + /* The method that adds the position pPos to the navigation history */ + bool addEntry(const SwPosition& rPos); + /* to get notified if our cursors self-destruct */ + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/navsh.hxx b/sw/source/uibase/inc/navsh.hxx new file mode 100644 index 000000000..3ee72ff9f --- /dev/null +++ b/sw/source/uibase/inc/navsh.hxx @@ -0,0 +1,36 @@ +/* -*- 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/. + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_NAVSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_NAVSH_HXX + +#include <sfx2/module.hxx> +#include <sfx2/shell.hxx> + +#include "basesh.hxx" +#include <shellid.hxx> + +class SwNavigationShell final : public SwBaseShell +{ +public: + SFX_DECL_INTERFACE(SW_NAVIGATIONSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwNavigationShell(SwView& rView); + + void GetState(SfxItemSet&); + void Execute(SfxRequest const&); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/num.hxx b/sw/source/uibase/inc/num.hxx new file mode 100644 index 000000000..781023f0a --- /dev/null +++ b/sw/source/uibase/inc/num.hxx @@ -0,0 +1,138 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_NUM_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_NUM_HXX + +#include <sfx2/tabdlg.hxx> +#include "numprevw.hxx" +#include <numrule.hxx> + +class SwWrtShell; +class SvxBrushItem; +class SwOutlineTabDialog; + +class SwNumPositionTabPage final : public SfxTabPage +{ + std::unique_ptr<SwNumRule> pActNum; + SwNumRule* pSaveNum; + SwWrtShell* pWrtSh; + + SwOutlineTabDialog* pOutlineDlg; + sal_uInt16 nActNumLvl; + + bool bModified : 1; + bool bPreset : 1; + bool bInInintControl : 1; // work around modify-error; should be resolved from 391 on + bool bLabelAlignmentPosAndSpaceModeActive; + + NumberingPreview m_aPreviewWIN; + + std::unique_ptr<weld::TreeView> m_xLevelLB; + std::unique_ptr<weld::Widget> m_xPositionFrame; + + // former set of controls shown for numbering rules containing list level + // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION + std::unique_ptr<weld::Label> m_xDistBorderFT; + std::unique_ptr<weld::MetricSpinButton> m_xDistBorderMF; + std::unique_ptr<weld::CheckButton> m_xRelativeCB; + std::unique_ptr<weld::Label> m_xIndentFT; + std::unique_ptr<weld::MetricSpinButton> m_xIndentMF; + std::unique_ptr<weld::Label> m_xDistNumFT; + std::unique_ptr<weld::MetricSpinButton> m_xDistNumMF; + std::unique_ptr<weld::Label> m_xAlignFT; + std::unique_ptr<weld::ComboBox> m_xAlignLB; + + // new set of controls shown for numbering rules containing list level + // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT + std::unique_ptr<weld::Label> m_xLabelFollowedByFT; + std::unique_ptr<weld::ComboBox> m_xLabelFollowedByLB; + std::unique_ptr<weld::Label> m_xListtabFT; + std::unique_ptr<weld::MetricSpinButton> m_xListtabMF; + std::unique_ptr<weld::Label> m_xAlign2FT; + std::unique_ptr<weld::ComboBox> m_xAlign2LB; + std::unique_ptr<weld::Label> m_xAlignedAtFT; + std::unique_ptr<weld::MetricSpinButton> m_xAlignedAtMF; + std::unique_ptr<weld::Label> m_xIndentAtFT; + std::unique_ptr<weld::MetricSpinButton> m_xIndentAtMF; + std::unique_ptr<weld::Button> m_xStandardPB; + std::unique_ptr<weld::CustomWeld> m_xPreviewWIN; + + + void InitControls(); + + DECL_LINK(LevelHdl, weld::TreeView&, void); + DECL_LINK(EditModifyHdl, weld::ComboBox&, void); + DECL_LINK(DistanceHdl, weld::MetricSpinButton&, void); + DECL_LINK(RelativeHdl, weld::Toggleable&, void); + DECL_LINK(StandardHdl, weld::Button&, void); + + void InitPosAndSpaceMode(); + void ShowControlsDependingOnPosAndSpaceMode(); + + DECL_LINK(LabelFollowedByHdl_Impl, weld::ComboBox&, void); + DECL_LINK(ListtabPosHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(AlignAtHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(IndentAtHdl_Impl, weld::MetricSpinButton&, void); + +public: + + SwNumPositionTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + virtual ~SwNumPositionTabPage() override; + + virtual void ActivatePage(const SfxItemSet& rSet) override; + virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; + + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet* rAttrSet); + + void SetOutlineTabDialog(SwOutlineTabDialog* pDlg){pOutlineDlg = pDlg;} + void SetWrtShell(SwWrtShell* pSh); +#ifdef DBG_UTIL + void SetModified(); +#else + void SetModified() + { + bModified = true; + m_aPreviewWIN.SetLevel(nActNumLvl); + m_aPreviewWIN.Invalidate(); + } +#endif +}; + +class SwSvxNumBulletTabDialog final : public SfxTabDialogController +{ + SwWrtShell& rWrtSh; + + virtual short Ok() override; + virtual void PageCreated(const OString& rPageId, SfxTabPage& rPage) override; + DECL_LINK(RemoveNumberingHdl, weld::Button&, void); + + std::unique_ptr<weld::ComboBox> m_xDummyCombo; + +public: + SwSvxNumBulletTabDialog(weld::Window* pParent, + const SfxItemSet* pSwItemSet, + SwWrtShell &); + virtual ~SwSvxNumBulletTabDialog() override; +}; +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_NUM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/numberingtypelistbox.hxx b/sw/source/uibase/inc/numberingtypelistbox.hxx new file mode 100644 index 000000000..b264dcf8c --- /dev/null +++ b/sw/source/uibase/inc/numberingtypelistbox.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_SW_SOURCE_UIBASE_INC_NUMBERINGTYPELISTBOX_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_NUMBERINGTYPELISTBOX_HXX + +#include <memory> +#include <vcl/weld.hxx> +#include <swdllapi.h> +#include <o3tl/typed_flags_set.hxx> +#include <editeng/svxenum.hxx> + +enum class SwInsertNumTypes +{ + NoNumbering = 0x01, + Extended = 0x02 +}; + +namespace o3tl { + template<> struct typed_flags<SwInsertNumTypes> : is_typed_flags<SwInsertNumTypes, 0x03> {}; +}; + +struct SwNumberingTypeListBox_Impl; + +class SW_DLLPUBLIC SwNumberingTypeListBox +{ + std::unique_ptr<weld::ComboBox> m_xWidget; + std::unique_ptr<SwNumberingTypeListBox_Impl> m_xImpl; + +public: + SwNumberingTypeListBox(std::unique_ptr<weld::ComboBox> pWidget); + ~SwNumberingTypeListBox(); + + void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xWidget->connect_changed(rLink); } + + void Reload(SwInsertNumTypes nTypeFlags); + SvxNumType GetSelectedNumberingType() const; + bool SelectNumberingType(SvxNumType nType); + void SetNoSelection() { m_xWidget->set_active(-1); } + void set_sensitive(bool bEnable) { m_xWidget->set_sensitive(bEnable); } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/numfmtlb.hxx b/sw/source/uibase/inc/numfmtlb.hxx new file mode 100644 index 000000000..0bbca0a5d --- /dev/null +++ b/sw/source/uibase/inc/numfmtlb.hxx @@ -0,0 +1,142 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_NUMFMTLB_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_NUMFMTLB_HXX + +#include <vcl/weld.hxx> +#include <svl/zforlist.hxx> +#include <swdllapi.h> + +class SwView; + +class SW_DLLPUBLIC SwNumFormatBase +{ +protected: + sal_Int32 m_nStdEntry; + sal_uInt32 m_nDefFormat; + SvNumFormatType m_nCurrFormatType; + LanguageType m_eCurLanguage; + bool m_bOneArea; + bool mbCurrFormatTypeNeedsInit; + bool m_bShowLanguageControl; //determine whether the language control has + //to be shown in the number format dialog + bool m_bUseAutomaticLanguage;//determine whether language is automatically assigned +public: + SwNumFormatBase(); + + void SetAutomaticLanguage(bool bSet) { m_bUseAutomaticLanguage = bSet; } + bool IsAutomaticLanguage()const { return m_bUseAutomaticLanguage; } + SvNumFormatType GetFormatType() const { return m_nCurrFormatType; } + LanguageType GetCurLanguage() const { return m_eCurLanguage;} + void SetLanguage(LanguageType eSet) { m_eCurLanguage = eSet; } + void SetShowLanguageControl(bool bSet) { m_bShowLanguageControl = bSet; } + SAL_DLLPRIVATE static double GetDefValue(const SvNumFormatType nFormatType); + void SetOneArea(bool bOnlyOne) { m_bOneArea = bOnlyOne; } + + void SetFormatType(const SvNumFormatType nFormatType); + void SetDefFormat(const sal_uInt32 nDefFormat); + virtual sal_uInt32 GetFormat() const = 0; + + virtual void Init(); + void CallSelectHdl(); + + virtual void clear(); + virtual int get_count() const = 0; + virtual int get_active() const = 0; + virtual OUString get_id(int nPos) const = 0; + virtual OUString get_text(int nPos) const = 0; + virtual weld::Widget& get_widget() const = 0; + virtual void append(const OUString& rId, const OUString& rText) = 0; + virtual void append_text(const OUString& rText) = 0; + virtual void insert_text(int nPos, const OUString& rText) = 0; + virtual void set_active(int nPos) = 0; + virtual void set_id(int nPos, const OUString& rId) = 0; + virtual ~SwNumFormatBase() {} +}; + +class SW_DLLPUBLIC NumFormatListBox final : public SwNumFormatBase +{ + std::unique_ptr<weld::ComboBox> mxControl; + + DECL_DLLPRIVATE_LINK( SelectHdl, weld::ComboBox&, void ); + + virtual void Init() override; + +public: + NumFormatListBox(std::unique_ptr<weld::ComboBox> xControl); + + virtual sal_uInt32 GetFormat() const override; + + virtual void clear() override; + virtual int get_count() const override { return mxControl->get_count(); } + virtual int get_active() const override { return mxControl->get_active(); } + virtual OUString get_id(int nPos) const override { return mxControl->get_id(nPos); } + virtual OUString get_text(int nPos) const override { return mxControl->get_text(nPos); } + virtual weld::Widget& get_widget() const override { return *mxControl; } + virtual void append(const OUString& rId, const OUString& rText) override { mxControl->append(rId, rText); } + virtual void append_text(const OUString& rText) override { mxControl->append_text(rText); } + virtual void insert_text(int nPos, const OUString& rText) override { mxControl->insert_text(nPos, rText); } + virtual void set_active(int nPos) override { mxControl->set_active(nPos); } + virtual void set_id(int nPos, const OUString& rId) override { mxControl->set_id(nPos, rId); } + void show() { mxControl->show(); } + void hide() { mxControl->hide(); } + + void set_sensitive(bool bSensitive) { mxControl->set_sensitive(bSensitive); } + void connect_changed(const Link<weld::ComboBox&, void>& rLink) { mxControl->connect_changed(rLink); } + OString get_buildable_name() const { return mxControl->get_buildable_name(); } + void set_buildable_name(const OString& rId){ mxControl->set_buildable_name(rId); } +}; + +class SW_DLLPUBLIC SwNumFormatTreeView final : public SwNumFormatBase +{ + std::unique_ptr<weld::TreeView> mxControl; + + DECL_DLLPRIVATE_LINK( SelectHdl, weld::TreeView&, void ); + + virtual void Init() override; + +public: + SwNumFormatTreeView(std::unique_ptr<weld::TreeView> xControl); + + virtual sal_uInt32 GetFormat() const override; + + virtual void clear() override; + virtual int get_count() const override { return mxControl->n_children(); } + virtual int get_active() const override { return mxControl->get_selected_index(); } + virtual OUString get_id(int nPos) const override { return mxControl->get_id(nPos); } + virtual OUString get_text(int nPos) const override { return mxControl->get_text(nPos); } + virtual weld::Widget& get_widget() const override { return *mxControl; } + virtual void append(const OUString& rId, const OUString& rText) override { mxControl->append(rId, rText); } + virtual void append_text(const OUString& rText) override { mxControl->append_text(rText); } + virtual void insert_text(int nPos, const OUString& rText) override { mxControl->insert_text(nPos, rText); } + virtual void set_active(int nPos) override { mxControl->select(nPos); } + virtual void set_id(int nPos, const OUString& rId) override { mxControl->set_id(nPos, rId); } + OUString get_selected_text() const { return mxControl->get_selected_text(); } + bool get_visible() const { return mxControl->get_visible(); } + int get_selected_index() const { return mxControl->get_selected_index(); } + void set_visible(bool bVisible) { mxControl->set_visible(bVisible); } + void select(int nPos) { mxControl->select(nPos); } + void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { mxControl->connect_row_activated(rLink); } + OString get_buildable_name() const { return mxControl->get_buildable_name(); } + void set_buildable_name(const OString& rId){ mxControl->set_buildable_name(rId); } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/numpara.hxx b/sw/source/uibase/inc/numpara.hxx new file mode 100644 index 000000000..19fea5b15 --- /dev/null +++ b/sw/source/uibase/inc/numpara.hxx @@ -0,0 +1,85 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_NUMPARA_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_NUMPARA_HXX + +#include <sfx2/tabdlg.hxx> +#include <svl/style.hxx> + +// with this TabPage numbering settings at the paragraph / paragraph style +// are performed. +class SwParagraphNumTabPage final : public SfxTabPage +{ + // #outlinelevel# + const OUString msOutlineNumbering; + + bool bModified : 1; + bool bCurNumrule : 1; + + std::unique_ptr<weld::Widget> m_xOutlineStartBX; + std::unique_ptr<weld::ComboBox> m_xOutlineLvLB; + std::unique_ptr<weld::Widget> m_xNumberStyleBX; + std::unique_ptr<weld::ComboBox> m_xNumberStyleLB; + std::unique_ptr<weld::Button> m_xEditNumStyleBtn; + + std::unique_ptr<weld::CheckButton> m_xNewStartCB; + std::unique_ptr<weld::Widget> m_xNewStartBX; + std::unique_ptr<weld::CheckButton> m_xNewStartNumberCB; + std::unique_ptr<weld::SpinButton> m_xNewStartNF; + + std::unique_ptr<weld::Widget> m_xCountParaFram; + std::unique_ptr<weld::CheckButton> m_xCountParaCB; + std::unique_ptr<weld::CheckButton> m_xRestartParaCountCB; + + std::unique_ptr<weld::Widget> m_xRestartBX; + std::unique_ptr<weld::SpinButton> m_xRestartNF; + + DECL_LINK(NewStartHdl_Impl, weld::Toggleable&, void); + DECL_LINK(StyleHdl_Impl, weld::ComboBox&,void); + DECL_LINK(LineCountHdl_Impl, weld::Toggleable&, void); + DECL_LINK(EditNumStyleHdl_Impl, weld::Button&, void); + DECL_LINK(EditNumStyleSelectHdl_Impl, weld::ComboBox&, void); + + static const WhichRangesContainer aPageRg; + + void ExecuteEditNumStyle_Impl(sal_uInt16 nId, const OUString& rStr, + SfxStyleFamily nFamily); + +public: + SwParagraphNumTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet ); + virtual ~SwParagraphNumTabPage() override; + + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet* rSet ); + static WhichRangesContainer GetRanges() { return aPageRg; } + + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; + virtual void ChangesApplied() override; + + void EnableNewStart(); + void DisableOutline(); + void DisableNumbering(); + + weld::ComboBox& GetStyleBox() {return *m_xNumberStyleLB;}; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/numprevw.hxx b/sw/source/uibase/inc/numprevw.hxx new file mode 100644 index 000000000..3c9059c06 --- /dev/null +++ b/sw/source/uibase/inc/numprevw.hxx @@ -0,0 +1,67 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_NUMPREVW_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_NUMPREVW_HXX + +#include <vcl/customweld.hxx> + +class SwNumRule; +namespace rtl { class OUString; } + +class NumberingPreview final : public weld::CustomWidgetController +{ + const SwNumRule* pActNum; + vcl::Font aStdFont; + tools::Long nPageWidth; + const OUString* pOutlineNames; + bool bPosition; + sal_uInt16 nActLevel; + +private: + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + +public: + NumberingPreview() + : pActNum(nullptr) + , nPageWidth(0) + , pOutlineNames(nullptr) + , bPosition(false) + , nActLevel(USHRT_MAX) + { + } + + void SetNumRule(const SwNumRule* pNum) + { + pActNum = pNum; + Invalidate(); + } + + void SetPageWidth(tools::Long nPgWidth) + {nPageWidth = nPgWidth;} + void SetOutlineNames(const OUString* pNames) + {pOutlineNames = pNames;} + void SetPositionMode() + { bPosition = true;} + void SetLevel(sal_uInt16 nSet) {nActLevel = nSet;} +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/olesh.hxx b/sw/source/uibase/inc/olesh.hxx new file mode 100644 index 000000000..a5c9eb28d --- /dev/null +++ b/sw/source/uibase/inc/olesh.hxx @@ -0,0 +1,43 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_OLESH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_OLESH_HXX + +#include "frmsh.hxx" + +class SwOleShell : public SwFrameShell +{ +public: + SFX_DECL_INTERFACE(SW_OLESHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +protected: + virtual void Activate(bool bMDI) override; + virtual void Deactivate(bool bMDI) override; + +public: + SwOleShell(SwView& rView); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/olmenu.hxx b/sw/source/uibase/inc/olmenu.hxx new file mode 100644 index 000000000..b5d8e59d7 --- /dev/null +++ b/sw/source/uibase/inc/olmenu.hxx @@ -0,0 +1,138 @@ +/* -*- 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 + +#include <com/sun/star/linguistic2/XDictionary.hpp> +#include <com/sun/star/linguistic2/XSpellAlternatives.hpp> +#include <com/sun/star/linguistic2/ProofreadingResult.hpp> +#include <com/sun/star/uno/Sequence.h> + +#include <rtl/ustring.hxx> +#include <vcl/builder.hxx> +#include <vcl/menu.hxx> + +#include <map> +#include <vector> + +#include <swdllapi.h> + +//! Don't change these values. You may break context menu modifying extensions! +#define MN_IGNORE_SELECTION 201 +#define MN_SHORT_COMMENT 208 +#define MN_EXPLANATION_LINK 209 + +// id range for dictionaries sub menu +#define MN_DICTIONARIES_START 300 +#define MN_DICTIONARIES_END (MN_DICTIONARIES_START + 99) + +// id range for suggestions from spell and grammar checker +#define MN_SUGGESTION_START 500 +#define MN_SUGGESTION_END (MN_SUGGESTION_START + MN_MAX_NUM_LANG) + +// id range for auto correction sub menu entries +#define MN_AUTOCORR_START 700 +#define MN_AUTOCORR_END (MN_AUTOCORR_START + MN_MAX_NUM_LANG) + +// max number of language entries sub menus +#define MN_MAX_NUM_LANG 99 + +#define MN_NONE_OFFSET (MN_MAX_NUM_LANG + 1) +#define MN_RESET_OFFSET (MN_MAX_NUM_LANG + 2) +#define MN_MORE_OFFSET (MN_MAX_NUM_LANG + 3) + +// id range for 'set language for selection' sub menu entries +#define MN_SET_LANGUAGE_SELECTION_START 900 +#define MN_SET_LANGUAGE_SELECTION_END (MN_SET_LANGUAGE_SELECTION_START + MN_MAX_NUM_LANG) +#define MN_SET_SELECTION_NONE (MN_SET_LANGUAGE_SELECTION_START + MN_NONE_OFFSET) +#define MN_SET_SELECTION_RESET (MN_SET_LANGUAGE_SELECTION_START + MN_RESET_OFFSET) +#define MN_SET_SELECTION_MORE (MN_SET_LANGUAGE_SELECTION_START + MN_MORE_OFFSET) + +// id range for 'set language for paragraph' sub menu entries +#define MN_SET_LANGUAGE_PARAGRAPH_START 1100 +#define MN_SET_LANGUAGE_PARAGRAPH_END (MN_SET_LANGUAGE_PARAGRAPH_START + MN_MAX_NUM_LANG) +#define MN_SET_PARA_NONE (MN_SET_LANGUAGE_PARAGRAPH_START + MN_NONE_OFFSET) +#define MN_SET_PARA_RESET (MN_SET_LANGUAGE_PARAGRAPH_START + MN_RESET_OFFSET) +#define MN_SET_PARA_MORE (MN_SET_LANGUAGE_PARAGRAPH_START + MN_MORE_OFFSET) + +class SwWrtShell; + +class SW_DLLPUBLIC SwSpellPopup +{ + VclBuilder m_aBuilder; + VclPtr<PopupMenu> m_xPopupMenu; + sal_uInt16 m_nIgnoreWordId; + sal_uInt16 m_nAddMenuId; + sal_uInt16 m_nAddId; + sal_uInt16 m_nSpellDialogId; + sal_uInt16 m_nCorrectMenuId; + sal_uInt16 m_nCorrectDialogId; + sal_uInt16 m_nLangSelectionMenuId; + sal_uInt16 m_nLangParaMenuId; + sal_uInt16 m_nRedlineAcceptId; + sal_uInt16 m_nRedlineRejectId; + sal_uInt16 m_nRedlineNextId; + sal_uInt16 m_nRedlinePrevId; + SwWrtShell* m_pSh; + css::uno::Sequence< css::uno::Reference< css::linguistic2::XDictionary > > m_aDics; + css::uno::Reference< css::linguistic2::XSpellAlternatives > m_xSpellAlt; + + OUString m_sExplanationLink; + + LanguageType m_nCheckedLanguage; + + std::map< sal_Int16, OUString > m_aLangTable_Text; + std::map< sal_Int16, OUString > m_aLangTable_Paragraph; + + OUString m_aDicNameSingle; + bool m_bGrammarResults; // show grammar results? Or show spellcheck results? + + static void fillLangPopupMenu( PopupMenu *pPopupMenu, sal_uInt16 nLangStart, + const css::uno::Sequence< OUString >& aSeq, SwWrtShell* pWrtSh, + std::map< sal_Int16, OUString > &rLangTable ); + + /// Checks if any of the redline menu items should be hidden. + void checkRedline(); + +public: + SwSpellPopup( SwWrtShell *pWrtSh, + const css::uno::Reference< css::linguistic2::XSpellAlternatives > &xAlt, + const OUString & rParaText ); + + SwSpellPopup( SwWrtShell *pWrtSh, + const css::linguistic2::ProofreadingResult &rResult, + sal_Int32 nErrorInResult, + const css::uno::Sequence< OUString > &rSuggestions, + const OUString & rParaText ); + + ~SwSpellPopup(); + + void InitItemCommands(const css::uno::Sequence< OUString >& aSuggestions); + + PopupMenu& GetMenu() + { + return *m_xPopupMenu; + } + + css::uno::Reference<css::awt::XPopupMenu> CreateMenuInterface() { return m_xPopupMenu->CreateMenuInterface(); } + + void Execute( const tools::Rectangle& rPopupPos, vcl::Window* pWin ); + void Execute( sal_uInt16 nId ); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/optcomp.hxx b/sw/source/uibase/inc/optcomp.hxx new file mode 100644 index 000000000..42ebc49d1 --- /dev/null +++ b/sw/source/uibase/inc/optcomp.hxx @@ -0,0 +1,74 @@ +/* -*- 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 + +#include <memory> +#include <sfx2/tabdlg.hxx> +#include <unotools/compatibility.hxx> +#include <rtl/ustring.hxx> + +class SwWrtShell; +struct SwCompatibilityOptPage_Impl; + +class SwCompatibilityOptPage final : public SfxTabPage +{ +private: + // config item + SvtCompatibilityOptions m_aConfigItem; + // text of the user entry + OUString m_sUserEntry; + // shell of the current document + SwWrtShell* m_pWrtShell; + // impl object + std::unique_ptr<SwCompatibilityOptPage_Impl> m_pImpl; + // saved options after "Reset"; used in "FillItemSet" for comparison + sal_uInt32 m_nSavedOptions; + bool m_bSavedMSFormsMenuOption; + + // controls + std::unique_ptr<weld::Frame> m_xMain; + std::unique_ptr<weld::Frame> m_xGlobalOptionsFrame; + std::unique_ptr<weld::ComboBox> m_xFormattingLB; + std::unique_ptr<weld::ComboBox> m_xGlobalOptionsLB; + std::unique_ptr<weld::TreeView> m_xOptionsLB; + std::unique_ptr<weld::TreeView> m_xGlobalOptionsCLB; + std::unique_ptr<weld::Button> m_xDefaultPB; + + // handler + DECL_LINK(SelectHdl, weld::ComboBox&, void); + DECL_LINK(UseAsDefaultHdl, weld::Button&, void); + + // private methods + void InitControls( const SfxItemSet& rSet ); + void SetCurrentOptions( sal_uInt32 nOptions ); + sal_uInt32 GetDocumentOptions() const; + void WriteOptions(); + +public: + SwCompatibilityOptPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + virtual ~SwCompatibilityOptPage() override; + + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet ); + + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/optload.hxx b/sw/source/uibase/inc/optload.hxx new file mode 100644 index 000000000..9b8c7c475 --- /dev/null +++ b/sw/source/uibase/inc/optload.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 . + */ + +#pragma once + +#include <tools/globname.hxx> +#include <tools/solar.h> +#include <sfx2/tabdlg.hxx> + +#include <vcl/customweld.hxx> +#include <vcl/textfilter.hxx> +#include <vcl/weld.hxx> +#include <sfx2/basedlgs.hxx> + +#include <SwCapObjType.hxx> + +class SwFieldMgr; +class SwWrtShell; + +class SwFieldUnitTable +{ +public: + static OUString GetString(sal_uInt32 i); + static sal_uInt32 Count(); + static FieldUnit GetValue(sal_uInt32 i); +}; + +class TextFilterAutoConvert final : public TextFilter +{ +private: + OUString m_sLastGoodText; + OUString m_sNone; +public: + TextFilterAutoConvert(const OUString &rNone) + : m_sNone(rNone) + { + } + virtual OUString filter(const OUString &rText) override; +}; + +class SwLoadOptPage final : public SfxTabPage +{ +private: + SwWrtShell* m_pWrtShell; + sal_uInt16 m_nLastTab; + sal_Int32 m_nOldLinkMode; + + std::unique_ptr<weld::RadioButton> m_xAlwaysRB; + std::unique_ptr<weld::RadioButton> m_xRequestRB; + std::unique_ptr<weld::RadioButton> m_xNeverRB; + + std::unique_ptr<weld::CheckButton> m_xAutoUpdateFields; + std::unique_ptr<weld::CheckButton> m_xAutoUpdateCharts; + + std::unique_ptr<weld::ComboBox> m_xMetricLB; + std::unique_ptr<weld::Label> m_xTabFT; + std::unique_ptr<weld::MetricSpinButton> m_xTabMF; + std::unique_ptr<weld::CheckButton> m_xUseSquaredPageMode; + std::unique_ptr<weld::CheckButton> m_xUseCharUnit; + std::unique_ptr<weld::Entry> m_xWordCountED; + std::unique_ptr<weld::CheckButton> m_xShowStandardizedPageCount; + std::unique_ptr<weld::SpinButton> m_xStandardizedPageSizeNF; + + DECL_LINK(MetricHdl, weld::ComboBox&, void); + DECL_LINK(StandardizedPageCountCheckHdl, weld::Toggleable&, void); + +public: + SwLoadOptPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + virtual ~SwLoadOptPage() override; + + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet* rAttrSet); + + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; +}; + +class SwCaptionOptDlg final : public SfxSingleTabDialogController +{ +public: + SwCaptionOptDlg(weld::Window* pParent, const SfxItemSet& rSet); +}; + +class SwCaptionPreview final : public weld::CustomWidgetController +{ +private: + OUString maText; + bool mbFontInitialized; + vcl::Font maFont; + + void ApplySettings(vcl::RenderContext& rRenderContext); + +public: + SwCaptionPreview(); + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + void SetPreviewText(const OUString& rText); + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; +}; + +class SwCaptionOptPage final : public SfxTabPage +{ +private: + OUString m_sSWTable; + OUString m_sSWFrame; + OUString m_sSWGraphic; + OUString m_sOLE; + + OUString m_sIllustration; + OUString m_sTable; + OUString m_sText; + OUString m_sDrawing; + + OUString m_sBegin; + OUString m_sEnd; + OUString m_sAbove; + OUString m_sBelow; + + OUString m_sNone; + + int m_nPrevSelectedEntry; + + std::unique_ptr<SwFieldMgr> pMgr; + bool bHTMLMode; + + TextFilterAutoConvert m_aTextFilter; + + SwCaptionPreview m_aPreview; + std::unique_ptr<weld::TreeView> m_xCheckLB; + std::unique_ptr<weld::ComboBox> m_xLbCaptionOrder; + + std::unique_ptr<weld::Widget> m_xSettingsGroup; + std::unique_ptr<weld::ComboBox> m_xCategoryBox; + std::unique_ptr<weld::Label> m_xFormatText; + std::unique_ptr<weld::ComboBox> m_xFormatBox; + //#i61007# order of captions + std::unique_ptr<weld::Label> m_xNumberingSeparatorFT; + std::unique_ptr<weld::Entry> m_xNumberingSeparatorED; + std::unique_ptr<weld::Label> m_xTextText; + std::unique_ptr<weld::Entry> m_xTextEdit; + std::unique_ptr<weld::ComboBox> m_xPosBox; + + std::unique_ptr<weld::Widget> m_xNumCapt; + std::unique_ptr<weld::ComboBox> m_xLbLevel; + std::unique_ptr<weld::Entry> m_xEdDelim; + + std::unique_ptr<weld::Widget> m_xCategory; + std::unique_ptr<weld::ComboBox> m_xCharStyleLB; + std::unique_ptr<weld::CheckButton> m_xApplyBorderCB; + std::unique_ptr<weld::CustomWeld> m_xPreview; + + DECL_LINK(SelectHdl, weld::ComboBox&, void); + DECL_LINK(SelectListBoxHdl, weld::ComboBox&, void); + DECL_LINK(ModifyEntryHdl, weld::Entry&, void); + DECL_LINK(ModifyComboHdl, weld::ComboBox&, void); + DECL_LINK(OrderHdl, weld::ComboBox&, void ); + DECL_LINK(ShowEntryHdl, weld::TreeView&, void); + DECL_LINK(ToggleEntryHdl, const weld::TreeView::iter_col&, void); + DECL_LINK(TextFilterHdl, OUString&, bool); + + void ModifyHdl(); + void UpdateEntry(int nRow); + void DelUserData(); + void SetOptions(const sal_uLong nPos, const SwCapObjType eType, const SvGlobalName *pOleId = nullptr); + void SaveEntry(int nEntry); + void InvalidatePreview(); + +public: + SwCaptionOptPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + virtual ~SwCaptionOptPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet* rAttrSet); + + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx new file mode 100644 index 000000000..7bb776951 --- /dev/null +++ b/sw/source/uibase/inc/optpage.hxx @@ -0,0 +1,388 @@ +/* -*- 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 + +#include <sfx2/tabdlg.hxx> + +#include <vcl/weld.hxx> +#include <svtools/ctrlbox.hxx> +#include <svx/colorbox.hxx> +#include <svx/fntctrl.hxx> +#include "fontcfg.hxx" +class SfxPrinter; +class SwStdFontConfig; +class SwWrtShell; +class FontList; + +// Tools->Options->Writer->View +// Tools->Options->Writer/Web->View +class SwContentOptPage final : public SfxTabPage +{ + std::unique_ptr<weld::CheckButton> m_xCrossCB; + + std::unique_ptr<weld::ComboBox> m_xHMetric; + std::unique_ptr<weld::CheckButton> m_xVRulerCBox; + std::unique_ptr<weld::CheckButton> m_xVRulerRightCBox; + std::unique_ptr<weld::ComboBox> m_xVMetric; + std::unique_ptr<weld::CheckButton> m_xSmoothCBox; + + std::unique_ptr<weld::CheckButton> m_xGrfCB; + std::unique_ptr<weld::CheckButton> m_xTableCB; + std::unique_ptr<weld::CheckButton> m_xDrwCB; + std::unique_ptr<weld::CheckButton> m_xPostItCB; + + std::unique_ptr<weld::Frame> m_xSettingsFrame; + std::unique_ptr<weld::Label> m_xSettingsLabel; + std::unique_ptr<weld::Label> m_xMetricLabel; + std::unique_ptr<weld::ComboBox> m_xMetricLB; + + std::unique_ptr<weld::CheckButton> m_xShowInlineTooltips; + std::unique_ptr<weld::Label> m_xOutlineLabel; + std::unique_ptr<weld::CheckButton> m_xShowOutlineContentVisibilityButton; + std::unique_ptr<weld::CheckButton> m_xTreatSubOutlineLevelsAsContent; + std::unique_ptr<weld::CheckButton> m_xShowChangesInMargin; + std::unique_ptr<weld::CheckButton> m_xFieldHiddenCB; + std::unique_ptr<weld::CheckButton> m_xFieldHiddenParaCB; + + DECL_LINK(VertRulerHdl, weld::Toggleable&, void); + DECL_LINK(ShowOutlineContentVisibilityButtonHdl, weld::Toggleable&, void); +public: + SwContentOptPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + virtual ~SwContentOptPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet); + + virtual bool FillItemSet(SfxItemSet* rSet) override; + virtual void Reset(const SfxItemSet* rSet) override; +}; + +// TabPage printer settings additions +class SwAddPrinterTabPage final : public SfxTabPage +{ + OUString sNone; + bool bAttrModified; + bool bPreview; + + std::unique_ptr<weld::CheckButton> m_xGrfCB; + std::unique_ptr<weld::CheckButton> m_xCtrlFieldCB; + std::unique_ptr<weld::CheckButton> m_xBackgroundCB; + std::unique_ptr<weld::CheckButton> m_xBlackFontCB; + std::unique_ptr<weld::CheckButton> m_xPrintHiddenTextCB; + std::unique_ptr<weld::CheckButton> m_xPrintTextPlaceholderCB; + + std::unique_ptr<weld::Widget> m_xPagesFrame; + std::unique_ptr<weld::CheckButton> m_xLeftPageCB; + std::unique_ptr<weld::CheckButton> m_xRightPageCB; + std::unique_ptr<weld::CheckButton> m_xProspectCB; + std::unique_ptr<weld::CheckButton> m_xProspectCB_RTL; + + std::unique_ptr<weld::Widget> m_xCommentsFrame; + std::unique_ptr<weld::RadioButton> m_xNoRB; + std::unique_ptr<weld::RadioButton> m_xOnlyRB; + std::unique_ptr<weld::RadioButton> m_xEndRB; + std::unique_ptr<weld::RadioButton> m_xEndPageRB; + std::unique_ptr<weld::RadioButton> m_xInMarginsRB; + + std::unique_ptr<weld::CheckButton> m_xPrintEmptyPagesCB; + std::unique_ptr<weld::CheckButton> m_xPaperFromSetupCB; + std::unique_ptr<weld::ComboBox> m_xFaxLB; + + DECL_LINK(AutoClickHdl, weld::Toggleable&, void); + DECL_LINK(SelectHdl, weld::ComboBox&, void); + +public: + SwAddPrinterTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + virtual ~SwAddPrinterTabPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet); + + virtual bool FillItemSet(SfxItemSet* rSet) override; + virtual void Reset(const SfxItemSet* rSet) override; + void SetFax(const std::vector<OUString>& ); + void SetPreview(bool bPrev); + virtual void PageCreated(const SfxAllItemSet& aSet) override; +}; + +class SwStdFontTabPage final : public SfxTabPage +{ + OUString m_sShellStd; + OUString m_sShellTitle; + OUString m_sShellList; + OUString m_sShellLabel; + OUString m_sShellIndex; + + VclPtr<SfxPrinter> m_pPrt; + std::unique_ptr<FontList> m_pFontList; + SwStdFontConfig* m_pFontConfig; + SwWrtShell* m_pWrtShell; + LanguageType m_eLanguage; + + // only defaults were there? they were signed with the boxes + bool m_bListDefault :1; + bool m_bSetListDefault :1; + bool m_bLabelDefault :1; + bool m_bSetLabelDefault :1; + bool m_bIdxDefault :1; + bool m_bSetIdxDefault :1; + bool m_bDisposePrinter :1; + + sal_uInt8 m_nFontGroup; //fontcfg.hxx: FONT_GROUP_[STANDARD|CJK|CTL] + + OUString m_sScriptWestern; + OUString m_sScriptAsian; + OUString m_sScriptComplex; + + std::unique_ptr<weld::Label> m_xLabelFT; + std::unique_ptr<weld::ComboBox> m_xStandardBox; + std::unique_ptr<FontSizeBox> m_xStandardHeightLB; + std::unique_ptr<weld::ComboBox> m_xTitleBox; + std::unique_ptr<FontSizeBox> m_xTitleHeightLB; + std::unique_ptr<weld::ComboBox> m_xListBox; + std::unique_ptr<FontSizeBox> m_xListHeightLB; + std::unique_ptr<weld::ComboBox> m_xLabelBox; + std::unique_ptr<FontSizeBox> m_xLabelHeightLB; + std::unique_ptr<weld::ComboBox> m_xIdxBox; + std::unique_ptr<FontSizeBox> m_xIndexHeightLB; + std::unique_ptr<weld::Button> m_xStandardPB; + + DECL_LINK(StandardHdl, weld::Button&, void ); + DECL_LINK(ModifyHdl, weld::ComboBox&, void ); + DECL_LINK(LoseFocusHdl, weld::Widget&, void ); + +public: + SwStdFontTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet); + virtual ~SwStdFontTabPage() override; + + virtual bool FillItemSet(SfxItemSet* rSet) override; + virtual void Reset(const SfxItemSet* rSet) override; + + virtual void PageCreated(const SfxAllItemSet& aSet) override; +}; + +class SwTableOptionsTabPage final : public SfxTabPage +{ + SwWrtShell* m_pWrtShell; + bool m_bHTMLMode; + + std::unique_ptr<weld::CheckButton> m_xHeaderCB; + std::unique_ptr<weld::CheckButton> m_xRepeatHeaderCB; + std::unique_ptr<weld::CheckButton> m_xDontSplitCB; + std::unique_ptr<weld::CheckButton> m_xBorderCB; + + std::unique_ptr<weld::CheckButton> m_xNumFormattingCB; + std::unique_ptr<weld::CheckButton> m_xNumFormatFormattingCB; + std::unique_ptr<weld::CheckButton> m_xNumAlignmentCB; + + std::unique_ptr<weld::MetricSpinButton> m_xRowMoveMF; + std::unique_ptr<weld::MetricSpinButton> m_xColMoveMF; + + std::unique_ptr<weld::MetricSpinButton> m_xRowInsertMF; + std::unique_ptr<weld::MetricSpinButton> m_xColInsertMF; + + std::unique_ptr<weld::RadioButton> m_xFixRB; + std::unique_ptr<weld::RadioButton> m_xFixPropRB; + std::unique_ptr<weld::RadioButton> m_xVarRB; + + DECL_LINK(CheckBoxHdl, weld::Toggleable&, void); + +public: + SwTableOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + virtual ~SwTableOptionsTabPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet); + + virtual bool FillItemSet(SfxItemSet* rSet) override; + virtual void Reset(const SfxItemSet* rSet) override; + + virtual void PageCreated( const SfxAllItemSet& aSet) override; + +}; + +// TabPage for ShadowCursor +class SwShdwCursorOptionsTabPage final : public SfxTabPage +{ + SwWrtShell * m_pWrtShell; + + //nonprinting characters + std::unique_ptr<weld::CheckButton> m_xParaCB; + std::unique_ptr<weld::CheckButton> m_xSHyphCB; + std::unique_ptr<weld::CheckButton> m_xSpacesCB; + std::unique_ptr<weld::CheckButton> m_xHSpacesCB; + std::unique_ptr<weld::CheckButton> m_xTabCB; + std::unique_ptr<weld::Label> m_xTabLabel; + std::unique_ptr<weld::CheckButton> m_xBreakCB; + std::unique_ptr<weld::CheckButton> m_xCharHiddenCB; + std::unique_ptr<weld::CheckButton> m_xBookmarkCB; + std::unique_ptr<weld::Label> m_xBookmarkLabel; + + std::unique_ptr<weld::Frame> m_xDirectCursorFrame; + std::unique_ptr<weld::CheckButton> m_xOnOffCB; + + std::unique_ptr<weld::ComboBox> m_xDirectCursorFillMode; + std::unique_ptr<weld::Frame> m_xCursorProtFrame; + std::unique_ptr<weld::Frame> m_xImageFrame; + std::unique_ptr<weld::CheckButton> m_xCursorInProtCB; + + std::unique_ptr<weld::ComboBox> m_xDefaultAnchorType; + + std::unique_ptr<weld::CheckButton> m_xMathBaselineAlignmentCB; + +public: + SwShdwCursorOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + virtual ~SwShdwCursorOptionsTabPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet); + + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; + + virtual void PageCreated( const SfxAllItemSet& aSet ) override; +}; + +// mark preview +class SwMarkPreview final : public weld::CustomWidgetController +{ + Color m_aBgCol; // background + Color m_aTransCol; // transparency + Color m_aMarkCol; // marks + Color m_aLineCol; // general lines + Color m_aShadowCol; // shadow + Color m_aTextCol; // text + Color m_aPrintAreaCol; // frame for print area + + tools::Rectangle aPage; + tools::Rectangle aLeftPagePrtArea; + tools::Rectangle aRightPagePrtArea; + + sal_uInt16 nMarkPos; + + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; + void PaintPage(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect); + void InitColors(); + +public: + SwMarkPreview(); + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + virtual ~SwMarkPreview() override; + + void SetColor(const Color& rCol) { m_aMarkCol = rCol; } + void SetMarkPos(sal_uInt16 nPos) { nMarkPos = nPos; } +}; + +// redlining options +class SwRedlineOptionsTabPage final : public SfxTabPage +{ + std::unique_ptr<weld::ComboBox> m_xInsertLB; + std::unique_ptr<ColorListBox> m_xInsertColorLB; + std::unique_ptr<SvxFontPrevWindow> m_xInsertedPreviewWN; + std::unique_ptr<weld::CustomWeld> m_xInsertedPreview; + + std::unique_ptr<weld::ComboBox> m_xDeletedLB; + std::unique_ptr<ColorListBox> m_xDeletedColorLB; + std::unique_ptr<SvxFontPrevWindow> m_xDeletedPreviewWN; + std::unique_ptr<weld::CustomWeld> m_xDeletedPreview; + + std::unique_ptr<weld::ComboBox> m_xChangedLB; + std::unique_ptr<ColorListBox> m_xChangedColorLB; + std::unique_ptr<SvxFontPrevWindow> m_xChangedPreviewWN; + std::unique_ptr<weld::CustomWeld> m_xChangedPreview; + + std::unique_ptr<weld::ComboBox> m_xMarkPosLB; + std::unique_ptr<ColorListBox> m_xMarkColorLB; + std::unique_ptr<SwMarkPreview> m_xMarkPreviewWN; + std::unique_ptr<weld::CustomWeld> m_xMarkPreview; + + DECL_LINK(AttribHdl, weld::ComboBox&, void); + void ChangedMaskPrev(); + DECL_LINK(ChangedMaskPrevHdl, weld::ComboBox&, void); + DECL_LINK(ChangedMaskColorPrevHdl, ColorListBox&, void); + DECL_LINK(ColorHdl, ColorListBox&, void); + + static void InitFontStyle(SvxFontPrevWindow& rExampleWin, const OUString& rText); + +public: + SwRedlineOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + virtual ~SwRedlineOptionsTabPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet); + + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; +}; + +// TabPage test settings for SW + +#ifdef DBG_UTIL + +class SwTestTabPage final : public SfxTabPage +{ +public: + SwTestTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + virtual ~SwTestTabPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet); + + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; + +private: + bool bAttrModified; + + std::unique_ptr<weld::CheckButton> m_xTest1CBox; + std::unique_ptr<weld::CheckButton> m_xTest2CBox; + std::unique_ptr<weld::CheckButton> m_xTest3CBox; + std::unique_ptr<weld::CheckButton> m_xTest4CBox; + std::unique_ptr<weld::CheckButton> m_xTest5CBox; + std::unique_ptr<weld::CheckButton> m_xTest6CBox; + std::unique_ptr<weld::CheckButton> m_xTest7CBox; + std::unique_ptr<weld::CheckButton> m_xTest8CBox; + std::unique_ptr<weld::CheckButton> m_xTest9CBox; + std::unique_ptr<weld::CheckButton> m_xTest10CBox; + + void Init(); + DECL_LINK(AutoClickHdl, weld::Toggleable&, void); +}; +#endif // DBG_UTIL + +class SwCompareOptionsTabPage final : public SfxTabPage +{ + std::unique_ptr<weld::RadioButton> m_xAutoRB; + std::unique_ptr<weld::RadioButton> m_xWordRB; + std::unique_ptr<weld::RadioButton> m_xCharRB; + std::unique_ptr<weld::CheckButton> m_xRsidCB; + std::unique_ptr<weld::CheckButton> m_xIgnoreCB; + std::unique_ptr<weld::SpinButton> m_xLenNF; + std::unique_ptr<weld::CheckButton> m_xStoreRsidCB; + + DECL_LINK(ComparisonHdl, weld::Toggleable&, void); + DECL_LINK(IgnoreHdl, weld::Toggleable&, void); + +public: + SwCompareOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + virtual ~SwCompareOptionsTabPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet ); + + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/outline.hxx b/sw/source/uibase/inc/outline.hxx new file mode 100644 index 000000000..6d9a23ab5 --- /dev/null +++ b/sw/source/uibase/inc/outline.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 . + */ + +#pragma once + +#include <memory> +#include <sfx2/tabdlg.hxx> +#include <swtypes.hxx> +#include "numprevw.hxx" +#include "numberingtypelistbox.hxx" +#include <rtl/ustring.hxx> + +class SwWrtShell; +class SwNumRule; +class SwChapterNumRules; + +class SwOutlineTabDialog final : public SfxTabDialogController +{ + static sal_uInt16 nNumLevel; + + OUString aCollNames[MAXLEVEL]; + + SwWrtShell& rWrtSh; + std::unique_ptr<SwNumRule> xNumRule; + SwChapterNumRules* pChapterNumRules; + + bool bModified : 1; + + std::unique_ptr<weld::MenuButton> m_xMenuButton; + + DECL_LINK(CancelHdl, weld::Button&, void); + DECL_LINK(FormHdl, weld::Toggleable&, void); + DECL_LINK(MenuSelectHdl, const OString&, void); + + virtual void PageCreated(const OString& rPageId, SfxTabPage& rPage) override; + virtual short Ok() override; + +public: + SwOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &); + virtual ~SwOutlineTabDialog() override; + + SwNumRule* GetNumRule() { return xNumRule.get(); } + sal_uInt16 GetLevel(std::u16string_view rFormatName) const; + OUString* GetCollNames() {return aCollNames;} + + static sal_uInt16 GetActNumLevel() {return nNumLevel;} + static void SetActNumLevel(sal_uInt16 nSet) {nNumLevel = nSet;} +}; + +class SwOutlineSettingsTabPage final : public SfxTabPage +{ + OUString aNoFormatName; + OUString aSaveCollNames[MAXLEVEL]; + SwWrtShell* pSh; + SwNumRule* pNumRule; + OUString* pCollNames; + sal_uInt16 nActLevel; + NumberingPreview m_aPreviewWIN; + + std::unique_ptr<weld::TreeView> m_xLevelLB; + std::unique_ptr<weld::ComboBox> m_xCollBox; + std::unique_ptr<SwNumberingTypeListBox> m_xNumberBox; + std::unique_ptr<weld::ComboBox> m_xCharFormatLB; + std::unique_ptr<weld::Label> m_xAllLevelFT; + std::unique_ptr<weld::SpinButton> m_xAllLevelNF; + std::unique_ptr<weld::Entry> m_xPrefixED; + std::unique_ptr<weld::Entry> m_xSuffixED; + std::unique_ptr<weld::SpinButton> m_xStartEdit; + std::unique_ptr<weld::CustomWeld> m_xPreviewWIN; + + DECL_LINK( LevelHdl, weld::TreeView&, void ); + DECL_LINK( ToggleComplete, weld::SpinButton&, void ); + DECL_LINK( CollSelect, weld::ComboBox&, void ); + void CollSave(); + DECL_LINK( NumberSelect, weld::ComboBox&, void ); + DECL_LINK( DelimModify, weld::Entry&, void ); + DECL_LINK( StartModified, weld::SpinButton&, void ); + DECL_LINK( CharFormatHdl, weld::ComboBox&, void ); + + void Update(); + + void SetModified() { m_aPreviewWIN.Invalidate(); } + void CheckForStartValue_Impl(sal_uInt16 nNumberingType); + +public: + SwOutlineSettingsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet* rAttrSet); + virtual ~SwOutlineSettingsTabPage() override; + + void SetWrtShell(SwWrtShell* pShell); + + virtual void ActivatePage(const SfxItemSet& rSet) override; + virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; + + virtual bool FillItemSet( SfxItemSet* rSet ) override; + virtual void Reset( const SfxItemSet* rSet ) override; + void SetNumRule(SwNumRule *pRule) + { + pNumRule = pRule; + m_aPreviewWIN.SetNumRule(pNumRule); + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/pardlg.hxx b/sw/source/uibase/inc/pardlg.hxx new file mode 100644 index 000000000..ac8d0da9d --- /dev/null +++ b/sw/source/uibase/inc/pardlg.hxx @@ -0,0 +1,28 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_PARDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_PARDLG_HXX + +//DialogModes: +#define DLG_STD 0 +#define DLG_ENVELOP 2 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/pattern.hxx b/sw/source/uibase/inc/pattern.hxx new file mode 100644 index 000000000..06bb5bb06 --- /dev/null +++ b/sw/source/uibase/inc/pattern.hxx @@ -0,0 +1,33 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_PATTERN_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_PATTERN_HXX + +#include <sfx2/basedlgs.hxx> + +class SwBackgroundDlg final : public SfxSingleTabDialogController +{ +public: + SwBackgroundDlg(weld::Window* pParent, const SfxItemSet& rSet); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/pgfnote.hxx b/sw/source/uibase/inc/pgfnote.hxx new file mode 100644 index 000000000..c55a9f9c7 --- /dev/null +++ b/sw/source/uibase/inc/pgfnote.hxx @@ -0,0 +1,66 @@ +/* -*- 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 + +#include <sfx2/tabdlg.hxx> + +#include <svtools/ctrlbox.hxx> +#include <svx/colorbox.hxx> + +// footnote settings TabPage +class SwFootNotePage final : public SfxTabPage +{ + static const WhichRangesContainer aPageRg; +public: + SwFootNotePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet); + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet); + virtual ~SwFootNotePage() override; + + static WhichRangesContainer GetRanges() { return aPageRg; } + + virtual bool FillItemSet(SfxItemSet *rSet) override; + virtual void Reset(const SfxItemSet *rSet) override; + +private: + + tools::Long lMaxHeight; + + std::unique_ptr<weld::RadioButton> m_xMaxHeightPageBtn; + std::unique_ptr<weld::RadioButton> m_xMaxHeightBtn; + std::unique_ptr<weld::MetricSpinButton> m_xMaxHeightEdit; + std::unique_ptr<weld::MetricSpinButton> m_xDistEdit; + std::unique_ptr<weld::ComboBox> m_xLinePosBox; + std::unique_ptr<SvtLineListBox> m_xLineTypeBox; + std::unique_ptr<weld::MetricSpinButton> m_xLineWidthEdit; + std::unique_ptr<ColorListBox> m_xLineColorBox; + std::unique_ptr<weld::MetricSpinButton> m_xLineLengthEdit; + std::unique_ptr<weld::MetricSpinButton> m_xLineDistEdit; + + DECL_LINK(HeightPage, weld::Toggleable&, void); + DECL_LINK(HeightMetric, weld::Toggleable&, void); + DECL_LINK(HeightModify, weld::MetricSpinButton&, void); + DECL_LINK(LineWidthChanged_Impl, weld::MetricSpinButton&, void); + DECL_LINK(LineColorSelected_Impl, ColorListBox&, void); + + virtual void ActivatePage( const SfxItemSet& rSet ) override; + virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/pggrid.hxx b/sw/source/uibase/inc/pggrid.hxx new file mode 100644 index 000000000..12d6a8bae --- /dev/null +++ b/sw/source/uibase/inc/pggrid.hxx @@ -0,0 +1,91 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_PGGRID_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_PGGRID_HXX + +#include <sfx2/tabdlg.hxx> +#include "colex.hxx" +#include <vcl/customweld.hxx> +#include <vcl/weld.hxx> +#include <svx/colorbox.hxx> + +// TabPage Format/(Styles/)Page/Text grid +class SwTextGridPage final : public SfxTabPage +{ + sal_Int32 m_nRubyUserValue; + bool m_bRubyUserValue; + Size m_aPageSize; + bool m_bVertical; + bool m_bSquaredMode; + bool m_bHRulerChanged; + bool m_bVRulerChanged; + + SwPageGridExample m_aExampleWN; + std::unique_ptr<weld::RadioButton> m_xNoGridRB; + std::unique_ptr<weld::RadioButton> m_xLinesGridRB; + std::unique_ptr<weld::RadioButton> m_xCharsGridRB; + std::unique_ptr<weld::CheckButton> m_xSnapToCharsCB; + std::unique_ptr<weld::CustomWeld> m_xExampleWN; + std::unique_ptr<weld::Widget> m_xLayoutFL; + std::unique_ptr<weld::SpinButton> m_xLinesPerPageNF; + std::unique_ptr<weld::Label> m_xLinesRangeFT; + std::unique_ptr<weld::MetricSpinButton> m_xTextSizeMF; + std::unique_ptr<weld::Label> m_xCharsPerLineFT; + std::unique_ptr<weld::SpinButton> m_xCharsPerLineNF; + std::unique_ptr<weld::Label> m_xCharsRangeFT; + std::unique_ptr<weld::Label> m_xCharWidthFT; + std::unique_ptr<weld::MetricSpinButton> m_xCharWidthMF; + std::unique_ptr<weld::Label> m_xRubySizeFT; + std::unique_ptr<weld::MetricSpinButton> m_xRubySizeMF; + std::unique_ptr<weld::CheckButton> m_xRubyBelowCB; + std::unique_ptr<weld::Widget> m_xDisplayFL; + std::unique_ptr<weld::CheckButton> m_xDisplayCB; + std::unique_ptr<weld::CheckButton> m_xPrintCB; + std::unique_ptr<ColorListBox> m_xColorLB; + + void UpdatePageSize(const SfxItemSet& rSet); + void PutGridItem(SfxItemSet& rSet); + static void SetLinesOrCharsRanges(weld::Label& rField, const sal_Int32 nValue); + + void GridModifyHdl(); + + DECL_LINK(GridTypeHdl, weld::Toggleable&, void); + DECL_LINK(CharorLineChangedHdl, weld::SpinButton&, void); + DECL_LINK(TextSizeChangedHdl, weld::MetricSpinButton&, void); + DECL_LINK(ColorModifyHdl, ColorListBox&, void); + DECL_LINK(GridModifyClickHdl, weld::Toggleable&, void); + DECL_LINK(DisplayGridHdl, weld::Toggleable&, void); + +public: + SwTextGridPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet); + virtual ~SwTextGridPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet); + static WhichRangesContainer GetRanges(); + + virtual bool FillItemSet(SfxItemSet *rSet) override; + virtual void Reset(const SfxItemSet *rSet) override; + + virtual void ActivatePage( const SfxItemSet& rSet ) override; + virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/prcntfld.hxx b/sw/source/uibase/inc/prcntfld.hxx new file mode 100644 index 000000000..d8393d309 --- /dev/null +++ b/sw/source/uibase/inc/prcntfld.hxx @@ -0,0 +1,87 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_PRCNTFLD_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_PRCNTFLD_HXX + +#include <svtools/unitconv.hxx> +#include <vcl/weld.hxx> +#include <swdllapi.h> + +class SW_DLLPUBLIC SwPercentField +{ + std::unique_ptr<weld::MetricSpinButton> m_pField; + + sal_Int64 m_nRefValue; // 100% value for conversion (in Twips) + sal_Int64 m_nOldMax; + sal_Int64 m_nOldMin; + int m_nOldSpinSize; + int m_nOldPageSize; + sal_Int64 m_nLastPercent; + sal_Int64 m_nLastValue; + sal_uInt16 m_nOldDigits; + FieldUnit m_eOldUnit; + bool m_bLockAutoCalculation; //prevent recalculation of percent values when the + //reference value is changed + + SAL_DLLPRIVATE static int ImpPower10(sal_uInt16 n); + +public: + + SwPercentField(std::unique_ptr<weld::MetricSpinButton> pControl); + const weld::MetricSpinButton* get() const { return m_pField.get(); } + weld::MetricSpinButton* get() { return m_pField.get(); } + void connect_value_changed(const Link<weld::MetricSpinButton&, void>& rLink) { m_pField->connect_value_changed(rLink); } + void SetMetric(FieldUnit eUnit) { ::SetFieldUnit(*m_pField, eUnit); } + void set_sensitive(bool bEnable) { m_pField->set_sensitive(bEnable); } + void show() { m_pField->show(); } + bool has_focus() const { return m_pField->has_focus(); } + void save_value() { m_pField->save_value(); } + bool get_value_changed_from_saved() const { return m_pField->get_value_changed_from_saved(); } + void set_text(const OUString& rStr) { m_pField->set_text(rStr); } + void set_accessible_name(const OUString& rStr) { m_pField->set_accessible_name(rStr); } + void SetMetricFieldMin(sal_Int64 nNewMin) { m_pField->set_min(nNewMin, FieldUnit::NONE); } + void SetMetricFieldMax(sal_Int64 nNewMax) { m_pField->set_max(nNewMax, FieldUnit::NONE); } + void SetMetricFieldRange(sal_Int64 nNewMin, sal_Int64 nNewMax) { m_pField->set_range(nNewMin, nNewMax, FieldUnit::NONE); } + void GetMetricFieldRange(sal_Int64 &rOldMin, sal_Int64& rOldMax) const { m_pField->get_range(rOldMin, rOldMax, FieldUnit::NONE); } + + void set_value(sal_Int64 nNewValue, FieldUnit eInUnit = FieldUnit::NONE); + sal_Int64 get_value(FieldUnit eOutUnit = FieldUnit::NONE); + + void set_min(sal_Int64 nNewMin, FieldUnit eInUnit); + void set_max(sal_Int64 nNewMax, FieldUnit eInUnit); + + sal_Int64 get_min(FieldUnit eOutUnit = FieldUnit::NONE) const { return m_pField->get_min(eOutUnit); } + + sal_Int64 NormalizePercent(sal_Int64 nValue); + sal_Int64 DenormalizePercent(sal_Int64 nValue); + + void SetRefValue(sal_Int64 nValue); + sal_Int64 GetRealValue(FieldUnit eOutUnit); + + sal_Int64 Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit); + + void ShowPercent(bool bPercent); + + void LockAutoCalculation(bool bLock) {m_bLockAutoCalculation = bLock;} +}; + + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_PRCNTFLD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx new file mode 100644 index 000000000..5d749564f --- /dev/null +++ b/sw/source/uibase/inc/pview.hxx @@ -0,0 +1,301 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_PVIEW_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_PVIEW_HXX + +#include <tools/link.hxx> +#include <tools/fract.hxx> +#include <vcl/window.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/viewfac.hxx> +#include <sfx2/viewsh.hxx> +#include <sfx2/zoomitem.hxx> +#include <swdllapi.h> +#include <shellid.hxx> + +class SwViewOption; +class SwDocShell; +class SwScrollbar; +class SwViewShell; +class SwPagePreview; +class ImageButton; +class Button; +class SwRect; +class DataChangedEvent; +class CommandEvent; +class SvtAccessibilityOptions; +class SwPagePreviewLayout; + +/// Provides the VCL widget that is used for the main area of the File -> Print Preview window. +class SAL_DLLPUBLIC_RTTI SwPagePreviewWin final : public vcl::Window +{ + SwViewShell* mpViewShell; + sal_uInt16 mnSttPage; + sal_uInt8 mnRow; + sal_uInt8 mnCol; + Size maPxWinSize; + Fraction maScale; + SwPagePreview& mrView; + bool mbCalcScaleForPreviewLayout; + tools::Rectangle maPaintedPreviewDocRect; + SwPagePreviewLayout* mpPgPreviewLayout; + + void SetPagePreview( sal_uInt8 nRow, sal_uInt8 nCol ); + + using Window::Scroll; + +public: + SwPagePreviewWin( vcl::Window* pParent, SwPagePreview& rView ); + virtual ~SwPagePreviewWin() override; + + // calls SwViewShell::Paint + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual void KeyInput( const KeyEvent & ) override; + virtual void Command( const CommandEvent& rCEvt ) override; + virtual void MouseButtonDown(const MouseEvent& rMEvt) override; + virtual void DataChanged( const DataChangedEvent& ) override; + + void SetViewShell( SwViewShell* pShell ); + + SwViewShell* GetViewShell() const + { + return mpViewShell; + } + + sal_uInt8 GetRow() const + { + return mnRow; + } + + sal_uInt8 GetCol() const + { + return mnCol; + } + + sal_uInt16 GetSttPage() const + { + return mnSttPage; + } + + void SetSttPage(sal_uInt16 n) + { + mnSttPage = n; + } + + /** get selected page number of document preview + + @return selected page number + */ + sal_uInt16 SelectedPage() const; + + /** set selected page number in document preview + + @param _nSelectedPageNum + input parameter - physical page number of page that will be the selected one. + */ + void SetSelectedPage( sal_uInt16 _nSelectedPageNum ); + + // If we only have one column we do not have a oth page + sal_uInt16 GetDefSttPage() const { return 1 == mnCol ? 1 : 0; } + + void CalcWish( sal_uInt8 nNewRow, sal_uInt8 nNewCol ); + + void SetWinSize( const Size& rNewSize ); + + // Add <MV_SELPAGE>, <MV_SCROLL> + enum MoveMode{ MV_CALC, MV_PAGE_UP, MV_PAGE_DOWN, MV_DOC_STT, MV_DOC_END, + MV_SELPAGE, MV_SCROLL, MV_NEWWINSIZE, MV_SPECIFIC_PAGE }; + bool MovePage( int eMoveMode ); + + // Create the status bar's string + OUString GetStatusStr( sal_uInt16 nPageCount ) const; + + void RepaintCoreRect( const SwRect& rRect ); + + /** Method to adjust preview to a new zoom factor + paint of preview is prepared for a new zoom factor + Zoom type has also been considered. + Thus, add new parameter <_eZoomType> + */ + void AdjustPreviewToNewZoom( const sal_uInt16 _nZoomFactor, + const SvxZoomType _eZoomType ); + + const tools::Rectangle& GetPaintedPreviewDocRect() const + { + return maPaintedPreviewDocRect; + } + + void Scroll(tools::Long nXMove, tools::Long nYMove, ScrollFlags nFlags = ScrollFlags::NONE) override; + + /** Method to enable/disable book preview + @param _bBookPreview + input parameter - boolean indicating, if book preview mode has to + switch on <true> or of <false> + + @return boolean indicating, if book preview mode has changed. + */ + bool SetBookPreviewMode( const bool _bBookPreview ); + + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; +}; + +/** + * View of a document + */ +class SW_DLLPUBLIC SwPagePreview final : public SfxViewShell +{ + // ViewWindow and handle to core + // current dispatcher shell + VclPtr<SwPagePreviewWin> m_pViewWin; + //viewdata of the previous SwView and the new cursor position + OUString m_sSwViewData; + //and the new cursor position if the user double click in the PagePreview + OUString m_sNewCursorPosition; + // to support keyboard the number of the page to go to can be set too + sal_uInt16 m_nNewPage; + // visible range + OUString m_sPageStr; + Size m_aDocSize; + tools::Rectangle m_aVisArea; + + // MDI control elements + VclPtr<SwScrollbar> m_pHScrollbar; + VclPtr<SwScrollbar> m_pVScrollbar; + bool mbHScrollbarEnabled : 1; + bool mbVScrollbarEnabled : 1; + // dummy window for filling the lower right edge when both scrollbars are active + VclPtr<vcl::Window> m_pScrollFill; + + sal_uInt16 mnPageCount; + bool m_bNormalPrint; + + // New members to reset design mode at draw view for form shell on switching + // back from writer page preview to normal view. + bool mbResetFormDesignMode:1; + bool mbFormDesignModeToReset:1; + + SAL_DLLPRIVATE void Init(); + SAL_DLLPRIVATE Point AlignToPixel(const Point& rPt) const; + + SAL_DLLPRIVATE void CreateScrollbar( bool bHori); + DECL_DLLPRIVATE_LINK(ScrollHdl, ScrollBar*, void); + DECL_DLLPRIVATE_LINK(EndScrollHdl, ScrollBar*, void); + SAL_DLLPRIVATE bool ChgPage( int eMvMode, bool bUpdateScrollbar = true ); + + SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) override; + SAL_DLLPRIVATE virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL ) override; + SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const override; + SAL_DLLPRIVATE virtual std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rOptions) override; + + SAL_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill ); + + /** Helper method to execute SfxRequest FN_PAGE_UP and FN_PAGE_DOWN + + @param _bPgUp + input parameter - boolean that indicates, if FN_PAGE_UP or FN_PAGE_DOWN + has to be executed. + + @param _pReq + optional input parameter - pointer to the <SfxRequest> instance, if existing. + */ + SAL_DLLPRIVATE void ExecPgUpAndPgDown( const bool _bPgUp, + SfxRequest* _pReq ); + + virtual void InnerResizePixel( const Point &rOfs, const Size &rSize, bool inplaceEditModeChange ) override; + virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ) override; + + void SetZoom(SvxZoomType eSet, sal_uInt16 nFactor); + +public: + SFX_DECL_VIEWFACTORY(SwPagePreview); + SFX_DECL_INTERFACE(SW_PAGEPREVIEW) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwViewShell* GetViewShell() const + { return m_pViewWin->GetViewShell(); } + void RepaintCoreRect( const SwRect& rRect ) + { m_pViewWin->RepaintCoreRect( rRect ); } + + void DocSzChgd(const Size& rNewSize); + + void SetVisArea( const tools::Rectangle& ); + + void ScrollViewSzChg(); + void ScrollDocSzChg(); + void ShowHScrollbar(bool bShow); + void ShowVScrollbar(bool bShow); + void EnableHScrollbar(bool bEnable); + void EnableVScrollbar(bool bEnable); + + sal_uInt16 GetPageCount() const { return mnPageCount; } + sal_uInt16 GetSelectedPage() const {return m_pViewWin->SelectedPage();} + + bool HandleWheelCommands( const CommandEvent& ); + + const OUString& GetPrevSwViewData() const { return m_sSwViewData; } + void SetNewCursorPos( const OUString& rStr ) { m_sNewCursorPosition = rStr; } + const OUString& GetNewCursorPos() const { return m_sNewCursorPosition; } + + sal_uInt16 GetNewPage() const {return m_nNewPage;} + + // Handler + void Execute(SfxRequest&); + void GetState(SfxItemSet&); + static void StateUndo(SfxItemSet&); + + SwDocShell* GetDocShell(); + + // apply Accessibility options + void ApplyAccessibilityOptions(SvtAccessibilityOptions const & rAccessibilityOptions); + + // Inline method to request values of new members + // <mbResetFormDesignMode> and <mbFormDesignModeToReset> + bool ResetFormDesignMode() const + { + return mbResetFormDesignMode; + } + + bool FormDesignModeToReset() const + { + return mbFormDesignModeToReset; + } + + /** Adjust position of vertical scrollbar + + Currently used, if the complete preview layout rows fit into to the given + window, if a new page is selected and this page is visible. + + @param _nNewThumbPos + input parameter - new position, which will be assigned to the vertical + scrollbar. + */ + void SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos ); + + SwPagePreview( SfxViewFrame* pFrame, SfxViewShell* ); + virtual ~SwPagePreview() override; +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx new file mode 100644 index 000000000..c91bb468a --- /dev/null +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -0,0 +1,168 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_REDLNDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_REDLNDLG_HXX +#include <swdllapi.h> +#include "chldwrap.hxx" +#include <docary.hxx> +#include <redline.hxx> +#include <sfx2/sidebar/PanelLayout.hxx> +#include <sfx2/basedlgs.hxx> +#include <svl/lstner.hxx> +#include <svx/ctredlin.hxx> +#include <o3tl/sorted_vector.hxx> + +#include <memory> +#include <vector> + +class SwChildWinWrapper; + +struct SwRedlineDataChild +{ + const SwRedlineData* pChild; // link to original stacked data + const SwRedlineDataChild* pNext; // link to stacked data + std::unique_ptr<weld::TreeIter> xTLBChild; // corresponding TreeListBox entry +}; + +struct SwRedlineDataParent +{ + const SwRedlineData* pData; // RedlineDataPtr + const SwRedlineDataChild* pNext; // link to stacked data + std::unique_ptr<weld::TreeIter> xTLBParent; // corresponding TreeListBox entry + OUString sComment; // redline comment + + bool operator< ( const SwRedlineDataParent& rObj ) const + { return (pData && pData->GetSeqNo() < rObj.pData->GetSeqNo()); } +}; + +class SwRedlineDataParentSortArr : public o3tl::sorted_vector<SwRedlineDataParent*, o3tl::less_ptr_to<SwRedlineDataParent> > {}; + +class SW_DLLPUBLIC SwRedlineAcceptDlg final +{ + std::shared_ptr<weld::Window> m_xParentDlg; + std::vector<std::unique_ptr<SwRedlineDataParent>> m_RedlineParents; + std::vector<std::unique_ptr<SwRedlineDataChild>> + m_RedlineChildren; + // purely here so we don't leak + std::vector<std::unique_ptr<RedlinData>> + m_RedlinData; + SwRedlineDataParentSortArr m_aUsedSeqNo; + Timer m_aSelectTimer; + OUString m_sInserted; + OUString m_sDeleted; + OUString m_sFormated; + OUString m_sTableChgd; + OUString m_sFormatCollSet; + OUString m_sFilterAction; + OUString m_sAutoFormat; + bool m_bOnlyFormatedRedlines; + bool m_bRedlnAutoFormat; + + // prevent update dialog data during longer operations (cf #102657#) + bool m_bInhibitActivate; + + std::unique_ptr<SvxAcceptChgCtr> m_xTabPagesCTRL; + std::unique_ptr<weld::Menu> m_xPopup, m_xSortMenu; + SvxTPView* m_pTPView; + SvxRedlinTable* m_pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox + + DECL_DLLPRIVATE_LINK( AcceptHdl, SvxTPView*, void ); + DECL_DLLPRIVATE_LINK( AcceptAllHdl, SvxTPView*, void ); + DECL_DLLPRIVATE_LINK( RejectHdl, SvxTPView*, void ); + DECL_DLLPRIVATE_LINK( RejectAllHdl, SvxTPView*, void ); + DECL_DLLPRIVATE_LINK( UndoHdl, SvxTPView*, void ); + DECL_DLLPRIVATE_LINK( SelectHdl, weld::TreeView&, void ); + DECL_DLLPRIVATE_LINK( GotoHdl, Timer*, void ); + DECL_DLLPRIVATE_LINK( CommandHdl, const CommandEvent&, bool ); + + SAL_DLLPRIVATE SwRedlineTable::size_type CalcDiff(SwRedlineTable::size_type nStart, bool bChild); + SAL_DLLPRIVATE void InsertChildren(SwRedlineDataParent *pParent, const SwRangeRedline& rRedln, bool bHasRedlineAutoFormat); + SAL_DLLPRIVATE void InsertParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd = SwRedlineTable::npos); + SAL_DLLPRIVATE void RemoveParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd); + SAL_DLLPRIVATE void InitAuthors(); + + SAL_DLLPRIVATE static OUString GetActionImage(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0, bool bRowChanges = false); + SAL_DLLPRIVATE OUString GetActionText(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0); + SAL_DLLPRIVATE SwRedlineTable::size_type GetRedlinePos(const weld::TreeIter& rEntry); + + SwRedlineAcceptDlg(SwRedlineAcceptDlg const&) = delete; + SwRedlineAcceptDlg& operator=(SwRedlineAcceptDlg const&) = delete; + +public: + SwRedlineAcceptDlg(const std::shared_ptr<weld::Window>& rParent, weld::Builder *pBuilder, weld::Container *pContentArea, bool bAutoFormat = false); + ~SwRedlineAcceptDlg(); + + DECL_LINK( FilterChangedHdl, SvxTPFilter*, void ); + + SvxAcceptChgCtr& GetChgCtrl() { return *m_xTabPagesCTRL; } + bool HasRedlineAutoFormat() const { return m_bRedlnAutoFormat; } + + void Init(SwRedlineTable::size_type nStart = 0); + void CallAcceptReject( bool bSelect, bool bAccept ); + + void Initialize(OUString &rExtraData); + void FillInfo(OUString &rExtraData) const; + + void Activate(); +}; + +class SwModelessRedlineAcceptDlg final : public SfxModelessDialogController +{ + std::unique_ptr<weld::Container> m_xContentArea; + std::unique_ptr<SwRedlineAcceptDlg> m_xImplDlg; + SwChildWinWrapper* m_pChildWin; + +public: + SwModelessRedlineAcceptDlg(SfxBindings*, SwChildWinWrapper*, weld::Window *pParent); + virtual ~SwModelessRedlineAcceptDlg() override; + + virtual void Activate() override; + virtual void FillInfo(SfxChildWinInfo&) const override; + void Initialize(SfxChildWinInfo * pInfo); +}; + +class SwRedlineAcceptChild final : public SwChildWinWrapper +{ +public: + SwRedlineAcceptChild(vcl::Window* , + sal_uInt16 nId, + SfxBindings*, + SfxChildWinInfo*); + + SFX_DECL_CHILDWINDOW_WITHID( SwRedlineAcceptChild ); + + virtual bool ReInitDlg(SwDocShell *pDocSh) override; +}; + +/// Redline (Manage Changes) panel for the sidebar. +class SwRedlineAcceptPanel final : public PanelLayout, public SfxListener +{ + std::unique_ptr<SwRedlineAcceptDlg> mpImplDlg; + std::unique_ptr<weld::Container> mxContentArea; +public: + SwRedlineAcceptPanel(weld::Widget* pParent); + virtual ~SwRedlineAcceptPanel() override; + + /// We need to be a SfxListener to be able to update the list of changes when we get SfxHintId::DocChanged. + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/regionsw.hxx b/sw/source/uibase/inc/regionsw.hxx new file mode 100644 index 000000000..e766e3a1a --- /dev/null +++ b/sw/source/uibase/inc/regionsw.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_SW_SOURCE_UIBASE_INC_REGIONSW_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_REGIONSW_HXX + +#include <sfx2/basedlgs.hxx> +#include <sfx2/tabdlg.hxx> + +#include "condedit.hxx" +#include <section.hxx> +#include <fmtftntx.hxx> +#include "numberingtypelistbox.hxx" +#include <svx/paraprev.hxx> + +#include <memory> +#include <map> + +class SwWrtShell; + +namespace sfx2 +{ + class DocumentInserter; + class FileDialogHelper; +} + +// dialog "edit regions" +class SectRepr; +typedef std::map<size_t, std::unique_ptr<SectRepr>> SectReprs_t; + +class SwEditRegionDlg final : public SfxDialogController +{ + bool m_bSubRegionsFilled; + + SwWrtShell& rSh; + SectReprs_t m_SectReprs; + const SwSection* pCurrSect; + std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter; + + bool bDontCheckPasswd :1; + + std::unique_ptr<weld::Entry> m_xCurName; + std::unique_ptr<weld::TreeView> m_xTree; + std::unique_ptr<weld::CheckButton> m_xFileCB; + std::unique_ptr<weld::CheckButton> m_xDDECB; + std::unique_ptr<weld::Widget> m_xDDEFrame; + std::unique_ptr<weld::Label> m_xFileNameFT; + std::unique_ptr<weld::Label> m_xDDECommandFT; + std::unique_ptr<weld::Entry> m_xFileNameED; + std::unique_ptr<weld::Button> m_xFilePB; + std::unique_ptr<weld::Label> m_xSubRegionFT; + std::unique_ptr<weld::ComboBox> m_xSubRegionED; + std::unique_ptr<weld::CheckButton> m_xProtectCB; + std::unique_ptr<weld::CheckButton> m_xPasswdCB; + std::unique_ptr<weld::Button> m_xPasswdPB; + std::unique_ptr<weld::CheckButton> m_xHideCB; + std::unique_ptr<weld::Label> m_xConditionFT; + std::unique_ptr<ConditionEdit> m_xConditionED; + // #114856# edit in readonly sections + std::unique_ptr<weld::CheckButton> m_xEditInReadonlyCB; + std::unique_ptr<weld::Button> m_xOK; + std::unique_ptr<weld::Button> m_xOptionsPB; + std::unique_ptr<weld::Button> m_xDismiss; + std::unique_ptr<weld::Widget> m_xHideFrame; + + void RecurseList(const SwSectionFormat* pFormat, const weld::TreeIter* pIter); + size_t FindArrPos(const SwSectionFormat* pFormat); + + DECL_LINK( GetFirstEntryHdl, weld::TreeView&, void ); + + DECL_LINK( OkHdl, weld::Button&, void ); + DECL_LINK( NameEditHdl, weld::Entry&, void ); + DECL_LINK( ConditionEditHdl, weld::Entry&, void ); + + void ChangePasswd(bool bChange); + DECL_LINK( TogglePasswdHdl, weld::Toggleable&, void ); + DECL_LINK( ChangePasswdHdl, weld::Button&, void ); + DECL_LINK( ChangeProtectHdl, weld::Toggleable&, void ); + DECL_LINK( ChangeHideHdl, weld::Toggleable&, void ); + // #114856# edit in readonly sections + DECL_LINK( ChangeEditInReadonlyHdl, weld::Toggleable&, void ); + DECL_LINK( ChangeDismissHdl, weld::Button&, void); + DECL_LINK( UseFileHdl, weld::Toggleable&, void ); + DECL_LINK( FileSearchHdl, weld::Button&, void ); + DECL_LINK( OptionsHdl, weld::Button&, void ); + DECL_LINK( FileNameComboBoxHdl, weld::ComboBox&, void ); + DECL_LINK( FileNameEntryHdl, weld::Entry&, void ); + DECL_LINK( DDEHdl, weld::Toggleable&, void ); + DECL_LINK( DlgClosedHdl, sfx2::FileDialogHelper*, void ); + DECL_LINK( SubRegionEventHdl, weld::ComboBox&, void ); + + bool CheckPasswd(weld::Toggleable* pBox = nullptr); + +public: + SwEditRegionDlg(weld::Window* pParent, SwWrtShell& rWrtSh); + virtual ~SwEditRegionDlg() override; + + void SelectSection(std::u16string_view rSectionName); + +}; + +// dialog "insert region" +class SwInsertSectionTabPage final : public SfxTabPage +{ + OUString m_sFileName; + OUString m_sFilterName; + OUString m_sFilePasswd; + + css::uno::Sequence <sal_Int8 > m_aNewPasswd; + SwWrtShell* m_pWrtSh; + std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter; + + std::unique_ptr<weld::EntryTreeView> m_xCurName; + std::unique_ptr<weld::CheckButton> m_xFileCB; + std::unique_ptr<weld::CheckButton> m_xDDECB; + std::unique_ptr<weld::Label> m_xDDECommandFT; + std::unique_ptr<weld::Label> m_xFileNameFT; + std::unique_ptr<weld::Entry> m_xFileNameED; + std::unique_ptr<weld::Button> m_xFilePB; + std::unique_ptr<weld::Label> m_xSubRegionFT; + std::unique_ptr<weld::ComboBox> m_xSubRegionED; + std::unique_ptr<weld::CheckButton> m_xProtectCB; + std::unique_ptr<weld::CheckButton> m_xPasswdCB; + std::unique_ptr<weld::Button> m_xPasswdPB; + std::unique_ptr<weld::CheckButton> m_xHideCB; + std::unique_ptr<weld::Label> m_xConditionFT; + std::unique_ptr<ConditionEdit> m_xConditionED; + // #114856# edit in readonly sections + std::unique_ptr<weld::CheckButton> m_xEditInReadonlyCB; + + void ChangePasswd(bool bChange); + + DECL_LINK( ChangeHideHdl, weld::Toggleable&, void ); + DECL_LINK( ChangeProtectHdl, weld::Toggleable&, void ); + DECL_LINK( ChangePasswdHdl, weld::Button&, void ); + DECL_LINK( TogglePasswdHdl, weld::Toggleable&, void ); + DECL_LINK( NameEditHdl, weld::ComboBox&, void ); + DECL_LINK( UseFileHdl, weld::Toggleable&, void ); + DECL_LINK( FileSearchHdl, weld::Button&, void ); + DECL_LINK( DDEHdl, weld::Toggleable&, void ); + DECL_LINK( DlgClosedHdl, sfx2::FileDialogHelper*, void ); + +public: + SwInsertSectionTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rAttrSet); + virtual ~SwInsertSectionTabPage() override; + + void SetWrtShell(SwWrtShell& rSh); + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet* ) override; + + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet* rAttrSet); +}; + +class SwSectionFootnoteEndTabPage final : public SfxTabPage +{ + std::unique_ptr<weld::CheckButton> m_xFootnoteNtAtTextEndCB; + std::unique_ptr<weld::CheckButton> m_xFootnoteNtNumCB; + std::unique_ptr<weld::Label> m_xFootnoteOffsetLbl; + std::unique_ptr<weld::SpinButton> m_xFootnoteOffsetField; + std::unique_ptr<weld::CheckButton> m_xFootnoteNtNumFormatCB; + std::unique_ptr<weld::Label> m_xFootnotePrefixFT; + std::unique_ptr<weld::Entry> m_xFootnotePrefixED; + std::unique_ptr<SwNumberingTypeListBox> m_xFootnoteNumViewBox; + std::unique_ptr<weld::Label> m_xFootnoteSuffixFT; + std::unique_ptr<weld::Entry> m_xFootnoteSuffixED; + std::unique_ptr<weld::CheckButton> m_xEndNtAtTextEndCB; + std::unique_ptr<weld::CheckButton> m_xEndNtNumCB; + std::unique_ptr<weld::Label> m_xEndOffsetLbl; + std::unique_ptr<weld::SpinButton> m_xEndOffsetField; + std::unique_ptr<weld::CheckButton> m_xEndNtNumFormatCB; + std::unique_ptr<weld::Label> m_xEndPrefixFT; + std::unique_ptr<weld::Entry> m_xEndPrefixED; + std::unique_ptr<SwNumberingTypeListBox> m_xEndNumViewBox; + std::unique_ptr<weld::Label> m_xEndSuffixFT; + std::unique_ptr<weld::Entry> m_xEndSuffixED; + + DECL_LINK(FootEndHdl, weld::Toggleable&, void); + void ResetState( bool bFootnote, const SwFormatFootnoteEndAtTextEnd& ); + +public: + SwSectionFootnoteEndTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rAttrSet); + virtual ~SwSectionFootnoteEndTabPage() override; + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet* ) override; + + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet* rAttrSet); +}; + +class SwSectionIndentTabPage final : public SfxTabPage +{ + SvxParaPrevWindow m_aPreviewWin; + std::unique_ptr<weld::MetricSpinButton> m_xBeforeMF; + std::unique_ptr<weld::MetricSpinButton> m_xAfterMF; + std::unique_ptr<weld::CustomWeld> m_xPreviewWin; + + DECL_LINK(IndentModifyHdl, weld::MetricSpinButton&, void); +public: + SwSectionIndentTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rAttrSet); + virtual ~SwSectionIndentTabPage() override; + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet* ) override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet); + + void SetWrtShell(SwWrtShell const & rSh); +}; + +class SwInsertSectionTabDialog final : public SfxTabDialogController +{ + SwWrtShell& rWrtSh; + std::unique_ptr<SwSectionData> m_pSectionData; + + virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; + virtual short Ok() override; +public: + SwInsertSectionTabDialog(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh); + virtual ~SwInsertSectionTabDialog() override; + + void SetSectionData(SwSectionData const& rSect); + SwSectionData * GetSectionData() { return m_pSectionData.get(); } +}; + +class SwSectionPropertyTabDialog final : public SfxTabDialogController +{ + SwWrtShell& rWrtSh; + + virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; +public: + SwSectionPropertyTabDialog(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh); + virtual ~SwSectionPropertyTabDialog() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/rowht.hxx b/sw/source/uibase/inc/rowht.hxx new file mode 100644 index 000000000..659b9ac63 --- /dev/null +++ b/sw/source/uibase/inc/rowht.hxx @@ -0,0 +1,43 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_ROWHT_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_ROWHT_HXX + +#include <vcl/weld.hxx> + +class SwWrtShell; + +class SwTableHeightDlg final : public weld::GenericDialogController +{ + SwWrtShell& m_rSh; + + std::unique_ptr<weld::MetricSpinButton> m_xHeightEdit; + std::unique_ptr<weld::CheckButton> m_xAutoHeightCB; + +private: + void Apply(); + +public: + SwTableHeightDlg(weld::Window* pParent, SwWrtShell& rS); + virtual short run() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/scroll.hxx b/sw/source/uibase/inc/scroll.hxx new file mode 100644 index 000000000..8527e7969 --- /dev/null +++ b/sw/source/uibase/inc/scroll.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 . + */ +#pragma once + +#include <vcl/scrbar.hxx> + +class SwScrollbar final : public ScrollBar +{ + Size m_aDocSz; + bool m_bHori :1; // horizontal = salTrue, otherwise vertical + bool m_bAuto :1; // for scrolling mode + bool m_bVisible :1; // show/hide should only set this flag + bool m_bSizeSet :1; // was the size already set? + + void AutoShow(); + + using Window::Hide; + using Window::IsVisible; + +public: + void ExtendedShow( bool bVisible = true ); + void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) override; + bool IsVisible(bool bReal) const { return bReal ? ScrollBar::IsVisible() : m_bVisible; } + + // changing of document size + void DocSzChgd(const Size &rNewSize); + // changing of visible region + void ViewPortChgd(const tools::Rectangle &rRectangle); + // what is it?? + bool IsHoriScroll() const { return m_bHori; } + + void SetAuto(bool bSet); + bool IsAuto() const { return m_bAuto;} + + SwScrollbar(vcl::Window *pParent, bool bHori ); + virtual ~SwScrollbar() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/selglos.hxx b/sw/source/uibase/inc/selglos.hxx new file mode 100644 index 000000000..fd5de3796 --- /dev/null +++ b/sw/source/uibase/inc/selglos.hxx @@ -0,0 +1,53 @@ +/* -*- 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 + +#include <sal/config.h> + +#include <string_view> + +#include <vcl/weld.hxx> + +class SwSelGlossaryDlg final : public weld::GenericDialogController +{ + std::unique_ptr<weld::Frame> m_xFrame; + std::unique_ptr<weld::TreeView> m_xGlosBox; + + DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); +public: + SwSelGlossaryDlg(weld::Window * pParent, std::u16string_view rShortName); + virtual ~SwSelGlossaryDlg() override; + + void InsertGlos(std::u16string_view rRegion, std::u16string_view rGlosName) + { + const OUString aTmp = OUString::Concat(rRegion) + ":" + rGlosName; + m_xGlosBox->append_text(aTmp); + } + sal_Int32 GetSelectedIdx() const + { + return m_xGlosBox->get_selected_index(); + } + void SelectEntryPos(sal_Int32 nIdx) + { + m_xGlosBox->select(nIdx); + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/sharedconnection.hxx b/sw/source/uibase/inc/sharedconnection.hxx new file mode 100644 index 000000000..58d5dfcfc --- /dev/null +++ b/sw/source/uibase/inc/sharedconnection.hxx @@ -0,0 +1,30 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SHAREDCONNECTION_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SHAREDCONNECTION_HXX + +#include <unotools/sharedunocomponent.hxx> +#include <com/sun/star/sdbc/XConnection.hpp> + +typedef ::utl::SharedUNOComponent<css::sdbc::XConnection> SharedConnection; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_SHAREDCONNECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/shdwcrsr.hxx b/sw/source/uibase/inc/shdwcrsr.hxx new file mode 100644 index 000000000..bf7fec99a --- /dev/null +++ b/sw/source/uibase/inc/shdwcrsr.hxx @@ -0,0 +1,53 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SHDWCRSR_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SHDWCRSR_HXX + +#include <tools/gen.hxx> +#include <tools/color.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/window.hxx> +#include <limits.h> + +class SwShadowCursor +{ + VclPtr<vcl::Window> m_pWin; + Color m_aCol; + Point m_aOldPt; + tools::Long m_nOldHeight; + sal_uInt16 m_nOldMode; + + void DrawTri( const Point& rPt, tools::Long nHeight, bool bLeft ); + void DrawCursor( const Point& rPt, tools::Long nHeight, sal_uInt16 nMode ); + +public: + SwShadowCursor( vcl::Window& rWin, const Color& rCol ) + : m_pWin( &rWin ), m_aCol( rCol ), m_nOldHeight(0), m_nOldMode( USHRT_MAX ) {} + ~SwShadowCursor(); + + void SetPos( const Point& rPt, tools::Long nHeight, sal_uInt16 nMode ); + + void Paint(); + + tools::Rectangle GetRect() const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/splittbl.hxx b/sw/source/uibase/inc/splittbl.hxx new file mode 100644 index 000000000..99e61f7d4 --- /dev/null +++ b/sw/source/uibase/inc/splittbl.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 . + */ + +#pragma once + +#include <vcl/weld.hxx> +#include <tblenum.hxx> + +class SwWrtShell; + +class SwSplitTableDlg final : public weld::GenericDialogController +{ +private: + std::unique_ptr<weld::RadioButton> m_xHorzBox; + std::unique_ptr<weld::RadioButton> m_xContentCopyRB; + std::unique_ptr<weld::RadioButton> m_xBoxAttrCopyWithParaRB; + std::unique_ptr<weld::RadioButton> m_xBoxAttrCopyNoParaRB; + std::unique_ptr<weld::RadioButton> m_xBorderCopyRB; + + SwWrtShell& rShell; + SplitTable_HeadlineOption m_nSplit; + + void Apply(); + +public: + SwSplitTableDlg(weld::Window* pParent, SwWrtShell& rSh); + + virtual short run() override + { + short nRet = GenericDialogController::run(); + if (nRet == RET_OK) + Apply(); + return nRet; + } + + SplitTable_HeadlineOption GetSplitMode() const { return m_nSplit; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/srcedtw.hxx b/sw/source/uibase/inc/srcedtw.hxx new file mode 100644 index 000000000..0042060cb --- /dev/null +++ b/sw/source/uibase/inc/srcedtw.hxx @@ -0,0 +1,145 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SRCEDTW_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SRCEDTW_HXX + +#include <vcl/window.hxx> +#include <svl/lstner.hxx> +#include <vcl/timer.hxx> +#include <vcl/idle.hxx> + +#include <vcl/xtextedt.hxx> +#include <mutex> +#include <set> + +namespace com::sun::star::beans { class XMultiPropertySet; } +class ScrollBar; +class SwSrcView; +class SwSrcEditWindow; +class TextEngine; +class TextView; +class DataChangedEvent; + +class TextViewOutWin final : public vcl::Window +{ + TextView* m_pTextView; + + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override; + virtual void KeyInput( const KeyEvent& rKeyEvt ) override; + virtual void MouseMove( const MouseEvent& rMEvt ) override; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; + virtual void Command( const CommandEvent& rCEvt ) override; + virtual void DataChanged( const DataChangedEvent& ) override; + +public: + TextViewOutWin(vcl::Window* pParent, WinBits nBits) : + Window(pParent, nBits), m_pTextView(nullptr){} + + void SetTextView( TextView* pView ) {m_pTextView = pView;} + +}; + +class SwSrcEditWindow final : public vcl::Window, public SfxListener +{ +private: + class ChangesListener; + friend class ChangesListener; + std::unique_ptr<TextView> m_pTextView; + std::unique_ptr<ExtTextEngine> m_pTextEngine; + + VclPtr<TextViewOutWin> m_pOutWin; + VclPtr<ScrollBar> m_pHScrollbar, + m_pVScrollbar; + + SwSrcView* m_pSrcView; + + rtl::Reference< ChangesListener > m_xListener; + std::mutex mutex_; + css::uno::Reference< css::beans::XMultiPropertySet > + m_xNotifier; + + tools::Long m_nCurTextWidth; + sal_uInt16 m_nStartLine; + rtl_TextEncoding m_eSourceEncoding; + bool m_bReadonly; + bool m_bHighlighting; + + Idle m_aSyntaxIdle; + std::set<sal_uInt16> m_aSyntaxLineTable; + + void ImpDoHighlight( const OUString& rSource, sal_uInt16 nLineOff ); + + void SetFont(); + + DECL_LINK( SyntaxTimerHdl, Timer *, void ); + + using Window::Invalidate; + + virtual void Resize() override; + virtual void DataChanged( const DataChangedEvent& ) override; + virtual void GetFocus() override; +// virtual void LoseFocus(); + + void CreateTextEngine(); + void DoSyntaxHighlight( sal_uInt16 nPara ); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + DECL_LINK(ScrollHdl, ScrollBar*, void); + +public: + SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView ); + virtual ~SwSrcEditWindow() override; + virtual void dispose() override; + + void SetScrollBarRanges(); + void InitScrollBars(); + void Read(SvStream& rInput) { m_pTextEngine->Read(rInput); } + void Write(SvStream& rOutput) { m_pTextEngine->Write(rOutput); } + + TextView* GetTextView() + {return m_pTextView.get();} + TextEngine* GetTextEngine() + {return m_pTextEngine.get();} + SwSrcView* GetSrcView() {return m_pSrcView;} + + TextViewOutWin* GetOutWin() {return m_pOutWin;} + + virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE ) override; + + void ClearModifyFlag() + { m_pTextEngine->SetModified(false); } + bool IsModified() const + { return m_pTextEngine->IsModified();} + + void SetReadonly(bool bSet){m_bReadonly = bSet;} + bool IsReadonly() const {return m_bReadonly;} + + void SetStartLine(sal_uInt16 nLine){m_nStartLine = nLine;} + + virtual void Command( const CommandEvent& rCEvt ) override; + void HandleWheelCommand( const CommandEvent& rCEvt ); + + void SetTextEncoding(rtl_TextEncoding eEncoding); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/srcview.hxx b/sw/source/uibase/inc/srcview.hxx new file mode 100644 index 000000000..caaecad67 --- /dev/null +++ b/sw/source/uibase/inc/srcview.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_SW_SOURCE_UIBASE_INC_SRCVIEW_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SRCVIEW_HXX + +#include <sfx2/viewfac.hxx> +#include <sfx2/viewsh.hxx> +#include <vcl/outdev.hxx> + +#include "srcedtw.hxx" +#include <shellid.hxx> + +class SwDocShell; +class SvxSearchItem; +class SfxMedium; + +class SwSrcView final : public SfxViewShell +{ + VclPtr<SwSrcEditWindow> m_aEditWin; + + std::unique_ptr<SvxSearchItem> m_pSearchItem; + + bool m_bSourceSaved :1; + rtl_TextEncoding m_eLoadEncoding; + void Init(); + + // for read-only switching + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + void StartSearchAndReplace(const SvxSearchItem& rItem, + bool bApi, + bool bRecursive = false); + +public: + SFX_DECL_VIEWFACTORY(SwSrcView); + SFX_DECL_INTERFACE(SW_SRC_VIEWSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwSrcView(SfxViewFrame* pFrame, SfxViewShell*); + + virtual ~SwSrcView() override; + + SwDocShell* GetDocShell(); + void SaveContent(const OUString& rTmpFile); + void SaveContentTo(SfxMedium& rMed); + + bool IsModified() const {return m_aEditWin->IsModified();} + + void Execute(SfxRequest&); + void GetState(SfxItemSet&); + + SvxSearchItem* GetSearchItem(); + void SetSearchItem( const SvxSearchItem& rItem ); + + void Load(SwDocShell* pDocShell); + + virtual sal_uInt16 SetPrinter( SfxPrinter* pNew, SfxPrinterChangeFlags nDiff = SFX_PRINTER_ALL ) override; + virtual SfxPrinter* GetPrinter( bool bCreate = false ) override; + + sal_Int32 PrintSource( OutputDevice *pOutDev, sal_Int32 nPage, bool bCalcNumPagesOnly ); + + bool HasSourceSaved() const {return m_bSourceSaved;} + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/srtdlg.hxx b/sw/source/uibase/inc/srtdlg.hxx new file mode 100644 index 000000000..2b6a39092 --- /dev/null +++ b/sw/source/uibase/inc/srtdlg.hxx @@ -0,0 +1,89 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SRTDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SRTDLG_HXX + +#include <svtools/collatorres.hxx> +#include <svx/langbox.hxx> +#include <vcl/weld.hxx> + +class SwWrtShell; + +class SwSortDlg final : public weld::GenericDialogController +{ + weld::Window* m_pParent; + std::unique_ptr<weld::Label> m_xColLbl; + + std::unique_ptr<weld::CheckButton> m_xKeyCB1; + std::unique_ptr<weld::SpinButton> m_xColEdt1; + std::unique_ptr<weld::ComboBox> m_xTypDLB1; + std::unique_ptr<weld::RadioButton> m_xSortUp1RB; + std::unique_ptr<weld::RadioButton> m_xSortDn1RB; + + std::unique_ptr<weld::CheckButton> m_xKeyCB2; + std::unique_ptr<weld::SpinButton> m_xColEdt2; + std::unique_ptr<weld::ComboBox> m_xTypDLB2; + std::unique_ptr<weld::RadioButton> m_xSortUp2RB; + std::unique_ptr<weld::RadioButton> m_xSortDn2RB; + + std::unique_ptr<weld::CheckButton> m_xKeyCB3; + std::unique_ptr<weld::SpinButton> m_xColEdt3; + std::unique_ptr<weld::ComboBox> m_xTypDLB3; + std::unique_ptr<weld::RadioButton> m_xSortUp3RB; + std::unique_ptr<weld::RadioButton> m_xSortDn3RB; + + std::unique_ptr<weld::RadioButton> m_xColumnRB; + std::unique_ptr<weld::RadioButton> m_xRowRB; + + std::unique_ptr<weld::RadioButton> m_xDelimTabRB; + std::unique_ptr<weld::RadioButton> m_xDelimFreeRB; + std::unique_ptr<weld::Entry> m_xDelimEdt; + std::unique_ptr<weld::Button> m_xDelimPB; + + std::unique_ptr<SvxLanguageBox> m_xLangLB; + + std::unique_ptr<weld::CheckButton> m_xCaseCB; + + OUString aColText; + OUString aRowText; + OUString aNumericText; + + SwWrtShell& rSh; + std::unique_ptr<CollatorResource> m_xColRes; + + sal_uInt16 nX; + sal_uInt16 nY; + + void Apply(); + sal_Unicode GetDelimChar() const; + + DECL_LINK(CheckHdl, weld::Toggleable&, void); + DECL_LINK(DelimHdl, weld::Toggleable&, void); + DECL_LINK(LanguageListBoxHdl, weld::ComboBox&, void); + void LanguageHdl(weld::ComboBox const*); + DECL_LINK(DelimCharHdl, weld::Button&, void); + +public: + SwSortDlg(weld::Window* pParent, SwWrtShell& rSh); + virtual short run() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swcont.hxx b/sw/source/uibase/inc/swcont.hxx new file mode 100644 index 000000000..77b9d5656 --- /dev/null +++ b/sw/source/uibase/inc/swcont.hxx @@ -0,0 +1,108 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SWCONT_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SWCONT_HXX + +#include <rtl/ustring.hxx> +#include <tools/long.hxx> +#include <vcl/naturalsort.hxx> + +class SwContentType; + +enum class ContentTypeId +{ + OUTLINE = 0, + TABLE = 1, + FRAME = 2, + GRAPHIC = 3, + OLE = 4, + BOOKMARK = 5, + REGION = 6, + URLFIELD = 7, + REFERENCE = 8, + INDEX = 9, + POSTIT = 10, + DRAWOBJECT = 11, + TEXTFIELD = 12, + FOOTNOTE = 13, + ENDNOTE = 14, + LAST = ENDNOTE, + UNKNOWN = -1 +}; + +// strings for context menus +#define CONTEXT_COUNT 17 +#define GLOBAL_CONTEXT_COUNT 14 + +// modes for Drag 'n Drop +enum class RegionMode +{ + NONE = 0, + LINK = 1, + EMBEDDED = 2 +}; + +//mini rtti +class SwTypeNumber +{ + sal_uInt8 m_nTypeId; + + public: + SwTypeNumber(sal_uInt8 nId) :m_nTypeId(nId){} + virtual ~SwTypeNumber(); + + sal_uInt8 GetTypeId() const { return m_nTypeId;} +}; + +class SwContent : public SwTypeNumber +{ + const SwContentType* m_pParent; + OUString m_sContentName; + double m_nYPosition; + // some subclasses appear to use this for a tools/gen.hxx-style + // geometric Y position, while e.g. SwOutlineContent wants to store + // the index in its subtree + bool m_bInvisible; +public: + SwContent(const SwContentType* pCnt, const OUString& rName, double nYPos); + + virtual bool IsProtect() const; + const SwContentType* GetParent() const {return m_pParent;} + const OUString& GetName() const {return m_sContentName;} + bool operator==(const SwContent& /*rCont*/) const + { + // they're never equal, otherwise they'd fall out of the array + return false; + } + bool operator<(const SwContent& rCont) const + { + // at first sort by position and then by name + if (m_nYPosition != rCont.m_nYPosition) + return m_nYPosition < rCont.m_nYPosition; + return vcl::NaturalSortCompare(m_sContentName, rCont.m_sContentName) < 0; + } + + bool IsInvisible() const {return m_bInvisible;} + void SetInvisible(){ m_bInvisible = true;} +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swdtflvr.hxx b/sw/source/uibase/inc/swdtflvr.hxx new file mode 100644 index 000000000..b165cd7b6 --- /dev/null +++ b/sw/source/uibase/inc/swdtflvr.hxx @@ -0,0 +1,249 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SWDTFLVR_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SWDTFLVR_HXX + +#include <sfx2/objsh.hxx> + +#include <vcl/transfer.hxx> +#include <vcl/graph.hxx> +#include <vcl/vclptr.hxx> +#include <sfx2/lnkbase.hxx> +#include <com/sun/star/embed/XEmbeddedObject.hpp> +#include <o3tl/deleter.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <svx/swframetypes.hxx> +#include <memory> + +#include <swdllapi.h> + +class Graphic; +class ImageMap; +class INetBookmark; +class INetImage; +class SfxAbstractPasteDialog; +class SwDoc; +class SwDocFac; +class SwPaM; +class SwTextBlocks; +class SwWrtShell; +class SvxClipboardFormatItem; +class SwFrameShell; +class SwView_Impl; +class SwPasteContext; +enum class SwPasteSdr; + +enum class TransferBufferType : sal_uInt16 +{ + NONE = 0x0000, + Document = 0x0001, + DocumentWord = 0x0002, + Graphic = 0x0004, + Table = 0x0008, + Ole = 0x0020, + InetField = 0x0040, + Drawing = 0x0081, // drawing is internal too! +}; +namespace o3tl { + template<> struct typed_flags<TransferBufferType> : is_typed_flags<TransferBufferType, 0x00ef> {}; +} +// paste table into a table +enum class PasteTableType +{ + PASTE_DEFAULT, // paste table by overwriting table cells + PASTE_ROW, // paste table as rows above + PASTE_COLUMN, // paste table as columns before + PASTE_TABLE // paste table as nested table +}; + +class SW_DLLPUBLIC SwTransferable final : public TransferableHelper +{ + friend class SwView_Impl; + SfxObjectShellLock m_aDocShellRef; + TransferableObjectDescriptor m_aObjDesc; + tools::SvRef<sfx2::SvBaseLink> m_xDdeLink; + + SwWrtShell *m_pWrtShell; + /* #96392# Added pCreatorView to distinguish SwFrameShell from + SwWrtShell. */ + const SwFrameShell *m_pCreatorView; + std::unique_ptr<SwDocFac, o3tl::default_delete<SwDocFac>> m_pClpDocFac; + std::unique_ptr<Graphic> m_pClpGraphic; + std::unique_ptr<Graphic> m_pClpBitmap; + Graphic *m_pOrigGraphic; + std::unique_ptr<INetBookmark> m_pBookmark; // URL and description! + std::unique_ptr<ImageMap> m_pImageMap; + std::unique_ptr<INetImage> m_pTargetURL; + + TransferBufferType m_eBufferType; + + bool m_bOldIdle :1; //D&D Idle flag from the viewsettings + bool m_bCleanUp :1; //D&D cleanup after Drop (not by internal Drop) + + // helper methods for the copy + css::uno::Reference < css::embed::XEmbeddedObject > FindOLEObj( sal_Int64& nAspect ) const; + const Graphic* FindOLEReplacementGraphic() const; + void DeleteSelection(); + + // helper methods for the paste + static SwTransferable* GetSwTransferable( const TransferableDataHelper& rData ); + static void SetSelInShell( SwWrtShell& , bool , const Point* ); + static bool CheckForURLOrLNKFile( const TransferableDataHelper& rData, + OUString& rFileName, OUString* pTitle = nullptr ); + static bool TestAllowedFormat( const TransferableDataHelper& rData, + SotClipboardFormatId nFormat, SotExchangeDest nDestination ); + + static bool PasteFileContent( const TransferableDataHelper&, + SwWrtShell& rSh, SotClipboardFormatId nFormat, bool bMsg, bool bIgnoreComments = false ); + static bool PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, + SotClipboardFormatId nFormat, SotExchangeActionFlags nActionFlags, bool bMsg ); + static bool PasteTargetURL( const TransferableDataHelper& rData, SwWrtShell& rSh, + SwPasteSdr nAction, const Point* pPt, bool bInsertGRF ); + + static bool PasteDDE( const TransferableDataHelper& rData, SwWrtShell& rWrtShell, + bool bReReadGrf, bool bMsg ); + + static bool PasteSdrFormat( const TransferableDataHelper& rData, + SwWrtShell& rSh, SwPasteSdr nAction, + const Point* pPt, SotExchangeActionFlags nActionFlags, bool bNeedToSelectBeforePaste); + + static bool PasteGrf( const TransferableDataHelper& rData, SwWrtShell& rSh, + SotClipboardFormatId nFormat, SwPasteSdr nAction, const Point* pPt, + SotExchangeActionFlags nActionFlags, sal_Int8 nDropAction, bool bNeedToSelectBeforePaste, RndStdIds nAnchorType = RndStdIds::FLY_AT_PARA ); + + static bool PasteImageMap( const TransferableDataHelper& rData, + SwWrtShell& rSh ); + + static bool PasteAsHyperlink( const TransferableDataHelper& rData, + SwWrtShell& rSh, SotClipboardFormatId nFormat ); + + static bool PasteFileName( TransferableDataHelper& rData, + SwWrtShell& rSh, SotClipboardFormatId nFormat, SwPasteSdr nAction, + const Point* pPt, SotExchangeActionFlags nActionFlags, bool * graphicInserted ); + + static bool PasteDBData( const TransferableDataHelper& rData, SwWrtShell& rSh, + SotClipboardFormatId nFormat, bool bLink, const Point* pDragPt, + bool bMsg ); + + static bool PasteFileList( const TransferableDataHelper& rData, + SwWrtShell& rSh, bool bLink, + const Point* pPt, bool bMsg ); + + bool PrivatePaste( SwWrtShell& rShell, SwPasteContext* pContext = nullptr, PasteTableType ePasteTable = PasteTableType::PASTE_DEFAULT ); + + void SetDataForDragAndDrop( const Point& rSttPos ); + + SwTransferable( const SwTransferable& ) = delete; + SwTransferable& operator=( const SwTransferable& ) = delete; + + virtual void AddSupportedFormats() override; + virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; + virtual bool WriteObject( tools::SvRef<SotTempStream>& rxOStm, + void* pUserObject, + sal_uInt32 nUserObjectId, + const css::datatransfer::DataFlavor& rFlavor ) override; + virtual void DragFinished( sal_Int8 nDropAction ) override; + virtual void ObjectReleased() override; + virtual sal_Bool SAL_CALL isComplex() override; + + using TransferableHelper::StartDrag; + +public: + SwTransferable( SwWrtShell& ); + virtual ~SwTransferable() override; + + static SotExchangeDest GetSotDestination( const SwWrtShell& rSh ); + + // set properties on the document, like PageMargin, VisArea. + // And set real Size + static void InitOle( SfxObjectShell* pDoc ); + + // copy - methods and helper methods for the copy + int Cut(); + int Copy( bool bIsCut = false ); + int PrepareForCopy( bool bIsCut = false ); + void PrepareForCopyTextRange(SwPaM & rPaM); + void CalculateAndCopy(); // special for Calculator + bool CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr ); + + // remove the DDE-Link format promise + void RemoveDDELinkFormat(vcl::Window& rWin); + + // paste - methods and helper methods for the paste + static bool IsPaste( const SwWrtShell&, const TransferableDataHelper& ); + static bool Paste( SwWrtShell&, TransferableDataHelper&, RndStdIds nAnchorType = RndStdIds::FLY_AT_PARA, + bool bIgnoreComments = false, PasteTableType ePasteTable = PasteTableType::PASTE_DEFAULT ); + static bool PasteData( TransferableDataHelper& rData, + SwWrtShell& rSh, sal_uInt8 nAction, SotExchangeActionFlags nActionFlags, + SotClipboardFormatId nFormat, + SotExchangeDest nDestination, bool bIsPasteFormat, + bool bIsDefault, + const Point* pDDPos = nullptr, sal_Int8 nDropAction = 0, + bool bPasteSelection = false, RndStdIds nAnchorType = RndStdIds::FLY_AT_PARA, + bool bIgnoreComments = false, + SwPasteContext* pContext = nullptr, + PasteTableType nPaste = PasteTableType::PASTE_DEFAULT ); + + static bool IsPasteSpecial( const SwWrtShell& rWrtShell, + const TransferableDataHelper& ); + static bool IsPasteOwnFormat( const TransferableDataHelper& ); + static bool PasteUnformatted( SwWrtShell& rSh, TransferableDataHelper& ); + /** + * @brief PrePasteSpecial Prepares the given dialog without actually running it + * @param rSh + * @param rFormatUsed + */ + static void PrePasteSpecial( const SwWrtShell& rSh, TransferableDataHelper&, const VclPtr<SfxAbstractPasteDialog>& pDlg ); + static bool PasteFormat( SwWrtShell& rSh, TransferableDataHelper& rData, + SotClipboardFormatId nFormat ); + + static void FillClipFormatItem( const SwWrtShell& rSh, + const TransferableDataHelper& rData, + SvxClipboardFormatItem & rToFill ); + + // Interfaces for Drag & Drop + void StartDrag( vcl::Window* pWin, const Point& rPos ); + + SwWrtShell* GetShell() { return m_pWrtShell; } + void SetCleanUp( bool bFlag ) { m_bCleanUp = bFlag; } + + // public only for testing + bool PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, bool bMove, + bool bIsXSelection ); + + // Interfaces for Selection + /* #96392# Added pCreator to distinguish SwFrameShell from SwWrtShell. */ + static void CreateSelection( SwWrtShell & rSh, + const SwFrameShell * pCreator = nullptr ); + static void ClearSelection( const SwWrtShell& rSh, + const SwFrameShell * pCreator = nullptr ); + + // the related SwView is being closed and the SwTransferable is invalid now + void Invalidate() {m_pWrtShell = nullptr;} + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); + + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override; + + static void SelectPasteFormat(TransferableDataHelper& rData, sal_uInt8& nAction, + SotClipboardFormatId& nFormat); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swmessdialog.hxx b/sw/source/uibase/inc/swmessdialog.hxx new file mode 100644 index 000000000..0c95e5e6a --- /dev/null +++ b/sw/source/uibase/inc/swmessdialog.hxx @@ -0,0 +1,27 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SWMESSDIALOG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SWMESSDIALOG_HXX + +#include <vcl/weld.hxx> + +class SwMessageAndEditDialog : public weld::MessageDialogController +{ +protected: + std::unique_ptr<weld::Entry> m_xEdit; + std::unique_ptr<weld::Button> m_xOKPB; +public: + SwMessageAndEditDialog(weld::Window* pParent, const OString& rID, + const OUString& rUIXMLDescription); +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWMESSDIALOG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx b/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx new file mode 100644 index 000000000..00d4e1e02 --- /dev/null +++ b/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <sfx2/basedlgs.hxx> + +class SwRedlineAcceptDlg; + +class SwModalRedlineAcceptDlg final : public SfxDialogController +{ + std::unique_ptr<weld::Container> m_xContentArea; + std::unique_ptr<SwRedlineAcceptDlg> m_xImplDlg; + +public: + SwModalRedlineAcceptDlg(weld::Window *pParent); + virtual ~SwModalRedlineAcceptDlg() override; + + void AcceptAll( bool bAccept ); + virtual void Activate() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swrenamexnameddlg.hxx b/sw/source/uibase/inc/swrenamexnameddlg.hxx new file mode 100644 index 000000000..bb8333d3f --- /dev/null +++ b/sw/source/uibase/inc/swrenamexnameddlg.hxx @@ -0,0 +1,61 @@ +/* -*- 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 + +#include <vcl/textfilter.hxx> +#include <vcl/weld.hxx> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XNamed.hpp> + +class SwRenameXNamedDlg final : public weld::GenericDialogController +{ + css::uno::Reference< css::container::XNamed > & xNamed; + css::uno::Reference< css::container::XNameAccess > & xNameAccess; + css::uno::Reference< css::container::XNameAccess > xSecondAccess; + css::uno::Reference< css::container::XNameAccess > xThirdAccess; + + TextFilter m_aTextFilter; + + std::unique_ptr<weld::Entry> m_xNewNameED; + std::unique_ptr<weld::Button> m_xOk; + + DECL_LINK(TextFilterHdl, OUString&, bool); + DECL_LINK(OkHdl, weld::Button&, void); + DECL_LINK(ModifyHdl, weld::Entry&, void); + +public: + SwRenameXNamedDlg(weld::Widget* pParent, + css::uno::Reference< css::container::XNamed > & xNamed, + css::uno::Reference< css::container::XNameAccess > & xNameAccess ); + + void SetForbiddenChars(const OUString& rSet) + { + m_aTextFilter.SetForbiddenChars(rSet); + } + + void SetAlternativeAccess( + css::uno::Reference< css::container::XNameAccess > const & xSecond, + css::uno::Reference< css::container::XNameAccess > const & xThird ) + { + xSecondAccess = xSecond; + xThirdAccess = xThird; + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swruler.hxx b/sw/source/uibase/inc/swruler.hxx new file mode 100644 index 000000000..6c903f9ca --- /dev/null +++ b/sw/source/uibase/inc/swruler.hxx @@ -0,0 +1,119 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SWRULER_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SWRULER_HXX + +#include <svx/ruler.hxx> +#include <vcl/timer.hxx> +#include <vcl/virdev.hxx> + +class SwViewShell; +class View; +namespace vcl { class Window; } +class SwEditWin; +namespace tools { class JsonWriter; } + +/** + * An horizontal ruler with a control for comment panel visibility for Writer. + * + * The comment control only appears when the document has comments already. + */ +class SwCommentRuler final : public SvxRuler +{ +public: + SwCommentRuler ( + SwViewShell* pViewSh, + vcl::Window* pParent, + SwEditWin* pWin, + SvxRulerSupportFlags nRulerFlags, + SfxBindings& rBindings, + WinBits nWinStyle); + virtual ~SwCommentRuler () override; + virtual void dispose() override; + + /** + * Paint the ruler. + * \param rRect ignored + */ + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + void CreateJsonNotification(tools::JsonWriter& rJsonWriter); + +private: + SwViewShell * mpViewShell; //< Shell to check if there is any comments on doc and their visibility + VclPtr<SwEditWin> mpSwWin; //< Used to get SwView to change the SideBar visibility + bool mbIsHighlighted; //< If comment control is highlighted (mouse is over it) + Timer maFadeTimer; //< Timer for high/'low'light fading + int mnFadeRate; //< From 0 to 100. 0 means not highlighted. + ScopedVclPtr<VirtualDevice> maVirDev; //< VirtualDevice of this window. Just for convenience. + + void NotifyKit(); + /** + * Callback function to handle a mouse button down event. + * + * When on comment control, it toggles the comment panel visibility. + */ + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + /** + * Callback function to handle a mouse move event. + * + * When on comment control, it let the control responsive by highlighting. + */ + virtual void MouseMove(const MouseEvent& rMEvt) override; + /** + * Callback function to handle a context menu call (mouse right button click). + * + * When on comment control, it does not do anything. + */ + virtual void Command( const CommandEvent& rCEvt ) override; + /** + * Update the view. + * + * Update the ruler appearance according to the document view and + * current cursor position. + */ + virtual void Update() override; + + /** + * Get the rectangle area that should be used to draw the comment control. + * + * It is horizontally aligned to the SideBar panel. + * \return The area where the comment control is. + */ + tools::Rectangle GetCommentControlRegion(); + + /** + * Paint the comment control on VirtualDevice. + */ + void DrawCommentControl(vcl::RenderContext& rRenderContext); + + /** + * Update the tooltip text. + */ + void UpdateCommentHelpText(); + + /** + * Get the proper color between two options, according to current status. + * + * The return color can be one of the given colors, or a merged one. + * It depends on highlight fading status. + * + * \param rHighColor color used to highlight status + * \param rLowColor color used to normal status + * \return The proper color to used in moment + */ + Color GetFadedColor(const Color &rHighColor, const Color &rLowColor); + + /// Fade timer callback. + DECL_LINK(FadeHandler, Timer *, void); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swtablerep.hxx b/sw/source/uibase/inc/swtablerep.hxx new file mode 100644 index 000000000..7b04e3dcf --- /dev/null +++ b/sw/source/uibase/inc/swtablerep.hxx @@ -0,0 +1,94 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SWTABLEREP_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SWTABLEREP_HXX + +#include <swdllapi.h> +#include <swtypes.hxx> + +class SwTabCols; + +struct TColumn +{ + SwTwips nWidth; + bool bVisible; +}; + +class SW_DLLPUBLIC SwTableRep +{ + std::vector<TColumn> m_aTColumns; + + SwTwips m_nTableWidth; + SwTwips m_nSpace; + SwTwips m_nLeftSpace; + SwTwips m_nRightSpace; + sal_uInt16 m_nAlign; + sal_uInt16 m_nColCount; + sal_uInt16 m_nAllCols; + sal_uInt16 m_nWidthPercent; + bool m_bLineSelected : 1; + bool m_bWidthChanged : 1; + bool m_bColsChanged : 1; + +public: + SwTableRep( const SwTabCols& rTabCol ); + ~SwTableRep(); + + SwTableRep( const SwTableRep& rCopy ) = default; + SwTableRep( SwTableRep&& rCopy ) = default; + SwTableRep& operator=(const SwTableRep& rCopy) = default; + SwTableRep& operator=(SwTableRep&& rCopy) = default; + + bool FillTabCols( SwTabCols& rTabCol ) const; + + SwTwips GetLeftSpace() const {return m_nLeftSpace;} + void SetLeftSpace(SwTwips nSet) {m_nLeftSpace = nSet;} + + SwTwips GetRightSpace() const {return m_nRightSpace;} + void SetRightSpace(SwTwips nSet) {m_nRightSpace = nSet;} + + SwTwips GetWidth() const {return m_nTableWidth;} + void SetWidth(SwTwips nSet) {m_nTableWidth = nSet;} + + sal_uInt16 GetWidthPercent() const {return m_nWidthPercent;} + void SetWidthPercent(sal_uInt16 nSet) {m_nWidthPercent = nSet;} + + sal_uInt16 GetAlign() const {return m_nAlign;} + void SetAlign(sal_uInt16 nSet) {m_nAlign = nSet;} + + sal_uInt16 GetColCount() const {return m_nColCount;} + sal_uInt16 GetAllColCount() const {return m_nAllCols;} + + bool HasColsChanged() const {return m_bColsChanged;} + void SetColsChanged() {m_bColsChanged = true;} + + bool HasWidthChanged() const {return m_bWidthChanged;} + void SetWidthChanged() {m_bWidthChanged = true;} + + bool IsLineSelected() const {return m_bLineSelected;} + void SetLineSelected(bool bSet) {m_bLineSelected = bSet;} + + SwTwips GetSpace() const { return m_nSpace;} + void SetSpace(SwTwips nSet) {m_nSpace = nSet;} + + TColumn* GetColumns() {return m_aTColumns.data();} +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swuiccoll.hxx b/sw/source/uibase/inc/swuiccoll.hxx new file mode 100644 index 000000000..8d13ba6ba --- /dev/null +++ b/sw/source/uibase/inc/swuiccoll.hxx @@ -0,0 +1,68 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SWUICCOLL_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SWUICCOLL_HXX + +#include <sfx2/tabdlg.hxx> + +#include <ccoll.hxx> + +class SwWrtShell; +class SwFormat; + +class SwCondCollPage final : public SfxTabPage +{ + std::vector<OUString> m_aStrArr; + + const CommandStruct*m_pCmds; + SwFormat* m_pFormat; + + std::unique_ptr<weld::TreeView> m_xTbLinks; + std::unique_ptr<weld::TreeView> m_xStyleLB; + std::unique_ptr<weld::ComboBox> m_xFilterLB; + std::unique_ptr<weld::Button> m_xRemovePB; + std::unique_ptr<weld::Button> m_xAssignPB; + + virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; + + DECL_LINK(AssignRemoveTreeListBoxHdl, weld::TreeView&, bool); + DECL_LINK(AssignRemoveClickHdl, weld::Button&, void); + DECL_LINK(SelectTreeListBoxHdl, weld::TreeView&, void); + DECL_LINK(SelectListBoxHdl, weld::ComboBox&, void); + void AssignRemove(const weld::Widget*); + void SelectHdl(const weld::Widget*); + + static const WhichRangesContainer m_aPageRg; + +public: + SwCondCollPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet); + virtual ~SwCondCollPage() override; + + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet); + static WhichRangesContainer GetRanges() { return m_aPageRg; } + + virtual bool FillItemSet( SfxItemSet *rSet) override; + virtual void Reset (const SfxItemSet *rSet) override; + + void SetCollection( SwFormat* pFormat ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swuicnttab.hxx b/sw/source/uibase/inc/swuicnttab.hxx new file mode 100644 index 000000000..359e58dc6 --- /dev/null +++ b/sw/source/uibase/inc/swuicnttab.hxx @@ -0,0 +1,447 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SWUICNTTAB_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SWUICNTTAB_HXX + +#include <sfx2/tabdlg.hxx> +#include <svx/langbox.hxx> +#include <vcl/idle.hxx> +#include <vcl/weld.hxx> +#include <vcl/customweld.hxx> + +#include <tox.hxx> +#include "toxmgr.hxx" +#include "cnttab.hxx" +#include <vector> + +class IndexEntryResource; +class IndexEntrySupplierWrapper; +class SwTOXWidget; +class SwTOXEdit; +class SwTOXButton; +class SwTOXEntryTabPage; +class SwOneExampleFrame; +class SwWrtShell; + +namespace com::sun::star{ + namespace text{ + class XTextSection; + class XDocumentIndex; + } +} + +struct SwIndexSections_Impl +{ + css::uno::Reference< css::text::XTextSection > xContainerSection; + css::uno::Reference< css::text::XDocumentIndex > xDocumentIndex; +}; + +class SwMultiTOXTabDialog final : public SfxTabDialogController +{ + std::unique_ptr<SwTOXMgr> m_pMgr; + SwWrtShell& m_rWrtShell; + + struct TypeData + { + std::unique_ptr<SwForm> m_pForm; + std::unique_ptr<SwTOXDescription> m_pDescription; + std::unique_ptr<SwIndexSections_Impl> m_pxIndexSections; + }; + std::vector<TypeData> m_vTypeData; + + SwTOXBase* m_pParamTOXBase; + + CurTOXType m_eCurrentTOXType; + + OUString m_sUserDefinedIndex; + sal_uInt16 m_nInitialTOXType; + + bool m_bEditTOX; + bool m_bExampleCreated; + bool m_bGlobalFlag; + + std::unique_ptr<SwOneExampleFrame> m_xExampleFrame; + std::unique_ptr<weld::CheckButton> m_xShowExampleCB; + std::unique_ptr<weld::CustomWeld> m_xExampleFrameWin; + + virtual short Ok() override; + std::unique_ptr<SwTOXDescription> CreateTOXDescFromTOXBase(const SwTOXBase*pCurTOX); + void ShowPreview(); + + DECL_LINK(CreateExample_Hdl, SwOneExampleFrame&, void); + DECL_LINK(ShowPreviewHdl, weld::Toggleable&, void); + +public: + SwMultiTOXTabDialog(weld::Widget* pParent, const SfxItemSet& rSet, + SwWrtShell &rShell, + SwTOXBase* pCurTOX, sal_uInt16 nToxType, + bool bGlobal); + virtual ~SwMultiTOXTabDialog() override; + + virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; + + SwForm* GetForm(CurTOXType eType); + + const CurTOXType& GetCurrentTOXType() const { return m_eCurrentTOXType;} + void SetCurrentTOXType(const CurTOXType& eSet) + { + m_eCurrentTOXType = eSet; + } + + bool IsTOXEditMode() const { return m_bEditTOX;} + + SwWrtShell& GetWrtShell() {return m_rWrtShell;} + + SwTOXDescription& GetTOXDescription(CurTOXType eTOXTypes); + void CreateOrUpdateExample( + TOXTypes nTOXIndex, sal_uInt16 nPage = 0, sal_uInt16 nCurLevel = USHRT_MAX); + + static bool IsNoNum(SwWrtShell& rSh, const OUString& rName); +}; + +class SwTOXSelectTabPage final : public SfxTabPage +{ + std::unique_ptr<IndexEntryResource> pIndexRes; + + OUString aStyleArr[MAXLEVEL]; + OUString sAutoMarkURL; + OUString sAutoMarkType; + OUString sAddStyleUser; + OUString sAddStyleContent; + + std::unique_ptr<const IndexEntrySupplierWrapper> pIndexEntryWrapper; + + bool m_bWaitingInitialSettings; + + std::unique_ptr<weld::Entry> m_xTitleED; + std::unique_ptr<weld::Label> m_xTypeFT; + std::unique_ptr<weld::ComboBox> m_xTypeLB; + std::unique_ptr<weld::CheckButton> m_xReadOnlyCB; + + std::unique_ptr<weld::Widget> m_xAreaFrame; + std::unique_ptr<weld::ComboBox> m_xAreaLB; + std::unique_ptr<weld::Widget> m_xLevelFT; //content, user + std::unique_ptr<weld::SpinButton> m_xLevelNF; //content, user + + //content + std::unique_ptr<weld::Widget> m_xCreateFrame; // content, user, illustration + std::unique_ptr<weld::CheckButton> m_xFromHeadingsCB; + std::unique_ptr<weld::CheckButton> m_xStylesCB; + std::unique_ptr<weld::CheckButton> m_xAddStylesCB; + std::unique_ptr<weld::Button> m_xAddStylesPB; + //user + std::unique_ptr<weld::CheckButton> m_xFromTablesCB; + std::unique_ptr<weld::CheckButton> m_xFromFramesCB; + std::unique_ptr<weld::CheckButton> m_xFromGraphicsCB; + std::unique_ptr<weld::CheckButton> m_xFromOLECB; + std::unique_ptr<weld::CheckButton> m_xLevelFromChapterCB; + + //illustration + table + std::unique_ptr<weld::RadioButton> m_xFromCaptionsRB; + std::unique_ptr<weld::RadioButton> m_xFromObjectNamesRB; + + //illustration and tables + std::unique_ptr<weld::Label> m_xCaptionSequenceFT; + std::unique_ptr<weld::ComboBox> m_xCaptionSequenceLB; + std::unique_ptr<weld::Label> m_xDisplayTypeFT; + std::unique_ptr<weld::ComboBox> m_xDisplayTypeLB; + + //all but illustration and table + std::unique_ptr<weld::CheckButton> m_xTOXMarksCB; + + //index only + std::unique_ptr<weld::Widget> m_xIdxOptionsFrame; + std::unique_ptr<weld::CheckButton> m_xCollectSameCB; + std::unique_ptr<weld::CheckButton> m_xUseFFCB; + std::unique_ptr<weld::CheckButton> m_xUseDashCB; + std::unique_ptr<weld::CheckButton> m_xCaseSensitiveCB; + std::unique_ptr<weld::CheckButton> m_xInitialCapsCB; + std::unique_ptr<weld::CheckButton> m_xKeyAsEntryCB; + std::unique_ptr<weld::CheckButton> m_xFromFileCB; + std::unique_ptr<weld::MenuButton> m_xAutoMarkPB; + + // object only + std::unique_ptr<weld::TreeView> m_xFromObjCLB; + std::unique_ptr<weld::Widget> m_xFromObjFrame; + + std::unique_ptr<weld::CheckButton> m_xSequenceCB; + std::unique_ptr<weld::ComboBox> m_xBracketLB; + std::unique_ptr<weld::Widget> m_xAuthorityFrame; + + //all + std::unique_ptr<weld::Widget> m_xSortFrame; + std::unique_ptr<SvxLanguageBox> m_xLanguageLB; + std::unique_ptr<weld::ComboBox> m_xSortAlgorithmLB; + + DECL_LINK(TOXTypeHdl, weld::ComboBox&, void ); + DECL_LINK(AddStylesHdl, weld::Button&, void ); + DECL_LINK(MenuEnableHdl, weld::Toggleable&, void); + DECL_LINK(MenuExecuteHdl, const OString&, void); + DECL_LINK(LanguageListBoxHdl, weld::ComboBox&, void); + void LanguageHdl(const weld::ComboBox*); + DECL_LINK(CheckBoxHdl, weld::Toggleable&, void ); + DECL_LINK(RadioButtonHdl, weld::Toggleable&, void); + DECL_LINK(ModifyEntryHdl, weld::Entry&, void); + DECL_LINK(ModifySpinHdl, weld::SpinButton&, void); + DECL_LINK(ModifyListBoxHdl, weld::ComboBox&, void); + + void ModifyHdl(); + void ApplyTOXDescription(); + void FillTOXDescription(); + +public: + SwTOXSelectTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet); + virtual ~SwTOXSelectTabPage() override; + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet* ) override; + + virtual void ActivatePage( const SfxItemSet& ) override; + virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; + + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet* rAttrSet); + + void SelectType(TOXTypes eSet); //preset TOXType, GlobalDoc + void SetWrtShell(SwWrtShell const & rSh); +}; + +class SwTokenWindow +{ + SwForm* m_pForm; + sal_uInt16 m_nLevel; + bool m_bValid; + OUString m_aButtonTexts[TOKEN_END]; // Text of the buttons + OUString m_aButtonHelpTexts[TOKEN_END]; // QuickHelpText of the buttons + OUString m_sCharStyle; + Link<SwFormToken&,void> m_aButtonSelectedHdl; + SwTOXWidget* m_pActiveCtrl; + Link<LinkParamNone*,void> m_aModifyHdl; + OUString m_sAccessibleName; + OUString m_sAdditionalAccnameString1; + OUString m_sAdditionalAccnameString2; + OUString m_sAdditionalAccnameString3; + + Idle m_aAdjustPositionsIdle; + + SwTOXEntryTabPage* m_pParent; + std::unique_ptr<weld::Container> m_xParentWidget; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Container> m_xContainer; + std::unique_ptr<weld::Button> m_xLeftScrollWin; + std::unique_ptr<weld::Container> m_xCtrlParentWin; + std::unique_ptr<weld::ScrolledWindow> m_xScrollWin; + std::unique_ptr<weld::Button> m_xRightScrollWin; + std::vector<std::unique_ptr<SwTOXWidget>> m_aControlList; + + DECL_LINK(EditResize, SwTOXEdit&, void); + DECL_LINK(NextItemHdl, SwTOXEdit&, void); + DECL_LINK(TbxFocusHdl, SwTOXWidget&, void); + DECL_LINK(NextItemBtnHdl, SwTOXButton&, void); + DECL_LINK(TbxFocusBtnHdl, SwTOXWidget&, void); + DECL_LINK(ScrollBtnHdl, weld::Button&, void); + DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void); + DECL_LINK(AdjustPositionsHdl, const Size&, void); + + void SetActiveControl(SwTOXWidget* pSet); + + SwTOXWidget* InsertItem(const OUString& rText, const SwFormToken& aToken); + void AdjustPositions(); + void AdjustScrolling(); + void MoveControls(tools::Long nOffset); + +public: + SwTokenWindow(std::unique_ptr<weld::Container> xParent); + weld::Container* get_child_container() { return m_xCtrlParentWin.get(); } + ~SwTokenWindow(); + + void SetTabPage(SwTOXEntryTabPage *pParent) { m_pParent = pParent; } + + void SetForm(SwForm& rForm, sal_uInt16 nLevel); + sal_uInt16 GetLastLevel()const {return m_nLevel;}; + + bool IsValid() const {return m_bValid;} + + void SetInvalid() {m_bValid = false;} + + OUString GetPattern() const; + + void SetButtonSelectedHdl(const Link<SwFormToken&,void>& rLink) + { m_aButtonSelectedHdl = rLink;} + + void SetModifyHdl(const Link<LinkParamNone*,void>& rLink){m_aModifyHdl = rLink;} + + SwTOXWidget* GetActiveControl() { return m_pActiveCtrl; } + + void InsertAtSelection(const SwFormToken& aToken); + void RemoveControl(const SwTOXButton* pDel, bool bInternalCall = false); + + bool Contains(FormTokenType) const; + + //helper for pattern buttons and edits + OUString CreateQuickHelp(const SwFormToken& rToken); + + void SetFocus2theAllBtn(); +private: + sal_uInt32 GetControlIndex(FormTokenType eType) const; +}; + +class SwTOXEntryTabPage final : public SfxTabPage +{ + OUString sDelimStr; + OUString sLevelStr; + OUString sAuthTypeStr; + + OUString sNoCharStyle; + SwForm* m_pCurrentForm; + + CurTOXType aLastTOXType; + bool bInLevelHdl; + + std::unique_ptr<weld::Label> m_xTypeFT; + std::unique_ptr<weld::Label> m_xLevelFT; + std::unique_ptr<weld::TreeView> m_xLevelLB; + std::unique_ptr<weld::Button> m_xAllLevelsPB; + std::unique_ptr<weld::Button> m_xEntryNoPB; + std::unique_ptr<weld::Button> m_xEntryPB; + std::unique_ptr<weld::Button> m_xTabPB; + std::unique_ptr<weld::Button> m_xChapterInfoPB; + std::unique_ptr<weld::Button> m_xPageNoPB; + std::unique_ptr<weld::Button> m_xHyperLinkPB; + std::unique_ptr<weld::Widget> m_xFieldBox; + std::unique_ptr<weld::ComboBox> m_xAuthFieldsLB; + std::unique_ptr<weld::Button> m_xAuthInsertPB; + std::unique_ptr<weld::Button> m_xAuthRemovePB; + std::unique_ptr<weld::ComboBox> m_xCharStyleLB; // character style of the current token + std::unique_ptr<weld::Button> m_xEditStylePB; + std::unique_ptr<weld::Label> m_xChapterEntryFT; + std::unique_ptr<weld::ComboBox> m_xChapterEntryLB; // type of chapter info + std::unique_ptr<weld::Label> m_xNumberFormatFT; + std::unique_ptr<weld::ComboBox> m_xNumberFormatLB; //!< format for numbering (E#) + std::unique_ptr<weld::Label> m_xEntryOutlineLevelFT; //!< Fixed text, for i53420 + std::unique_ptr<weld::SpinButton> m_xEntryOutlineLevelNF; //!< level to evaluate outline level to, for i53420 + std::unique_ptr<weld::Label> m_xFillCharFT; + std::unique_ptr<weld::ComboBox> m_xFillCharCB; // fill char for tab stop + std::unique_ptr<weld::Label> m_xTabPosFT; + std::unique_ptr<weld::MetricSpinButton> m_xTabPosMF; // tab stop position + std::unique_ptr<weld::CheckButton> m_xAutoRightCB; + std::unique_ptr<weld::Widget> m_xFormatFrame; + std::unique_ptr<weld::Label> m_xMainEntryStyleFT; + std::unique_ptr<weld::ComboBox> m_xMainEntryStyleLB; // character style of main entries in indexes + std::unique_ptr<weld::CheckButton> m_xAlphaDelimCB; + std::unique_ptr<weld::CheckButton> m_xCommaSeparatedCB; + std::unique_ptr<weld::CheckButton> m_xRelToStyleCB; // position relative to the right margin of the para style + std::unique_ptr<weld::Widget> m_xSortingFrame; + std::unique_ptr<weld::RadioButton> m_xSortDocPosRB; + std::unique_ptr<weld::RadioButton> m_xSortContentRB; + std::unique_ptr<weld::Widget> m_xSortKeyFrame; + std::unique_ptr<weld::ComboBox> m_xFirstKeyLB; + std::unique_ptr<weld::ToggleButton> m_xFirstSortUpRB; + std::unique_ptr<weld::ToggleButton> m_xFirstSortDownRB; + std::unique_ptr<weld::ComboBox> m_xSecondKeyLB; + std::unique_ptr<weld::ToggleButton> m_xSecondSortUpRB; + std::unique_ptr<weld::ToggleButton> m_xSecondSortDownRB; + std::unique_ptr<weld::ComboBox> m_xThirdKeyLB; + std::unique_ptr<weld::ToggleButton> m_xThirdSortUpRB; + std::unique_ptr<weld::ToggleButton> m_xThirdSortDownRB; + std::unique_ptr<SwTokenWindow> m_xTokenWIN; + + DECL_LINK(StyleSelectHdl, weld::ComboBox&, void); + DECL_LINK(EditStyleHdl, weld::Button&, void); + DECL_LINK(InsertTokenHdl, weld::Button&, void); + DECL_LINK(LevelHdl, weld::TreeView&, void); + DECL_LINK(AutoRightHdl, weld::Toggleable&, void); + DECL_LINK(TokenSelectedHdl, SwFormToken&, void); + DECL_LINK(TabPosHdl, weld::MetricSpinButton&, void); + DECL_LINK(FillCharHdl, weld::ComboBox&, void); + DECL_LINK(RemoveInsertAuthHdl, weld::Button&, void); + DECL_LINK(SortKeyHdl, weld::Toggleable&, void); + DECL_LINK(ChapterInfoHdl, weld::ComboBox&, void); + DECL_LINK(ChapterInfoOutlineHdl, weld::SpinButton&, void); + DECL_LINK(NumberFormatHdl, weld::ComboBox&, void); + DECL_LINK(ToggleHdl, weld::Toggleable&, void); + + DECL_LINK(AllLevelsHdl, weld::Button&, void); + + void WriteBackLevel(); + void UpdateDescriptor(); + DECL_LINK(ModifyHdl, LinkParamNone*, void); + void OnModify(bool bAllLevels); + DECL_LINK(ModifyClickHdl, weld::Toggleable&, void); + + void ShowHideControls(int eType); + +public: + SwTOXEntryTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet); + virtual ~SwTOXEntryTabPage() override; + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet* ) override; + virtual void ActivatePage( const SfxItemSet& ) override; + virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; + + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet* rAttrSet); + void SetWrtShell(SwWrtShell& rSh); + + void PreTokenButtonRemoved(const SwFormToken& rToken); + void SetFocus2theAllBtn(); +}; + +class SwTOXStylesTabPage final : public SfxTabPage +{ + std::unique_ptr<SwForm> m_pCurrentForm; + + std::unique_ptr<weld::TreeView> m_xLevelLB; + std::unique_ptr<weld::Button> m_xAssignBT; + std::unique_ptr<weld::TreeView> m_xParaLayLB; + std::unique_ptr<weld::Button> m_xStdBT; + std::unique_ptr<weld::Button> m_xEditStyleBT; + + DECL_LINK(EditStyleHdl, weld::Button&, void); + DECL_LINK(StdHdl, weld::Button&, void); + DECL_LINK(EnableSelectHdl, weld::TreeView&, void); + DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); + DECL_LINK(AssignHdl, weld::Button&, void); + void Modify(); + + SwForm& GetForm() + { + SwMultiTOXTabDialog* pDlg = static_cast<SwMultiTOXTabDialog*>(GetDialogController()); + return *pDlg->GetForm(pDlg->GetCurrentTOXType()); + } + +public: + SwTOXStylesTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet); + virtual ~SwTOXStylesTabPage() override; + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet* ) override; + + virtual void ActivatePage( const SfxItemSet& ) override; + virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; + + static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet* rAttrSet); + +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWUICNTTAB_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swuiidxmrk.hxx b/sw/source/uibase/inc/swuiidxmrk.hxx new file mode 100644 index 000000000..1c4a38e0f --- /dev/null +++ b/sw/source/uibase/inc/swuiidxmrk.hxx @@ -0,0 +1,235 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SWUIIDXMRK_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SWUIIDXMRK_HXX + +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp> +#include <sfx2/basedlgs.hxx> +#include <sfx2/childwin.hxx> +#include <vcl/weld.hxx> +#include <toxe.hxx> +#include <memory> + +class SwWrtShell; +class SwTOXMgr; +class SwTOXMark; + +// insert mark for index entry +class SwIndexMarkFloatDlg; +class SwIndexMarkModalDlg; + +class SwIndexMarkPane +{ + std::shared_ptr<weld::Dialog> m_xDialog; + + friend class SwIndexMarkFloatDlg; + friend class SwIndexMarkModalDlg; + + OUString m_aOrgStr; + bool m_bDel; + bool const m_bNewMark; + bool m_bSelected; + + bool m_bPhoneticED0_ChangedByUser; + bool m_bPhoneticED1_ChangedByUser; + bool m_bPhoneticED2_ChangedByUser; + LanguageType m_nLangForPhoneticReading; //Language of current text used for phonetic reading proposal + bool m_bIsPhoneticReadingEnabled; //this value states whether phonetic reading is enabled in principle dependent of global cjk settings and language of current entry + css::uno::Reference< css::i18n::XExtendedIndexEntrySupplier > + m_xExtendedIndexEntrySupplier; + + std::unique_ptr<SwTOXMgr> + m_pTOXMgr; + SwWrtShell* m_pSh; + + std::unique_ptr<weld::Label> m_xTypeFT; + std::unique_ptr<weld::ComboBox> m_xTypeDCB; + std::unique_ptr<weld::Button> m_xNewBT; + std::unique_ptr<weld::Entry> m_xEntryED; + std::unique_ptr<weld::Button> m_xSyncED; + std::unique_ptr<weld::Label> m_xPhoneticFT0; + std::unique_ptr<weld::Entry> m_xPhoneticED0; + std::unique_ptr<weld::Label> m_xKey1FT; + std::unique_ptr<weld::ComboBox> m_xKey1DCB; + std::unique_ptr<weld::Label> m_xPhoneticFT1; + std::unique_ptr<weld::Entry> m_xPhoneticED1; + std::unique_ptr<weld::Label> m_xKey2FT; + std::unique_ptr<weld::ComboBox> m_xKey2DCB; + std::unique_ptr<weld::Label> m_xPhoneticFT2; + std::unique_ptr<weld::Entry> m_xPhoneticED2; + std::unique_ptr<weld::Label> m_xLevelFT; + std::unique_ptr<weld::SpinButton> m_xLevelNF; + std::unique_ptr<weld::CheckButton> m_xMainEntryCB; + std::unique_ptr<weld::CheckButton> m_xApplyToAllCB; + std::unique_ptr<weld::CheckButton> m_xSearchCaseSensitiveCB; + std::unique_ptr<weld::CheckButton> m_xSearchCaseWordOnlyCB; + std::unique_ptr<weld::Button> m_xOKBT; + std::unique_ptr<weld::Button> m_xCloseBT; + std::unique_ptr<weld::Button> m_xDelBT; + std::unique_ptr<weld::Button> m_xPrevSameBT; + std::unique_ptr<weld::Button> m_xNextSameBT; + std::unique_ptr<weld::Button> m_xPrevBT; + std::unique_ptr<weld::Button> m_xNextBT; + + void Apply(); + void InitControls(); + void InsertMark(); + void UpdateMark(); + + DECL_LINK(InsertHdl, weld::Button&, void); + DECL_LINK(CloseHdl, weld::Button&, void); + DECL_LINK(SyncSelectionHdl, weld::Button&, void); + DECL_LINK(DelHdl, weld::Button&, void); + DECL_LINK( NextHdl, weld::Button&, void ); + DECL_LINK( NextSameHdl, weld::Button&, void ); + DECL_LINK( PrevHdl, weld::Button&, void ); + DECL_LINK( PrevSameHdl, weld::Button&, void ); + DECL_LINK( ModifyListBoxHdl, weld::ComboBox&, void ); + DECL_LINK( ModifyEditHdl, weld::Entry&, void ); + void ModifyHdl(const weld::Widget& rWidget); + DECL_LINK( KeyDCBModifyHdl, weld::ComboBox&, void ); + DECL_LINK( NewUserIdxHdl, weld::Button&, void ); + DECL_LINK( SearchTypeHdl, weld::Toggleable&, void ); + DECL_LINK( PhoneticEDModifyHdl, weld::Entry&, void ); + + //this method updates the values from 'nLangForPhoneticReading' and 'bIsPhoneticReadingEnabled' + //it needs to be called ones if this dialog is opened to create a new entry (in InitControls), + //or otherwise it has to be called for each changed TOXMark (in UpdateDialog) + void UpdateLanguageDependenciesForPhoneticReading(); + OUString GetDefaultPhoneticReading( const OUString& rText ); + + void UpdateKeyBoxes(); + + void UpdateDialog(); + void InsertUpdate(); + + void Activate(); + +public: + + SwIndexMarkPane(const std::shared_ptr<weld::Dialog>& rDialog, weld::Builder& rBuilder, + bool bNewDlg, SwWrtShell* pWrtShell); + + ~SwIndexMarkPane(); + + void ReInitDlg(SwWrtShell& rWrtShell, SwTOXMark const * pCurTOXMark = nullptr); + bool IsTOXType(const OUString& rName) { return m_xTypeDCB->find_text(rName) != -1; } +}; + +class SwIndexMarkFloatDlg final : public SfxModelessDialogController +{ + SwIndexMarkPane m_aContent; + + virtual void Activate() override; +public: + SwIndexMarkFloatDlg(SfxBindings* pBindings, + SfxChildWindow* pChild, + weld::Window *pParent, + SfxChildWinInfo const * pInfo, + bool bNew); + void ReInitDlg(SwWrtShell& rWrtShell); +}; + +class SwIndexMarkModalDlg final : public SfxDialogController +{ + SwIndexMarkPane m_aContent; +public: + SwIndexMarkModalDlg(weld::Window *pParent, SwWrtShell& rSh, SwTOXMark const * pCurTOXMark); + virtual ~SwIndexMarkModalDlg() override; + virtual short int run() override; +}; + +class SwAuthMarkModalDlg; + +class SwAuthorMarkPane +{ + weld::DialogController& m_rDialog; + + static bool bIsFromComponent; + + friend class SwAuthMarkModalDlg; + friend class SwAuthMarkFloatDlg; + + bool bNewEntry; + bool bBibAccessInitialized; + + SwWrtShell* pSh; + + OUString m_sColumnTitles[AUTH_FIELD_END]; + OUString m_sFields[AUTH_FIELD_END]; + + OUString m_sCreatedEntry[AUTH_FIELD_END]; + + css::uno::Reference< css::container::XNameAccess > xBibAccess; + + std::unique_ptr<weld::RadioButton> m_xFromComponentRB; + std::unique_ptr<weld::RadioButton> m_xFromDocContentRB; + std::unique_ptr<weld::Label> m_xAuthorFI; + std::unique_ptr<weld::Label> m_xTitleFI; + std::unique_ptr<weld::Entry> m_xEntryED; + std::unique_ptr<weld::ComboBox> m_xEntryLB; + std::unique_ptr<weld::Button> m_xActionBT; + std::unique_ptr<weld::Button> m_xCloseBT; + std::unique_ptr<weld::Button> m_xCreateEntryPB; + std::unique_ptr<weld::Button> m_xEditEntryPB; + + DECL_LINK(InsertHdl, weld::Button&, void); + DECL_LINK(CloseHdl, weld::Button&, void); + DECL_LINK(CreateEntryHdl, weld::Button&, void); + DECL_LINK(CompEntryHdl, weld::ComboBox&, void); + DECL_LINK(ChangeSourceHdl, weld::Toggleable&, void); + DECL_LINK(IsEditAllowedHdl, weld::Entry&, bool); + DECL_LINK(IsEntryAllowedHdl, weld::Entry&, bool); + DECL_LINK(EditModifyHdl, weld::Entry&, void); + + void InitControls(); + void Activate(); + +public: + SwAuthorMarkPane(weld::DialogController& rDialog, weld::Builder& rBuilder, bool bNew); + void ReInitDlg(SwWrtShell& rWrtShell); +}; + +class SwAuthMarkFloatDlg final : public SfxModelessDialogController +{ + SwAuthorMarkPane m_aContent; + virtual void Activate() override; +public: + SwAuthMarkFloatDlg(SfxBindings* pBindings, + SfxChildWindow* pChild, + weld::Window *pParent, + SfxChildWinInfo const * pInfo, + bool bNew); + void ReInitDlg(SwWrtShell& rWrtShell); +}; + +class SwAuthMarkModalDlg final : public SfxDialogController +{ + SwAuthorMarkPane m_aContent; + + void Apply(); +public: + SwAuthMarkModalDlg(weld::Window *pParent, SwWrtShell& rSh); + virtual short int run() override; +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWUIIDXMRK_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swuipardlg.hxx b/sw/source/uibase/inc/swuipardlg.hxx new file mode 100644 index 000000000..de5e83828 --- /dev/null +++ b/sw/source/uibase/inc/swuipardlg.hxx @@ -0,0 +1,46 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SWUIPARDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SWUIPARDLG_HXX + +#include <view.hxx> + +#include <sfx2/tabdlg.hxx> + +class SwParaDlg final : public SfxTabDialogController +{ + SwView& rView; + bool bDrawParaDlg; + + void PageCreated(const OString& rId, SfxTabPage& rPage) override; + +public: + SwParaDlg(weld::Window *pParent, + SwView& rVw, + const SfxItemSet&, + sal_uInt8 nDialogMode, + const OUString *pCollName, + bool bDraw = false, + const OString& sDefPage = OString()); + virtual ~SwParaDlg() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swwrtshitem.hxx b/sw/source/uibase/inc/swwrtshitem.hxx new file mode 100644 index 000000000..ab8f0f769 --- /dev/null +++ b/sw/source/uibase/inc/swwrtshitem.hxx @@ -0,0 +1,42 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_SWWRTSHITEM_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SWWRTSHITEM_HXX +#include <svl/poolitem.hxx> +#include <swdllapi.h> + +class SwWrtShell; + +class SW_DLLPUBLIC SwWrtShellItem final : public SfxPoolItem +{ + SwWrtShell* m_pWrtSh; + +public: + SwWrtShellItem( SwWrtShell* pWrtSh ); + + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwWrtShellItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + SwWrtShell* GetValue() const { return m_pWrtSh; } + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/syncbtn.hxx b/sw/source/uibase/inc/syncbtn.hxx new file mode 100644 index 000000000..e100edc2e --- /dev/null +++ b/sw/source/uibase/inc/syncbtn.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SYNCBTN_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_SYNCBTN_HXX + +#include <sfx2/basedlgs.hxx> +#include <sfx2/childwin.hxx> + +class SwSyncBtnDlg final : public SfxModelessDialogController +{ + std::unique_ptr<weld::Button> m_xSyncBtn; + + DECL_STATIC_LINK( SwSyncBtnDlg, BtnHdl, weld::Button&, void ); + +public: + SwSyncBtnDlg(SfxBindings*, SfxChildWindow*, weld::Window *pParent); + virtual ~SwSyncBtnDlg() override; +}; + +class SwSyncChildWin final : public SfxChildWindow +{ +public: + SwSyncChildWin(vcl::Window*, + sal_uInt16 nId, + SfxBindings*, + SfxChildWinInfo*); + + SFX_DECL_CHILDWINDOW(SwSyncChildWin); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/tabledlg.hxx b/sw/source/uibase/inc/tabledlg.hxx new file mode 100644 index 000000000..0edb8efed --- /dev/null +++ b/sw/source/uibase/inc/tabledlg.hxx @@ -0,0 +1,40 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_TABLEDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_TABLEDLG_HXX + +#include <sfx2/tabdlg.hxx> + +class SwWrtShell; +struct TColumn; + +// table dialog +class SwTableTabDlg final : public SfxTabDialogController +{ + SwWrtShell* pShell; + + virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; + +public: + SwTableTabDlg(weld::Window* pParent, const SfxItemSet* pItemSet, SwWrtShell* pSh); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/tablemgr.hxx b/sw/source/uibase/inc/tablemgr.hxx new file mode 100644 index 000000000..d382d29b6 --- /dev/null +++ b/sw/source/uibase/inc/tablemgr.hxx @@ -0,0 +1,75 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_TABLEMGR_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_TABLEMGR_HXX + +#include <swdllapi.h> +#include <swtypes.hxx> +#include <tabcol.hxx> + +#include <vcl/weld.hxx> + +class SwFrameFormat; +class SwWrtShell; +class SwFlyFrameFormat; + +namespace com::sun::star { + namespace frame { class XModel; } + namespace chart2 { + namespace data { + class XDataProvider; } } +} + +const SwTwips lAutoWidth = INVALID_TWIPS; +const char cParaDelim = 0x0a; + +class SW_DLLPUBLIC SwTableFUNC +{ + SwFrameFormat *m_pFormat; + SwWrtShell *m_pSh; + SwTabCols m_aCols; + +private: + SAL_DLLPRIVATE int GetRightSeparator(int nNum) const; + +public: + SwTableFUNC(SwWrtShell *pShell); + ~SwTableFUNC(); + + void InitTabCols(); + void ColWidthDlg(weld::Window *pParent); + SwTwips GetColWidth(sal_uInt16 nNum) const; + SwTwips GetMaxColWidth(sal_uInt16 nNum) const; + void SetColWidth(sal_uInt16 nNum, SwTwips nWidth ); + sal_uInt16 GetColCount() const; + sal_uInt16 GetCurColNum() const; + + SwWrtShell* GetShell() const { return m_pSh; } + + // @deprecated + void UpdateChart(); + + /// @return the XModel of the newly inserted chart if successful + css::uno::Reference< css::frame::XModel > + InsertChart( css::uno::Reference< css::chart2::data::XDataProvider > const &rxDataProvider, bool bFillWithData, const OUString &rCellRange, SwFlyFrameFormat** ppFlyFrameFormat = nullptr ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/tabsh.hxx b/sw/source/uibase/inc/tabsh.hxx new file mode 100644 index 000000000..6816376c1 --- /dev/null +++ b/sw/source/uibase/inc/tabsh.hxx @@ -0,0 +1,56 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_TABSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_TABSH_HXX + +#include "basesh.hxx" +#include <swdllapi.h> + +class SfxItemSet; +class SwWrtShell; +struct WhichRangesContainer; + +SW_DLLPUBLIC void ItemSetToTableParam( const SfxItemSet& rSet, SwWrtShell &rSh ); + +SW_DLLPUBLIC const WhichRangesContainer& SwuiGetUITableAttrRange(); + +class SwTableShell: public SwBaseShell +{ +public: + SFX_DECL_INTERFACE(SW_TABSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + void Execute(SfxRequest &); + void GetState(SfxItemSet &); + void GetFrameBorderState(SfxItemSet &rSet); + void GetLineStyleState(SfxItemSet &rSet); + void ExecTableStyle(SfxRequest& rReq); + + void ExecNumberFormat(SfxRequest const & rReq); + + SwTableShell(SwView &rView); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/tautofmt.hxx b/sw/source/uibase/inc/tautofmt.hxx new file mode 100644 index 000000000..4c03bd981 --- /dev/null +++ b/sw/source/uibase/inc/tautofmt.hxx @@ -0,0 +1,89 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_TAUTOFMT_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_TAUTOFMT_HXX + +#include <tools/link.hxx> +#include <sfx2/basedlgs.hxx> +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <vcl/weld.hxx> + +#include "wrtsh.hxx" +#include "autoformatpreview.hxx" +#include <tblafmt.hxx> + +class SwTableAutoFormat; +class SwTableAutoFormatTable; +class SwWrtShell; + +class SwAutoFormatDlg final : public SfxDialogController +{ + OUString m_aStrTitle; + OUString m_aStrLabel; + OUString m_aStrClose; + OUString m_aStrDelTitle; + OUString m_aStrDelMsg; + OUString m_aStrRenameTitle; + OUString m_aStrInvalidFormat; + + SwWrtShell* m_pShell; + sal_uInt8 m_nIndex; + sal_uInt8 m_nDfltStylePos; + bool m_bCoreDataChanged : 1; + bool m_bSetAutoFormat : 1; + + AutoFormatPreview m_aWndPreview; + std::unique_ptr<SwTableAutoFormatTable> m_xTableTable; + + std::unique_ptr<weld::TreeView> m_xLbFormat; + std::unique_ptr<weld::CheckButton> m_xBtnNumFormat; + std::unique_ptr<weld::CheckButton> m_xBtnBorder; + std::unique_ptr<weld::CheckButton> m_xBtnFont; + std::unique_ptr<weld::CheckButton> m_xBtnPattern; + std::unique_ptr<weld::CheckButton> m_xBtnAlignment; + std::unique_ptr<weld::Button> m_xBtnCancel; + std::unique_ptr<weld::Button> m_xBtnAdd; + std::unique_ptr<weld::Button> m_xBtnRemove; + std::unique_ptr<weld::Button> m_xBtnRename; + std::unique_ptr<weld::CustomWeld> m_xWndPreview; + + void Init( const SwTableAutoFormat* pSelFormat ); + void UpdateChecks( const SwTableAutoFormat&, bool bEnableBtn ); + + DECL_LINK(CheckHdl, weld::Toggleable&, void); + DECL_LINK(AddHdl, weld::Button&, void); + DECL_LINK(RemoveHdl, weld::Button&, void); + DECL_LINK(RenameHdl, weld::Button&, void); + DECL_LINK(SelFormatHdl, weld::TreeView&, void); + +public: + SwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pShell, + bool bSetAutoFormat, const SwTableAutoFormat* pSelFormat); + + virtual short run() override; + + std::unique_ptr<SwTableAutoFormat> FillAutoFormatOfIndex() const; + + virtual ~SwAutoFormatDlg() override; +}; + +#endif // SW_AUTOFMT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/tblnumfm.hxx b/sw/source/uibase/inc/tblnumfm.hxx new file mode 100644 index 000000000..8e0f32f3e --- /dev/null +++ b/sw/source/uibase/inc/tblnumfm.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_TBLNUMFM_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_TBLNUMFM_HXX + +#include <sfx2/basedlgs.hxx> + +namespace weld +{ +class Window; +} +class SfxItemSet; + +class SwNumFormatDlg final : public SfxSingleTabDialogController +{ +public: + SwNumFormatDlg(weld::Widget* pParent, const SfxItemSet& rSet); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/textsh.hxx b/sw/source/uibase/inc/textsh.hxx new file mode 100644 index 000000000..f965370e0 --- /dev/null +++ b/sw/source/uibase/inc/textsh.hxx @@ -0,0 +1,91 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_TEXTSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_TEXTSH_HXX + +#include "basesh.hxx" +#include <unotools/caserotate.hxx> +#include <com/sun/star/ui/dialogs/DialogClosedEvent.hpp> + +class AbstractSvxPostItDialog; +class SwFieldMgr; +class SwFlyFrameAttrMgr; +class SvxHyperlinkItem; +class SwInsertChart; + +class SW_DLLPUBLIC SwTextShell: public SwBaseShell +{ + RotateTransliteration m_aRotateCase; + + void InsertSymbol( SfxRequest& ); + void InsertHyperlink( const SvxHyperlinkItem& rHlnkItem ); + bool InsertMediaDlg( SfxRequest const & ); + +public: + SFX_DECL_INTERFACE(SW_TEXTSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + DECL_DLLPRIVATE_LINK( RedlineNextHdl, AbstractSvxPostItDialog&, void ); + DECL_DLLPRIVATE_LINK( RedlinePrevHdl, AbstractSvxPostItDialog&, void ); + DECL_DLLPRIVATE_STATIC_LINK( SwTextShell, DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void ); + + void Execute(SfxRequest &); + void GetState(SfxItemSet &); + + void ExecInsert(SfxRequest &); + void StateInsert(SfxItemSet&); + void ExecDelete(SfxRequest &); + void ExecEnterNum(SfxRequest &); + void ExecBasicMove(SfxRequest &); + void ExecMove(SfxRequest &); + void ExecMovePage(SfxRequest &); + void ExecMoveCol(SfxRequest &); + void ExecMoveLingu(SfxRequest &); + void ExecMoveMisc(SfxRequest &); + void ExecField(SfxRequest &rReq); + void ExecSetNumber(SfxRequest const &); + void StateField(SfxItemSet &); + void ExecIdx(SfxRequest const &); + void GetIdxState(SfxItemSet &); + void ExecGlossary(SfxRequest &); + + void ExecCharAttr(SfxRequest &); + void ExecCharAttrArgs(SfxRequest &); + void ExecParaAttr(SfxRequest &); + void ExecParaAttrArgs(SfxRequest &); + void ExecDB(SfxRequest const &); + void ExecTransliteration(SfxRequest const &); + void ExecRotateTransliteration(SfxRequest const &); + + void GetAttrState(SfxItemSet &); + + SwTextShell(SwView &rView); + virtual ~SwTextShell() override; + /// Create item set for the insert frame dialog. + SfxItemSet CreateInsertFrameItemSet(SwFlyFrameAttrMgr& rMgr); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/titlepage.hxx b/sw/source/uibase/inc/titlepage.hxx new file mode 100644 index 000000000..9e8c58984 --- /dev/null +++ b/sw/source/uibase/inc/titlepage.hxx @@ -0,0 +1,64 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_TITLEPAGE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_TITLEPAGE_HXX + +#include <sfx2/basedlgs.hxx> + +#include <fmtpdsc.hxx> + +namespace vcl +{ +class Window; +} +class SwWrtShell; +class SwPageDesc; + +class SwTitlePageDlg final : public SfxDialogController +{ +private: + std::unique_ptr<const SwFormatPageDesc> mpPageFormatDesc; + + SwPageDesc* mpTitleDesc; + const SwPageDesc* mpIndexDesc; + const SwPageDesc* mpNormalDesc; + + std::unique_ptr<weld::RadioButton> m_xUseExistingPagesRB; + std::unique_ptr<weld::SpinButton> m_xPageCountNF; + std::unique_ptr<weld::RadioButton> m_xDocumentStartRB; + std::unique_ptr<weld::RadioButton> m_xPageStartRB; + std::unique_ptr<weld::SpinButton> m_xPageStartNF; + std::unique_ptr<weld::CheckButton> m_xRestartNumberingCB; + std::unique_ptr<weld::SpinButton> m_xRestartNumberingNF; + std::unique_ptr<weld::CheckButton> m_xSetPageNumberCB; + std::unique_ptr<weld::SpinButton> m_xSetPageNumberNF; + std::unique_ptr<weld::ComboBox> m_xPagePropertiesLB; + std::unique_ptr<weld::Button> m_xPagePropertiesPB; + std::unique_ptr<weld::Button> m_xOkPB; + + void FillList(); + + sal_uInt16 GetInsertPosition() const; + + DECL_LINK(OKHdl, weld::Button&, void); + DECL_LINK(EditHdl, weld::Button&, void); + DECL_LINK(RestartNumberingHdl, weld::Toggleable&, void); + DECL_LINK(SetPageNumberHdl, weld::Toggleable&, void); + DECL_LINK(ValueChangeHdl, weld::SpinButton&, void); + DECL_LINK(StartPageHdl, weld::Toggleable&, void); + +public: + SwTitlePageDlg(weld::Window* pParent); + virtual ~SwTitlePageDlg() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/tmpdlg.hxx b/sw/source/uibase/inc/tmpdlg.hxx new file mode 100644 index 000000000..e77b928bf --- /dev/null +++ b/sw/source/uibase/inc/tmpdlg.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_SW_SOURCE_UIBASE_INC_TMPDLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_TMPDLG_HXX + +#include <sfx2/styledlg.hxx> +#include <svl/style.hxx> + +class SfxItemSet; +class SwWrtShell; + +// the tab dialog carrier of TabPages +class SwTemplateDlgController final : public SfxStyleDialogController +{ + + SfxStyleFamily nType; + sal_uInt16 nHtmlMode; + SwWrtShell* pWrtShell; + bool bNewStyle; + +public: + /// @param sPage + /// Identifies name of page to open at by default + SwTemplateDlgController(weld::Window* pParent, + SfxStyleSheetBase& rBase, + SfxStyleFamily nRegion, + const OString& sPage, + SwWrtShell* pActShell, + bool bNew); + + virtual void RefreshInputSet() override; + + virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; + virtual short Ok() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/tmplctrl.hxx b/sw/source/uibase/inc/tmplctrl.hxx new file mode 100644 index 000000000..0b60c3a6b --- /dev/null +++ b/sw/source/uibase/inc/tmplctrl.hxx @@ -0,0 +1,44 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_TMPLCTRL_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_TMPLCTRL_HXX + +#include <sfx2/stbitem.hxx> + +class SwTemplateControl final : public SfxStatusBarControl +{ + virtual void Command(const CommandEvent& rCEvt) override; + +public: + virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState) override; + virtual void Paint(const UserDrawEvent& rEvt) override; + + SFX_DECL_STATUSBAR_CONTROL(); + + SwTemplateControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb); + virtual ~SwTemplateControl() override; + +private: + OUString m_sTemplate; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/toxmgr.hxx b/sw/source/uibase/inc/toxmgr.hxx new file mode 100644 index 000000000..84a49a5a2 --- /dev/null +++ b/sw/source/uibase/inc/toxmgr.hxx @@ -0,0 +1,275 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_TOXMGR_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_TOXMGR_HXX + +#include <swdllapi.h> +#include <tox.hxx> +#include <authfld.hxx> +#include <memory> +#include <optional> + +class SwWrtShell; +class SwForm; + +// manager for directory functionality +//one single method will be sufficient to insert AND update indexes +class SW_DLLPUBLIC SwTOXDescription +{ + TOXTypes m_eTOXType; + OUString m_aStyleNames[MAXLEVEL]; + OUString m_sSequenceName; + OUString m_sMainEntryCharStyle; + OUString m_sAutoMarkURL; + std::optional<OUString> + m_aTitle; + std::optional<OUString> + m_aTOUName; + std::unique_ptr<SwForm> + m_pForm; + SwTOXElement m_nContent; + SwTOIOptions m_nIndexOptions; + SwTOOElements m_nOLEOptions; + LanguageType m_eLanguage; + OUString m_sSortAlgorithm; + + OUString m_sAuthBrackets; + SwCaptionDisplay m_eCaptionDisplay; + SwTOXSortKey m_eSortKey1; + SwTOXSortKey m_eSortKey2; + SwTOXSortKey m_eSortKey3; + sal_uInt8 m_nLevel; + bool m_bFromObjectNames : 1; + bool m_bFromChapter : 1; + bool m_bReadonly: 1; + bool m_bLevelFromChapter : 1; + bool m_bIsAuthSequence :1; + bool m_bSortByDocument :1; + + //TODO: TemplateNames + //const String* pTemplateName = 0, ??? + + SwTOXDescription(SwTOXDescription const &) = delete; + SwTOXDescription & operator= (SwTOXDescription const &) = delete; + +public: + // single argument ctors shall be explicit. + explicit SwTOXDescription(TOXTypes eType) : + m_eTOXType(eType), + m_nContent(SwTOXElement::Mark | SwTOXElement::OutlineLevel), + m_nIndexOptions(SwTOIOptions::SameEntry|SwTOIOptions::FF|SwTOIOptions::CaseSensitive), + m_nOLEOptions(SwTOOElements::NONE), + m_eLanguage(::GetAppLanguage()), + m_eCaptionDisplay(CAPTION_COMPLETE), + m_nLevel(MAXLEVEL), + m_bFromObjectNames(false), + m_bFromChapter(false), + m_bReadonly(true), + m_bLevelFromChapter(false), + m_bIsAuthSequence(false), + m_bSortByDocument(true) + {} + + TOXTypes GetTOXType() const { return m_eTOXType;} + + const OUString& GetStyleNames(sal_uInt16 nLvl) const + {return m_aStyleNames[nLvl];} + void SetStyleNames(const OUString& rSet, sal_uInt16 nLvl) + {m_aStyleNames[nLvl] = rSet; } + + const OUString& GetAutoMarkURL() const { return m_sAutoMarkURL;} + void SetAutoMarkURL(const OUString& rSet) {m_sAutoMarkURL = rSet;} + + void SetTitle(const OUString& rSet) { m_aTitle = rSet; } + std::optional<OUString> const & GetTitle() const {return m_aTitle; } + + void SetTOUName(const OUString& rSet) { m_aTOUName = rSet; } + std::optional<OUString> const & GetTOUName() const { return m_aTOUName; } + + void SetForm(const SwForm& rSet) { m_pForm.reset( new SwForm(rSet) );} + const SwForm* GetForm() const {return m_pForm.get();} + + void SetContentOptions(SwTOXElement nSet) { m_nContent = nSet;} + SwTOXElement GetContentOptions() const { return m_nContent;} + + void SetIndexOptions(SwTOIOptions nSet) { m_nIndexOptions = nSet;} + SwTOIOptions GetIndexOptions() const { return m_nIndexOptions;} + + const OUString& GetMainEntryCharStyle() const {return m_sMainEntryCharStyle;} + void SetMainEntryCharStyle(const OUString& rSet) {m_sMainEntryCharStyle = rSet;} + + void SetLevel(sal_uInt8 nSet) {m_nLevel = nSet;} + sal_uInt8 GetLevel()const {return m_nLevel; } + + void SetCreateFromObjectNames(bool bSet) { m_bFromObjectNames = bSet;} + bool IsCreateFromObjectNames() const {return m_bFromObjectNames;} + + const OUString& GetSequenceName() const {return m_sSequenceName;} + void SetSequenceName(const OUString& rSet) {m_sSequenceName = rSet;} + + SwCaptionDisplay GetCaptionDisplay() const { return m_eCaptionDisplay;} + void SetCaptionDisplay(SwCaptionDisplay eSet) {m_eCaptionDisplay = eSet;} + + void SetFromChapter(bool bSet) { m_bFromChapter = bSet;} + bool IsFromChapter() const {return m_bFromChapter;} + + void SetReadonly(bool bSet){m_bReadonly = bSet;} + bool IsReadonly() const {return m_bReadonly;} + + SwTOOElements GetOLEOptions() const {return m_nOLEOptions;} + void SetOLEOptions(SwTOOElements nOpt) {m_nOLEOptions = nOpt;} + + bool IsLevelFromChapter() const {return m_bLevelFromChapter;} + void SetLevelFromChapter(bool bSet) {m_bLevelFromChapter = bSet;} + + const OUString& GetAuthBrackets() const {return m_sAuthBrackets;} + void SetAuthBrackets(const OUString& rSet) {m_sAuthBrackets = rSet;} + + bool IsAuthSequence() const {return m_bIsAuthSequence;} + void SetAuthSequence(bool bSet){m_bIsAuthSequence = bSet;} + + bool IsSortByDocument()const {return m_bSortByDocument ;} + void SetSortByDocument(bool bSet) {m_bSortByDocument = bSet;} + + void SetSortKeys(SwTOXSortKey eKey1, + SwTOXSortKey eKey2, + SwTOXSortKey eKey3); + + const SwTOXSortKey& GetSortKey1() const {return m_eSortKey1;} + const SwTOXSortKey& GetSortKey2() const {return m_eSortKey2;} + const SwTOXSortKey& GetSortKey3() const {return m_eSortKey3;} + + LanguageType GetLanguage() const {return m_eLanguage;} + void SetLanguage(LanguageType nLang) {m_eLanguage = nLang;} + + const OUString& GetSortAlgorithm()const {return m_sSortAlgorithm;} + void SetSortAlgorithm(const OUString& rSet) {m_sSortAlgorithm = rSet;} + + void ApplyTo(SwTOXBase& rTOXBase); + +}; + +class SwTOXMarkDescription +{ + TOXTypes meTOXType; + int mnLevel; + bool mbMainEntry; + + std::optional<OUString> maPrimKey; + std::optional<OUString> maSecKey; + std::optional<OUString> maAltStr; + std::optional<OUString> maTOUName; + + std::optional<OUString> maPhoneticReadingOfAltStr; + std::optional<OUString> maPhoneticReadingOfPrimKey; + std::optional<OUString> maPhoneticReadingOfSecKey; + + SwTOXMarkDescription(SwTOXMarkDescription const &) = delete; + SwTOXMarkDescription & operator= (SwTOXMarkDescription const &) = delete; + +public: + // single argument ctors shall be explicit. + explicit SwTOXMarkDescription(TOXTypes eType) : + meTOXType(eType), + mnLevel(0), + mbMainEntry(false) + { + } + + TOXTypes GetTOXType()const {return meTOXType;} + + void SetLevel(int nSet) {mnLevel = nSet;} + int GetLevel() const {return mnLevel;} + + void SetMainEntry(bool bSet) {mbMainEntry = bSet;} + bool IsMainEntry() const {return mbMainEntry;} + + void SetPrimKey(const OUString& rSet) { maPrimKey = rSet; } + std::optional<OUString> const & GetPrimKey() const { return maPrimKey; } + + void SetSecKey(const OUString& rSet) { maSecKey = rSet; } + std::optional<OUString> const & GetSecKey() const { return maSecKey; } + + void SetAltStr(const OUString& rSet) { maAltStr = rSet; } + std::optional<OUString> const & GetAltStr() const { return maAltStr; } + + void SetTOUName(const OUString& rSet) { maTOUName = rSet; } + std::optional<OUString> const & GetTOUName() const { return maTOUName; } + + void SetPhoneticReadingOfAltStr(const OUString& rSet) { maPhoneticReadingOfAltStr = rSet; } + std::optional<OUString> const & GetPhoneticReadingOfAltStr() const { return maPhoneticReadingOfAltStr; } + + void SetPhoneticReadingOfPrimKey(const OUString& rSet) { maPhoneticReadingOfPrimKey = rSet; } + std::optional<OUString> const & GetPhoneticReadingOfPrimKey() const { return maPhoneticReadingOfPrimKey; } + + void SetPhoneticReadingOfSecKey(const OUString& rSet) { maPhoneticReadingOfSecKey = rSet; } + std::optional<OUString> const & GetPhoneticReadingOfSecKey() const { return maPhoneticReadingOfSecKey; } +}; + +/** + * Built on top of SwWrtShell, provides functionality to insert, update or perform other actions on + * various ToX types (table of contents, indexes and so on). + */ +class SW_DLLPUBLIC SwTOXMgr +{ + SwWrtShell* m_pSh; + SwTOXMark* m_pCurTOXMark; + SwTOXMarks m_aCurMarks; + + SAL_DLLPRIVATE sal_uInt16 GetUserTypeID(const OUString& rStr); + +public: + // single argument ctors shall be explicit. + explicit SwTOXMgr(SwWrtShell* pShell); + + // methods for directory marks + + void InsertTOXMark(const SwTOXMarkDescription& rDesc); + + void UpdateTOXMark(const SwTOXMarkDescription& rDesc); + + void DeleteTOXMark(); + void NextTOXMark(bool bSame=false); + void PrevTOXMark(bool bSame=false); + + // get current TOXmarks + sal_uInt16 GetTOXMarkCount() const; + SwTOXMark* GetTOXMark(sal_uInt16 nId); + SwTOXMark* GetCurTOXMark(); + void SetCurTOXMark(sal_uInt16 nId); + + // methods for directories + + bool UpdateOrInsertTOX(const SwTOXDescription& rDesc, SwTOXBase** ppBase, const SfxItemSet* pSet); + + const SwTOXType* GetTOXType(TOXTypes eTyp) const; + SwWrtShell * GetShell() { return m_pSh; } +}; + +// inlines +inline sal_uInt16 SwTOXMgr::GetTOXMarkCount() const + { return m_aCurMarks.size(); } + +inline SwTOXMark* SwTOXMgr::GetCurTOXMark() + { return m_pCurTOXMark; } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/uiborder.hxx b/sw/source/uibase/inc/uiborder.hxx new file mode 100644 index 000000000..bd23157b7 --- /dev/null +++ b/sw/source/uibase/inc/uiborder.hxx @@ -0,0 +1,39 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_UIBORDER_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_UIBORDER_HXX + +#include <sfx2/basedlgs.hxx> +#include <svx/flagsdef.hxx> + +class SwBorderDlg final : public SfxSingleTabDialogController +{ +public: + // nType may be: + // SW_BORDER_MODE_PARA + // SW_BORDER_MODE_TABLE + // SW_BORDER_MODE_FRAME + + SwBorderDlg(weld::Window* pParent, const SfxItemSet& rSet, SwBorderModes nType); + virtual ~SwBorderDlg() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/uiitems.hxx b/sw/source/uibase/inc/uiitems.hxx new file mode 100644 index 000000000..ded715538 --- /dev/null +++ b/sw/source/uibase/inc/uiitems.hxx @@ -0,0 +1,108 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_UIITEMS_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_UIITEMS_HXX + +#include <memory> +#include <svl/poolitem.hxx> +#include <swdllapi.h> +#include <pagedesc.hxx> + +class SwNumRule; +class IntlWrapper; +class SwPaM; + +// container for FootNote +class SW_DLLPUBLIC SwPageFootnoteInfoItem final : public SfxPoolItem +{ + SwPageFootnoteInfo m_aFootnoteInfo; + +public: + + SwPageFootnoteInfoItem(SwPageFootnoteInfo const & rInfo); + virtual ~SwPageFootnoteInfoItem() override; + + SwPageFootnoteInfoItem(SwPageFootnoteInfoItem const &) = default; + SwPageFootnoteInfoItem(SwPageFootnoteInfoItem &&) = default; + SwPageFootnoteInfoItem & operator =(SwPageFootnoteInfoItem const &) = delete; // due to SfxPoolItem + SwPageFootnoteInfoItem & operator =(SwPageFootnoteInfoItem &&) = delete; // due to SfxPoolItem + + virtual SwPageFootnoteInfoItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + SwPageFootnoteInfo& GetPageFootnoteInfo() { return m_aFootnoteInfo; } + const SwPageFootnoteInfo& GetPageFootnoteInfo() const { return m_aFootnoteInfo; } +}; + +class SW_DLLPUBLIC SwPtrItem final : public SfxPoolItem +{ + void* m_pMisc; + +public: + SwPtrItem( const sal_uInt16 nId, void* pPtr); + + virtual SwPtrItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + + void* GetValue() const { return m_pMisc; } +}; + +class SW_DLLPUBLIC SwUINumRuleItem final : public SfxPoolItem +{ + std::unique_ptr<SwNumRule> m_pRule; + +public: + SwUINumRuleItem( const SwNumRule& rRule ); + SwUINumRuleItem( const SwUINumRuleItem& rItem ); + virtual ~SwUINumRuleItem() override; + + virtual SwUINumRuleItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + const SwNumRule* GetNumRule() const { return m_pRule.get(); } + SwNumRule* GetNumRule() { return m_pRule.get(); } +}; + +class SwPaMItem final : public SfxPoolItem +{ + SwPaM* m_pPaM; + +public: + SwPaMItem( const sal_uInt16 nId, SwPaM* pPaM); + + virtual SwPaMItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + + SwPaM* GetValue() const { return m_pPaM; } +}; + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_UIITEMS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/uinums.hxx b/sw/source/uibase/inc/uinums.hxx new file mode 100644 index 000000000..54dd1c2a0 --- /dev/null +++ b/sw/source/uibase/inc/uinums.hxx @@ -0,0 +1,119 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_UINUMS_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_UINUMS_HXX + +#include <numrule.hxx> +#include <swdllapi.h> + +#include <memory> +#include <vector> + +class SfxPoolItem; +class SwWrtShell; +class SvStream; + +namespace sw { class StoredChapterNumberingRules; } + +#define MAX_NUM_RULES 9 + +class SW_DLLPUBLIC SwNumRulesWithName final +{ + OUString maName; + // the NumRule's formats _have_ to be independent of a document + // (They should always be there!) + class SAL_DLLPRIVATE SwNumFormatGlobal + { + friend class SwNumRulesWithName; + SwNumFormat m_aFormat; + OUString m_sCharFormatName; + sal_uInt16 m_nCharPoolId; + std::vector<std::unique_ptr<SfxPoolItem>> m_Items; + + SwNumFormatGlobal& operator=( const SwNumFormatGlobal& ) = delete; + + public: + SwNumFormatGlobal( const SwNumFormat& rFormat ); + SwNumFormatGlobal( const SwNumFormatGlobal& ); + ~SwNumFormatGlobal(); + + SwNumFormat MakeNumFormat(SwWrtShell& rSh) const; + }; + + std::unique_ptr<SwNumFormatGlobal> m_aFormats[ MAXLEVEL ]; + + friend class sw::StoredChapterNumberingRules; + friend class SwChapterNumRules; + void SetName(const OUString& rSet) {maName = rSet;} + void SetNumFormat(size_t, SwNumFormat const&, OUString const&); + SwNumRulesWithName() = default; + +public: + SwNumRulesWithName(const SwNumRule &, const OUString &); + SwNumRulesWithName( const SwNumRulesWithName & ); + ~SwNumRulesWithName(); + + SwNumRulesWithName &operator=(const SwNumRulesWithName &); + + const OUString& GetName() const { return maName; } + void ResetNumRule(SwWrtShell& rSh, SwNumRule& ) const; + + void GetNumFormat(size_t, SwNumFormat const*&, OUString const*&) const; +}; + +class SW_DLLPUBLIC SwChapterNumRules final +{ +public: + enum { nMaxRules = MAX_NUM_RULES }; // currently 9 defined forms +private: + std::unique_ptr<SwNumRulesWithName> m_pNumRules[ MAX_NUM_RULES ]; + + void Init(); + void Save(); + +public: + SwChapterNumRules(); + ~SwChapterNumRules(); + + inline const SwNumRulesWithName* GetRules(sal_uInt16 nIdx) const; + void CreateEmptyNumRule(sal_uInt16 nIdx); // for import + void ApplyNumRules( const SwNumRulesWithName &rCopy, + sal_uInt16 nIdx); +}; + +inline const SwNumRulesWithName *SwChapterNumRules::GetRules(sal_uInt16 nIdx) const +{ + assert(nIdx < nMaxRules); + return m_pNumRules[nIdx].get(); +} + + +namespace sw +{ + +void ExportStoredChapterNumberingRules( + SwChapterNumRules & rRules, SvStream & rStream, OUString const&); +void ImportStoredChapterNumberingRules( + SwChapterNumRules & rRules, SvStream & rStream, OUString const&); + +} // namespace sw + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/uiobject.hxx b/sw/source/uibase/inc/uiobject.hxx new file mode 100644 index 000000000..8911ef2a8 --- /dev/null +++ b/sw/source/uibase/inc/uiobject.hxx @@ -0,0 +1,85 @@ +/* -*- 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/. + */ + +#ifndef SW_SOURCE_UIBASE_INC_UIOBJECT_HXX +#define SW_SOURCE_UIBASE_INC_UIOBJECT_HXX + +#include <memory> +#include <vcl/uitest/uiobject.hxx> + +#include "edtwin.hxx" +#include "PageBreakWin.hxx" + +#include <AnnotationWin.hxx> + +class SwEditWinUIObject final : public WindowUIObject +{ +public: + + SwEditWinUIObject(const VclPtr<SwEditWin>& xEditWin); + + virtual StringMap get_state() override; + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + + virtual OUString get_name() const override; + +private: + + VclPtr<SwEditWin> mxEditWin; + +}; + +// This class handles the Comments as a UIObject to be used in UITest Framework +class CommentUIObject final : public WindowUIObject +{ + VclPtr<sw::annotation::SwAnnotationWin> mxCommentUIObject; + +public: + + CommentUIObject(const VclPtr<sw::annotation::SwAnnotationWin>& xCommentUIObject); + + virtual StringMap get_state() override; + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +private: + + OUString get_name() const override; + +}; + +class PageBreakUIObject final : public WindowUIObject +{ +public: + + PageBreakUIObject(const VclPtr<SwBreakDashedLine>& xEditWin); + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +private: + + virtual OUString get_name() const override; + + VclPtr<SwBreakDashedLine> mxPageBreakUIObject; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/uitool.hxx b/sw/source/uibase/inc/uitool.hxx new file mode 100644 index 000000000..85747a9f8 --- /dev/null +++ b/sw/source/uibase/inc/uitool.hxx @@ -0,0 +1,114 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_UITOOL_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_UITOOL_HXX + +#include <vcl/weld.hxx> +#include <swtypes.hxx> +#include <swdllapi.h> + +class SfxItemSet; +class SwPageDesc; +class SvxTabStopItem; +class SwWrtShell; +namespace com::sun::star::awt { class XPopupMenu; } +namespace weld { class ComboBox; } +class SwDocShell; +class SwFrameFormat; +class SwTabCols; +class DateTime; +class SfxViewFrame; +class SwEditShell; + +// fill BoxInfo attribute +SW_DLLPUBLIC void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh); + +/** + * Convert character specific attributes to general ones used by tab pages. + * + * @param[in,out] rSet the set in which character attributes are stored + * @param[in] bIsPara is called by a paragraph style +**/ +SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet& rSet, bool bPara = false); + +/** + * Convert general attributes to the corresponding character attributes. + * This method is used after executed a character dialog. + * + * @param[in,out] rSet the set in which character attributes are stored + * @param[in] rOrigSet original itemset used as input for the dialog + * @param[in] bIsPara is called by a paragraph style +**/ +SW_DLLPUBLIC void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet, bool bPara = false); + + +/** +* Apply character background on the shell. Need to use this to hide the mixed +* character background and character highlighting attribute, which were +* added for MSO compatibility where there are two kind of character background. +* +* @param[in] rBackgroundColor the color to apply on the shell +* @param[in,out] rShell the shell on which we apply the new attribute +**/ +void ApplyCharBackground(const Color& rBackgroundColor, SwWrtShell& rShell); + +// SfxItemSets <-> PageDesc +void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc ); +void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet); + +// fill tabs with default tabs +SW_DLLPUBLIC void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem& rTabs); + +// erase DefaultTabs from TabStopArray +//void EraseDefTabs(SvxTabStopItem& rTabs); + +// determine space between 1st and 2nd element +SW_DLLPUBLIC SwTwips GetTabDist(const SvxTabStopItem& rTabs); + +// determine whether a Sfx-PageDesc combination exists in the set +// and set this in the set and delete the transport items +// (PageBreak & PageModel) from the set +void SwToSfxPageDescAttr( SfxItemSet& rSet ); +void SfxToSwPageDescAttr( const SwWrtShell& rShell, SfxItemSet& rSet ); + +SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb); +void SetDfltMetric(FieldUnit eMetric, bool bWeb); + +bool HasCharUnit( bool bWeb ); +void SetApplyCharUnit(bool bApplyChar, bool bWeb); + +// fill ListBox with all char style templates, except the standard ones +SW_DLLPUBLIC void FillCharStyleListBox(weld::ComboBox& rToFill, SwDocShell* pDocSh, bool bSorted = false, bool bWithDefault = false); + +//inserts a string sorted into a ListBox, +SW_DLLPUBLIC void InsertStringSorted(const OUString& rId, const OUString& rEntry, weld::ComboBox& rToFill, int nOffset); + +// Get table width and alignment +SwTwips GetTableWidth( SwFrameFormat const * pFormat, SwTabCols const & rCols, sal_uInt16 *pPercent, + SwWrtShell* pSh ); + +OUString GetAppLangDateTimeString( const DateTime& ); + +// search for a command string within the menu structure and execute it +// at the dispatcher if there is one, if executed return true +bool ExecuteMenuCommand(const css::uno::Reference<css::awt::XPopupMenu>& rMenu, const SfxViewFrame& rViewFrame, sal_uInt16 nId); + +#endif // INCLUDED_SW_SOURCE_UIBASE_INC_UITOOL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx new file mode 100644 index 000000000..1cb5fd659 --- /dev/null +++ b/sw/source/uibase/inc/uivwimp.hxx @@ -0,0 +1,169 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_UIVWIMP_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_UIVWIMP_HXX + +#include <view.hxx> + +#include <sfx2/objsh.hxx> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/weakref.hxx> + +class SwXTextView; +class SfxRequest; +class SwTransferable; +class SfxRequest; + +namespace sfx2 { class DocumentInserter; } +namespace com::sun::star { + namespace frame { + class XDispatchProviderInterceptor; + } + namespace lang { + class XUnoTunnel; + } +} + +class SwScannerEventListener final : public ::cppu::WeakImplHelper< + css::lang::XEventListener > +{ + SwView* m_pView; + +public: + + SwScannerEventListener( SwView& rView ) : m_pView( &rView ) {} + virtual ~SwScannerEventListener() override; + + // XEventListener + virtual void SAL_CALL disposing( + const css::lang::EventObject& rEventObject ) override; + + void ViewDestroyed() { m_pView = nullptr; } +}; + +// Clipboard EventListener +class SwClipboardChangeListener final : public ::cppu::WeakImplHelper< + css::datatransfer::clipboard::XClipboardListener > +{ + SwView* m_pView; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) override; + + // XClipboardListener + virtual void SAL_CALL changedContents( const css::datatransfer::clipboard::ClipboardEvent& rEventObject ) override; + +public: + SwClipboardChangeListener( SwView& rView ) : m_pView( &rView ) {} + virtual ~SwClipboardChangeListener() override; + + void ViewDestroyed() { m_pView = nullptr; } + + void AddRemoveListener( bool bAdd ); +}; + +class SwMailMergeConfigItem; + +class SwView_Impl +{ + css::uno::Reference< css::frame::XDispatchProviderInterceptor > m_xDispatchProviderInterceptor; + css::uno::Reference< css::view::XSelectionSupplier > mxXTextView; // UNO object + std::vector< css::uno::WeakReference< css::lang::XUnoTunnel > > mxTransferables; + + // temporary document for printing text of selection / multi selection + // in PDF export. + SfxObjectShellLock m_xTmpSelDocShell; + + SwView* m_pView; + rtl::Reference<SwScannerEventListener> + mxScanEvtLstnr; + rtl::Reference<SwClipboardChangeListener> + mxClipEvtLstnr; + ShellMode m_eShellMode; + + std::shared_ptr<SwMailMergeConfigItem> + m_xConfigItem; + + std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter; + std::unique_ptr<SfxRequest> m_pRequest; + sal_Int16 m_nParam; + + Point m_aEditingPosition; + bool m_bSelectObject; + bool m_bEditingPositionSet; + +public: + /// Redline author that's specific to this view. + OUString m_sRedlineAuthor; + + SwView_Impl(SwView* pShell); + ~SwView_Impl(); + + void SetShellMode(ShellMode eSet); + + css::view::XSelectionSupplier* GetUNOObject(); + SwXTextView* GetUNOObject_Impl(); + void Invalidate(); + + ShellMode GetShellMode() const {return m_eShellMode;} + + void ExecuteScan(SfxRequest& rReq); + SwScannerEventListener& GetScannerEventListener(); + + void AddClipboardListener(); + + void AddTransferable(SwTransferable& rTransferable); + + void SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem> const & rItem) + { + m_xConfigItem = rItem; + } + std::shared_ptr<SwMailMergeConfigItem> const & GetMailMergeConfigItem() const {return m_xConfigItem;} + + //#i33307# restore editing position + void SetRestorePosition(const Point& rCursorPos, bool bSelectObj) + { + m_aEditingPosition = rCursorPos; + m_bSelectObject = bSelectObj; + m_bEditingPositionSet = true; + } + bool GetRestorePosition(Point& rCursorPos, bool& rbSelectObj) + { + rCursorPos = m_aEditingPosition; + rbSelectObj = m_bSelectObject; + return m_bEditingPositionSet; + } + + void StartDocumentInserter( + const OUString& rFactory, + const Link<sfx2::FileDialogHelper*,void>& rEndDialogHdl, + const sal_uInt16 nSlotId + ); + std::unique_ptr<SfxMedium> CreateMedium(); + void InitRequest( const SfxRequest& rRequest ); + + SfxRequest* GetRequest() const { return m_pRequest.get(); } + sal_Int16 GetParam() const { return m_nParam; } + void SetParam( sal_Int16 nParam ) { m_nParam = nParam; } +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/unoatxt.hxx b/sw/source/uibase/inc/unoatxt.hxx new file mode 100644 index 000000000..9c566c225 --- /dev/null +++ b/sw/source/uibase/inc/unoatxt.hxx @@ -0,0 +1,267 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_UNOATXT_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_UNOATXT_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/text/XAutoTextGroup.hpp> +#include <com/sun/star/text/XAutoTextEntry.hpp> +#include <com/sun/star/text/XAutoTextContainer2.hpp> +#include <com/sun/star/text/XText.hpp> +#include <svl/itemprop.hxx> +#include <svl/lstner.hxx> +#include <comphelper/compbase.hxx> +#include <cppuhelper/implbase.hxx> +#include <rtl/ref.hxx> +#include <svtools/unoevent.hxx> + +class SwTextBlocks; +class SwGlossaries; +class SwDoc; +class SwDocShell; +class SwXBodyText; + +#ifndef SW_DECL_SWDOCSHELL_DEFINED +#define SW_DECL_SWDOCSHELL_DEFINED +#include <tools/ref.hxx> +typedef tools::SvRef<SwDocShell> SwDocShellRef; +#endif + +class SwXAutoTextContainer final : public cppu::WeakImplHelper +< + css::text::XAutoTextContainer2, + css::lang::XServiceInfo +> +{ + SwGlossaries *m_pGlossaries; + + virtual ~SwXAutoTextContainer() override; // ref-counted objects are not to be deleted from outside -> protected dtor + +public: + SwXAutoTextContainer(); + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XAutoTextContainer + virtual css::uno::Reference< css::text::XAutoTextGroup > SAL_CALL insertNewByName(const OUString& aGroupName) override; + virtual void SAL_CALL removeByName(const OUString& aGroupName) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + +class SwXAutoTextGroup final : public cppu::WeakImplHelper +< + css::text::XAutoTextGroup, + css::beans::XPropertySet, + css::lang::XServiceInfo, + css::container::XIndexAccess, + css::container::XNamed, + css::lang::XUnoTunnel +> +{ + const SfxItemPropertySet* m_pPropSet; + SwGlossaries* m_pGlossaries; + OUString m_sName; + OUString m_sGroupName; // prefix m_ to disambiguate from some local vars in the implementation + + virtual ~SwXAutoTextGroup() override; // ref-counted objects are not to be deleted from outside -> protected dtor + +public: + SwXAutoTextGroup(const OUString& rName, SwGlossaries* pGloss); + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + //XAutoTextGroup + virtual css::uno::Sequence< OUString > SAL_CALL getTitles() override; + virtual void SAL_CALL renameByName(const OUString& aElementName, const OUString& aNewElementName, const OUString& aNewElementTitle) override; + virtual css::uno::Reference< css::text::XAutoTextEntry > SAL_CALL insertNewByName(const OUString& aName, const OUString& aTitle, const css::uno::Reference< css::text::XTextRange > & xTextRange) override; + virtual void SAL_CALL removeByName(const OUString& aEntryName) override; + + //XNamed + virtual OUString SAL_CALL getName() override; + virtual void SAL_CALL setName(const OUString& Name_) override; + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + void Invalidate(); +}; + +class SwXAutoTextEntry final + :public SfxListener + ,public comphelper::WeakComponentImplHelper + < + css::text::XAutoTextEntry, + css::lang::XServiceInfo, + css::lang::XUnoTunnel, + css::text::XText, + css::document::XEventsSupplier + > +{ + SwGlossaries* m_pGlossaries; + OUString m_sGroupName; + OUString m_sEntryName; + SwDocShellRef m_xDocSh; + rtl::Reference<SwXBodyText> + mxBodyText; + + void EnsureBodyText () + { + if ( !mxBodyText.is() ) + GetBodyText(); + } + void GetBodyText (); + + void disposing(std::unique_lock<std::mutex>&) override; + + /** ensure that the current content (which may only be in-memory so far) is flushed to the auto text group file + + <p>If somebody modifies an auto text via this class, then this is not directly reflected to the respective + glossaries file (on disk), instead we hold a copy of this text (in [p|x]BodyText). On the other hand, + in applyTo, we do not work with this _copy_, but just tell the target for the application to insert + the content which we're responsible for - and this target doesn't know about our copy, but only + about the persistent version.</br> + So we need to ensure that before somebody else does something with our auto text, we flush our + (in-memory) copy to disk.</p> + + */ + void implFlushDocument( bool _bCloseDoc = false ); + + // SfxListener overridables + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + virtual ~SwXAutoTextEntry() override; // ref-counted objects are not to be deleted from outside -> protected dtor + +public: + SwXAutoTextEntry(SwGlossaries* , const OUString& rGroupName, const OUString& rEntryName); + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + //XText + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override; + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > & aTextPosition) override; + virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > & xRange, const OUString& aString, sal_Bool bAbsorb) override; + virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > & xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override; + virtual void SAL_CALL insertTextContent(const css::uno::Reference< css::text::XTextRange > & xRange, const css::uno::Reference< css::text::XTextContent > & xContent, sal_Bool bAbsorb) override; + virtual void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > & xContent) override; + + //XTextRange + virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override; + virtual OUString SAL_CALL getString() override; + virtual void SAL_CALL setString(const OUString& aString) override; + + //XAutoTextEntry + virtual void SAL_CALL applyTo(const css::uno::Reference< css::text::XTextRange > & xRange) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XEventsSupplier + virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents( ) override; + + void Invalidate() {m_pGlossaries = nullptr;} + const SwGlossaries* GetGlossaries() const { return m_pGlossaries; } + const OUString& GetGroupName() const {return m_sGroupName;} + const OUString& GetEntryName() const {return m_sEntryName;} +}; + +/** Implement the XNameAccess for the AutoText events */ +class SwAutoTextEventDescriptor final : public SvBaseEventDescriptor +{ + SwXAutoTextEntry& m_rAutoTextEntry; + + using SvBaseEventDescriptor::replaceByName; + using SvBaseEventDescriptor::getByName; + +public: + SwAutoTextEventDescriptor( SwXAutoTextEntry& rAutoText ); + + virtual ~SwAutoTextEventDescriptor() override; + + virtual OUString SAL_CALL getImplementationName() override; + +private: + + virtual void replaceByName( + const SvMacroItemId nEvent, /// item ID of event + const SvxMacro& rMacro) /// event (will be copied) + override; + + virtual void getByName( + SvxMacro& rMacro, /// macro to be filled + const SvMacroItemId nEvent ) /// item ID of event + override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/unodispatch.hxx b/sw/source/uibase/inc/unodispatch.hxx new file mode 100644 index 000000000..b748d5a10 --- /dev/null +++ b/sw/source/uibase/inc/unodispatch.hxx @@ -0,0 +1,127 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_UNODISPATCH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_UNODISPATCH_HXX + +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XInterceptorInfo.hpp> +#include <cppuhelper/implbase.hxx> +#include <vector> +#include <vcl/svapp.hxx> + +class SwView; + +class SwXDispatchProviderInterceptor final : public cppu::WeakImplHelper +< + css::frame::XDispatchProviderInterceptor, + css::lang::XEventListener, + css::lang::XUnoTunnel, + css::frame::XInterceptorInfo +> +{ + class DispatchMutexLock_Impl + { + //::osl::MutexGuard aGuard; #102295# solar mutex has to be used currently + SolarMutexGuard aGuard; + public: + DispatchMutexLock_Impl(); + ~DispatchMutexLock_Impl(); + }; + friend class DispatchMutexLock_Impl; + +// ::osl::Mutex m_aMutex;#102295# solar mutex has to be used currently + + // the component which's dispatches we're intercepting + css::uno::Reference< css::frame::XDispatchProviderInterception> m_xIntercepted; + + // chaining + css::uno::Reference< css::frame::XDispatchProvider> m_xSlaveDispatcher; + css::uno::Reference< css::frame::XDispatchProvider> m_xMasterDispatcher; + + css::uno::Reference< css::frame::XDispatch> m_xDispatch; + + SwView* m_pView; + +public: + SwXDispatchProviderInterceptor(SwView& rView); + virtual ~SwXDispatchProviderInterceptor() override; + + //XDispatchProvider + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags ) override; + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& aDescripts ) override; + + //XDispatchProviderInterceptor + virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) override; + virtual void SAL_CALL setSlaveDispatchProvider( const css::uno::Reference< css::frame::XDispatchProvider >& xNewDispatchProvider ) override; + virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) override; + virtual void SAL_CALL setMasterDispatchProvider( const css::uno::Reference< css::frame::XDispatchProvider >& xNewSupplier ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + //XUnoTunnel + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + // XInterceptorInfo + virtual css::uno::Sequence<OUString> SAL_CALL getInterceptedURLs() override; + + // view destroyed + void Invalidate(); +}; + +struct StatusStruct_Impl +{ + css::uno::Reference< css::frame::XStatusListener> xListener; + css::util::URL aURL; +}; +class SwXDispatch final : public cppu::WeakImplHelper +< + css::frame::XDispatch, + css::view::XSelectionChangeListener +> +{ + SwView* m_pView; + std::vector< StatusStruct_Impl > m_aStatusListenerVector; + bool m_bOldEnable; + bool m_bListenerAdded; +public: + SwXDispatch(SwView& rView); + virtual ~SwXDispatch() override; + + virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs ) override; + virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) override; + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) override; + + //XSelectionChangeListener + virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override; + + //XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + static const char* GetDBChangeURL(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/unomailmerge.hxx b/sw/source/uibase/inc/unomailmerge.hxx new file mode 100644 index 000000000..722d80448 --- /dev/null +++ b/sw/source/uibase/inc/unomailmerge.hxx @@ -0,0 +1,175 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_UNOMAILMERGE_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_UNOMAILMERGE_HXX + +#include <cppuhelper/implbase.hxx> +#include <comphelper/interfacecontainer2.hxx> +#include <comphelper/interfacecontainer3.hxx> +#include <comphelper/multiinterfacecontainer3.hxx> + +#include <com/sun/star/task/XJob.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/text/XMailMergeBroadcaster.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <svl/itemprop.hxx> +#include <sfx2/objsh.hxx> + +namespace com::sun::star { + + namespace sdbc { + class XResultSet; + class XConnection; + } + namespace frame { + class XModel; + } + namespace lang { + class XMultiServiceFactory; + } + namespace text { + class XMailMergeListener; + struct MailMergeEvent; + } + namespace beans{ + struct PropertyValue; + } + +} + +typedef comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XPropertyChangeListener, sal_Int32> + OPropertyListenerContainerHelper; + +class SwDBManager; +class MailMergeExecuteFinalizer; + +/** + * Gives UNO access to the global mail merge functionality, via the com.sun.star.text.MailMerge + * service. + */ +class SwXMailMerge final : + public cppu::WeakImplHelper + < + css::task::XJob, + css::util::XCancellable, + css::beans::XPropertySet, + css::text::XMailMergeBroadcaster, + css::lang::XComponent, + css::lang::XServiceInfo + > +{ + friend class MailMergeExecuteFinalizer; + + comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> m_aEvtListeners; + comphelper::OInterfaceContainerHelper2 m_aMergeListeners; + OPropertyListenerContainerHelper m_aPropListeners; + + const SfxItemPropertySet* m_pPropSet; + + SfxObjectShellRef m_xDocSh; // the document + + OUString m_aTmpFileName; + + // properties of mail merge service + css::uno::Sequence< css::uno::Any > m_aSelection; + css::uno::Reference< css::sdbc::XResultSet > m_xResultSet; + css::uno::Reference< css::sdbc::XConnection > m_xConnection; + css::uno::Reference< css::frame::XModel > m_xModel; + OUString m_aDataSourceName; + OUString m_aDataCommand; + OUString m_aFilter; + OUString m_aDocumentURL; + OUString m_aOutputURL; + OUString m_aFileNamePrefix; + sal_Int32 m_nDataCommandType; + sal_Int16 m_nOutputType; + bool m_bEscapeProcessing; + bool m_bSinglePrintJobs; + bool m_bFileNameFromColumn; + + OUString m_sInServerPassword; + OUString m_sOutServerPassword; + OUString m_sSubject; + OUString m_sAddressFromColumn; + OUString m_sMailBody; + OUString m_sAttachmentName; + OUString m_sAttachmentFilter; + css::uno::Sequence< OUString > m_aCopiesTo; + css::uno::Sequence< OUString > m_aBlindCopiesTo; + bool m_bSendAsHTML; + bool m_bSendAsAttachment; + + css::uno::Sequence< css::beans::PropertyValue > m_aPrintSettings; + + bool m_bSaveAsSingleFile; + OUString m_sSaveFilter; + OUString m_sSaveFilterOptions; + css::uno::Sequence< css::beans::PropertyValue > m_aSaveFilterData; + + bool m_bDisposing; + SwDBManager *m_pMgr; + + void launchEvent( const css::beans::PropertyChangeEvent &rEvt ) const; + + SwXMailMerge( const SwXMailMerge & ) = delete; + SwXMailMerge & operator = ( const SwXMailMerge & ) = delete; + + virtual ~SwXMailMerge() override; +public: + SwXMailMerge(); + + void LaunchMailMergeEvent( const css::text::MailMergeEvent &rData ) const; + + // XJob + virtual css::uno::Any SAL_CALL execute( const css::uno::Sequence< css::beans::NamedValue >& Arguments ) override; + + // XCancellable + virtual void SAL_CALL cancel() override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XMailMergeBroadcaster + virtual void SAL_CALL addMailMergeEventListener( const css::uno::Reference< css::text::XMailMergeListener >& xListener ) override; + virtual void SAL_CALL removeMailMergeEventListener( const css::uno::Reference< css::text::XMailMergeListener >& xListener ) override; + + // XComponent + virtual void SAL_CALL dispose( ) override; + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/unomod.hxx b/sw/source/uibase/inc/unomod.hxx new file mode 100644 index 000000000..758677f10 --- /dev/null +++ b/sw/source/uibase/inc/unomod.hxx @@ -0,0 +1,139 @@ +/* -*- 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 + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/view/XPrintSettingsSupplier.hpp> +#include <com/sun/star/view/XViewSettingsSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <cppuhelper/implbase.hxx> +#include <comphelper/ChainablePropertySet.hxx> +#include <tools/fldunit.hxx> + +class SwView; +class SwViewOption; +class SwPrintData; +class SwDoc; + +css::uno::Reference< css::uno::XInterface > SAL_CALL SwXModule_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & ); + +class SwXModule final : public cppu::WeakImplHelper +< + css::view::XViewSettingsSupplier, + css::view::XPrintSettingsSupplier, + css::lang::XServiceInfo +> +{ + + css::uno::Reference< css::beans::XPropertySet > mxViewSettings; + css::uno::Reference< css::beans::XPropertySet > mxPrintSettings; + + virtual ~SwXModule() override; +public: + SwXModule(); + + //XViewSettings + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getViewSettings() override; + + //XPrintSettings + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getPrintSettings() override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; +}; + +enum class SwXPrintSettingsType +{ + Module, + Document +}; + +class SwXPrintSettings final : public comphelper::ChainablePropertySet +{ + friend class SwXDocumentSettings; + + SwXPrintSettingsType meType; + SwPrintData * mpPrtOpt; + SwDoc *mpDoc; + + virtual void _preSetValues () override; + virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const css::uno::Any &rValue ) override; + virtual void _postSetValues () override; + + virtual void _preGetValues () override; + + virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, css::uno::Any & rValue ) override; + virtual void _postGetValues () override; + + virtual ~SwXPrintSettings() + noexcept override; +public: + SwXPrintSettings( SwXPrintSettingsType eType, SwDoc * pDoc = nullptr ); + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; +}; + +/** + * Implements com.sun.star.text.ViewSettings: UNO access to per-view settings (e.g. if formatting + * marks are visible or not.) + */ +class SwXViewSettings final : public comphelper::ChainablePropertySet +{ + friend class SwXDocumentSettings; + + SwView* m_pView; + std::unique_ptr<SwViewOption> mpViewOption; + const SwViewOption* mpConstViewOption; + bool m_bObjectValid:1, mbApplyZoom; + + FieldUnit m_eHRulerUnit; + bool mbApplyHRulerMetric; + FieldUnit m_eVRulerUnit; + bool mbApplyVRulerMetric; + + virtual void _preSetValues () override; + virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const css::uno::Any &rValue ) override; + virtual void _postSetValues() override; + + virtual void _preGetValues () override; + virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, css::uno::Any & rValue ) override; + virtual void _postGetValues () override; + + virtual ~SwXViewSettings() + noexcept override; +public: + SwXViewSettings(SwView* pView); + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + bool IsValid() const {return m_bObjectValid;} + void Invalidate() {m_bObjectValid = false;} +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/unotools.hxx b/sw/source/uibase/inc/unotools.hxx new file mode 100644 index 000000000..347962572 --- /dev/null +++ b/sw/source/uibase/inc/unotools.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_SW_SOURCE_UIBASE_INC_UNOTOOLS_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_UNOTOOLS_HXX + +#include <sal/config.h> + +#include <string_view> + +#include <vcl/idle.hxx> +#include <vcl/weld.hxx> +#include <vcl/customweld.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/text/XTextCursor.hpp> +#include <swdllapi.h> + +#define EX_SHOW_ONLINE_LAYOUT 0x01 +// hard zoom value +#define EX_SHOW_BUSINESS_CARDS 0x02 +//don't modify page size +#define EX_SHOW_DEFAULT_PAGE 0x04 +//replace sample toc strings in the template to localized versions +#define EX_LOCALIZE_TOC_STRINGS 0x08 + +class SwView; + +class SW_DLLPUBLIC SwOneExampleFrame final : public weld::CustomWidgetController +{ + ScopedVclPtr<VirtualDevice> m_xVirDev; + css::uno::Reference< css::frame::XModel > m_xModel; + css::uno::Reference< css::frame::XController > m_xController; + css::uno::Reference< css::text::XTextCursor > m_xCursor; + + Idle m_aLoadedIdle; + Link<SwOneExampleFrame&,void> m_aInitializedLink; + + OUString m_sArgumentURL; + + SwView* m_pModuleView; + + sal_uInt32 m_nStyleFlags; + + bool m_bIsInitialized; + + DECL_DLLPRIVATE_LINK( TimeoutHdl, Timer*, void ); + void PopupHdl(std::string_view rId); + + SAL_DLLPRIVATE void CreateControl(); + SAL_DLLPRIVATE void DisposeControl(); + +public: + SwOneExampleFrame(sal_uInt32 nStyleFlags, + const Link<SwOneExampleFrame&,void>* pInitializedLink, + const OUString* pURL = nullptr); + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + virtual bool Command(const CommandEvent& rCEvt) override; + virtual ~SwOneExampleFrame() override; + + css::uno::Reference< css::frame::XModel > & GetModel() {return m_xModel;} + css::uno::Reference< css::text::XTextCursor > & GetTextCursor() {return m_xCursor;} + + void ClearDocument(); + + bool IsInitialized() const {return m_bIsInitialized;} + + bool CreatePopup(const Point& rPt); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/unotxvw.hxx b/sw/source/uibase/inc/unotxvw.hxx new file mode 100644 index 000000000..9608ed619 --- /dev/null +++ b/sw/source/uibase/inc/unotxvw.hxx @@ -0,0 +1,257 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_UNOTXVW_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_UNOTXVW_HXX + +#include <sfx2/sfxbasecontroller.hxx> +#include <comphelper/interfacecontainer3.hxx> +#include <com/sun/star/text/XTextViewCursor.hpp> +#include <com/sun/star/text/XTextViewCursorSupplier.hpp> +#include <com/sun/star/text/XTextViewTextRangeSupplier.hpp> +#include <com/sun/star/text/XRubySelection.hpp> +#include <com/sun/star/view/XFormLayerAccess.hpp> +#include <com/sun/star/view/XScreenCursor.hpp> +#include <com/sun/star/view/XViewSettingsSupplier.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/view/XLineCursor.hpp> +#include <com/sun/star/view/XViewCursor.hpp> +#include <com/sun/star/text/XPageCursor.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/datatransfer/XTransferableSupplier.hpp> +#include <com/sun/star/datatransfer/XTransferableTextSupplier.hpp> +#include <cppuhelper/implbase.hxx> +#include <svl/itemprop.hxx> +#include <TextCursorHelper.hxx> +#include <comphelper/uno3.hxx> + +#include <sfx2/objsh.hxx> + +class SdrObject; +class SwView; + +class SwXTextView final : + public css::view::XSelectionSupplier, + public css::lang::XServiceInfo, + public css::view::XFormLayerAccess, + public css::text::XTextViewCursorSupplier, + public css::text::XTextViewTextRangeSupplier, + public css::text::XRubySelection, + public css::view::XViewSettingsSupplier, + public css::beans::XPropertySet, + public css::datatransfer::XTransferableSupplier, + public css::datatransfer::XTransferableTextSupplier, + public SfxBaseController +{ + ::comphelper::OInterfaceContainerHelper3<css::view::XSelectionChangeListener> m_SelChangedListeners; + + SwView* m_pView; + const SfxItemPropertySet* m_pPropSet; // property map for SwXTextView properties + // (not related to mxViewSettings!) + + css::uno::Reference< css::beans::XPropertySet > mxViewSettings; + css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor; + + SdrObject* GetControl( + const css::uno::Reference< css::awt::XControlModel > & Model, + css::uno::Reference< css::awt::XControl >& xToFill ); + + virtual ~SwXTextView() override; +public: + SwXTextView(SwView* pSwView); + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual void SAL_CALL acquire( ) noexcept override; + virtual void SAL_CALL release( ) noexcept override; + + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + + //XSelectionSupplier + virtual css::uno::Any SAL_CALL getSelection() override; + virtual sal_Bool SAL_CALL select(const css::uno::Any& rInterface) override; + virtual void SAL_CALL addSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > & xListener) override; + virtual void SAL_CALL removeSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > & xListener) override; + + // XFormLayerAccess + virtual css::uno::Reference< css::form::runtime::XFormController > SAL_CALL getFormController( const css::uno::Reference< css::form::XForm >& Form ) override; + virtual sal_Bool SAL_CALL isFormDesignMode( ) override; + virtual void SAL_CALL setFormDesignMode( sal_Bool DesignMode ) override; + + // XControlAccess + virtual css::uno::Reference< css::awt::XControl > SAL_CALL getControl(const css::uno::Reference< css::awt::XControlModel > & Model) override; + + //XTextViewCursorSupplier + virtual css::uno::Reference< css::text::XTextViewCursor > SAL_CALL getViewCursor() override; + + // XTextViewTextRangeSupplier + virtual css::uno::Reference<css::text::XTextRange> + SAL_CALL createTextRangeByPixelPosition(const css::awt::Point& rPixelPosition) override; + + //XViewSettings + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getViewSettings() override; + + //XRubySelection + virtual css::uno::Sequence< + css::uno::Sequence< css::beans::PropertyValue > > SAL_CALL getRubyList( sal_Bool bAutomatic ) override; + + virtual void SAL_CALL setRubyList( + const css::uno::Sequence< + css::uno::Sequence< css::beans::PropertyValue > >& RubyList, sal_Bool bAutomatic ) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + //XTransferableSupplier + virtual css::uno::Reference< css::datatransfer::XTransferable > SAL_CALL getTransferable( ) override; + virtual void SAL_CALL insertTransferable( const css::uno::Reference< css::datatransfer::XTransferable >& xTrans ) override; + + // XTransferableTextSupplier + virtual css::uno::Reference<css::datatransfer::XTransferable> SAL_CALL getTransferableForTextRange(css::uno::Reference<css::text::XTextRange> const& xTextRange) override; + + void NotifySelChanged(); + void NotifyDBChanged(); + + SwView* GetView() {return m_pView;} + void Invalidate(); + + // temporary document used for PDF export of selections/multi-selections + SfxObjectShellLock BuildTmpSelectionDoc(); +}; + +typedef cppu::WeakImplHelper< + css::text::XTextViewCursor, + css::lang::XServiceInfo, + css::text::XPageCursor, + css::view::XScreenCursor, + css::view::XViewCursor, + css::view::XLineCursor, + css::beans::XPropertySet, + css::beans::XPropertyState + > SwXTextViewCursor_Base; + +class SwXTextViewCursor final: public SwXTextViewCursor_Base, public OTextCursorHelper +{ + SwView* m_pView; + const SfxItemPropertySet* m_pPropSet; + bool IsTextSelection( bool bAllowTables = true ) const; + virtual ~SwXTextViewCursor() override; + +public: + SwXTextViewCursor(SwView* pVw); + + DECLARE_XINTERFACE() + + //XTextViewCursor + virtual sal_Bool SAL_CALL isVisible() override; + virtual void SAL_CALL setVisible(sal_Bool bVisible) override; + virtual css::awt::Point SAL_CALL getPosition() override; + + //XTextCursor - new + virtual void SAL_CALL collapseToStart() override; + virtual void SAL_CALL collapseToEnd() override; + virtual sal_Bool SAL_CALL isCollapsed() override; + virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) override; + virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) override; + virtual void SAL_CALL gotoStart( sal_Bool bExpand ) override; + virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) override; + virtual void SAL_CALL gotoRange( const css::uno::Reference< css::text::XTextRange >& xRange, sal_Bool bExpand ) override; + + //XPageCursor + virtual sal_Bool SAL_CALL jumpToFirstPage() override; + virtual sal_Bool SAL_CALL jumpToLastPage() override; + virtual sal_Bool SAL_CALL jumpToPage(sal_Int16 nPage) override; + virtual sal_Bool SAL_CALL jumpToNextPage() override; + virtual sal_Bool SAL_CALL jumpToPreviousPage() override; + virtual sal_Bool SAL_CALL jumpToEndOfPage() override; + virtual sal_Bool SAL_CALL jumpToStartOfPage() override; + virtual sal_Int16 SAL_CALL getPage() override; + + //XTextRange + virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override; + virtual OUString SAL_CALL getString() override; + virtual void SAL_CALL setString(const OUString& aString) override; + + //XScreenCursor + virtual sal_Bool SAL_CALL screenDown() override; + virtual sal_Bool SAL_CALL screenUp() override; + + //XViewCursor + virtual sal_Bool SAL_CALL goDown(sal_Int16 nCount, sal_Bool bExpand) override; + virtual sal_Bool SAL_CALL goUp(sal_Int16 nCount, sal_Bool bExpand) override; + + //XLineCursor + virtual sal_Bool SAL_CALL isAtStartOfLine() override; + virtual sal_Bool SAL_CALL isAtEndOfLine() override; + virtual void SAL_CALL gotoEndOfLine(sal_Bool bExpand) override; + virtual void SAL_CALL gotoStartOfLine(sal_Bool bExpand) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XPropertyState + virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override; + virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override; + virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + void Invalidate(){m_pView = nullptr;} + + // ITextCursorHelper + virtual const SwPaM* GetPaM() const override; + virtual SwPaM* GetPaM() override; + virtual const SwDoc* GetDoc() const override; + virtual SwDoc* GetDoc() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/usrpref.hxx b/sw/source/uibase/inc/usrpref.hxx new file mode 100644 index 000000000..1464c90bc --- /dev/null +++ b/sw/source/uibase/inc/usrpref.hxx @@ -0,0 +1,273 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_USRPREF_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_USRPREF_HXX + +#include <memory> +#include <unotools/configitem.hxx> +#include <fldupde.hxx> +#include <viewopt.hxx> +#include <tools/fldunit.hxx> + +class SwMasterUsrPref; + +class SwContentViewConfig final : public utl::ConfigItem +{ +private: + SwMasterUsrPref& m_rParent; + bool m_bWeb; + + css::uno::Sequence<OUString> GetPropertyNames() const; + + virtual void ImplCommit() override; + +public: + SwContentViewConfig(bool bWeb, SwMasterUsrPref& rParent); + virtual ~SwContentViewConfig() override; + + // utl::ConfigItem + virtual void Notify( const css::uno::Sequence< OUString > &rPropertyNames ) override; + + void Load(); + using ConfigItem::SetModified; +}; + +class SwLayoutViewConfig final : public utl::ConfigItem +{ +private: + SwMasterUsrPref& m_rParent; + bool m_bWeb; + + css::uno::Sequence<OUString> GetPropertyNames() const; + + virtual void ImplCommit() override; + +public: + SwLayoutViewConfig(bool bWeb, SwMasterUsrPref& rParent); + virtual ~SwLayoutViewConfig() override; + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + void Load(); + using ConfigItem::SetModified; +}; + +class SwGridConfig final : public utl::ConfigItem +{ +private: + SwMasterUsrPref& m_rParent; + + static css::uno::Sequence<OUString> GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SwGridConfig(bool bWeb, SwMasterUsrPref& rParent); + virtual ~SwGridConfig() override; + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + void Load(); + using ConfigItem::SetModified; +}; + +class SwCursorConfig final : public utl::ConfigItem +{ +private: + SwMasterUsrPref& m_rParent; + + static css::uno::Sequence<OUString> GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SwCursorConfig(SwMasterUsrPref& rParent); + virtual ~SwCursorConfig() override; + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + void Load(); + using ConfigItem::SetModified; +}; + +class SwWebColorConfig final : public utl::ConfigItem +{ +private: + SwMasterUsrPref& m_rParent; + css::uno::Sequence<OUString> m_aPropNames; + + virtual void ImplCommit() override; + +public: + SwWebColorConfig(SwMasterUsrPref& rParent); + virtual ~SwWebColorConfig() override; + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + void Load(); + using ConfigItem::SetModified; +}; + +class SwMasterUsrPref : public SwViewOption +{ + friend class SwContentViewConfig; + friend class SwLayoutViewConfig; + friend class SwGridConfig; + friend class SwCursorConfig; + friend class SwWebColorConfig; + + SwFieldUpdateFlags m_eFieldUpdateFlags; //update of fields and charts + sal_Int32 m_nLinkUpdateMode; + FieldUnit m_eUserMetric; + FieldUnit m_eHScrollMetric; + bool m_bIsHScrollMetricSet; + FieldUnit m_eVScrollMetric; + bool m_bIsVScrollMetricSet; + + sal_Int32 m_nDefTabInMm100; //default tab stop distance, in 1/100 mm + + bool m_bIsSquaredPageMode; //default page mode for text grid + bool m_bIsAlignMathObjectsToBaseline; + + SwContentViewConfig m_aContentConfig; + SwLayoutViewConfig m_aLayoutConfig; + SwGridConfig m_aGridConfig; + SwCursorConfig m_aCursorConfig; + std::unique_ptr<SwWebColorConfig> m_pWebColorConfig; + + bool m_bApplyCharUnit; // apply_char_unit +public: + SwMasterUsrPref(bool bWeb); + ~SwMasterUsrPref(); + + void SetUsrPref(const SwViewOption &rCopy); + + void SetModified() + { + m_aContentConfig.SetModified(); + m_aLayoutConfig.SetModified(); + m_aGridConfig.SetModified(); + m_aCursorConfig.SetModified(); + if(m_pWebColorConfig) + m_pWebColorConfig->SetModified(); + } + + void SetUpdateLinkMode(sal_Int32 nSet, bool bNoModify = false) + { + m_nLinkUpdateMode = nSet; + if(!bNoModify) + m_aContentConfig.SetModified(); + } + sal_Int32 GetUpdateLinkMode() const {return m_nLinkUpdateMode; } + + void SetUpdateFields(bool bSet) + { + if(bSet && m_eFieldUpdateFlags == AUTOUPD_OFF) + { + m_eFieldUpdateFlags = AUTOUPD_FIELD_ONLY; + } + else if(!bSet) + { + m_eFieldUpdateFlags = AUTOUPD_OFF; + } + }; + bool IsUpdateFields()const {return m_eFieldUpdateFlags != AUTOUPD_OFF; } + + SwFieldUpdateFlags GetFieldUpdateFlags()const {return m_eFieldUpdateFlags;} + void SetFieldUpdateFlags(SwFieldUpdateFlags eSet) + { + m_eFieldUpdateFlags = eSet; + m_aContentConfig.SetModified(); + } + + void SetUpdateCharts(bool bSet) + { + if(bSet) + { + m_eFieldUpdateFlags = AUTOUPD_FIELD_AND_CHARTS; + } + else if(m_eFieldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS) + { + m_eFieldUpdateFlags = AUTOUPD_FIELD_ONLY; + } + }; + bool IsUpdateCharts()const {return m_eFieldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS; } + + FieldUnit GetMetric() const { return m_eUserMetric;} + void SetMetric(FieldUnit eSet, bool bNoModify = false) + { + m_eUserMetric = eSet; + if(!bNoModify) + m_aLayoutConfig.SetModified(); + } + + bool IsHScrollMetric()const {return m_bIsHScrollMetricSet;} + FieldUnit GetHScrollMetric() const { return m_bIsHScrollMetricSet ? m_eHScrollMetric : m_eUserMetric;} + void SetHScrollMetric(FieldUnit eSet) + { + m_eHScrollMetric = eSet; m_bIsHScrollMetricSet = true; + m_aLayoutConfig.SetModified(); + } + + bool IsVScrollMetric()const {return m_bIsVScrollMetricSet;} + FieldUnit GetVScrollMetric() const { return m_bIsVScrollMetricSet ? m_eVScrollMetric : m_eUserMetric;} + void SetVScrollMetric(FieldUnit eSet) + { + m_eVScrollMetric = eSet; m_bIsVScrollMetricSet = true; + m_aLayoutConfig.SetModified(); + } + + bool IsApplyCharUnit() const + { + return m_bApplyCharUnit; + } + void SetApplyCharUnit(bool bSet, bool noModify = false) + { + m_bApplyCharUnit = bSet; + if (!noModify) { + m_aLayoutConfig.SetModified(); + } + } + + sal_Int32 GetDefTabInMm100() const { return m_nDefTabInMm100;} + void SetDefTabInMm100( sal_Int32 nSet, bool bNoModify = false ) + { + m_nDefTabInMm100 = nSet; + if(!bNoModify) + m_aLayoutConfig.SetModified(); + } + + //default page mode for text grid + bool IsSquaredPageMode() const {return m_bIsSquaredPageMode;} + void SetDefaultPageMode( bool bVal, bool bNoModify = false ) + { + m_bIsSquaredPageMode = bVal; + if(!bNoModify) + m_aLayoutConfig.SetModified(); + } + + bool IsAlignMathObjectsToBaseline() const { return m_bIsAlignMathObjectsToBaseline; } + void SetAlignMathObjectsToBaseline( bool bVal, bool noModify = false ) + { + m_bIsAlignMathObjectsToBaseline = bVal; + if (!noModify) { + m_aLayoutConfig.SetModified(); + } + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/viewlayoutctrl.hxx b/sw/source/uibase/inc/viewlayoutctrl.hxx new file mode 100644 index 000000000..a13f9ff52 --- /dev/null +++ b/sw/source/uibase/inc/viewlayoutctrl.hxx @@ -0,0 +1,47 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_VIEWLAYOUTCTRL_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_VIEWLAYOUTCTRL_HXX + +#include <sfx2/stbitem.hxx> +#include <memory> + +class SwViewLayoutControl final : public SfxStatusBarControl +{ +private: + + struct SwViewLayoutControl_Impl; + std::unique_ptr<SwViewLayoutControl_Impl> mpImpl; + +public: + + SFX_DECL_STATUSBAR_CONTROL(); + + SwViewLayoutControl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb ); + virtual ~SwViewLayoutControl() override; + + virtual void StateChangedAtStatusBarControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; + virtual void Paint( const UserDrawEvent& rEvt ) override; + virtual bool MouseButtonDown( const MouseEvent & ) override; + virtual bool MouseMove( const MouseEvent & ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/watermarkdialog.hxx b/sw/source/uibase/inc/watermarkdialog.hxx new file mode 100644 index 000000000..57281a4d3 --- /dev/null +++ b/sw/source/uibase/inc/watermarkdialog.hxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_WATERMARKDIALOG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_WATERMARKDIALOG_HXX + +#include <sfx2/bindings.hxx> +#include <vcl/weld.hxx> +#include <svx/colorbox.hxx> +#include <sfx2/basedlgs.hxx> + +class SwWatermarkDialog final : public SfxDialogController +{ +public: + SwWatermarkDialog(weld::Window* pParent, SfxBindings& rBindings); + virtual ~SwWatermarkDialog() override; + + void InitFields(); + +private: + DECL_LINK(OKButtonHdl, weld::Button&, void); + + SfxBindings& m_rBindings; + + std::unique_ptr<weld::Entry> m_xTextInput; + std::unique_ptr<weld::Button> m_xOKButton; + std::unique_ptr<weld::ComboBox> m_xFont; + std::unique_ptr<weld::MetricSpinButton> m_xAngle; + std::unique_ptr<weld::MetricSpinButton> m_xTransparency; + std::unique_ptr<ColorListBox> m_xColor; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/source/uibase/inc/wformsh.hxx b/sw/source/uibase/inc/wformsh.hxx new file mode 100644 index 000000000..a29e0f940 --- /dev/null +++ b/sw/source/uibase/inc/wformsh.hxx @@ -0,0 +1,39 @@ +/* -*- 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 + +#include "drformsh.hxx" + +class SwWebDrawFormShell final : public SwDrawFormShell +{ +public: + SwWebDrawFormShell(SwView& rShell); + virtual ~SwWebDrawFormShell() override; + + SFX_DECL_INTERFACE(SW_WEBDRAWFORMSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/wfrmsh.hxx b/sw/source/uibase/inc/wfrmsh.hxx new file mode 100644 index 000000000..de87c8743 --- /dev/null +++ b/sw/source/uibase/inc/wfrmsh.hxx @@ -0,0 +1,41 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_WFRMSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_WFRMSH_HXX + +#include "frmsh.hxx" + +class SwWebFrameShell final : public SwFrameShell +{ +public: + SFX_DECL_INTERFACE(SW_WEBFRAMESHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwWebFrameShell(SwView& rView); + virtual ~SwWebFrameShell() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/wgrfsh.hxx b/sw/source/uibase/inc/wgrfsh.hxx new file mode 100644 index 000000000..937556a6b --- /dev/null +++ b/sw/source/uibase/inc/wgrfsh.hxx @@ -0,0 +1,39 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_WGRFSH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_WGRFSH_HXX + +#include "grfsh.hxx" + +class SwWebGrfShell final : public SwGrfShell +{ +public: + SwWebGrfShell(SwView& rShell); + virtual ~SwWebGrfShell() override; + + SFX_DECL_INTERFACE(SW_WEBGRFSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/wlistsh.hxx b/sw/source/uibase/inc/wlistsh.hxx new file mode 100644 index 000000000..556ebb8fd --- /dev/null +++ b/sw/source/uibase/inc/wlistsh.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "listsh.hxx" + +class SwWebListShell final : public SwListShell +{ +public: + SFX_DECL_INTERFACE(SW_WEBLISTSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwWebListShell(SwView& rView); + virtual ~SwWebListShell() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/wolesh.hxx b/sw/source/uibase/inc/wolesh.hxx new file mode 100644 index 000000000..497c952c7 --- /dev/null +++ b/sw/source/uibase/inc/wolesh.hxx @@ -0,0 +1,40 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_WOLESH_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_WOLESH_HXX + +#include "olesh.hxx" + +class SwWebOleShell final : public SwOleShell +{ +public: + SFX_DECL_INTERFACE(SW_WEBOLESHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwWebOleShell(SwView& rView); + virtual ~SwWebOleShell() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/wordcountctrl.hxx b/sw/source/uibase/inc/wordcountctrl.hxx new file mode 100644 index 000000000..8074253b3 --- /dev/null +++ b/sw/source/uibase/inc/wordcountctrl.hxx @@ -0,0 +1,36 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_WORDCOUNTCTRL_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_WORDCOUNTCTRL_HXX + +#include <sfx2/stbitem.hxx> + +/** +Word count status bar control for Writer. + +@remarks This is a simple status bar control of type SfxStringItem, and it has no custom +logic whatsoever. The actual updating of the word count string happens in +SwView::StateStatusLine (see sw/source/ui/uiview/view2.cxx). +*/ +class SwWordCountStatusBarControl final : public SfxStatusBarControl +{ +public: + SFX_DECL_STATUSBAR_CONTROL(); + + SwWordCountStatusBarControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb); + virtual ~SwWordCountStatusBarControl() override; + + virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/wordcountdialog.hxx b/sw/source/uibase/inc/wordcountdialog.hxx new file mode 100644 index 000000000..c5b23f0c5 --- /dev/null +++ b/sw/source/uibase/inc/wordcountdialog.hxx @@ -0,0 +1,76 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_WORDCOUNTDIALOG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_WORDCOUNTDIALOG_HXX +#include <sfx2/basedlgs.hxx> +struct SwDocStat; +#include <sfx2/childwin.hxx> +#include <swabstdlg.hxx> + +class SwWordCountFloatDlg final : public SfxModelessDialogController +{ + void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc); + void showCJK(bool bShowCJK); + void showStandardizedPages(bool bShowStandardizedPages); + + std::unique_ptr<weld::Label> m_xCurrentWordFT; + std::unique_ptr<weld::Label> m_xCurrentCharacterFT; + std::unique_ptr<weld::Label> m_xCurrentCharacterExcludingSpacesFT; + std::unique_ptr<weld::Label> m_xCurrentCjkcharsFT; + std::unique_ptr<weld::Label> m_xCurrentStandardizedPagesFT; + std::unique_ptr<weld::Label> m_xDocWordFT; + std::unique_ptr<weld::Label> m_xDocCharacterFT; + std::unique_ptr<weld::Label> m_xDocCharacterExcludingSpacesFT; + std::unique_ptr<weld::Label> m_xDocCjkcharsFT; + std::unique_ptr<weld::Label> m_xDocStandardizedPagesFT; + std::unique_ptr<weld::Label> m_xCjkcharsLabelFT; + std::unique_ptr<weld::Label> m_xCjkcharsLabelFT2; + std::unique_ptr<weld::Label> m_xStandardizedPagesLabelFT; + std::unique_ptr<weld::Label> m_xStandardizedPagesLabelFT2; + +public: + SwWordCountFloatDlg(SfxBindings* pBindings, + SfxChildWindow* pChild, + weld::Window *pParent, + SfxChildWinInfo const * pInfo); + virtual ~SwWordCountFloatDlg() override; + void UpdateCounts(); + + void SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat); +}; + +class SwWordCountWrapper final : public SfxChildWindow +{ + VclPtr<AbstractSwWordCountFloatDlg> m_xAbstDlg; + +public: + SwWordCountWrapper( vcl::Window *pParentWindow, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo ); + SFX_DECL_CHILDWINDOW_WITHID(SwWordCountWrapper); + + virtual ~SwWordCountWrapper() override; + void UpdateCounts(); + void SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx new file mode 100644 index 000000000..5da3c3443 --- /dev/null +++ b/sw/source/uibase/inc/workctrl.hxx @@ -0,0 +1,195 @@ +/* -*- 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_SW_SOURCE_UIBASE_INC_WORKCTRL_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_WORKCTRL_HXX + +#include <sfx2/tbxctrl.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/InterimItemWindow.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> + +class PopupMenu; +class SwView; + +using namespace ::com::sun::star; + +// double entry! hrc and hxx +// these Ids say what the buttons below the scrollbar are doing +#define NID_START 20000 +#define NID_TBL 20000 +#define NID_FRM 20001 +#define NID_PGE 20002 +#define NID_DRW 20003 +#define NID_CTRL 20004 +#define NID_REG 20005 +#define NID_BKM 20006 +#define NID_GRF 20007 +#define NID_OLE 20008 +#define NID_OUTL 20009 +#define NID_SEL 20010 +#define NID_FTN 20011 +#define NID_MARK 20012 +#define NID_POSTIT 20013 +#define NID_SRCH_REP 20014 +#define NID_INDEX_ENTRY 20015 +#define NID_TABLE_FORMULA 20016 +#define NID_TABLE_FORMULA_ERROR 20017 +#define NID_RECENCY 20018 +#define NID_FIELD 20019 +#define NID_FIELD_BYTYPE 20020 +#define NID_COUNT 21 + +class SwTbxAutoTextCtrl final : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SwTbxAutoTextCtrl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); + virtual ~SwTbxAutoTextCtrl() override; + + virtual void CreatePopupWindow() override; + virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState ) override; + + DECL_STATIC_LINK(SwTbxAutoTextCtrl, PopupHdl, Menu*, bool); +}; + +class SwPreviewZoomControl final : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SwPreviewZoomControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); + virtual ~SwPreviewZoomControl() override; + + virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState ) override; + + virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window *pParent ) override; +}; + +class SwJumpToSpecificPageControl final : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SwJumpToSpecificPageControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); + virtual ~SwJumpToSpecificPageControl() override; + + virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window *pParent ) override; +}; + +class NavElementToolBoxControl; + +class NavElementBox_Base +{ +public: + NavElementBox_Base(std::unique_ptr<weld::ComboBox> xComboBox, + const uno::Reference<frame::XFrame>& xFrame); + + virtual ~NavElementBox_Base() {} + + void set_sensitive(bool bSensitive) {m_xComboBox->set_sensitive(bSensitive);} + + weld::ComboBox* GetComboBox() {return m_xComboBox.get();} + + void UpdateBox(); + + +protected: + std::unique_ptr<weld::ComboBox> m_xComboBox; + uno::Reference< frame::XFrame > m_xFrame; + bool m_bRelease; + + virtual bool DoKeyInput(const KeyEvent& /*rKEvt*/); + + DECL_STATIC_LINK(NavElementBox_Base, SelectHdl, weld::ComboBox&, void); + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + + void ReleaseFocus_Impl(); +}; + +class NavElementBox_Impl final : public InterimItemWindow, public NavElementBox_Base +{ +public: + NavElementBox_Impl(vcl::Window* pParent, + const uno::Reference<frame::XFrame>& xFrame); + + virtual void dispose() override + { + m_xComboBox.reset(); + InterimItemWindow::dispose(); + } + + virtual void GetFocus() override + { + if (m_xComboBox) + m_xComboBox->grab_focus(); + InterimItemWindow::GetFocus(); + } + + virtual bool DoKeyInput(const KeyEvent& rKEvt) override; + + virtual ~NavElementBox_Impl() override + { + disposeOnce(); + } +}; + +class NavElementToolBoxControl : public svt::ToolboxController, public lang::XServiceInfo +{ +public: + explicit NavElementToolBoxControl( + const css::uno::Reference< css::uno::XComponentContext >& rServiceManager ); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XComponent + virtual void SAL_CALL dispose() override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) override; + virtual void SAL_CALL click() override; + virtual void SAL_CALL doubleClick() override; + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override; + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) override; + + weld::ComboBox* GetComboBox() {return m_pBox->GetComboBox();} + +private: + VclPtr<NavElementBox_Impl> m_xVclBox; + std::unique_ptr<NavElementBox_Base> m_xWeldBox; + NavElementBox_Base* m_pBox; +}; + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/wrap.hxx b/sw/source/uibase/inc/wrap.hxx new file mode 100644 index 000000000..c947eee3a --- /dev/null +++ b/sw/source/uibase/inc/wrap.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 . + */ + +#pragma once + +#include <sfx2/tabdlg.hxx> +#include <sfx2/basedlgs.hxx> +#include <svx/swframetypes.hxx> + +class SfxItemSet; +class SwWrtShell; + +class SwWrapDlg final : public SfxSingleTabDialogController +{ +public: + SwWrapDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pSh, bool bDrawMode); +}; + +// circulation TabPage +class SwWrapTabPage final : public SfxTabPage +{ + RndStdIds m_nAnchorId; + sal_uInt16 m_nHtmlMode; + + SwWrtShell* m_pWrtSh; + + bool m_bFormat; + bool m_bNew; + bool m_bHtmlMode; + bool m_bDrawMode; + bool m_bContourImage; + + // WRAPPING + std::unique_ptr<weld::Image> m_xNoWrapImg; + std::unique_ptr<weld::RadioButton> m_xNoWrapRB; + std::unique_ptr<weld::Image> m_xWrapLeftImg; + std::unique_ptr<weld::RadioButton> m_xWrapLeftRB; + std::unique_ptr<weld::Image> m_xWrapRightImg; + std::unique_ptr<weld::RadioButton> m_xWrapRightRB; + std::unique_ptr<weld::Image> m_xWrapParallelImg; + std::unique_ptr<weld::RadioButton> m_xWrapParallelRB; + std::unique_ptr<weld::Image> m_xWrapThroughImg; + std::unique_ptr<weld::RadioButton> m_xWrapThroughRB; + std::unique_ptr<weld::Image> m_xIdealWrapImg; + std::unique_ptr<weld::RadioButton> m_xIdealWrapRB; + + // MARGIN + std::unique_ptr<weld::MetricSpinButton> m_xLeftMarginED; + std::unique_ptr<weld::MetricSpinButton> m_xRightMarginED; + std::unique_ptr<weld::MetricSpinButton> m_xTopMarginED; + std::unique_ptr<weld::MetricSpinButton> m_xBottomMarginED; + + // OPTIONS + std::unique_ptr<weld::CheckButton> m_xWrapAnchorOnlyCB; + std::unique_ptr<weld::CheckButton> m_xWrapTransparentCB; + std::unique_ptr<weld::CheckButton> m_xWrapOutlineCB; + std::unique_ptr<weld::CheckButton> m_xWrapOutsideCB; + std::unique_ptr<weld::CheckButton> m_xAllowOverlapCB; + + void SetImages(); + virtual void ActivatePage(const SfxItemSet& rSet) override; + virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; + + DECL_LINK(RangeModifyHdl, weld::MetricSpinButton&, void); + DECL_LINK(WrapTypeHdl, weld::Toggleable&, void); + DECL_LINK(ContourHdl, weld::Toggleable&, void); + + static const WhichRangesContainer m_aWrapPageRg; + +public: + SwWrapTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet); + static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet); + virtual ~SwWrapTabPage() override; + + virtual bool FillItemSet(SfxItemSet *rSet) override; + virtual void Reset(const SfxItemSet *rSet) override; + + static WhichRangesContainer GetRanges() { return m_aWrapPageRg; } + void SetNewFrame(bool bNewFrame) { m_bNew = bNewFrame; } + void SetFormatUsed(bool bFormat, bool bDrawMode) { m_bFormat = bFormat; m_bDrawMode = bDrawMode; } + void SetShell(SwWrtShell* pSh) { m_pWrtSh = pSh; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx new file mode 100644 index 000000000..619d7e17b --- /dev/null +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -0,0 +1,704 @@ +/* -*- 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 + +#include <swdllapi.h> +#include <fesh.hxx> +#include <swurl.hxx> +#include <IMark.hxx> +#include "navmgr.hxx" +#include <optional> +#include <com/sun/star/embed/EmbedVerbs.hpp> +#include <o3tl/typed_flags_set.hxx> +#include <svx/swframetypes.hxx> +#include <vcl/weld.hxx> + +#include <doc.hxx> +#include <docsh.hxx> +#include <viewopt.hxx> + +namespace vcl { class Window; } +class SbxArray; +class SwFlyFrameAttrMgr; +class SwField; +class SwTOXBase; +class SwView; +class SvGlobalName; +class SwInputFieldList; +class SwSectionData; +class Timer; +class SvxMacro; +class SwFormatINetFormat; +class SvxAutoCorrect; +class NaviContentBookmark; +struct SwCallMouseEvent; +class SfxStringListItem; +enum class SvMacroItemId : sal_uInt16; +class SwFieldMgr; +class SfxRequest; +enum class SwLineBreakClear; +class SwContentControl; +enum class SwContentControlType; + +namespace i18nutil { + struct SearchOptions2; +} + +enum class SelectionType : sal_Int32 +{ + NONE = 0x000000, + Text = CNT_TXT, // text, never frames too 0x0001 + Graphic = CNT_GRF, // graphic 0x0002 + Ole = CNT_OLE, // OLE 0x0010 + Frame = 0x000020, // frame, no content type + NumberList = 0x000040, // NumList + Table = 0x000080, // cursor is in table + TableCell = 0x000100, // table cells are selected + DrawObject = 0x000200, // drawing objects (rectangle, circle...) + DrawObjectEditMode = 0x000400, // draw-textobjects in edit mode + Ornament = 0x000800, // edit ornament objects + DbForm = 0x001000, // drawing objects: DB-Forms + FormControl = 0x002000, // a form control is focused. Neither set nor evaluated by the SwWrtShell itself, only by its clients. + Media = 0x004000, // Media object + ExtrudedCustomShape = 0x008000, // extruded custom shape + FontWork = 0x010000, // fontwork + PostIt = 0x020000, // annotation + TableRow = 0x040000, // table rows are selected + TableCol = 0x080000, // table columns are selected + All = 0x0ffff3, +}; +namespace o3tl { + template<> struct typed_flags<SelectionType> : is_typed_flags<SelectionType, 0x0ffff3> {}; +} + +/** Used by the UI to modify the document model. + +Eg. the Insert() method will take the current cursor position, insert the +string, and take care of undo etc. +*/ +class SW_DLLPUBLIC SwWrtShell final : public SwFEShell +{ +private: + using SwCursorShell::Left; + using SwCursorShell::Right; + using SwCursorShell::Up; + using SwCursorShell::Down; + using SwCursorShell::LeftMargin; + using SwCursorShell::RightMargin; + using SwCursorShell::SelectTextAttr; + using SwCursorShell::GotoPage; + using SwFEShell::InsertObject; + using SwEditShell::AutoCorrect; + using SwCursorShell::GotoMark; + + typedef tools::Long (SwWrtShell::*SELECTFUNC)(const Point *, bool bProp ); + typedef void (SwWrtShell::*SELECTFUNC2)(const Point *, bool bProp ); + + SELECTFUNC2 m_fnDrag = &SwWrtShell::BeginDrag; + SELECTFUNC m_fnSetCursor = &SwWrtShell::SetCursor; + SELECTFUNC2 m_fnEndDrag = &SwWrtShell::DefaultEndDrag; + SELECTFUNC m_fnKillSel = &SwWrtShell::Ignore; + +public: + using SwCursorShell::GotoFootnoteAnchor; + using SwEditShell::Insert; + + tools::Long CallSetCursor(const Point* pPt, bool bProp) { return (this->*m_fnSetCursor)(pPt, bProp); } + void Drag (const Point* pPt, bool bProp) { (this->*m_fnDrag)(pPt, bProp); } + void EndDrag (const Point* pPt, bool bProp) { (this->*m_fnEndDrag)(pPt, bProp); } + tools::Long KillSelection(const Point* pPt, bool bProp) { return (this->*m_fnKillSel)(pPt, bProp); } + + bool IsSplitVerticalByDefault() const; + void SetSplitVerticalByDefault(bool value); + + // reset all selections + tools::Long ResetSelect( const Point *, bool ); + + // resets the cursorstack after movement with PageUp/-Down if a stack is built up + inline void ResetCursorStack(); + SelectionType GetSelectionType() const; + + bool IsModePushed() const { return nullptr != m_pModeStack; } + void PushMode(); + void PopMode(); + + void SttSelect(); + void EndSelect(); + bool IsInSelect() const { return m_bInSelect; } + void SetInSelect() { m_bInSelect = true; } + // is there a text- or frameselection? + bool HasSelection() const { return SwCursorShell::HasSelection() || + IsMultiSelection() || IsSelFrameMode() || IsObjSelected(); } + bool Pop(SwCursorShell::PopMode, ::std::unique_ptr<SwCallLink> const pLink); + bool Pop(SwCursorShell::PopMode = SwCursorShell::PopMode::DeleteStack); + + void EnterStdMode(); + bool IsStdMode() const { return !m_bExtMode && !m_bAddMode && !m_bBlockMode; } + + void EnterExtMode(); + void LeaveExtMode(); + void ToggleExtMode(); + bool IsExtMode() const { return m_bExtMode; } + + void EnterAddMode(); + void LeaveAddMode(); + void ToggleAddMode(); + bool IsAddMode() const { return m_bAddMode; } + + void EnterBlockMode(); + void LeaveBlockMode(); + void ToggleBlockMode(); + bool IsBlockMode() const { return m_bBlockMode; } + + void SetInsMode( bool bOn = true ); + void ToggleInsMode() { SetInsMode( !m_bIns ); } + bool IsInsMode() const { return m_bIns; } + void SetRedlineFlagsAndCheckInsMode( RedlineFlags eMode ); + + void EnterSelFrameMode(const Point *pStartDrag = nullptr); + void LeaveSelFrameMode(); + bool IsSelFrameMode() const { return m_bLayoutMode; } + // reset selection of frames + void UnSelectFrame(); + + void Invalidate(); + + // select table cells for editing of formulas in the ribbonbar + inline void SelTableCells( const Link<SwWrtShell&,void> &rLink ); + inline void EndSelTableCells(); + + // leave per word or per line selection mode. Is usually called in MB-Up. + bool IsExtSel() const { return m_bSelWrd || m_bSelLn; } + + // query whether the active m_fnDrag pointer is set to BeginDrag + // is needed for MouseMove to work around bugs 55592/55931 + inline bool Is_FnDragEQBeginDrag() const; + + // base requests + bool IsEndWrd(); + bool IsSttOfPara() const { return IsSttPara(); } + bool IsEndOfPara() const { return IsEndPara(); } + + // select word / sentence + bool SelNearestWrd(); + bool SelWrd (const Point * = nullptr ); + // #i32329# Enhanced selection + void SelSentence (const Point *); + void SelPara (const Point *); + void SelAll(); + + // basecursortravelling +typedef bool (SwWrtShell::*FNSimpleMove)(); + bool SimpleMove( FNSimpleMove, bool bSelect ); + + bool Left ( sal_uInt16 nMode, bool bSelect, + sal_uInt16 nCount, bool bBasicCall, bool bVisual = false ); + bool Right ( sal_uInt16 nMode, bool bSelect, + sal_uInt16 nCount, bool bBasicCall, bool bVisual = false ); + bool Up ( bool bSelect, sal_uInt16 nCount = 1, bool bBasicCall = false ); + bool Down ( bool bSelect, sal_uInt16 nCount = 1, bool bBasicCall = false ); + void NxtWrd ( bool bSelect = false ) { SimpleMove( &SwWrtShell::NxtWrd_, bSelect ); } + bool PrvWrd ( bool bSelect = false ) { return SimpleMove( &SwWrtShell::PrvWrd_, bSelect ); } + + bool LeftMargin ( bool bSelect, bool bBasicCall ); + bool RightMargin( bool bSelect, bool bBasicCall ); + + bool StartOfSection( bool bSelect = false ); + bool EndOfSection ( bool bSelect = false ); + + bool SttNxtPg ( bool bSelect = false ); + void SttPrvPg ( bool bSelect = false ); + void EndNxtPg ( bool bSelect = false ); + bool EndPrvPg ( bool bSelect = false ); + bool SttPg ( bool bSelect = false ); + bool EndPg ( bool bSelect = false ); + bool SttPara ( bool bSelect = false ); + void EndPara ( bool bSelect = false ); + bool FwdPara () + { return SimpleMove( &SwWrtShell::FwdPara_, false/*bSelect*/ ); } + void BwdPara () + { SimpleMove( &SwWrtShell::BwdPara_, false/*bSelect*/ ); } + void FwdSentence( bool bSelect = false ) + { SimpleMove( &SwWrtShell::FwdSentence_, bSelect ); } + void BwdSentence( bool bSelect = false ) + { SimpleMove( &SwWrtShell::BwdSentence_, bSelect ); } + + // #i20126# Enhanced table selection + bool SelectTableRowCol( const Point& rPt, const Point* pEnd = nullptr, bool bRowDrag = false ); + void SelectTableRow(); + void SelectTableCol(); + void SelectTableCell(); + + bool SelectTextAttr( sal_uInt16 nWhich, const SwTextAttr* pAttr = nullptr ); + + // per column jumps + void StartOfColumn (); + void EndOfColumn (); + void StartOfNextColumn (); + void EndOfNextColumn (); + void StartOfPrevColumn (); + void EndOfPrevColumn (); + + // set the cursor to page "nPage" at the beginning + // additionally to an identically named implementation in crsrsh.hxx + // here all existing selections are being reset before setting the + // cursor + bool GotoPage( sal_uInt16 nPage, bool bRecord ); + + // setting the cursor; remember the old position for turning back + DECL_DLLPRIVATE_LINK( ExecFlyMac, const SwFlyFrameFormat*, void ); + + bool PageCursor(SwTwips lOffset, bool bSelect); + + // update fields + void UpdateInputFields( SwInputFieldList* pLst = nullptr ); + + void NoEdit(bool bHideCursor = true); + void Edit(); + + bool IsRetainSelection() const { return m_bRetainSelection; } + void SetRetainSelection( bool bRet ) { m_bRetainSelection = bRet; } + + // change current data base and notify + void ChgDBData(const SwDBData& SwDBData); + + // delete + void DelToEndOfLine(); + void DelToStartOfLine(); + void DelLine(); + bool DelLeft(); + + // also deletes the frame or sets the cursor in the frame when bDelFrame == false + bool DelRight(bool isReplaceHeuristic = false); + void DelToEndOfPara(); + void DelToStartOfPara(); + bool DelToEndOfSentence(); + void DelToStartOfSentence(); + void DelNxtWord(); + void DelPrvWord(); + + // checks whether a word selection exists. + // According to the rules for intelligent Cut / Paste + // surrounding spaces are cut out. + // returns type of word selection (see enum) + enum word { + NO_WORD = 0, + WORD_SPACE_BEFORE = 1, + WORD_SPACE_AFTER = 2, + WORD_NO_SPACE = 3 + }; + int IntelligentCut(SelectionType nSelectionType, bool bCut = true); + + // edit + bool InsertField2(SwField const &, SwPaM* pAnnotationRange = nullptr); + void Insert(const OUString &); + // graphic + void InsertGraphic( const OUString &rPath, const OUString &rFilter, + const Graphic &, SwFlyFrameAttrMgr * = nullptr, + RndStdIds nAnchorType = RndStdIds::FLY_AT_PARA); + + void InsertByWord( const OUString & ); + void InsertPageBreak(const OUString *pPageDesc = nullptr, const ::std::optional<sal_uInt16>& rPgNum = std::nullopt); + void InsertLineBreak(std::optional<SwLineBreakClear> oClear = std::nullopt); + void InsertColumnBreak(); + void InsertContentControl(SwContentControlType eType); + void InsertFootnote(const OUString &, bool bEndNote = false, bool bEdit = true ); + void SplitNode( bool bAutoFormat = false ); + bool CanInsert(); + + // indexes + void InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = nullptr); + void UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = nullptr); + + // numbering and bullets + /** + Turns on numbering or bullets. + + @param bNum true: turn on numbering + false: turn on bullets + */ + void NumOrBulletOn(bool bNum); // #i29560# + void NumOrBulletOff(); // #i29560# + void NumOn(); + void BulletOn(); + + //OLE + void InsertObject( /*SvInPlaceObjectRef *pObj, */ // != 0 for clipboard + const svt::EmbeddedObjectRef&, + SvGlobalName const *pName, // != 0 create object accordingly + sal_uInt16 nSlotId = 0); // SlotId for dialog + + bool InsertOleObject( const svt::EmbeddedObjectRef& xObj, SwFlyFrameFormat **pFlyFrameFormat = nullptr ); + void LaunchOLEObj(sal_Int32 nVerb = css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY); // start server + virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset ) override; + virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj, + const SwRect *pFlyPrtRect = nullptr, + const SwRect *pFlyFrameRect = nullptr, + const bool bNoTextFramePrtAreaChanged = false ) override; + virtual void ConnectObj( svt::EmbeddedObjectRef& xIPObj, const SwRect &rPrt, + const SwRect &rFrame ) override; + + // styles and formats + + // enum tells when should happen when the style was not found + enum GetStyle { GETSTYLE_NOCREATE, // create none + GETSTYLE_CREATESOME, // if on PoolId create mapt + GETSTYLE_CREATEANY }; // return standard if applicable + + SwTextFormatColl* GetParaStyle(const OUString &rCollName, + GetStyle eCreate = GETSTYLE_NOCREATE); + SwCharFormat* GetCharStyle(const OUString &rFormatName, + GetStyle eCreate = GETSTYLE_NOCREATE); + SwFrameFormat* GetTableStyle(std::u16string_view rFormatName); + + void SetPageStyle(const OUString &rCollName); + + OUString const & GetCurPageStyle() const; + + // change current style using the attributes in effect + void QuickUpdateStyle(); + + enum DoType { UNDO, REDO, REPEAT }; + + enum class FieldDialogPressedButton { NONE, Previous, Next }; + + void Do(DoType eDoType, sal_uInt16 nCnt = 1, sal_uInt16 nOffset = 0); + OUString GetDoString( DoType eDoType ) const; + OUString GetRepeatString() const; + void GetDoStrings( DoType eDoType, SfxStringListItem& rStrLstItem ) const; + + // search and replace + sal_uLong SearchPattern(const i18nutil::SearchOptions2& rSearchOpt, + bool bSearchInNotes, + SwDocPositions eStart, SwDocPositions eEnd, + FindRanges eFlags = FindRanges::InBody, + bool bReplace = false ); + + sal_uLong SearchTempl (const OUString &rTempl, + SwDocPositions eStart, SwDocPositions eEnd, + FindRanges eFlags = FindRanges::InBody, + const OUString* pReplTempl = nullptr ); + + sal_uLong SearchAttr (const SfxItemSet& rFindSet, + bool bNoColls, + SwDocPositions eStart, SwDocPositions eEnd, + FindRanges eFlags = FindRanges::InBody, + const i18nutil::SearchOptions2* pSearchOpt = nullptr, + const SfxItemSet* pReplaceSet = nullptr); + + void AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar ); + + // action ahead of cursor movement + // resets selection if applicable, triggers timer and GCAttr() + void MoveCursor( bool bWithSelect = false ); + + // update input fields + bool StartInputFieldDlg(SwField*, bool bPrevButton, bool bNextButton, weld::Widget* pParentWin, FieldDialogPressedButton* pPressedButton = nullptr); + // update DropDown fields + bool StartDropDownFieldDlg(SwField*, bool bPrevButton, bool bNextButton, weld::Widget* pParentWin, FieldDialogPressedButton* pPressedButton = nullptr); + + //"Handler" for changes at DrawView - for controls. + virtual void DrawSelChanged( ) override; + + // jump to bookmark and set the "selections-flags" correctly again + void GotoMark( const ::sw::mark::IMark* const pMark ); + bool GotoMark( const ::sw::mark::IMark* const pMark, bool bSelect ); + void GotoMark( const OUString& rName ); + bool GoNextBookmark(); // true when there still was one + bool GoPrevBookmark(); + + bool GotoFieldmark(::sw::mark::IFieldmark const * const pMark); + + bool GotoField( const SwFormatField& rField ); + + bool GotoContentControl(const SwFormatContentControl& rContentControl); + + // jump to the next / previous hyperlink - inside text and also + // on graphics + void SelectNextPrevHyperlink( bool bNext ); + + // determine corresponding SwView + const SwView& GetView() const { return m_rView; } + SwView& GetView() { return m_rView; } + + // Because nobody else is doing it, here is an ExecMacro() + void ExecMacro( const SvxMacro& rMacro, OUString* pRet = nullptr, SbxArray* pArgs = nullptr ); + // call into the dark Basic/JavaScript + sal_uInt16 CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent, + bool bCheckPtr = false ); + + // a click at the given field. the cursor is on it. + // execute the predefined actions. + void ClickToField( const SwField& rField, bool bExecHyperlinks ); + void ClickToINetAttr( const SwFormatINetFormat& rItem, LoadUrlFlags nFilter = LoadUrlFlags::NONE ); + bool ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter ); + inline bool IsInClickToEdit() const ; + + // if a URL-Button is selected, return its URL; otherwise an empty string + bool GetURLFromButton( OUString& rURL, OUString& rDescr ) const; + + void NavigatorPaste( const NaviContentBookmark& rBkmk, + const sal_uInt16 nAction ); + + virtual void ApplyViewOptions( const SwViewOption &rOpt ) override; + virtual void SetReadonlyOption( bool bSet ) override; + + // automatic update of styles + void AutoUpdateFrame(SwFrameFormat* pFormat, const SfxItemSet& rStyleSet); + void AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyleSet, SwPaM* pPaM = nullptr ); + + // starts dialog for inserting ranges via Drag&Drop/Clipboard + void StartInsertRegionDialog(const SwSectionData&); + + // ctor, the first one is a kind of a controlled copy ctor for more views of a document + SwWrtShell( SwWrtShell&, vcl::Window *pWin, SwView &rShell); + SwWrtShell( SwDoc& rDoc, vcl::Window *pWin, SwView &rShell, + const SwViewOption *pViewOpt); + virtual ~SwWrtShell() override; + + bool TryRemoveIndent(); // #i23725# + + OUString GetSelDescr() const; + + SwNavigationMgr& GetNavigationMgr() { return m_aNavigationMgr; } + + void addCurrentPosition(); + bool GotoFly( const OUString& rName, FlyCntType eType = FLYCNTTYPE_ALL, + bool bSelFrame = true ); + bool GotoINetAttr( const SwTextINetFormat& rAttr ); + void GotoOutline( SwOutlineNodes::size_type nIdx ); + bool GotoOutline( const OUString& rName ); + bool GotoRegion( std::u16string_view rName ); + bool GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType = 0, + sal_uInt16 nSeqNo = 0 ); + bool GotoNextTOXBase( const OUString* pName = nullptr); + bool GotoTable( const OUString& rName ); + void GotoFormatField( const SwFormatField& rField ); + const SwRangeRedline* GotoRedline( SwRedlineTable::size_type nArrPos, bool bSelect); + bool GotoDrawingObject(std::u16string_view rName); + void GotoFootnoteAnchor(const SwTextFootnote& rTextFootnote); + void ChangeHeaderOrFooter(std::u16string_view rStyleName, bool bHeader, bool bOn, bool bShowWarning); + virtual void SetShowHeaderFooterSeparator( FrameControlType eControl, bool bShow ) override; + + /// Inserts a new annotation/comment at the current cursor position / selection. + void InsertPostIt(SwFieldMgr& rFieldMgr, const SfxRequest& rReq); + + bool IsOutlineContentVisible(const size_t nPos); + void MakeOutlineContentVisible(const size_t nPos, bool bMakeVisible = true); + void MakeAllFoldedOutlineContentVisible(bool bMakeVisible = true); + void InvalidateOutlineContentVisibility(); + bool GetAttrOutlineContentVisible(const size_t nPos); + + OString getLOKPayload(int nType, int nViewId, bool* ignore) const; + +private: + + SAL_DLLPRIVATE void OpenMark(); + SAL_DLLPRIVATE void CloseMark( bool bOkFlag ); + + struct ModeStack + { + ModeStack *pNext; + bool bAdd, + bBlock, + bExt, + bIns; + ModeStack(ModeStack *pNextMode, bool _bIns, bool _bExt, bool _bAdd, bool _bBlock): + pNext(pNextMode), + bAdd(_bAdd), + bBlock(_bBlock), + bExt(_bExt), + bIns(_bIns) + {} + } *m_pModeStack = nullptr; + + // carry cursor along when PageUp / -Down + enum PageMove + { + MV_NO, + MV_PAGE_UP, + MV_PAGE_DOWN + } m_ePageMove = MV_NO; + + struct CursorStack + { + Point aDocPos; + std::unique_ptr<CursorStack> pNext; + bool bValidCurPos : 1; + bool bIsFrameSel : 1; + SwTwips lOffset; + + CursorStack( bool bValid, bool bFrameSel, const Point &rDocPos, + SwTwips lOff, std::unique_ptr<CursorStack> pN ) + : aDocPos(rDocPos), + pNext(std::move(pN)), + bValidCurPos( bValid ), + bIsFrameSel( bFrameSel ), + lOffset(lOff) + { + } + + }; + std::unique_ptr<CursorStack> m_pCursorStack; + + SwView &m_rView; + SwNavigationMgr m_aNavigationMgr; + + Point m_aDest; + bool m_bDestOnStack = false; + bool HasCursorStack() const { return nullptr != m_pCursorStack; } + SAL_DLLPRIVATE bool PushCursor(SwTwips lOffset, bool bSelect); + SAL_DLLPRIVATE bool PopCursor(bool bUpdate, bool bSelect = false); + + // take END cursor along when PageUp / -Down + SAL_DLLPRIVATE void SttWrd(); + SAL_DLLPRIVATE void EndWrd(); + SAL_DLLPRIVATE bool NxtWrd_(); + SAL_DLLPRIVATE bool PrvWrd_(); + // #i92468# + SAL_DLLPRIVATE bool NxtWrdForDelete(); + SAL_DLLPRIVATE bool PrvWrdForDelete(); + SAL_DLLPRIVATE bool FwdSentence_(); + SAL_DLLPRIVATE bool BwdSentence_(); + bool FwdPara_(); + SAL_DLLPRIVATE bool BwdPara_(); + + // selections + bool m_bIns :1; + bool m_bInSelect :1; + bool m_bExtMode :1; + bool m_bAddMode :1; + bool m_bBlockMode :1; + bool m_bLayoutMode :1; + bool m_bSelWrd :1; + bool m_bSelLn :1; + bool m_bIsInClickToEdit:1; + bool m_bClearMark :1; // don't delete selection for ChartAutoPilot + bool m_bRetainSelection :1; // Do not remove selections + + Point m_aStart; + Link<SwWrtShell&,void> m_aSelTableLink; + + // resets the cursor stack after movement by PageUp/-Down + SAL_DLLPRIVATE void ResetCursorStack_(); + + using SwCursorShell::SetCursor; + SAL_DLLPRIVATE tools::Long SetCursor(const Point *, bool bProp=false ); + + SAL_DLLPRIVATE tools::Long SetCursorKillSel(const Point *, bool bProp ); + + SAL_DLLPRIVATE void BeginDrag(const Point *, bool bProp ); + SAL_DLLPRIVATE void DefaultDrag(const Point *, bool bProp ); + SAL_DLLPRIVATE void DefaultEndDrag(const Point *, bool bProp ); + + SAL_DLLPRIVATE void ExtSelWrd(const Point *, bool bProp ); + SAL_DLLPRIVATE void ExtSelLn(const Point *, bool bProp ); + + SAL_DLLPRIVATE void BeginFrameDrag(const Point *, bool bProp ); + + // after SSize/Move of a frame update; Point is destination. + SAL_DLLPRIVATE void UpdateLayoutFrame(const Point *, bool bProp ); + + SAL_DLLPRIVATE void SttLeaveSelect(); + SAL_DLLPRIVATE void AddLeaveSelect(); + SAL_DLLPRIVATE tools::Long Ignore(const Point *, bool bProp ); + + SAL_DLLPRIVATE void LeaveExtSel() { m_bSelWrd = m_bSelLn = false;} + + SAL_DLLPRIVATE bool GoStart(bool KeepArea, bool *, + bool bSelect, bool bDontMoveRegion = false); + SAL_DLLPRIVATE bool GoEnd(bool KeepArea = false, const bool * = nullptr); + + enum BookMarkMove + { + BOOKMARK_INDEX, + BOOKMARK_NEXT, + BOOKMARK_PREV + }; + + SAL_DLLPRIVATE bool MoveBookMark(BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark=nullptr); +}; + +inline void SwWrtShell::ResetCursorStack() +{ + if ( HasCursorStack() ) + ResetCursorStack_(); +} + +inline void SwWrtShell::SelTableCells(const Link<SwWrtShell&,void> &rLink ) +{ + SetSelTableCells( true ); + m_bClearMark = true; + m_aSelTableLink = rLink; +} +inline void SwWrtShell::EndSelTableCells() +{ + SetSelTableCells( false ); + m_bClearMark = true; +} + +inline bool SwWrtShell::IsInClickToEdit() const { return m_bIsInClickToEdit; } + +inline bool SwWrtShell::Is_FnDragEQBeginDrag() const +{ +#ifdef __GNUC__ + SELECTFUNC2 fnTmp = &SwWrtShell::BeginDrag; + return m_fnDrag == fnTmp; +#else + return m_fnDrag == &SwWrtShell::BeginDrag; +#endif +} + +class MakeAllOutlineContentTemporarilyVisible +{ +private: + SwWrtShell* m_pWrtSh = nullptr; + bool m_bDone = false; +public: + static sal_uInt32 nLock; + MakeAllOutlineContentTemporarilyVisible(SwDoc* pDoc) + { + ++nLock; + if (nLock > 1) + return; + if (SwDocShell* pDocSh = pDoc->GetDocShell()) + if ((m_pWrtSh = pDocSh->GetWrtShell()) && m_pWrtSh->GetViewOptions() && + m_pWrtSh->GetViewOptions()->IsShowOutlineContentVisibilityButton()) + { + m_pWrtSh->StartAllAction(); + m_pWrtSh->MakeAllFoldedOutlineContentVisible(); + m_bDone = true; + } + } + + ~MakeAllOutlineContentTemporarilyVisible() COVERITY_NOEXCEPT_FALSE + { + --nLock; + if (nLock > 0) + return; + if (m_bDone && m_pWrtSh) + { + m_pWrtSh->MakeAllFoldedOutlineContentVisible(false); + m_pWrtSh->EndAllAction(); + } + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/wtabsh.hxx b/sw/source/uibase/inc/wtabsh.hxx new file mode 100644 index 000000000..9eff4052d --- /dev/null +++ b/sw/source/uibase/inc/wtabsh.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "tabsh.hxx" + +class SwWebTableShell final : public SwTableShell +{ +public: + SFX_DECL_INTERFACE(SW_WEBTABSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwWebTableShell(SwView& rView); + virtual ~SwWebTableShell() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/wtextsh.hxx b/sw/source/uibase/inc/wtextsh.hxx new file mode 100644 index 000000000..7958d688f --- /dev/null +++ b/sw/source/uibase/inc/wtextsh.hxx @@ -0,0 +1,37 @@ +/* -*- 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 + +#include "textsh.hxx" + +class SwWebTextShell final : public SwTextShell +{ +public: + SFX_DECL_INTERFACE(SW_WEBTEXTSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwWebTextShell(SwView& rView); + virtual ~SwWebTextShell() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/wview.hxx b/sw/source/uibase/inc/wview.hxx new file mode 100644 index 000000000..1aa807b2f --- /dev/null +++ b/sw/source/uibase/inc/wview.hxx @@ -0,0 +1,43 @@ +/* -*- 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 + +#include <swdllapi.h> +#include <view.hxx> + +class SW_DLLPUBLIC SwWebView final : public SwView +{ +private: + virtual void SelectShell() override; + +public: + SFX_DECL_VIEWFACTORY(SwWebView); + SFX_DECL_INTERFACE(SW_WEBVIEWSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwWebView(SfxViewFrame* pFrame, SfxViewShell*); + virtual ~SwWebView() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/zoomctrl.hxx b/sw/source/uibase/inc/zoomctrl.hxx new file mode 100644 index 000000000..b5af8ba9a --- /dev/null +++ b/sw/source/uibase/inc/zoomctrl.hxx @@ -0,0 +1,41 @@ +/* -*- 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 + +#include <svx/zoomctrl.hxx> + +class SwZoomControl final : public SvxZoomStatusBarControl +{ +private: + OUString m_sPreviewZoom; + +public: + virtual void Command(const CommandEvent& rCEvt) override; + virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState) override; + virtual void Paint(const UserDrawEvent& rEvt) override; + + SFX_DECL_STATUSBAR_CONTROL(); + + SwZoomControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb); + virtual ~SwZoomControl() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |