Line data Source code
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_PAGECTRL_HXX
20 : #define INCLUDED_SVX_PAGECTRL_HXX
21 :
22 : #include <vcl/window.hxx>
23 : #include <svx/svxdllapi.h>
24 : #include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
25 :
26 : class SvxBoxItem;
27 :
28 : class SVX_DLLPUBLIC SvxPageWindow : public vcl::Window
29 : {
30 : using Window::GetBorder;
31 :
32 : private:
33 : Size aWinSize;
34 : Size aSize;
35 :
36 : long nTop;
37 : long nBottom;
38 : long nLeft;
39 : long nRight;
40 :
41 : SvxBoxItem* pBorder;
42 : bool bResetBackground;
43 : bool bFrameDirection;
44 : sal_Int32 nFrameDirection;
45 :
46 : long nHdLeft;
47 : long nHdRight;
48 : long nHdDist;
49 : long nHdHeight;
50 : SvxBoxItem* pHdBorder;
51 :
52 : long nFtLeft;
53 : long nFtRight;
54 : long nFtDist;
55 : long nFtHeight;
56 : SvxBoxItem* pFtBorder;
57 :
58 : //UUUU
59 : drawinglayer::attribute::SdrAllFillAttributesHelperPtr maHeaderFillAttributes;
60 : drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFooterFillAttributes;
61 : drawinglayer::attribute::SdrAllFillAttributesHelperPtr maPageFillAttributes;
62 :
63 : bool bFooter : 1;
64 : bool bHeader : 1;
65 : bool bTable : 1;
66 : bool bHorz : 1;
67 : bool bVert : 1;
68 :
69 : sal_uInt16 eUsage;
70 :
71 : OUString aLeftText;
72 : OUString aRightText;
73 :
74 : protected:
75 : virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
76 :
77 : virtual void DrawPage(vcl::RenderContext& rRenderContext, const Point& rPoint,
78 : const bool bSecond, const bool bEnabled);
79 :
80 : //UUUU
81 : void drawFillAttributes(vcl::RenderContext& rRenderContext,
82 : const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
83 : const Rectangle& rPaintRange, const Rectangle& rDefineRange);
84 :
85 : public:
86 : SvxPageWindow(vcl::Window* pParent);
87 : virtual ~SvxPageWindow();
88 : virtual void dispose() SAL_OVERRIDE;
89 :
90 : //UUUU
91 0 : void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes)
92 : {
93 0 : maHeaderFillAttributes = rFillAttributes;
94 0 : }
95 0 : void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes)
96 : {
97 0 : maFooterFillAttributes = rFillAttributes;
98 0 : }
99 0 : void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes)
100 : {
101 0 : maPageFillAttributes = rFillAttributes;
102 0 : }
103 0 : const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& getPageFillAttributes() const
104 : {
105 0 : return maPageFillAttributes;
106 : }
107 :
108 : void SetWidth(long nWidth)
109 : {
110 : aSize.Width() = nWidth;
111 : }
112 : void SetHeight(long nHeight)
113 : {
114 : aSize.Height() = nHeight;
115 : }
116 :
117 0 : void SetSize(const Size& rSize)
118 : {
119 0 : aSize = rSize;
120 0 : }
121 0 : const Size& GetSize() const
122 : {
123 0 : return aSize;
124 : }
125 :
126 0 : void SetTop(long nNew) { nTop = nNew; }
127 0 : void SetBottom(long nNew) { nBottom = nNew; }
128 0 : void SetLeft(long nNew) { nLeft = nNew; }
129 0 : void SetRight(long nNew) { nRight = nNew; }
130 : void SetBorder(const SvxBoxItem& rNew);
131 :
132 0 : long GetTop() const { return nTop; }
133 0 : long GetBottom() const { return nBottom; }
134 0 : long GetLeft() const { return nLeft; }
135 0 : long GetRight() const { return nRight; }
136 :
137 : const SvxBoxItem& GetBorder() const;
138 :
139 0 : void SetHdLeft(long nNew) { nHdLeft = nNew; }
140 0 : void SetHdRight(long nNew) { nHdRight = nNew; }
141 0 : void SetHdDist(long nNew) { nHdDist = nNew; }
142 0 : void SetHdHeight(long nNew) { nHdHeight = nNew; }
143 : void SetHdBorder(const SvxBoxItem& rNew);
144 :
145 0 : long GetHdLeft() const { return nHdLeft; }
146 0 : long GetHdRight() const { return nHdRight; }
147 0 : long GetHdDist() const { return nHdDist; }
148 0 : long GetHdHeight() const { return nHdHeight; }
149 :
150 : const SvxBoxItem& GetHdBorder() const { return *pHdBorder; }
151 :
152 0 : void SetFtLeft(long nNew) { nFtLeft = nNew; }
153 0 : void SetFtRight(long nNew) { nFtRight = nNew; }
154 0 : void SetFtDist(long nNew) { nFtDist = nNew; }
155 0 : void SetFtHeight(long nNew) { nFtHeight = nNew; }
156 : void SetFtBorder(const SvxBoxItem& rNew);
157 :
158 0 : long GetFtLeft() const { return nFtLeft; }
159 0 : long GetFtRight() const { return nFtRight; }
160 0 : long GetFtDist() const { return nFtDist; }
161 0 : long GetFtHeight() const { return nFtHeight; }
162 :
163 : const SvxBoxItem& GetFtBorder() const { return *pFtBorder; }
164 :
165 0 : void SetUsage(sal_uInt16 eU) { eUsage = eU; }
166 0 : sal_uInt16 GetUsage() const { return eUsage; }
167 :
168 0 : void SetHeader( bool bNew ) { bHeader = bNew; }
169 : bool GetHeader() const { return bHeader;}
170 0 : void SetFooter( bool bNew ) { bFooter = bNew; }
171 : bool GetFooter() const { return bFooter;}
172 :
173 0 : void SetTable( bool bNew ) { bTable = bNew; }
174 : bool GetTable() const { return bTable;}
175 0 : void SetHorz( bool bNew ) { bHorz = bNew; }
176 : bool GetHorz() const { return bHorz;}
177 0 : void SetVert( bool bNew ) { bVert = bNew; }
178 : bool GetVert() const { return bVert;}
179 :
180 : void EnableFrameDirection(bool bEnable);
181 : //uses enum SvxFrameDirection
182 : void SetFrameDirection(sal_Int32 nDirection);
183 :
184 : void ResetBackground();
185 :
186 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
187 : };
188 :
189 : #endif // INCLUDED_SVX_PAGECTRL_HXX
190 :
191 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|