/src/libreoffice/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.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 | | |
20 | | #ifndef INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRFRAMEBORDERPRIMITIVE2D_HXX |
21 | | #define INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRFRAMEBORDERPRIMITIVE2D_HXX |
22 | | |
23 | | #include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx> |
24 | | #include <svx/framelink.hxx> |
25 | | |
26 | | // predefines |
27 | | |
28 | | namespace drawinglayer::primitive2d |
29 | | { |
30 | | class SVXCORE_DLLPUBLIC SdrFrameBorderData |
31 | | { |
32 | | private: |
33 | | basegfx::B2DPoint maOrigin; /// start point of borderline |
34 | | basegfx::B2DVector maX; /// X-Axis of borderline with length |
35 | | svx::frame::Style maStyle; /// Style of borderline |
36 | | Color maColor; |
37 | | bool mbForceColor; |
38 | | |
39 | | class SdrConnectStyleData |
40 | | { |
41 | | private: |
42 | | svx::frame::Style maStyle; |
43 | | basegfx::B2DVector maNormalizedPerpendicular; |
44 | | bool mbStyleMirrored; |
45 | | |
46 | | public: |
47 | | SdrConnectStyleData( |
48 | | const svx::frame::Style& rStyle, |
49 | | const basegfx::B2DVector& rNormalizedPerpendicular, |
50 | | bool bStyleMirrored); |
51 | | |
52 | 25.2k | const svx::frame::Style& getStyle() const { return maStyle; } |
53 | 12.6k | const basegfx::B2DVector& getNormalizedPerpendicular() const { return maNormalizedPerpendicular; } |
54 | 12.6k | bool getStyleMirrored() const { return mbStyleMirrored; } |
55 | | bool operator==(const SdrConnectStyleData& rCompare) const; |
56 | | }; |
57 | | |
58 | | std::vector<SdrConnectStyleData> maStart; |
59 | | std::vector<SdrConnectStyleData> maEnd; |
60 | | |
61 | | public: |
62 | | SdrFrameBorderData( |
63 | | const basegfx::B2DPoint& rOrigin, |
64 | | const basegfx::B2DVector& rX, |
65 | | const svx::frame::Style& rStyle, |
66 | | const Color* pForceColor); |
67 | | |
68 | | void addSdrConnectStyleData( |
69 | | bool bStart, |
70 | | const svx::frame::Style& rStyle, |
71 | | const basegfx::B2DVector& rNormalizedPerpendicular, |
72 | | bool bStyleMirrored); |
73 | | |
74 | | void create2DDecomposition( |
75 | | Primitive2DContainer& rContainer, |
76 | | double fMinDiscreteUnit) const; |
77 | | |
78 | | double getMinimalNonZeroBorderWidth() const; |
79 | | bool operator==(const SdrFrameBorderData& rCompare) const; |
80 | | }; |
81 | | |
82 | | typedef std::vector<SdrFrameBorderData> SdrFrameBorderDataVector; |
83 | | |
84 | | } // end of namespace drawinglayer::primitive2d |
85 | | |
86 | | namespace drawinglayer::primitive2d |
87 | | { |
88 | | class SVXCORE_DLLPUBLIC SdrFrameBorderPrimitive2D final : public BufferedDecompositionPrimitive2D |
89 | | { |
90 | | private: |
91 | | SdrFrameBorderDataVector maFrameBorders; |
92 | | double mfMinimalNonZeroBorderWidth; |
93 | | double mfMinimalNonZeroBorderWidthUsedForDecompose; |
94 | | bool mbForceToSingleDiscreteUnit; |
95 | | |
96 | | // local decomposition. |
97 | | virtual Primitive2DReference create2DDecomposition( |
98 | | const geometry::ViewInformation2D& aViewInformation) const override; |
99 | | |
100 | | public: |
101 | | SdrFrameBorderPrimitive2D( |
102 | | SdrFrameBorderDataVector&& rFrameBorders, |
103 | | bool bForceToSingleDiscreteUnit); |
104 | | |
105 | | // compare operator |
106 | | virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; |
107 | | |
108 | | // override to get view-dependent |
109 | | virtual void get2DDecomposition( |
110 | | Primitive2DDecompositionVisitor& rVisitor, |
111 | | const geometry::ViewInformation2D& rViewInformation) const override; |
112 | | |
113 | | // data access |
114 | 17.7k | const SdrFrameBorderDataVector& getFrameBorders() const { return maFrameBorders; } |
115 | 13.3k | bool doForceToSingleDiscreteUnit() const { return mbForceToSingleDiscreteUnit; } |
116 | | |
117 | | // provide unique ID |
118 | | virtual sal_uInt32 getPrimitive2DID() const override; |
119 | | }; |
120 | | |
121 | | } // end of namespace drawinglayer::primitive2d |
122 | | |
123 | | |
124 | | #endif // INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRFRAMEBORDERPRIMITIVE2D_HXX |
125 | | |
126 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |