convert apply styles dialog to .ui

Change-Id: Id596ceaebc0dda3be046be89f22b6bf1a304fa4e
This commit is contained in:
Caolán McNamara
2013-09-02 09:29:47 +01:00
parent 24a076337a
commit d649afe84b
9 changed files with 308 additions and 158 deletions

View File

@@ -61,6 +61,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/swriter,\
$(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/abstractdialog \
sw/uiconfig/swriter/ui/asciifilterdialog \
sw/uiconfig/swriter/ui/assignstylesdialog \
sw/uiconfig/swriter/ui/authenticationsettingsdialog \
sw/uiconfig/swriter/ui/autoformattable \
sw/uiconfig/swriter/ui/autotext \

View File

@@ -124,7 +124,6 @@
#define TP_OPTCAPTION_PAGE (RC_GLOBALS_BEGIN + 77)
#define DLG_SVXTEST_NUM_BULLET (RC_GLOBALS_BEGIN + 79)
#define DLG_ADD_IDX_STYLES (RC_GLOBALS_BEGIN + 94)
//maximum: RC_GLOBALS_BEGIN + 120

View File

@@ -137,7 +137,6 @@
#define HID_REDLINE_CTRL "SW_HID_REDLINE_CTRL"
#define HID_OPTCAPTION_PAGE "SW_HID_OPTCAPTION_PAGE"
#define HID_DLG_ADD_IDX_STYLES "SW_HID_DLG_ADD_IDX_STYLES"
#define HID_ADD_STYLES_TLB "SW_HID_ADD_STYLES_TLB"
#define HID_COMPATIBILITY_OPTIONS_BOX "SW_HID_COMPATIBILITY_OPTIONS_BOX"

View File

@@ -43,6 +43,14 @@
#define TOX_PAGE_ENTRY 2
#define TOX_PAGE_STYLES 3
#define TO_CONTENT 1
#define TO_INDEX 2
#define TO_ILLUSTRATION 4
#define TO_TABLE 8
#define TO_USER 16
#define TO_OBJECT 32
#define TO_AUTHORITIES 64
struct CurTOXType
{
TOXTypes eType;

View File

@@ -47,7 +47,6 @@
#include <cmdid.h>
#include <utlui.hrc>
#include <index.hrc>
#include <cnttab.hrc>
#include <globals.hrc>
#include <SwStyleNameMapper.hxx>
#include <swuicnttab.hxx>

View File

@@ -68,7 +68,7 @@
#include <helpid.h>
#include <utlui.hrc>
#include <index.hrc>
#include <cnttab.hrc>
#include <cnttab.hxx>
#include <globals.hrc>
#include <SwStyleNameMapper.hxx>
#include <sfx2/filedlghelper.hxx>
@@ -562,10 +562,13 @@ sal_Bool SwMultiTOXTabDialog::IsNoNum(SwWrtShell& rSh, const String& rName)
class SwIndexTreeLB : public SvSimpleTable
{
private:
public:
SwIndexTreeLB(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
SwIndexTreeLB(SvSimpleTableContainer& rParent, WinBits nBits = 0);
virtual void KeyInput( const KeyEvent& rKEvt );
virtual void Resize();
virtual sal_IntPtr GetTabPos( SvTreeListEntry*, SvLBoxTab* );
void setColSizes();
};
@@ -573,7 +576,8 @@ SwIndexTreeLB::SwIndexTreeLB(SvSimpleTableContainer& rParent, WinBits nBits)
: SvSimpleTable(rParent, nBits)
{
HeaderBar& rStylesHB = GetTheHeaderBar();
rStylesHB.SetStyle(rStylesHB.GetStyle()|WB_BUTTONSTYLE|WB_TABSTOP|WB_BORDER);
rStylesHB.SetStyle(rStylesHB.GetStyle()|WB_BUTTONSTYLE);
SetStyle(GetStyle() & ~(WB_AUTOHSCROLL|WB_HSCROLL));
}
sal_IntPtr SwIndexTreeLB::GetTabPos( SvTreeListEntry* pEntry, SvLBoxTab* pTab)
@@ -625,19 +629,40 @@ void SwIndexTreeLB::KeyInput( const KeyEvent& rKEvt )
SvTreeListBox::KeyInput(rKEvt);
}
void SwIndexTreeLB::Resize()
{
SvSimpleTable::Resize();
setColSizes();
}
void SwIndexTreeLB::setColSizes()
{
HeaderBar &rHB = GetTheHeaderBar();
if (rHB.GetItemCount() < MAXLEVEL+1)
return;
long nWidth = rHB.GetSizePixel().Width();
nWidth /= 14;
nWidth--;
long nTabs_Impl[MAXLEVEL+2];
nTabs_Impl[0] = MAXLEVEL+1;
nTabs_Impl[1] = 3 * nWidth;
for(sal_uInt16 i = 1; i <= MAXLEVEL; ++i)
nTabs_Impl[i+1] = nTabs_Impl[i] + nWidth;
SvSimpleTable::SetTabs(&nTabs_Impl[0], MAP_PIXEL);
}
class SwAddStylesDlg_Impl : public SfxModalDialog
{
OKButton aOk;
CancelButton aCancel;
HelpButton aHelp;
OKButton* m_pOk;
FixedLine aStylesFL;
SvSimpleTableContainer aHeaderTreeContainer;
SwIndexTreeLB aHeaderTree;
ImageButton aLeftPB;
ImageButton aRightPB;
SwIndexTreeLB* m_pHeaderTree;
PushButton* m_pLeftPB;
PushButton* m_pRightPB;
String sHBFirst;
String* pStyleArr;
DECL_LINK(OkHdl, void *);
@@ -650,61 +675,43 @@ public:
};
SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(Window* pParent,
SwWrtShell& rWrtSh, String rStringArr[]) :
SfxModalDialog(pParent, SW_RES(DLG_ADD_IDX_STYLES)),
aOk( this, SW_RES(PB_OK )),
aCancel( this, SW_RES(PB_CANCEL )),
aHelp( this, SW_RES(PB_HELP )),
aStylesFL( this, SW_RES(FL_STYLES )),
aHeaderTreeContainer(this, SW_RES(TR_HEADER )),
aHeaderTree(aHeaderTreeContainer),
aLeftPB( this, SW_RES(PB_LEFT )),
aRightPB( this, SW_RES(PB_RIGHT )),
sHBFirst( SW_RES(ST_HB_FIRST)),
pStyleArr(rStringArr)
SwWrtShell& rWrtSh, String rStringArr[])
: SfxModalDialog(pParent, "AssignStylesDialog",
"modules/swriter/ui/assignstylesdialog.ui")
, pStyleArr(rStringArr)
{
FreeResource();
get(m_pOk, "ok");
get(m_pLeftPB, "left");
get(m_pRightPB, "right");
OUString sHBFirst = get<FixedText>("notapplied")->GetText();
SvSimpleTableContainer *pHeaderTreeContainer = get<SvSimpleTableContainer>("styles");
Size aSize = pHeaderTreeContainer->LogicToPixel(Size(273, 164), MAP_APPFONT);
pHeaderTreeContainer->set_width_request(aSize.Width());
pHeaderTreeContainer->set_height_request(aSize.Height());
m_pHeaderTree = new SwIndexTreeLB(*get<SvSimpleTableContainer>("styles"));
aHeaderTreeContainer.SetAccessibleRelationMemberOf(&aStylesFL);
aLeftPB.SetAccessibleRelationMemberOf(&aStylesFL);
aRightPB.SetAccessibleRelationMemberOf(&aStylesFL);
m_pOk->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, OkHdl));
m_pLeftPB->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
m_pRightPB->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
aOk.SetClickHdl(LINK(this, SwAddStylesDlg_Impl, OkHdl));
aLeftPB.SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
aRightPB.SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
HeaderBar& rHB = aHeaderTree.GetTheHeaderBar();
HeaderBar& rHB = m_pHeaderTree->GetTheHeaderBar();
rHB.SetEndDragHdl(LINK(this, SwAddStylesDlg_Impl, HeaderDragHdl));
long nWidth = rHB.GetSizePixel().Width();
nWidth /= 14;
nWidth--;
long nTabs_Impl[MAXLEVEL+2];
nTabs_Impl[0] = MAXLEVEL+1;
nTabs_Impl[1] = 3 * nWidth;
OUStringBuffer sHeader(sHBFirst);
for(sal_uInt16 i = 1; i <= MAXLEVEL; ++i)
{
sHeader.append("\t").append(OUString::number(i));
nTabs_Impl[i+1] = nTabs_Impl[i] + nWidth;
}
aHeaderTree.SvSimpleTable::SetTabs(&nTabs_Impl[0], MAP_PIXEL);
aHeaderTree.InsertHeaderEntry(sHeader.makeStringAndClear());
m_pHeaderTree->InsertHeaderEntry(sHeader.makeStringAndClear());
m_pHeaderTree->setColSizes();
aHeaderTree.SetStyle(aHeaderTree.GetStyle()|WB_CLIPCHILDREN|WB_SORT);
aHeaderTree.GetModel()->SetSortMode(SortAscending);
m_pHeaderTree->SetStyle(m_pHeaderTree->GetStyle()|WB_CLIPCHILDREN|WB_SORT);
m_pHeaderTree->GetModel()->SetSortMode(SortAscending);
for (sal_uInt16 i = 0; i < MAXLEVEL; ++i)
{
String sStyles(rStringArr[i]);
for(sal_uInt16 nToken = 0; nToken < comphelper::string::getTokenCount(sStyles, TOX_STYLE_DELIMITER); nToken++)
{
String sTmp(sStyles.GetToken(nToken, TOX_STYLE_DELIMITER));
SvTreeListEntry* pEntry = aHeaderTree.InsertEntry(sTmp);
SvTreeListEntry* pEntry = m_pHeaderTree->InsertEntry(sTmp);
pEntry->SetUserData(reinterpret_cast<void*>(i));
}
}
@@ -722,22 +729,23 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(Window* pParent,
const OUString aName = pColl->GetName();
if (!aName.isEmpty())
{
SvTreeListEntry* pEntry = aHeaderTree.First();
while (pEntry && aHeaderTree.GetEntryText(pEntry)!=aName)
SvTreeListEntry* pEntry = m_pHeaderTree->First();
while (pEntry && m_pHeaderTree->GetEntryText(pEntry)!=aName)
{
pEntry = aHeaderTree.Next(pEntry);
pEntry = m_pHeaderTree->Next(pEntry);
}
if (!pEntry)
{
aHeaderTree.InsertEntry(aName)->SetUserData((void*)USHRT_MAX);
m_pHeaderTree->InsertEntry(aName)->SetUserData((void*)USHRT_MAX);
}
}
}
aHeaderTree.GetModel()->Resort();
m_pHeaderTree->GetModel()->Resort();
}
SwAddStylesDlg_Impl::~SwAddStylesDlg_Impl()
{
delete m_pHeaderTree;
}
IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl)
@@ -745,18 +753,18 @@ IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl)
for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
pStyleArr[i].Erase();
SvTreeListEntry* pEntry = aHeaderTree.First();
SvTreeListEntry* pEntry = m_pHeaderTree->First();
while(pEntry)
{
sal_IntPtr nLevel = (sal_IntPtr)pEntry->GetUserData();
if(nLevel != USHRT_MAX)
{
String sName(aHeaderTree.GetEntryText(pEntry));
String sName(m_pHeaderTree->GetEntryText(pEntry));
if(pStyleArr[nLevel].Len())
pStyleArr[nLevel] += TOX_STYLE_DELIMITER;
pStyleArr[nLevel] += sName;
}
pEntry = aHeaderTree.Next(pEntry);
pEntry = m_pHeaderTree->Next(pEntry);
}
//TODO write back style names
@@ -766,14 +774,14 @@ IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl)
IMPL_LINK_NOARG(SwAddStylesDlg_Impl, HeaderDragHdl)
{
aHeaderTree.Invalidate();
m_pHeaderTree->Invalidate();
return 0;
}
IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, PushButton*, pBtn)
{
sal_Bool bLeft = pBtn == &aLeftPB;
SvTreeListEntry* pEntry = aHeaderTree.FirstSelected();
sal_Bool bLeft = pBtn == m_pLeftPB;
SvTreeListEntry* pEntry = m_pHeaderTree->FirstSelected();
if(pEntry)
{
sal_IntPtr nLevel = (sal_IntPtr)pEntry->GetUserData();
@@ -792,7 +800,7 @@ IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, PushButton*, pBtn)
nLevel = 0;
}
pEntry->SetUserData((void*)nLevel);
aHeaderTree.Invalidate();
m_pHeaderTree->Invalidate();
}
return 0;
}

View File

@@ -17,17 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#define TLB_STYLES 100
#define FL_STYLES 101
#define PB_OK 102
#define PB_CANCEL 103
#define PB_HELP 104
#define TR_HEADER 109
#define PB_LEFT 110
#define PB_RIGHT 111
#define HB_STYLES 112
#define ST_HB_FIRST 113
#define TO_CONTENT 1
#define TO_INDEX 2
#define TO_ILLUSTRATION 4

View File

@@ -19,7 +19,6 @@
#include "index.hrc"
#include "globals.hrc"
#include "cnttab.hrc"
#include "cmdid.h"
#include "helpid.h"
@@ -166,83 +165,4 @@ String STR_AUTOMARK_TYPE
Text [ en-US ] = "Selection file for the alphabetical index (*.sdi)";
};
//------------------------------------------------------------------
ModalDialog DLG_ADD_IDX_STYLES
{
HelpId = HID_DLG_ADD_IDX_STYLES;
OutputSize = TRUE ;
SVLook = TRUE ;
Size = MAP_APPFONT ( 350 , 200 ) ;
Moveable = TRUE ;
Control TR_HEADER
{
Pos = MAP_APPFONT ( 12 , 15 ) ;
Size = MAP_APPFONT ( 273 , 164 ) ;
Border = TRUE;
TabStop = TRUE;
};
ImageButton PB_LEFT
{
HelpID = "sw:ImageButton:DLG_ADD_IDX_STYLES:PB_LEFT";
Pos = MAP_APPFONT ( 12 , 182 ) ;
Size = MAP_APPFONT ( 50 , 12 ) ;
TabStop = TRUE ;
ButtonImage = Image
{
ImageBitmap = Bitmap
{
File = "all_left.bmp" ;
};
MaskColor = IMAGE_MASK_COLOR ;
};
QuickHelpText [ en-US ] = "Left" ;
};
ImageButton PB_RIGHT
{
HelpID = "sw:ImageButton:DLG_ADD_IDX_STYLES:PB_RIGHT";
Pos = MAP_APPFONT ( 65 , 182 ) ;
Size = MAP_APPFONT ( 50 , 12 ) ;
TabStop = TRUE ;
ButtonImage = Image
{
ImageBitmap = Bitmap
{
File = "all_right.bmp" ;
};
MaskColor = IMAGE_MASK_COLOR ;
};
QuickHelpText [ en-US ] = "Right" ;
};
FixedLine FL_STYLES
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
Size = MAP_APPFONT ( 285 , 8 ) ;
Text [ en-US ] = "Styl~es";
};
OKButton PB_OK
{
Pos = MAP_APPFONT ( 297 , 6 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
DefButton = TRUE ;
};
CancelButton PB_CANCEL
{
Pos = MAP_APPFONT ( 297 , 23 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
HelpButton PB_HELP
{
Pos = MAP_APPFONT ( 297 , 40 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
String ST_HB_FIRST
{
Text [ en-US ] = "Not applied";
};
Text [ en-US ] = "Assign Styles";
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -0,0 +1,227 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-requires LibreOffice 1.0 -->
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">sw/res/all_left.png</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">sw/res/all_right.png</property>
</object>
<object class="GtkDialog" id="AssignStylesDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Insert Database Columns</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="help">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="formatframe">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</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="hexpand">True</property>
<property name="vexpand">True</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">6</property>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="spacing">12</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="left">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">image1</property>
<child internal-child="accessible">
<object class="AtkObject" id="left-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Left</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="right">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">image2</property>
<child internal-child="accessible">
<object class="AtkObject" id="right-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Right</property>
</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>
</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="svtlo-SvSimpleTableContainer" id="styles">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Simple Table Container-selection3"/>
</child>
</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="notapplied">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Not applied</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>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Styles</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>
</child>
<action-widgets>
<action-widget response="0">ok</action-widget>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">help</action-widget>
</action-widgets>
</object>
</interface>