[PATCH] Convert Drop Caps tab page to UI widgets

Olivier Hallot (via Code Review) gerrit at gerrit.libreoffice.org
Wed Jun 12 11:52:43 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4236

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/36/4236/1

Convert Drop Caps tab page to UI widgets

Change-Id: Ic66f367d23b84666dd0165108c405b5b625b798b
---
M extras/source/glade/libreoffice-catalog.xml.in
M sw/UIConfig_swriter.mk
M sw/source/ui/chrdlg/drpcps.cxx
D sw/source/ui/chrdlg/drpcps.hrc
M sw/source/ui/chrdlg/drpcps.src
M sw/source/ui/inc/drpcps.hxx
A sw/uiconfig/swriter/ui/dropcapspage.ui
7 files changed, 502 insertions(+), 303 deletions(-)



diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 145b71c..06b4039 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -117,6 +117,9 @@
     <glade-widget-class title="Caption Preview" name="swuilo-SwCaptionPreview"
                         generic-name="Caption Preview Window" parent="GtkDrawingArea"
                         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-ExtBoxWithBtns"
                         generic-name="Extensions List" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index daf19a7..1108705 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -73,6 +73,7 @@
 	sw/uiconfig/swriter/ui/columnwidth \
 	sw/uiconfig/swriter/ui/converttexttable \
 	sw/uiconfig/swriter/ui/createauthorentry \
+	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 1a11874..9b0a505 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;
@@ -66,11 +66,11 @@
     String          maScriptText;
     Color           maBackColor;
     Color           maTextLineColor;
-    sal_uInt8           mnLines;
+    sal_uInt8       mnLines;
     long            mnTotLineH;
     long            mnLineH;
     long            mnTextH;
-    sal_uInt16          mnDistance;
+    sal_uInt16      mnDistance;
     sal_Int32       mnLeading;
     Printer*        mpPrinter;
     bool            mbDelPrinter;
@@ -100,6 +100,7 @@
     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)
@@ -110,9 +111,24 @@
         , mpPrinter( NULL )
         , mbDelPrinter( false )
     {}
+
+    SwDropCapsPict(Window *pParent, WinBits nBits)
+        : Control(pParent, nBits)
+        , mnTotLineH(0)
+        , mnLineH(0)
+        , mnTextH(0)
+        , mpPrinter( NULL )
+        , mbDelPrinter( false )
+    {}
+
     ~SwDropCapsPict();
 
     void UpdatePaintSettings( void );       // also invalidates control!
+
+    // TODO: Work in progress
+    inline void     SetPictSize();
+    virtual Size    GetOptimalPictSize() const;
+    // end WIP
 
     inline void SetText( const OUString& rT );
     inline void SetLines( sal_uInt8 nL );
@@ -121,12 +137,28 @@
 
     void        DrawPrev( const Point& rPt );
 };
+// TODO: Work in progress
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwDropCapsPict(Window *pParent, VclBuilder::stringmap &)
+{
+    return new SwDropCapsPict(pParent, WB_BORDER);
+}
 
 inline void SwDropCapsPict::SetText( const OUString& rT )
 {
     maText = rT;
     UpdatePaintSettings();
 }
+// TODO: Work in progress
+inline void SwDropCapsPict::SetPictSize()
+{
+}
+
+// TODO: Work in progress
+Size SwDropCapsPict::GetOptimalPictSize() const
+{
+    return LogicToPixel(Size(105 , 80), MAP_APPFONT);
+}
+
 
 inline void SwDropCapsPict::SetLines( sal_uInt8 nL )
 {
@@ -248,7 +280,7 @@
     Font aFont;
     {
         SwDropCapsPage* pPage = ( SwDropCapsPage* ) GetParent();
-        if (!pPage->aTemplateBox.GetSelectEntryPos())
+        if (!pPage->m_pTemplateBox->GetSelectEntryPos())
         {
             // query the Font at paragraph's beginning
             pPage->rSh.SttCrsrMove();
@@ -273,7 +305,7 @@
         {
             // query Font at character template
             SwCharFmt *pFmt = pPage->rSh.GetCharStyle(
-                                    pPage->aTemplateBox.GetSelectEntry(),
+                                    pPage->m_pTemplateBox->GetSelectEntry(),
                                     SwWrtShell::GETSTYLE_CREATEANY );
             OSL_ENSURE(pFmt, "character style doesn't exist!");
             const SvxFontItem &rFmtFont = pFmt->GetFont();
@@ -331,7 +363,8 @@
 
     SetFillColor( maBackColor );
 
-    Size aOutputSizePixel( GetOutputSizePixel() );
+    //Size aOutputSizePixel( GetOutputSizePixel() );
+    Size aOutputSizePixel( GetOptimalSize() );
 
     DrawRect(Rectangle(Point(0, 0), aOutputSizePixel ));
     SetClipRegion(Region(Rectangle(
@@ -349,7 +382,7 @@
     sal_uLong lDistance = mnDistance;
     sal_uInt16 nDistW = (sal_uInt16) (sal_uLong) (((lDistance * 100) / 240) * mnTotLineH) / 100;
     SetFillColor( maBackColor );
-    if(((SwDropCapsPage*)GetParent())->aDropCapsBox.IsChecked())
+    if(((SwDropCapsPage*)GetParent())->m_pDropCapsBox->IsChecked())
     {
         Size    aTextSize( maTextSize );
         aTextSize.Width() += nDistW;
@@ -511,54 +544,55 @@
 
 SwDropCapsPage::SwDropCapsPage(Window *pParent, const SfxItemSet &rSet) :
 
-    SfxTabPage(pParent, SW_RES(TP_DROPCAPS), rSet),
+    SfxTabPage(pParent, "DropCapPage","modules/swriter/ui/dropcapspage.ui", rSet),
 
-    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))),
-
+    //pPict         (new SwDropCapsPict(this, SW_RES(CNT_PICT))),
     bModified(sal_False),
     bFormat(sal_True),
     rSh(::GetActiveView()->GetWrtShell())
 {
-    FreeResource();
+    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");
+
+// TODO: Work in progress
+    get(m_pSwDropCapsGrid,"DropCapPage");
+    pPict = new SwDropCapsPict(m_pSwDropCapsGrid, WB_BORDER);
+
+    pPict->set_grid_left_attach(0);
+    pPict->set_grid_top_attach(0);
+    pPict->SetPictSize();
+// end WIP
     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 );
 
     // 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()
@@ -605,45 +639,45 @@
     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 ) ) ) );
+    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;
 }
 
@@ -654,25 +688,25 @@
 
 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);
@@ -689,9 +723,9 @@
 
 IMPL_LINK_NOARG(SwDropCapsPage, WholeWordHdl)
 {
-    aDropCapsField.Enable( !aWholeWordCB.IsChecked() );
+    m_pDropCapsField->Enable( !m_pWholeWordCB->IsChecked() );
 
-    ModifyHdl(&aDropCapsField);
+    ModifyHdl(m_pDropCapsField);
 
     bModified = sal_True;
 
@@ -708,13 +742,13 @@
     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;
 
@@ -726,7 +760,7 @@
             sPreview = rSh.GetDropTxt(nVal);
         }
 
-        String sEdit(aTextEdit.GetText());
+        String sEdit(m_pTextEdit->GetText());
 
         if (sEdit.Len() && sPreview.CompareTo(sEdit, sEdit.Len()) != COMPARE_EQUAL)
         {
@@ -735,23 +769,23 @@
         }
 
         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)
+    if (pEdit == m_pDropCapsField || pEdit == m_pTextEdit)
         pPict->SetText (sPreview);
-    else if (pEdit == &aLinesField)
-        pPict->SetLines((sal_uInt8)aLinesField.GetValue());
+    else if (pEdit == m_pLinesField)
+        pPict->SetLines((sal_uInt8)m_pLinesField->GetValue());
     else
-        pPict->SetDistance((sal_uInt16)aDistanceField.Denormalize(aDistanceField.GetValue(FUNIT_TWIP)));
+        pPict->SetDistance((sal_uInt16)m_pDistanceField->Denormalize(m_pDistanceField->GetValue(FUNIT_TWIP)));
 
     bModified = sal_True;
 
@@ -782,18 +816,18 @@
     {
         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
         {
@@ -810,12 +844,12 @@
 
         // 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 4dc16c2..0000000
--- 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 79b4a3e..6436ad0 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 @@
         };
     };
 };
- // 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 c6784d4..9cc5d84 100644
--- a/sw/source/ui/inc/drpcps.hxx
+++ b/sw/source/ui/inc/drpcps.hxx
@@ -53,28 +53,29 @@
 class SwDropCapsPage : public SfxTabPage
 {
 friend class SwDropCapsPict;
+    // 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;
 
-    FixedLine       aSettingsFL;
-    CheckBox        aDropCapsBox;
-    CheckBox        aWholeWordCB;
-    FixedText       aSwitchText;
-    NumericField    aDropCapsField;
-    FixedText       aLinesText;
-    NumericField    aLinesField;
-    FixedText       aDistanceText;
-    MetricField     aDistanceField;
+    VclFrame*        m_pContentFL;
+    FixedText*       m_pTextText;
+    Edit*            m_pTextEdit;
+    //FixedText       aTemplateText;
+    ListBox*         m_pTemplateBox;
 
-    FixedLine       aContentFL;
-    FixedText       aTextText;
-    Edit            aTextEdit;
-    FixedText       aTemplateText;
-    ListBox         aTemplateBox;
+    SwDropCapsPict   *pPict;
 
-    SwDropCapsPict  *pPict;
-
-    sal_Bool            bModified;
-    sal_Bool            bFormat;
-    sal_Bool            bHtmlMode;
+    sal_Bool          bModified;
+    sal_Bool          bFormat;
+    sal_Bool          bHtmlMode;
 
     SwWrtShell &rSh;
 
@@ -101,6 +102,9 @@
     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 0000000..50f7e42
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/dropcapspage.ui
@@ -0,0 +1,342 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <!-- interface-requires LibreOffice 1.0 -->
+  <object class="GtkAdjustment" id="adjustmentFLD_DISTANCE">
+    <property name="upper">200</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</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">6</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>
+                      </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="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>

-- 
To view, visit https://gerrit.libreoffice.org/4236
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic66f367d23b84666dd0165108c405b5b625b798b
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Olivier Hallot <olivier.hallot at edx.srv.br>



More information about the LibreOffice mailing list