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

convert concordence entry dialog to .ui format

Change-Id: I52f88e6be67c4473ccf1b999ac7cb346b1c4f9ee
üst a4c3dc55
...@@ -73,6 +73,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ ...@@ -73,6 +73,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/columnwidth \ sw/uiconfig/swriter/ui/columnwidth \
sw/uiconfig/swriter/ui/converttexttable \ sw/uiconfig/swriter/ui/converttexttable \
sw/uiconfig/swriter/ui/createauthorentry \ sw/uiconfig/swriter/ui/createauthorentry \
sw/uiconfig/swriter/ui/createautomarkdialog \
sw/uiconfig/swriter/ui/dropdownfielddialog \ sw/uiconfig/swriter/ui/dropdownfielddialog \
sw/uiconfig/swriter/ui/endnotepage \ sw/uiconfig/swriter/ui/endnotepage \
sw/uiconfig/swriter/ui/editcategories \ sw/uiconfig/swriter/ui/editcategories \
......
...@@ -410,7 +410,6 @@ ...@@ -410,7 +410,6 @@
#define HID_AUTH_FIELD_ISBN "SW_HID_AUTH_FIELD_ISBN" #define HID_AUTH_FIELD_ISBN "SW_HID_AUTH_FIELD_ISBN"
#define HID_INSERT_INDEX_ENTRY_LEVEL_LB "SW_HID_INSERT_INDEX_ENTRY_LEVEL_LB" #define HID_INSERT_INDEX_ENTRY_LEVEL_LB "SW_HID_INSERT_INDEX_ENTRY_LEVEL_LB"
#define HID_DLG_CREATE_AUTOMARK "SW_HID_DLG_CREATE_AUTOMARK"
#define HID_BUSINESS_CARD_CONTENT "SW_HID_BUSINESS_CARD_CONTENT" #define HID_BUSINESS_CARD_CONTENT "SW_HID_BUSINESS_CARD_CONTENT"
#define HID_SAVE_LABEL_DLG "SW_HID_SAVE_LABEL_DLG" #define HID_SAVE_LABEL_DLG "SW_HID_SAVE_LABEL_DLG"
#define HID_BUSINESS_FMT_PAGE "SW_HID_BUSINESS_FMT_PAGE" #define HID_BUSINESS_FMT_PAGE "SW_HID_BUSINESS_FMT_PAGE"
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#define STR_FILE_NOT_FOUND (RC_INDEX_BEGIN + 18) #define STR_FILE_NOT_FOUND (RC_INDEX_BEGIN + 18)
#define DLG_CHANGE_AUTH_ENTRY (RC_INDEX_BEGIN + 19) #define DLG_CHANGE_AUTH_ENTRY (RC_INDEX_BEGIN + 19)
#define DLG_CREATE_AUTOMARK (RC_INDEX_BEGIN + 20)
#endif // _INDEX_HRC #endif // _INDEX_HRC
......
...@@ -140,6 +140,7 @@ struct AutoMarkEntry ...@@ -140,6 +140,7 @@ struct AutoMarkEntry
typedef boost::ptr_vector<AutoMarkEntry> AutoMarkEntryArr; typedef boost::ptr_vector<AutoMarkEntry> AutoMarkEntryArr;
typedef ::svt::EditBrowseBox SwEntryBrowseBox_Base; typedef ::svt::EditBrowseBox SwEntryBrowseBox_Base;
class SwEntryBrowseBox : public SwEntryBrowseBox_Base class SwEntryBrowseBox : public SwEntryBrowseBox_Base
{ {
Edit aCellEdit; Edit aCellEdit;
...@@ -173,25 +174,25 @@ protected: ...@@ -173,25 +174,25 @@ protected:
virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol); virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol);
virtual sal_Bool SaveModified(); virtual sal_Bool SaveModified();
std::vector<long> GetOptimalColWidths() const;
public: public:
SwEntryBrowseBox(Window* pParent, const ResId& rId, SwEntryBrowseBox(Window* pParent, VclBuilderContainer* pBuilder);
BrowserMode nMode = 0 );
void ReadEntries(SvStream& rInStr); void ReadEntries(SvStream& rInStr);
void WriteEntries(SvStream& rOutStr); void WriteEntries(SvStream& rOutStr);
sal_Bool IsModified()const; sal_Bool IsModified()const;
virtual String GetCellText( long nRow, sal_uInt16 nColumn ) const; virtual String GetCellText( long nRow, sal_uInt16 nColumn ) const;
virtual void Resize();
virtual Size GetOptimalSize() const;
}; };
class SwAutoMarkDlg_Impl : public ModalDialog class SwAutoMarkDlg_Impl : public ModalDialog
{ {
OKButton aOKPB; OKButton* m_pOKPB;
CancelButton aCancelPB;
HelpButton aHelpPB;
SwEntryBrowseBox aEntriesBB; SwEntryBrowseBox* m_pEntriesBB;
FixedLine aEntriesFL;
String sAutoMarkURL; String sAutoMarkURL;
const String sAutoMarkType; const String sAutoMarkType;
...@@ -3879,9 +3880,8 @@ void SwTOXStylesTabPage::Modify() ...@@ -3879,9 +3880,8 @@ void SwTOXStylesTabPage::Modify()
#define ITEM_WORDONLY 7 #define ITEM_WORDONLY 7
SwEntryBrowseBox::SwEntryBrowseBox(Window* pParent, const ResId& rId, SwEntryBrowseBox::SwEntryBrowseBox(Window* pParent, VclBuilderContainer* pBuilder)
BrowserMode nMode ) : : SwEntryBrowseBox_Base( pParent, EBBF_NONE, WB_TABSTOP | WB_BORDER,
SwEntryBrowseBox_Base( pParent, rId, nMode,
BROWSER_KEEPSELECTION | BROWSER_KEEPSELECTION |
BROWSER_COLUMNSELECTION | BROWSER_COLUMNSELECTION |
BROWSER_MULTISELECTION | BROWSER_MULTISELECTION |
...@@ -3889,22 +3889,21 @@ SwEntryBrowseBox::SwEntryBrowseBox(Window* pParent, const ResId& rId, ...@@ -3889,22 +3889,21 @@ SwEntryBrowseBox::SwEntryBrowseBox(Window* pParent, const ResId& rId,
BROWSER_HLINESFULL | BROWSER_HLINESFULL |
BROWSER_VLINESFULL | BROWSER_VLINESFULL |
BROWSER_AUTO_VSCROLL| BROWSER_AUTO_VSCROLL|
BROWSER_HIDECURSOR ), BROWSER_HIDECURSOR )
aCellEdit(&GetDataWindow(), 0), , aCellEdit(&GetDataWindow(), 0)
aCellCheckBox(&GetDataWindow()), , aCellCheckBox(&GetDataWindow())
, bModified(false)
sSearch( ResId(ST_SEARCH, *rId.GetResMgr() )), {
sAlternative( ResId(ST_ALTERNATIVE, *rId.GetResMgr() )), sSearch = pBuilder->get<Window>("searchterm")->GetText();
sPrimKey( ResId(ST_PRIMKEY, *rId.GetResMgr() )), sAlternative = pBuilder->get<Window>("alternative")->GetText();
sSecKey( ResId(ST_SECKEY, *rId.GetResMgr() )), sPrimKey = pBuilder->get<Window>("key1")->GetText();
sComment( ResId(ST_COMMENT, *rId.GetResMgr() )), sSecKey = pBuilder->get<Window>("key2")->GetText();
sCaseSensitive( ResId(ST_CASESENSITIVE, *rId.GetResMgr() )), sComment = pBuilder->get<Window>("comment")->GetText();
sWordOnly( ResId(ST_WORDONLY, *rId.GetResMgr() )), sCaseSensitive = pBuilder->get<Window>("casesensitive")->GetText();
sYes( ResId(ST_TRUE, *rId.GetResMgr() )), sWordOnly = pBuilder->get<Window>("wordonly")->GetText();
sNo( ResId(ST_FALSE, *rId.GetResMgr() )), sYes = pBuilder->get<Window>("yes")->GetText();
bModified(false) sNo = pBuilder->get<Window>("no")->GetText();
{
FreeResource();
aCellCheckBox.GetBox().EnableTriState(sal_False); aCellCheckBox.GetBox().EnableTriState(sal_False);
xController = new ::svt::EditCellController(&aCellEdit); xController = new ::svt::EditCellController(&aCellEdit);
xCheckController = new ::svt::CheckBoxCellController(&aCellCheckBox); xCheckController = new ::svt::CheckBoxCellController(&aCellCheckBox);
...@@ -3939,6 +3938,63 @@ SwEntryBrowseBox::SwEntryBrowseBox(Window* pParent, const ResId& rId, ...@@ -3939,6 +3938,63 @@ SwEntryBrowseBox::SwEntryBrowseBox(Window* pParent, const ResId& rId,
} }
void SwEntryBrowseBox::Resize()
{
SwEntryBrowseBox_Base::Resize();
Dialog *pDlg = GetParentDialog();
if (pDlg && pDlg->isCalculatingInitialLayoutSize())
{
long nWidth = GetSizePixel().Width();
std::vector<long> aWidths = GetOptimalColWidths();
long nNaturalWidth(::std::accumulate(aWidths.begin(), aWidths.end(), 0));
long nExcess = ((nWidth - nNaturalWidth) / aWidths.size()) - 1;
for (size_t i = 0; i < aWidths.size(); ++i)
SetColumnWidth(i+1, aWidths[i] + nExcess);
}
}
std::vector<long> SwEntryBrowseBox::GetOptimalColWidths() const
{
std::vector<long> aWidths;
long nStandardColMinWidth = approximate_char_width() * 16;
long nYesNoWidth = approximate_char_width() * 5;
nYesNoWidth = std::max(nYesNoWidth, GetTextWidth(sYes));
nYesNoWidth = std::max(nYesNoWidth, GetTextWidth(sNo));
for (sal_uInt16 i = 1; i < 6; i++)
{
OUString sTitle = GetColumnTitle(i);
long nColWidth = std::max(nStandardColMinWidth, GetTextWidth(sTitle));
nColWidth += 12;
aWidths.push_back(nColWidth);
}
for (sal_uInt16 i = 6; i < 8; i++)
{
OUString sTitle = GetColumnTitle(i);
long nColWidth = std::max(nYesNoWidth, GetTextWidth(sTitle));
nColWidth += 12;
aWidths.push_back(nColWidth);
}
return aWidths;
}
Size SwEntryBrowseBox::GetOptimalSize() const
{
Size aSize = LogicToPixel(Size(276 , 175), MapMode(MAP_APPFONT));
std::vector<long> aWidths = GetOptimalColWidths();
long nWidth(::std::accumulate(aWidths.begin(), aWidths.end(), 0));
aSize.Width() = std::max(aSize.Width(), nWidth);
return aSize;
}
sal_Bool SwEntryBrowseBox::SeekRow( long nRow ) sal_Bool SwEntryBrowseBox::SeekRow( long nRow )
{ {
nCurrentRow = nRow; nCurrentRow = nRow;
...@@ -4150,19 +4206,18 @@ sal_Bool SwEntryBrowseBox::IsModified()const ...@@ -4150,19 +4206,18 @@ sal_Bool SwEntryBrowseBox::IsModified()const
} }
SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(Window* pParent, const String& rAutoMarkURL, SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(Window* pParent, const String& rAutoMarkURL,
const String& rAutoMarkType, bool bCreate) : const String& rAutoMarkType, bool bCreate)
ModalDialog(pParent, SW_RES(DLG_CREATE_AUTOMARK)), : ModalDialog(pParent, "CreateAutomarkDialog",
aOKPB( this, SW_RES(PB_OK )), "modules/swriter/ui/createautomarkdialog.ui")
aCancelPB( this, SW_RES(PB_CANCEL )), , sAutoMarkURL(rAutoMarkURL)
aHelpPB( this, SW_RES(PB_HELP )), , sAutoMarkType(rAutoMarkType)
aEntriesBB( this, SW_RES(BB_ENTRIES )), , bCreateMode(bCreate)
aEntriesFL( this, SW_RES(FL_ENTRIES )), {
sAutoMarkURL(rAutoMarkURL), get(m_pOKPB, "ok");
sAutoMarkType(rAutoMarkType), m_pEntriesBB = new SwEntryBrowseBox(get<VclContainer>("area"), this);
bCreateMode(bCreate) m_pEntriesBB->set_expand(true);
{ m_pEntriesBB->Show();
FreeResource(); m_pOKPB->SetClickHdl(LINK(this, SwAutoMarkDlg_Impl, OkHdl));
aOKPB.SetClickHdl(LINK(this, SwAutoMarkDlg_Impl, OkHdl));
String sTitle = GetText(); String sTitle = GetText();
sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": ")); sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": "));
...@@ -4170,12 +4225,12 @@ SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(Window* pParent, const String& rAutoMarkU ...@@ -4170,12 +4225,12 @@ SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(Window* pParent, const String& rAutoMarkU
SetText(sTitle); SetText(sTitle);
bool bError = false; bool bError = false;
if( bCreateMode ) if( bCreateMode )
aEntriesBB.RowInserted(0, 1, sal_True); m_pEntriesBB->RowInserted(0, 1, sal_True);
else else
{ {
SfxMedium aMed( sAutoMarkURL, STREAM_STD_READ ); SfxMedium aMed( sAutoMarkURL, STREAM_STD_READ );
if( aMed.GetInStream() && !aMed.GetInStream()->GetError() ) if( aMed.GetInStream() && !aMed.GetInStream()->GetError() )
aEntriesBB.ReadEntries( *aMed.GetInStream() ); m_pEntriesBB->ReadEntries( *aMed.GetInStream() );
else else
bError = true; bError = true;
} }
...@@ -4186,12 +4241,13 @@ SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(Window* pParent, const String& rAutoMarkU ...@@ -4186,12 +4241,13 @@ SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(Window* pParent, const String& rAutoMarkU
SwAutoMarkDlg_Impl::~SwAutoMarkDlg_Impl() SwAutoMarkDlg_Impl::~SwAutoMarkDlg_Impl()
{ {
delete m_pEntriesBB;
} }
IMPL_LINK_NOARG(SwAutoMarkDlg_Impl, OkHdl) IMPL_LINK_NOARG(SwAutoMarkDlg_Impl, OkHdl)
{ {
bool bError = false; bool bError = false;
if(aEntriesBB.IsModified() || bCreateMode) if(m_pEntriesBB->IsModified() || bCreateMode)
{ {
SfxMedium aMed( sAutoMarkURL, SfxMedium aMed( sAutoMarkURL,
bCreateMode ? STREAM_WRITE bCreateMode ? STREAM_WRITE
...@@ -4200,7 +4256,7 @@ IMPL_LINK_NOARG(SwAutoMarkDlg_Impl, OkHdl) ...@@ -4200,7 +4256,7 @@ IMPL_LINK_NOARG(SwAutoMarkDlg_Impl, OkHdl)
pStrm->SetStreamCharSet( RTL_TEXTENCODING_MS_1253 ); pStrm->SetStreamCharSet( RTL_TEXTENCODING_MS_1253 );
if( !pStrm->GetError() ) if( !pStrm->GetError() )
{ {
aEntriesBB.WriteEntries( *pStrm ); m_pEntriesBB->WriteEntries( *pStrm );
aMed.Commit(); aMed.Commit();
} }
else else
......
...@@ -203,21 +203,6 @@ ...@@ -203,21 +203,6 @@
#define CB_SHOWEXAMPLE 14 #define CB_SHOWEXAMPLE 14
// AutoMark dialog
#define BB_ENTRIES 1
#define FL_ENTRIES 2
#define ST_SEARCH 10
#define ST_ALTERNATIVE 11
#define ST_PRIMKEY 12
#define ST_SECKEY 13
#define ST_COMMENT 14
#define ST_CASESENSITIVE 15
#define ST_WORDONLY 16
#define ST_TRUE 17
#define ST_FALSE 18
//ButtonMenu //ButtonMenu
#define MN_AUTOMARK_OPEN 1 #define MN_AUTOMARK_OPEN 1
#define MN_AUTOMARK_NEW 2 #define MN_AUTOMARK_NEW 2
......
...@@ -1248,84 +1248,4 @@ ModalDialog DLG_ADD_IDX_STYLES ...@@ -1248,84 +1248,4 @@ ModalDialog DLG_ADD_IDX_STYLES
Text [ en-US ] = "Assign Styles"; Text [ en-US ] = "Assign Styles";
}; };
ModalDialog DLG_CREATE_AUTOMARK
{
HelpId = HID_DLG_CREATE_AUTOMARK;
OutputSize = TRUE ;
SVLook = TRUE ;
Size = MAP_APPFONT ( 350 , 200 ) ;
Moveable = TRUE ;
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 ;
};
Control BB_ENTRIES
{
Pos = MAP_APPFONT ( 12 , 18 ) ;
Size = MAP_APPFONT ( 276 , 175 ) ;
TabStop = TRUE ;
Border = TRUE;
String ST_SEARCH
{
Text [ en-US ] = "Search term";
};
String ST_ALTERNATIVE
{
Text [ en-US ] = "Alternative entry";
};
String ST_PRIMKEY
{
Text [ en-US ] = "1st key";
};
String ST_SECKEY
{
Text [ en-US ] = "2nd key";
};
String ST_COMMENT
{
Text [ en-US ] = "Comment";
};
String ST_CASESENSITIVE
{
Text [ en-US ] = "Match case";
};
String ST_WORDONLY
{
Text [ en-US ] = "Word only";
};
String ST_TRUE
{
Text [ en-US ] = "Yes";
};
String ST_FALSE
{
Text [ en-US ] = "No";
};
};
FixedLine FL_ENTRIES
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
Size = MAP_APPFONT ( 288, 8 ) ;
Text [ en-US ] = "Entries";
};
Text [ en-US ] = "Edit Concordance File";
};
// -----------------------------------------------------------------------------
/* 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