Commit cad28844 authored by Girish Ramakrishnan's avatar Girish Ramakrishnan

SVN_SILENT: Fix coding style

Somehow flake/ got left out.

svn path=/trunk/koffice/; revision=865831
parent 49c5f68b
......@@ -45,14 +45,14 @@ public:
KoSnapGuide * snapGuide;
};
KoCanvasBase::KoCanvasBase( KoShapeControllerBase * shapeControllerBase )
: d(new Private())
KoCanvasBase::KoCanvasBase(KoShapeControllerBase * shapeControllerBase)
: d(new Private())
{
KConfigGroup cfg( KGlobal::config()->group("canvas") );
KConfigGroup cfg(KGlobal::config()->group("canvas"));
d->isAntialiased = cfg.readEntry("antialiasing", true);
d->resourceProvider = new KoCanvasResourceProvider(0);
d->shapeController = new KoShapeController( this, shapeControllerBase );
d->snapGuide = new KoSnapGuide( this );
d->shapeController = new KoShapeController(this, shapeControllerBase);
d->snapGuide = new KoSnapGuide(this);
}
KoCanvasBase::~KoCanvasBase()
......
......@@ -50,7 +50,8 @@ class KoGuidesData;
* should implement. Flake tools know about the canvas, so they can
* do things like scroll, redraw, set a cursor etc.
*/
class FLAKE_EXPORT KoCanvasBase {
class FLAKE_EXPORT KoCanvasBase
{
public:
......@@ -59,7 +60,7 @@ public:
* @param shapeControllerBase the implementation of the shapeController that the
* application provides to allow shapes to be added in multiple views.
*/
explicit KoCanvasBase( KoShapeControllerBase * shapeControllerBase );
explicit KoCanvasBase(KoShapeControllerBase * shapeControllerBase);
virtual ~KoCanvasBase();
public:
......@@ -144,7 +145,9 @@ public:
* By default the origin of the canvas widget and the position of the
* document origin are coincident, thus an empty point is returned.
*/
virtual QPoint documentOrigin() const { return QPoint(0,0); }
virtual QPoint documentOrigin() const {
return QPoint(0, 0);
}
/**
* This method should somehow call QWidget::updateMicroFocus() on the canvas widget.
......
This diff is collapsed.
......@@ -54,7 +54,8 @@ class KoCanvasBase;
* bottom? Now it's one config setting.
*
*/
class FLAKE_EXPORT KoCanvasController : public QAbstractScrollArea {
class FLAKE_EXPORT KoCanvasController : public QAbstractScrollArea
{
Q_OBJECT
public:
/// An enum to alter the positioning and size of the canvas insize the canvas controller
......@@ -75,7 +76,7 @@ public:
/**
* Reimplemented from QAbstractScrollArea.
*/
void scrollContentsBy ( int dx, int dy );
void scrollContentsBy(int dx, int dy);
/**
* Set the shadow option -- by default the canvas controller draws
......@@ -84,7 +85,7 @@ public:
*
* @param drawShadow if true, the shadow is drawn, if false, not
*/
void setDrawShadow( bool drawShadow );
void setDrawShadow(bool drawShadow);
/**
* Set the new canvas to be shown as a child
......@@ -133,7 +134,7 @@ public:
* Sets the how the canvas behaves if the zoomed document becomes smaller than the viewport.
* @param mode the new canvas mode, CanvasMode::Centered is the default value
*/
void setCanvasMode( CanvasMode mode );
void setCanvasMode(CanvasMode mode);
/// Returns the current canvas mode
CanvasMode canvasMode() const;
......@@ -150,7 +151,7 @@ public:
* @param rect the rectangle to make visible
* @param smooth if true the viewport translation will make be just enough to ensure visibility, no more.
*/
void ensureVisible( const QRectF &rect, bool smooth = false );
void ensureVisible(const QRectF &rect, bool smooth = false);
/**
* @brief Scrolls the content of the canvas so that the given shape is visible.
......@@ -159,7 +160,7 @@ public:
*
* @param shape the shape to make visible
*/
void ensureVisible( KoShape *shape );
void ensureVisible(KoShape *shape);
/**
* will cause the toolOptionWidgetsChanged to be emitted and all
......@@ -197,7 +198,7 @@ public:
* @param center the position to zoom around
* @param zoom the zoom to apply
*/
void zoomBy(const QPoint &center, qreal zoom );
void zoomBy(const QPoint &center, qreal zoom);
/**
* @brief zoom so that rect is exactly visible (as close as possible)
......@@ -224,7 +225,7 @@ public:
* Sets the preferred center point in pixels.
* @param viewPoint the new preferred center
*/
void setPreferredCenter( const QPoint &viewPoint );
void setPreferredCenter(const QPoint &viewPoint);
/// Returns the currently set preferred center point in pixels
QPoint preferredCenter() const;
......@@ -263,19 +264,19 @@ signals:
* Emitted when the cursor is moved over the canvas widget.
* @param pos the position in widget pixels.
*/
void canvasMousePositionChanged(const QPoint & pos );
void canvasMousePositionChanged(const QPoint & pos);
/**
* Emitted when the cursor is moved over the canvas widget.
* @param pos the position in document coordinates.
*/
void documentMousePositionChanged(const QPointF & pos );
void documentMousePositionChanged(const QPointF & pos);
/**
* Emitted when the entire controller size changes
* @param size the size in widget pixels.
*/
void sizeChanged(const QSize & size );
void sizeChanged(const QSize & size);
/**
* Emit the new tool option widgets to be used with this canvas.
......@@ -288,7 +289,7 @@ signals:
* @param point the new top-left point from which the document should
* be drawn.
*/
void moveDocumentOffset( const QPoint &point );
void moveDocumentOffset(const QPoint &point);
/**
* Emitted when zoomTo have calculated a factor by which the zoom should change,
......@@ -297,7 +298,7 @@ signals:
*
* @param factor by how much the zoom needs to change.
*/
void zoomBy( const qreal factor );
void zoomBy(const qreal factor);
public slots:
......@@ -308,14 +309,14 @@ public slots:
* @param recalculateCenter if true the offset in the document we center on after calling
* recenterPreferred() will be recalculated for the new document size so the visual offset stays the same.
*/
void setDocumentSize( const QSize &newSize, bool recalculateCenter = true);
void setDocumentSize(const QSize &newSize, bool recalculateCenter = true);
/**
* Starts adding a new guide line. The guides tool is activated
* which then handles placing the new guide line according to the
* mouse movement.
*/
void addGuideLine( Qt::Orientation orientation, int viewPosition );
void addGuideLine(Qt::Orientation orientation, int viewPosition);
protected slots:
......@@ -327,19 +328,19 @@ protected slots:
protected:
/// reimplemented from QWidget
virtual void paintEvent( QPaintEvent * event );
virtual void paintEvent(QPaintEvent * event);
/// reimplemented from QWidget
virtual void resizeEvent(QResizeEvent * resizeEvent);
/// reimplemented from QWidget
virtual void dragEnterEvent( QDragEnterEvent * event );
virtual void dragEnterEvent(QDragEnterEvent * event);
/// reimplemented from QWidget
virtual void dropEvent( QDropEvent *event );
virtual void dropEvent(QDropEvent *event);
/// reimplemented from QWidget
virtual void dragMoveEvent ( QDragMoveEvent *event );
virtual void dragMoveEvent(QDragMoveEvent *event);
/// reimplemented from QWidget
virtual void dragLeaveEvent( QDragLeaveEvent *event );
virtual void dragLeaveEvent(QDragLeaveEvent *event);
/// reimplemented from QWidget
virtual void wheelEvent( QWheelEvent *event );
virtual void wheelEvent(QWheelEvent *event);
/// reimplemented from QWidget
virtual void keyPressEvent(QKeyEvent *event);
......
This diff is collapsed.
......@@ -25,7 +25,8 @@
#include <QWidget>
class Viewport : public QWidget {
class Viewport : public QWidget
{
Q_OBJECT
public:
......@@ -33,30 +34,32 @@ public:
Viewport(KoCanvasController *parent);
~Viewport() {}
void setCanvas( QWidget *canvas );
QWidget *canvas() { return m_canvas; }
void setDocumentSize( const QSize &size );
void setCanvas(QWidget *canvas);
QWidget *canvas() {
return m_canvas;
}
void setDocumentSize(const QSize &size);
/**
* When true, a shadow is drawn around the canvas widet.
*/
void setDrawShadow( bool drawShadow );
void setDrawShadow(bool drawShadow);
public slots:
void documentOffsetMoved( const QPoint &);
void documentOffsetMoved(const QPoint &);
public:
void handleDragEnterEvent( QDragEnterEvent *event );
void handleDropEvent( QDropEvent *event );
void handleDragMoveEvent ( QDragMoveEvent *event );
void handleDragLeaveEvent( QDragLeaveEvent *event );
void handlePaintEvent( QPainter & gc, QPaintEvent *event );
void handleDragEnterEvent(QDragEnterEvent *event);
void handleDropEvent(QDropEvent *event);
void handleDragMoveEvent(QDragMoveEvent *event);
void handleDragLeaveEvent(QDragLeaveEvent *event);
void handlePaintEvent(QPainter & gc, QPaintEvent *event);
private:
QPointF correctPosition( const QPoint &point ) const;
void repaint( KoShape *shape );
QPointF correctPosition(const QPoint &point) const;
void repaint(KoShape *shape);
/**
Decides whether the containing canvas widget should be as
......
......@@ -22,7 +22,7 @@
#include <QVariant>
#include <KoColor.h> // Zut, do we want this? It's convenient, but
// also makes flake dependent on pigment. (BSAR)
// also makes flake dependent on pigment. (BSAR)
#include "KoShape.h"
class KoCanvasResourceProvider::Private
......@@ -32,11 +32,11 @@ public:
};
KoCanvasResourceProvider::KoCanvasResourceProvider(QObject * parent)
: QObject( parent ),
d( new Private() )
: QObject(parent),
d(new Private())
{
// initialize handle radius to a sane value
setHandleRadius( 3 );
setHandleRadius(3);
}
KoCanvasResourceProvider::~KoCanvasResourceProvider()
......@@ -44,110 +44,108 @@ KoCanvasResourceProvider::~KoCanvasResourceProvider()
delete d;
}
void KoCanvasResourceProvider::setResource( int key, const QVariant & value )
void KoCanvasResourceProvider::setResource(int key, const QVariant & value)
{
if ( d->resources.contains( key ) ) {
if (d->resources.contains(key)) {
d->resources[key] = value;
} else {
d->resources.insert(key, value);
}
else {
d->resources.insert( key, value );
}
emit resourceChanged( key, value );
emit resourceChanged(key, value);
}
QVariant KoCanvasResourceProvider::resource(int key)
{
if ( !d->resources.contains( key ) ) {
if (!d->resources.contains(key)) {
QVariant empty;
return empty;
}
else
return d->resources.value( key );
} else
return d->resources.value(key);
}
void KoCanvasResourceProvider::setResource( int key, const KoColor & color )
void KoCanvasResourceProvider::setResource(int key, const KoColor & color)
{
QVariant v;
v.setValue( color );
setResource( key, v );
v.setValue(color);
setResource(key, v);
}
void KoCanvasResourceProvider::setResource( int key, const KoID & id )
void KoCanvasResourceProvider::setResource(int key, const KoID & id)
{
QVariant v;
v.setValue( id );
setResource( key, v );
v.setValue(id);
setResource(key, v);
}
void KoCanvasResourceProvider::setResource( int key, KoShape* shape )
void KoCanvasResourceProvider::setResource(int key, KoShape* shape)
{
QVariant v;
v.setValue( shape );
setResource( key, v );
v.setValue(shape);
setResource(key, v);
}
KoColor KoCanvasResourceProvider::koColorResource( int key )
KoColor KoCanvasResourceProvider::koColorResource(int key)
{
if (! d->resources.contains(key)) {
KoColor empty;
return empty;
}
return resource( key ).value<KoColor>();
return resource(key).value<KoColor>();
}
void KoCanvasResourceProvider::setForegroundColor( const KoColor & color )
void KoCanvasResourceProvider::setForegroundColor(const KoColor & color)
{
setResource( KoCanvasResource::ForegroundColor, color );
setResource(KoCanvasResource::ForegroundColor, color);
}
KoColor KoCanvasResourceProvider::foregroundColor()
{
return koColorResource( KoCanvasResource::ForegroundColor );
return koColorResource(KoCanvasResource::ForegroundColor);
}
void KoCanvasResourceProvider::setBackgroundColor( const KoColor & color )
void KoCanvasResourceProvider::setBackgroundColor(const KoColor & color)
{
//QVariant v;
//v.setValue( color );
setResource( KoCanvasResource::BackgroundColor, color );
setResource(KoCanvasResource::BackgroundColor, color);
}
KoColor KoCanvasResourceProvider::backgroundColor()
{
return koColorResource( KoCanvasResource::BackgroundColor );
return koColorResource(KoCanvasResource::BackgroundColor);
}
KoID KoCanvasResourceProvider::koIDResource(int key)
{
return resource( key ).value<KoID>();
return resource(key).value<KoID>();
}
KoShape * KoCanvasResourceProvider::koShapeResource( int key )
KoShape * KoCanvasResourceProvider::koShapeResource(int key)
{
if (! d->resources.contains(key))
return 0;
return resource( key ).value<KoShape *>();
return resource(key).value<KoShape *>();
}
void KoCanvasResourceProvider::setHandleRadius( int handleRadius )
void KoCanvasResourceProvider::setHandleRadius(int handleRadius)
{
// do not allow arbitrary small handles
if ( handleRadius < 3 )
if (handleRadius < 3)
handleRadius = 3;
setResource( KoCanvasResource::HandleRadius, QVariant( handleRadius) );
setResource(KoCanvasResource::HandleRadius, QVariant(handleRadius));
}
int KoCanvasResourceProvider::handleRadius()
{
return resource( KoCanvasResource::HandleRadius ).toInt();
return resource(KoCanvasResource::HandleRadius).toInt();
}
void KoCanvasResourceProvider::setUnitChanged()
{
setResource( KoCanvasResource::Unit, true );
setResource(KoCanvasResource::Unit, true);
}
bool KoCanvasResourceProvider::boolResource(int key) const
......@@ -166,7 +164,7 @@ int KoCanvasResourceProvider::intResource(int key) const
qreal KoCanvasResourceProvider::doubleResource(int key) const
{
if(! d->resources.contains(key))
if (! d->resources.contains(key))
return 0.;
return d->resources[key].toDouble();
}
......@@ -200,7 +198,7 @@ void KoCanvasResourceProvider::clearResource(int key)
return;
d->resources.remove(key);
QVariant empty;
emit resourceChanged( key, empty );
emit resourceChanged(key, empty);
}
#include "KoCanvasResourceProvider.moc"
......@@ -36,31 +36,32 @@ class KoShape;
* properties, like current foreground color, current background
* color and more.
*/
namespace KoCanvasResource {
/**
* This enum holds identifiers to the resources that can be stored in here.
*/
enum CanvasResource {
ForegroundColor, ///< The active forground color selected for this canvas.
BackgroundColor, ///< The active background color selected for this canvas.
CompositeOperation,
CompositeOpacity,
HandleRadius, ///< The handle radius used for drawing handles of any kind
PageSize, ///< The size of the (current) page in postscript points.
DocumentIsLoading, ///< A boolean that is set to true while loading is happening.
Unit, ///< The unit of this canvas has changed
HotPosition, ///< The hot position has changed
CurrentPage, ///< The current page has changed
KarbonStart = 1000, ///< Base number for karbon specific values.
KexiStart = 2000, ///< Base number for kexi specific values.
KivioStart = 3000, ///< Base number for kivio specific values.
KPlatoStart = 4000, ///< Base number for kplato specific values.
KPresenterStart = 5000, ///< Base number for kpresenter specific values.
KritaStart = 6000, ///< Base number for krita specific values.
KSpreadStart = 7000, ///< Base number for kspread specific values.
KWordStart = 8000 ///< Base number for kword specific values.
};
namespace KoCanvasResource
{
/**
* This enum holds identifiers to the resources that can be stored in here.
*/
enum CanvasResource {
ForegroundColor, ///< The active forground color selected for this canvas.
BackgroundColor, ///< The active background color selected for this canvas.
CompositeOperation,
CompositeOpacity,
HandleRadius, ///< The handle radius used for drawing handles of any kind
PageSize, ///< The size of the (current) page in postscript points.
DocumentIsLoading, ///< A boolean that is set to true while loading is happening.
Unit, ///< The unit of this canvas has changed
HotPosition, ///< The hot position has changed
CurrentPage, ///< The current page has changed
KarbonStart = 1000, ///< Base number for karbon specific values.
KexiStart = 2000, ///< Base number for kexi specific values.
KivioStart = 3000, ///< Base number for kivio specific values.
KPlatoStart = 4000, ///< Base number for kplato specific values.
KPresenterStart = 5000, ///< Base number for kpresenter specific values.
KritaStart = 6000, ///< Base number for krita specific values.
KSpreadStart = 7000, ///< Base number for kspread specific values.
KWordStart = 8000 ///< Base number for kword specific values.
};
}
......@@ -70,7 +71,8 @@ namespace KoCanvasResource {
* color and more. All tools belonging to the current canvas are
* notified when a Resource changes (is set).
*/
class FLAKE_EXPORT KoCanvasResourceProvider : public QObject {
class FLAKE_EXPORT KoCanvasResourceProvider : public QObject
{
Q_OBJECT
......@@ -88,25 +90,25 @@ public:
* @param key the integer key, based on KoCanvasResource::CanvasResource
* @param value the new value for the key.
*/
void setResource( int key, const QVariant & value );
void setResource(int key, const QVariant & value);
/**
* Set a resource of type KoColor.
* @param key the integer key, based on KoCanvasResource::CanvasResource
* @param color the new value for the key.
*/
void setResource( int key, const KoColor & color );
void setResource(int key, const KoColor & color);
/**
* Set a resource of type KoId.
* @param key the integer key, based on KoCanvasResource::CanvasResource
* @param id the new value for the key.
*/
void setResource( int key, const KoID & id );
void setResource(int key, const KoID & id);
/**
* Set a resource of type KoShape*.
* @param key the integer key, based on KoCanvasResource::CanvasResource
* @param id the new value for the key.
*/
void setResource( int key, KoShape* shape );
void setResource(int key, KoShape* shape);
/**
* Returns a qvariant containing the specified resource or a standard one if the
......@@ -119,7 +121,7 @@ public:
* Set the foregroundColor resource.
* @param color the new foreground color
*/
void setForegroundColor( const KoColor & color );
void setForegroundColor(const KoColor & color);
/**