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

convert hard-coded layout of char hyperlink tabpage to .ui

Change-Id: I4d43f911b084146393e4be514584acc245a4fda4
üst e4c8ec5f
......@@ -10,6 +10,7 @@
$(eval $(call gb_UI_UI,modules/swriter))
$(eval $(call gb_UI_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/charurlpage \
sw/uiconfig/swriter/ui/columnwidth \
sw/uiconfig/swriter/ui/converttexttable \
sw/uiconfig/swriter/ui/inserttable \
......
......@@ -175,7 +175,6 @@
#define HID_ENV_ENV "SW_HID_ENV_ENV"
#define HID_ENV_FMT "SW_HID_ENV_FMT"
#define HID_FRM_URL "SW_HID_FRM_URL"
#define HID_CHAR_URL "SW_HID_CHAR_URL"
#define HID_CONTENT_OPT "SW_HID_CONTENT_OPT"
#define HID_STD_FONT "SW_HID_STD_FONT"
#define HID_COND_COLL "SW_HID_COND_COLL"
......
......@@ -50,7 +50,6 @@
#include <globals.hrc>
#include <chrdlg.hrc>
#include <chardlg.hrc>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
#include <SwStyleNameMapper.hxx>
......@@ -148,62 +147,21 @@ void SwCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
}
SwCharURLPage::SwCharURLPage(Window* pParent, const SfxItemSet& rCoreSet)
: SfxTabPage(pParent, SW_RES(TP_CHAR_URL), rCoreSet)
, m_aBox(this, false, 7)
, m_aGrid(&m_aBox)
, aURLFL(&m_aGrid, SW_RES(FL_URL))
, aURLFT(&m_aGrid, SW_RES(FT_URL))
, aURLED(&m_aGrid, SW_RES(ED_URL))
, aTextFT(&m_aGrid, SW_RES(FT_TEXT))
, aTextED(&m_aGrid, SW_RES(ED_TEXT))
, aNameFT(&m_aGrid, SW_RES(FT_NAME))
, aNameED(&m_aGrid, SW_RES(ED_NAME))
, aTargetFrmFT(&m_aGrid, SW_RES(FT_TARGET))
, aTargetFrmLB(&m_aGrid, SW_RES(LB_TARGET))
, aURLPB(&m_aGrid, SW_RES(PB_URL))
, aEventPB(&m_aGrid, SW_RES(PB_EVENT))
, aStyleFL(&m_aGrid, SW_RES(FL_STYLE))
, aVisitedFT(&m_aGrid, SW_RES(FT_VISITED))
, aVisitedLB(&m_aGrid, SW_RES(LB_VISITED))
, aNotVisitedFT(&m_aGrid, SW_RES(FT_NOT_VISITED))
, aNotVisitedLB(&m_aGrid, SW_RES(LB_NOT_VISITED))
: SfxTabPage(pParent, "CharURLPage", "modules/swriter/ui/charurlpage.ui", rCoreSet)
, pINetItem(0)
, bModified(sal_False)
{
FreeResource();
m_aBox.set_expand(true);
m_aGrid.set_column_spacing(7);
m_aGrid.set_row_spacing(2);
setGridAttach(aURLFL, 0, 0, 3);
setGridAttach(aURLFT, 0, 1);
setGridAttach(aURLED, 1, 1);
setGridAttach(aURLPB, 2, 1);
setGridAttach(aTextFT, 0, 2);
setGridAttach(aTextED, 1, 2);
setGridAttach(aNameFT, 0, 3);
setGridAttach(aNameED, 1, 3);
setGridAttach(aTargetFrmFT, 0, 4);
setGridAttach(aTargetFrmLB, 1, 4);
setGridAttach(aEventPB, 0, 5);
setGridAttach(aStyleFL, 0, 6, 3);
setGridAttach(aVisitedFT, 0, 7);
setGridAttach(aVisitedLB, 1, 7);
setGridAttach(aNotVisitedFT, 0, 8);
setGridAttach(aNotVisitedLB, 1, 8);
aEventPB.SetAccessibleRelationMemberOf(&aURLFL);
get(m_pURLED, "urled");
get(m_pTextFT, "textft");
get(m_pTextED, "texted");
get(m_pNameED, "nameed");
get(m_pTargetFrmLB, "targetfrmlb");
get(m_pURLPB, "urlpb");
get(m_pEventPB, "eventpb");
get(m_pVisitedLB, "visitedlb");
get(m_pNotVisitedLB, "unvisitedlb");
get(m_pCharStyleContainer, "charstyle");
const SfxPoolItem* pItem;
SfxObjectShell* pShell;
......@@ -213,21 +171,15 @@ SwCharURLPage::SwCharURLPage(Window* pParent, const SfxItemSet& rCoreSet)
{
sal_uInt16 nHtmlMode = ((const SfxUInt16Item*)pItem)->GetValue();
if(HTMLMODE_ON & nHtmlMode)
{
aStyleFL.Hide();
aVisitedFT.Hide();
aVisitedLB.Hide();
aNotVisitedFT.Hide();
aNotVisitedLB.Hide();
}
m_pCharStyleContainer->Hide();
}
aURLPB.SetClickHdl (LINK( this, SwCharURLPage, InsertFileHdl));
aEventPB.SetClickHdl(LINK( this, SwCharURLPage, EventHdl ));
m_pURLPB->SetClickHdl (LINK( this, SwCharURLPage, InsertFileHdl));
m_pEventPB->SetClickHdl(LINK( this, SwCharURLPage, EventHdl ));
SwView *pView = ::GetActiveView();
::FillCharStyleListBox(aVisitedLB, pView->GetDocShell());
::FillCharStyleListBox(aNotVisitedLB, pView->GetDocShell());
::FillCharStyleListBox(*m_pVisitedLB, pView->GetDocShell());
::FillCharStyleListBox(*m_pNotVisitedLB, pView->GetDocShell());
TargetList* pList = new TargetList;
const SfxFrame& rFrame = pView->GetViewFrame()->GetTopFrame();
......@@ -239,7 +191,7 @@ SwCharURLPage::SwCharURLPage(Window* pParent, const SfxItemSet& rCoreSet)
for ( i = 0; i < nCount; i++ )
{
aTargetFrmLB.InsertEntry( *pList->at( i ) );
m_pTargetFrmLB->InsertEntry( *pList->at( i ) );
}
for ( i = nCount; i; )
{
......@@ -260,25 +212,25 @@ void SwCharURLPage::Reset(const SfxItemSet& rSet)
if(SFX_ITEM_SET == rSet.GetItemState(RES_TXTATR_INETFMT, sal_False, &pItem))
{
const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*)pItem;
aURLED.SetText( INetURLObject::decode( pINetFmt->GetValue(),
m_pURLED->SetText( INetURLObject::decode( pINetFmt->GetValue(),
INET_HEX_ESCAPE,
INetURLObject::DECODE_UNAMBIGUOUS,
RTL_TEXTENCODING_UTF8 ));
aURLED.SaveValue();
aNameED.SetText(pINetFmt->GetName());
m_pURLED->SaveValue();
m_pNameED->SetText(pINetFmt->GetName());
String sEntry = pINetFmt->GetVisitedFmt();
if( !sEntry.Len() )
SwStyleNameMapper::FillUIName( RES_POOLCHR_INET_VISIT, sEntry );
aVisitedLB.SelectEntry(sEntry);
m_pVisitedLB->SelectEntry(sEntry);
sEntry = pINetFmt->GetINetFmt();
if(!sEntry.Len())
SwStyleNameMapper::FillUIName( RES_POOLCHR_INET_NORMAL, sEntry );
aNotVisitedLB.SelectEntry(sEntry);
m_pNotVisitedLB->SelectEntry(sEntry);
aTargetFrmLB.SetText(pINetFmt->GetTargetFrame());
aVisitedLB. SaveValue();
aNotVisitedLB.SaveValue();
aTargetFrmLB. SaveValue();
m_pTargetFrmLB->SetText(pINetFmt->GetTargetFrame());
m_pVisitedLB-> SaveValue();
m_pNotVisitedLB->SaveValue();
m_pTargetFrmLB-> SaveValue();
pINetItem = new SvxMacroItem(FN_INET_FIELD_MACRO);
if( pINetFmt->GetMacroTbl() )
......@@ -286,15 +238,15 @@ void SwCharURLPage::Reset(const SfxItemSet& rSet)
}
if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_SELECTION, sal_False, &pItem))
{
aTextED.SetText(((const SfxStringItem*)pItem)->GetValue());
aTextFT.Enable( sal_False );
aTextED.Enable( sal_False );
m_pTextED->SetText(((const SfxStringItem*)pItem)->GetValue());
m_pTextFT->Enable( sal_False );
m_pTextED->Enable( sal_False );
}
}
sal_Bool SwCharURLPage::FillItemSet(SfxItemSet& rSet)
{
::rtl::OUString sURL = aURLED.GetText();
::rtl::OUString sURL = m_pURLED->GetText();
if(!sURL.isEmpty())
{
sURL = URIHelper::SmartRel2Abs(INetURLObject(), sURL, Link(), false );
......@@ -305,19 +257,19 @@ sal_Bool SwCharURLPage::FillItemSet(SfxItemSet& rSet)
sURL = URIHelper::simpleNormalizedMakeRelative(::rtl::OUString(), sURL);
}
SwFmtINetFmt aINetFmt(sURL, aTargetFrmLB.GetText());
aINetFmt.SetName(aNameED.GetText());
bModified |= aURLED.GetText() != aURLED.GetSavedValue();
bModified |= aNameED.IsModified();
bModified |= aTargetFrmLB.GetSavedValue() != aTargetFrmLB.GetText();
SwFmtINetFmt aINetFmt(sURL, m_pTargetFrmLB->GetText());
aINetFmt.SetName(m_pNameED->GetText());
bModified |= m_pURLED->GetText() != m_pURLED->GetSavedValue();
bModified |= m_pNameED->IsModified();
bModified |= m_pTargetFrmLB->GetSavedValue() != m_pTargetFrmLB->GetText();
// set valid settings first
String sEntry = aVisitedLB.GetSelectEntry();
String sEntry = m_pVisitedLB->GetSelectEntry();
sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sEntry, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
aINetFmt.SetVisitedFmtId(nId);
aINetFmt.SetVisitedFmt(nId == RES_POOLCHR_INET_VISIT ? aEmptyStr : sEntry);
sEntry = aNotVisitedLB.GetSelectEntry();
sEntry = m_pNotVisitedLB->GetSelectEntry();
nId = SwStyleNameMapper::GetPoolIdFromUIName( sEntry, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
aINetFmt.SetINetFmtId( nId );
aINetFmt.SetINetFmt(nId == RES_POOLCHR_INET_NORMAL ? aEmptyStr : sEntry);
......@@ -325,16 +277,16 @@ sal_Bool SwCharURLPage::FillItemSet(SfxItemSet& rSet)
if( pINetItem && !pINetItem->GetMacroTable().empty() )
aINetFmt.SetMacroTbl( &pINetItem->GetMacroTable() );
if(aVisitedLB.GetSavedValue() != aVisitedLB.GetSelectEntryPos())
if(m_pVisitedLB->GetSavedValue() != m_pVisitedLB->GetSelectEntryPos())
bModified = sal_True;
if(aNotVisitedLB.GetSavedValue() != aNotVisitedLB.GetSelectEntryPos())
if(m_pNotVisitedLB->GetSavedValue() != m_pNotVisitedLB->GetSelectEntryPos())
bModified = sal_True;
if(aTextED.IsModified())
if(m_pTextED->IsModified())
{
bModified = sal_True;
rSet.Put(SfxStringItem(FN_PARAM_SELECTION, aTextED.GetText()));
rSet.Put(SfxStringItem(FN_PARAM_SELECTION, m_pTextED->GetText()));
}
if(bModified)
rSet.Put(aINetFmt);
......@@ -353,7 +305,7 @@ IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl)
if( aDlgHelper.Execute() == ERRCODE_NONE )
{
Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
aURLED.SetText(xFP->getFiles().getConstArray()[0]);
m_pURLED->SetText(xFP->getFiles().getConstArray()[0]);
}
return 0;
}
......
/*
* 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/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#define FL_URL 50
#define FT_URL 51
#define ED_URL 52
#define FL_STYLE 53
#define FT_VISITED 55
#define LB_VISITED 56
#define FT_NOT_VISITED 57
#define LB_NOT_VISITED 58
#define PB_EVENT 59
#define PB_URL 60
#define LB_TARGET 61
#define FT_TARGET 62
#define FT_TEXT 63
#define ED_TEXT 64
#define FT_NAME 65
#define ED_NAME 66
......@@ -27,7 +27,6 @@
#include "globals.hrc"
#include "chrdlg.hrc"
#include "chardlg.hrc"
#include "helpid.h"
TabDialog DLG_CHAR
......@@ -101,132 +100,3 @@ TabDialog DLG_DRAWCHAR
};
};
};
TabPage TP_CHAR_URL
{
HelpID = HID_CHAR_URL ;
SVLook = TRUE ;
Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ;
Hide = TRUE ;
FixedLine FL_URL
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
Size = MAP_APPFONT ( 248 , 8 ) ;
Text [ en-US ] = "Hyperlink" ;
};
FixedText FT_URL
{
Pos = MAP_APPFONT ( 12 , 17 ) ;
Size = MAP_APPFONT ( 73 , 8 ) ;
Text [ en-US ] = "~URL" ;
};
Edit ED_URL
{
HelpID = "sw:Edit:TP_CHAR_URL:ED_URL";
Pos = MAP_APPFONT ( 88 , 15 ) ;
Size = MAP_APPFONT ( 104 , 12 ) ;
Border = TRUE ;
TabStop = TRUE ;
};
PushButton PB_URL
{
HelpID = "sw:PushButton:TP_CHAR_URL:PB_URL";
Pos = MAP_APPFONT ( 198 , 14 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~Browse..." ;
};
FixedText FT_TEXT
{
Pos = MAP_APPFONT ( 12 , 33 ) ;
Size = MAP_APPFONT ( 73 , 8 ) ;
Text [ en-US ] = "Te~xt";
};
Edit ED_TEXT
{
HelpID = "sw:Edit:TP_CHAR_URL:ED_TEXT";
Pos = MAP_APPFONT ( 88 , 31 ) ;
Size = MAP_APPFONT ( 104 , 12 ) ;
Border = TRUE ;
TabStop = TRUE ;
Group = TRUE ;
};
FixedText FT_NAME
{
Pos = MAP_APPFONT ( 12 , 49 ) ;
Size = MAP_APPFONT ( 73 , 8 ) ;
Text [ en-US ] = "~Name" ;
};
Edit ED_NAME
{
HelpID = "sw:Edit:TP_CHAR_URL:ED_NAME";
Pos = MAP_APPFONT ( 88 , 47 ) ;
Size = MAP_APPFONT ( 104 , 12 ) ;
Border = TRUE ;
TabStop = TRUE ;
Group = TRUE ;
};
FixedText FT_TARGET
{
Pos = MAP_APPFONT ( 12 , 65 ) ;
Size = MAP_APPFONT ( 73 , 10 ) ;
Text [ en-US ] = "~Target frame" ;
};
ComboBox LB_TARGET
{
HelpID = "sw:ComboBox:TP_CHAR_URL:LB_TARGET";
Pos = MAP_APPFONT ( 88 , 63 ) ;
Size = MAP_APPFONT ( 104 , 60 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
Sort = TRUE ;
Group = TRUE ;
};
PushButton PB_EVENT
{
HelpID = "sw:PushButton:TP_CHAR_URL:PB_EVENT";
Pos = MAP_APPFONT ( 12 , 79 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~Events..." ;
};
FixedLine FL_STYLE
{
Pos = MAP_APPFONT ( 6 , 104 ) ;
Size = MAP_APPFONT ( 248 , 8 ) ;
Text [ en-US ] = "Character Styles" ;
};
FixedText FT_VISITED
{
Pos = MAP_APPFONT ( 12 , 116 ) ;
Size = MAP_APPFONT ( 73 , 8 ) ;
Text [ en-US ] = "~Visited links" ;
};
ListBox LB_VISITED
{
HelpID = "sw:ListBox:TP_CHAR_URL:LB_VISITED";
Pos = MAP_APPFONT ( 88 , 113 ) ;
Size = MAP_APPFONT ( 104 , 60 ) ;
Border = TRUE ;
TabStop = TRUE ;
DropDown = TRUE ;
Sort = TRUE ;
Group = TRUE ;
};
FixedText FT_NOT_VISITED
{
Pos = MAP_APPFONT ( 12 , 131 ) ;
Size = MAP_APPFONT ( 73 , 10 ) ;
Text [ en-US ] = "Unvisited ~links" ;
};
ListBox LB_NOT_VISITED
{
HelpID = "sw:ListBox:TP_CHAR_URL:LB_NOT_VISITED";
Pos = MAP_APPFONT ( 88 , 129 ) ;
Size = MAP_APPFONT ( 104 , 60 ) ;
Border = TRUE ;
TabStop = TRUE ;
DropDown = TRUE ;
Sort = TRUE ;
Group = TRUE ;
};
};
......@@ -60,26 +60,17 @@ public:
class SwCharURLPage : public SfxTabPage
{
VclVBox m_aBox;
VclGrid m_aGrid;
FixedLine aURLFL;
FixedText aURLFT;
Edit aURLED;
FixedText aTextFT;
Edit aTextED;
FixedText aNameFT;
Edit aNameED;
FixedText aTargetFrmFT;
ComboBox aTargetFrmLB;
PushButton aURLPB;
PushButton aEventPB;
FixedLine aStyleFL;
FixedText aVisitedFT;
ListBox aVisitedLB;
FixedText aNotVisitedFT;
ListBox aNotVisitedLB;
Edit* m_pURLED;
FixedText* m_pTextFT;
Edit* m_pTextED;
Edit* m_pNameED;
ComboBox* m_pTargetFrmLB;
PushButton* m_pURLPB;
PushButton* m_pEventPB;
ListBox* m_pVisitedLB;
ListBox* m_pNotVisitedLB;
VclContainer* m_pCharStyleContainer;
SvxMacroItem* pINetItem;
sal_Bool bModified;
......
This diff is collapsed.
......@@ -503,6 +503,7 @@ Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, const
{
extractModel(id, rMap);
ComboBox* pComboBox = new ComboBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK);
pComboBox->SetDropDownLineCount(16); //arbitrary
pWindow = pComboBox;
}
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkTreeView")))
......
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