[Libreoffice-commits] core.git: cui/source cui/uiconfig include/sfx2 sfx2/Library_sfx.mk sfx2/source svx/source sw/source sw/uiconfig
Caolán McNamara
caolanm at redhat.com
Wed Jun 19 07:18:51 PDT 2013
cui/source/tabpages/paragrph.cxx | 29 --------
cui/uiconfig/ui/paragalignpage.ui | 116 ++++++++++++++++-----------------
cui/uiconfig/ui/paraindentspacing.ui | 46 ++++++-------
include/sfx2/dialoghelper.hxx | 32 +++++++++
sfx2/Library_sfx.mk | 1
sfx2/source/dialog/dialoghelper.cxx | 59 ++++++++++++++++
svx/source/dialog/paraprev.cxx | 3
sw/source/ui/chrdlg/drpcps.cxx | 5 +
sw/uiconfig/swriter/ui/dropcapspage.ui | 64 ++++++++++--------
9 files changed, 217 insertions(+), 138 deletions(-)
New commits:
commit d3c1c8d7587239abcf5448ee143a61fe54b01422
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 19 15:13:04 2013 +0100
expand scheme to share sizes for paragraph dialog preview widgets
Change-Id: Id1ded6828468ff956c83eb57f1da62fd80761b5d
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index e17f61c..a0844d4 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -19,6 +19,7 @@
#include <svl/style.hxx>
#include <sfx2/app.hxx>
+#include <sfx2/dialoghelper.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/module.hxx>
#include <vcl/mnemonic.hxx>
@@ -634,34 +635,6 @@ int SvxStdParagraphTabPage::DeactivatePage( SfxItemSet* _pSet )
return LEAVE_PAGE;
}
-namespace
-{
- //these tab pages both have the same basic layout with a preview on the
- //right, get both of their non-preview areas to request the same size
- //so that the preview appears in the same place in each one so
- //flipping between tabs isn't distracting as it jumps around
- void setPreviewsToSamePlace(Window *pParent, VclBuilderContainer *pPage)
- {
- for (Window* pChild = pParent->GetWindow(WINDOW_FIRSTCHILD); pChild;
- pChild = pChild->GetWindow(WINDOW_NEXT))
- {
- VclBuilderContainer *pPeer = dynamic_cast<VclBuilderContainer*>(pChild);
- if (pPeer != pPage && pPeer->hasBuilder())
- {
- Window *pOtherGrid = pPeer->get<Window>("maingrid");
- Window *pOurGrid = pPage->get<Window>("maingrid");
- if (pOtherGrid && pOurGrid)
- {
- boost::shared_ptr< VclSizeGroup > xGroup(new VclSizeGroup);
- pOtherGrid->add_to_size_group(xGroup);
- pOurGrid->add_to_size_group(xGroup);
- }
- }
- }
- }
-}
-
-
// -----------------------------------------------------------------------
SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window* pParent, const SfxItemSet& rAttr ) :
diff --git a/cui/uiconfig/ui/paragalignpage.ui b/cui/uiconfig/ui/paragalignpage.ui
index 68238bc..920832d 100644
--- a/cui/uiconfig/ui/paragalignpage.ui
+++ b/cui/uiconfig/ui/paragalignpage.ui
@@ -2,6 +2,62 @@
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-requires LibreOffice 1.0 -->
+ <object class="GtkListStore" id="liststoreLB_LASTLINE">
+ <columns>
+ <!-- column-name gchararray1 -->
+ <column type="gchararray"/>
+ <!-- column-name guint1 -->
+ <column type="guint"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Default</col>
+ <col id="1">0</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Left</col>
+ <col id="1">1</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Centered</col>
+ <col id="1">2</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Justified</col>
+ <col id="1">3</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="liststoreLB_VERTALIGN">
+ <columns>
+ <!-- column-name gchararray1 -->
+ <column type="gchararray"/>
+ <!-- column-name guint1 -->
+ <column type="guint"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Automatic</col>
+ <col id="1">0</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Base line</col>
+ <col id="1">1</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Top</col>
+ <col id="1">2</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Middle</col>
+ <col id="1">3</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Bottom</col>
+ <col id="1">4</col>
+ </row>
+ </data>
+ </object>
<object class="GtkGrid" id="ParaAlignPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -14,17 +70,15 @@
<object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_top">24</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
+ <property name="top_padding">24</property>
<child>
<object class="svxlo-SvxParaPrevWindow" id="drawingareaWN_EXAMPLE">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">start</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="drawingareaWN_EXAMPLE-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Example</property>
@@ -426,62 +480,6 @@
</packing>
</child>
</object>
- <object class="GtkListStore" id="liststoreLB_LASTLINE">
- <columns>
- <!-- column-name gchararray1 -->
- <column type="gchararray"/>
- <!-- column-name guint1 -->
- <column type="guint"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Default</col>
- <col id="1">0</col>
- </row>
- <row>
- <col id="0" translatable="yes">Left</col>
- <col id="1">1</col>
- </row>
- <row>
- <col id="0" translatable="yes">Centered</col>
- <col id="1">2</col>
- </row>
- <row>
- <col id="0" translatable="yes">Justified</col>
- <col id="1">3</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="liststoreLB_VERTALIGN">
- <columns>
- <!-- column-name gchararray1 -->
- <column type="gchararray"/>
- <!-- column-name guint1 -->
- <column type="guint"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Automatic</col>
- <col id="1">0</col>
- </row>
- <row>
- <col id="0" translatable="yes">Base line</col>
- <col id="1">1</col>
- </row>
- <row>
- <col id="0" translatable="yes">Top</col>
- <col id="1">2</col>
- </row>
- <row>
- <col id="0" translatable="yes">Middle</col>
- <col id="1">3</col>
- </row>
- <row>
- <col id="0" translatable="yes">Bottom</col>
- <col id="1">4</col>
- </row>
- </data>
- </object>
<object class="GtkSizeGroup" id="sizegroup1">
<widgets>
<widget name="box1"/>
diff --git a/cui/uiconfig/ui/paraindentspacing.ui b/cui/uiconfig/ui/paraindentspacing.ui
index 82df1ba..f38dc87 100644
--- a/cui/uiconfig/ui/paraindentspacing.ui
+++ b/cui/uiconfig/ui/paraindentspacing.ui
@@ -2,6 +2,28 @@
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-requires LibreOffice 1.0 -->
+ <object class="GtkAdjustment" id="adjustmentED_DIST">
+ <property name="upper">9999</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustmentED_LINEDISTMETRIC">
+ <property name="upper">9999</property>
+ <property name="step_increment">10</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustmentLINEDISTPERCENT">
+ <property name="lower">50</property>
+ <property name="upper">200</property>
+ <property name="value">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustmentspinED_INDENT">
+ <property name="upper">9999</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkGrid" id="ParaIndentSpacing">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -14,9 +36,9 @@
<object class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_top">24</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
+ <property name="top_padding">24</property>
<child>
<object class="svxlo-SvxParaPrevWindow" id="drawingareaWN_EXAMPLE">
<property name="visible">True</property>
@@ -504,28 +526,6 @@
</packing>
</child>
</object>
- <object class="GtkAdjustment" id="adjustmentED_DIST">
- <property name="upper">9999</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustmentED_LINEDISTMETRIC">
- <property name="upper">9999</property>
- <property name="step_increment">10</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustmentLINEDISTPERCENT">
- <property name="lower">50</property>
- <property name="upper">200</property>
- <property name="value">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustmentspinED_INDENT">
- <property name="upper">9999</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
<object class="GtkListStore" id="liststoreLB_LINEDIST">
<columns>
<!-- column-name gchararray1 -->
diff --git a/include/sfx2/dialoghelper.hxx b/include/sfx2/dialoghelper.hxx
new file mode 100644
index 0000000..c15f23b7
--- /dev/null
+++ b/include/sfx2/dialoghelper.hxx
@@ -0,0 +1,32 @@
+/* -*- 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/.
+ */
+
+#ifndef _SFX_DIALOGHELPER_HXX
+#define _SFX_DIALOGHELPER_HXX
+
+#include "sfx2/dllapi.h"
+#include <tools/gen.hxx>
+
+class Window;
+class VclBuilderContainer;
+
+//when two tab pages both have the same basic layout with a preview on the
+//right, get both of their non-preview areas to request the same size so that
+//the preview appears in the same place in each one so flipping between tabs
+//isn't distracting as it jumps around
+//
+//there has to be a "maingrid" container which contains all the widgets
+//except for the preview widget
+void SFX2_DLLPUBLIC setPreviewsToSamePlace(Window *pParent, VclBuilderContainer *pPage);
+
+Size SFX2_DLLPUBLIC getParagraphPreviewOptimalSize(const Window *pReference);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index aefe3a2..161a6f7 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -150,6 +150,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/dialog/alienwarn \
sfx2/source/dialog/basedlgs \
sfx2/source/dialog/checkin \
+ sfx2/source/dialog/dialoghelper \
sfx2/source/dialog/dinfdlg \
sfx2/source/dialog/dinfedt \
sfx2/source/dialog/dockwin \
diff --git a/sfx2/source/dialog/dialoghelper.cxx b/sfx2/source/dialog/dialoghelper.cxx
new file mode 100644
index 0000000..89fd3ad
--- /dev/null
+++ b/sfx2/source/dialog/dialoghelper.cxx
@@ -0,0 +1,59 @@
+/* -*- 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/.
+ */
+
+#include <sfx2/dialoghelper.hxx>
+#include <vcl/builder.hxx>
+#include <vcl/layout.hxx>
+#include <vector>
+
+//these tab pages both have the same basic layout with a preview on the
+//right, get both of their non-preview areas to request the same size
+//so that the preview appears in the same place in each one so
+//flipping between tabs isn't distracting as it jumps around
+void setPreviewsToSamePlace(Window *pParent, VclBuilderContainer *pPage)
+{
+ Window *pOurGrid = pPage->get<Window>("maingrid");
+ if (!pOurGrid)
+ return;
+
+ std::vector<Window*> aGrids;
+ aGrids.push_back(pOurGrid);
+
+ for (Window* pChild = pParent->GetWindow(WINDOW_FIRSTCHILD); pChild;
+ pChild = pChild->GetWindow(WINDOW_NEXT))
+ {
+ VclBuilderContainer *pPeer = dynamic_cast<VclBuilderContainer*>(pChild);
+ if (!pPeer || pPeer == pPage || !pPeer->hasBuilder())
+ continue;
+
+ Window *pOtherGrid = pPeer->get<Window>("maingrid");
+ if (!pOtherGrid)
+ continue;
+
+ aGrids.push_back(pOtherGrid);
+ }
+
+ if (aGrids.size() > 1)
+ {
+ boost::shared_ptr< VclSizeGroup > xGroup(new VclSizeGroup);
+ for (std::vector<Window*>::iterator aI = aGrids.begin(); aI != aGrids.end(); ++aI)
+ {
+ Window *pWindow = *aI;
+ pWindow->remove_from_all_size_groups();
+ pWindow->add_to_size_group(xGroup);
+ }
+ }
+}
+
+Size getParagraphPreviewOptimalSize(const Window *pReference)
+{
+ return pReference->LogicToPixel(Size(68 , 112), MAP_APPFONT);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/paraprev.cxx b/svx/source/dialog/paraprev.cxx
index 255f42b6..8de4a37 100644
--- a/svx/source/dialog/paraprev.cxx
+++ b/svx/source/dialog/paraprev.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sfx2/dialoghelper.hxx>
#include <svx/paraprev.hxx>
#include <vcl/builder.hxx>
@@ -75,7 +76,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxParaPrevWindow(Window *p
Size SvxParaPrevWindow::GetOptimalSize() const
{
- return LogicToPixel(Size(68 , 112), MAP_APPFONT);
+ return getParagraphPreviewOptimalSize(this);
}
// -----------------------------------------------------------------------
diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx
index a404853..6b33d81 100644
--- a/sw/source/ui/chrdlg/drpcps.cxx
+++ b/sw/source/ui/chrdlg/drpcps.cxx
@@ -29,6 +29,7 @@
#include <svl/stritem.hxx>
#include <editeng/fontitem.hxx>
+#include <sfx2/dialoghelper.hxx>
#include <sfx2/htmlmode.hxx>
#include <sfx2/objsh.hxx>
#include <editeng/svxfont.hxx>
@@ -143,7 +144,7 @@ void SwDropCapsPict::SetText( const OUString& rT )
Size SwDropCapsPict::GetOptimalSize() const
{
- return LogicToPixel(Size(105 , 80), MAP_APPFONT);
+ return getParagraphPreviewOptimalSize(this);
}
void SwDropCapsPict::Resize()
@@ -574,6 +575,8 @@ SwDropCapsPage::SwDropCapsPage(Window *pParent, const SfxItemSet &rSet)
m_pDropCapsBox->SetClickHdl (LINK(this, SwDropCapsPage, ClickHdl ));
m_pTemplateBox->SetSelectHdl(LINK(this, SwDropCapsPage, SelectHdl));
m_pWholeWordCB->SetClickHdl (LINK(this, SwDropCapsPage, WholeWordHdl ));
+
+ setPreviewsToSamePlace(pParent, this);
}
SwDropCapsPage::~SwDropCapsPage()
diff --git a/sw/uiconfig/swriter/ui/dropcapspage.ui b/sw/uiconfig/swriter/ui/dropcapspage.ui
index 86b57d5..5bd6027 100644
--- a/sw/uiconfig/swriter/ui/dropcapspage.ui
+++ b/sw/uiconfig/swriter/ui/dropcapspage.ui
@@ -1,6 +1,7 @@
<?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">2</property>
<property name="step_increment">0.10000000000000001</property>
@@ -22,16 +23,16 @@
<object class="GtkGrid" id="DropCapPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="valign">start</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">
+ <object class="GtkGrid" id="maingrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">12</property>
+ <property name="row_spacing">12</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
@@ -54,7 +55,7 @@
<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="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
@@ -63,7 +64,7 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
+ <property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
@@ -71,7 +72,7 @@
<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="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
@@ -80,7 +81,7 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
+ <property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
@@ -134,8 +135,10 @@
<child>
<object class="GtkSpinButton" id="spinFLD_DROPCAPS">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
+ <property name="halign">start</property>
<property name="invisible_char">â¢</property>
+ <property name="invisible_char_set">True</property>
<property name="adjustment">adjustmentFLD_DROPCAPS</property>
</object>
<packing>
@@ -148,8 +151,10 @@
<child>
<object class="GtkSpinButton" id="spinFLD_LINES">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
+ <property name="halign">start</property>
<property name="invisible_char">â¢</property>
+ <property name="invisible_char_set">True</property>
<property name="adjustment">adjustmentFLD_LINES</property>
</object>
<packing>
@@ -162,8 +167,10 @@
<child>
<object class="GtkSpinButton" id="spinFLD_DISTANCE:0cm">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
+ <property name="halign">start</property>
<property name="invisible_char">â¢</property>
+ <property name="invisible_char_set">True</property>
<property name="adjustment">adjustmentFLD_DISTANCE</property>
<property name="digits">2</property>
</object>
@@ -174,12 +181,6 @@
<property name="height">1</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
</object>
</child>
</object>
@@ -196,9 +197,10 @@
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
+ <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>
@@ -254,7 +256,7 @@
<child>
<object class="GtkEntry" id="entryEDT_TEXT">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="max_length">9</property>
<property name="invisible_char">â¢</property>
<property name="invisible_char_set">True</property>
@@ -294,9 +296,10 @@
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
</object>
@@ -308,9 +311,20 @@
</packing>
</child>
<child>
- <object class="swuilo-SwDropCapsPict" id="drawingareaWN_EXAMPLE">
+ <object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="top_padding">24</property>
+ <child>
+ <object class="swuilo-SwDropCapsPict" 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>
<packing>
<property name="left_attach">1</property>
@@ -336,8 +350,6 @@
<widget name="spinFLD_DROPCAPS"/>
<widget name="spinFLD_LINES"/>
<widget name="spinFLD_DISTANCE:0cm"/>
- <widget name="entryEDT_TEXT"/>
- <widget name="comboBOX_TEMPLATE"/>
</widgets>
</object>
</interface>
More information about the Libreoffice-commits
mailing list