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