~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/riched20/list.c

Version: ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /*
  2  * RichEdit - Basic operations on double linked lists.
  3  *
  4  * Copyright 2004 by Krzysztof Foltman
  5  *
  6  * This library is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2.1 of the License, or (at your option) any later version.
 10  *
 11  * This library is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this library; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 
 22 #include "editor.h"
 23 
 24 WINE_DEFAULT_DEBUG_CHANNEL(richedit_lists);
 25 
 26 void ME_InsertBefore(ME_DisplayItem *diWhere, ME_DisplayItem *diWhat)
 27 {
 28   diWhat->next = diWhere;
 29   diWhat->prev = diWhere->prev;
 30 
 31   diWhere->prev->next = diWhat;
 32   diWhat->next->prev = diWhat;
 33 }
 34 
 35 void ME_Remove(ME_DisplayItem *diWhere)
 36 {
 37   ME_DisplayItem *diNext = diWhere->next;
 38   ME_DisplayItem *diPrev = diWhere->prev;
 39   assert(diNext);
 40   assert(diPrev);
 41   diPrev->next = diNext;
 42   diNext->prev = diPrev;
 43 }
 44 
 45 ME_DisplayItem *ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass)
 46 {
 47   if (!di)
 48     return NULL;
 49   di = di->prev;
 50   while(di!=NULL) {
 51     if (ME_DITypesEqual(di->type, nTypeOrClass))
 52       return di;
 53     di = di->prev;
 54   }
 55   return NULL;
 56 }
 57 
 58 ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass)
 59 {
 60   while(di!=NULL) {
 61     if (ME_DITypesEqual(di->type, nTypeOrClass))
 62       return di;
 63     di = di->prev;
 64   }
 65   return NULL;
 66 }
 67 
 68 ME_DisplayItem *ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass)
 69 {
 70   if (!di) return NULL;
 71   di = di->next;
 72   while(di!=NULL) {
 73     if (ME_DITypesEqual(di->type, nTypeOrClass))
 74       return di;
 75     di = di->next;
 76   }
 77   return NULL;
 78 }
 79 
 80 ME_DisplayItem *ME_FindItemFwdOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass)
 81 {
 82   while(di!=NULL) {
 83     if (ME_DITypesEqual(di->type, nTypeOrClass))
 84       return di;
 85     di = di->next;
 86   }
 87   return NULL;
 88 }
 89 
 90 BOOL ME_DITypesEqual(ME_DIType type, ME_DIType nTypeOrClass)
 91 {
 92   if (type==nTypeOrClass)
 93     return TRUE;
 94   if (nTypeOrClass==diRunOrParagraph && (type==diRun || type==diParagraph))
 95     return TRUE;
 96   if (nTypeOrClass==diRunOrStartRow && (type==diRun || type==diStartRow))
 97     return TRUE;
 98   if (nTypeOrClass==diParagraphOrEnd && (type==diTextEnd || type==diParagraph))
 99     return TRUE;
100   if (nTypeOrClass==diStartRowOrParagraph && (type==diStartRow || type==diParagraph))
101     return TRUE;
102   if (nTypeOrClass==diStartRowOrParagraphOrEnd 
103     && (type==diStartRow || type==diParagraph || type==diTextEnd))
104     return TRUE;
105   if (nTypeOrClass==diRunOrParagraphOrEnd 
106     && (type==diRun || type==diParagraph || type==diTextEnd))
107     return TRUE;
108   return FALSE;
109 }
110 
111 void ME_DestroyDisplayItem(ME_DisplayItem *item) {
112 /*  TRACE("type=%s\n", ME_GetDITypeName(item->type)); */
113   if (item->type==diParagraph || item->type == diUndoSetParagraphFormat) {
114     FREE_OBJ(item->member.para.pFmt);
115   }
116   if (item->type==diRun || item->type == diUndoInsertRun) {
117     if (item->member.run.ole_obj) ME_DeleteReObject(item->member.run.ole_obj);
118     ME_ReleaseStyle(item->member.run.style);
119     ME_DestroyString(item->member.run.strText);
120   }
121   if (item->type==diUndoSetCharFormat) {
122     ME_ReleaseStyle(item->member.ustyle);
123   }
124   if (item->type==diUndoSplitParagraph) {
125      FREE_OBJ(item->member.para.pFmt);
126      FREE_OBJ(item->member.para.pCell);
127   }
128   FREE_OBJ(item);
129 }
130 
131 ME_DisplayItem *ME_MakeDI(ME_DIType type) {
132   ME_DisplayItem *item = ALLOC_OBJ(ME_DisplayItem);
133   ZeroMemory(item, sizeof(ME_DisplayItem));
134   item->type = type;
135   item->prev = item->next = NULL;
136   if (type == diParagraph || type == diUndoSplitParagraph) {
137     item->member.para.pFmt = ALLOC_OBJ(PARAFORMAT2);
138     ME_SetDefaultParaFormat(item->member.para.pFmt);
139     item->member.para.nFlags = MEPF_REWRAP;
140   }
141     
142   return item;
143 }
144 
145 const char *ME_GetDITypeName(ME_DIType type)
146 {
147   switch(type)
148   {
149     case diParagraph: return "diParagraph";
150     case diRun: return "diRun";
151     case diCell: return "diCell";
152     case diTextStart: return "diTextStart";
153     case diTextEnd: return "diTextEnd";
154     case diStartRow: return "diStartRow";
155     case diUndoEndTransaction: return "diUndoEndTransaction";
156     case diUndoPotentialEndTransaction: return "diUndoPotentialEndTransaction";
157     case diUndoSetParagraphFormat: return "diUndoSetParagraphFormat";
158     case diUndoSetCharFormat: return "diUndoSetCharFormat";
159     case diUndoInsertRun: return "diUndoInsertRun";
160     case diUndoDeleteRun: return "diUndoDeleteRun";
161     case diUndoJoinParagraphs: return "diJoinParagraphs";
162     case diUndoSplitParagraph: return "diSplitParagraph";
163     default: return "?";
164   }
165 }
166 
167 void ME_DumpDocument(ME_TextBuffer *buffer)
168 {
169   /* FIXME this is useless, */
170   ME_DisplayItem *pItem = buffer->pFirst;
171   TRACE("DOCUMENT DUMP START\n");
172   while(pItem) {
173     switch(pItem->type)
174     {
175       case diTextStart:
176         TRACE("Start\n");
177         break;
178       case diCell:
179         TRACE("Cell(level=%d%s)\n", pItem->member.cell.nNestingLevel,
180               !pItem->member.cell.next_cell ? ", END" :
181                 (!pItem->member.cell.prev_cell ? ", START" :""));
182         break;
183       case diParagraph:
184         TRACE("Paragraph(ofs=%d)\n", pItem->member.para.nCharOfs);
185         if (pItem->member.para.nFlags & MEPF_ROWSTART)
186           TRACE(" - (Table Row Start)\n");
187         if (pItem->member.para.nFlags & MEPF_ROWEND)
188           TRACE(" - (Table Row End)\n");
189         break;
190       case diStartRow:
191         TRACE(" - StartRow\n");
192         break;
193       case diRun:
194         TRACE(" - Run(\"%s\", %d)\n", debugstr_w(pItem->member.run.strText->szData), 
195           pItem->member.run.nCharOfs);
196         if (pItem->member.run.nFlags & MERF_ENDPARA)
197           TRACE(" - Paragraph end: %d CR, %d LF\n", pItem->member.run.nCR, pItem->member.run.nLF);
198         break;
199       case diTextEnd:
200         TRACE("End(ofs=%d)\n", pItem->member.para.nCharOfs);
201         break;
202       default:
203         break;
204     }
205     pItem = pItem->next;
206   }
207   TRACE("DOCUMENT DUMP END\n");
208 }
209 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.