Differential D14589 Diff 39128 plugins/flake/textshape/kotext/opendocument/KoTextSharedLoadingData.cpp
Changeset View
Changeset View
Standalone View
Standalone View
plugins/flake/textshape/kotext/opendocument/KoTextSharedLoadingData.cpp
Show First 20 Lines • Show All 240 Lines • ▼ Show 20 Line(s) | 226 | Q_FOREACH (KoXmlElement *styleElem, styleElements) { | |||
---|---|---|---|---|---|
241 | d->namedParagraphStyles.insert(name, parastyle); | 241 | d->namedParagraphStyles.insert(name, parastyle); | ||
242 | 242 | | |||
243 | if (styleElem->hasAttributeNS(KoXmlNS::style, "next-style-name")) | 243 | if (styleElem->hasAttributeNS(KoXmlNS::style, "next-style-name")) | ||
244 | nextStyles.insert(parastyle, styleElem->attributeNS(KoXmlNS::style, "next-style-name")); | 244 | nextStyles.insert(parastyle, styleElem->attributeNS(KoXmlNS::style, "next-style-name")); | ||
245 | if (styleElem->hasAttributeNS(KoXmlNS::style, "parent-style-name")) | 245 | if (styleElem->hasAttributeNS(KoXmlNS::style, "parent-style-name")) | ||
246 | parentStyles.insert(parastyle, styleElem->attributeNS(KoXmlNS::style, "parent-style-name")); | 246 | parentStyles.insert(parastyle, styleElem->attributeNS(KoXmlNS::style, "parent-style-name")); | ||
247 | 247 | | |||
248 | // TODO check if it a know style set the styleid so that the custom styles are kept during copy and paste | 248 | // TODO check if it a know style set the styleid so that the custom styles are kept during copy and paste | ||
249 | // in case styles are not added to the style manager they have to be deleted after loading to avoid leaking memeory | 249 | // in case styles are not added to the style manager they have to be deleted after loading to avoid leaking memory | ||
250 | if (styleManager) { | 250 | if (styleManager) { | ||
251 | styleManager->add(parastyle); | 251 | styleManager->add(parastyle); | ||
252 | } else { | 252 | } else { | ||
253 | d->paragraphStylesToDelete.append(parastyle); | 253 | d->paragraphStylesToDelete.append(parastyle); | ||
254 | } | 254 | } | ||
255 | 255 | | |||
256 | parastyle->setDefaultStyle(d->defaultParagraphStyle); | 256 | parastyle->setDefaultStyle(d->defaultParagraphStyle); | ||
257 | } | 257 | } | ||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 378 | { | |||
382 | for (; it != tableStyles.end(); ++it) { | 382 | for (; it != tableStyles.end(); ++it) { | ||
383 | if (styleTypes & ContentDotXml) { | 383 | if (styleTypes & ContentDotXml) { | ||
384 | d->tableContentDotXmlStyles.insert(it->first, it->second); | 384 | d->tableContentDotXmlStyles.insert(it->first, it->second); | ||
385 | } | 385 | } | ||
386 | if (styleTypes & StylesDotXml) { | 386 | if (styleTypes & StylesDotXml) { | ||
387 | d->tableStylesDotXmlStyles.insert(it->first, it->second); | 387 | d->tableStylesDotXmlStyles.insert(it->first, it->second); | ||
388 | } | 388 | } | ||
389 | // TODO check if it a know style set the styleid so that the custom styles are kept during copy and paste | 389 | // TODO check if it a know style set the styleid so that the custom styles are kept during copy and paste | ||
390 | // in case styles are not added to the style manager they have to be deleted after loading to avoid leaking memeory | 390 | // in case styles are not added to the style manager they have to be deleted after loading to avoid leaking memory | ||
391 | if (styleManager) { | 391 | if (styleManager) { | ||
392 | styleManager->add(it->second); | 392 | styleManager->add(it->second); | ||
393 | } else { | 393 | } else { | ||
394 | d->tableStylesToDelete.append(it->second); | 394 | d->tableStylesToDelete.append(it->second); | ||
395 | } | 395 | } | ||
396 | } | 396 | } | ||
397 | } | 397 | } | ||
398 | 398 | | |||
Show All 23 Lines | 418 | { | |||
422 | for (; it != tableColumnStyles.end(); ++it) { | 422 | for (; it != tableColumnStyles.end(); ++it) { | ||
423 | if (styleTypes & ContentDotXml) { | 423 | if (styleTypes & ContentDotXml) { | ||
424 | d->tableColumnContentDotXmlStyles.insert(it->first, it->second); | 424 | d->tableColumnContentDotXmlStyles.insert(it->first, it->second); | ||
425 | } | 425 | } | ||
426 | if (styleTypes & StylesDotXml) { | 426 | if (styleTypes & StylesDotXml) { | ||
427 | d->tableColumnStylesDotXmlStyles.insert(it->first, it->second); | 427 | d->tableColumnStylesDotXmlStyles.insert(it->first, it->second); | ||
428 | } | 428 | } | ||
429 | // TODO check if it a know style set the styleid so that the custom styles are kept during copy and paste | 429 | // TODO check if it a know style set the styleid so that the custom styles are kept during copy and paste | ||
430 | // in case styles are not added to the style manager they have to be deleted after loading to avoid leaking memeory | 430 | // in case styles are not added to the style manager they have to be deleted after loading to avoid leaking memory | ||
431 | if (styleManager) { | 431 | if (styleManager) { | ||
432 | styleManager->add(it->second); | 432 | styleManager->add(it->second); | ||
433 | } else { | 433 | } else { | ||
434 | d->tableColumnStylesToDelete.append(it->second); | 434 | d->tableColumnStylesToDelete.append(it->second); | ||
435 | } | 435 | } | ||
436 | } | 436 | } | ||
437 | } | 437 | } | ||
438 | 438 | | |||
Show All 23 Lines | 458 | { | |||
462 | for (; it != tableRowStyles.end(); ++it) { | 462 | for (; it != tableRowStyles.end(); ++it) { | ||
463 | if (styleTypes & ContentDotXml) { | 463 | if (styleTypes & ContentDotXml) { | ||
464 | d->tableRowContentDotXmlStyles.insert(it->first, it->second); | 464 | d->tableRowContentDotXmlStyles.insert(it->first, it->second); | ||
465 | } | 465 | } | ||
466 | if (styleTypes & StylesDotXml) { | 466 | if (styleTypes & StylesDotXml) { | ||
467 | d->tableRowStylesDotXmlStyles.insert(it->first, it->second); | 467 | d->tableRowStylesDotXmlStyles.insert(it->first, it->second); | ||
468 | } | 468 | } | ||
469 | // TODO check if it a know style set the styleid so that the custom styles are kept during copy and paste | 469 | // TODO check if it a know style set the styleid so that the custom styles are kept during copy and paste | ||
470 | // in case styles are not added to the style manager they have to be deleted after loading to avoid leaking memeory | 470 | // in case styles are not added to the style manager they have to be deleted after loading to avoid leaking memory | ||
471 | if (styleManager) { | 471 | if (styleManager) { | ||
472 | styleManager->add(it->second); | 472 | styleManager->add(it->second); | ||
473 | } else { | 473 | } else { | ||
474 | d->tableRowStylesToDelete.append(it->second); | 474 | d->tableRowStylesToDelete.append(it->second); | ||
475 | } | 475 | } | ||
476 | } | 476 | } | ||
477 | } | 477 | } | ||
478 | 478 | | |||
Show All 23 Lines | 498 | { | |||
502 | for (; it != tableCellStyles.end(); ++it) { | 502 | for (; it != tableCellStyles.end(); ++it) { | ||
503 | if (styleTypes & ContentDotXml) { | 503 | if (styleTypes & ContentDotXml) { | ||
504 | d->tableCellContentDotXmlStyles.insert(it->first, it->second); | 504 | d->tableCellContentDotXmlStyles.insert(it->first, it->second); | ||
505 | } | 505 | } | ||
506 | if (styleTypes & StylesDotXml) { | 506 | if (styleTypes & StylesDotXml) { | ||
507 | d->tableCellStylesDotXmlStyles.insert(it->first, it->second); | 507 | d->tableCellStylesDotXmlStyles.insert(it->first, it->second); | ||
508 | } | 508 | } | ||
509 | // TODO check if it a know style set the styleid so that the custom styles are kept during copy and paste | 509 | // TODO check if it a know style set the styleid so that the custom styles are kept during copy and paste | ||
510 | // in case styles are not added to the style manager they have to be deleted after loading to avoid leaking memeory | 510 | // in case styles are not added to the style manager they have to be deleted after loading to avoid leaking memory | ||
511 | if (styleManager) { | 511 | if (styleManager) { | ||
512 | styleManager->add(it->second); | 512 | styleManager->add(it->second); | ||
513 | } else { | 513 | } else { | ||
514 | d->tableCellStylesToDelete.append(it->second); | 514 | d->tableCellStylesToDelete.append(it->second); | ||
515 | } | 515 | } | ||
516 | } | 516 | } | ||
517 | } | 517 | } | ||
518 | 518 | | |||
Show All 23 Lines | 538 | { | |||
542 | for (; it != sectionStyles.end(); ++it) { | 542 | for (; it != sectionStyles.end(); ++it) { | ||
543 | if (styleTypes & ContentDotXml) { | 543 | if (styleTypes & ContentDotXml) { | ||
544 | d->sectionContentDotXmlStyles.insert(it->first, it->second); | 544 | d->sectionContentDotXmlStyles.insert(it->first, it->second); | ||
545 | } | 545 | } | ||
546 | if (styleTypes & StylesDotXml) { | 546 | if (styleTypes & StylesDotXml) { | ||
547 | d->sectionStylesDotXmlStyles.insert(it->first, it->second); | 547 | d->sectionStylesDotXmlStyles.insert(it->first, it->second); | ||
548 | } | 548 | } | ||
549 | // TODO check if it a know style set the styleid so that the custom styles are kept during copy and paste | 549 | // TODO check if it a know style set the styleid so that the custom styles are kept during copy and paste | ||
550 | // in case styles are not added to the style manager they have to be deleted after loading to avoid leaking memeory | 550 | // in case styles are not added to the style manager they have to be deleted after loading to avoid leaking memory | ||
551 | if (styleManager) { | 551 | if (styleManager) { | ||
552 | styleManager->add(it->second); | 552 | styleManager->add(it->second); | ||
553 | } else { | 553 | } else { | ||
554 | d->sectionStylesToDelete.append(it->second); | 554 | d->sectionStylesToDelete.append(it->second); | ||
555 | } | 555 | } | ||
556 | } | 556 | } | ||
557 | } | 557 | } | ||
558 | 558 | | |||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Line(s) | |||||
682 | void KoTextSharedLoadingData::addTableTemplate(KoShapeLoadingContext &context, KoStyleManager *styleManager) | 682 | void KoTextSharedLoadingData::addTableTemplate(KoShapeLoadingContext &context, KoStyleManager *styleManager) | ||
683 | { | 683 | { | ||
684 | QList<QPair<QString, KoTextTableTemplate *> > tableTemplates(loadTableTemplates(context)); | 684 | QList<QPair<QString, KoTextTableTemplate *> > tableTemplates(loadTableTemplates(context)); | ||
685 | 685 | | |||
686 | QList<QPair<QString, KoTextTableTemplate *> >::iterator it(tableTemplates.begin()); | 686 | QList<QPair<QString, KoTextTableTemplate *> >::iterator it(tableTemplates.begin()); | ||
687 | for (; it != tableTemplates.end(); ++it) { | 687 | for (; it != tableTemplates.end(); ++it) { | ||
688 | d->tableTemplates.insert(it->first, it->second); | 688 | d->tableTemplates.insert(it->first, it->second); | ||
689 | 689 | | |||
690 | // in case templates are not added to the style manager they have to be deleted after loading to avoid leaking memeory | 690 | // in case templates are not added to the style manager they have to be deleted after loading to avoid leaking memory | ||
691 | if (styleManager) { | 691 | if (styleManager) { | ||
692 | styleManager->add(it->second); | 692 | styleManager->add(it->second); | ||
693 | } else { | 693 | } else { | ||
694 | d->tableTemplatesToDelete.append(it->second); | 694 | d->tableTemplatesToDelete.append(it->second); | ||
695 | } | 695 | } | ||
696 | } | 696 | } | ||
697 | } | 697 | } | ||
698 | 698 | | |||
Show All 14 Lines |