diff options
author | Olivier Hallot <olivier.hallot@edx.srv.br> | 2013-06-12 15:47:38 -0300 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-19 13:13:52 +0000 |
commit | d74323815aec2abb25eae026052651ceec7e372a (patch) | |
tree | 64bdc0e610bca40712aeddec444c7e8b5a10a355 /sw | |
parent | 97cd0f38a53f97034442de57d48006d30c4a94db (diff) |
Convert Drop Caps tab page to UI widgets
Conflicts:
sw/UIConfig_swriter.mk
Conflicts:
sw/source/ui/chrdlg/drpcps.cxx
Change-Id: Ic66f367d23b84666dd0165108c405b5b625b798b
Reviewed-on: https://gerrit.libreoffice.org/4236
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/UIConfig_swriter.mk | 1 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/drpcps.cxx | 280 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/drpcps.hrc | 45 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/drpcps.src | 142 | ||||
-rw-r--r-- | sw/source/ui/inc/drpcps.hxx | 48 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/dropcapspage.ui | 343 |
6 files changed, 519 insertions, 340 deletions
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index a5e5101dfc4c..d7f016d1bd9a 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -74,6 +74,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/converttexttable \ sw/uiconfig/swriter/ui/createauthorentry \ sw/uiconfig/swriter/ui/createautomarkdialog \ + sw/uiconfig/swriter/ui/dropcapspage \ sw/uiconfig/swriter/ui/dropdownfielddialog \ sw/uiconfig/swriter/ui/endnotepage \ sw/uiconfig/swriter/ui/editcategories \ diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index afb51f19b7ec..a404853129d5 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -26,6 +26,7 @@ #include "globals.hrc" #include <vcl/metric.hxx> + #include <svl/stritem.hxx> #include <editeng/fontitem.hxx> #include <sfx2/htmlmode.hxx> @@ -46,7 +47,6 @@ #include "charfmt.hxx" #include "chrdlg.hrc" -#include "drpcps.hrc" using namespace css; @@ -62,15 +62,16 @@ static sal_uInt16 aPageRg[] = { class SwDropCapsPict : public Control { + SwDropCapsPage* mpPage; String maText; String maScriptText; Color maBackColor; Color maTextLineColor; - sal_uInt8 mnLines; + sal_uInt8 mnLines; long mnTotLineH; long mnLineH; long mnTextH; - sal_uInt16 mnDistance; + sal_uInt16 mnDistance; Printer* mpPrinter; bool mbDelPrinter; /// The _ScriptInfo structure holds information on where we change from one @@ -99,47 +100,71 @@ class SwDropCapsPict : public Control void GetFontSettings( const SwDropCapsPage& _rPage, Font& _rFont, sal_uInt16 _nWhich ); void GetFirstScriptSegment(xub_StrLen &start, xub_StrLen &end, sal_uInt16 &scriptType); bool GetNextScriptSegment(size_t &nIdx, xub_StrLen &start, xub_StrLen &end, sal_uInt16 &scriptType); + public: - SwDropCapsPict(Window *pParent, const ResId &rResId) - : Control(pParent, rResId) + SwDropCapsPict(Window *pParent, WinBits nBits) + : Control(pParent, nBits) + , mpPage(NULL) , mnTotLineH(0) , mnLineH(0) , mnTextH(0) , mpPrinter( NULL ) , mbDelPrinter( false ) {} + + void SetDropCapsPage(SwDropCapsPage* pPage) { mpPage = pPage; } + ~SwDropCapsPict(); void UpdatePaintSettings( void ); // also invalidates control! - inline void SetText( const OUString& rT ); - inline void SetLines( sal_uInt8 nL ); - inline void SetDistance( sal_uInt16 nD ); - inline void SetValues( const String& rText, sal_uInt8 nLines, sal_uInt16 nDistance ); + virtual void Resize(); + virtual Size GetOptimalSize() const; + + void SetText( const OUString& rT ); + void SetLines( sal_uInt8 nL ); + void SetDistance( sal_uInt16 nD ); + void SetValues( const String& rText, sal_uInt8 nLines, sal_uInt16 nDistance ); void DrawPrev( const Point& rPt ); }; -inline void SwDropCapsPict::SetText( const OUString& rT ) +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwDropCapsPict(Window *pParent, VclBuilder::stringmap &) +{ + return new SwDropCapsPict(pParent, WB_BORDER); +} + +void SwDropCapsPict::SetText( const OUString& rT ) { maText = rT; UpdatePaintSettings(); } -inline void SwDropCapsPict::SetLines( sal_uInt8 nL ) +Size SwDropCapsPict::GetOptimalSize() const +{ + return LogicToPixel(Size(105 , 80), MAP_APPFONT); +} + +void SwDropCapsPict::Resize() +{ + Control::Resize(); + UpdatePaintSettings(); +} + +void SwDropCapsPict::SetLines( sal_uInt8 nL ) { mnLines = nL; UpdatePaintSettings(); } -inline void SwDropCapsPict::SetDistance( sal_uInt16 nD ) +void SwDropCapsPict::SetDistance( sal_uInt16 nD ) { mnDistance = nD; UpdatePaintSettings(); } -inline void SwDropCapsPict::SetValues( const String& rText, sal_uInt8 nLines, sal_uInt16 nDistance ) +void SwDropCapsPict::SetValues( const String& rText, sal_uInt8 nLines, sal_uInt16 nDistance ) { maText = rText; mnLines = nLines; @@ -148,7 +173,7 @@ inline void SwDropCapsPict::SetValues( const String& rText, sal_uInt8 nLines, sa UpdatePaintSettings(); } -inline void SwDropCapsPict::InitPrinter( void ) +void SwDropCapsPict::InitPrinter( void ) { if( !mpPrinter ) _InitPrinter(); @@ -178,7 +203,7 @@ static void calcFontHeightAnyAscent( OutputDevice* _pWin, Font& _rFont, long& _n } } - SwDropCapsPict::~SwDropCapsPict() +SwDropCapsPict::~SwDropCapsPict() { if( mbDelPrinter ) delete mpPrinter; @@ -244,34 +269,34 @@ void SwDropCapsPict::UpdatePaintSettings( void ) mnLineH = mnTotLineH - 2; Font aFont; + if (mpPage) { - SwDropCapsPage* pPage = ( SwDropCapsPage* ) GetParent(); - if (!pPage->aTemplateBox.GetSelectEntryPos()) + if (!mpPage->m_pTemplateBox->GetSelectEntryPos()) { // query the Font at paragraph's beginning - pPage->rSh.SttCrsrMove(); - pPage->rSh.Push(); - pPage->rSh.ClearMark(); + mpPage->rSh.SttCrsrMove(); + mpPage->rSh.Push(); + mpPage->rSh.ClearMark(); SwWhichPara pSwuifnParaCurr = GetfnParaCurr(); SwPosPara pSwuifnParaStart = GetfnParaStart(); - pPage->rSh.MovePara(pSwuifnParaCurr,pSwuifnParaStart); + mpPage->rSh.MovePara(pSwuifnParaCurr,pSwuifnParaStart); // normal - GetFontSettings( *pPage, aFont, RES_CHRATR_FONT ); + GetFontSettings( *mpPage, aFont, RES_CHRATR_FONT ); // CJK - GetFontSettings( *pPage, maCJKFont, RES_CHRATR_CJK_FONT ); + GetFontSettings( *mpPage, maCJKFont, RES_CHRATR_CJK_FONT ); // CTL - GetFontSettings( *pPage, maCTLFont, RES_CHRATR_CTL_FONT ); + GetFontSettings( *mpPage, maCTLFont, RES_CHRATR_CTL_FONT ); - pPage->rSh.Pop(sal_False); - pPage->rSh.EndCrsrMove(); + mpPage->rSh.Pop(sal_False); + mpPage->rSh.EndCrsrMove(); } else { // query Font at character template - SwCharFmt *pFmt = pPage->rSh.GetCharStyle( - pPage->aTemplateBox.GetSelectEntry(), + SwCharFmt *pFmt = mpPage->rSh.GetCharStyle( + mpPage->m_pTemplateBox->GetSelectEntry(), SwWrtShell::GETSTYLE_CREATEANY ); OSL_ENSURE(pFmt, "character style doesn't exist!"); const SvxFontItem &rFmtFont = pFmt->GetFont(); @@ -347,7 +372,7 @@ void SwDropCapsPict::Paint(const Rectangle &/*rRect*/) sal_uLong lDistance = mnDistance; sal_uInt16 nDistW = (sal_uInt16) (sal_uLong) (((lDistance * 100) / 240) * mnTotLineH) / 100; SetFillColor( maBackColor ); - if(((SwDropCapsPage*)GetParent())->aDropCapsBox.IsChecked()) + if (mpPage && mpPage->m_pDropCapsBox->IsChecked()) { Size aTextSize( maTextSize ); aTextSize.Width() += nDistW; @@ -507,61 +532,52 @@ SwDropCapsDlg::SwDropCapsDlg(Window *pParent, const SfxItemSet &rSet ) : { } -SwDropCapsPage::SwDropCapsPage(Window *pParent, const SfxItemSet &rSet) : - - SfxTabPage(pParent, SW_RES(TP_DROPCAPS), rSet), +SwDropCapsPage::SwDropCapsPage(Window *pParent, const SfxItemSet &rSet) + : SfxTabPage(pParent, "DropCapPage","modules/swriter/ui/dropcapspage.ui", rSet) + , bModified(false) + , bFormat(true) + , rSh(::GetActiveView()->GetWrtShell()) +{ + get(m_pDropCapsBox,"checkCB_SWITCH"); + get(m_pWholeWordCB,"checkCB_WORD"); + get(m_pDropCapsField,"spinFLD_DROPCAPS"); + get(m_pLinesField,"spinFLD_LINES"); + get(m_pDistanceField,"spinFLD_DISTANCE"); + get(m_pContentFL,"frameFL_CONTENT"); + get(m_pTextText,"labelTXT_TEXT"); + get(m_pTextEdit,"entryEDT_TEXT"); + get(m_pTemplateBox,"comboBOX_TEMPLATE"); + get(m_pPict,"drawingareaWN_EXAMPLE"); + m_pPict->SetDropCapsPage(this); - aSettingsFL (this, SW_RES(FL_SETTINGS)), - aDropCapsBox (this, SW_RES(CB_SWITCH )), - aWholeWordCB (this, SW_RES(CB_WORD )), - aSwitchText (this, SW_RES(FT_DROPCAPS )), - aDropCapsField(this, SW_RES(FLD_DROPCAPS)), - aLinesText (this, SW_RES(TXT_LINES )), - aLinesField (this, SW_RES(FLD_LINES )), - aDistanceText (this, SW_RES(TXT_DISTANCE)), - aDistanceField(this, SW_RES(FLD_DISTANCE)), - - aContentFL (this, SW_RES(FL_CONTENT )), - aTextText (this, SW_RES(TXT_TEXT )), - aTextEdit (this, SW_RES(EDT_TEXT )), - aTemplateText (this, SW_RES(TXT_TEMPLATE)), - aTemplateBox (this, SW_RES(BOX_TEMPLATE)), - - pPict (new SwDropCapsPict(this, SW_RES(CNT_PICT))), - - bModified(sal_False), - bFormat(sal_True), - rSh(::GetActiveView()->GetWrtShell()) -{ - FreeResource(); SetExchangeSupport(); sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current()); bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False; // In the template dialog the text is not influenceable - aTextText.Enable( !bFormat ); - aTextEdit.Enable( !bFormat ); + m_pTextText->Enable( !bFormat ); + m_pTextEdit->Enable( !bFormat ); // Metrics - SetMetric( aDistanceField, GetDfltMetric(bHtmlMode) ); + SetMetric( *m_pDistanceField, GetDfltMetric(bHtmlMode) ); + - pPict->SetBorderStyle( WINDOW_BORDER_MONO ); + m_pPict->SetBorderStyle( WINDOW_BORDER_MONO ); // Install handler Link aLk = LINK(this, SwDropCapsPage, ModifyHdl); - aDropCapsField.SetModifyHdl( aLk ); - aLinesField .SetModifyHdl( aLk ); - aDistanceField.SetModifyHdl( aLk ); - aTextEdit .SetModifyHdl( aLk ); - aDropCapsBox .SetClickHdl (LINK(this, SwDropCapsPage, ClickHdl )); - aTemplateBox .SetSelectHdl(LINK(this, SwDropCapsPage, SelectHdl)); - aWholeWordCB .SetClickHdl (LINK(this, SwDropCapsPage, WholeWordHdl )); + m_pDropCapsField->SetModifyHdl( aLk ); + m_pLinesField->SetModifyHdl( aLk ); + m_pDistanceField->SetModifyHdl( aLk ); + m_pTextEdit->SetModifyHdl( aLk ); + m_pDropCapsBox->SetClickHdl (LINK(this, SwDropCapsPage, ClickHdl )); + m_pTemplateBox->SetSelectHdl(LINK(this, SwDropCapsPage, SelectHdl)); + m_pWholeWordCB->SetClickHdl (LINK(this, SwDropCapsPage, WholeWordHdl )); } - SwDropCapsPage::~SwDropCapsPage() +SwDropCapsPage::~SwDropCapsPage() { - delete pPict; } int SwDropCapsPage::DeactivatePage(SfxItemSet * _pSet) @@ -603,45 +619,45 @@ void SwDropCapsPage::Reset(const SfxItemSet &rSet) SwFmtDrop aFmtDrop((SwFmtDrop &) rSet.Get(RES_PARATR_DROP)); if (aFmtDrop.GetLines() > 1) { - aDropCapsField.SetValue(aFmtDrop.GetChars()); - aLinesField .SetValue(aFmtDrop.GetLines()); - aDistanceField.SetValue(aDistanceField.Normalize(aFmtDrop.GetDistance()), FUNIT_TWIP); - aWholeWordCB .Check (aFmtDrop.GetWholeWord()); + m_pDropCapsField->SetValue(aFmtDrop.GetChars()); + m_pLinesField->SetValue(aFmtDrop.GetLines()); + m_pDistanceField->SetValue(m_pDistanceField->Normalize(aFmtDrop.GetDistance()), FUNIT_TWIP); + m_pWholeWordCB->Check(aFmtDrop.GetWholeWord()); } else { - aDropCapsField.SetValue(1); - aLinesField .SetValue(3); - aDistanceField.SetValue(0); + m_pDropCapsField->SetValue(1); + m_pLinesField->SetValue(3); + m_pDistanceField->SetValue(0); } - ::FillCharStyleListBox(aTemplateBox, rSh.GetView().GetDocShell(), true); + ::FillCharStyleListBox(*m_pTemplateBox, rSh.GetView().GetDocShell(), true); - aTemplateBox.InsertEntry(SW_RESSTR(SW_STR_NONE), 0); + m_pTemplateBox->InsertEntry(SW_RESSTR(SW_STR_NONE), 0); // Reset format - aTemplateBox.SelectEntryPos(0); + m_pTemplateBox->SelectEntryPos(0); if (aFmtDrop.GetCharFmt()) - aTemplateBox.SelectEntry(aFmtDrop.GetCharFmt()->GetName()); + m_pTemplateBox->SelectEntry(aFmtDrop.GetCharFmt()->GetName()); // Enable controls - aDropCapsBox.Check(aFmtDrop.GetLines() > 1); - const sal_uInt16 nVal = sal_uInt16(aDropCapsField.GetValue()); + m_pDropCapsBox->Check(aFmtDrop.GetLines() > 1); + const sal_uInt16 nVal = sal_uInt16(m_pDropCapsField->GetValue()); if (bFormat) - aTextEdit.SetText(GetDefaultString(nVal)); + m_pTextEdit->SetText(GetDefaultString(nVal)); else { - aTextEdit.SetText(rSh.GetDropTxt(nVal)); - aTextEdit.Enable(); - aTextText.Enable(); + m_pTextEdit->SetText(rSh.GetDropTxt(nVal)); + m_pTextEdit->Enable(); + m_pTextText->Enable(); } // Preview - pPict->SetValues( aTextEdit.GetText(), - sal_uInt8( aLinesField.GetValue() ), - sal_uInt16( aDistanceField.Denormalize( aDistanceField.GetValue( FUNIT_TWIP ) ) ) ); + m_pPict->SetValues( m_pTextEdit->GetText(), + sal_uInt8( m_pLinesField->GetValue() ), + sal_uInt16( m_pDistanceField->Denormalize( m_pDistanceField->GetValue( FUNIT_TWIP ) ) ) ); - ClickHdl(&aDropCapsBox); + ClickHdl(m_pDropCapsBox); bModified = sal_False; } @@ -652,28 +668,28 @@ Page: CheckBox's Click-Handler IMPL_LINK_NOARG(SwDropCapsPage, ClickHdl) { - sal_Bool bChecked = aDropCapsBox.IsChecked(); + sal_Bool bChecked = m_pDropCapsBox->IsChecked(); - aWholeWordCB .Enable( bChecked && !bHtmlMode ); + m_pWholeWordCB->Enable( bChecked && !bHtmlMode ); - aSwitchText.Enable( bChecked && !aWholeWordCB.IsChecked() ); - aDropCapsField.Enable( bChecked && !aWholeWordCB.IsChecked() ); - aLinesText .Enable( bChecked ); - aLinesField .Enable( bChecked ); - aDistanceText.Enable( bChecked ); - aDistanceField.Enable( bChecked ); - aTemplateText .Enable( bChecked ); - aTemplateBox .Enable( bChecked ); - aTextEdit .Enable( bChecked && !bFormat ); - aTextText .Enable( bChecked && !bFormat ); + //aSwitchText.Enable( bChecked && !m_pWholeWordCB->IsChecked() ); + m_pDropCapsField->Enable( bChecked && !m_pWholeWordCB->IsChecked() ); + //aLinesText .Enable( bChecked ); + m_pLinesField->Enable( bChecked ); + //aDistanceText.Enable( bChecked ); + m_pDistanceField->Enable( bChecked ); + //aTemplateText .Enable( bChecked ); + m_pTemplateBox->Enable( bChecked ); + m_pTextEdit->Enable( bChecked && !bFormat ); + //aTextText .Enable( bChecked && !bFormat ); if ( bChecked ) { - ModifyHdl(&aDropCapsField); - aDropCapsField.GrabFocus(); + ModifyHdl(m_pDropCapsField); + m_pDropCapsField->GrabFocus(); } else - pPict->SetText(aEmptyStr); + m_pPict->SetText(OUString()); bModified = sal_True; @@ -687,9 +703,9 @@ Page: CheckBox's Click-Handler IMPL_LINK_NOARG(SwDropCapsPage, WholeWordHdl) { - aDropCapsField.Enable( !aWholeWordCB.IsChecked() ); + m_pDropCapsField->Enable( !m_pWholeWordCB->IsChecked() ); - ModifyHdl(&aDropCapsField); + ModifyHdl(m_pDropCapsField); bModified = sal_True; @@ -706,13 +722,13 @@ IMPL_LINK( SwDropCapsPage, ModifyHdl, Edit *, pEdit ) String sPreview; // set text if applicable - if (pEdit == &aDropCapsField) + if (pEdit == m_pDropCapsField) { sal_uInt16 nVal; bool bSetText = false; - if (!aWholeWordCB.IsChecked()) - nVal = (sal_uInt16)aDropCapsField.GetValue(); + if (!m_pWholeWordCB->IsChecked()) + nVal = (sal_uInt16)m_pDropCapsField->GetValue(); else nVal = 0; @@ -724,7 +740,7 @@ IMPL_LINK( SwDropCapsPage, ModifyHdl, Edit *, pEdit ) sPreview = rSh.GetDropTxt(nVal); } - String sEdit(aTextEdit.GetText()); + String sEdit(m_pTextEdit->GetText()); if (sEdit.Len() && sPreview.CompareTo(sEdit, sEdit.Len()) != COMPARE_EQUAL) { @@ -733,23 +749,23 @@ IMPL_LINK( SwDropCapsPage, ModifyHdl, Edit *, pEdit ) } if (bSetText) - aTextEdit.SetText(sPreview); + m_pTextEdit->SetText(sPreview); } - else if (pEdit == &aTextEdit) // set quantity if applicable + else if (pEdit == m_pTextEdit) // set quantity if applicable { - sal_Int32 nTmp = aTextEdit.GetText().getLength(); - aDropCapsField.SetValue(std::max((sal_uInt16)1, (sal_uInt16)nTmp)); + sal_Int32 nTmp = m_pTextEdit->GetText().getLength(); + m_pDropCapsField->SetValue(std::max((sal_uInt16)1, (sal_uInt16)nTmp)); - sPreview = aTextEdit.GetText().copy(0, nTmp); + sPreview = m_pTextEdit->GetText().copy(0, nTmp); } // adjust image - if (pEdit == &aDropCapsField || pEdit == &aTextEdit) - pPict->SetText (sPreview); - else if (pEdit == &aLinesField) - pPict->SetLines((sal_uInt8)aLinesField.GetValue()); + if (pEdit == m_pDropCapsField || pEdit == m_pTextEdit) + m_pPict->SetText (sPreview); + else if (pEdit == m_pLinesField) + m_pPict->SetLines((sal_uInt8)m_pLinesField->GetValue()); else - pPict->SetDistance((sal_uInt16)aDistanceField.Denormalize(aDistanceField.GetValue(FUNIT_TWIP))); + m_pPict->SetDistance((sal_uInt16)m_pDistanceField->Denormalize(m_pDistanceField->GetValue(FUNIT_TWIP))); bModified = sal_True; @@ -763,7 +779,7 @@ Page: Template-Box' Select-Handler. IMPL_LINK_NOARG_INLINE_START(SwDropCapsPage, SelectHdl) { - pPict->UpdatePaintSettings(); + m_pPict->UpdatePaintSettings(); bModified = sal_True; return 0; } @@ -780,18 +796,18 @@ void SwDropCapsPage::FillSet( SfxItemSet &rSet ) { SwFmtDrop aFmt; - sal_Bool bOn = aDropCapsBox.IsChecked(); + sal_Bool bOn = m_pDropCapsBox->IsChecked(); if(bOn) { // quantity, lines, gap - aFmt.GetChars() = (sal_uInt8) aDropCapsField.GetValue(); - aFmt.GetLines() = (sal_uInt8) aLinesField.GetValue(); - aFmt.GetDistance() = (sal_uInt16) aDistanceField.Denormalize(aDistanceField.GetValue(FUNIT_TWIP)); - aFmt.GetWholeWord() = aWholeWordCB.IsChecked(); + aFmt.GetChars() = (sal_uInt8) m_pDropCapsField->GetValue(); + aFmt.GetLines() = (sal_uInt8) m_pLinesField->GetValue(); + aFmt.GetDistance() = (sal_uInt16) m_pDistanceField->Denormalize(m_pDistanceField->GetValue(FUNIT_TWIP)); + aFmt.GetWholeWord() = m_pWholeWordCB->IsChecked(); // template - if (aTemplateBox.GetSelectEntryPos()) - aFmt.SetCharFmt(rSh.GetCharStyle(aTemplateBox.GetSelectEntry())); + if (m_pTemplateBox->GetSelectEntryPos()) + aFmt.SetCharFmt(rSh.GetCharStyle(m_pTemplateBox->GetSelectEntry())); } else { @@ -808,12 +824,12 @@ void SwDropCapsPage::FillSet( SfxItemSet &rSet ) // hard text formatting // Bug 24974: in designer/template catalog this doesn't make sense!! - if( !bFormat && aDropCapsBox.IsChecked() ) + if( !bFormat && m_pDropCapsBox->IsChecked() ) { - String sText(aTextEdit.GetText()); + String sText(m_pTextEdit->GetText()); - if (!aWholeWordCB.IsChecked()) - sText.Erase( static_cast< xub_StrLen >(aDropCapsField.GetValue())); + if (!m_pWholeWordCB->IsChecked()) + sText.Erase( static_cast< xub_StrLen >(m_pDropCapsField->GetValue())); SfxStringItem aStr(FN_PARAM_1, sText); rSet.Put( aStr ); diff --git a/sw/source/ui/chrdlg/drpcps.hrc b/sw/source/ui/chrdlg/drpcps.hrc deleted file mode 100644 index 4dc16c29d1c6..000000000000 --- a/sw/source/ui/chrdlg/drpcps.hrc +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _DRPCPS_HRC -#define _DRPCPS_HRC - -// #define ****************************************************************** - -#define FT_DROPCAPS 1 -#define FLD_DROPCAPS 2 -#define TXT_LINES 3 -#define FLD_LINES 4 -#define TXT_DISTANCE 5 -#define FLD_DISTANCE 6 -#define CNT_PICT 7 -#define TXT_TEXT 8 -#define EDT_TEXT 9 -#define TXT_TEMPLATE 10 -#define BOX_TEMPLATE 11 -#define FL_SETTINGS 12 -#define CB_SWITCH 13 -#define FL_CONTENT 15 -#define CB_WORD 16 - -#endif - -// ********************************************************************** EOF - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/chrdlg/drpcps.src b/sw/source/ui/chrdlg/drpcps.src index 79b4a3e74fbe..6436ad0a97d0 100644 --- a/sw/source/ui/chrdlg/drpcps.src +++ b/sw/source/ui/chrdlg/drpcps.src @@ -19,7 +19,6 @@ #include "globals.hrc" #include "chrdlg.hrc" -#include "drpcps.hrc" #include "helpid.h" // TabDialog **************************************************************** TabDialog DLG_DROPCAPS @@ -42,146 +41,7 @@ TabDialog DLG_DROPCAPS }; }; }; - // TabPage ****************************************************************** -TabPage TP_DROPCAPS -{ - HelpID = HID_DROPCAPS ; - Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ; - Hide = TRUE ; - CheckBox CB_SWITCH - { - HelpID = "sw:CheckBox:TP_DROPCAPS:CB_SWITCH"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 90 , 10 ) ; - Text [ en-US ] = "Display drop caps" ; - }; - CheckBox CB_WORD - { - HelpID = "sw:CheckBox:TP_DROPCAPS:CB_WORD"; - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 90 , 10 ) ; - Text [ en-US ] = "~Whole word" ; - }; - FixedText FT_DROPCAPS - { - Pos = MAP_APPFONT ( 12 , 44 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Number of ~characters:" ; - }; - NumericField FLD_DROPCAPS - { - HelpID = "sw:NumericField:TP_DROPCAPS:FLD_DROPCAPS"; - Border = TRUE ; - First = 1 ; - Last = 9 ; - Left = TRUE ; - Maximum = 9 ; - Minimum = 1 ; - Pos = MAP_APPFONT ( 89 , 42 ) ; - Repeat = TRUE ; - Size = MAP_APPFONT ( 36 , 12 ) ; - Spin = TRUE ; - TabStop = TRUE ; - }; - FixedText TXT_LINES - { - Left = TRUE ; - Pos = MAP_APPFONT ( 12 , 60 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "~Lines" ; - }; - NumericField FLD_LINES - { - HelpID = "sw:NumericField:TP_DROPCAPS:FLD_LINES"; - Border = TRUE ; - First = 2 ; - Last = 9 ; - Left = TRUE ; - Maximum = 9 ; - Minimum = 2 ; - Pos = MAP_APPFONT ( 89 , 58 ) ; - Repeat = TRUE ; - Size = MAP_APPFONT ( 36 , 12 ) ; - Spin = TRUE ; - TabStop = TRUE ; - }; - FixedText TXT_DISTANCE - { - Left = TRUE ; - Pos = MAP_APPFONT ( 12 , 76 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Space to text" ; - }; - MetricField FLD_DISTANCE - { - HelpID = "sw:MetricField:TP_DROPCAPS:FLD_DISTANCE"; - Border = TRUE ; - DecimalDigits = 2 ; - First = 0 ; - Last = 200 ; - Left = TRUE ; - Maximum = 200 ; - Minimum = 0 ; - Pos = MAP_APPFONT ( 89 , 74 ) ; - Repeat = TRUE ; - Size = MAP_APPFONT ( 36 , 12 ) ; - Spin = TRUE ; - SpinSize = 10 ; - TabStop = TRUE ; - Unit = FUNIT_CM ; - }; - FixedLine FL_SETTINGS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 125 , 8 ) ; - Text [ en-US ] = "Settings" ; - }; - Control CNT_PICT - { - Border = TRUE ; - Pos = MAP_APPFONT ( 143 , 7 ) ; - Size = MAP_APPFONT ( 105 , 80 ) ; - }; - FixedText TXT_TEXT - { - Left = TRUE ; - Pos = MAP_APPFONT ( 12 , 102 ) ; - Size = MAP_APPFONT ( 125 , 8 ) ; - Text [ en-US ] = "~Text" ; - }; - Edit EDT_TEXT - { - HelpID = "sw:Edit:TP_DROPCAPS:EDT_TEXT"; - Border = TRUE ; - Left = TRUE ; - Pos = MAP_APPFONT ( 143 , 100 ) ; - Size = MAP_APPFONT ( 105 , 12 ) ; - TabStop = TRUE ; - MaxTextLength = 9 ; - }; - FixedText TXT_TEMPLATE - { - Left = TRUE ; - Pos = MAP_APPFONT ( 12 , 118 ) ; - Size = MAP_APPFONT ( 125 , 8 ) ; - Text [ en-US ] = "Character St~yle" ; - }; - ListBox BOX_TEMPLATE - { - HelpID = "sw:ListBox:TP_DROPCAPS:BOX_TEMPLATE"; - Border = TRUE ; - DropDown = TRUE ; - Pos = MAP_APPFONT ( 143 , 116 ) ; - Size = MAP_APPFONT ( 105 , 61 ) ; - TabStop = TRUE ; - }; - FixedLine FL_CONTENT - { - Pos = MAP_APPFONT ( 6 , 89 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Contents" ; - }; -}; + // ********************************************************************** EOF /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/inc/drpcps.hxx b/sw/source/ui/inc/drpcps.hxx index c6784d40f6fe..d0bcd7401cdc 100644 --- a/sw/source/ui/inc/drpcps.hxx +++ b/sw/source/ui/inc/drpcps.hxx @@ -53,28 +53,29 @@ class SwDropCapsPict; class SwDropCapsPage : public SfxTabPage { friend class SwDropCapsPict; - - FixedLine aSettingsFL; - CheckBox aDropCapsBox; - CheckBox aWholeWordCB; - FixedText aSwitchText; - NumericField aDropCapsField; - FixedText aLinesText; - NumericField aLinesField; - FixedText aDistanceText; - MetricField aDistanceField; - - FixedLine aContentFL; - FixedText aTextText; - Edit aTextEdit; - FixedText aTemplateText; - ListBox aTemplateBox; - - SwDropCapsPict *pPict; - - sal_Bool bModified; - sal_Bool bFormat; - sal_Bool bHtmlMode; + // TODO: Work in progress + VclGrid* m_pSwDropCapsGrid; + //FixedLine aSettingsFL; + CheckBox* m_pDropCapsBox; + CheckBox* m_pWholeWordCB; + //FixedText aSwitchText; + NumericField* m_pDropCapsField; + //FixedText aLinesText; + NumericField* m_pLinesField; + //FixedText aDistanceText; + MetricField* m_pDistanceField; + + VclFrame* m_pContentFL; + FixedText* m_pTextText; + Edit* m_pTextEdit; + //FixedText aTemplateText; + ListBox* m_pTemplateBox; + + SwDropCapsPict* m_pPict; + + sal_Bool bModified; + sal_Bool bFormat; + sal_Bool bHtmlMode; SwWrtShell &rSh; @@ -101,6 +102,9 @@ public: virtual void Reset (const SfxItemSet &rSet); void SetFormat(sal_Bool bSet){bFormat = bSet;} +protected: + void aSwitchText(sal_Bool bChecked); + //void SW_RES(int arg1); }; #endif diff --git a/sw/uiconfig/swriter/ui/dropcapspage.ui b/sw/uiconfig/swriter/ui/dropcapspage.ui new file mode 100644 index 000000000000..86b57d554085 --- /dev/null +++ b/sw/uiconfig/swriter/ui/dropcapspage.ui @@ -0,0 +1,343 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkAdjustment" id="adjustmentFLD_DISTANCE"> + <property name="upper">2</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustmentFLD_DROPCAPS"> + <property name="lower">1</property> + <property name="upper">9</property> + <property name="step_increment">1</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustmentFLD_LINES"> + <property name="lower">2</property> + <property name="upper">9</property> + <property name="value">2</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkGrid" id="DropCapPage"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="border_width">6</property> + <property name="row_spacing">12</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">12</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkCheckButton" id="checkCB_SWITCH"> + <property name="label" translatable="yes">_Display drop caps</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="checkCB_WORD"> + <property name="label" translatable="yes">_Whole word</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelFT_DROPCAPS"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Number of _characters:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">spinFLD_DROPCAPS</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelTXT_LINES"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Lines:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">spinFLD_LINES</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelTXT_DISTANCE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Space to text:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">spinFLD_DISTANCE:0cm</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">4</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="spinFLD_DROPCAPS"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustmentFLD_DROPCAPS</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="spinFLD_LINES"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustmentFLD_LINES</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="spinFLD_DISTANCE:0cm"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustmentFLD_DISTANCE</property> + <property name="digits">2</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">4</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="labelFL_SETTING"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Settings</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frameFL_CONTENT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">12</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel" id="labelTXT_TEXT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Text:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">entryEDT_TEXT</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelTXT_TEMPLATE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Character st_yle:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">comboBOX_TEMPLATE</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="entryEDT_TEXT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="max_length">9</property> + <property name="invisible_char">•</property> + <property name="invisible_char_set">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="comboBOX_TEMPLATE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="labelFL_CONTENT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Contents</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="swuilo-SwDropCapsPict" id="drawingareaWN_EXAMPLE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <object class="GtkSizeGroup" id="sizegroup1"> + <widgets> + <widget name="checkCB_SWITCH"/> + <widget name="checkCB_WORD"/> + <widget name="labelFT_DROPCAPS"/> + <widget name="labelTXT_LINES"/> + <widget name="labelTXT_DISTANCE"/> + <widget name="labelTXT_TEXT"/> + <widget name="labelTXT_TEMPLATE"/> + </widgets> + </object> + <object class="GtkSizeGroup" id="sizegroup2"> + <widgets> + <widget name="spinFLD_DROPCAPS"/> + <widget name="spinFLD_LINES"/> + <widget name="spinFLD_DISTANCE:0cm"/> + <widget name="entryEDT_TEXT"/> + <widget name="comboBOX_TEMPLATE"/> + </widgets> + </object> +</interface> |