Converts document indentation to tabs.

        :return: Method success.
        :rtype: bool

def convert_indentation_to_tabs(self):
        """
        Converts document indentation to tabs.

        :return: Method success.
        :rtype: bool
        """

        cursor = self.textCursor()

        block = self.document().findBlockByLineNumber(0)
        while block.isValid():
            cursor.setPosition(block.position())
            search = re.match(r"^ +", block.text())
            if search:
                cursor.movePosition(QTextCursor.StartOfBlock, QTextCursor.MoveAnchor)
                searchLength = len(search.group(0))
                foundations.common.repeat(
                    lambda: cursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor), searchLength)
                cursor.insertText(self.__indent_marker * (searchLength / self.__indent_width))
            block = block.next()
        return True