LibreOffice Module sw (master)  1
drpcps.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 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_DRPCPS_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_DRPCPS_HXX
21 
22 #include <com/sun/star/i18n/XBreakIterator.hpp>
23 #include <editeng/svxfont.hxx>
24 #include <sfx2/basedlgs.hxx>
25 #include <sfx2/tabdlg.hxx>
26 #include <vcl/customweld.hxx>
27 #include <vcl/print.hxx>
28 
29 class SwWrtShell;
30 
32 {
33 public:
34  SwDropCapsDlg(weld::Window *pParent, const SfxItemSet &rSet);
35 };
36 
37 class SwDropCapsPage;
38 
40 {
42  OUString maText;
43  OUString maScriptText;
47  long mnTotLineH;
48  long mnLineH;
49  long mnTextH;
50  sal_uInt16 mnDistance;
55  struct ScriptInfo
56  {
58  sal_uInt16 const scriptType;
59  sal_Int32 const changePos;
60  ScriptInfo(sal_uInt16 scrptType, sal_Int32 position)
61  : textWidth(0), scriptType(scrptType), changePos(position) {}
62  };
63  std::vector<ScriptInfo> maScriptChanges;
68  css::uno::Reference< css::i18n::XBreakIterator > xBreak;
69 
70  virtual void Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle &rRect) override;
71  void CheckScript();
73  inline void InitPrinter();
74  void InitPrinter_();
75  static void GetFontSettings( const SwDropCapsPage& _rPage, vcl::Font& _rFont, sal_uInt16 _nWhich );
76  void GetFirstScriptSegment(sal_Int32 &start, sal_Int32 &end, sal_uInt16 &scriptType);
77  bool GetNextScriptSegment(size_t &nIdx, sal_Int32 &start, sal_Int32 &end, sal_uInt16 &scriptType);
78 
79 public:
80 
82  : mpPage(nullptr)
83  , mnLines(0)
84  , mnTotLineH(0)
85  , mnLineH(0)
86  , mnTextH(0)
87  , mnDistance(0)
88  , mpPrinter(nullptr)
89  , mbDelPrinter(false)
90  {}
91 
92  void SetDropCapsPage(SwDropCapsPage* pPage) { mpPage = pPage; }
93 
94  virtual ~SwDropCapsPict() override;
95 
96  void UpdatePaintSettings(); // also invalidates control!
97 
98  virtual void Resize() override;
99 
100  virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
101 
102  void SetText( const OUString& rT );
103  void SetLines( sal_uInt8 nL );
104  void SetDistance( sal_uInt16 nD );
105  void SetValues( const OUString& rText, sal_uInt8 nLines, sal_uInt16 nDistance );
106 
107  void DrawPrev(vcl::RenderContext& rRenderContext, const Point& rPt);
108 };
109 
111 {
112 friend class SwDropCapsPict;
114 
115  bool bModified;
116  bool bFormat;
117  bool bHtmlMode;
118 
120 
121  std::unique_ptr<weld::CheckButton> m_xDropCapsBox;
122  std::unique_ptr<weld::CheckButton> m_xWholeWordCB;
123  std::unique_ptr<weld::Label> m_xSwitchText;
124  std::unique_ptr<weld::SpinButton> m_xDropCapsField;
125  std::unique_ptr<weld::Label> m_xLinesText;
126  std::unique_ptr<weld::SpinButton> m_xLinesField;
127  std::unique_ptr<weld::Label> m_xDistanceText;
128  std::unique_ptr<weld::MetricSpinButton> m_xDistanceField;
129  std::unique_ptr<weld::Label> m_xTextText;
130  std::unique_ptr<weld::Entry> m_xTextEdit;
131  std::unique_ptr<weld::Label> m_xTemplateText;
132  std::unique_ptr<weld::ComboBox> m_xTemplateBox;
133  std::unique_ptr<weld::CustomWeld> m_xPict;
134 
135  virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
136  void FillSet( SfxItemSet &rSet );
137 
138  void ModifyEntry(weld::Entry& rEdit);
139 
140  DECL_LINK(ClickHdl, weld::ToggleButton&, void);
141  DECL_LINK(MetricValueChangedHdl, weld::MetricSpinButton&, void);
142  DECL_LINK(ValueChangedHdl, weld::SpinButton&, void);
143  DECL_LINK(ModifyHdl, weld::Entry&, void);
144  DECL_LINK(SelectHdl, weld::ComboBox&, void);
145  DECL_LINK(WholeWordHdl, weld::ToggleButton&, void);
146 
147  static const sal_uInt16 aPageRg[];
148 
149 public:
150  SwDropCapsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet);
151  virtual ~SwDropCapsPage() override;
152 
153  static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet);
154  static const sal_uInt16* GetRanges() { return aPageRg; }
155 
156 
157  virtual bool FillItemSet( SfxItemSet *rSet) override;
158  virtual void Reset (const SfxItemSet *rSet) override;
159 
160  void SetFormat(bool bSet){bFormat = bSet;}
161 };
162 
163 #endif
164 
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void UpdatePaintSettings()
Definition: drpcps.cxx:187
std::unique_ptr< weld::Entry > m_xTextEdit
Definition: drpcps.hxx:130
Size maTextSize
Definition: drpcps.hxx:67
bool GetNextScriptSegment(size_t &nIdx, sal_Int32 &start, sal_Int32 &end, sal_uInt16 &scriptType)
Get the details of the first script change.
Definition: drpcps.cxx:162
const SfxItemSet * pSet
SvxFont maCTLFont
Definition: drpcps.hxx:66
sal_uIntPtr sal_uLong
std::unique_ptr< weld::MetricSpinButton > m_xDistanceField
Definition: drpcps.hxx:128
The ScriptInfo structure holds information on where we change from one script to another.
Definition: drpcps.hxx:55
void GetFirstScriptSegment(sal_Int32 &start, sal_Int32 &end, sal_uInt16 &scriptType)
Get the details of the first script change.
Definition: drpcps.cxx:141
void SetFormat(bool bSet)
Definition: drpcps.hxx:160
void ModifyEntry(weld::Entry &rEdit)
Definition: drpcps.cxx:625
SvxFont maFont
Definition: drpcps.hxx:64
SwWrtShell & rSh
Definition: drpcps.hxx:119
std::unique_ptr< weld::ComboBox > m_xTemplateBox
Definition: drpcps.hxx:132
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: drpcps.cxx:69
void SetText(const OUString &rT)
Definition: drpcps.cxx:63
Color maBackColor
Definition: drpcps.hxx:44
sal_uInt16 mnDistance
Definition: drpcps.hxx:50
sal_uInt16 const scriptType
Script type (e.g. Latin, Asian, Complex)
Definition: drpcps.hxx:58
std::unique_ptr< weld::Label > m_xSwitchText
Definition: drpcps.hxx:123
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
long mnTextH
Definition: drpcps.hxx:49
static const sal_uInt16 aPageRg[]
Definition: drpcps.hxx:147
void SetLines(sal_uInt8 nL)
Definition: drpcps.cxx:82
void InitPrinter_()
Definition: drpcps.cxx:439
sal_uLong textWidth
Physical width of this segment.
Definition: drpcps.hxx:57
std::unique_ptr< weld::Label > m_xTextText
Definition: drpcps.hxx:129
SwDropCapsDlg(weld::Window *pParent, const SfxItemSet &rSet)
Definition: drpcps.cxx:453
void SetDistance(sal_uInt16 nD)
Definition: drpcps.cxx:88
bool bModified
Definition: drpcps.hxx:115
void CheckScript()
Definition: drpcps.cxx:343
static const sal_uInt16 * GetRanges()
Definition: drpcps.hxx:154
std::unique_ptr< weld::CheckButton > m_xDropCapsBox
Definition: drpcps.hxx:121
virtual void Paint(vcl::RenderContext &, const tools::Rectangle &rRect) override
Definition: drpcps.cxx:266
std::unique_ptr< weld::CustomWeld > m_xPict
Definition: drpcps.hxx:133
std::unique_ptr< weld::CheckButton > m_xWholeWordCB
Definition: drpcps.hxx:122
void FillSet(SfxItemSet &rSet)
Definition: drpcps.cxx:695
sal_uInt8 mnLines
Definition: drpcps.hxx:46
SwDropCapsPage * mpPage
Definition: drpcps.hxx:41
SwDropCapsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: drpcps.cxx:461
SwDropCapsPict m_aPict
Definition: drpcps.hxx:113
SvxFont maCJKFont
Definition: drpcps.hxx:65
css::uno::Reference< css::i18n::XBreakIterator > xBreak
Definition: drpcps.hxx:68
void InitPrinter()
Definition: drpcps.cxx:103
sal_Int32 const changePos
Character position where the script changes.
Definition: drpcps.hxx:59
ScriptInfo(sal_uInt16 scrptType, sal_Int32 position)
Definition: drpcps.hxx:60
DECL_LINK(ClickHdl, weld::ToggleButton &, void)
void SetValues(const OUString &rText, sal_uInt8 nLines, sal_uInt16 nDistance)
Definition: drpcps.cxx:94
virtual void Resize() override
Definition: drpcps.cxx:76
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: drpcps.cxx:527
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: drpcps.cxx:514
std::unique_ptr< weld::SpinButton > m_xLinesField
Definition: drpcps.hxx:126
virtual ~SwDropCapsPict() override
Definition: drpcps.cxx:131
std::unique_ptr< weld::Label > m_xTemplateText
Definition: drpcps.hxx:131
long mnLineH
Definition: drpcps.hxx:48
Size CalcTextSize()
Definition: drpcps.cxx:376
unsigned char sal_uInt8
static void GetFontSettings(const SwDropCapsPage &_rPage, vcl::Font &_rFont, sal_uInt16 _nWhich)
Definition: drpcps.cxx:175
Color maTextLineColor
Definition: drpcps.hxx:45
bool mbDelPrinter
Definition: drpcps.hxx:52
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: drpcps.cxx:522
virtual ~SwDropCapsPage() override
Definition: drpcps.cxx:510
void SetDropCapsPage(SwDropCapsPage *pPage)
Definition: drpcps.hxx:92
void DrawPrev(vcl::RenderContext &rRenderContext, const Point &rPt)
Definition: drpcps.cxx:308
bool bHtmlMode
Definition: drpcps.hxx:117
DeactivateRC
OUString maScriptText
Definition: drpcps.hxx:43
std::vector< ScriptInfo > maScriptChanges
Definition: drpcps.hxx:63
std::unique_ptr< weld::SpinButton > m_xDropCapsField
Definition: drpcps.hxx:124
std::unique_ptr< weld::Label > m_xLinesText
Definition: drpcps.hxx:125
VclPtr< Printer > mpPrinter
Definition: drpcps.hxx:51
virtual void Reset(const SfxItemSet *rSet) override
Definition: drpcps.cxx:534
OUString maText
Definition: drpcps.hxx:42
std::unique_ptr< weld::Label > m_xDistanceText
Definition: drpcps.hxx:127
long mnTotLineH
Definition: drpcps.hxx:47