зеркало из https://github.com/mozilla/gecko-dev.git
Fixed more Composer bugs
This commit is contained in:
Родитель
60b4f20229
Коммит
65a3224235
|
@ -668,13 +668,14 @@ ED_FileError EDT_PublishFile( MWContext * pContext,
|
|||
if (NET_MakeUploadURL(&pPrefLocation,pDestDirectory,pUsername,NULL)) {
|
||||
// Save as the "last location" in preferences
|
||||
PREF_SetCharPref("editor.publish_last_loc", pPrefLocation);
|
||||
|
||||
|
||||
// Save the password if user wants us to (and we have one!)
|
||||
// Also set the preference we use for initial state of "save password" checkbox
|
||||
if( pPassword && *pPassword ){
|
||||
if( bSavePassword ){
|
||||
// PROBLEM: If password was wrong, user may have
|
||||
// enterred it in prompted dialog, but we dont know that one!
|
||||
// NOTE: Password remembering is now handled by "Single Signon" system
|
||||
// All we do here is save the password in a pref so edt_SyncPublishingHistory
|
||||
// can get it and pass
|
||||
char * pass = HG99875(pPassword);
|
||||
PREF_SetCharPref("editor.publish_last_pass",pass);
|
||||
PREF_SetBoolPref("editor.publish_save_password",TRUE);
|
||||
|
|
|
@ -4165,6 +4165,7 @@ private:
|
|||
XP_Bool m_bDontOverwriteAll;
|
||||
XP_Bool m_bDontOverwrite;
|
||||
int m_iCurFile; // 1-based
|
||||
int m_iErrorCount;
|
||||
IStreamOut *m_pOutStream;
|
||||
XP_Bool m_bOpenOutputHandledError;
|
||||
CEditSaveToTempData *m_pSaveToTempData;
|
||||
|
|
|
@ -4505,14 +4505,7 @@ void CEditBuffer::SetParagraphAlign( ED_Alignment eAlign ){
|
|||
XP_Bool bDone;
|
||||
XP_ASSERT(m_pCurrent);
|
||||
|
||||
// To avoid extra HTML params, use default
|
||||
// for left align since that's how layout will do it
|
||||
//cmanske: Windows FE was doing this - moved logic here for consistency
|
||||
// TODO: This is messy for table cells: We need to check if ROW
|
||||
// has set alignment and NOT do this if it isn't already ED_ALIGN_DEFAULT,
|
||||
// otherwise cell gets the row's alignment
|
||||
// BUT we must keep an explicit ED_ALIGN_LEFT if inside a table caption
|
||||
// Use insert point instead of m_pCurrent in case we're selected
|
||||
// Use insert point instead of m_pCurrent in case we're selected (m_pCurrent = 0)
|
||||
CEditElement *pParent = 0;
|
||||
CEditLeafElement *pInsertPoint;
|
||||
GetPropertyPoint(&pInsertPoint);
|
||||
|
@ -4530,10 +4523,14 @@ void CEditBuffer::SetParagraphAlign( ED_Alignment eAlign ){
|
|||
}
|
||||
pParent = pParent->GetParent();
|
||||
}
|
||||
// To avoid extra HTML params, use ED_ALIGN_DEFAULT instead of ED_ALIGN_LEFT
|
||||
// for left align since that's how layout will do it
|
||||
// But we must keep an explicit ED_ALIGN_LEFT if inside a table caption
|
||||
if( !bInCaption && eAlign == ED_ALIGN_LEFT )
|
||||
eAlign = ED_ALIGN_DEFAULT;
|
||||
|
||||
if( IsSelected() ){
|
||||
if( IsSelected() )
|
||||
{
|
||||
CEditLeafElement *pBegin, *pEnd, *pCurrent;
|
||||
CEditContainerElement *pContainer = NULL;
|
||||
ElementOffset iBeginPos, iEndPos;
|
||||
|
@ -4587,7 +4584,8 @@ void CEditBuffer::SetParagraphAlign( ED_Alignment eAlign ){
|
|||
if( pTable )
|
||||
Relayout( pTable, 0 );
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
CEditElement *pContainer = m_pCurrent->FindContainer();
|
||||
// HACKOLA: just poke in a new tag type.
|
||||
pContainer->Container()->SetAlignment( eAlign );
|
||||
|
@ -7259,8 +7257,13 @@ void CEditBuffer::DeleteTableRows(intn number){
|
|||
BeginBatchChanges(kGroupOfChangesCommandID);
|
||||
// If we have entire rows selected, use that for number to delete
|
||||
if( number <= 0 )
|
||||
number = max( 1, GetNumberOfSelectedRows());
|
||||
|
||||
{
|
||||
intn iSelected = GetNumberOfSelectedRows();
|
||||
number = max( 1, iSelected);
|
||||
// If deleting selected rows -- move to the first selected cell
|
||||
if( iSelected > 0 )
|
||||
SetTableInsertPoint(m_SelectedEdCells[0], TRUE);
|
||||
}
|
||||
AdoptAndDo(new CDeleteTableRowCommand(this, number));
|
||||
|
||||
EndBatchChanges();
|
||||
|
@ -7885,7 +7888,13 @@ void CEditBuffer::DeleteTableColumns(intn number){
|
|||
BeginBatchChanges(kGroupOfChangesCommandID);
|
||||
// If we have entire columns selected, use that for number to delete
|
||||
if( number <= 0 )
|
||||
number = max(1, GetNumberOfSelectedColumns());
|
||||
{
|
||||
intn iSelected = GetNumberOfSelectedColumns();
|
||||
number = max(1, iSelected);
|
||||
// Deleting selected columns - move to the first selected cell
|
||||
if( iSelected > 0 )
|
||||
SetTableInsertPoint(m_SelectedEdCells[0], TRUE);
|
||||
}
|
||||
|
||||
AdoptAndDo(new CDeleteTableColumnCommand(this, number));
|
||||
EndBatchChanges();
|
||||
|
@ -9347,6 +9356,22 @@ void CEditBuffer::DebugPrintTree(CEditElement* pElement){
|
|||
}
|
||||
else if( pElement->IsContainer() ){
|
||||
ED_Alignment alignment = pElement->Container()->GetAlignment();
|
||||
// See we are inside a caption
|
||||
XP_Bool bInCaption = FALSE;
|
||||
CEditElement *pParent = pElement->GetParent();
|
||||
while( pParent && pParent != m_pRoot )
|
||||
{
|
||||
if( pParent->IsCaption() )
|
||||
{
|
||||
bInCaption = TRUE;
|
||||
break;
|
||||
}
|
||||
pParent = pParent->GetParent();
|
||||
}
|
||||
if( alignment == ED_ALIGN_DEFAULT )
|
||||
{
|
||||
alignment = bInCaption ? ED_ALIGN_ABSCENTER : ED_ALIGN_LEFT;
|
||||
}
|
||||
if ( alignment < LO_ALIGN_CENTER || alignment > ED_ALIGN_ABSTOP ) {
|
||||
pData = "Bad alignment.";
|
||||
}
|
||||
|
|
|
@ -1037,6 +1037,7 @@ CEditListElement* CEditElement::GetMailQuote() {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// This is silly -- we never return anything other than ED_ALIGN_DEFAULT???
|
||||
ED_Alignment CEditElement::GetDefaultAlignment(){
|
||||
if ( m_pParent )
|
||||
return m_pParent->GetDefaultAlignment();
|
||||
|
@ -1863,7 +1864,7 @@ void CEditSubDocElement::FinishedLoad( CEditBuffer* pBuffer ){
|
|||
// Subdocs have to have children.
|
||||
// Put an empty paragraph into any empty subdoc.
|
||||
pChild = CEditContainerElement::NewDefaultContainer( this,
|
||||
IsCaption() ? ED_ALIGN_CENTER : GetDefaultAlignment() );
|
||||
IsCaption() ? ED_ALIGN_ABSCENTER : GetDefaultAlignment() );
|
||||
// Creating it inserts it.
|
||||
(void) new CEditTextElement(pChild, 0);
|
||||
}
|
||||
|
@ -5445,15 +5446,6 @@ EEditElementType CEditTableCellElement::GetElementType(){
|
|||
|
||||
ED_Alignment CEditTableCellElement::GetDefaultAlignment(){
|
||||
return ED_ALIGN_DEFAULT;
|
||||
/*
|
||||
EDT_TableCellData* pData = GetData();
|
||||
ED_Alignment result = IsTableData() ? ED_ALIGN_LEFT : ED_ALIGN_ABSCENTER;
|
||||
if ( pData->align != ED_ALIGN_DEFAULT ) {
|
||||
result = pData->align;
|
||||
}
|
||||
FreeData(pData);
|
||||
return result;
|
||||
*/
|
||||
}
|
||||
|
||||
XP_Bool CEditTableCellElement::IsTableData(){
|
||||
|
@ -7673,19 +7665,29 @@ void CEditContainerElement::AdjustContainers( CEditBuffer *pBuffer ){
|
|||
CEditElement::AdjustContainers(pBuffer);
|
||||
}
|
||||
|
||||
PA_Tag* CEditContainerElement::TagOpen( int iEditOffset ){
|
||||
PA_Tag* CEditContainerElement::TagOpen( int iEditOffset )
|
||||
{
|
||||
PA_Tag *pRet = 0;
|
||||
PA_Tag* pTag;
|
||||
|
||||
// create the DIV tag if we need to.
|
||||
if( m_align == ED_ALIGN_ABSCENTER || m_align == ED_ALIGN_RIGHT ){
|
||||
if( m_align == ED_ALIGN_LEFT || m_align == ED_ALIGN_ABSCENTER || m_align == ED_ALIGN_RIGHT )
|
||||
{
|
||||
pTag = XP_NEW( PA_Tag );
|
||||
XP_BZERO( pTag, sizeof( PA_Tag ) );
|
||||
if( m_align== ED_ALIGN_RIGHT ){
|
||||
// Explicitely create LEFT <DIV> element if not ED_ALIGN_DEFAULT
|
||||
if( m_align== ED_ALIGN_LEFT )
|
||||
{
|
||||
SetTagData( pTag, "ALIGN=left>");
|
||||
pTag->type = P_DIVISION;
|
||||
}
|
||||
else if( m_align== ED_ALIGN_RIGHT )
|
||||
{
|
||||
SetTagData( pTag, "ALIGN=right>");
|
||||
pTag->type = P_DIVISION;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
SetTagData( pTag, ">");
|
||||
pTag->type = P_CENTER;
|
||||
}
|
||||
|
@ -7693,44 +7695,51 @@ PA_Tag* CEditContainerElement::TagOpen( int iEditOffset ){
|
|||
}
|
||||
|
||||
// create the actual paragraph tag
|
||||
if( GetTagData() ){
|
||||
if( GetTagData() )
|
||||
{
|
||||
pTag = XP_NEW( PA_Tag );
|
||||
XP_BZERO( pTag, sizeof( PA_Tag ) );
|
||||
SetTagData( pTag, GetTagData() );
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
pTag = CEditElement::TagOpen( iEditOffset );
|
||||
}
|
||||
|
||||
// link the tags together.
|
||||
if( pRet == 0 ){
|
||||
if( pRet == 0 )
|
||||
pRet = pTag;
|
||||
}
|
||||
else {
|
||||
else
|
||||
pRet->next = pTag;
|
||||
}
|
||||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
PA_Tag* CEditContainerElement::TagEnd( ){
|
||||
PA_Tag* CEditContainerElement::TagEnd( )
|
||||
{
|
||||
PA_Tag *pRet = CEditElement::TagEnd();
|
||||
if( m_align == ED_ALIGN_ABSCENTER || m_align == ED_ALIGN_RIGHT ){
|
||||
if( m_align == ED_ALIGN_LEFT || m_align == ED_ALIGN_ABSCENTER || m_align == ED_ALIGN_RIGHT )
|
||||
{
|
||||
PA_Tag* pTag = XP_NEW( PA_Tag );
|
||||
XP_BZERO( pTag, sizeof( PA_Tag ) );
|
||||
pTag->is_end = TRUE;
|
||||
if( m_align == ED_ALIGN_RIGHT ){
|
||||
// Explicitely create LEFT <DIV> element if not ED_ALIGN_DEFAULT
|
||||
if( m_align== ED_ALIGN_LEFT )
|
||||
{
|
||||
pTag->type = P_DIVISION;
|
||||
}
|
||||
else if( m_align == ED_ALIGN_RIGHT )
|
||||
{
|
||||
pTag->type = P_DIVISION;
|
||||
}
|
||||
else {
|
||||
pTag->type = P_CENTER;
|
||||
}
|
||||
|
||||
if( pRet == 0 ){
|
||||
if( pRet == 0 )
|
||||
pRet = pTag;
|
||||
}
|
||||
else {
|
||||
else
|
||||
pRet->next = pTag;
|
||||
}
|
||||
}
|
||||
return pRet;
|
||||
}
|
||||
|
@ -7863,9 +7872,9 @@ void CEditContainerElement::PrintOpen( CPrintState *pPrintState ){
|
|||
if (pPrevContainer && pPrevContainer->GetType()!=P_NSDT)
|
||||
pPrevContainer=NULL;//all bets are off
|
||||
|
||||
// We must set this explicitly for text in TableCaptions
|
||||
// Hopefully, we will change ED_ALIGN_LEFT to ED_ALIGN_DEFAULT for regular paragraphs
|
||||
// so we don't clutter HTML with extra <DIV> alignment tags
|
||||
// We must always set alignment explicitly for text in TableCaptions
|
||||
// For this to work, we must change use ED_ALIGN_DEFAULT instead of ED_ALIGN_LEFT
|
||||
// when parsing regular paragraphs so we don't clutter HTML with extra <DIV> alignment tags
|
||||
if (( GetAlignment() == ED_ALIGN_LEFT && ! IsEmpty()) && ( !pPrevContainer ||
|
||||
(pPrevContainer->GetAlignment() != ED_ALIGN_LEFT) ))
|
||||
{
|
||||
|
@ -8096,7 +8105,8 @@ void CEditContainerElement::SetData( EDT_ContainerData *pData ){
|
|||
if( m_align == ED_ALIGN_CENTER ) m_align = ED_ALIGN_ABSCENTER;
|
||||
|
||||
//
|
||||
// Never generate ALIGN= stuff anymore. Use the Div tag and Center Tags
|
||||
// Never generate ALIGN= stuff anymore.
|
||||
// Use the Div tag for LEFT and RIGHT, and the CENTER tag
|
||||
//
|
||||
char* pExtra = "";
|
||||
if ( pData && pData->pExtra ) {
|
||||
|
@ -8131,7 +8141,7 @@ EDT_ContainerData* CEditContainerElement::ParseParams( PA_Tag *pTag, int16 csid
|
|||
align = edt_FetchParamAlignment( pTag, m_defaultAlign, FALSE, csid );
|
||||
if( align == ED_ALIGN_CENTER ) align = ED_ALIGN_ABSCENTER;
|
||||
|
||||
if( align == ED_ALIGN_RIGHT || align == ED_ALIGN_LEFT || align == ED_ALIGN_ABSCENTER){
|
||||
if( align == ED_ALIGN_DEFAULT || align == ED_ALIGN_RIGHT || align == ED_ALIGN_LEFT || align == ED_ALIGN_ABSCENTER){
|
||||
pData->align = align;
|
||||
}
|
||||
pData->pExtra = edt_FetchParamExtras( pTag, containerParams, csid );
|
||||
|
@ -10627,6 +10637,10 @@ EDT_ImageData* CEditImageElement::GetImageData(){
|
|||
|
||||
if( m_href != ED_LINK_ID_NONE ){
|
||||
pRet->pHREFData = m_href->GetData();
|
||||
// The only way to consistently show the "default" 2-pixel border
|
||||
// is to set it to 2 if it was missing in the tag params
|
||||
if( pRet->iBorder == -1 )
|
||||
pRet->iBorder = GetDefaultBorder();
|
||||
}
|
||||
pRet->align = m_align;
|
||||
PA_FreeTag( pTag );
|
||||
|
|
|
@ -304,11 +304,15 @@ CFileSaveObject::~CFileSaveObject(){
|
|||
if (m_tapeFS->GetType() == ITapeFileSystem::Publish &&
|
||||
m_status == ED_ERROR_NONE) {
|
||||
char *msg = NULL;
|
||||
|
||||
// Different message for 1 or multiple files.
|
||||
if (m_tapeFS->GetNumFiles() > 1) {
|
||||
// Subtract count of files that failed.
|
||||
int iCount = m_tapeFS->GetNumFiles() - m_iErrorCount;
|
||||
|
||||
if ( iCount > 1) {
|
||||
char *tmplate = XP_GetString(XP_EDT_PUBLISH_REPORT_MSG);
|
||||
if (tmplate) {
|
||||
msg = PR_smprintf(tmplate,m_tapeFS->GetNumFiles());
|
||||
msg = PR_smprintf(tmplate, iCount);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -460,6 +464,9 @@ ED_FileError CFileSaveObject::SaveFiles(){
|
|||
}
|
||||
FE_SaveDialogCreate( m_pContext, m_tapeFS->GetNumFiles(), saveType );
|
||||
}
|
||||
// Count number of files we fail to save
|
||||
// to subtract from total number when reporting at the end
|
||||
m_iErrorCount = 0;
|
||||
|
||||
if (SaveFirstFile()) {
|
||||
// Child of CFileSaveObject took care of the first file.
|
||||
|
@ -558,6 +565,7 @@ void CFileSaveObject::NetFetchDone( int status ){
|
|||
// "Unknown" error default
|
||||
iError = ED_ERROR_FILE_READ;
|
||||
}
|
||||
m_iErrorCount++;
|
||||
}
|
||||
|
||||
// ED_ERROR_FILE_OPEN was already handled in CFileSaveObject::OpenOutputFile()
|
||||
|
|
|
@ -5111,6 +5111,10 @@ Bool lo_ProcessClick(MWContext *context, lo_TopState *top_state, lo_DocState *st
|
|||
case LO_HIT_ELEMENT_REGION_BEFORE:
|
||||
{
|
||||
|
||||
lo_SetInsertPoint(context, top_state, eptr, position, layer);
|
||||
return FALSE;
|
||||
#if 0
|
||||
/* Unfortunately, we hit this even when clicking within a text region - find another way to select line in a cell */
|
||||
if( requireCaret || lo_GetParentTable(context, eptr) == 0 )
|
||||
{
|
||||
/* Not in a table cell or we need a caret
|
||||
|
@ -5133,6 +5137,7 @@ Bool lo_ProcessClick(MWContext *context, lo_TopState *top_state, lo_DocState *st
|
|||
lo_SetSelection(context, & result->lo_hitLine.selection, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case LO_HIT_ELEMENT_REGION_MIDDLE:
|
||||
|
|
|
@ -2141,7 +2141,8 @@ lo_NewElement(MWContext *context, lo_DocState *state, intn type,
|
|||
|
||||
if( EDT_IS_EDITOR(context) )
|
||||
{
|
||||
if( lo_EditableElement( type ) )
|
||||
/* if( lo_EditableElement( type ) ) Change from toshok: */
|
||||
if( lo_EditableElement( type ) && type != LO_LINEFEED )
|
||||
{
|
||||
if( edit_element == 0 ){
|
||||
edit_element = state->edit_current_element;
|
||||
|
|
Загрузка…
Ссылка в новой задаче