office-gobmx/svx/inc/svx/dialcontrol.hxx
Michael Meeks 0a063f3a36 re-base on ALv2 code. Includes:
Patch contributed by Christian Lippka
    impress212: #i113063# patch: dubios self assign in svx/source/dialog/framelink.cxx
    http://svn.apache.org/viewvc?view=revision&revision=1167619

    Patches contributed by Mathias Bauer
    gnumake4 work variously
    http://svn.apache.org/viewvc?view=revision&revision=1394707
    http://svn.apache.org/viewvc?view=revision&revision=1394326
    cws mba34issues01: #i117712#: fix several resource errors introduced by
    IAccessible2 implementation
    http://svn.apache.org/viewvc?view=revision&revision=1172343
    cws mba34issues01: #i117719#: use correct resource ID
    http://svn.apache.org/viewvc?view=revision&revision=1172351

    Patch contributed by Andre Fischer
    Do not add targets for junit tests when junit is disabled.
    http://svn.apache.org/viewvc?view=revision&revision=1241508

    Patches contributed by Armin Le-Grand
    #118804# corrected GraphicExporter behaviour on shortcut when pixel graphic is requested
    http://svn.apache.org/viewvc?view=revision&revision=1240195
    fix for #118525#: Using primitives for chart sub-geometry visualisation
    http://svn.apache.org/viewvc?view=revision&revision=1226879
    #118485# - Styles for OLEs are not saved.
    http://svn.apache.org/viewvc?view=revision&revision=1182166
    #118524: apply patch, followup fixes to 118485
    http://svn.apache.org/viewvc?view=revision&revision=1186077 13f79535-47bb-0310-9956-ffa450edef68

    Patch contributed by Regina Henschel
    linecap: Reintegrating finished LineCap feature
    http://svn.apache.org/viewvc?view=revision&revision=1232507

    Patch contributed by Wang Lei (leiw)
    #i118760# split the first table cell vertically, then undo&redo,
    the Presentation app will crash
    http://svn.apache.org/viewvc?view=revision&revision=1301361

cleanup globlmn hacks, undo dependent fixmes.
2012-11-27 12:55:10 +00:00

128 lines
4.7 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef SVX_DIALCONTROL_HXX
#define SVX_DIALCONTROL_HXX
#include <memory>
#include <vcl/ctrl.hxx>
#include <sfx2/itemconnect.hxx>
#include "svx/svxdllapi.h"
class NumericField;
namespace svx {
// ============================================================================
struct DialControl_Impl;
/** This control allows to input a rotation angle, visualized by a dial.
Usage: A single click sets a rotation angle rounded to steps of 15 degrees.
Dragging with the left mouse button sets an exact rotation angle. Pressing
the ESCAPE key during mouse drag cancels the operation and restores the old
state of the control.
It is possible to link a numeric field to this control using the function
SetLinkedField(). The DialControl will take full control of this numeric
field:
- Sets the rotation angle to the numeric field in mouse operations.
- Shows the value entered/modified in the numeric field.
- Enables/disables/shows/hides the field according to own state changes.
*/
class SVX_DLLPUBLIC DialControl : public Control
{
public:
explicit DialControl( Window* pParent, const ResId& rResId );
virtual ~DialControl();
virtual void Paint( const Rectangle& rRect );
virtual void StateChanged( StateChangedType nStateChange );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseMove( const MouseEvent& rMEvt );
virtual void MouseButtonUp( const MouseEvent& rMEvt );
virtual void KeyInput( const KeyEvent& rKEvt );
virtual void LoseFocus();
/** Returns true, if the control is not in "don't care" state. */
bool HasRotation() const;
/** Sets the control to "don't care" state. */
void SetNoRotation();
/** Returns the current rotation angle in 1/100 degrees. */
sal_Int32 GetRotation() const;
/** Sets the rotation to the passed value (in 1/100 degrees). */
void SetRotation( sal_Int32 nAngle );
/** Links the passed numeric edit field to the control (bi-directional). */
void SetLinkedField( NumericField* pField );
/** Save value for later comparison */
void SaveValue();
/** Compare value with the saved value */
bool IsValueModified();
private:
void Init( const Size& rWinSize, const Font& rWinFont );
void Init( const Size& rWinSize );
void InvalidateControl();
void ImplSetRotation( sal_Int32 nAngle, bool bBroadcast );
void ImplSetFieldLink( const Link& rLink );
void HandleMouseEvent( const Point& rPos, bool bInitial );
void HandleEscapeEvent();
DECL_LINK( LinkedFieldModifyHdl, NumericField* );
std::auto_ptr< DialControl_Impl > mpImpl;
};
// ============================================================================
/** Wrapper for usage of a DialControl in item connections. */
class SVX_DLLPUBLIC DialControlWrapper : public sfx::SingleControlWrapper< DialControl, sal_Int32 >
{
public:
explicit DialControlWrapper( DialControl& rDial );
virtual bool IsControlDontKnow() const;
virtual void SetControlDontKnow( bool bSet );
virtual sal_Int32 GetControlValue() const;
virtual void SetControlValue( sal_Int32 nValue );
};
// ----------------------------------------------------------------------------
/** An item<->control connection for a DialControl. */
typedef sfx::ItemControlConnection< sfx::Int32ItemWrapper, DialControlWrapper > DialControlConnection;
// ============================================================================
} // namespace svx
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */