[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice
From:       Thomas Zander <zander () kde ! org>
Date:       2007-06-28 11:52:13
Message-ID: 1183031533.215157.24248.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 681271 by zander:

* Add api docs
* d-pointer the KoShapeLoadingContext
* inline a trivial static method


 M  +1 -0      libs/flake/KoPathControlPointMoveStrategy.h  
 M  +1 -1      libs/flake/KoShapeConfigWidgetBase.h  
 M  +1 -7      libs/flake/KoShapeConnection.cpp  
 M  +4 -12     libs/flake/KoShapeConnection.h  
 M  +14 -6     libs/flake/KoShapeLoadingContext.cpp  
 M  +12 -4     libs/flake/KoShapeLoadingContext.h  
 M  +6 -0      libs/flake/KoShapeManager.h  
 M  +7 -0      libs/flake/KoTool.h  
 M  +11 -0     libs/flake/KoZoomStrategy.h  
 M  +1 -0      libs/flake/KoZoomTool.h  
 M  +3 -0      libs/flake/commands/KoShapeTransformCommand.h  
 M  +3 -3      plugins/defaultTools/ConnectionTool.cpp  


--- trunk/koffice/libs/flake/KoPathControlPointMoveStrategy.h #681270:681271
@@ -30,6 +30,7 @@
 class KoPathTool;
 
 /**
+ * /internal
  * @brief Strategy for moving points of a path shape.
  */
 class KoPathControlPointMoveStrategy : public KoInteractionStrategy
--- trunk/koffice/libs/flake/KoShapeConfigWidgetBase.h #681270:681271
@@ -83,7 +83,7 @@
     }
 
 protected:
-    KoCanvasResourceProvider *m_resourceProvider;
+    KoCanvasResourceProvider *m_resourceProvider; ///< the resource provider with \
data for this canvas  };
 
 
--- trunk/koffice/libs/flake/KoShapeConnection.cpp #681270:681271
@@ -77,14 +77,8 @@
         b = converter.documentToView(d->endPoint);
 
     QPen pen(Qt::black);
-    paintConnection (painter, a, b, pen, StraightConnection);
-}
-
-void KoShapeConnection::paintConnection(QPainter& painter, const QPointF& \
                startPoint,
-					       const QPointF& endPoint, const QPen& pen,
-					       ConnectionType type) {    
     painter.setPen(pen);
-    painter.drawLine(startPoint, endPoint);
+    painter.drawLine(a, b);
 }
 
 KoShape *KoShapeConnection::shape1() const {
--- trunk/koffice/libs/flake/KoShapeConnection.h #681270:681271
@@ -44,10 +44,11 @@
 class FLAKE_EXPORT KoShapeConnection {
 public:
 
+    /// the visual type of connection
     enum ConnectionType {
-        StraightConnection,
-        MultiLineConnection,
-        CurvedConnection
+        StraightConnection,     ///< The connection is one straight (taut) line.
+        MultiLineConnection,    ///< The connection is build up of multiple straight \
lines. +        CurvedConnection        ///< The connection is build using bezier \
curves.  };
 
     /**
@@ -126,15 +127,6 @@
      * Return a bounding rectangle in which this connection is completely present.
      */
     QRectF boundingRect() const;
-    
-    /**
-     * Paints the connection of specified type
-     * @param startPoint Point in pt to start drawing from
-     * @param endPoint Point in pt to end drawing at
-     * @param type Type of connector to draw
-     */
-    static void paintConnection(QPainter& painter, const QPointF& startPoint,
-				const QPointF& endPoint, const QPen& pen, ConnectionType type);
 
 private:
     class Private;
--- trunk/koffice/libs/flake/KoShapeLoadingContext.cpp #681270:681271
@@ -19,33 +19,41 @@
 
 #include "KoShapeLoadingContext.h"
 
+class KoShapeLoadingContext::Private {
+public:
+    Private(KoOasisLoadingContext &c) : context(c) {}
+    KoOasisLoadingContext &context;
+    QMap<QString, KoShapeLayer*> layers;
+    QMap<QString, KoShape*> drawIds;
+};
+
 KoShapeLoadingContext::KoShapeLoadingContext( KoOasisLoadingContext & context )
-: m_context( context )
+: d( new Private(context))
 {
 }
 
 KoOasisLoadingContext & KoShapeLoadingContext::koLoadingContext()
 {
-    return m_context;
+    return d->context;
 }
 
 KoShapeLayer * KoShapeLoadingContext::layer( const QString & layerName )
 {
-   return m_layers.value( layerName, 0 ); 
+   return d->layers.value( layerName, 0 );
 }
 
 void KoShapeLoadingContext::addLayer( KoShapeLayer * layer, const QString & \
layerName )  {
-    m_layers[ layerName ] = layer;
+    d->layers[ layerName ] = layer;
 }
 
 void KoShapeLoadingContext::addShapeId( KoShape * shape, const QString & id )
 {
-    m_drawIds.insert( id, shape );
+    d->drawIds.insert( id, shape );
 }
 
 KoShape * KoShapeLoadingContext::shapeById( const QString & id )
 {
-   return m_drawIds.value( id, 0 ); 
+   return d->drawIds.value( id, 0 );
 }
 
--- trunk/koffice/libs/flake/KoShapeLoadingContext.h #681270:681271
@@ -30,13 +30,20 @@
 class KoShape;
 
 /**
- * Context passed to shapes during loading
+ * Context passed to shapes during loading.
+ * This class holds various variables as well as a context full of variables which \
all together + * form the context of a loading operation.
  */
 class FLAKE_EXPORT KoShapeLoadingContext
 {
 public:
+    /**
+     * constructor
+     * @param context the context created for generic ODF loading.
+     */
     KoShapeLoadingContext( KoOasisLoadingContext & context );
 
+    /// return the embedded loading context
     KoOasisLoadingContext & koLoadingContext();
 
     /// Returns layer referenced by given name
@@ -44,13 +51,14 @@
     /// Adds a new layer to be referenced by the given name later
     void addLayer( KoShapeLayer * layer, const QString & layerName );
 
+    /// register the id for a specific shape
     void addShapeId( KoShape * shape, const QString & id );
+    /// return the shape formerly registered using addShapeId()
     KoShape * shapeById( const QString & id );
 
 private:
-    KoOasisLoadingContext &m_context;
-    QMap<QString, KoShapeLayer*> m_layers;
-    QMap<QString, KoShape*> m_drawIds;
+    class Private;
+    Private * const d;
 };
 
 #endif /* KOSHAPELOADINGCONTEXT_H */
--- trunk/koffice/libs/flake/KoShapeManager.h #681270:681271
@@ -144,6 +144,12 @@
      */
     void addShapeConnection(KoShapeConnection *connection);
 
+    /**
+     * Switch to editing the shape that is at the position of the event.
+     * This method will check select a shape at the event position and switch to the \
default tool +     * for that shape, or switch to the default tool if there is no \
shape at the position. +     * @param event the event that holds the point where to \
look for a shape. +     */
     void suggestChangeTool(KoPointerEvent *event);
 
 private:
--- trunk/koffice/libs/flake/KoTool.h #681270:681271
@@ -172,6 +172,7 @@
      * Default implementation returns simple defaults, for tools that want to \
                provide
      * a more responsive text entry experience for CJK languages it would be good to \
                reimplemnt.
      * @param query specifies which property is queried.
+     * @param converter the view converter for the current canvas.
      */
     virtual QVariant inputMethodQuery(Qt::InputMethodQuery query, const \
KoViewConverter &converter) const;  
@@ -208,6 +209,12 @@
      */
     virtual void copy() const { }
 
+    /**
+     * Paste the clipboard selection.
+     * A tool typically has one or more shapes selected and pasting should do \
something meaningful +     * for this specific shape and tool combination.  Inserting \
text in a text tool, for example. +     * @return will return true if pasting \
succeeded. False if nothing happened. +     */
     virtual bool paste() { return false; }
 
     /**
--- trunk/koffice/libs/flake/KoZoomStrategy.h #681270:681271
@@ -25,10 +25,21 @@
 class KoCanvasController;
 class KoZoomTool;
 
+/**
+ * //internal
+ * This is a strategy for the KoZoomTool which will be used to do the actual zooming
+ */
 class KoZoomStrategy : public KoShapeRubberSelectStrategy {
 public:
+    /**
+     * constructor
+     * @param tool the parent tool this strategy is for
+     * @param controller the canvas controller that wraps the canvas the tool is \
acting on. +     * @param clicked the location (in documnet points) where the \
interaction starts. +     */
     KoZoomStrategy( KoZoomTool *tool, KoCanvasController *controller, const QPointF \
&clicked );  
+    /// Execute the zoom
     void finishInteraction( Qt::KeyboardModifiers modifiers );
 private:
     KoCanvasController *m_controller;
--- trunk/koffice/libs/flake/KoZoomTool.h #681270:681271
@@ -29,6 +29,7 @@
 class KoCanvasBase;
 class KoCanvasController;
 
+/// \internal
 class KoZoomTool : public KoInteractionTool
 {
 public:
--- trunk/koffice/libs/flake/commands/KoShapeTransformCommand.h #681270:681271
@@ -27,6 +27,9 @@
 
 class KoShape;
 
+/**
+ * A command to transform a selection of shapes with the same transformation.
+ */
 class FLAKE_EXPORT KoShapeTransformCommand : public QUndoCommand
 {
 public:
--- trunk/koffice/plugins/defaultTools/ConnectionTool.cpp #681270:681271
@@ -54,7 +54,7 @@
             painter.fillRect(QRectF(QPointF(point.x() - 2, point.y() -2) , QSizeF(4, \
4)), QBrush(Qt::red));  }
     }
-    
+
     if(m_startShape)
     {
         double x, y;
@@ -63,8 +63,8 @@
         matrix.scale(x, y);
         QPointF startPoint = \
matrix.map(m_startShape->connectors()[m_gluePointIndex]);  QPointF endPoint = \
                converter.documentToView (m_lastMousePos);
-        KoShapeConnection::paintConnection(painter, startPoint, endPoint, QPen \
                (Qt::black),
-                                            KoShapeConnection::StraightConnection);
+        painter.setPen(QPen(Qt::black)); // TODO make color configurable
+        painter.drawLine(startPoint, endPoint);
     }
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic