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,\ ...@@ -61,6 +61,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/swriter,\
$(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/abstractdialog \ sw/uiconfig/swriter/ui/abstractdialog \
sw/uiconfig/swriter/ui/asciifilterdialog \ sw/uiconfig/swriter/ui/asciifilterdialog \
sw/uiconfig/swriter/ui/assignstylesdialog \
sw/uiconfig/swriter/ui/authenticationsettingsdialog \ sw/uiconfig/swriter/ui/authenticationsettingsdialog \
sw/uiconfig/swriter/ui/autoformattable \ sw/uiconfig/swriter/ui/autoformattable \
sw/uiconfig/swriter/ui/autotext \ sw/uiconfig/swriter/ui/autotext \
......
...@@ -124,7 +124,6 @@ ...@@ -124,7 +124,6 @@
#define TP_OPTCAPTION_PAGE (RC_GLOBALS_BEGIN + 77) #define TP_OPTCAPTION_PAGE (RC_GLOBALS_BEGIN + 77)
#define DLG_SVXTEST_NUM_BULLET (RC_GLOBALS_BEGIN + 79) #define DLG_SVXTEST_NUM_BULLET (RC_GLOBALS_BEGIN + 79)
#define DLG_ADD_IDX_STYLES (RC_GLOBALS_BEGIN + 94)
//maximum: RC_GLOBALS_BEGIN + 120 //maximum: RC_GLOBALS_BEGIN + 120
......
...@@ -137,7 +137,6 @@ ...@@ -137,7 +137,6 @@
#define HID_REDLINE_CTRL "SW_HID_REDLINE_CTRL" #define HID_REDLINE_CTRL "SW_HID_REDLINE_CTRL"
#define HID_OPTCAPTION_PAGE "SW_HID_OPTCAPTION_PAGE" #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_ADD_STYLES_TLB "SW_HID_ADD_STYLES_TLB"
#define HID_COMPATIBILITY_OPTIONS_BOX "SW_HID_COMPATIBILITY_OPTIONS_BOX" #define HID_COMPATIBILITY_OPTIONS_BOX "SW_HID_COMPATIBILITY_OPTIONS_BOX"
......
...@@ -43,6 +43,14 @@ ...@@ -43,6 +43,14 @@
#define TOX_PAGE_ENTRY 2 #define TOX_PAGE_ENTRY 2
#define TOX_PAGE_STYLES 3 #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 struct CurTOXType
{ {
TOXTypes eType; TOXTypes eType;
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
#include <cmdid.h> #include <cmdid.h>
#include <utlui.hrc> #include <utlui.hrc>
#include <index.hrc> #include <index.hrc>
#include <cnttab.hrc>
#include <globals.hrc> #include <globals.hrc>
#include <SwStyleNameMapper.hxx> #include <SwStyleNameMapper.hxx>
#include <swuicnttab.hxx> #include <swuicnttab.hxx>
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
#include <helpid.h> #include <helpid.h>
#include <utlui.hrc> #include <utlui.hrc>
#include <index.hrc> #include <index.hrc>
#include <cnttab.hrc> #include <cnttab.hxx>
#include <globals.hrc> #include <globals.hrc>
#include <SwStyleNameMapper.hxx> #include <SwStyleNameMapper.hxx>
#include <sfx2/filedlghelper.hxx> #include <sfx2/filedlghelper.hxx>
...@@ -562,10 +562,13 @@ sal_Bool SwMultiTOXTabDialog::IsNoNum(SwWrtShell& rSh, const String& rName) ...@@ -562,10 +562,13 @@ sal_Bool SwMultiTOXTabDialog::IsNoNum(SwWrtShell& rSh, const String& rName)
class SwIndexTreeLB : public SvSimpleTable class SwIndexTreeLB : public SvSimpleTable
{ {
private:
public: public:
SwIndexTreeLB(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER); SwIndexTreeLB(SvSimpleTableContainer& rParent, WinBits nBits = 0);
virtual void KeyInput( const KeyEvent& rKEvt ); virtual void KeyInput( const KeyEvent& rKEvt );
virtual void Resize();
virtual sal_IntPtr GetTabPos( SvTreeListEntry*, SvLBoxTab* ); virtual sal_IntPtr GetTabPos( SvTreeListEntry*, SvLBoxTab* );
void setColSizes();
}; };
...@@ -573,7 +576,8 @@ SwIndexTreeLB::SwIndexTreeLB(SvSimpleTableContainer& rParent, WinBits nBits) ...@@ -573,7 +576,8 @@ SwIndexTreeLB::SwIndexTreeLB(SvSimpleTableContainer& rParent, WinBits nBits)
: SvSimpleTable(rParent, nBits) : SvSimpleTable(rParent, nBits)
{ {
HeaderBar& rStylesHB = GetTheHeaderBar(); 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) sal_IntPtr SwIndexTreeLB::GetTabPos( SvTreeListEntry* pEntry, SvLBoxTab* pTab)
...@@ -625,19 +629,40 @@ void SwIndexTreeLB::KeyInput( const KeyEvent& rKEvt ) ...@@ -625,19 +629,40 @@ void SwIndexTreeLB::KeyInput( const KeyEvent& rKEvt )
SvTreeListBox::KeyInput(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 class SwAddStylesDlg_Impl : public SfxModalDialog
{ {
OKButton aOk; OKButton* m_pOk;
CancelButton aCancel;
HelpButton aHelp;
FixedLine aStylesFL; SwIndexTreeLB* m_pHeaderTree;
SvSimpleTableContainer aHeaderTreeContainer; PushButton* m_pLeftPB;
SwIndexTreeLB aHeaderTree; PushButton* m_pRightPB;
ImageButton aLeftPB;
ImageButton aRightPB;
String sHBFirst;
String* pStyleArr; String* pStyleArr;
DECL_LINK(OkHdl, void *); DECL_LINK(OkHdl, void *);
...@@ -650,61 +675,43 @@ public: ...@@ -650,61 +675,43 @@ public:
}; };
SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(Window* pParent, SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(Window* pParent,
SwWrtShell& rWrtSh, String rStringArr[]) : SwWrtShell& rWrtSh, String rStringArr[])
SfxModalDialog(pParent, SW_RES(DLG_ADD_IDX_STYLES)), : SfxModalDialog(pParent, "AssignStylesDialog",
aOk( this, SW_RES(PB_OK )), "modules/swriter/ui/assignstylesdialog.ui")
aCancel( this, SW_RES(PB_CANCEL )), , pStyleArr(rStringArr)
aHelp( this, SW_RES(PB_HELP )), {
get(m_pOk, "ok");
aStylesFL( this, SW_RES(FL_STYLES )), get(m_pLeftPB, "left");
aHeaderTreeContainer(this, SW_RES(TR_HEADER )), get(m_pRightPB, "right");
aHeaderTree(aHeaderTreeContainer), OUString sHBFirst = get<FixedText>("notapplied")->GetText();
aLeftPB( this, SW_RES(PB_LEFT )), SvSimpleTableContainer *pHeaderTreeContainer = get<SvSimpleTableContainer>("styles");
aRightPB( this, SW_RES(PB_RIGHT )), Size aSize = pHeaderTreeContainer->LogicToPixel(Size(273, 164), MAP_APPFONT);
pHeaderTreeContainer->set_width_request(aSize.Width());
sHBFirst( SW_RES(ST_HB_FIRST)), pHeaderTreeContainer->set_height_request(aSize.Height());
pStyleArr(rStringArr) m_pHeaderTree = new SwIndexTreeLB(*get<SvSimpleTableContainer>("styles"));
{
FreeResource(); m_pOk->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, OkHdl));
m_pLeftPB->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
aHeaderTreeContainer.SetAccessibleRelationMemberOf(&aStylesFL); m_pRightPB->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
aLeftPB.SetAccessibleRelationMemberOf(&aStylesFL);
aRightPB.SetAccessibleRelationMemberOf(&aStylesFL); HeaderBar& rHB = m_pHeaderTree->GetTheHeaderBar();
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();
rHB.SetEndDragHdl(LINK(this, SwAddStylesDlg_Impl, HeaderDragHdl)); 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); OUStringBuffer sHeader(sHBFirst);
for(sal_uInt16 i = 1; i <= MAXLEVEL; ++i) for(sal_uInt16 i = 1; i <= MAXLEVEL; ++i)
{
sHeader.append("\t").append(OUString::number(i)); sHeader.append("\t").append(OUString::number(i));
nTabs_Impl[i+1] = nTabs_Impl[i] + nWidth; m_pHeaderTree->InsertHeaderEntry(sHeader.makeStringAndClear());
} m_pHeaderTree->setColSizes();
aHeaderTree.SvSimpleTable::SetTabs(&nTabs_Impl[0], MAP_PIXEL);
aHeaderTree.InsertHeaderEntry(sHeader.makeStringAndClear());
aHeaderTree.SetStyle(aHeaderTree.GetStyle()|WB_CLIPCHILDREN|WB_SORT); m_pHeaderTree->SetStyle(m_pHeaderTree->GetStyle()|WB_CLIPCHILDREN|WB_SORT);
aHeaderTree.GetModel()->SetSortMode(SortAscending); m_pHeaderTree->GetModel()->SetSortMode(SortAscending);
for (sal_uInt16 i = 0; i < MAXLEVEL; ++i) for (sal_uInt16 i = 0; i < MAXLEVEL; ++i)
{ {
String sStyles(rStringArr[i]); String sStyles(rStringArr[i]);
for(sal_uInt16 nToken = 0; nToken < comphelper::string::getTokenCount(sStyles, TOX_STYLE_DELIMITER); nToken++) for(sal_uInt16 nToken = 0; nToken < comphelper::string::getTokenCount(sStyles, TOX_STYLE_DELIMITER); nToken++)
{ {
String sTmp(sStyles.GetToken(nToken, TOX_STYLE_DELIMITER)); 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)); pEntry->SetUserData(reinterpret_cast<void*>(i));
} }
} }
...@@ -722,22 +729,23 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(Window* pParent, ...@@ -722,22 +729,23 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(Window* pParent,
const OUString aName = pColl->GetName(); const OUString aName = pColl->GetName();
if (!aName.isEmpty()) if (!aName.isEmpty())
{ {
SvTreeListEntry* pEntry = aHeaderTree.First(); SvTreeListEntry* pEntry = m_pHeaderTree->First();
while (pEntry && aHeaderTree.GetEntryText(pEntry)!=aName) while (pEntry && m_pHeaderTree->GetEntryText(pEntry)!=aName)
{ {
pEntry = aHeaderTree.Next(pEntry); pEntry = m_pHeaderTree->Next(pEntry);
} }
if (!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() SwAddStylesDlg_Impl::~SwAddStylesDlg_Impl()
{ {
delete m_pHeaderTree;
} }
IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl) IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl)
...@@ -745,18 +753,18 @@ IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl) ...@@ -745,18 +753,18 @@ IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl)
for(sal_uInt16 i = 0; i < MAXLEVEL; i++) for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
pStyleArr[i].Erase(); pStyleArr[i].Erase();
SvTreeListEntry* pEntry = aHeaderTree.First(); SvTreeListEntry* pEntry = m_pHeaderTree->First();
while(pEntry) while(pEntry)
{ {
sal_IntPtr nLevel = (sal_IntPtr)pEntry->GetUserData(); sal_IntPtr nLevel = (sal_IntPtr)pEntry->GetUserData();
if(nLevel != USHRT_MAX) if(nLevel != USHRT_MAX)
{ {
String sName(aHeaderTree.GetEntryText(pEntry)); String sName(m_pHeaderTree->GetEntryText(pEntry));
if(pStyleArr[nLevel].Len()) if(pStyleArr[nLevel].Len())
pStyleArr[nLevel] += TOX_STYLE_DELIMITER; pStyleArr[nLevel] += TOX_STYLE_DELIMITER;
pStyleArr[nLevel] += sName; pStyleArr[nLevel] += sName;
} }
pEntry = aHeaderTree.Next(pEntry); pEntry = m_pHeaderTree->Next(pEntry);
} }
//TODO write back style names //TODO write back style names
...@@ -766,14 +774,14 @@ IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl) ...@@ -766,14 +774,14 @@ IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl)
IMPL_LINK_NOARG(SwAddStylesDlg_Impl, HeaderDragHdl) IMPL_LINK_NOARG(SwAddStylesDlg_Impl, HeaderDragHdl)
{ {
aHeaderTree.Invalidate(); m_pHeaderTree->Invalidate();
return 0; return 0;
} }
IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, PushButton*, pBtn) IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, PushButton*, pBtn)
{ {
sal_Bool bLeft = pBtn == &aLeftPB; sal_Bool bLeft = pBtn == m_pLeftPB;
SvTreeListEntry* pEntry = aHeaderTree.FirstSelected(); SvTreeListEntry* pEntry = m_pHeaderTree->FirstSelected();
if(pEntry) if(pEntry)
{ {
sal_IntPtr nLevel = (sal_IntPtr)pEntry->GetUserData(); sal_IntPtr nLevel = (sal_IntPtr)pEntry->GetUserData();
...@@ -792,7 +800,7 @@ IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, PushButton*, pBtn) ...@@ -792,7 +800,7 @@ IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, PushButton*, pBtn)
nLevel = 0; nLevel = 0;
} }
pEntry->SetUserData((void*)nLevel); pEntry->SetUserData((void*)nLevel);
aHeaderTree.Invalidate(); m_pHeaderTree->Invalidate();
} }
return 0; return 0;
} }
......
...@@ -17,17 +17,6 @@ ...@@ -17,17 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * 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_CONTENT 1
#define TO_INDEX 2 #define TO_INDEX 2
#define TO_ILLUSTRATION 4 #define TO_ILLUSTRATION 4
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "index.hrc" #include "index.hrc"
#include "globals.hrc" #include "globals.hrc"
#include "cnttab.hrc"
#include "cmdid.h" #include "cmdid.h"
#include "helpid.h" #include "helpid.h"
...@@ -166,83 +165,4 @@ String STR_AUTOMARK_TYPE ...@@ -166,83 +165,4 @@ String STR_AUTOMARK_TYPE
Text [ en-US ] = "Selection file for the alphabetical index (*.sdi)"; 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: */ /* 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