1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19 20 #pragma once 21 22 #include <memory> 23 #include <sfx2/tabdlg.hxx> 24 #include <swtypes.hxx> 25 #include "numprevw.hxx" 26 #include "numberingtypelistbox.hxx" 27 #include <rtl/ustring.hxx> 28 29 class SwWrtShell; 30 class SwNumRule; 31 class SwChapterNumRules; 32 33 class SwOutlineTabDialog final : public SfxTabDialogController 34 { 35 static sal_uInt16 nNumLevel; 36 37 OUString aCollNames[MAXLEVEL]; 38 39 SwWrtShell& rWrtSh; 40 std::unique_ptr<SwNumRule> xNumRule; 41 SwChapterNumRules* pChapterNumRules; 42 43 bool bModified : 1; 44 45 std::unique_ptr<weld::MenuButton> m_xMenuButton; 46 47 DECL_LINK(CancelHdl, weld::Button&, void); 48 DECL_LINK(FormHdl, weld::Toggleable&, void); 49 DECL_LINK(MenuSelectHdl, const OString&, void); 50 51 virtual void PageCreated(const OString& rPageId, SfxTabPage& rPage) override; 52 virtual short Ok() override; 53 54 public: 55 SwOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &); 56 virtual ~SwOutlineTabDialog() override; 57 GetNumRule()58 SwNumRule* GetNumRule() { return xNumRule.get(); } 59 sal_uInt16 GetLevel(std::u16string_view rFormatName) const; GetCollNames()60 OUString* GetCollNames() {return aCollNames;} 61 GetActNumLevel()62 static sal_uInt16 GetActNumLevel() {return nNumLevel;} SetActNumLevel(sal_uInt16 nSet)63 static void SetActNumLevel(sal_uInt16 nSet) {nNumLevel = nSet;} 64 }; 65 66 class SwOutlineSettingsTabPage : public SfxTabPage 67 { 68 OUString aNoFormatName; 69 OUString aSaveCollNames[MAXLEVEL]; 70 SwWrtShell* pSh; 71 SwNumRule* pNumRule; 72 OUString* pCollNames; 73 sal_uInt16 nActLevel; 74 NumberingPreview m_aPreviewWIN; 75 76 std::unique_ptr<weld::TreeView> m_xLevelLB; 77 std::unique_ptr<weld::ComboBox> m_xCollBox; 78 std::unique_ptr<SwNumberingTypeListBox> m_xNumberBox; 79 std::unique_ptr<weld::ComboBox> m_xCharFormatLB; 80 std::unique_ptr<weld::Label> m_xAllLevelFT; 81 std::unique_ptr<weld::SpinButton> m_xAllLevelNF; 82 std::unique_ptr<weld::Entry> m_xPrefixED; 83 std::unique_ptr<weld::Entry> m_xSuffixED; 84 std::unique_ptr<weld::SpinButton> m_xStartEdit; 85 std::unique_ptr<weld::CustomWeld> m_xPreviewWIN; 86 87 DECL_LINK( LevelHdl, weld::TreeView&, void ); 88 DECL_LINK( ToggleComplete, weld::SpinButton&, void ); 89 DECL_LINK( CollSelect, weld::ComboBox&, void ); 90 void CollSave(); 91 DECL_LINK( NumberSelect, weld::ComboBox&, void ); 92 DECL_LINK( DelimModify, weld::Entry&, void ); 93 DECL_LINK( StartModified, weld::SpinButton&, void ); 94 DECL_LINK( CharFormatHdl, weld::ComboBox&, void ); 95 96 void Update(); 97 SetModified()98 void SetModified() { m_aPreviewWIN.Invalidate(); } 99 void CheckForStartValue_Impl(sal_uInt16 nNumberingType); 100 101 public: 102 SwOutlineSettingsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); 103 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, 104 const SfxItemSet* rAttrSet); 105 virtual ~SwOutlineSettingsTabPage() override; 106 107 void SetWrtShell(SwWrtShell* pShell); 108 109 virtual void ActivatePage(const SfxItemSet& rSet) override; 110 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; 111 112 virtual bool FillItemSet( SfxItemSet* rSet ) override; 113 virtual void Reset( const SfxItemSet* rSet ) override; SetNumRule(SwNumRule * pRule)114 void SetNumRule(SwNumRule *pRule) 115 { 116 pNumRule = pRule; 117 m_aPreviewWIN.SetNumRule(pNumRule); 118 } 119 }; 120 121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 122