public void IndentLine(ICSharpCode.AvalonEdit.Document.TextDocument document, DocumentLine line, bool TakeCaret)
		{
			if (line.PreviousLine == null)
				return;

			if (!DSettings.Instance.EnableSmartIndentation)
			{
				var t = document.GetText(line);
				int c=0;
				for(;c<t.Length && (t[c] == ' ' || t[c] == '\t');c++);

				RawlyIndentLine(t.Length==0 ? string.Empty : t.Substring(0, c+1), document, line);

				return;
			}

			var tr=document.CreateReader();
			var newIndent = D_Parser.Formatting.Indent.IndentEngineWrapper.CalculateIndent(tr, line.LineNumber, dEditor.Editor.Options.ConvertTabsToSpaces, dEditor.Editor.Options.IndentationSize);
			tr.Close();

			RawlyIndentLine(newIndent, document, line);
		}
		protected string GetIndentation(ICSharpCode.TextEditor.Document.IDocument document, int line)
		{
			string lineText = document.GetText(document.GetLineSegment(line));
			return lineText.Substring(0, lineText.Length - lineText.TrimStart().Length);
		}