/src/libreoffice/svx/source/dialog/contimp.hxx
Line | Count | Source |
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 | | #pragma once |
20 | | |
21 | | #include <sfx2/ctrlitem.hxx> |
22 | | #include "contwnd.hxx" |
23 | | #include <vcl/idle.hxx> |
24 | | #include <vcl/weld/Button.hxx> |
25 | | #include <vcl/weld/Dialog.hxx> |
26 | | #include <vcl/weld/Label.hxx> |
27 | | #include <vcl/weld/MetricSpinButton.hxx> |
28 | | #include <vcl/weld/Toolbar.hxx> |
29 | | |
30 | | class SvxSuperContourDlg; |
31 | | |
32 | | class SvxContourDlgItem : public SfxControllerItem |
33 | | { |
34 | | SvxSuperContourDlg& rDlg; |
35 | | |
36 | | protected: |
37 | | |
38 | | virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; |
39 | | |
40 | | public: |
41 | | |
42 | | SvxContourDlgItem( SvxSuperContourDlg& rDlg, SfxBindings& rBindings ); |
43 | | }; |
44 | | |
45 | | class ContourWindow; |
46 | | |
47 | | class StatusColor : public weld::CustomWidgetController |
48 | | { |
49 | | private: |
50 | | ContourWindow& m_rWnd; |
51 | | public: |
52 | | StatusColor(ContourWindow& rWnd) |
53 | 0 | : m_rWnd(rWnd) |
54 | 0 | { |
55 | 0 | } |
56 | | virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; |
57 | | virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override |
58 | 0 | { |
59 | 0 | weld::CustomWidgetController::SetDrawingArea(pDrawingArea); |
60 | 0 | Size aSize(pDrawingArea->get_approximate_digit_width() * 3, |
61 | 0 | pDrawingArea->get_text_height()); |
62 | 0 | pDrawingArea->set_size_request(aSize.Width(), aSize.Height()); |
63 | 0 | SetOutputSizePixel(aSize); |
64 | 0 | } |
65 | | }; |
66 | | |
67 | | class SvxSuperContourDlg |
68 | | { |
69 | | Graphic aGraphic; |
70 | | Graphic aUndoGraphic; |
71 | | Graphic aRedoGraphic; |
72 | | Graphic aUpdateGraphic; |
73 | | tools::PolyPolygon aUpdatePolyPoly; |
74 | | Idle aUpdateIdle; |
75 | | Idle aCreateIdle; |
76 | | SfxBindings* mpBindings; |
77 | | void* pUpdateEditingObject; |
78 | | void* pCheckObj; |
79 | | SvxContourDlgItem aContourItem; |
80 | | sal_Int32 mnGrfChanged; |
81 | | bool bExecState; |
82 | | bool bUpdateGraphicLinked; |
83 | | bool bGraphicLinked; |
84 | | |
85 | | weld::Dialog& m_rDialog; |
86 | | std::unique_ptr<ContourWindow> m_xContourWnd; |
87 | | std::unique_ptr<StatusColor> m_xStbStatusColor; |
88 | | std::unique_ptr<weld::Toolbar> m_xTbx1; |
89 | | std::unique_ptr<weld::MetricSpinButton> m_xMtfTolerance; |
90 | | std::unique_ptr<weld::Label> m_xStbStatus2; |
91 | | std::unique_ptr<weld::Label> m_xStbStatus3; |
92 | | std::unique_ptr<weld::Button> m_xCancelBtn; |
93 | | std::unique_ptr<weld::CustomWeld> m_xStbStatusColorWeld; |
94 | | std::unique_ptr<weld::CustomWeld> m_xContourWndWeld; |
95 | | |
96 | | DECL_LINK( Tbx1ClickHdl, const OUString&, void ); |
97 | | DECL_LINK( MousePosHdl, GraphCtrl*, void ); |
98 | | DECL_LINK( GraphSizeHdl, GraphCtrl*, void ); |
99 | | DECL_LINK( UpdateHdl, Timer *, void ); |
100 | | DECL_LINK( CreateHdl, Timer *, void ); |
101 | | DECL_LINK( StateHdl, GraphCtrl*, void ); |
102 | | DECL_LINK( PipetteHdl, ContourWindow&, void ); |
103 | | DECL_LINK( PipetteClickHdl, ContourWindow&, void ); |
104 | | DECL_LINK( WorkplaceClickHdl, ContourWindow&, void ); |
105 | | DECL_LINK( CancelHdl, weld::Button&, void ); |
106 | | |
107 | | void SetActiveTool(std::u16string_view rId); |
108 | | void SetActivePoly(std::u16string_view rId); |
109 | | |
110 | 0 | SfxBindings& GetBindings() { return *mpBindings; } |
111 | | |
112 | | public: |
113 | | |
114 | | SvxSuperContourDlg(weld::Builder& rBuilder, weld::Dialog& rDialog, SfxBindings* pBindings); |
115 | | ~SvxSuperContourDlg(); |
116 | | |
117 | | void SetExecState( bool bEnable ); |
118 | | |
119 | | void SetGraphic( const Graphic& rGraphic ); |
120 | 0 | const Graphic& GetGraphic() const { return aGraphic; } |
121 | 0 | bool IsGraphicChanged() const { return mnGrfChanged > 0; } |
122 | | |
123 | | void SetPolyPolygon( const tools::PolyPolygon& rPolyPoly ); |
124 | | tools::PolyPolygon GetPolyPolygon(); |
125 | | |
126 | 0 | const void* GetEditingObject() const { return pCheckObj; } |
127 | | |
128 | | void UpdateGraphic( const Graphic& rGraphic, bool bGraphicLinked, |
129 | | const tools::PolyPolygon* pPolyPoly, |
130 | | void* pEditingObj ); |
131 | | }; |
132 | | |
133 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |