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 :
20 : #ifndef INCLUDED_CUI_SOURCE_INC_CUITABLINE_HXX
21 : #define INCLUDED_CUI_SOURCE_INC_CUITABLINE_HXX
22 :
23 : #include <vector>
24 : #include <svx/tabline.hxx>
25 : #include <svx/tabarea.hxx>
26 :
27 0 : class SvxLineTabDialog : public SfxTabDialog
28 : {
29 : sal_uInt16 m_nLineTabPage;
30 : sal_uInt16 m_nShadowTabPage;
31 : sal_uInt16 m_nStyleTabPage;
32 : sal_uInt16 m_nEndTabPage;
33 :
34 : private:
35 : SdrModel* pDrawModel;
36 : const SdrObject* pObj;
37 :
38 : const SfxItemSet& rOutAttrs;
39 :
40 : XColorListRef pColorList;
41 : XColorListRef mpNewColorList;
42 : XDashListRef pDashList;
43 : XDashListRef pNewDashList;
44 : XLineEndListRef pLineEndList;
45 : XLineEndListRef pNewLineEndList;
46 : bool bObjSelected;
47 :
48 : ChangeType nLineEndListState;
49 : ChangeType nDashListState;
50 : ChangeType mnColorListState;
51 :
52 : sal_uInt16 nPageType;
53 : sal_Int32 nPosDashLb;
54 : sal_Int32 nPosLineEndLb;
55 : bool mbAreaTP;
56 :
57 : virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) SAL_OVERRIDE;
58 :
59 : protected:
60 : virtual short Ok() SAL_OVERRIDE;
61 : DECL_LINK( CancelHdlImpl, void * );
62 : void SavePalettes();
63 :
64 : public:
65 : SvxLineTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr,
66 : SdrModel* pModel, const SdrObject* pObj = NULL,
67 : bool bHasObj = true );
68 :
69 0 : void SetNewDashList( XDashListRef pInLst)
70 0 : { pNewDashList = pInLst; }
71 0 : XDashListRef GetNewDashList() const { return pNewDashList; }
72 : XDashListRef GetDashList() const { return pDashList; }
73 :
74 0 : void SetNewLineEndList( XLineEndListRef pInLst)
75 0 : { pNewLineEndList = pInLst; }
76 0 : XLineEndListRef GetNewLineEndList() const { return pNewLineEndList; }
77 : XLineEndListRef GetLineEndList() const { return pLineEndList; }
78 :
79 0 : void SetNewColorList( XColorListRef pColTab ) { mpNewColorList = pColTab; }
80 0 : XColorListRef GetNewColorList() const { return mpNewColorList; }
81 0 : XColorListRef GetColorList() const { return pColorList; }
82 : };
83 :
84 : /*************************************************************************/
85 :
86 : struct SvxBmpItemInfo;
87 : typedef ::std::vector< SvxBmpItemInfo* > SvxBmpItemInfoList;
88 :
89 : class SvxLineTabPage : public SvxTabPage
90 : {
91 : using TabPage::ActivatePage;
92 : using TabPage::DeactivatePage;
93 : static const sal_uInt16 pLineRanges[];
94 : private:
95 : VclPtr<VclBox> m_pBoxColor;
96 : VclPtr<LineLB> m_pLbLineStyle;
97 : VclPtr<ColorLB> m_pLbColor;
98 : VclPtr<VclBox> m_pBoxWidth;
99 : VclPtr<MetricField> m_pMtrLineWidth;
100 : VclPtr<VclBox> m_pBoxTransparency;
101 : VclPtr<MetricField> m_pMtrTransparent;
102 :
103 : VclPtr<VclFrame> m_pFlLineEnds;
104 : VclPtr<VclBox> m_pBoxArrowStyles;
105 : VclPtr<LineEndLB> m_pLbStartStyle;
106 : VclPtr<VclBox> m_pBoxStart;
107 : VclPtr<MetricField> m_pMtrStartWidth;
108 : VclPtr<TriStateBox> m_pTsbCenterStart;
109 : VclPtr<VclBox> m_pBoxEnd;
110 : VclPtr<LineEndLB> m_pLbEndStyle;
111 : VclPtr<MetricField> m_pMtrEndWidth;
112 : VclPtr<TriStateBox> m_pTsbCenterEnd;
113 : VclPtr<CheckBox> m_pCbxSynchronize;
114 : VclPtr<SvxXLinePreview> m_pCtlPreview;
115 :
116 : // #116827#
117 : VclPtr<VclFrame> m_pFLEdgeStyle;
118 : VclPtr<VclGrid> m_pGridEdgeCaps;
119 : VclPtr<ListBox> m_pLBEdgeStyle;
120 :
121 : // LineCaps
122 : VclPtr<ListBox> m_pLBCapStyle;
123 :
124 : //#58425# symbols on a line (e. g. StarChart) ->
125 : /** a list of symbols to be shown in menu. Symbol at position SID_ATTR_SYMBOLTYPE is to be shown in preview.
126 : The list position is to be used cyclic. */
127 : SdrObjList* pSymbolList;
128 : bool bNewSize;
129 : /// a graphic to be displayed in the preview in case that an automatic symbol is chosen
130 : Graphic aAutoSymbolGraphic;
131 : long nNumMenuGalleryItems;
132 : long nSymbolType;
133 : /// attributes for the shown symbols; only necessary if not equal to line properties
134 : SfxItemSet* pSymbolAttr;
135 : VclPtr<VclFrame> m_pFlSymbol;
136 : VclPtr<VclGrid> m_pGridIconSize;
137 : VclPtr<MenuButton> m_pSymbolMB;
138 : VclPtr<MetricField> m_pSymbolWidthMF;
139 : VclPtr<MetricField> m_pSymbolHeightMF;
140 : VclPtr<CheckBox> m_pSymbolRatioCB;
141 : std::vector<OUString> aGrfNames;
142 : SvxBmpItemInfoList aGrfBrushItems;
143 : bool bLastWidthModified;
144 : Size aSymbolLastSize;
145 : Graphic aSymbolGraphic;
146 : Size aSymbolSize;
147 : bool bSymbols;
148 :
149 : const SfxItemSet& rOutAttrs;
150 : RECT_POINT eRP;
151 : bool bObjSelected;
152 :
153 : XOutdevItemPool* pXPool;
154 : XLineStyleItem aXLStyle;
155 : XLineWidthItem aXWidth;
156 : XLineDashItem aXDash;
157 : XLineColorItem aXColor;
158 : XLineAttrSetItem aXLineAttr;
159 : SfxItemSet& rXLSet;
160 :
161 : XColorListRef pColorList;
162 : XDashListRef pDashList;
163 : XLineEndListRef pLineEndList;
164 :
165 : ChangeType* pnLineEndListState;
166 : ChangeType* pnDashListState;
167 : ChangeType* pnColorListState;
168 : sal_uInt16 nPageType;
169 : sal_uInt16 nDlgType;
170 : sal_Int32* pPosDashLb;
171 : sal_Int32* pPosLineEndLb;
172 :
173 : SfxMapUnit ePoolUnit;
174 :
175 : // #63083#
176 : sal_Int32 nActLineWidth;
177 :
178 : // handler for gallery popup menu button + size
179 : DECL_LINK_TYPED( GraphicHdl_Impl, MenuButton *, void );
180 : DECL_LINK( MenuCreateHdl_Impl, MenuButton * );
181 : DECL_LINK( GraphicArrivedHdl_Impl, SvxBrushItem* );
182 : DECL_LINK( SizeHdl_Impl, MetricField * );
183 : DECL_LINK( RatioHdl_Impl, CheckBox * );
184 :
185 : DECL_LINK( ClickInvisibleHdl_Impl, void * );
186 : DECL_LINK( ChangeStartHdl_Impl, void * );
187 : DECL_LINK( ChangeEndHdl_Impl, void * );
188 : DECL_LINK( ChangePreviewHdl_Impl, void * );
189 : DECL_LINK( ChangeTransparentHdl_Impl, void * );
190 :
191 : // #116827#
192 : DECL_LINK( ChangeEdgeStyleHdl_Impl, void * );
193 :
194 : // LineCaps
195 : DECL_LINK ( ChangeCapStyleHdl_Impl, void * );
196 :
197 : bool FillXLSet_Impl();
198 :
199 : void InitSymbols(MenuButton* pButton);
200 : void SymbolSelected(MenuButton* pButton);
201 : void FillListboxes();
202 : public:
203 :
204 : void ShowSymbolControls(bool bOn);
205 :
206 : SvxLineTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
207 : virtual ~SvxLineTabPage();
208 : virtual void dispose() SAL_OVERRIDE;
209 :
210 : void Construct();
211 :
212 : static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
213 0 : static const sal_uInt16* GetRanges() { return pLineRanges; }
214 :
215 : virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
216 : virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
217 :
218 : virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE;
219 : virtual sfxpg DeactivatePage( SfxItemSet* pSet ) SAL_OVERRIDE;
220 :
221 : virtual void PointChanged( vcl::Window* pWindow, RECT_POINT eRP ) SAL_OVERRIDE;
222 :
223 : virtual void FillUserData() SAL_OVERRIDE;
224 :
225 0 : void SetColorList( XColorListRef pColTab ) { pColorList = pColTab; }
226 0 : void SetDashList( XDashListRef pDshLst ) { pDashList = pDshLst; }
227 0 : void SetLineEndList( XLineEndListRef pLneEndLst) { pLineEndList = pLneEndLst; }
228 0 : void SetObjSelected( bool bHasObj ) { bObjSelected = bHasObj; }
229 :
230 0 : void SetPageType( sal_uInt16 nInType ) { nPageType = nInType; }
231 0 : void SetDlgType( sal_uInt16 nInType ) { nDlgType = nInType; }
232 0 : void SetPosDashLb( sal_Int32* pInPos ) { pPosDashLb = pInPos; }
233 0 : void SetPosLineEndLb( sal_Int32* pInPos ) { pPosLineEndLb = pInPos; }
234 :
235 0 : void SetLineEndChgd( ChangeType* pIn ) { pnLineEndListState = pIn; }
236 0 : void SetDashChgd( ChangeType* pIn ) { pnDashListState = pIn; }
237 0 : void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; }
238 :
239 : virtual void PageCreated(const SfxAllItemSet& aSet) SAL_OVERRIDE;
240 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
241 : };
242 :
243 : /*************************************************************************/
244 :
245 : class SvxLineDefTabPage : public SfxTabPage
246 : {
247 : using TabPage::ActivatePage;
248 : using TabPage::DeactivatePage;
249 : private:
250 : VclPtr<LineLB> m_pLbLineStyles;
251 : VclPtr<ListBox> m_pLbType1;
252 : VclPtr<ListBox> m_pLbType2;
253 : VclPtr<NumericField> m_pNumFldNumber1;
254 : VclPtr<NumericField> m_pNumFldNumber2;
255 : VclPtr<MetricField> m_pMtrLength1;
256 : VclPtr<MetricField> m_pMtrLength2;
257 : VclPtr<MetricField> m_pMtrDistance;
258 : VclPtr<CheckBox> m_pCbxSynchronize;
259 : VclPtr<PushButton> m_pBtnAdd;
260 : VclPtr<PushButton> m_pBtnModify;
261 : VclPtr<PushButton> m_pBtnDelete;
262 : VclPtr<PushButton> m_pBtnLoad;
263 : VclPtr<PushButton> m_pBtnSave;
264 : VclPtr<SvxXLinePreview> m_pCtlPreview;
265 :
266 : const SfxItemSet& rOutAttrs;
267 : XDash aDash;
268 : bool bObjSelected;
269 :
270 : XOutdevItemPool* pXPool;
271 : XLineStyleItem aXLStyle;
272 : XLineWidthItem aXWidth;
273 : XLineDashItem aXDash;
274 : XLineColorItem aXColor;
275 : XLineAttrSetItem aXLineAttr;
276 : SfxItemSet& rXLSet;
277 :
278 : XDashListRef pDashList;
279 :
280 : ChangeType* pnDashListState;
281 : sal_uInt16* pPageType;
282 : sal_uInt16 nDlgType;
283 : sal_Int32* pPosDashLb;
284 :
285 : SfxMapUnit ePoolUnit;
286 : FieldUnit eFUnit;
287 :
288 : void FillDash_Impl();
289 : void FillDialog_Impl();
290 :
291 : DECL_LINK( ClickAddHdl_Impl, void * );
292 : DECL_LINK( ClickModifyHdl_Impl, void * );
293 : DECL_LINK( ClickDeleteHdl_Impl, void * );
294 : DECL_LINK( SelectLinestyleHdl_Impl, void * );
295 : DECL_LINK( ChangePreviewHdl_Impl, void * );
296 : DECL_LINK( ChangeNumber1Hdl_Impl, void * );
297 : DECL_LINK( ChangeNumber2Hdl_Impl, void * );
298 : DECL_LINK( ClickLoadHdl_Impl, void * );
299 : DECL_LINK( ClickSaveHdl_Impl, void * );
300 : DECL_LINK( ChangeMetricHdl_Impl, void * );
301 : DECL_LINK( SelectTypeHdl_Impl, void * );
302 :
303 : void CheckChanges_Impl();
304 :
305 : public:
306 : SvxLineDefTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
307 : virtual ~SvxLineDefTabPage();
308 : virtual void dispose() SAL_OVERRIDE;
309 :
310 : void Construct();
311 :
312 : static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
313 : virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
314 : virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
315 :
316 : virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE;
317 : virtual sfxpg DeactivatePage( SfxItemSet* pSet ) SAL_OVERRIDE;
318 :
319 0 : void SetDashList( XDashListRef pDshLst ) { pDashList = pDshLst; }
320 0 : void SetObjSelected( bool bHasObj ) { bObjSelected = bHasObj; }
321 :
322 0 : void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; }
323 0 : void SetDlgType( sal_uInt16 nInType ) { nDlgType = nInType; }
324 0 : void SetPosDashLb( sal_Int32* pInPos ) { pPosDashLb = pInPos; }
325 :
326 0 : void SetDashChgd( ChangeType* pIn ) { pnDashListState = pIn; }
327 :
328 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
329 : };
330 :
331 : /*************************************************************************/
332 :
333 : class SvxLineEndDefTabPage : public SfxTabPage
334 : {
335 : using TabPage::ActivatePage;
336 : using TabPage::DeactivatePage;
337 :
338 : private:
339 : VclPtr<Edit> m_pEdtName;
340 : VclPtr<LineEndLB> m_pLbLineEnds;
341 : VclPtr<PushButton> m_pBtnAdd;
342 : VclPtr<PushButton> m_pBtnModify;
343 : VclPtr<PushButton> m_pBtnDelete;
344 : VclPtr<PushButton> m_pBtnLoad;
345 : VclPtr<PushButton> m_pBtnSave;
346 : VclPtr<SvxXLinePreview> m_pCtlPreview;
347 :
348 : const SfxItemSet& rOutAttrs;
349 : const SdrObject* pPolyObj;
350 : bool bObjSelected;
351 :
352 : XOutdevItemPool* pXPool;
353 : XLineStyleItem aXLStyle;
354 : XLineWidthItem aXWidth;
355 : XLineColorItem aXColor;
356 : XLineAttrSetItem aXLineAttr;
357 : SfxItemSet& rXLSet;
358 :
359 : XLineEndListRef pLineEndList;
360 :
361 : ChangeType* pnLineEndListState;
362 : sal_uInt16* pPageType;
363 : sal_uInt16 nDlgType;
364 : sal_Int32* pPosLineEndLb;
365 :
366 : DECL_LINK( ClickAddHdl_Impl, void * );
367 : DECL_LINK( ClickModifyHdl_Impl, void * );
368 : DECL_LINK( ClickDeleteHdl_Impl, void * );
369 : DECL_LINK( ClickLoadHdl_Impl, void * );
370 : DECL_LINK( ClickSaveHdl_Impl, void * );
371 : DECL_LINK( SelectLineEndHdl_Impl, void * );
372 : long ChangePreviewHdl_Impl( void* p );
373 :
374 : void CheckChanges_Impl();
375 :
376 : public:
377 : SvxLineEndDefTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
378 : virtual ~SvxLineEndDefTabPage();
379 : virtual void dispose() SAL_OVERRIDE;
380 :
381 : void Construct();
382 :
383 : static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
384 : virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
385 : virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
386 :
387 : virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE;
388 : virtual sfxpg DeactivatePage( SfxItemSet* pSet ) SAL_OVERRIDE;
389 :
390 0 : void SetLineEndList( XLineEndListRef pInList ) { pLineEndList = pInList; }
391 0 : void SetPolyObj( const SdrObject* pObj ) { pPolyObj = pObj; }
392 0 : void SetObjSelected( bool bHasObj ) { bObjSelected = bHasObj; }
393 :
394 0 : void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; }
395 0 : void SetDlgType( sal_uInt16 nInType ) { nDlgType = nInType; }
396 0 : void SetPosLineEndLb( sal_Int32* pInPos ) { pPosLineEndLb = pInPos; }
397 :
398 0 : void SetLineEndChgd( ChangeType* pIn ) { pnLineEndListState = pIn; }
399 :
400 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
401 : virtual void Resize() SAL_OVERRIDE;
402 : };
403 :
404 : #endif // INCLUDED_CUI_SOURCE_INC_CUITABLINE_HXX
405 :
406 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|