Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

672 lines
20 KiB

  1. #include "lsdnset.h"
  2. #include "lsc.h"
  3. #include "lsdnode.h"
  4. #include "dnutils.h"
  5. #include "iobj.h"
  6. #include "ntiman.h"
  7. #include "tabutils.h"
  8. #include "getfmtst.h"
  9. #include "setfmtst.h"
  10. #include "lstext.h"
  11. #include "dninfo.h"
  12. #include "chnutils.h"
  13. #include "lssubl.h"
  14. #include "sublutil.h"
  15. #include "lscfmtfl.h"
  16. #include "iobjln.h"
  17. #include "lsmem.h" /* memset() */
  18. #define FColinearTflows(t1, t2) \
  19. (((t1) & fUVertical) == ((t2) & fUVertical))
  20. /* L S D N Q U E R Y O B J D I M R A N G E */
  21. /*----------------------------------------------------------------------------
  22. %%Function: LsdnQueryObjDimRange
  23. %%Contact: igorzv
  24. Parameters:
  25. plsc - (IN) ptr to line services context
  26. plsdnFirst - (IN) first dnode in the range
  27. plsdnLast - (IN) last dnode in the range
  28. pobjdim - (OUT) geometry of the range
  29. ----------------------------------------------------------------------------*/
  30. LSERR WINAPI LsdnQueryObjDimRange(PLSC plsc,
  31. PLSDNODE plsdnFirst, PLSDNODE plsdnLast,
  32. POBJDIM pobjdim)
  33. {
  34. PLSDNODE plsdn;
  35. LSERR lserr;
  36. if (pobjdim == NULL)
  37. return lserrNullOutputParameter;
  38. if (!FIsLSC(plsc))
  39. return lserrInvalidContext;
  40. /* if client call us with empty range return right away */
  41. if (plsdnFirst == NULL)
  42. {
  43. if (plsdnLast != NULL)
  44. return lserrInvalidDnode;
  45. memset(pobjdim, 0, sizeof(OBJDIM));
  46. return lserrNone;
  47. }
  48. if (!FIsLSDNODE(plsdnFirst))
  49. return lserrInvalidDnode;
  50. if (!FIsLSDNODE(plsdnLast))
  51. return lserrInvalidDnode;
  52. if (plsdnFirst->plssubl != plsdnLast->plssubl)
  53. return lserrInvalidDnode;
  54. /* we should call NominalToIdeal if we are in formating stage and range intersects last chunk
  55. and this chunk is chunk of text*/
  56. plsdn = plsdnLast;
  57. /* to find chunk where we are we should skip back borders */
  58. while (plsdn != NULL && FIsDnodeBorder(plsdn))
  59. {
  60. plsdn = plsdn->plsdnPrev;
  61. }
  62. if ((plsc->lsstate == LsStateFormatting) &&
  63. FNominalToIdealEncounted(plsc) &&
  64. (plsdn != NULL) &&
  65. FIsDnodeReal(plsdn) &&
  66. (IdObjFromDnode(plsdn) == IobjTextFromLsc(&plsc->lsiobjcontext))
  67. )
  68. {
  69. for(; !FIsChunkBoundary(plsdn->plsdnNext, IobjTextFromLsc(&plsc->lsiobjcontext),
  70. plsdnLast->cpFirst);
  71. plsdn=plsdn->plsdnNext);
  72. if (plsdn->plsdnNext == NULL)
  73. {
  74. lserr = ApplyNominalToIdeal(PlschunkcontextFromSubline(plsdnFirst->plssubl),
  75. &plsc->lsiobjcontext, plsc->grpfManager, plsc->lsadjustcontext.lskj,
  76. FIsSubLineMain(SublineFromDnode(plsdn)), FLineContainsAutoNumber(plsc),
  77. plsdn);
  78. if (lserr != lserrNone)
  79. return lserr;
  80. }
  81. }
  82. return FindListDims(plsdnFirst, plsdnLast, pobjdim);
  83. }
  84. /* L S D N G E T C U R T A B I N F O */
  85. /*----------------------------------------------------------------------------
  86. %%Function: LsdnGetCurTabInfo
  87. %%Contact: igorzv
  88. Parameters:
  89. plsc - (IN) ptr to line services context
  90. plsktab - (OUT) type of current tab
  91. Finds tab stop nearest to the current pen position and returns type of such tab stop.
  92. ----------------------------------------------------------------------------*/
  93. LSERR WINAPI LsdnGetCurTabInfo(PLSC plsc, LSKTAB* plsktab)
  94. {
  95. PLSDNODE plsdnTab;
  96. LSTABSCONTEXT* plstabscontext;
  97. BOOL fBreakThroughTab;
  98. LSERR lserr;
  99. long urNewMargin;
  100. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  101. if (!FFormattingAllowed(plsc)) return lserrFormattingFunctionDisabled;
  102. if (plsktab == NULL) return lserrInvalidParameter;
  103. plsdnTab = GetCurrentDnode(plsc);
  104. plstabscontext = &(plsc->lstabscontext);
  105. Assert(FIsLSDNODE(plsdnTab));
  106. if (!plsdnTab->fTab) return lserrCurrentDnodeIsNotTab;
  107. Assert(FIsDnodeReal(plsdnTab));
  108. if (plstabscontext->plsdnPendingTab != NULL) return lserrPendingTabIsNotResolved;
  109. lserr = GetCurTabInfoCore(&plsc->lstabscontext, plsdnTab, GetCurrentUr(plsc), fFalse,
  110. plsktab, &fBreakThroughTab);
  111. if (lserr != lserrNone)
  112. return lserr;
  113. TurnOnTabEncounted(plsc);
  114. if (*plsktab != lsktLeft)
  115. TurnOnNonLeftTabEncounted(plsc);
  116. /* move current pen position */
  117. AdvanceCurrentUr(plsc, DurFromDnode(plsdnTab));
  118. if (fBreakThroughTab)
  119. {
  120. lserr = GetMarginAfterBreakThroughTab(&plsc->lstabscontext, plsdnTab, &urNewMargin);
  121. if (lserr != lserrNone)
  122. return lserr;
  123. SetBreakthroughLine(plsc, urNewMargin);
  124. }
  125. return lserrNone;
  126. }
  127. /* L S D N R E S O L V E P R E V T A B */
  128. /*----------------------------------------------------------------------------
  129. %%Function: LsdnResolvePrevTab
  130. %%Contact: igorzv
  131. Parameters:
  132. plsc - (IN) ptr to line services context
  133. ----------------------------------------------------------------------------*/
  134. LSERR WINAPI LsdnResolvePrevTab(PLSC plsc)
  135. {
  136. long dur;
  137. LSERR lserr;
  138. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  139. if (!FFormattingAllowed(plsc)) return lserrFormattingFunctionDisabled;
  140. lserr = ResolvePrevTabCore(&plsc->lstabscontext, GetCurrentDnode(plsc), GetCurrentUr(plsc),
  141. &dur);
  142. if (lserr != lserrNone)
  143. return lserr;
  144. AdvanceCurrentUr(plsc, dur);
  145. return lserrNone;
  146. }
  147. /* L S D N S K I P C U R T A B */
  148. /*----------------------------------------------------------------------------
  149. %%Function: LsdnSkipCurTab
  150. %%Contact: igorzv
  151. Parameters:
  152. plsc - (IN) ptr to line services context
  153. ----------------------------------------------------------------------------*/
  154. LSERR WINAPI LsdnSkipCurTab(PLSC plsc) /* IN: Pointer to LS Context */
  155. {
  156. PLSDNODE plsdnTab;
  157. LSTABSCONTEXT* plstabscontext;
  158. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  159. if (!FFormattingAllowed(plsc)) return lserrFormattingFunctionDisabled;
  160. plsdnTab = GetCurrentDnode(plsc);
  161. plstabscontext = &(plsc->lstabscontext);
  162. Assert(FIsLSDNODE(plsdnTab));
  163. if (!plsdnTab->fTab) return lserrCurrentDnodeIsNotTab;
  164. Assert(FIsDnodeReal(plsdnTab));
  165. if (plstabscontext->plsdnPendingTab != NULL)
  166. {
  167. CancelPendingTab(&plsc->lstabscontext);
  168. }
  169. else
  170. {
  171. AdvanceCurrentUr(plsc, - plsdnTab->u.real.objdim.dur);
  172. SetDnodeDurFmt(plsdnTab, 0);
  173. }
  174. return lserrNone;
  175. }
  176. /* L S D N S E T R I G I D D U P */
  177. /*----------------------------------------------------------------------------
  178. %%Function: LsdnSetRigidDup
  179. %%Contact: igorzv
  180. Parameters:
  181. plsc - (IN) ptr to line services context
  182. plsdn - (IN) dnode to be modified
  183. dup - (IN) dup to put in the dnode
  184. ----------------------------------------------------------------------------*/
  185. LSERR WINAPI LsdnSetRigidDup(PLSC plsc, PLSDNODE plsdn, long dup)
  186. {
  187. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  188. if (!FIsLSDNODE(plsdn)) return lserrInvalidParameter;
  189. if (!FFormattingAllowed(plsc)) return lserrFormattingFunctionDisabled;
  190. plsdn->fRigidDup = fTrue;
  191. if (plsdn->klsdn == klsdnReal)
  192. {
  193. plsdn->u.real.dup = dup;
  194. }
  195. else
  196. {
  197. plsdn->u.pen.dup = dup;
  198. }
  199. return lserrNone;
  200. }
  201. /* L S D N G E T D U P */
  202. /*----------------------------------------------------------------------------
  203. %%Function: LsdnGetDup
  204. %%Contact: igorzv
  205. Parameters:
  206. plsc - (IN) ptr to line services context
  207. plsdn - (IN) dnode queried
  208. dup - (OUT) dup of this dnode
  209. ----------------------------------------------------------------------------*/
  210. LSERR WINAPI LsdnGetDup(PLSC plsc, PLSDNODE plsdn, long* pdup)
  211. {
  212. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  213. if (!FIsLSDNODE(plsdn)) return lserrInvalidParameter;
  214. /* check that dup in dnode is valid */
  215. if (plsdn->plssubl->fDupInvalid && !plsdn->fRigidDup)
  216. return lserrDupInvalid;
  217. *pdup = DupFromDnode(plsdn);
  218. return lserrNone;
  219. }
  220. /* L S D N R E S E T O B J D I M */
  221. /*----------------------------------------------------------------------------
  222. %%Function: LsdnResetObjDim
  223. %%Contact: igorzv
  224. Parameters:
  225. plsc - (IN) ptr to line services context
  226. plsdn - (IN) dnode to be modified
  227. pobjdimNew - (IN) new dimensions of the dnode
  228. ----------------------------------------------------------------------------*/
  229. LSERR WINAPI LsdnResetObjDim(PLSC plsc, PLSDNODE plsdn, PCOBJDIM pobjdimNew)
  230. {
  231. long durOld;
  232. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  233. if (!FIsLSDNODE(plsdn)) return lserrInvalidParameter;
  234. if (!FIsDnodeReal(plsdn)) return lserrInvalidParameter;
  235. /* we should be in the stage of formatting or breaking */
  236. if (!FFormattingAllowed(plsc) && !FBreakingAllowed(plsc))
  237. return lserrFormattingFunctionDisabled;
  238. durOld = plsdn->u.real.objdim.dur;
  239. SetDnodeObjdimFmt(plsdn, *pobjdimNew);
  240. /* update current pen position */
  241. AdvanceCurrentUrSubl(plsdn->plssubl, (plsdn->u.real.objdim.dur - durOld));
  242. return lserrNone;
  243. }
  244. /* L S D N R E S E T P E N N O D E */
  245. /*----------------------------------------------------------------------------
  246. %%Function: LsdnResetPenNode
  247. %%Contact: igorzv
  248. Parameters:
  249. plsc - (IN) ptr to line services context
  250. plsdnPen - (IN) dnode to be modified
  251. dvpPen - (IN) new dvp of the dnode
  252. durPen - (IN) new dur of the dnode
  253. dvrPen - (IN) new dvr of the dnode
  254. ----------------------------------------------------------------------------*/
  255. LSERR WINAPI LsdnResetPenNode(PLSC plsc, PLSDNODE plsdnPen,
  256. long dvpPen, long durPen, long dvrPen)
  257. {
  258. long durOld;
  259. long dvrOld;
  260. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  261. if (!FIsLSDNODE(plsdnPen)) return lserrInvalidParameter;
  262. if (!FIsDnodePen(plsdnPen)) return lserrInvalidParameter;
  263. /* we should be in the stage of formatting */
  264. if (!FFormattingAllowed(plsc)) return lserrFormattingFunctionDisabled;
  265. if (GetDnodeToFinish(plsc) == NULL) return lserrFormattingFunctionDisabled;
  266. if (!FIsDnodeReal(GetDnodeToFinish(plsc)) )
  267. return lserrFormattingFunctionDisabled;
  268. if (plsdnPen->plssubl != GetCurrentSubline(plsc)) return lserrInvalidParameter;
  269. durOld = plsdnPen->u.pen.dur;
  270. dvrOld = plsdnPen->u.pen.dvr;
  271. plsdnPen->u.pen.dvp = dvpPen;
  272. SetPenBorderDurFmt(plsdnPen, durPen);
  273. plsdnPen->u.pen.dvr = dvrPen;
  274. /* update current pen position */
  275. AdvanceCurrentUr(plsc, plsdnPen->u.pen.dur - durOld);
  276. AdvanceCurrentVr(plsc, plsdnPen->u.pen.dvr - dvrOld);
  277. return lserrNone;
  278. }
  279. /* L S D N Q U E R Y N O D E */
  280. /*----------------------------------------------------------------------------
  281. %%Function: LsdnQueryPenNode
  282. %%Contact: igorzv
  283. Parameters:
  284. plsc - (IN) ptr to line services context
  285. plsdnPen - (IN) dnode quried
  286. pdvpPen - (OUT) dvp of the dnode
  287. pdurPen - (OUT) dur of the dnode
  288. pdvrPen - (OUT) dvr of the dnode
  289. ----------------------------------------------------------------------------*/
  290. LSERR WINAPI LsdnQueryPenNode(PLSC plsc, PLSDNODE plsdnPen,
  291. long* pdvpPen, long* pdurPen, long* pdvrPen)
  292. {
  293. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  294. if (!FIsLSDNODE(plsdnPen)) return lserrInvalidParameter;
  295. if (!FIsDnodePen(plsdnPen)) return lserrInvalidParameter;
  296. *pdvpPen = plsdnPen->u.pen.dvp;
  297. *pdurPen = plsdnPen->u.pen.dur;
  298. *pdvrPen = plsdnPen->u.pen.dvr;
  299. return lserrNone;
  300. }
  301. /* L S D N S E T A B S B A S E L I N E */
  302. /*----------------------------------------------------------------------------
  303. %%Function: LsdnSetAbsBaseLine
  304. %%Contact: igorzv
  305. Parameters:
  306. plsc - (IN) ptr to line services context
  307. vaAdvanceNew - (IN) new vaBase
  308. ----------------------------------------------------------------------------*/
  309. LSERR WINAPI LsdnSetAbsBaseLine(PLSC plsc, long vaAdvanceNew)
  310. {
  311. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  312. /* we should be in the stage of formatting*/
  313. if (!FFormattingAllowed(plsc)) return lserrFormattingFunctionDisabled;
  314. plsc->plslineCur->lslinfo.fAdvanced = fTrue;
  315. plsc->plslineCur->lslinfo.vaAdvance = vaAdvanceNew;
  316. return lserrNone;
  317. }
  318. #define PlnobjFromLsc(plsc,iobj) ((Assert(FIsLSC(plsc)), PlnobjFromLsline((plsc)->plslineCur,iobj)))
  319. /* L S D N M O D I F Y P A R A E N D I N G*/
  320. /*----------------------------------------------------------------------------
  321. %%Function: LsdnModifyParaEnding
  322. %%Contact: igorzv
  323. Parameters:
  324. plsc - (IN) ptr to line services context
  325. lskeop - (IN) Kind of line ending
  326. ----------------------------------------------------------------------------*/
  327. LSERR WINAPI LsdnModifyParaEnding(PLSC plsc, LSKEOP lskeop)
  328. {
  329. LSERR lserr;
  330. DWORD iobjText;
  331. PLNOBJ plnobjText;
  332. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  333. /* we should be in the stage of formatting*/
  334. if (!FFormattingAllowed(plsc)) return lserrFormattingFunctionDisabled;
  335. iobjText = IobjTextFromLsc(&plsc->lsiobjcontext);
  336. plnobjText = PlnobjFromLsc(plsc, iobjText);
  337. lserr = ModifyTextLineEnding(plnobjText, lskeop);
  338. return lserr;
  339. }
  340. /* L S D N D I S T R I B U T E */
  341. /*----------------------------------------------------------------------------
  342. %%Function: LsdnDistribute
  343. %%Contact: igorzv
  344. Parameters:
  345. plsc - (IN) ptr to line services context
  346. plsdnFirst - (IN) first dnode in the range
  347. plsdnFirst - (IN) last dnode in the range
  348. durToDistribute - (IN) amount to distribute between dnodes
  349. ----------------------------------------------------------------------------*/
  350. LSERR WINAPI LsdnDistribute(PLSC plsc, PLSDNODE plsdnFirst,
  351. PLSDNODE plsdnLast, long durToDistribute)
  352. {
  353. GRCHUNKEXT grchunkext;
  354. LSERR lserr;
  355. long durToNonText;
  356. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  357. if (!FIsLSDNODE(plsdnFirst)) return lserrInvalidParameter;
  358. if (!FIsLSDNODE(plsdnLast)) return lserrInvalidParameter;
  359. /* we should be in the stage of formatting or breaking*/
  360. if (!FFormattingAllowed(plsc) && !FBreakingAllowed(plsc))
  361. return lserrFormattingFunctionDisabled;
  362. InitGroupChunkExt(PlschunkcontextFromSubline(plsdnFirst->plssubl),
  363. IobjTextFromLsc(&plsc->lsiobjcontext), &grchunkext);
  364. /* skip first pen dnodes */
  365. while (FIsDnodePen(plsdnFirst) && (plsdnFirst != plsdnLast))
  366. {
  367. plsdnFirst = plsdnFirst->plsdnNext;
  368. if (plsdnFirst == NULL) /* plsdnFirst and plksdnLast are not in the same level */
  369. return lserrInvalidParameter;
  370. }
  371. if (FIsDnodePen(plsdnFirst)) /* only pens are in the list so there is no business for us */
  372. return lserrNone;
  373. while (FIsDnodePen(plsdnLast) && (plsdnLast != plsdnFirst))
  374. {
  375. plsdnLast = plsdnLast->plsdnPrev;
  376. if (plsdnLast == NULL) /* plsdnFirst and plksdnLast are not in the same level */
  377. return lserrInvalidParameter;
  378. }
  379. Assert(!FIsDnodePen(plsdnLast));
  380. lserr = CollectTextGroupChunk(plsdnFirst, plsdnLast->cpFirst + plsdnLast->dcp,
  381. CollectSublinesNone, &grchunkext);
  382. if (lserr != lserrNone)
  383. return lserr;
  384. /* Because of rigid dup it doesn't make sense to change dur of non text objects
  385. We inforce text to distrubute everything among text by setting amount of
  386. non text to 0 */
  387. return DistributeInText(&(grchunkext.lsgrchnk),
  388. LstflowFromSubline(SublineFromDnode(plsdnFirst)),
  389. 0, durToDistribute, &durToNonText);
  390. }
  391. /* L S D N S U B M I T S U B L I N E S */
  392. /*----------------------------------------------------------------------------
  393. %%Function: LsdnSubmitSublines
  394. %%Contact: igorzv
  395. Parameters:
  396. plsc - (IN) ptr to line services context
  397. plsdnode - (IN) dnode
  398. cSubline - (IN) amount of submitted sublines
  399. rgpsubl - (IN) array of submitted sublines
  400. fUseForJustification - (IN) to use for justification
  401. fUseForCompression - (IN) to use for compression
  402. fUseForDisplay - (IN) to use for display
  403. fUseForDecimalTab - (IN) to use for decimal tab
  404. fUseForTrailingArea - (IN) to use for calculating trailing area
  405. ----------------------------------------------------------------------------*/
  406. LSERR WINAPI LsdnSubmitSublines(PLSC plsc, PLSDNODE plsdnode,
  407. DWORD cSubline, PLSSUBL* rgpsubl,
  408. BOOL fUseForJustification, BOOL fUseForCompression,
  409. BOOL fUseForDisplay, BOOL fUseForDecimalTab,
  410. BOOL fUseForTrailingArea)
  411. {
  412. DWORD i;
  413. BOOL fEmpty = fFalse;
  414. BOOL fEmptyWork;
  415. BOOL fTabOrPen = fFalse;
  416. BOOL fNotColinearTflow = fFalse;
  417. BOOL fNotSameTflow = fFalse;
  418. LSERR lserr;
  419. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  420. if (!FIsLSDNODE(plsdnode)) return lserrInvalidParameter;
  421. if (!FIsDnodeReal(plsdnode)) return lserrInvalidParameter;
  422. /* we should be in the stage of formatting or breaking*/
  423. if (!FFormattingAllowed(plsc) && !FBreakingAllowed(plsc)) return lserrFormattingFunctionDisabled;
  424. /* this procedure can be called many times for the same dnode, so
  425. we should dispose memory allocated in previous call */
  426. if (plsdnode->u.real.pinfosubl != NULL)
  427. {
  428. if (plsdnode->u.real.pinfosubl->rgpsubl != NULL)
  429. {
  430. plsc->lscbk.pfnDisposePtr(plsc->pols, plsdnode->u.real.pinfosubl->rgpsubl);
  431. }
  432. plsc->lscbk.pfnDisposePtr(plsc->pols, plsdnode->u.real.pinfosubl);
  433. plsdnode->u.real.pinfosubl = NULL;
  434. }
  435. /* if nothing submitted return right away */
  436. if (cSubline == 0)
  437. return lserrNone;
  438. TurnOnSubmittedSublineEncounted(plsc);
  439. /* calculate some properties of sublines to decide accept or not */
  440. for (i = 0; i < cSubline; i++)
  441. {
  442. if (rgpsubl[i] == NULL) return lserrInvalidParameter;
  443. if (!FIsLSSUBL(rgpsubl[i])) return lserrInvalidParameter;
  444. lserr = FIsSublineEmpty(rgpsubl[i], &fEmptyWork);
  445. if (lserr != lserrNone)
  446. return lserr;
  447. if (fEmptyWork) fEmpty = fTrue;
  448. if (FAreTabsPensInSubline(rgpsubl[i]))
  449. fTabOrPen = fTrue;
  450. if (LstflowFromSubline(SublineFromDnode(plsdnode)) !=
  451. LstflowFromSubline(rgpsubl[i]))
  452. fNotSameTflow = fTrue;
  453. if (!FColinearTflows(LstflowFromSubline(SublineFromDnode(plsdnode)),
  454. LstflowFromSubline(rgpsubl[i])))
  455. fNotColinearTflow = fTrue;
  456. }
  457. plsdnode->u.real.pinfosubl = plsc->lscbk.pfnNewPtr(plsc->pols,
  458. sizeof(*(plsdnode->u.real.pinfosubl)));
  459. if (plsdnode->u.real.pinfosubl == NULL)
  460. return lserrOutOfMemory;
  461. plsdnode->u.real.pinfosubl->cSubline = cSubline;
  462. plsdnode->u.real.pinfosubl->rgpsubl = plsc->lscbk.pfnNewPtr(plsc->pols,
  463. sizeof(PLSSUBL) * cSubline);
  464. if (plsdnode->u.real.pinfosubl->rgpsubl == NULL)
  465. return lserrOutOfMemory;
  466. /* copy array of sublines */
  467. for (i = 0; i < cSubline; i++)
  468. {
  469. plsdnode->u.real.pinfosubl->rgpsubl[i] = rgpsubl[i];
  470. }
  471. /* set flags */
  472. plsdnode->u.real.pinfosubl->fUseForJustification =
  473. fUseForJustification && !fEmpty && !fTabOrPen && !fNotColinearTflow ;
  474. plsdnode->u.real.pinfosubl->fUseForCompression =
  475. fUseForCompression && plsdnode->u.real.pinfosubl->fUseForJustification;
  476. /* if subline is submitted for compression it should also submitted for justification */
  477. plsdnode->u.real.pinfosubl->fUseForTrailingArea =
  478. fUseForTrailingArea && plsdnode->u.real.pinfosubl->fUseForCompression;
  479. /* if subline is submitted for trailing area it should also be submitted for compression
  480. which implies submitting for justification */
  481. plsdnode->u.real.pinfosubl->fUseForDisplay =
  482. fUseForDisplay && !fEmpty && !(plsc->grpfManager & fFmiDrawInCharCodes);
  483. plsdnode->u.real.pinfosubl->fUseForDecimalTab =
  484. fUseForDecimalTab && !fEmpty && !fTabOrPen;
  485. return lserrNone;
  486. }
  487. /* L S D N G E T F O R M A T D E P T H */
  488. /*----------------------------------------------------------------------------
  489. %%Function: LsdnGetFormatDepth
  490. %%Contact: igorzv
  491. Parameters:
  492. plsc - (IN) ptr to line services context
  493. pnDepthFormatLineMax - (OUT) maximum depth of sublines
  494. ----------------------------------------------------------------------------*/
  495. LSERR WINAPI LsdnGetFormatDepth(
  496. PLSC plsc, /* IN: Pointer to LS Context */
  497. DWORD* pnDepthFormatLineMax) /* OUT: nDepthFormatLineMax */
  498. {
  499. if (!FIsLSC(plsc)) return lserrInvalidParameter;
  500. /* we should be in the stage of formatting or breaking*/
  501. if (!FFormattingAllowed(plsc) && !FBreakingAllowed(plsc))
  502. return lserrFormattingFunctionDisabled;
  503. Assert(FWorkWithCurrentLine(plsc));
  504. *pnDepthFormatLineMax = plsc->plslineCur->lslinfo.nDepthFormatLineMax;
  505. return lserrNone;
  506. }