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

expand scheme to share sizes for paragraph dialog preview widgets

Change-Id: Id1ded6828468ff956c83eb57f1da62fd80761b5d
üst 41efa153
......@@ -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 ) :
......
......@@ -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"/>
......
......@@ -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 -->
......
/* -*- 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: */
......@@ -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 \
......
/* -*- 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: */
......@@ -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);
}
// -----------------------------------------------------------------------
......
......@@ -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()
......
<?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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment