Changeset View
Changeset View
Standalone View
Standalone View
libs/flake/KoShape.cpp
Show First 20 Lines • Show All 1095 Lines • ▼ Show 20 Line(s) | 1095 | if (d->visible) | |||
---|---|---|---|---|---|
1096 | return d->printable; | 1096 | return d->printable; | ||
1097 | else | 1097 | else | ||
1098 | return false; | 1098 | return false; | ||
1099 | } | 1099 | } | ||
1100 | 1100 | | |||
1101 | void KoShape::setSelectable(bool selectable) | 1101 | void KoShape::setSelectable(bool selectable) | ||
1102 | { | 1102 | { | ||
1103 | Q_D(KoShape); | 1103 | Q_D(KoShape); | ||
1104 | #if QT_VERSION >= 0x050700 | ||||
1104 | d->allowedInteractions.setFlag(SelectionAllowed, selectable); | 1105 | d->allowedInteractions.setFlag(SelectionAllowed, selectable); | ||
1106 | #else | ||||
1107 | selectable ? (d->allowedInteractions |= SelectionAllowed) : (d->allowedInteractions &= ~SelectionAllowed); | ||||
1108 | #endif | ||||
1105 | } | 1109 | } | ||
1106 | 1110 | | |||
1107 | bool KoShape::isSelectable() const | 1111 | bool KoShape::isSelectable() const | ||
1108 | { | 1112 | { | ||
1109 | Q_D(const KoShape); | 1113 | Q_D(const KoShape); | ||
1110 | return d->allowedInteractions.testFlag(SelectionAllowed); | 1114 | return d->allowedInteractions.testFlag(SelectionAllowed); | ||
1111 | } | 1115 | } | ||
1112 | 1116 | | |||
1113 | void KoShape::setGeometryProtected(bool on) | 1117 | void KoShape::setGeometryProtected(bool on) | ||
1114 | { | 1118 | { | ||
1115 | Q_D(KoShape); | 1119 | Q_D(KoShape); | ||
1120 | #if QT_VERSION >= 0x050700 | ||||
1116 | d->allowedInteractions.setFlag(MoveAllowed, !on); | 1121 | d->allowedInteractions.setFlag(MoveAllowed, !on); | ||
1117 | d->allowedInteractions.setFlag(ResizeAllowed, !on); | 1122 | d->allowedInteractions.setFlag(ResizeAllowed, !on); | ||
1123 | #else | ||||
1124 | (!on) ? (d->allowedInteractions |= MoveAllowed) : (d->allowedInteractions &= ~MoveAllowed); | ||||
1125 | (!on) ? (d->allowedInteractions |= ResizeAllowed) : (d->allowedInteractions &= ~ResizeAllowed); | ||||
1126 | #endif | ||||
1118 | } | 1127 | } | ||
1119 | 1128 | | |||
1120 | bool KoShape::isGeometryProtected() const | 1129 | bool KoShape::isGeometryProtected() const | ||
1121 | { | 1130 | { | ||
1122 | Q_D(const KoShape); | 1131 | Q_D(const KoShape); | ||
1123 | return !d->allowedInteractions.testFlag(MoveAllowed) || !d->allowedInteractions.testFlag(ResizeAllowed); | 1132 | return !d->allowedInteractions.testFlag(MoveAllowed) || !d->allowedInteractions.testFlag(ResizeAllowed); | ||
1124 | } | 1133 | } | ||
1125 | 1134 | | |||
1126 | void KoShape::setContentProtected(bool protect) | 1135 | void KoShape::setContentProtected(bool protect) | ||
1127 | { | 1136 | { | ||
1128 | Q_D(KoShape); | 1137 | Q_D(KoShape); | ||
1138 | #if QT_VERSION >= 0x050700 | ||||
1129 | d->allowedInteractions.setFlag(ContentChangeAllowed, !protect); | 1139 | d->allowedInteractions.setFlag(ContentChangeAllowed, !protect); | ||
1140 | #else | ||||
1141 | (!protect) ? (d->allowedInteractions |= ContentChangeAllowed) : (d->allowedInteractions &= ~ContentChangeAllowed); | ||||
1142 | #endif | ||||
1130 | } | 1143 | } | ||
1131 | 1144 | | |||
1132 | bool KoShape::isContentProtected() const | 1145 | bool KoShape::isContentProtected() const | ||
1133 | { | 1146 | { | ||
1134 | Q_D(const KoShape); | 1147 | Q_D(const KoShape); | ||
1135 | return !d->allowedInteractions.testFlag(ContentChangeAllowed); | 1148 | return !d->allowedInteractions.testFlag(ContentChangeAllowed); | ||
1136 | } | 1149 | } | ||
1137 | 1150 | | |||
1138 | void KoShape::setDeletable(bool deletable) | 1151 | void KoShape::setDeletable(bool deletable) | ||
1139 | { | 1152 | { | ||
1140 | Q_D(KoShape); | 1153 | Q_D(KoShape); | ||
1154 | #if QT_VERSION >= 0x050700 | ||||
1141 | d->allowedInteractions.setFlag(DeletionAllowed, deletable); | 1155 | d->allowedInteractions.setFlag(DeletionAllowed, deletable); | ||
1156 | #else | ||||
1157 | deletable ? (d->allowedInteractions |= DeletionAllowed) : (d->allowedInteractions &= ~DeletionAllowed); | ||||
1158 | #endif | ||||
1142 | } | 1159 | } | ||
1143 | 1160 | | |||
1144 | bool KoShape::isDeletable() const | 1161 | bool KoShape::isDeletable() const | ||
1145 | { | 1162 | { | ||
1146 | Q_D(const KoShape); | 1163 | Q_D(const KoShape); | ||
1147 | return d->allowedInteractions.testFlag(DeletionAllowed); | 1164 | return d->allowedInteractions.testFlag(DeletionAllowed); | ||
1148 | } | 1165 | } | ||
1149 | 1166 | | |||
1150 | void KoShape::setAllowedInteraction(KoShape::AllowedInteraction flag, bool value) | 1167 | void KoShape::setAllowedInteraction(KoShape::AllowedInteraction flag, bool value) | ||
1151 | { | 1168 | { | ||
1152 | Q_D(KoShape); | 1169 | Q_D(KoShape); | ||
1170 | #if QT_VERSION >= 0x050700 | ||||
1153 | d->allowedInteractions.setFlag(flag, value); | 1171 | d->allowedInteractions.setFlag(flag, value); | ||
1172 | #else | ||||
1173 | value ? (d->allowedInteractions |= flag) : (d->allowedInteractions &= ~flag); | ||||
1174 | #endif | ||||
1154 | } | 1175 | } | ||
1155 | 1176 | | |||
1156 | bool KoShape::allowedInteraction(KoShape::AllowedInteraction flag, bool recursive) const | 1177 | bool KoShape::allowedInteraction(KoShape::AllowedInteraction flag, bool recursive) const | ||
1157 | { | 1178 | { | ||
1158 | return allowedInteractions(recursive).testFlag(flag); | 1179 | return allowedInteractions(recursive).testFlag(flag); | ||
1159 | } | 1180 | } | ||
1160 | 1181 | | |||
1161 | void KoShape::setAllowedInteractions(KoShape::AllowedInteractions interactions) | 1182 | void KoShape::setAllowedInteractions(KoShape::AllowedInteractions interactions) | ||
▲ Show 20 Lines • Show All 327 Lines • ▼ Show 20 Line(s) | 1508 | if (d->shadow && !d->shadow->deref()) { | |||
1489 | d->shadow = 0; | 1510 | d->shadow = 0; | ||
1490 | } | 1511 | } | ||
1491 | setBackground(loadOdfFill(context)); | 1512 | setBackground(loadOdfFill(context)); | ||
1492 | setStroke(loadOdfStroke(element, context)); | 1513 | setStroke(loadOdfStroke(element, context)); | ||
1493 | setShadow(d->loadOdfShadow(context)); | 1514 | setShadow(d->loadOdfShadow(context)); | ||
1494 | setBorder(d->loadOdfBorder(context)); | 1515 | setBorder(d->loadOdfBorder(context)); | ||
1495 | 1516 | | |||
1496 | QString protect(styleStack.property(KoXmlNS::style, "protect")); | 1517 | QString protect(styleStack.property(KoXmlNS::style, "protect")); | ||
1518 | #if QT_VERSION >= 0x050700 | ||||
1497 | d->allowedInteractions.setFlag(MoveAllowed, !protect.contains("position")); | 1519 | d->allowedInteractions.setFlag(MoveAllowed, !protect.contains("position")); | ||
1498 | d->allowedInteractions.setFlag(ResizeAllowed, !protect.contains("size")); | 1520 | d->allowedInteractions.setFlag(ResizeAllowed, !protect.contains("size")); | ||
1521 | #else | ||||
1522 | (!protect.contains("position")) ? (d->allowedInteractions |= MoveAllowed) : (d->allowedInteractions &= ~MoveAllowed); | ||||
1523 | (!protect.contains("size")) ? (d->allowedInteractions |= ResizeAllowed) : (d->allowedInteractions &= ~ResizeAllowed); | ||||
1524 | #endif | ||||
1499 | setContentProtected(protect.contains("content")); | 1525 | setContentProtected(protect.contains("content")); | ||
1500 | 1526 | | |||
1501 | QString margin = styleStack.property(KoXmlNS::fo, "margin"); | 1527 | QString margin = styleStack.property(KoXmlNS::fo, "margin"); | ||
1502 | if (!margin.isEmpty()) { | 1528 | if (!margin.isEmpty()) { | ||
1503 | setTextRunAroundDistanceLeft(KoUnit::parseValue(margin)); | 1529 | setTextRunAroundDistanceLeft(KoUnit::parseValue(margin)); | ||
1504 | setTextRunAroundDistanceTop(KoUnit::parseValue(margin)); | 1530 | setTextRunAroundDistanceTop(KoUnit::parseValue(margin)); | ||
1505 | setTextRunAroundDistanceRight(KoUnit::parseValue(margin)); | 1531 | setTextRunAroundDistanceRight(KoUnit::parseValue(margin)); | ||
1506 | setTextRunAroundDistanceBottom(KoUnit::parseValue(margin)); | 1532 | setTextRunAroundDistanceBottom(KoUnit::parseValue(margin)); | ||
▲ Show 20 Lines • Show All 893 Lines • Show Last 20 Lines |