[Uml-devel] kdesdk/umbrello/umbrello

Brian Thomas thomas at mail630.gsfc.nasa.gov
Sat Oct 25 15:56:31 UTC 2003


CVS commit by thomas: 

added getNewEditorline, get end/start line methods for codeeditor


  M +28 -0     textblock.cpp   1.7
  M +24 -0     textblock.h   1.5


--- kdesdk/umbrello/umbrello/textblock.h  #1.4:1.5
@@ -134,4 +134,10 @@ public:
                                       bool alwaysAddBreak = true, bool lastLineHasBreak = true);
 
+        /** UnFormat a long text string. Typically, this means removing
+         *  the indentaion (linePrefix) and/or newline chars from each line.
+         *  If an indentation isnt specified, then the current indentation is used.
+         */
+        virtual QString unformatText ( const QString & text, const QString & indent = "");
+
         /**
          * @return      QString
@@ -171,4 +177,22 @@ public:
          */
         virtual void setAttributesFromObject (TextBlock * obj);
+
+        /** Used by the CodeEditor. It provides it with an appropriate
+         * starting string for a new line of text within the given textblock
+         * (for example a string with the proper indentation).
+         * If the indentation amount is '0' the current indentationString will
+         * be used.
+         */
+        virtual QString getNewEditorLine( int indentAmount = 0 );
+
+        /** Ush. These are terrifically bad and must one day go away. 
+         * Both methods indicate the range of lines in this textblock 
+         * which may be edited by the codeeditor (assuming that any are
+         * actually editable). The default case is no lines are editable. 
+         * The line numbering starts with '0' and a '-1' means no line
+         * qualifies.
+         */
+        virtual int firstEditableLine();
+        virtual int lastEditableLine();
 
 protected:

--- kdesdk/umbrello/umbrello/textblock.cpp  #1.6:1.7
@@ -160,4 +160,32 @@ QString TextBlock::getIndentationString 
 //  
 
+/** Ush. These are terrifically bad and must one day go away.
+ * Both methods indicate the range of lines in this textblock
+ * which may be edited by the codeeditor (assuming that any are
+ * actually editable). The default case is no lines are editable.
+ * The line numbering starts with '0' and a '-1' means no line
+ * qualifies.
+ */
+int TextBlock::firstEditableLine() { return 0; }
+int TextBlock::lastEditableLine() { return 0; }
+
+QString TextBlock::getNewEditorLine ( int amount ) {
+        return getIndentationString(amount);
+}
+
+// will remove indenation from this text block.
+QString TextBlock::unformatText ( const QString & text, const QString & indent )
+{
+        QString output = text;
+        QString myIndent = indent;
+        if(myIndent.isEmpty())
+                myIndent = getIndentationString();
+
+        if(!output.isEmpty())
+                output.remove(QRegExp("^"+myIndent)); 
+
+        return output;
+}
+
 void TextBlock::release () {
         this->deleteLater();






More information about the umbrello-devel mailing list