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 #ifndef INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGESTYLESPANEL_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGESTYLESPANEL_HXX
21 
22 #include <memory>
23 #include <com/sun/star/frame/XFrame.hpp>
24 
25 #include <svx/sidebar/PanelLayout.hxx>
26 
27 #include <sfx2/sidebar/ControllerItem.hxx>
28 
29 #include <svx/pageitem.hxx>
30 
31 #include <vcl/fixed.hxx>
32 #include <vcl/lstbox.hxx>
33 #include <svl/intitem.hxx>
34 #include <svl/poolitem.hxx>
35 #include <svx/xbtmpit.hxx>
36 #include <svx/xflclit.hxx>
37 #include <svx/xflgrit.hxx>
38 #include <svx/xflhtit.hxx>
39 #include <svx/itemwin.hxx>
40 #include <svx/pagenumberlistbox.hxx>
41 
42 class List;
43 class SvxColorListBox;
44 namespace sw { namespace sidebar {
45 
46 class PageStylesPanel:
47     public PanelLayout,
48     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
49 {
50 public:
51     static VclPtr<vcl::Window> Create(
52         vcl::Window* pParent,
53         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
54         SfxBindings* pBindings);
55 
56     virtual void NotifyItemUpdate(
57         const sal_uInt16 nSId,
58         const SfxItemState eState,
59         const SfxPoolItem* pState) override;
60 
GetBindings() const61     SfxBindings* GetBindings() const { return mpBindings; }
62     PageStylesPanel(
63         vcl::Window* pParent,
64         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
65         SfxBindings* pBindings);
66     virtual ~PageStylesPanel() override;
67     virtual void dispose() override;
68 
69 private:
70 
71     SfxBindings* mpBindings;
72 
73     ::std::unique_ptr<SfxInt16Item>      mpPageColumnItem;
74     ::std::unique_ptr<SvxPageItem>       mpPageItem;
75     ::std::unique_ptr<XFillColorItem>    mpBgColorItem;
76     ::std::unique_ptr<XFillGradientItem> mpBgGradientItem;
77     ::std::unique_ptr<XFillHatchItem>    mpBgHatchItem;
78     ::std::unique_ptr<XFillBitmapItem>   mpBgBitmapItem;
79 
80     ::sfx2::sidebar::ControllerItem maPageColumnControl;
81     ::sfx2::sidebar::ControllerItem maPageNumFormatControl;
82     ::sfx2::sidebar::ControllerItem maBgColorControl;
83     ::sfx2::sidebar::ControllerItem maBgHatchingControl;
84     ::sfx2::sidebar::ControllerItem maBgGradientControl;
85     ::sfx2::sidebar::ControllerItem maBgBitmapControl;
86     ::sfx2::sidebar::ControllerItem maBgFillStyleControl;
87 
88     VclPtr<SvxColorListBox> mpBgColorLB;
89     VclPtr<SvxFillAttrBox>  mpBgHatchingLB;
90     VclPtr<SvxColorListBox> mpBgGradientLB;
91     VclPtr<SvxFillAttrBox>  mpBgBitmapLB;
92     VclPtr<ListBox>         mpLayoutSelectLB;
93     VclPtr<ListBox>         mpColumnCount;
94     VclPtr<PageNumberListBox> mpNumberSelectLB;
95     VclPtr<SvxFillTypeBox>  mpBgFillType;
96     VclPtr<FixedText>       mpCustomEntry;
97     OUString aCustomEntry;
98 
99     void Initialize();
100     void Update();
101     Color const & GetColorSetOrDefault();
102     XGradient const & GetGradientSetOrDefault();
103     OUString const & GetHatchingSetOrDefault();
104     OUString const & GetBitmapSetOrDefault();
105     OUString const & GetPatternSetOrDefault();
106 
107     void ModifyFillColor();
108 
109     DECL_LINK( ModifyColumnCountHdl, ListBox&, void );
110     DECL_LINK( ModifyNumberingHdl, ListBox&, void );
111     DECL_LINK( ModifyLayoutHdl, ListBox&, void );
112     DECL_LINK( ModifyFillStyleHdl, ListBox&, void );
113     DECL_LINK( ModifyFillColorHdl, ListBox&, void );
114     DECL_LINK( ModifyFillColorListHdl, SvxColorListBox&, void );
115 };
116 
117 } } //end of namespace sw::sidebar
118 
119 #endif
120 
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
122