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_SVX_NUMVSET_HXX
20 #define INCLUDED_SVX_NUMVSET_HXX
21 
22 #include <vcl/idle.hxx>
23 #include <svtools/valueset.hxx>
24 #include <com/sun/star/uno/Reference.h>
25 #include <com/sun/star/uno/Sequence.h>
26 #include <com/sun/star/lang/Locale.hpp>
27 #include <svx/svxdllapi.h>
28 
29 namespace com{namespace sun{ namespace star{
30     namespace container{
31         class XIndexAccess;
32     }
33     namespace beans{
34         struct PropertyValue;
35     }
36     namespace text{
37         class XNumberingFormatter;
38     }
39 }}}
40 
41 enum class NumberingPageType
42 {
43     BULLET,
44     SINGLENUM,
45     OUTLINE,
46     BITMAP
47 };
48 
49 class SvxNumValueSet final : public ValueSet
50 {
51     NumberingPageType ePageType;
52     tools::Rectangle       aOrgRect;
53     VclPtr<VirtualDevice> pVDev;
54 
55     css::uno::Reference<css::text::XNumberingFormatter> xFormatter;
56     css::lang::Locale aLocale;
57 
58     css::uno::Sequence<
59         css::uno::Sequence<
60             css::beans::PropertyValue> > aNumSettings;
61 
62     css::uno::Sequence<
63         css::uno::Reference<
64             css::container::XIndexAccess> > aOutlineSettings;
65 
66 public:
67     SvxNumValueSet(vcl::Window* pParent, WinBits nWinBits);
68     void init(NumberingPageType eType);
69     virtual ~SvxNumValueSet() override;
70     virtual void dispose() override;
71 
72     virtual void    UserDraw( const UserDrawEvent& rUDEvt ) override;
73 
74     void            SetNumberingSettings(
75         const css::uno::Sequence<
76                   css::uno::Sequence<css::beans::PropertyValue> >& aNum,
77         css::uno::Reference<css::text::XNumberingFormatter> const & xFormatter,
78         const css::lang::Locale& rLocale );
79 
80     void            SetOutlineNumberingSettings(
81             css::uno::Sequence<
82                 css::uno::Reference<css::container::XIndexAccess> > const & rOutline,
83             css::uno::Reference<css::text::XNumberingFormatter> const & xFormatter,
84             const css::lang::Locale& rLocale);
85 };
86 
87 class SVX_DLLPUBLIC NumValueSet : public SvtValueSet
88 {
89     NumberingPageType ePageType;
90     tools::Rectangle       aOrgRect;
91     VclPtr<VirtualDevice> pVDev;
92 
93     css::uno::Reference<css::text::XNumberingFormatter> xFormatter;
94     css::lang::Locale aLocale;
95 
96     css::uno::Sequence<
97         css::uno::Sequence<
98             css::beans::PropertyValue> > aNumSettings;
99 
100     css::uno::Sequence<
101         css::uno::Reference<
102             css::container::XIndexAccess> > aOutlineSettings;
103 
104 public:
105     NumValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow);
106     void init(NumberingPageType eType);
107     virtual ~NumValueSet() override;
108 
109     virtual void    UserDraw( const UserDrawEvent& rUDEvt ) override;
110 
111     void            SetNumberingSettings(
112         const css::uno::Sequence<
113                   css::uno::Sequence<css::beans::PropertyValue> >& aNum,
114         css::uno::Reference<css::text::XNumberingFormatter> const & xFormatter,
115         const css::lang::Locale& rLocale );
116 
117     void            SetOutlineNumberingSettings(
118             css::uno::Sequence<
119                 css::uno::Reference<css::container::XIndexAccess> > const & rOutline,
120             css::uno::Reference<css::text::XNumberingFormatter> const & xFormatter,
121             const css::lang::Locale& rLocale);
122 };
123 
124 
125 class SVX_DLLPUBLIC SvxBmpNumValueSet final : public NumValueSet
126 {
127     Idle        aFormatIdle;
128     bool        bGrfNotFound;
129 
130     DECL_LINK(FormatHdl_Impl, Timer *, void);
131 
132 public:
133     SvxBmpNumValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow);
134     void init();
135     virtual ~SvxBmpNumValueSet() override;
136 
137     virtual void    UserDraw( const UserDrawEvent& rUDEvt ) override;
138 };
139 
140 #endif
141 
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
143