Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / cui / source / inc / cuihyperdlg.hxx
blob8423d8c49759b8aad563a823849260cc886b36dd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <sal/config.h>
24 #include <memory>
25 #include <string_view>
27 #include <svx/hlnkitem.hxx>
28 #include <sfx2/childwin.hxx>
29 #include <sfx2/ctrlitem.hxx>
30 #include <sfx2/bindings.hxx>
32 #include "iconcdlg.hxx"
34 /*************************************************************************
36 |* Hyperlink-Dialog
38 \************************************************************************/
40 class SvxHpLinkDlg;
41 class SvxHlinkCtrl : public SfxControllerItem
43 private:
44 SvxHpLinkDlg* pParent;
46 SfxStatusForwarder aRdOnlyForwarder;
48 public:
49 SvxHlinkCtrl( sal_uInt16 nId, SfxBindings & rBindings, SvxHpLinkDlg* pDlg);
50 virtual void dispose() override;
52 virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
53 const SfxPoolItem* pState ) override;
57 /*************************************************************************
59 |* Hyperlink-Dialog
61 \************************************************************************/
63 class SvxHpLinkDlg : public SfxModelessDialogController
65 private:
66 friend class IconChoicePage;
68 std::vector< std::unique_ptr<IconChoicePageData> > maPageList;
70 OUString msCurrentPageId;
71 // tdf#90496 - remember last used view in hyperlink dialog
72 static OUString msRememberedPageId;
74 const SfxItemSet* pSet;
75 std::unique_ptr<SfxItemSet> pOutSet;
76 std::unique_ptr<SfxItemSet> pExampleSet;
77 WhichRangesContainer pRanges;
79 SvxHlinkCtrl maCtrl; ///< Controller
80 std::unique_ptr<SfxItemSet> mpItemSet;
82 bool mbGrabFocus : 1;
83 bool mbIsHTMLDoc : 1;
85 std::unique_ptr<weld::Notebook> m_xIconCtrl;
86 std::unique_ptr<weld::Button> m_xOKBtn;
87 std::unique_ptr<weld::Button> m_xApplyBtn;
88 std::unique_ptr<weld::Button> m_xCancelBtn;
89 std::unique_ptr<weld::Button> m_xHelpBtn;
90 std::unique_ptr<weld::Button> m_xResetBtn;
92 DECL_LINK( ChosePageHdl_Impl, const OUString&, void );
94 IconChoicePageData* GetPageData ( std::u16string_view rId );
96 void SwitchPage( const OUString& rId );
98 DECL_LINK( ResetHdl, weld::Button&, void) ;
99 DECL_LINK (ClickOkHdl_Impl, weld::Button&, void );
100 DECL_LINK (ClickApplyHdl_Impl, weld::Button&, void );
102 IconChoicePage* GetTabPage( std::u16string_view rPageId )
103 { return GetPageData(rPageId)->xPage.get(); }
105 void ActivatePageImpl ();
106 void DeActivatePageImpl ();
107 void ResetPageImpl ();
109 void Activate() override;
110 virtual void Close() override;
111 void Apply();
113 public:
114 SvxHpLinkDlg(SfxBindings* pBindings, SfxChildWindow* pChild, weld::Window* pParent);
115 virtual ~SvxHpLinkDlg () override;
117 // interface
118 void AddTabPage(const OUString &rId, CreatePage pCreateFunc /* != NULL */);
120 void SetCurPageId( const OUString& rId ) { msCurrentPageId = rId; SwitchPage(rId ); }
121 const OUString& GetCurPageId() const { return msCurrentPageId; }
122 void ShowPage( const OUString& rId );
124 /// gives via map converted local slots if applicable
125 WhichRangesContainer GetInputRanges( const SfxItemPool& );
126 void SetInputSet( const SfxItemSet* pInSet );
128 void Start();
129 bool QueryClose();
131 void PageCreated(IconChoicePage& rPage);
133 void SetPage( SvxHyperlinkItem const * pItem );
134 void SetReadOnlyMode( bool bReadOnly );
135 bool IsHTMLDoc() const { return mbIsHTMLDoc; }
137 SfxDispatcher* GetDispatcher() const { return GetBindings().GetDispatcher(); }
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */