Warning, file /kdevelop/kdevelop/plugins/astyle/astyle_formatter.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2008 Cédric Pasteur <cedric.pasteur@free.fr> 0003 SPDX-FileCopyrightText: 2001 Matthias Hölzer-Klüpfel <mhk@caldera.de> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #include "astyle_formatter.h" 0009 0010 #include <QString> 0011 0012 #include <interfaces/isourceformatter.h> 0013 #include <util/formattinghelpers.h> 0014 0015 #include "astyle_stringiterator.h" 0016 #include "debug.h" 0017 0018 using namespace KDevelop; 0019 0020 namespace AStyleOptionKey { 0021 QString forceTabs() 0022 { 0023 return QStringLiteral("FillForce"); 0024 } 0025 0026 QString tabSpaceConversion() 0027 { 0028 // The meaning of the "FillForce" key depends on whether tab or space indentation is used: 0029 // * for tabs: the forceTabs argument to ASBeautifier::setTabIndentation(); 0030 // * for spaces: the state argument to ASFormatter::setTabSpaceConversionMode(). 0031 return forceTabs(); 0032 } 0033 0034 QString fillEmptyLines() 0035 { 0036 return QStringLiteral("FillEmptyLines"); 0037 } 0038 0039 QString bracesAdd() 0040 { 0041 return QStringLiteral("BracesAdd"); 0042 } 0043 } 0044 0045 AStyleFormatter::AStyleFormatter() 0046 { 0047 } 0048 0049 QString AStyleFormatter::formatSource(const QString &text, const QString& leftContext, const QString& rightContext) 0050 { 0051 QString useText = leftContext + text + rightContext; 0052 0053 AStyleStringIterator is(useText); 0054 QString output; 0055 QTextStream os(&output, QIODevice::WriteOnly); 0056 0057 m_engine.init(&is); 0058 0059 while (m_engine.hasMoreLines()) 0060 os << QString::fromUtf8(m_engine.nextLine().c_str()) << QLatin1Char('\n'); 0061 0062 m_engine.init(nullptr); 0063 0064 return extractFormattedTextFromContext(output, text, leftContext, rightContext, m_options[QStringLiteral("FillCount")].toInt()); 0065 } 0066 0067 void AStyleFormatter::updateFormatter() 0068 { 0069 qCDebug(KDEV_ASTYLE) << "Updating option with: " << ISourceFormatter::optionMapToString(m_options); 0070 // fill 0071 int wsCount = m_options[QStringLiteral("FillCount")].toInt(); 0072 if(m_options[QStringLiteral("Fill")].toString() == QLatin1String("Tabs")) { 0073 const bool forceTabs = m_options[AStyleOptionKey::forceTabs()].toBool(); 0074 AStyleFormatter::setTabIndentation(wsCount, forceTabs); 0075 } else { 0076 const bool tabSpaceConversion = m_options[AStyleOptionKey::tabSpaceConversion()].toBool(); 0077 AStyleFormatter::setSpaceIndentationAndTabSpaceConversion(wsCount, tabSpaceConversion); 0078 } 0079 0080 AStyleFormatter::setEmptyLineFill(m_options[AStyleOptionKey::fillEmptyLines()].toBool()); 0081 0082 // indent 0083 AStyleFormatter::setSwitchIndent(m_options[QStringLiteral("IndentSwitches")].toBool()); 0084 AStyleFormatter::setClassIndent(m_options[QStringLiteral("IndentClasses")].toBool()); 0085 AStyleFormatter::setCaseIndent(m_options[QStringLiteral("IndentCases")].toBool()); 0086 AStyleFormatter::setBracketIndent(m_options[QStringLiteral("IndentBrackets")].toBool()); 0087 AStyleFormatter::setNamespaceIndent(m_options[QStringLiteral("IndentNamespaces")].toBool()); 0088 AStyleFormatter::setLabelIndent(m_options[QStringLiteral("IndentLabels")].toBool()); 0089 AStyleFormatter::setBlockIndent(m_options[QStringLiteral("IndentBlocks")].toBool()); 0090 AStyleFormatter::setPreprocessorIndent(m_options[QStringLiteral("IndentPreprocessors")].toBool()); 0091 AStyleFormatter::setAfterParens(m_options[QStringLiteral("AfterParens")].toBool()); 0092 AStyleFormatter::setContinuation(m_options[QStringLiteral("Continuation")].toInt()); 0093 0094 // continuation 0095 AStyleFormatter::setMaxInStatementIndentLength(m_options[QStringLiteral("MaxStatement")].toInt()); 0096 if(m_options[QStringLiteral("MinConditional")].toInt() != -1) 0097 AStyleFormatter::setMinConditionalIndentLength(m_options[QStringLiteral("MinConditional")].toInt()); 0098 0099 // brackets 0100 QString s = m_options[QStringLiteral("Brackets")].toString(); 0101 if(s == QLatin1String("Break")) 0102 AStyleFormatter::setBracketFormatMode(astyle::BREAK_MODE); 0103 else if(s == QLatin1String("Attach")) 0104 AStyleFormatter::setBracketFormatMode(astyle::ATTACH_MODE); 0105 else if(s == QLatin1String("Linux")) 0106 AStyleFormatter::setBracketFormatMode(astyle::LINUX_MODE); 0107 else if(s == QLatin1String("Stroustrup")) 0108 // In astyle 2.06 BracketMode STROUSTRUP_MODE was removed and LINUX_MODE is the replacement 0109 AStyleFormatter::setBracketFormatMode(astyle::LINUX_MODE); 0110 else if(s == QLatin1String("Horstmann") || s == QLatin1String("RunInMode")) 0111 AStyleFormatter::setBracketFormatMode(astyle::RUN_IN_MODE); 0112 else 0113 AStyleFormatter::setBracketFormatMode(astyle::NONE_MODE); 0114 0115 AStyleFormatter::setBreakClosingHeaderBracketsMode(m_options[QStringLiteral("BracketsCloseHeaders")].toBool()); 0116 AStyleFormatter::setAddBracesMode(m_options[AStyleOptionKey::bracesAdd()].toBool()); 0117 0118 // blocks 0119 AStyleFormatter::setBreakBlocksMode(m_options[QStringLiteral("BlockBreak")].toBool()); 0120 AStyleFormatter::setBreakClosingHeaderBlocksMode(m_options[QStringLiteral("BlockBreakAll")].toBool()); 0121 AStyleFormatter::setBreakElseIfsMode(m_options[QStringLiteral("BlockIfElse")].toBool()); 0122 0123 // padding 0124 AStyleFormatter::setOperatorPaddingMode(m_options[QStringLiteral("PadOperators")].toBool()); 0125 AStyleFormatter::setParensInsidePaddingMode(m_options[QStringLiteral("PadParenthesesIn")].toBool()); 0126 AStyleFormatter::setParensOutsidePaddingMode(m_options[QStringLiteral("PadParenthesesOut")].toBool()); 0127 AStyleFormatter::setParensHeaderPaddingMode(m_options[QStringLiteral("PadParenthesesHeader")].toBool()); 0128 AStyleFormatter::setParensUnPaddingMode(m_options[QStringLiteral("PadParenthesesUn")].toBool()); 0129 0130 // oneliner 0131 AStyleFormatter::setBreakOneLineBlocksMode(!m_options[QStringLiteral("KeepBlocks")].toBool()); 0132 AStyleFormatter::setBreakOneLineStatementsMode(!m_options[QStringLiteral("KeepStatements")].toBool()); 0133 0134 // pointer 0135 s = m_options[QStringLiteral("PointerAlign")].toString(); 0136 if(s == QLatin1String("Name")) 0137 AStyleFormatter::setPointerAlignment(astyle::PTR_ALIGN_NAME); 0138 else if(s == QLatin1String("Middle")) 0139 AStyleFormatter::setPointerAlignment(astyle::PTR_ALIGN_MIDDLE); 0140 else if(s == QLatin1String("Type")) 0141 AStyleFormatter::setPointerAlignment(astyle::PTR_ALIGN_TYPE); 0142 else 0143 AStyleFormatter::setPointerAlignment(astyle::PTR_ALIGN_NONE); 0144 } 0145 0146 void AStyleFormatter::resetStyle() 0147 { 0148 // fill 0149 setSpaceIndentationAndTabSpaceConversion(4, false); 0150 setEmptyLineFill(false); 0151 // brackets 0152 setBracketFormatMode(astyle::NONE_MODE); 0153 setBreakClosingHeaderBracketsMode(false); 0154 setAddBracesMode(false); 0155 // oneliner 0156 setBreakOneLineBlocksMode(true); 0157 setBreakOneLineStatementsMode(true); 0158 // blocks 0159 setBreakBlocksMode(false); 0160 setBreakClosingHeaderBlocksMode(false); 0161 setBreakElseIfsMode(false); 0162 // continuation 0163 setMaxInStatementIndentLength(40); 0164 setMinConditionalIndentLength(-1); 0165 // indent 0166 setSwitchIndent(true); 0167 setClassIndent(true); 0168 setCaseIndent(false); 0169 setBracketIndent(false); 0170 setNamespaceIndent(true); 0171 setLabelIndent(true); 0172 setBlockIndent(false); 0173 setPreprocessorIndent(false); 0174 setAfterParens(false); 0175 setContinuation(1); 0176 // padding 0177 setOperatorPaddingMode(false); 0178 setParensInsidePaddingMode(true); 0179 setParensOutsidePaddingMode(true); 0180 setParensHeaderPaddingMode(true); 0181 setParensUnPaddingMode(true); 0182 // pointer 0183 setPointerAlignment(astyle::PTR_ALIGN_NONE); 0184 } 0185 0186 bool AStyleFormatter::predefinedStyle( const QString & style ) 0187 { 0188 if(style == QLatin1String("ANSI")) { 0189 resetStyle(); 0190 setBracketIndent(false); 0191 setSpaceIndentationNoConversion(4); 0192 setBracketFormatMode(astyle::BREAK_MODE); 0193 setClassIndent(false); 0194 setSwitchIndent(false); 0195 setNamespaceIndent(false); 0196 return true; 0197 } else if(style == QLatin1String("K&R")) { 0198 resetStyle(); 0199 setBracketIndent(false); 0200 setSpaceIndentationNoConversion(4); 0201 setBracketFormatMode(astyle::ATTACH_MODE); 0202 setClassIndent(false); 0203 setSwitchIndent(false); 0204 setNamespaceIndent(false); 0205 return true; 0206 } else if(style == QLatin1String("Linux")) { 0207 resetStyle(); 0208 setBracketIndent(false); 0209 setSpaceIndentationNoConversion(8); 0210 setBracketFormatMode(astyle::LINUX_MODE); 0211 setClassIndent(false); 0212 setSwitchIndent(false); 0213 setNamespaceIndent(false); 0214 return true; 0215 } else if(style == QLatin1String("GNU")) { 0216 resetStyle(); 0217 setBlockIndent(true); 0218 setSpaceIndentationNoConversion(2); 0219 setBracketFormatMode(astyle::BREAK_MODE); 0220 setClassIndent(false); 0221 setSwitchIndent(false); 0222 setNamespaceIndent(false); 0223 return true; 0224 } else if(style == QLatin1String("Java")) { 0225 resetStyle(); 0226 setBracketIndent(false); 0227 setSpaceIndentationNoConversion(4); 0228 setBracketFormatMode(astyle::ATTACH_MODE); 0229 setSwitchIndent(false); 0230 return true; 0231 } else if (style == QLatin1String("Stroustrup")) { 0232 resetStyle(); 0233 setBracketFormatMode(astyle::LINUX_MODE); 0234 setBlockIndent(false); 0235 setBracketIndent(false); 0236 setSpaceIndentationNoConversion(5); 0237 setClassIndent(false); 0238 setSwitchIndent(false); 0239 setNamespaceIndent(false); 0240 return true; 0241 } else if (style == QLatin1String("Horstmann")) { 0242 resetStyle(); 0243 setBracketFormatMode(astyle::RUN_IN_MODE); 0244 setBlockIndent(false); 0245 setBracketIndent(false); 0246 setSwitchIndent(true); 0247 setSpaceIndentationNoConversion(3); 0248 setClassIndent(false); 0249 setNamespaceIndent(false); 0250 return true; 0251 } else if (style == QLatin1String("Whitesmith")) { 0252 resetStyle(); 0253 setSpaceIndentationNoConversion(4); 0254 setBracketFormatMode(astyle::BREAK_MODE); 0255 setBlockIndent(false); 0256 setBracketIndent(true); 0257 setClassIndent(true); 0258 setSwitchIndent(true); 0259 setNamespaceIndent(false); 0260 return true; 0261 } else if (style == QLatin1String("Banner")) { 0262 resetStyle(); 0263 setSpaceIndentationNoConversion(4); 0264 setBracketFormatMode(astyle::ATTACH_MODE); 0265 setBlockIndent(false); 0266 setBracketIndent(true); 0267 setClassIndent(true); 0268 setSwitchIndent(true); 0269 setNamespaceIndent(false); 0270 return true; 0271 } else if (style == QLatin1String("1TBS")) { 0272 resetStyle(); 0273 setSpaceIndentationNoConversion(4); 0274 setBracketFormatMode(astyle::LINUX_MODE); 0275 setAddBracesMode(true); 0276 setBlockIndent(false); 0277 setBracketIndent(false); 0278 setClassIndent(false); 0279 setSwitchIndent(false); 0280 setNamespaceIndent(false); 0281 return true; 0282 } else if (style == QLatin1String("KDELibs")) { 0283 // https://community.kde.org/Policies/Frameworks_Coding_Style 0284 resetStyle(); 0285 setSpaceIndentationAndTabSpaceConversion(4, true); 0286 setBracketFormatMode(astyle::LINUX_MODE); 0287 setPointerAlignment(astyle::PTR_ALIGN_NAME); 0288 setLabelIndent(true); 0289 setOperatorPaddingMode(true); 0290 setParensInsidePaddingMode(false); 0291 setParensOutsidePaddingMode(false); 0292 setParensHeaderPaddingMode(true); 0293 setParensUnPaddingMode(true); 0294 setBreakOneLineStatementsMode(false); 0295 setPreprocessorIndent(true); 0296 setSwitchIndent(false); 0297 setClassIndent(false); 0298 setNamespaceIndent(false); 0299 return true; 0300 } else if (style == QLatin1String("Qt")) { 0301 // https://wiki.qt.io/Qt_Coding_Style 0302 resetStyle(); 0303 setSpaceIndentationNoConversion(4); 0304 setPointerAlignment(astyle::PTR_ALIGN_NAME); 0305 setOperatorPaddingMode(true); 0306 setBracketFormatMode(astyle::LINUX_MODE); 0307 setSwitchIndent(false); 0308 setParensInsidePaddingMode(false); 0309 setParensOutsidePaddingMode(false); 0310 setParensHeaderPaddingMode(true); 0311 setParensUnPaddingMode(true); 0312 setClassIndent(false); 0313 setNamespaceIndent(false); 0314 return true; 0315 } 0316 0317 return false; 0318 } 0319 0320 QVariant AStyleFormatter::option(const QString &key) const 0321 { 0322 if(!m_options.contains(key)) 0323 qCDebug(KDEV_ASTYLE) << "Missing option name " << key; 0324 return m_options[key]; 0325 } 0326 0327 void AStyleFormatter::loadStyle(const QString &content) 0328 { 0329 m_options = ISourceFormatter::stringToOptionMap(content); 0330 updateFormatter(); 0331 } 0332 0333 QString AStyleFormatter::saveStyle() const 0334 { 0335 return ISourceFormatter::optionMapToString(m_options); 0336 } 0337 0338 void AStyleFormatter::setCStyle() 0339 { 0340 m_engine.setCStyle(); 0341 } 0342 void AStyleFormatter::setJavaStyle() 0343 { 0344 m_engine.setJavaStyle(); 0345 } 0346 void AStyleFormatter::setSharpStyle() 0347 { 0348 m_engine.setSharpStyle(); 0349 } 0350 0351 void AStyleFormatter::setTabIndentation(int length, bool forceTabs) 0352 { 0353 m_engine.setTabIndentation(length, forceTabs); 0354 m_options[QStringLiteral("Fill")] = QStringLiteral("Tabs"); 0355 m_options[QStringLiteral("FillCount")] = length; 0356 m_options[AStyleOptionKey::forceTabs()] = forceTabs; 0357 0358 m_engine.setTabSpaceConversionMode(false); 0359 } 0360 0361 void AStyleFormatter::setSpaceIndentationAndTabSpaceConversion(int length, bool tabSpaceConversion) 0362 { 0363 // set ASBeautifier::shouldForceTabIndentation to false 0364 m_engine.setTabIndentation(length, false); 0365 0366 m_engine.setSpaceIndentation(length); 0367 m_options[QStringLiteral("Fill")] = QStringLiteral("Spaces"); 0368 m_options[QStringLiteral("FillCount")] = length; 0369 0370 m_options[AStyleOptionKey::tabSpaceConversion()] = tabSpaceConversion; 0371 m_engine.setTabSpaceConversionMode(tabSpaceConversion); 0372 } 0373 0374 void AStyleFormatter::setSpaceIndentationNoConversion(int length) 0375 { 0376 setSpaceIndentationAndTabSpaceConversion(length, false); 0377 } 0378 0379 void AStyleFormatter::setEmptyLineFill(bool on) 0380 { 0381 m_options[AStyleOptionKey::fillEmptyLines()] = on; 0382 m_engine.setEmptyLineFill(on); 0383 } 0384 0385 void AStyleFormatter::setBlockIndent(bool on) 0386 { 0387 m_options[QStringLiteral("IndentBlocks")] = on; 0388 m_engine.setBlockIndent(on); 0389 } 0390 0391 void AStyleFormatter::setBracketIndent(bool on) 0392 { 0393 m_options[QStringLiteral("IndentBrackets")] = on; 0394 m_engine.setBraceIndent(on); 0395 } 0396 0397 void AStyleFormatter::setCaseIndent(bool on) 0398 { 0399 m_options[QStringLiteral("IndentCases")] = on; 0400 m_engine.setCaseIndent(on); 0401 } 0402 0403 void AStyleFormatter::setClassIndent(bool on) 0404 { 0405 m_options[QStringLiteral("IndentClasses")] = on; 0406 m_engine.setClassIndent(on); 0407 } 0408 0409 void AStyleFormatter::setLabelIndent(bool on) 0410 { 0411 m_options[QStringLiteral("IndentLabels")] = on; 0412 m_engine.setLabelIndent(on); 0413 } 0414 0415 void AStyleFormatter::setNamespaceIndent(bool on) 0416 { 0417 m_options[QStringLiteral("IndentNamespaces")] = on; 0418 m_engine.setNamespaceIndent(on); 0419 } 0420 0421 void AStyleFormatter::setPreprocessorIndent(bool on) 0422 { 0423 m_options[QStringLiteral("IndentPreprocessors")] = on; 0424 m_engine.setPreprocDefineIndent(on); 0425 } 0426 0427 void AStyleFormatter::setSwitchIndent(bool on) 0428 { 0429 m_options[QStringLiteral("IndentSwitches")] = on; 0430 m_engine.setSwitchIndent(on); 0431 } 0432 0433 void AStyleFormatter::setMaxInStatementIndentLength(int max) 0434 { 0435 m_options[QStringLiteral("MaxStatement")] = max; 0436 m_engine.setMaxInStatementIndentLength(max); 0437 } 0438 0439 void AStyleFormatter::setMinConditionalIndentLength(int min) 0440 { 0441 m_options[QStringLiteral("MinConditional")] = min; 0442 m_engine.setMinConditionalIndentOption(min); 0443 m_engine.setMinConditionalIndentLength(); 0444 } 0445 0446 void AStyleFormatter::setAfterParens(bool on) 0447 { 0448 m_options[QStringLiteral("AfterParens")] = on; 0449 m_engine.setAfterParenIndent(on); 0450 } 0451 0452 void AStyleFormatter::setContinuation(int n) 0453 { 0454 m_options[QStringLiteral("Continuation")] = n; 0455 m_engine.setContinuationIndentation(n); 0456 } 0457 0458 void AStyleFormatter::setBracketFormatMode(astyle::BraceMode mode) 0459 { 0460 switch (mode) { 0461 case astyle::NONE_MODE: 0462 m_options[QStringLiteral("Brackets")] = QString(); 0463 break; 0464 case astyle::ATTACH_MODE: 0465 m_options[QStringLiteral("Brackets")] = QStringLiteral("Attach"); 0466 break; 0467 case astyle::BREAK_MODE: 0468 m_options[QStringLiteral("Brackets")] = QStringLiteral("Break"); 0469 break; 0470 case astyle::LINUX_MODE: 0471 m_options[QStringLiteral("Brackets")] = QStringLiteral("Linux"); 0472 break; 0473 case astyle::RUN_IN_MODE: 0474 m_options[QStringLiteral("Brackets")] = QStringLiteral("RunInMode"); 0475 break; 0476 } 0477 m_engine.setBraceFormatMode(mode); 0478 } 0479 0480 void AStyleFormatter::setBreakClosingHeaderBracketsMode(bool state) 0481 { 0482 m_options[QStringLiteral("BracketsCloseHeaders")] = state; 0483 m_engine.setBreakClosingHeaderBracketsMode(state); 0484 } 0485 0486 void AStyleFormatter::setAddBracesMode(bool state) 0487 { 0488 m_options[AStyleOptionKey::bracesAdd()] = state; 0489 m_engine.setAddBracesMode(state); 0490 } 0491 0492 void AStyleFormatter::setBreakBlocksMode(bool state) 0493 { 0494 m_options[QStringLiteral("BlockBreak")] = state; 0495 m_engine.setBreakBlocksMode(state); 0496 } 0497 0498 void AStyleFormatter::setBreakElseIfsMode(bool state) 0499 { 0500 m_options[QStringLiteral("BlockIfElse")] = state; 0501 m_engine.setBreakElseIfsMode(state); 0502 } 0503 0504 void AStyleFormatter::setBreakClosingHeaderBlocksMode(bool state) 0505 { 0506 m_options[QStringLiteral("BlockBreakAll")] = state; 0507 m_engine.setBreakClosingHeaderBlocksMode(state); 0508 } 0509 0510 void AStyleFormatter::setOperatorPaddingMode(bool mode) 0511 { 0512 m_options[QStringLiteral("PadOperators")] = mode; 0513 m_engine.setOperatorPaddingMode(mode); 0514 } 0515 0516 void AStyleFormatter::setParensOutsidePaddingMode(bool mode) 0517 { 0518 m_options[QStringLiteral("PadParenthesesOut")] = mode; 0519 m_engine.setParensOutsidePaddingMode(mode); 0520 } 0521 0522 void AStyleFormatter::setParensInsidePaddingMode(bool mode) 0523 { 0524 m_options[QStringLiteral("PadParenthesesIn")] = mode; 0525 m_engine.setParensInsidePaddingMode(mode); 0526 } 0527 0528 void AStyleFormatter::setParensHeaderPaddingMode(bool mode) { 0529 m_options[QStringLiteral("PadParenthesesHeader")] = mode; 0530 m_engine.setParensHeaderPaddingMode(mode); 0531 } 0532 0533 void AStyleFormatter::setParensUnPaddingMode(bool state) 0534 { 0535 m_options[QStringLiteral("PadParenthesesUn")] = state; 0536 m_engine.setParensUnPaddingMode(state); 0537 } 0538 0539 void AStyleFormatter::setBreakOneLineBlocksMode(bool state) 0540 { 0541 m_options[QStringLiteral("KeepBlocks")] = !state; 0542 m_engine.setBreakOneLineBlocksMode(state); 0543 } 0544 0545 void AStyleFormatter::setBreakOneLineStatementsMode(bool state) 0546 { 0547 m_options[QStringLiteral("KeepStatements")] = !state; 0548 m_engine.setBreakOneLineStatementsMode(state); 0549 } 0550 0551 void AStyleFormatter::setPointerAlignment(astyle::PointerAlign alignment) 0552 { 0553 switch (alignment) { 0554 case astyle::PTR_ALIGN_NONE: 0555 m_options[QStringLiteral("PointerAlign")] = QStringLiteral("None"); 0556 break; 0557 case astyle::PTR_ALIGN_NAME: 0558 m_options[QStringLiteral("PointerAlign")] = QStringLiteral("Name"); 0559 break; 0560 case astyle::PTR_ALIGN_MIDDLE: 0561 m_options[QStringLiteral("PointerAlign")] = QStringLiteral("Middle"); 0562 break; 0563 case astyle::PTR_ALIGN_TYPE: 0564 m_options[QStringLiteral("PointerAlign")] = QStringLiteral("Type"); 0565 break; 0566 } 0567 m_engine.setPointerAlignment(alignment); 0568 }