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

convert apply styles dialog to .ui

Change-Id: Id596ceaebc0dda3be046be89f22b6bf1a304fa4e
üst 24a07633
......@@ -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 \
......
......@@ -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
......
......@@ -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"
......
......@@ -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;
......
......@@ -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>
......
......@@ -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)
{
FreeResource();
aHeaderTreeContainer.SetAccessibleRelationMemberOf(&aStylesFL);
aLeftPB.SetAccessibleRelationMemberOf(&aStylesFL);
aRightPB.SetAccessibleRelationMemberOf(&aStylesFL);
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();
SwWrtShell& rWrtSh, String rStringArr[])
: SfxModalDialog(pParent, "AssignStylesDialog",
"modules/swriter/ui/assignstylesdialog.ui")
, pStyleArr(rStringArr)
{
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"));
m_pOk->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, OkHdl));
m_pLeftPB->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
m_pRightPB->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
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;
}
......
......@@ -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
......
......@@ -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: */
This diff is collapsed.
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