Kaydet (Commit) 70d2a595 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SwDropCapsPage

Change-Id: Ic3438ff0862f74273fe0aec443aaeacee331abdd
Reviewed-on: https://gerrit.libreoffice.org/55843
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst f94292e8
...@@ -386,9 +386,6 @@ ...@@ -386,9 +386,6 @@
<glade-widget-class title="Caption Preview" name="swuilo-SwCaptionPreview" <glade-widget-class title="Caption Preview" name="swuilo-SwCaptionPreview"
generic-name="Caption Preview Window" parent="GtkDrawingArea" generic-name="Caption Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/> icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Drop Caps Preview" name="swuilo-SwDropCapsPict"
generic-name="Drop Caps Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Extension List" name="deploymentgui-ExtensionBox" <glade-widget-class title="Extension List" name="deploymentgui-ExtensionBox"
generic-name="Extensions List" parent="GtkDrawingArea" generic-name="Extensions List" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/> icon-name="widget-gtk-drawingarea"/>
......
This diff is collapsed.
...@@ -19,18 +19,20 @@ ...@@ -19,18 +19,20 @@
#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_DRPCPS_HXX #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_DRPCPS_HXX
#define INCLUDED_SW_SOURCE_UIBASE_INC_DRPCPS_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_DRPCPS_HXX
#include <editeng/svxfont.hxx>
#include <sfx2/basedlgs.hxx> #include <sfx2/basedlgs.hxx>
#include <sfx2/tabdlg.hxx> #include <sfx2/tabdlg.hxx>
#include <sfx2/printer.hxx>
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#include <vcl/field.hxx> #include <vcl/field.hxx>
#include <vcl/edit.hxx> #include <vcl/edit.hxx>
#include <vcl/lstbox.hxx> #include <vcl/lstbox.hxx>
#include <vcl/customweld.hxx>
#include <com/sun/star/i18n/BreakIterator.hpp>
class SwWrtShell; class SwWrtShell;
...@@ -40,25 +42,83 @@ public: ...@@ -40,25 +42,83 @@ public:
SwDropCapsDlg(vcl::Window *pParent, const SfxItemSet &rSet ); SwDropCapsDlg(vcl::Window *pParent, const SfxItemSet &rSet );
}; };
class SwDropCapsPict; class SwDropCapsPage;
class SwDropCapsPict : public weld::CustomWidgetController
{
VclPtr<SwDropCapsPage> mpPage;
OUString maText;
OUString maScriptText;
Color maBackColor;
Color maTextLineColor;
sal_uInt8 mnLines;
long mnTotLineH;
long mnLineH;
long mnTextH;
sal_uInt16 mnDistance;
VclPtr<Printer> mpPrinter;
bool mbDelPrinter;
/// The ScriptInfo structure holds information on where we change from one
/// script to another.
struct ScriptInfo
{
sal_uLong textWidth; ///< Physical width of this segment.
sal_uInt16 scriptType; ///< Script type (e.g. Latin, Asian, Complex)
sal_Int32 changePos; ///< Character position where the script changes.
ScriptInfo(sal_uInt16 scrptType, sal_Int32 position)
: textWidth(0), scriptType(scrptType), changePos(position) {}
};
std::vector<ScriptInfo> maScriptChanges;
SvxFont maFont;
SvxFont maCJKFont;
SvxFont maCTLFont;
Size maTextSize;
css::uno::Reference< css::i18n::XBreakIterator > xBreak;
virtual void Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle &rRect) override;
void CheckScript();
Size CalcTextSize();
inline void InitPrinter();
void InitPrinter_();
static void GetFontSettings( const SwDropCapsPage& _rPage, vcl::Font& _rFont, sal_uInt16 _nWhich );
void GetFirstScriptSegment(sal_Int32 &start, sal_Int32 &end, sal_uInt16 &scriptType);
bool GetNextScriptSegment(size_t &nIdx, sal_Int32 &start, sal_Int32 &end, sal_uInt16 &scriptType);
public:
SwDropCapsPict()
: mpPage(nullptr)
, mnLines(0)
, mnTotLineH(0)
, mnLineH(0)
, mnTextH(0)
, mnDistance(0)
, mpPrinter(nullptr)
, mbDelPrinter(false)
{}
void SetDropCapsPage(SwDropCapsPage* pPage) { mpPage = pPage; }
virtual ~SwDropCapsPict() override;
void UpdatePaintSettings(); // also invalidates control!
virtual void Resize() override;
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
void SetText( const OUString& rT );
void SetLines( sal_uInt8 nL );
void SetDistance( sal_uInt16 nD );
void SetValues( const OUString& rText, sal_uInt8 nLines, sal_uInt16 nDistance );
void DrawPrev(vcl::RenderContext& rRenderContext, const Point& rPt);
};
class SwDropCapsPage : public SfxTabPage class SwDropCapsPage : public SfxTabPage
{ {
friend class SwDropCapsPict; friend class SwDropCapsPict;
VclPtr<CheckBox> m_pDropCapsBox; SwDropCapsPict m_aPict;
VclPtr<CheckBox> m_pWholeWordCB;
VclPtr<FixedText> m_pSwitchText;
VclPtr<NumericField> m_pDropCapsField;
VclPtr<FixedText> m_pLinesText;
VclPtr<NumericField> m_pLinesField;
VclPtr<FixedText> m_pDistanceText;
VclPtr<MetricField> m_pDistanceField;
VclPtr<FixedText> m_pTextText;
VclPtr<Edit> m_pTextEdit;
VclPtr<FixedText> m_pTemplateText;
VclPtr<ListBox> m_pTemplateBox;
VclPtr<SwDropCapsPict> m_pPict;
bool bModified; bool bModified;
bool bFormat; bool bFormat;
...@@ -66,13 +126,31 @@ friend class SwDropCapsPict; ...@@ -66,13 +126,31 @@ friend class SwDropCapsPict;
SwWrtShell &rSh; SwWrtShell &rSh;
std::unique_ptr<weld::CheckButton> m_xDropCapsBox;
std::unique_ptr<weld::CheckButton> m_xWholeWordCB;
std::unique_ptr<weld::Label> m_xSwitchText;
std::unique_ptr<weld::SpinButton> m_xDropCapsField;
std::unique_ptr<weld::Label> m_xLinesText;
std::unique_ptr<weld::SpinButton> m_xLinesField;
std::unique_ptr<weld::Label> m_xDistanceText;
std::unique_ptr<weld::MetricSpinButton> m_xDistanceField;
std::unique_ptr<weld::Label> m_xTextText;
std::unique_ptr<weld::Entry> m_xTextEdit;
std::unique_ptr<weld::Label> m_xTemplateText;
std::unique_ptr<weld::ComboBoxText> m_xTemplateBox;
std::unique_ptr<weld::CustomWeld> m_xPict;
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
void FillSet( SfxItemSet &rSet ); void FillSet( SfxItemSet &rSet );
DECL_LINK( ClickHdl, Button*, void ); void ModifyEntry(weld::Entry& rEdit);
DECL_LINK( ModifyHdl, Edit&, void );
DECL_LINK( SelectHdl, ListBox&, void ); DECL_LINK(ClickHdl, weld::ToggleButton&, void);
DECL_LINK( WholeWordHdl, Button*, void ); DECL_LINK(MetricValueChangedHdl, weld::MetricSpinButton&, void);
DECL_LINK(ValueChangedHdl, weld::SpinButton&, void);
DECL_LINK(ModifyHdl, weld::Entry&, void);
DECL_LINK(SelectHdl, weld::ComboBoxText&, void);
DECL_LINK(WholeWordHdl, weld::ToggleButton&, void);
using SfxTabPage::ActivatePage; using SfxTabPage::ActivatePage;
using SfxTabPage::DeactivatePage; using SfxTabPage::DeactivatePage;
...@@ -80,9 +158,8 @@ friend class SwDropCapsPict; ...@@ -80,9 +158,8 @@ friend class SwDropCapsPict;
static const sal_uInt16 aPageRg[]; static const sal_uInt16 aPageRg[];
public: public:
SwDropCapsPage(vcl::Window *pParent, const SfxItemSet &rSet); SwDropCapsPage(TabPageParent pParent, const SfxItemSet &rSet);
virtual ~SwDropCapsPage() override; virtual ~SwDropCapsPage() override;
virtual void dispose() override;
static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet *rSet); static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet *rSet);
static const sal_uInt16* GetRanges() { return aPageRg; } static const sal_uInt16* GetRanges() { return aPageRg; }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.22.1 -->
<interface domain="sw"> <interface domain="sw">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkAdjustment" id="adjustmentFLD_DISTANCE"> <object class="GtkAdjustment" id="adjustmentFLD_DISTANCE">
<property name="upper">2</property> <property name="upper">2</property>
<property name="step_increment">0.10000000000000001</property> <property name="step_increment">0.10000000000000001</property>
...@@ -87,10 +86,10 @@ ...@@ -87,10 +86,10 @@
<object class="GtkLabel" id="labelFT_DROPCAPS"> <object class="GtkLabel" id="labelFT_DROPCAPS">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="dropcapspage|labelFT_DROPCAPS">Number of _characters:</property> <property name="label" translatable="yes" context="dropcapspage|labelFT_DROPCAPS">Number of _characters:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">spinFLD_DROPCAPS</property> <property name="mnemonic_widget">spinFLD_DROPCAPS</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -101,10 +100,10 @@ ...@@ -101,10 +100,10 @@
<object class="GtkLabel" id="labelTXT_LINES"> <object class="GtkLabel" id="labelTXT_LINES">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="dropcapspage|labelTXT_LINES">_Lines:</property> <property name="label" translatable="yes" context="dropcapspage|labelTXT_LINES">_Lines:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">spinFLD_LINES</property> <property name="mnemonic_widget">spinFLD_LINES</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -115,10 +114,10 @@ ...@@ -115,10 +114,10 @@
<object class="GtkLabel" id="labelTXT_DISTANCE"> <object class="GtkLabel" id="labelTXT_DISTANCE">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="dropcapspage|labelTXT_DISTANCE">_Space to text:</property> <property name="label" translatable="yes" context="dropcapspage|labelTXT_DISTANCE">_Space to text:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">spinFLD_DISTANCE:0cm</property> <property name="mnemonic_widget">spinFLD_DISTANCE</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -130,6 +129,7 @@ ...@@ -130,6 +129,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="activates_default">True</property>
<property name="adjustment">adjustmentFLD_DROPCAPS</property> <property name="adjustment">adjustmentFLD_DROPCAPS</property>
</object> </object>
<packing> <packing>
...@@ -142,6 +142,7 @@ ...@@ -142,6 +142,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="activates_default">True</property>
<property name="adjustment">adjustmentFLD_LINES</property> <property name="adjustment">adjustmentFLD_LINES</property>
</object> </object>
<packing> <packing>
...@@ -150,10 +151,11 @@ ...@@ -150,10 +151,11 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="spinFLD_DISTANCE:0cm"> <object class="GtkSpinButton" id="spinFLD_DISTANCE">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="activates_default">True</property>
<property name="adjustment">adjustmentFLD_DISTANCE</property> <property name="adjustment">adjustmentFLD_DISTANCE</property>
<property name="digits">2</property> <property name="digits">2</property>
</object> </object>
...@@ -204,10 +206,10 @@ ...@@ -204,10 +206,10 @@
<object class="GtkLabel" id="labelTXT_TEXT"> <object class="GtkLabel" id="labelTXT_TEXT">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="dropcapspage|labelTXT_TEXT">_Text:</property> <property name="label" translatable="yes" context="dropcapspage|labelTXT_TEXT">_Text:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">entryEDT_TEXT</property> <property name="mnemonic_widget">entryEDT_TEXT</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -218,10 +220,10 @@ ...@@ -218,10 +220,10 @@
<object class="GtkLabel" id="labelTXT_TEMPLATE"> <object class="GtkLabel" id="labelTXT_TEMPLATE">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="dropcapspage|labelTXT_TEMPLATE">Character st_yle:</property> <property name="label" translatable="yes" context="dropcapspage|labelTXT_TEMPLATE">Character st_yle:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">comboBOX_TEMPLATE</property> <property name="mnemonic_widget">comboBOX_TEMPLATE</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -233,6 +235,7 @@ ...@@ -233,6 +235,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="max_length">9</property> <property name="max_length">9</property>
<property name="activates_default">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
...@@ -240,7 +243,7 @@ ...@@ -240,7 +243,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBox" id="comboBOX_TEMPLATE"> <object class="GtkComboBoxText" id="comboBOX_TEMPLATE">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
</object> </object>
...@@ -283,11 +286,28 @@ ...@@ -283,11 +286,28 @@
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="top_padding">24</property> <property name="top_padding">24</property>
<child> <child>
<object class="swuilo-SwDropCapsPict" id="drawingareaWN_EXAMPLE"> <object class="GtkScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">start</property> <property name="valign">start</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkDrawingArea" id="drawingareaWN_EXAMPLE">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">start</property>
</object>
</child>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
...@@ -312,7 +332,7 @@ ...@@ -312,7 +332,7 @@
<widgets> <widgets>
<widget name="spinFLD_DROPCAPS"/> <widget name="spinFLD_DROPCAPS"/>
<widget name="spinFLD_LINES"/> <widget name="spinFLD_LINES"/>
<widget name="spinFLD_DISTANCE:0cm"/> <widget name="spinFLD_DISTANCE"/>
</widgets> </widgets>
</object> </object>
</interface> </interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment