LibreOffice Module svx (master)  1
framelink.hxx
Go to the documentation of this file.
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_FRAMELINK_HXX
21 #define INCLUDED_SVX_FRAMELINK_HXX
22 
23 #include <sal/types.h>
24 #include <tools/color.hxx>
25 #include <svx/svxdllapi.h>
26 #include <editeng/borderline.hxx>
27 
28 #include <memory>
29 
30 namespace svx::frame {
31 
32 
33 // Enums
34 
35 
38 enum class RefMode : sal_uInt8
39 {
41  Centered,
42 
48  Begin,
49 
55  End
56 };
57 
58 
59 // Classes
60 
61 
101 {
102 private:
106  double mfPrim;
107  double mfDist;
108  double mfSecn;
109  double mfPatternScale;
112  bool mbWordTableCell : 1;
113  bool mbUseGapColor : 1;
114 
115 public:
117  explicit Style();
119  explicit Style( double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale );
121  explicit Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale );
123  explicit Style( const editeng::SvxBorderLine* pBorder, double fScale );
124 
125  RefMode GetRefMode() const { return meRefMode; }
126  Color GetColorPrim() const { return maColorPrim; }
127  Color GetColorSecn() const { return maColorSecn; }
128  Color GetColorGap() const { return maColorGap; }
129  bool UseGapColor() const { return mbUseGapColor; }
130  double Prim() const { return mfPrim; }
131  double Dist() const { return mfDist; }
132  double Secn() const { return mfSecn; }
133  double PatternScale() const { return mfPatternScale;}
134  SvxBorderLineStyle Type() const { return mnType; }
135 
138  bool IsUsed() const { return 0.0 != mfPrim; }
139 
141  double GetWidth() const { return mfPrim + mfDist + mfSecn; }
142 
144  void Clear();
146  void Set( double nP, double nD, double nS );
148  void Set( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS );
150  void Set( const editeng::SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 );
151 
153  void SetRefMode( RefMode eRefMode ) { meRefMode = eRefMode; }
155  void SetColorPrim( const Color& rColor ) { maColorPrim = rColor; }
156  void SetColorSecn( const Color& rColor ) { maColorSecn = rColor; }
158  void SetType( SvxBorderLineStyle nType ) { mnType = nType; }
159 
161  Style& MirrorSelf();
162 
164  void SetWordTableCell(bool bWordTableCell) { mbWordTableCell = bWordTableCell; }
165 
166  bool operator==( const Style& rOther) const;
167  bool operator<( const Style& rOther) const;
168 };
169 
170 inline bool operator>( const Style& rL, const Style& rR ) { return rR.operator<(rL); }
171 
172 }
173 
174 
175 #endif
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
RefMode
Specifies how the reference points for frame borders are used.
Definition: framelink.hxx:38
double Dist() const
Definition: framelink.hxx:131
RefMode GetRefMode() const
Definition: framelink.hxx:125
SvxBorderLineStyle mnType
Reference point handling for this frame border.
Definition: framelink.hxx:111
The reference points specify the begin of the frame border width.
SvxBorderLineStyle Type() const
Definition: framelink.hxx:134
Color GetColorSecn() const
Definition: framelink.hxx:127
double GetWidth() const
Returns the total width of this frame style.
Definition: framelink.hxx:141
The reference points specify the end of the frame border width.
Color GetColorGap() const
Definition: framelink.hxx:128
bool IsUsed() const
Check if this style is used - this depends on it having any width definition.
Definition: framelink.hxx:138
RefMode meRefMode
Scale used for line pattern spacing.
Definition: framelink.hxx:110
bool UseGapColor() const
Definition: framelink.hxx:129
SvxBorderLineStyle
bool operator>(const Style &rL, const Style &rR)
Definition: framelink.hxx:170
double mfDist
Width of primary (single, left, or top) line.
Definition: framelink.hxx:107
double Secn() const
Definition: framelink.hxx:132
void SetColorSecn(const Color &rColor)
Definition: framelink.hxx:156
double PatternScale() const
Definition: framelink.hxx:133
#define SAL_WARN_UNUSED
void SetType(SvxBorderLineStyle nType)
Sets whether to use dotted style for single hair lines.
Definition: framelink.hxx:158
Color GetColorPrim() const
Definition: framelink.hxx:126
bool operator<(const Subset &rLHS, const Subset &rRHS)
Definition: ucsubset.hxx:49
void SetWordTableCell(bool bWordTableCell)
Enables the Word-compatible Style comparison code.
Definition: framelink.hxx:164
unsigned char sal_uInt8
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
Contains the widths of primary and secondary line of a frame style.
Definition: framelink.hxx:100
void SetColorPrim(const Color &rColor)
Sets a new color, does not modify other settings.
Definition: framelink.hxx:155
Frame borders are drawn centered to the reference points.
void SetRefMode(RefMode eRefMode)
Sets a new reference point handling mode, does not modify other settings.
Definition: framelink.hxx:153
double Prim() const
Definition: framelink.hxx:130
bool operator==(const ScCsvLayoutData &rData1, const ScCsvLayoutData &rData2)
double mfPatternScale
Width of secondary (right or bottom) line.
Definition: framelink.hxx:109
double mfSecn
Distance between primary and secondary line.
Definition: framelink.hxx:108