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( 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
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(const weld::Entry& rEdit);
139
140 DECL_LINK(ClickHdl, weld::Toggleable&, 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::Toggleable&, void);
146
148
149public:
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);
155
156
157 virtual bool FillItemSet( SfxItemSet *rSet) override;
158 virtual void Reset (const SfxItemSet *rSet) override;
159
160 void SetFormat(bool bSet){m_bFormat = bSet;}
161};
162
163#endif
164
165/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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:464
std::unique_ptr< weld::CheckButton > m_xWholeWordCB
Definition: drpcps.hxx:122
std::unique_ptr< weld::ComboBox > m_xTemplateBox
Definition: drpcps.hxx:132
DECL_LINK(ClickHdl, weld::Toggleable &, void)
DECL_LINK(SelectHdl, weld::ComboBox &, void)
virtual ~SwDropCapsPage() override
Definition: drpcps.cxx:520
bool m_bModified
Definition: drpcps.hxx:117
std::unique_ptr< weld::Label > m_xSwitchText
Definition: drpcps.hxx:123
std::unique_ptr< weld::Entry > m_xTextEdit
Definition: drpcps.hxx:130
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: drpcps.cxx:524
void ModifyEntry(const weld::Entry &rEdit)
Definition: drpcps.cxx:638
std::unique_ptr< weld::Label > m_xTextText
Definition: drpcps.hxx:129
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: drpcps.cxx:537
static const WhichRangesContainer s_aPageRg
Definition: drpcps.hxx:147
std::unique_ptr< weld::SpinButton > m_xLinesField
Definition: drpcps.hxx:126
void FillSet(SfxItemSet &rSet)
Definition: drpcps.cxx:711
DECL_LINK(ValueChangedHdl, weld::SpinButton &, void)
std::unique_ptr< weld::CustomWeld > m_xPict
Definition: drpcps.hxx:133
std::unique_ptr< weld::SpinButton > m_xDropCapsField
Definition: drpcps.hxx:124
void SetFormat(bool bSet)
Definition: drpcps.hxx:160
SwDropCapsPict m_aPict
Definition: drpcps.hxx:115
SwDropCapsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: drpcps.cxx:472
virtual void Reset(const SfxItemSet *rSet) override
Definition: drpcps.cxx:544
DECL_LINK(WholeWordHdl, weld::Toggleable &, void)
std::unique_ptr< weld::CheckButton > m_xDropCapsBox
Definition: drpcps.hxx:121
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: drpcps.cxx:532
std::unique_ptr< weld::Label > m_xDistanceText
Definition: drpcps.hxx:127
DECL_LINK(MetricValueChangedHdl, weld::MetricSpinButton &, void)
std::unique_ptr< weld::Label > m_xTemplateText
Definition: drpcps.hxx:131
std::unique_ptr< weld::MetricSpinButton > m_xDistanceField
Definition: drpcps.hxx:128
static WhichRangesContainer GetRanges()
Definition: drpcps.hxx:154
DECL_LINK(ModifyHdl, weld::Entry &, void)
bool m_bHtmlMode
Definition: drpcps.hxx:119
std::unique_ptr< weld::Label > m_xLinesText
Definition: drpcps.hxx:125
bool m_bFormat
Definition: drpcps.hxx:118
void InitPrinter_()
Definition: drpcps.cxx:450
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:354
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
static void GetFontSettings(vcl::Font &_rFont, sal_uInt16 _nWhich)
Definition: drpcps.cxx:172
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
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:387
void SetDropCapsPage(SwDropCapsPage *pPage)
Definition: drpcps.hxx:94
bool mbDelPrinter
Definition: drpcps.hxx:54
void UpdatePaintSettings()
Definition: drpcps.cxx:189
virtual void Paint(vcl::RenderContext &, const tools::Rectangle &rRect) override
Definition: drpcps.cxx:277
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:319
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